|
@@ -4,16 +4,24 @@
|
|
|
<!-- <data-table ref="table" :fields="fields" :data="list" :opera="opera" :total="total" @edit="toEdit" @query="search"></data-table> -->
|
|
|
<el-form :model="form" :inline="true" size="mini">
|
|
|
<el-form-item label="学校名称">
|
|
|
- <el-input v-model="form.name" clearable></el-input>
|
|
|
+ <el-input v-model="form.name" placeholder="请输入学校名称" clearable></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="学校代码">
|
|
|
- <el-input v-model="form.code" clearable></el-input>
|
|
|
+ <el-input v-model="form.code" placeholder="请输入学校代码" clearable></el-input>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<el-row type="flex" align="middle" justify="end" class="btn_bar">
|
|
|
<el-col :span="2">
|
|
|
<el-button type="primary" @click="handleSave" size="mini">保存人数安排</el-button>
|
|
|
</el-col>
|
|
|
+ <el-col :span="3">
|
|
|
+ <el-button type="primary" @click="downloadTemplate" size="mini">下载学校计划人数模板</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="3">
|
|
|
+ <el-upload action="/files/train/school/upload" :show-file-list="false" :on-success="handleSuccess" :on-error="handleError" multiple accept=".xlsx">
|
|
|
+ <el-button size="mini" type="primary">选择学校计划人数文件</el-button>
|
|
|
+ </el-upload>
|
|
|
+ </el-col>
|
|
|
</el-row>
|
|
|
<el-table :data="getList()" border stripe size="mini" :summary-method="getSummaries" show-summary>
|
|
|
<el-table-column align="center" label="学校" prop="name"></el-table-column>
|
|
@@ -83,7 +91,7 @@ export default {
|
|
|
methods: {
|
|
|
...plan({ getPlan: 'fetch', updatePlan: 'update' }),
|
|
|
...school(['query', 'findSchool']),
|
|
|
- ...util({ modelFetch: 'fetch' }),
|
|
|
+ ...util({ modelFetch: 'fetch', schoolImport: 'schoolImport', schoolDownload: 'schoolDownload' }),
|
|
|
...classtype({ getClassType: 'query' }),
|
|
|
async trainTemplage() {
|
|
|
let planid = _.get(this.defaultOption, 'planid');
|
|
@@ -227,6 +235,25 @@ export default {
|
|
|
return { affix: _.head(arr), value: _.last(arr) };
|
|
|
}
|
|
|
},
|
|
|
+ //上传成功
|
|
|
+ async handleSuccess(res, file) {
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ let r = await this.schoolImport(res.uri);
|
|
|
+ if (this.$checkRes(r)) {
|
|
|
+ this.$set(this.plan, 'school', r.data.school);
|
|
|
+ await this.toSetData();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //上传失败
|
|
|
+ handleError(err, file) {
|
|
|
+ this.$message.error('请重新上传或联系开发人员');
|
|
|
+ },
|
|
|
+ // 下载模板
|
|
|
+ async downloadTemplate() {
|
|
|
+ const res = await this.schoolDownload();
|
|
|
+ if (this.$checkRes(res)) window.open(res.data);
|
|
|
+ },
|
|
|
},
|
|
|
watch: {
|
|
|
defaultOption: {
|