diff --git a/src/api/device/plan.js b/src/api/device/plan.js index b0c4d96..fe7ffb0 100644 --- a/src/api/device/plan.js +++ b/src/api/device/plan.js @@ -1,9 +1,26 @@ import request from '@/utils/request' +// 修改计划初始化信息 +export function initUpdatePlanInfo(data) { + return request({ + url: '/device/inspectionPlan/initUpdatePlanInfo', + method: 'post', + data: data + }); +} + +// 查询工作中心 +export function getWorkCenter() { + return request({ + url: '/device/inspectionPlan/getWorkCenter', + method: 'get' + }); +} + // 查询人员信息 export function getPersonList() { return request({ - url: '/device/plan/getPersonList', + url: '/device/inspectionPlan/getPersonList', method: 'get' }); } @@ -11,7 +28,7 @@ export function getPersonList() { // 处理计划-设备信息 export function formatEquItem(data) { return request({ - url: '/device/plan/formatEquItem', + url: '/device/inspectionPlan/formatEquItem', method: 'post', data: data }); @@ -20,7 +37,7 @@ export function formatEquItem(data) { // 获取设备信息list export function getEquList(equQuery) { return request({ - url: '/device/plan/getEquList', + url: '/device/inspectionPlan/getEquList', method: 'get', params: equQuery }); @@ -29,7 +46,7 @@ export function getEquList(equQuery) { // 查询计划列表 export function listPlan(query) { return request({ - url: '/device/plan/list', + url: '/device/inspectionPlan/list', method: 'get', params: query }); @@ -38,7 +55,7 @@ export function listPlan(query) { // 查询计划详细 export function getPlan(planId) { return request({ - url: '/device/plan/' + planId, + url: '/device/inspectionPlan/' + planId, method: 'get' }); } @@ -46,7 +63,7 @@ export function getPlan(planId) { // 新增计划 export function addPlan(data) { return request({ - url: '/device/plan', + url: '/device/inspectionPlan', method: 'post', data: data }); @@ -55,7 +72,7 @@ export function addPlan(data) { // 修改计划 export function updatePlan(data) { return request({ - url: '/device/plan', + url: '/device/inspectionPlan', method: 'put', data: data }); @@ -64,7 +81,7 @@ export function updatePlan(data) { // 删除计划 export function delPlan(planId) { return request({ - url: '/device/plan/' + planId, + url: '/device/inspectionPlan/' + planId, method: 'delete' }); } diff --git a/src/views/device/inspectionPlan/index.vue b/src/views/device/inspectionPlan/index.vue index fd89bde..98033da 100644 --- a/src/views/device/inspectionPlan/index.vue +++ b/src/views/device/inspectionPlan/index.vue @@ -25,7 +25,7 @@ @keyup.enter.native="handleQuery" /> - + - + - + - + - - - + + + @@ -265,7 +265,7 @@ {{ parseTime(scope.row.planLoopEnd, '{y}-{m}-{d}') }} - + @@ -376,10 +376,16 @@ - + - - + + + + @@ -523,6 +529,10 @@ prop="equipmentTypeName" label="设备类型"> + + { this.equTotal = response.total; this.queryEquipment = response.rows; @@ -829,6 +879,7 @@ export default { this.equipmentQuery = { equipmentCode: null, equipmentName: null, + workshopCode: null, pageNum: 1, pageSize: 10, }; @@ -838,8 +889,15 @@ export default { stepLast() { this.inspectionPlanStep--; }, - // 步骤-下一步 + // 步骤-下一步-检验工作中心 stepNext() { + if (this.form.planWorkshop == null) { + this.$message({ + message: '请选择工作中心!', + type: 'warning' + }) + return + } this.inspectionPlanStep++; }, /** 查询计划列表 */ @@ -914,27 +972,62 @@ export default { }, /** 新增按钮操作 */ handleAdd() { + this.reset(); // 清除缓存 this.resetQuery(); this.queryEquipment = []; this.inspectionPlanStep = 0; this.selectPersonList = []; + this.personList = []; - this.getEquList(); this.setPerson(); + this.setWorkCenter(); + this.open = true; this.title = "添加计划"; }, + // 获取工作中心 + setWorkCenter(){ + getWorkCenter().then(response => { + console.log("这里是工作中心") + console.log(response.data) + this.workCenterList = response.data; + }) + }, /** 修改按钮操作 */ handleUpdate(row) { this.reset(); - const planId = row.planId || this.ids - getPlan(planId).then(response => { + // 清除缓存 + this.resetQuery(); + this.queryEquipment = []; + this.inspectionPlanStep = 0; + this.selectPersonList = []; + this.personList = []; + this.setPerson(); + this.setWorkCenter(); + + initUpdatePlanInfo(row).then(response => { + console.log(row) + console.log("返回数据如下") + console.log(response.data) this.form = response.data; + + this.selectPersonList = response.data.personListVO; + + for (let i = 0; i < this.form.equipmentItem.length; i++) { + if (this.form.equipmentItem[i].itemTempName == null) { + this.form.equipmentItem[i].itemTempName = ''; + } + for (let j = 0; j < this.form.equipmentItem[i].equPlanDetailList.length; j++) { + this.form.equipmentItem[i].itemTempName = this.form.equipmentItem[i].itemTempName + this.form.equipmentItem[i].equPlanDetailList[j].itemName +"," + } + } + this.open = true; this.title = "修改计划"; - }); + }) + }, /** 提交按钮 */ submitForm() { @@ -987,6 +1080,8 @@ export default { }); } else { this.form.personList = this.selectPersonList; + console.log("这里是人员信息") + console.log(this.form.personList) addPlan(this.form).then(response => { this.$modal.msgSuccess("新增成功"); this.open = false;