|
|
@@ -54,19 +54,7 @@
|
|
|
|
|
|
</avue-crud>
|
|
|
|
|
|
- <el-dialog title="技术人员花名册导入"
|
|
|
- append-to-body
|
|
|
- :visible.sync="excelBox"
|
|
|
- width="555px"
|
|
|
- >
|
|
|
- <avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter">
|
|
|
- <template slot="excelTemplate">
|
|
|
- <el-button type="primary" @click="handleTemplate">
|
|
|
- 点击下载<i class="el-icon-download el-icon--right"></i>
|
|
|
- </el-button>
|
|
|
- </template>
|
|
|
- </avue-form>
|
|
|
- </el-dialog>
|
|
|
+ <upload-excel-dialog ref="uploadExcelDialog" :uploadAfter="uploadAfter"/>
|
|
|
</basic-container>
|
|
|
</template>
|
|
|
|
|
|
@@ -74,9 +62,8 @@
|
|
|
import { getLastMonthData } from "@/api/technicianRoster";
|
|
|
import {exportBloByPost} from "@/api/common";
|
|
|
import YearMonthSelect from "@/components/year-month-select";
|
|
|
+import UploadExcelDialog from "@/components/upload-excel-dialog";
|
|
|
import moment from "moment";
|
|
|
-import NProgress from 'nprogress';
|
|
|
-import 'nprogress/nprogress.css';
|
|
|
import {getToken} from "@/util/auth";
|
|
|
import {downloadXls} from "@/util/util";
|
|
|
|
|
|
@@ -84,15 +71,13 @@ import {downloadXls} from "@/util/util";
|
|
|
export default window.$crudCommon({
|
|
|
components: {
|
|
|
YearMonthSelect,
|
|
|
+ UploadExcelDialog,
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
params: {
|
|
|
yearAndMonth: moment(new Date()).format('YYYYMM'),
|
|
|
},
|
|
|
- excelBox: false,
|
|
|
- excelForm: {},
|
|
|
-
|
|
|
isSelAnnual: false, // 是否选择全年
|
|
|
};
|
|
|
},
|
|
|
@@ -116,43 +101,6 @@ export default window.$crudCommon({
|
|
|
delBtn: !this.isSelAnnual,
|
|
|
};
|
|
|
},
|
|
|
- excelOption() {
|
|
|
- return {
|
|
|
- submitBtn: false,
|
|
|
- emptyBtn: false,
|
|
|
- column: [
|
|
|
- {
|
|
|
- label: '上传月份',
|
|
|
- prop: 'yearAndMonth',
|
|
|
- type: 'input',
|
|
|
- span: 24,
|
|
|
- disabled: true,
|
|
|
- },
|
|
|
- {
|
|
|
- label: '模板上传',
|
|
|
- prop: 'excelFile',
|
|
|
- type: 'upload',
|
|
|
- drag: true,
|
|
|
- loadText: '模板上传中,请稍等',
|
|
|
- span: 24,
|
|
|
- propsHttp: {
|
|
|
- res: 'data'
|
|
|
- },
|
|
|
- data: {
|
|
|
- yearAndMonth: this.params.yearAndMonth,
|
|
|
- },
|
|
|
- tip: '请上传 .xls,.xlsx 标准格式文件',
|
|
|
- action: '/api/kd-scientific/technician/import'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '模板下载',
|
|
|
- prop: 'excelTemplate',
|
|
|
- formslot: true,
|
|
|
- span: 24,
|
|
|
- }
|
|
|
- ]
|
|
|
- }
|
|
|
- },
|
|
|
},
|
|
|
methods: {
|
|
|
validCustom() {
|
|
|
@@ -177,33 +125,20 @@ export default window.$crudCommon({
|
|
|
callback && callback();
|
|
|
},
|
|
|
handleImport() {
|
|
|
- this.excelBox = true;
|
|
|
- this.excelForm.yearAndMonth = this.params.yearAndMonth;
|
|
|
+ let excelParams = { yearAndMonth: this.params.yearAndMonth };
|
|
|
+ this.$refs.uploadExcelDialog.open('/api/kd-scientific/technician/import', excelParams);
|
|
|
},
|
|
|
- uploadAfter(res, done, loading, column) {
|
|
|
- this.excelBox = false;
|
|
|
+ uploadAfter() {
|
|
|
this.page.currentPage = 1;
|
|
|
this.getList(this.page);
|
|
|
- done();
|
|
|
},
|
|
|
handleExport() {
|
|
|
- this.$confirm("是否导出当前月份技术人员花名册?", "提示", {
|
|
|
- confirmButtonText: "确定",
|
|
|
- cancelButtonText: "取消",
|
|
|
- type: "warning"
|
|
|
- }).then(() => {
|
|
|
- NProgress.start();
|
|
|
- exportBloByPost(`/api/kd-scientific/technician/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
|
|
|
- downloadXls(res.data, `技术人员花名册${this.params.yearAndMonth}.xlsx`);
|
|
|
- NProgress.done();
|
|
|
- })
|
|
|
+ exportBloByPost(`/api/kd-scientific/technician/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
|
|
|
+ downloadXls(res.data, `技术人员花名册${this.params.yearAndMonth}.xlsx`);
|
|
|
});
|
|
|
},
|
|
|
handleTemplate() {
|
|
|
this.$message.warning("暂未配置模板");
|
|
|
- // exportBlob(`/api/kd-system/region/export-template?${this.website.tokenHeader}=${getToken()}`).then(res => {
|
|
|
- // downloadXls(res.data, "技术人员花名册.xlsx");
|
|
|
- // });
|
|
|
},
|
|
|
handleReadyLastMonData() {
|
|
|
this.$confirm("确认要读取上个月的数据吗?", "提示", {
|
|
|
@@ -211,7 +146,6 @@ export default window.$crudCommon({
|
|
|
cancelButtonText: "取消",
|
|
|
type: "warning"
|
|
|
}).then(() => {
|
|
|
- // let lastMonth = moment(this.params.yearAndMonth).subtract(1, 'months').format("YYYY-MM");
|
|
|
getLastMonthData({ yearAndMonth: this.params.yearAndMonth}).then(res => {
|
|
|
let data = res.data;
|
|
|
if (data.success) {
|