From c62188eaa789863efaef95a05d81422c8f5b0614 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 28 Nov 2023 00:40:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20mtask=E9=A1=B5=E9=9D=A2=E7=9A=84bug?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config/route.js | 2 +- src/views/pm/mtask.vue | 510 +++++--- src/views/pm/mtask2.vue | 17 +- src/views/wpm/worktask.vue | 896 ++++++++++---- src/views/wpm/worktask2.vue | 28 +- src/views/wpm/worktaskFlog.vue | 41 +- src/views/wpm/worktask_form.vue | 2028 ++++++++++++++++++++----------- 7 files changed, 2336 insertions(+), 1186 deletions(-) diff --git a/src/config/route.js b/src/config/route.js index 9bdd3ffb..58f9fbdf 100644 --- a/src/config/route.js +++ b/src/config/route.js @@ -792,7 +792,7 @@ const routes = [ "name": "worktaskFlog", "path": "/wpm/worktaskFlog", "meta": { - "title": "生产一部记录", + "title": "生产二部记录", "icon": "el-icon-cellphone", "perms": ["wpm"], "hidden":true diff --git a/src/views/pm/mtask.vue b/src/views/pm/mtask.vue index a50706ec..3fbf3363 100644 --- a/src/views/pm/mtask.vue +++ b/src/views/pm/mtask.vue @@ -1,10 +1,18 @@ - - - - + + - + - - - + + + - - + @@ -137,18 +168,37 @@ - + - - - + + - + + + + + - + + + + - - - - - - - - - + + + - - + @@ -199,27 +267,59 @@ - - + +
- 生产进度 + 生产进度
- - 查询 + + 查询
- + - + - + - + @@ -229,15 +329,35 @@ {{ scope.row.material_.model }} - + +
{{ item.count1 }}
{{ item.count2 }}
@@ -247,23 +367,49 @@ - - -
- - 查询 -
+ + - - + +
+ +
+
+ + - - - - - + + + @@ -294,22 +440,22 @@ export default { save: false, }, apiUtask: this.$API.pm.utask.list, - paramsUtask7: { belong_dept__name: '7车间' }, - paramsUtask8: { belong_dept__name: '8车间' }, - paramsUtask10: { belong_dept__name: '10车间' }, + paramsUtask7: { belong_dept__name: "7车间" }, + paramsUtask8: { belong_dept__name: "8车间" }, + paramsUtask10: { belong_dept__name: "10车间" }, apiObj: null, - paramsObj: { utask: '' }, + paramsObj: { utask: "" }, query: { page: 1, page_size: 20, - date: '' + date: "", }, - utaskId: '', + utaskId: "", isloading: false, visibleRecord: false, tableHeight: null, hideDo: true, - activeName: '7车间', + activeName: "7车间", dataList: [ // {number:'rwbh2023',name:'玻璃棒',xh:'',count:100,count1:100,start_date:'2023-10-15',end_date:'2023-10-15', count01:100, count02:200, count03:300 }, // {number:'rwbh2023',name:'玻璃棒',xh:'',count:100,count1:100,start_date:'2023-10-15',end_date:'2023-10-15', count01:100, count02:250, count03:300 }, @@ -319,11 +465,11 @@ export default { selection: [], selectedIds: [], state_: { - 10: '创建中', - 14: '已分解', - 20: '已下达', - 30: '生产中', - 40: '已提交' + 10: "创建中", + 14: "已分解", + 20: "已下达", + 30: "生产中", + 40: "已提交", }, topHeight: null, bottomHeight: null, @@ -336,24 +482,29 @@ export default { let day = date.getDate(); let timeNow = date.getTime(); let timer = 1000 * 60 * 60 * 24 * 2; - let data2 = new Date(timeNow - timer);//2天前日期 + let data2 = new Date(timeNow - timer); //2天前日期 let year2 = data2.getFullYear(); let month2 = data2.getMonth() + 1; let day2 = data2.getDate(); - let startDate = year2 + '-' + month2 + '-' + day2; - let endDate = year + '-' + month + '-' + day; + let startDate = year2 + "-" + month2 + "-" + day2; + let endDate = year + "-" + month + "-" + day; this.query.date = [startDate, endDate]; - let heights = document.getElementById('topContainer').clientHeight; - this.topHeight = (heights - 45) + 'px'; - this.bottomHeight = (heights - 65) + 'px'; + let heights = document.getElementById("topContainer").clientHeight; + this.topHeight = heights - 45 + "px"; + this.bottomHeight = heights - 65 + "px"; }, methods: { // 动态绑定Class bindClass(item) { let count = item.count; - let classInfo = { countBlock: true, redColor: false, greenColor: false, orangeColor: false }; + let classInfo = { + countBlock: true, + redColor: false, + greenColor: false, + orangeColor: false, + }; let countok = 0; - if (this.activeName == '10车间') { + if (this.activeName == "10车间") { countok = item.count3; } else { countok = item.count2; @@ -368,7 +519,7 @@ export default { } } - return classInfo + return classInfo; }, //添加 add() { @@ -388,29 +539,39 @@ export default { async table_del(row) { this.$confirm(`确定删除吗?`, "提示", { type: "warning", - }).then(() => { - this.$API.pm.utask.delete.req(row.id).then((res) => { - this.$message.success("删除成功"); - this.$refs.table7.refresh(); - return res; - }).catch((err) => { - return err; - }); - }).catch(() => { }); + }) + .then(() => { + this.$API.pm.utask.delete + .req(row.id) + .then((res) => { + this.$message.success("删除成功"); + this.$refs.table7.refresh(); + return res; + }) + .catch((err) => { + return err; + }); + }) + .catch(() => {}); }, //终止 table_end(row) { this.$confirm(`确定终止该任务吗?`, "提示", { type: "warning", - }).then(() => { - this.$API.pm.utask.stop.req(row.id).then((res) => { - this.$message.success("操作成功"); - this.$refs.table10.refresh(); - return res; - }).catch((err) => { - return err; - }); - }).catch(() => { }); + }) + .then(() => { + this.$API.pm.utask.stop + .req(row.id) + .then((res) => { + this.$message.success("操作成功"); + this.$refs.table10.refresh(); + return res; + }) + .catch((err) => { + return err; + }); + }) + .catch(() => {}); }, //本地更新数据 handleSaveSuccess(data, mode) { @@ -428,14 +589,14 @@ export default { let arr = []; let startTimer = new Date(start).getTime(); let endTimer = new Date(end).getTime(); - let oneTime = 1000 * 60 * 60 * 24;//1天时间 + let oneTime = 1000 * 60 * 60 * 24; //1天时间 let tempTime = startTimer; while (tempTime <= endTimer) { let dates = new Date(tempTime); let year = dates.getFullYear(); let month = dates.getMonth() + 1; let day = dates.getDate(); - let item = year + '-' + month + '-' + day; + let item = year + "-" + month + "-" + day; arr.push(item); tempTime = tempTime + oneTime; } @@ -446,8 +607,8 @@ export default { }, handleSelectionChange(selection) { this.selectedIds = []; - selection.forEach(item => { - this.selectedIds.push(item.id) + selection.forEach((item) => { + this.selectedIds.push(item.id); }); }, //任务分解 @@ -456,48 +617,60 @@ export default { if (that.selectedIds.length > 0) { let ids = that.selectedIds; that.isloading = true; - that.$API.pm.utask.scheduemtasks.req({ ids: ids }).then(res => { - that.$API.pm.utask.assgin.req({ ids: ids }).then(res => { - that.$message.success('下达任务成功'); - that.isloading = false; - that.$refs.table7.refresh(); - // that.$refs.table8.refresh(); - that.$refs.table10.refresh(); - }).catch(() => { - that.isloading = false; + that.$API.pm.utask.scheduemtasks + .req({ ids: ids }) + .then((res) => { + that.$API.pm.utask.assgin + .req({ ids: ids }) + .then((res) => { + that.$message.success("下达任务成功"); + that.isloading = false; + that.$refs.table7.refresh(); + // that.$refs.table8.refresh(); + that.$refs.table10.refresh(); + }) + .catch(() => { + that.isloading = false; + }); }) - - }).catch(() => { - that.isloading = false; - }) + .catch(() => { + that.isloading = false; + }); } else { - this.$message.error('未选择任何任务') + this.$message.error("未选择任何任务"); } }, utaskAssgin() { let that = this; if (that.selectedIds.length > 0) { that.isloading = true; - that.$API.pm.utask.assgin.req({ ids: that.selectedIds }).then(res => { - that.$message.success('下达任务成功'); - that.isloading = false; - that.$refs.table7.refresh(); - // that.$refs.table8.refresh(); - that.$refs.table10.refresh(); - }).catch(() => { - that.isloading = false; - }) + that.$API.pm.utask.assgin + .req({ ids: that.selectedIds }) + .then((res) => { + that.$message.success("下达任务成功"); + that.isloading = false; + that.$refs.table7.refresh(); + // that.$refs.table8.refresh(); + that.$refs.table10.refresh(); + }) + .catch(() => { + that.isloading = false; + }); } else { - this.$message.error('未选择任何任务') + this.$message.error("未选择任何任务"); } }, //查看 table_show(row) { this.utaskId = row.id; + this.paramsObj = {} this.paramsObj.utask = row.id; this.apiObj = this.$API.pm.mtask.list; this.visibleRecord = true; }, + handleMtaskQuery() { + this.$refs.drawer_table.queryData(this.paramsObj) + } , handleClick() { this.columList = []; this.dataList = []; @@ -506,45 +679,46 @@ export default { let that = this; that.columList = []; let utask = val.id; - that.dataList = [val] - this.$API.pm.mtask.list.req({ utask: utask, page: 0 }).then(res => { - let columList = [] - res.forEach(item => { + that.dataList = [val]; + this.$API.pm.mtask.list.req({ utask: utask, page: 0 }).then((res) => { + let columList = []; + res.forEach((item) => { let obj = {}; - obj.state = item.state - obj.count1 = 0; obj.count2 = 0; obj.count3 = 0; + obj.state = item.state; + obj.count1 = 0; + obj.count2 = 0; + obj.count3 = 0; obj.count = item.count; obj.data = item.start_date; - if (that.activeName == '7车间') { + if (that.activeName == "7车间") { let rate = (item.count_ok / item.count) * 100; - obj.count2 = item.count_ok;//7车间count_ok - obj.count3 = rate + '%';//7车间合格率 - } else if (that.activeName == '10车间') { + obj.count2 = item.count_ok; //7车间count_ok + obj.count3 = rate + "%"; //7车间合格率 + } else if (that.activeName == "10车间") { let mlogs = item.mlogs; if (mlogs.length > 0) { for (let i = 0; i < mlogs.length; i++) { - if (mlogs[i].shift_name == '白班') { - obj.count1 = mlogs[i].count_ok;//10车间白班 + if (mlogs[i].shift_name == "白班") { + obj.count1 = mlogs[i].count_ok; //10车间白班 } else { - obj.count2 = mlogs[i].count_ok;//10车间夜班 + obj.count2 = mlogs[i].count_ok; //10车间夜班 } - obj.count3 = obj.count1 + obj.count2;//10车间合计 + obj.count3 = obj.count1 + obj.count2; //10车间合计 } } } columList.push(obj); - - }) - this.columList = columList - console.log(columList) - }) + }); + this.columList = columList; + console.log(columList); + }); }, }, }; \ No newline at end of file diff --git a/src/views/pm/mtask2.vue b/src/views/pm/mtask2.vue index 2bd1fc0c..af0c255a 100644 --- a/src/views/pm/mtask2.vue +++ b/src/views/pm/mtask2.vue @@ -110,12 +110,13 @@ -
- - 查询 -
- + +
+ +
+
+ @@ -372,9 +373,9 @@ export default { this.apiObj = this.$API.pm.mtask.list; this.visibleRecord = true; }, - handleDetailQuery() { - this.$refs.drawer_table.refresh(); - }, + handleMtaskQuery() { + this.$refs.drawer_table.queryData(this.paramsObj) + } , //删除 async table_del(row) { let that = this; diff --git a/src/views/wpm/worktask.vue b/src/views/wpm/worktask.vue index a4b9d007..af5b0f3c 100644 --- a/src/views/wpm/worktask.vue +++ b/src/views/wpm/worktask.vue @@ -1,82 +1,172 @@