diff --git a/src/api/qc/qc.js b/src/api/qc/qc.js index 5972b48..a0620ad 100644 --- a/src/api/qc/qc.js +++ b/src/api/qc/qc.js @@ -12,6 +12,7 @@ export const qcCheckOutItemSearch = data => createAPI(`/pms/qc/qcCheckOutItemSea export const qcCheckOutItemSave = data => createAPI(`/pms/qc/qcCheckOutItemSave`,'post',data) export const qcCheckOutItemUpdate = data => createAPI(`/pms/qc/qcCheckOutItemUpdate`,'post',data) export const qcCheckOutItemDelete = data => createAPI(`/pms/qc/qcCheckOutItemDelete`,'post',data) +export const uploadExcel = data => createAPI(`/pms/qc/uploadExcel`,'post',data) // ===================================== 根据物料设置检验模板 ===================================== export const qcPartModelSearch = data => createAPI(`/pms/qc/qcPartModelSearch`,'post',data) @@ -19,7 +20,6 @@ export const qcPartModelSave = data => createAPI(`/pms/qc/qcPartModelSave`,'post export const qcPartModelUpdate = data => createAPI(`/pms/qc/qcPartModelUpdate`,'post',data) export const qcPartModelDelete = data => createAPI(`/pms/qc/qcPartModelDelete`,'post',data) - // ===================================== 根据分类设置检验模板 ===================================== export const qcCheckOutModelSearch = data => createAPI(`/pms/qc/qcCheckOutModelSearch`,'post',data) export const qcCheckOutModelSave = data => createAPI(`/pms/qc/qcCheckOutModelSave`,'post',data) @@ -30,7 +30,6 @@ export const saveModalDetails = data => createAPI(`/pms/qc/saveModalDetails`,'po export const deleteModalDetails = data => createAPI(`/pms/qc/deleteModalDetails`,'post',data) export const getItemLists= data => createAPI(`/pms/qc/getItemLists`,'post',data) - // ===================================== 检验录入 ===================================== export const qcInspectionInformationSearch = data => createAPI(`/pms/qc/qcInspectionInformationSearch`,'post',data) export const modalCodeBlur = data => createAPI(`/pms/qc/modalCodeBlur`,'post',data) @@ -51,7 +50,6 @@ export const workOrderSearch = data => createAPI(`/pms/qc/workOrderSearch`,'post export const selectInformationByWorkOrderNo = data => createAPI(`/pms/qc/selectInformationByWorkOrderNo`,'post',data) export const checkSubDetailValue = data => createAPI(`/pms/qc/checkSubDetailValue`,'post',data) - // ===================================== 质检员信息 ===================================== export const inspectorSearch = data => createAPI(`/pms/qc/inspectorSearch`,'post',data) export const inspectorSave = data => createAPI(`/pms/qc/inspectorSave`,'post',data) @@ -69,7 +67,7 @@ export const ItemDetailsSearch = data => createAPI(`/pms/qc/ItemDetailsSearch`,' export const addItemDetails = data => createAPI(`/pms/qc/addItemDetails`,'post',data) export const getItemList = data => createAPI(`/pms/qc/getItemList`,'post',data) export const delItemDetails = data => createAPI(`/pms/qc/delItemDetails`,'post',data) -export const uploadExcel = data => createAPI(`/pms/qc/uploadExcel`,'post',data) +export const uploadTemplateExcel = data => createAPI(`/pms/qc/uploadTemplateExcel`,'post',data) export const saveItemDetailed = data => createAPI(`/pms/qc/saveItemDetailed`,'post',data) // ===================================== 样本量 ===================================== @@ -90,12 +88,22 @@ export const samplingLevelSave = data => createAPI(`/pms/qc/samplingLevelSave`,' export const samplingLevelUpdate = data => createAPI(`/pms/qc/samplingLevelUpdate`,'post',data) export const samplingLevelDelete = data => createAPI(`/pms/qc/samplingLevelDelete`,'post',data) -// ===================================== 抽样方案 ===================================== +// ===================================== 样本量字码矩阵 ===================================== export const samplingInspectionPlanSearch = data => createAPI(`/pms/qc/samplingInspectionPlanSearch`,'post',data) export const samplingInspectionPlanSave = data => createAPI(`/pms/qc/samplingInspectionPlanSave`,'post',data) export const samplingInspectionPlanUpdate = data => createAPI(`/pms/qc/samplingInspectionPlanUpdate`,'post',data) export const samplingInspectionPlanDelete = data => createAPI(`/pms/qc/samplingInspectionPlanDelete`,'post',data) +// ===================================== 抽样方案 ===================================== +export const samplingProgrammeSearch = data => createAPI(`/pms/qc/samplingProgrammeSearch`,'post',data) +export const samplingProgrammeSave = data => createAPI(`/pms/qc/samplingProgrammeSave`,'post',data) +export const samplingProgrammeDelete = data => createAPI(`/pms/qc/samplingProgrammeDelete`,'post',data) +export const searchSamplingProgrammeDetails = data => createAPI(`/pms/qc/searchSamplingProgrammeDetails`,'post',data) +export const saveSamplingProgrammeDetails = data => createAPI(`/pms/qc/saveSamplingProgrammeDetails`,'post',data) +export const deleteSamplingProgrammeDetails = data => createAPI(`/pms/qc/deleteSamplingProgrammeDetails`,'post',data) +export const getPlanLists = data => createAPI(`/pms/qc/getPlanLists`,'post',data) + + // ===================================== 物料属性设置 ===================================== export const qcPartAttributeSearch = data => createAPI(`/pms/qc/qcPartAttributeSearch`,'post',data) export const qcPartAttributeSave = data => createAPI(`/pms/qc/qcPartAttributeSave`,'post',data) @@ -104,6 +112,13 @@ export const searchPartAttributeDetails = data => createAPI(`/pms/qc/searchPartA export const savePartAttributeDetails = data => createAPI(`/pms/qc/savePartAttributeDetails`,'post',data) export const deletePartAttributeDetails = data => createAPI(`/pms/qc/deletePartAttributeDetails`,'post',data) export const saveAttributeDetailed = data => createAPI(`/pms/qc/saveAttributeDetailed`,'post',data) +export const uploadPartAttributeExcel = data => createAPI(`/pms/qc/uploadPartAttributeExcel`,'post',data) +// ===================================== 类别属性设置 ===================================== +export const qcFamilyAttributeSearch = data => createAPI(`/pms/qc/qcFamilyAttributeSearch`,'post',data) +export const qcFamilyAttributeSave = data => createAPI(`/pms/qc/qcFamilyAttributeSave`,'post',data) +export const qcFamilyAttributeDelete = data => createAPI(`/pms/qc/qcFamilyAttributeDelete`,'post',data) +export const uploadFamilyAttributeExcel = data => createAPI(`/pms/qc/uploadFamilyAttributeExcel`,'post',data) - +// ===================================== FAI检验 ===================================== +export const qcFAIInspectionSearch = data => createAPI(`/pms/qc/qcFAIInspectionSearch`,'post',data) diff --git a/src/views/modules/qc/FAIResultEntry.vue b/src/views/modules/qc/FAIResultEntry.vue index 5e8e119..bd44057 100644 --- a/src/views/modules/qc/FAIResultEntry.vue +++ b/src/views/modules/qc/FAIResultEntry.vue @@ -14,12 +14,6 @@ - - - - - - @@ -29,18 +23,10 @@ - - - - - - - - 清空 查询 - 新增检验记录 + 新增 import { + qcFAIInspectionSearch, // 查询FAI的检验记录 + qcInspectionInformationSearch, // 检验记录查询 qcInspectionInformationSave, // 新增检验记录 qcInspectionInformationDelete, // 删除检验记录 detailInformationSearch, // 查询明细信息 modalCodeBlur, // 模板信息 saveDetailInformation, // 新增明细信息 - // searchModelTree, // 明细信息的分类级联 saveSubmitResult, // 保存检验结果 checkCompleted, // 判断主信息和明细信息是否已填写 selectModelByPartNo, // 物料编码失去焦点事件 subDetailInformationSave, // 新增子明细信息 selectSubDetailInformation, checkOutIsSubmit, // 检查是否已提交 - // workOrderSearch, // 查询工单列表 selectInformationByWorkOrderNo, // 工单号失去焦点事件 checkSubDetailValue // 检查子明细中的实测值是否在规定范围 } from "@/api/qc/qc.js" @@ -326,28 +312,6 @@ Chooselist }, watch: { - searchData: { - deep: true, - handler: function (newV, oldV) { - this.searchData.isQualified = this.searchData.isQualified.toUpperCase() - // - this.searchData.inspectionNo = this.searchData.inspectionNo.toUpperCase() - } - }, - modalData: { - deep: true, - handler: function (newV, oldV) { - this.modalData.isQualified = this.modalData.isQualified.toUpperCase() - this.modalData.inspectionNo = this.modalData.inspectionNo.toUpperCase() - } - }, - detailData: { - deep: true, - handler: function (newV, oldV) { - this.modalData.isQualified = this.modalData.isQualified.toUpperCase() - this.modalData.inspectionNo = this.modalData.inspectionNo.toUpperCase() - } - }, }, data () { @@ -935,7 +899,7 @@ getDataList () { this.searchData.limit = this.pageSize this.searchData.page = this.pageIndex - qcInspectionInformationSearch(this.searchData).then(({data}) => { + qcFAIInspectionSearch(this.searchData).then(({data}) => { if (data.code == 0) { this.dataList = data.page.list this.pageIndex = data.page.currPage diff --git a/src/views/modules/qc/qcFamilyAttribute.vue b/src/views/modules/qc/qcFamilyAttribute.vue index 080e6a4..e8314a1 100644 --- a/src/views/modules/qc/qcFamilyAttribute.vue +++ b/src/views/modules/qc/qcFamilyAttribute.vue @@ -8,29 +8,20 @@ - - + + - - - - + - - - - - - - - - - 清空 查询 新增 + + + + 导入 @@ -95,126 +85,194 @@ layout="total, sizes, prev, pager, next, jumper"> - - - - - - - - - - - - - - + + - 物料分类编码 + 类别编码 - + - - 检验类型编码 - - - - + + - 保存 关闭 - - + + - - + + - - + + - 新增 - 快速新增 + 新增 - - - - +
+ + + + - - - + + + + + + + + + + + + + + + + + + - + + + + + +
+ 保存 关闭
- - - - - 检验项目编码 - - - - - - - - 保存 - 关闭 - - + + + + + + + + + + + + + + + + - - + +
- 检验模板编码: - 检验模板名称: + + + + + + + + + + + + + + + + 查询 + +
- 可选项目: + 可选模板: + label="模板编码"> + label="模板名称"> @@ -248,7 +306,7 @@ - 已有项目: + 已有模板: + label="模板编码"> + label="模板名称"> - - 关闭 - + + 关闭 +
@@ -285,16 +343,17 @@ diff --git a/src/views/modules/qc/qcItemMaintenance.vue b/src/views/modules/qc/qcItemMaintenance.vue index d07f78f..434b73f 100644 --- a/src/views/modules/qc/qcItemMaintenance.vue +++ b/src/views/modules/qc/qcItemMaintenance.vue @@ -8,17 +8,16 @@ - + - + 查询 新增 - 导入 @@ -37,7 +36,6 @@ {{ "导出" }}
-
@@ -77,7 +75,6 @@ - @@ -89,7 +86,6 @@ - @@ -104,13 +100,11 @@ - - 保存 关闭 diff --git a/src/views/modules/qc/qcPartAttribute.vue b/src/views/modules/qc/qcPartAttribute.vue index a389030..5c60e9c 100644 --- a/src/views/modules/qc/qcPartAttribute.vue +++ b/src/views/modules/qc/qcPartAttribute.vue @@ -14,13 +14,17 @@ - + 清空 查询 新增 + + + + 导入 @@ -85,9 +88,8 @@ layout="total, sizes, prev, pager, next, jumper"> - + - 物料编码 @@ -130,8 +132,8 @@ - 新增 - 快速新增 + + 新增 @@ -241,35 +243,36 @@ - - - - - 检验模板编码 - - - - - - - - 保存 - 关闭 - - + + + + + + + + + + + + + + + + - - + +
- - + + - - + + + { if (data && data.code === 0) { @@ -882,24 +867,6 @@ }) } }) - }else { - qcPartModelUpdate(this.modalData).then(({data}) => { - if (data && data.code === 0) { - this.getDataList() - this.modalFlag=false - this.$message({ - message: '操作成功', - type: 'success', - duration: 1500, - onClose: () => { - } - }) - } else { - this.$alert(data.msg, '错误', { - confirmButtonText: '确定' - }) - } - }) } }, // 保存属性模板 @@ -936,14 +903,6 @@ }) this.detailModelFlag = true; }, - - // 普通新增 - addDetailModal(){ - this.detailData.templateId = ''; - this.detailData.templateName = ''; - this.addDetailModalFlag = true; - }, - checkInspectionType(){ getItemLists(this.detailData).then(({data}) => { this.itemList1 = data.row1; @@ -961,7 +920,6 @@ }) this.fastAddFlag = true; }, - clickItem1(row){ this.itemListRow1 = JSON.parse(JSON.stringify(row)); }, @@ -985,8 +943,8 @@ savePartAttributeDetails(inData).then(({data}) => { if (data && data.code == 0) { getItemLists(this.detailData).then(({data}) => { - this.itemList1=data.row1; - this.itemList2=data.row2; + this.itemList1 = data.row1; + this.itemList2 = data.row2; }) this.itemListRow1 = null } else { @@ -1029,48 +987,47 @@ this.detailList = data.rows }) }, - - // 保存物料属性中的模板明细 - savePartAttributeDetails(){ - if(this.detailData.templateId == "" || this.detailData.templateId == null){ - this.$alert('请选择检验模板!', '错误', { - confirmButtonText: '确定' - }) - return false - } - savePartAttributeDetails(this.detailData).then(({data}) => { - if (data && data.code == 0) { - searchPartAttributeDetails(this.detailData).then(({data}) => { - this.detailList = data.rows - }) - this.addDetailModalFlag = false; - this.$message({ - message: '操作成功', - type: 'success', - duration: 1500, - onClose: () => { - } - }) - } else { - this.$alert(data.msg, '错误', { - confirmButtonText: '确定' - }) - } - }) - }, - itemNoBlur(){ - let inData = { - itemType: 'D', - itemNo: this.detailData.itemNo - } - qcCheckOutItemSearch(inData).then(({data}) => { - if(data.rows.length > 0){ - this.detailData.itemDesc = data.rows[0].itemDesc - }else { - this.detailData.itemDesc = '' - } - }) - }, + // // 保存物料属性中的模板明细 + // savePartAttributeDetails(){ + // if(this.detailData.templateId == "" || this.detailData.templateId == null){ + // this.$alert('请选择检验模板!', '错误', { + // confirmButtonText: '确定' + // }) + // return false + // } + // savePartAttributeDetails(this.detailData).then(({data}) => { + // if (data && data.code == 0) { + // searchPartAttributeDetails(this.detailData).then(({data}) => { + // this.detailList = data.rows + // }) + // this.addDetailModalFlag = false; + // this.$message({ + // message: '操作成功', + // type: 'success', + // duration: 1500, + // onClose: () => { + // } + // }) + // } else { + // this.$alert(data.msg, '错误', { + // confirmButtonText: '确定' + // }) + // } + // }) + // }, + // itemNoBlur(){ + // let inData = { + // itemType: 'D', + // itemNo: this.detailData.itemNo + // } + // qcCheckOutItemSearch(inData).then(({data}) => { + // if(data.rows.length > 0){ + // this.detailData.itemDesc = data.rows[0].itemDesc + // }else { + // this.detailData.itemDesc = '' + // } + // }) + // }, // 删除物料属性中的模板 deletePartAttributeDetails(row){ this.$confirm(`是否删除这个检验模板?`, '提示', { @@ -1178,6 +1135,37 @@ }, // 导出 end + + // 导入 + clickFile() { + this.$refs.file.dispatchEvent(new MouseEvent('click')) + }, + async uploadFile() { + const file = this.$refs.file.files + let extName = file[0].name.substring(file[0].name.lastIndexOf('.')).toLowerCase() + if (extName === '.xlsx' || extName === '.xls') { + let formData = new FormData() + formData.append('file', file[0]) + uploadPartAttributeExcel(formData).then(({data}) => { + if(data.code === 0) { + this.getDataList() + this.$message({ + type: 'success', + message: '数据导入成功!' + }) + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + }) + } + else { + this.$message.error('数据导入失败,请选择正确的xlsx模板文件') + } + this.load(); + }, + } } diff --git a/src/views/modules/qc/qcSamplingInspection.vue b/src/views/modules/qc/qcSamplingInspectionPlan.vue similarity index 92% rename from src/views/modules/qc/qcSamplingInspection.vue rename to src/views/modules/qc/qcSamplingInspectionPlan.vue index 0f472b6..9073fc5 100644 --- a/src/views/modules/qc/qcSamplingInspection.vue +++ b/src/views/modules/qc/qcSamplingInspectionPlan.vue @@ -8,21 +8,15 @@
- - + + - - - - - - - - + + @@ -76,7 +70,7 @@ width="160" label="操作"> @@ -94,7 +88,18 @@ - + + + + + + + + + + + + @@ -126,15 +131,6 @@ - - - - - - - - - 保存 关闭 @@ -147,10 +143,10 @@ diff --git a/src/views/modules/qc/qcTemplate.vue b/src/views/modules/qc/qcTemplate.vue index 5b9bbb9..b8e5f48 100644 --- a/src/views/modules/qc/qcTemplate.vue +++ b/src/views/modules/qc/qcTemplate.vue @@ -8,14 +8,15 @@ - + - + + 清空 查询 新增 + + + + 导入 - @@ -113,11 +117,13 @@ - - 抽样方案 - + 抽样方案编码 + + + + 检验水平编码 @@ -127,7 +133,6 @@ - @@ -139,7 +144,6 @@ - @@ -148,7 +152,6 @@ - 保存 关闭 @@ -191,7 +194,6 @@ - 删除项目 - @@ -263,8 +264,14 @@
- 检验模板编码: - 检验模板名称: + + + + + + + +
@@ -333,37 +340,6 @@
- - - - - - - - - - - - - - - - - - - 关闭 - - - @@ -381,6 +357,7 @@ getItemList, // 获取明细列表 delItemDetails, // 删除项目的检验明细 saveItemDetailed, // 新增项目明细的最大最小值 + uploadTemplateExcel, // 导入文件 qcCheckOutItemSearch, // 搜索项目 } from "@/api/qc/qc.js" @@ -397,7 +374,6 @@ return { // 是否收藏 favorite: false, - // 导出 start exportData: [], exportName: "根据物料设置检验模板" + this.dayjs().format('YYYYMMDDHHmmss'), @@ -405,7 +381,6 @@ exportFooter: [], exportList:[], // 导出 end - tagNo:'', searchData: { site: this.$store.state.user.site, @@ -421,7 +396,6 @@ pageIndex: 1, pageSize: 100, totalPage: 0, - addDetailModalFlag:false, modalFlag:false, modalDisableFlag:false, modalData:{ @@ -432,7 +406,8 @@ templateRemark: '', templateType: '', templateVersion: '', - samplingPlanNo: '', + samplingProgrammeNo: '', + samplingProgrammeDesc: '', inspectionTypeNo: '', inspectionCycle: '', createTime: '', @@ -450,7 +425,8 @@ templateRemark: '', templateType: '', templateVersion: '', - samplingPlanNo: '', + samplingProgrammeNo: '', + samplingProgrammeDesc: '', inspectionTypeNo: '', inspectionCycle: '', createTime: '', @@ -507,7 +483,7 @@ serialNumber: '301003TableCodeDesc', tableId: "301003Table", tableName: "检验模板表", - columnProp: 'samplingPlanNo', + columnProp: 'samplingProgrammeNo', headerAlign: "center", align: "left", columnLabel: '抽样方案', @@ -738,22 +714,8 @@ ], detailModelFlag:false, detailList: [], - chooseTableData:[], dataListLoading: false, - dataListSelections: [], - - // modalDisableFlag:false, - chooseModalFlag:false, - itemFlag:'text', - itemData:{ - itemNo:'', - valueNo:'', - availableValue:'', - itemType:'D', - createdBy: this.$store.state.user.name - }, dataList:[], - departmentList:[], // 展示列集 columnDetailList: [ { @@ -811,13 +773,6 @@ columnWidth: 70, }, ], - levelList:[], - chooseModalData:{ - itemNo: '', - itemDesc: '', - itemType:'D', - valueTypeDb:'', - }, // 快速添加 fastAddFlag:false, itemList1:[], @@ -845,7 +800,6 @@ } }) }, - // 查询设备 objectSearch(){ objectSearch().then(({data}) => { @@ -854,7 +808,6 @@ } }) }, - // 清空搜索栏 doEmpty(){ this.searchData = { @@ -866,14 +819,13 @@ limit: 10, } }, - // 获取基础数据列表S getBaseList (val,type) { this.tagNo = val this.$nextTick(() => { let strVal = '' - if (val === 1049) { - strVal = this.modalData.samplingPlanNo + if (val === 1051) { + strVal = this.modalData.samplingProgrammeNo this.$refs.baseList.init(val, strVal) } if (val === 1048) { @@ -884,8 +836,9 @@ }, /* 列表方法的回调 */ getBaseData (val) { - if (this.tagNo === 1049) { - this.modalData.samplingPlanNo = val.sampling_plan_no + if (this.tagNo === 1051) { + this.modalData.samplingProgrammeNo = val.sampling_programme_no + this.modalData.samplingProgrammeDesc = val.sampling_programme_desc } if (this.tagNo === 1048) { this.modalData.samplingLevelNo = val.sampling_level_no @@ -926,7 +879,8 @@ templateRemark: '', templateType: '', templateVersion: '', - samplingPlanNo: '', + samplingProgrammeNo: '', + samplingProgrammeDesc: '', inspectionTypeNo: '', inspectionCycle: '', createBy: this.$store.state.user.name, @@ -948,7 +902,8 @@ templateRemark: row.templateRemark, templateType: row.templateType, templateVersion: row.templateVersion, - samplingPlanNo: row.samplingPlanNo, + samplingProgrammeNo: row.samplingProgrammeNo, + samplingProgrammeDesc: row.samplingProgrammeDesc, inspectionTypeNo: row.inspectionTypeNo, createBy: this.$store.state.user.name, samplingLevelNo: row.samplingLevelNo, @@ -994,7 +949,7 @@ }) return false } - if (this.modalData.samplingPlanNo == '' || this.modalData.samplingPlanNo == null) { + if (this.modalData.samplingProgrammeNo == '' || this.modalData.samplingProgrammeNo == null) { this.$alert('请选择抽检方案!', '错误', { confirmButtonText: '确定' }) @@ -1068,7 +1023,7 @@ }) } }, - // 打开检验明细清单 + // 打开检验项目 detailModal(row){ this.detailData.templateId = row.templateId this.detailData.templateName = row.templateName @@ -1102,14 +1057,6 @@ }) } }, - - // 普通新增 - // addDetailModal(){ - // this.detailData.itemNo = ''; - // this.detailData.itemDesc = ''; - // this.addDetailModalFlag = true; - // }, - // 快速新增 addFastModal(){ this.itemListRow2 = null @@ -1120,7 +1067,6 @@ }) this.fastAddFlag = true; }, - clickItem1(row){ this.itemListRow1 = JSON.parse(JSON.stringify(row)); }, @@ -1191,48 +1137,6 @@ this.detailList = data.rows }) }, - - // 新增项目中的明细 - addItemDetails(){ - if(this.detailData.itemNo == "" || this.detailData.itemNo == null){ - this.$alert('请选择检验明细编码!', '错误', { - confirmButtonText: '确定' - }) - return false - } - addItemDetails(this.detailData).then(({data}) => { - if (data && data.code == 0) { - ItemDetailsSearch(this.detailData).then(({data}) => { - this.detailList = data.rows - }) - this.addDetailModalFlag = false; - this.$message({ - message: '操作成功', - type: 'success', - duration: 1500, - onClose: () => { - } - }) - } else { - this.$alert(data.msg, '错误', { - confirmButtonText: '确定' - }) - } - }) - }, - itemNoBlur(){ - let inData = { - itemType: 'D', - itemNo: this.detailData.itemNo - } - qcCheckOutItemSearch(inData).then(({data}) => { - if(data.rows.length>0){ - this.detailData.itemDesc = data.rows[0].itemDesc - }else { - this.detailData.itemDesc = '' - } - }) - }, // 删除项目中的明细 delItemDetails(row){ console.log(row) @@ -1278,7 +1182,6 @@ // flag=true; } } - }) }, // 收藏 OR 取消收藏 @@ -1315,7 +1218,6 @@ await templateSearch(this.searchData).then(({data}) => { this.exportList= data.page.list; }) - return this.exportList; }, startDownload() { @@ -1336,11 +1238,40 @@ }) json += "}" let s = eval("(" + json + ")") - return s }, // 导出 end + // 导入 + clickFile() { + this.$refs.file.dispatchEvent(new MouseEvent('click')) + }, + async uploadFile() { + const file = this.$refs.file.files + let extName = file[0].name.substring(file[0].name.lastIndexOf('.')).toLowerCase() + if (extName === '.xlsx' || extName === '.xls') { + let formData = new FormData() + formData.append('file', file[0]) + uploadTemplateExcel(formData).then(({data}) => { + if(data.code === 0) { + this.getDataList() + this.$message({ + type: 'success', + message: '数据导入成功!' + }) + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + }) + } + else { + this.$message.error('数据导入失败,请选择正确的xlsx模板文件') + } + this.load(); + }, + } }