diff --git a/src/api/plan/workorder.js b/src/api/plan/workorder.js index 0fc34ad..6be3492 100644 --- a/src/api/plan/workorder.js +++ b/src/api/plan/workorder.js @@ -135,4 +135,42 @@ export function getUnReadComment(data){ method:'post', data:data }) - } \ No newline at end of file +} + +export function getWorkOrderBatch(workOrderId) { + return request({ + url: '/plan/pro/workorder/getWorkOrderBatch/' + workOrderId, + method: 'get' + }); +} + +export function getWorkOrderBatchInfo(query) { + return request({ + url: '/plan/pro/workorder/getWorkOrderBatchInfo', + method: 'get', + params: query + }); +} + +export function insertWorkOrderBatch(data){ + return request({ + url:'/plan/pro/workorder/insertWorkOrderBatch', + method:'post', + data:data + }) +} + export function updateWorkOrderBatch(data){ + return request({ + url:'/plan/pro/workorder/updateWorkOrderBatch', + method:'put', + data:data + }) + } + +export function removeWorkOrderBatch(batchCode,workorderCode) { + return request({ + url: '/plan/pro/workorder/removeWorkOrderBatch/' +batchCode+ '/' +workorderCode, + method: 'delete', + }); +} + diff --git a/src/views/plan/workorder/index.vue b/src/views/plan/workorder/index.vue index 0d365be..8ffce62 100644 --- a/src/views/plan/workorder/index.vue +++ b/src/views/plan/workorder/index.vue @@ -173,6 +173,18 @@ >切线调拨 + + 批次编辑 + + @@ -622,6 +634,84 @@ 取 消 + + + + + 新增 + + + + 修改 + + + + 删除 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -634,7 +724,12 @@ import { getOrderAndWork,getProSortNo, getWorkBatchList, subChangeWorkOrderPro,subChangeWorkOrderM, - checkWorkOrder + checkWorkOrder, + getWorkOrderBatch, + getWorkOrderBatchInfo, + insertWorkOrderBatch, + updateWorkOrderBatch, + removeWorkOrderBatch } from '@/api/plan/workorder' import moment from 'moment'; import { getProEquipment, getProRoutes, getProShifts,selectMaterielList} from '@/api/plan/order' @@ -714,13 +809,18 @@ export default { }, // 遮罩层 loading: true, + batchLoading: true, // 选中数组 ids: [], cods: [], + // 批次编辑列表 + batchData: [], // 非单个禁用 single: true, + batchSingle: true, // 非多个禁用 multiple: true, + batchMultiple: true, // 下达禁用 statuses: [], // 显示搜索条件 @@ -732,9 +832,15 @@ export default { // 弹出层标题 title: "", titleM:"", + batchTitle: "", + bEditTitle: "", // 是否显示弹出层 open: false, openM:false, + batchOpen: false, + bEditOpen: false, + // 是否禁止修改批次 + editBatchFlag: false, // 查询参数 queryParams: { productDateArray: [new Date(), new Date()], @@ -768,6 +874,7 @@ export default { }, // 表单参数 form: {}, + batchForm: {}, // 表单校验 rules: { workorderCode: [ @@ -789,6 +896,23 @@ export default { {required: true, message: "单位不能为空", trigger: "blur"} ], }, + batchRules: { + workorderCode: [ + {required: true, message: "工单编码不能为空", trigger: "blur"} + ], + batchCode: [ + {required: true, message: "当前批次编码不能为空", trigger: "blur"} + ], + batchQuantity: [ + {required: true, message: "当前批次数量不能为空", trigger: "blur"} + ], + newBatchCode: [ + {required: true, message: "新批次编码不能为空", trigger: "blur"} + ], + newBatchQuantity: [ + {required: true, message: "新批次数量不能为空", trigger: "blur"} + ], + }, /**********************************/ eRouteProps: {multiple: true}, eRouteOptions: [], @@ -1626,6 +1750,17 @@ export default { }; this.resetForm("form"); }, + resetBatchForm() { + this.batchForm = { + workorderCode: null, + batchCode: null, + batchQuantity: null, + newBatchCode: null, + newBatchQuantity: null, + attr1: null, + } + this.resetForm("batchForm"); + }, // 首-搜索按钮操作 handleQuery() { this.queryParams.pageNum = 1; @@ -1647,6 +1782,13 @@ export default { this.multiple = !selection.length this.statuses = selection.map(item => item.status) }, + batchSelectionChange(selection) { + this.batchids = selection.map(item => item.workorderId) + this.bWorkCodes = selection.map(item => item.workorderCode) + this.batchCodes = selection.map(item => item.batchCode) + this.batchSingle = selection.length !== 1 + this.batchMultiple = !selection.length + }, // 首-新增按钮操作 handleAdd() { alert("待建设") @@ -1664,6 +1806,91 @@ export default { }) return value; }, + editBatch() { + this.batchLoading = true; + const workOrdercode = this.codes[0]; + getWorkOrderBatch(workOrdercode).then(response => { + if(response.code == 200) { + this.batchData = response.rows; + this.batchOpen = true; + this.batchLoading = false; + this.batchTitle = "批次编辑"; + } + + }) + }, + hangleCloseEditBatch() { + this.batchOpen = false; + this.getList(); + }, + + // 批次编辑新增 + handleAddBatch() { + this.resetBatchForm(); + this.batchForm.workorderCode = this.codes[0]; + this.bEditOpen = true; + this.bEditTitle = "批次新增"; + this.editBatchFlag = false; + }, + // 批次编辑修改 + handleUpdateBatch() { + this.editBatchFlag = true; + this.resetBatchForm(); + const params = { + workorderCode: this.bWorkCodes[0], + batchCode: this.batchCodes[0] + } + getWorkOrderBatchInfo(params).then(response => { + this.batchForm = response.data; + this.bEditOpen = true; + this.bEditTitle = "批次修改"; + }); + }, + // 批次编辑取消 + batchCancel() { + this.bEditOpen = false; + this.editBatch(); + }, + // 批次编辑提交 + batchSubmitForm() { + this.$refs["batchForm"].validate(valid => { + if (valid) { + if (this.batchForm.batchCode != null) { + updateWorkOrderBatch(this.batchForm).then(response => { + if(response.code === 200) { + this.$modal.msgSuccess("修改成功"); + }else{ + this.$modal.msgError(response.msg); + } + this.bEditOpen = false; + this.editBatch(); + }); + } else { + insertWorkOrderBatch(this.batchForm).then(response => { + if(response.code === 200) { + this.$modal.msgSuccess("新增成功"); + }else{ + this.$modal.msgError(response.msg); + } + this.bEditOpen = false; + this.editBatch(); + }); + } + } + }); + }, + // 删除批次 + handleRemoveBatch() { + const workorderCode = this.bWorkCodes[0]; + const batchCode = this.batchCodes[0]; + this.$modal.confirm('是否确认删除批次编号为"' + batchCode + '"的数据项?').then(function() { + return removeWorkOrderBatch(batchCode,workorderCode); + }).then(() => { + this.editBatch(); + this.$modal.msgSuccess("删除成功"); + }).catch(() => {}); + }, + //新增-打开组成白坯选择物料窗口 selectBPMateriel() { // 清除搜索缓存