|
@@ -1,39 +1,73 @@
|
|
|
<template>
|
|
|
<div id="index">
|
|
|
- <list-frame :title="mainTitle" @query="search" :total="total" :needFilter="false" :needAdd="false" @add="$router.push({ path: '/dept/detail' })">
|
|
|
- <data-table :fields="fields" :data="list" :opera="opera" @edit="toEdit" @update="toUpdate"></data-table>
|
|
|
+ <list-frame :title="mainTitle" @query="search" :total="total" :needFilter="false" :needAdd="false">
|
|
|
+ <data-table :fields="fields" :data="list" :opera="opera" @update="toUpdate"></data-table>
|
|
|
</list-frame>
|
|
|
+ <el-dialog title="上传名单" :visible.sync="dialog" @close="toClose" v-if="dialog">
|
|
|
+ <data-form :data="form" :fields="dataFields" :needSave="false">
|
|
|
+ <template #custom="{ item, form, fieldChange }">
|
|
|
+ <template v-if="item.model === 'filepath'">
|
|
|
+ <upload
|
|
|
+ url="/files/train/upload"
|
|
|
+ :limit="1"
|
|
|
+ :isBtn="true"
|
|
|
+ :showList="true"
|
|
|
+ accept=".xls,.xlsx"
|
|
|
+ listType="text"
|
|
|
+ tip="请上传文件格式为xls或xlsx的excel表格"
|
|
|
+ @upload="uploadSuccess"
|
|
|
+ ></upload>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ <template #submit>
|
|
|
+ <el-row type="flex" justify="middle">
|
|
|
+ <el-col :span="1">
|
|
|
+ <el-button @click="cerUpdate" type="primary">确认上传</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </template>
|
|
|
+ </data-form>
|
|
|
+ <data-table :fields="tableFields" :data="errList" v-if="errList.length > 0" :height="300"></data-table>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import listFrame from '@frame/layout/admin/list-frame';
|
|
|
import dataTable from '@frame/components/data-table';
|
|
|
+import dataForm from '@frame/components/form';
|
|
|
+import upload from '@frame/components/upload';
|
|
|
import { createNamespacedHelpers } from 'vuex';
|
|
|
-const { mapActions } = createNamespacedHelpers('trainplan');
|
|
|
const { mapActions: schPlan } = createNamespacedHelpers('schPlan');
|
|
|
+const { mapActions } = createNamespacedHelpers('schimport');
|
|
|
|
|
|
export default {
|
|
|
- metaInfo: { title: '上班学生管理' },
|
|
|
+ metaInfo: { title: '上报学生' },
|
|
|
name: 'index',
|
|
|
props: {},
|
|
|
- components: { listFrame, dataTable },
|
|
|
+ components: { listFrame, dataTable, dataForm, upload },
|
|
|
data: () => ({
|
|
|
info: {},
|
|
|
+ dialog: false,
|
|
|
opera: [
|
|
|
{
|
|
|
- label: '添加',
|
|
|
- icon: 'el-icon-date',
|
|
|
- method: 'edit',
|
|
|
+ label: '上报时间',
|
|
|
+ icon: 'el-icon-document-add',
|
|
|
+ method: 'update',
|
|
|
},
|
|
|
- // {
|
|
|
- // label: '上报时间',
|
|
|
- // icon: 'el-icon-document',
|
|
|
- // method: 'update',
|
|
|
- // },
|
|
|
],
|
|
|
- fields: [{ label: '期数', prop: 'newTermnum' }],
|
|
|
- list: [{ term: {} }],
|
|
|
+ fields: [
|
|
|
+ { label: '期数', prop: 'termnum' },
|
|
|
+ { label: '类型', prop: 'type', format: i => (i === '0' ? '普通班级' : '特殊班级') },
|
|
|
+ ],
|
|
|
+ tableFields: [
|
|
|
+ { label: '姓名', prop: 'name' },
|
|
|
+ { label: '错误', prop: 'msg' },
|
|
|
+ ],
|
|
|
+ list: [],
|
|
|
+ errList: [],
|
|
|
+ form: {},
|
|
|
+ dataFields: [{ label: '上传学生名单', model: 'filepath', custom: true }],
|
|
|
total: 0,
|
|
|
}),
|
|
|
created() {
|
|
@@ -52,48 +86,55 @@ export default {
|
|
|
let main = meta.title || '';
|
|
|
return main;
|
|
|
},
|
|
|
+ id() {
|
|
|
+ return this.$route.query.id;
|
|
|
+ },
|
|
|
},
|
|
|
methods: {
|
|
|
- ...mapActions(['query', 'delete']),
|
|
|
+ ...mapActions(['create']),
|
|
|
...schPlan({
|
|
|
schQuery: 'query',
|
|
|
- schPlanCreate: 'create',
|
|
|
- schPlanUpdate: 'update',
|
|
|
}),
|
|
|
async search({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
- const res = await this.schQuery({ planid: this.info.id, schid: '99991', skip, limit, ...info });
|
|
|
+ const res = await this.schQuery({ planid: this.id, schid: '99991', skip, limit, ...info });
|
|
|
if (this.$checkRes(res)) {
|
|
|
- // console.log(res.data[0]);
|
|
|
if (res.data.length > 0) {
|
|
|
- for (let val of res.data) {
|
|
|
- console.log(val.term);
|
|
|
- for (let lets of val.term) {
|
|
|
- console.log(lets);
|
|
|
- val.newTermnum = lets.termnum;
|
|
|
- }
|
|
|
- }
|
|
|
- console.log(res.data);
|
|
|
-
|
|
|
- this.$set(this, `list`, res.data);
|
|
|
- // console.log(res.data);
|
|
|
-
|
|
|
- this.$set(this, `total`, res.total);
|
|
|
-
|
|
|
- this.$set(this, `list`, res.data);
|
|
|
+ let { term, ...others } = res.data[0];
|
|
|
+ this.$set(this, `list`, term);
|
|
|
+ this.$set(this, `info`, others);
|
|
|
}
|
|
|
- console.log(res.data.length);
|
|
|
- console.log(res.data);
|
|
|
}
|
|
|
},
|
|
|
- toEdit({ data }) {
|
|
|
- //TODO 该把详情做成什么样的比较好,是和大日历在一起选择还是其他形式
|
|
|
- this.$router.push({ path: '/scganli/detail' });
|
|
|
+ uploadSuccess({ data }) {
|
|
|
+ this.$set(this.form, `filepath`, data.uri);
|
|
|
},
|
|
|
-
|
|
|
async toUpdate({ data }) {
|
|
|
- // const res = await this.delete(data.id);
|
|
|
- // this.$checkRes(res, '删除成功', '删除失败');
|
|
|
- // this.search();
|
|
|
+ let { termid } = data;
|
|
|
+ this.form.termid = termid;
|
|
|
+ this.dialog = true;
|
|
|
+ },
|
|
|
+ async cerUpdate() {
|
|
|
+ let form = JSON.parse(JSON.stringify(this.form));
|
|
|
+ form.schid = '99991';
|
|
|
+ let res = await this.create(form);
|
|
|
+ let err = () => this.$message.error('上报失败');
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ let upRes = res.data;
|
|
|
+ if (upRes.errorcode === '1') {
|
|
|
+ err();
|
|
|
+ this.$set(this, `errList`, upRes.errormsg);
|
|
|
+ } else {
|
|
|
+ this.dialog = false;
|
|
|
+ this.$message.success('上报成功');
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ err();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ toClose() {
|
|
|
+ this.form = {};
|
|
|
+ this.dialog = false;
|
|
|
+ this.errList = [];
|
|
|
},
|
|
|
},
|
|
|
};
|