From 365439d05be6ddeba4d2e057ea5b51c2a1b47f92 Mon Sep 17 00:00:00 2001 From: shijing Date: Thu, 21 Mar 2024 11:04:44 +0800 Subject: [PATCH] =?UTF-8?q?gannt=E4=BF=AE=E6=94=B9#138?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config/route.js | 20 +++---- src/views/pm/utask_dept10.vue | 106 +++++++++++++++++++--------------- src/views/pm/utask_dept6.vue | 72 +++++++++++++++++++---- src/views/pm/utask_dept7.vue | 84 ++++++++++++--------------- 4 files changed, 166 insertions(+), 116 deletions(-) diff --git a/src/config/route.js b/src/config/route.js index c59c60c4..e92243cb 100644 --- a/src/config/route.js +++ b/src/config/route.js @@ -2379,16 +2379,16 @@ const routes = [ }, "component": "statistics/inm_check.vue" }, - { - "name": "good_check", - "path": "/statistic/good_check", - "meta": { - "title": "成品检验统计", - "icon": "el-icon-DataAnalysis", - "perms": ["statistic_qm"] - }, - "component": "statistics/good_check.vue" - }, + // { + // "name": "good_check", + // "path": "/statistic/good_check", + // "meta": { + // "title": "成品检验统计", + // "icon": "el-icon-DataAnalysis", + // "perms": ["statistic_qm"] + // }, + // "component": "statistics/good_check.vue" + // }, // { // "name": "behavior_check", // "path": "/statistic/behavior_check", diff --git a/src/views/pm/utask_dept10.vue b/src/views/pm/utask_dept10.vue index 4aea41f8..bf38d6a7 100644 --- a/src/views/pm/utask_dept10.vue +++ b/src/views/pm/utask_dept10.vue @@ -23,8 +23,8 @@ - + @@ -105,43 +105,7 @@ - - + @@ -176,6 +140,7 @@ export default { dateValue:'', apiUtask: null, apiObj: null, + ganntVisit:true, visibleRecord: false, currentDept: { id: 0 }, paramsUtask: {}, @@ -209,6 +174,50 @@ export default { } }) }, + updateCount(res, tableData) { + let that = this; + this.count = res.count; + let data = []; + console.log('tableData', tableData) + if (tableData.length > 0) { + tableData.forEach(item=>{ + let start_date = item.start_date; + let end_date = item.end_date; + let objItem = {}; + objItem.id = item.id; + objItem.type = 'utask'; + objItem.number = item.number; + objItem.count = item.count; + objItem.text = item.number; + objItem.material_name = item.material_.name; + objItem.material_specification = item.material_.specification; + objItem.material_model = item.material_.model; + objItem.progress = item.count_real / item.count;; + objItem.count_ok = item.count_ok; + objItem.count_real = item.count_real; + objItem.count_notok = item.count_notok; + objItem.state = item.state; + objItem.start_date = start_date; + objItem.utaskType = item.type; + objItem.mgroup_name = item.mgroup_name; + objItem.open = true; + let oneDay = 24 * 60 * 60 * 1000; // 一天的毫秒数 + let firstDate = new Date(start_date); + let secondDate = new Date(end_date); + let timeDiff = Math.abs(secondDate.getTime()-firstDate.getTime()); + let daysDiff = Math.ceil(timeDiff / oneDay); + objItem.duration = daysDiff+1; + data.push(objItem) + that.start_date = start_date; + console.log('objItemduration',objItem.duration) + }) + } + that.ganntVisit = true; + that.tasks.data = data; + gantt.parse(that.tasks); + // 刷新数据 + gantt.refreshData(); + }, getGantt(){ let that = this; that.$API.pm.utask.list.req(that.paramsUtask).then(res=>{ @@ -375,14 +384,17 @@ export default { this.$refs.table.refresh(); }, utaskSearch(){ - let start_date = this.dateValue[0]; - let end_date = this.dateValue[1]; - let obj = {}; - obj.start_date__gte = start_date; - obj.end_date__lte = end_date; - obj.belong_dept__name = '10车间'; - this.paramsUtask = obj; - this.getGantt(); + this.ganntVisit = false; + if (this.dateValue && this.dateValue.length > 0) { + let start_date = this.dateValue[0]; + let end_date = this.dateValue[1]; + this.paramsUtask.start_date__gte = start_date; + this.paramsUtask.end_date__lte = end_date; + } else { + this.paramsUtask.start_date__gte = ''; + this.paramsUtask.end_date__lte = ''; + } + this.$refs.tables.refresh(); }, } } diff --git a/src/views/pm/utask_dept6.vue b/src/views/pm/utask_dept6.vue index 39321704..5f0e7d9a 100644 --- a/src/views/pm/utask_dept6.vue +++ b/src/views/pm/utask_dept6.vue @@ -25,8 +25,8 @@ - + @@ -114,7 +114,7 @@ - + @@ -149,6 +149,7 @@ export default { start_date:'', end_date:'', }, + ganntVisit:true, dateValue:'', apiUtask: null, currentDept: { id: 0 }, @@ -180,12 +181,56 @@ export default { that.currentDept = res[0] that.paramsUtask.belong_dept = that.currentDept.id that.apiUtask = that.$API.pm.utask.list - that.getGantt(); + // that.getGantt(); } else { that.$message.error("未找到车间"); } }) }, + updateCount(res, tableData) { + let that = this; + this.count = res.count; + let data = []; + console.log('tableData', tableData) + if (tableData.length > 0) { + tableData.forEach(item=>{ + let start_date = item.start_date; + let end_date = item.end_date; + let objItem = {}; + objItem.id = item.id; + objItem.type = 'utask'; + objItem.number = item.number; + objItem.count = item.count; + objItem.text = item.number; + objItem.material_name = item.material_.name; + objItem.material_specification = item.material_.specification; + objItem.material_model = item.material_.model; + objItem.progress = item.count_real / item.count;; + objItem.count_ok = item.count_ok; + objItem.count_real = item.count_real; + objItem.count_notok = item.count_notok; + objItem.state = item.state; + objItem.start_date = start_date; + objItem.utaskType = item.type; + objItem.mgroup_name = item.mgroup_name; + objItem.open = true; + let oneDay = 24 * 60 * 60 * 1000; // 一天的毫秒数 + let firstDate = new Date(start_date); + let secondDate = new Date(end_date); + let timeDiff = Math.abs(secondDate.getTime()-firstDate.getTime()); + let daysDiff = Math.ceil(timeDiff / oneDay); + objItem.duration = daysDiff+1; + data.push(objItem) + that.start_date = start_date; + console.log('objItemduration',objItem.duration) + }) + } + that.ganntVisit = true; + that.tasks.data = data; + gantt.parse(that.tasks); + // 刷新数据 + gantt.refreshData(); + }, getGantt(){ let that = this; that.$API.pm.utask.list.req(that.paramsUtask).then(res=>{ @@ -405,14 +450,17 @@ export default { this.$refs.table.refresh(); }, utaskSearch(){ - let start_date = this.dateValue[0]; - let end_date = this.dateValue[1]; - let obj = {}; - obj.start_date__gte = start_date; - obj.end_date__lte = end_date; - obj.belong_dept__name = '6车间'; - this.paramsUtask = obj; - this.getGantt(); + this.ganntVisit = false; + if (this.dateValue && this.dateValue.length > 0) { + let start_date = this.dateValue[0]; + let end_date = this.dateValue[1]; + this.paramsUtask.start_date__gte = start_date; + this.paramsUtask.end_date__lte = end_date; + } else { + this.paramsUtask.start_date__gte = ''; + this.paramsUtask.end_date__lte = ''; + } + this.$refs.tables.refresh(); }, } } diff --git a/src/views/pm/utask_dept7.vue b/src/views/pm/utask_dept7.vue index bbe51c61..26cb52fb 100644 --- a/src/views/pm/utask_dept7.vue +++ b/src/views/pm/utask_dept7.vue @@ -23,8 +23,8 @@ - + @@ -140,7 +140,7 @@ --> - + @@ -172,13 +172,14 @@ export default { tasks: { data: [] }, - dateValue:'', + ganntVisit:true, + dateValue:[], apiUtask: null, apiObj: null, visibleRecord: false, currentDept: { id: 0 }, paramsUtask: {}, - paramsObj: {}, + queryUtask: {}, utaskList: [], state_: { 10: "创建中", @@ -188,11 +189,12 @@ export default { 34:'终止', 40: "已提交", }, - start_date:'' + start_date: '', + newDate:'' } }, mounted() { - this.initDept() + this.initDept(); }, methods: { initDept() { @@ -201,19 +203,21 @@ export default { if (res.length == 1) { that.currentDept = res[0]; that.paramsUtask.belong_dept = that.currentDept.id; + // that.paramsObj.belong_dept = that.currentDept.id; that.apiUtask = that.$API.pm.utask.list; - that.getGantt(); + // that.getGantt(); } else { that.$message.error("未找到车间"); } }) }, - getGantt(){ + updateCount(res, tableData) { let that = this; - that.$API.pm.utask.list.req(that.paramsUtask).then(res=>{ - let list = res.results; - let data = []; - list.forEach(item=>{ + this.count = res.count; + let data = []; + console.log('tableData', tableData) + if (tableData.length > 0) { + tableData.forEach(item=>{ let start_date = item.start_date; let end_date = item.end_date; let objItem = {}; @@ -244,12 +248,12 @@ export default { that.start_date = start_date; console.log('objItemduration',objItem.duration) }) - that.tasks.data = data; - - gantt.parse(that.tasks); - // 刷新数据 - gantt.refreshData(); - }) + } + that.ganntVisit = true; + that.tasks.data = data; + gantt.parse(that.tasks); + // 刷新数据 + gantt.refreshData(); }, utaskDepuse() { let that = this; @@ -343,37 +347,23 @@ export default { this.$refs.showDrawer.open(); }); }, - // rowclick(val) { - // let utask = val.id; - // this.$API.pm.mtask.list.req({ utask: utask, page: 0 }).then((res) => { - // let columList = []; - // res.forEach((item) => { - // let obj = {}; - // obj.id = item.id - // obj.state = item.state; - // obj.count_ok = item.count_ok - // obj.count = item.count; - // obj.start_date = item.start_date; - // obj.rate = ((item.count_ok / item.count) * 100).toFixed(0) + '%'; - // columList.push(obj); - // }); - // this.mtaskList = columList - // this.utaskList = [val] - // }); - // }, + handleSaveSuccess(data, mode) { this.$refs.table.refresh(); }, - utaskSearch(){ - let start_date = this.dateValue[0]; - let end_date = this.dateValue[1]; - let obj = {}; - obj.start_date__gte = start_date; - obj.end_date__lte = end_date; - obj.belong_dept__name = '7车间'; - obj.page = 0; - this.paramsUtask = obj; - this.getGantt(); + utaskSearch() { + console.log('this.dateValue',this.dateValue); + this.ganntVisit = false; + if (this.dateValue && this.dateValue.length > 0) { + let start_date = this.dateValue[0]; + let end_date = this.dateValue[1]; + this.paramsUtask.start_date__gte = start_date; + this.paramsUtask.end_date__lte = end_date; + } else { + this.paramsUtask.start_date__gte = ''; + this.paramsUtask.end_date__lte = ''; + } + this.$refs.tables.refresh(); }, } }