diff --git a/src/components/GanttComponent.vue b/src/components/GanttComponent.vue index bab4818e..c403cf46 100644 --- a/src/components/GanttComponent.vue +++ b/src/components/GanttComponent.vue @@ -28,6 +28,7 @@ export default { }, }, mounted: function () { + let that = this; gantt.clearAll();// 清空之前的配置 gantt.i18n.setLocale('cn'); // 设置中文 gantt.config.date_format = "%Y-%m-%d"; @@ -36,6 +37,13 @@ export default { gantt.config.autosize = true;//自适应尺寸 gantt.plugins({ tooltip: true }); gantt.config.bar_height = 20; //task高度 + gantt.config.duration_unit = "day";// 设置时间单位为天 + + // gantt.config.work_time = true; + // gantt.setWorkTime({ hours:["20:00-20:00"] }); + // gantt.setWorkTime({ day:7, hours:false }); + + // gantt.setWorkTime({ hours:["0-24"] }); // gantt.config.start_date = new Date(2023, 9, 1); // gantt.config.end_date = new Date(2023, 9, 10); //更改父项图标 @@ -63,6 +71,44 @@ export default { '完工时间:' + gantt.templates.tooltip_date_format(start); }; }); + gantt.attachEvent("onTaskClick", async function(id, e) { + var task = gantt.getTask(id); + console.log(task) + if(task.type=="utask"){ + that.$API.pm.mtask.list.req({ utask: id, page: 0, ordering: 'start_date,mgroup__process__sort' }).then(res => { + let data = []; + res.forEach(item => { + let obj = {}; + obj.id = item.id; + obj.type = 'task'; + obj.parent = id; + obj.number = item.number; + obj.text = item.mgroup_name; + obj.state = item.state; + obj.start = item.start_date; + obj.start_date = item.start_date; + obj.duration = 1; + obj.progress = item.count_real / item.count; + obj.count = item.count; + obj.count_ok = item.count_ok; + obj.count_real = item.count_real; + obj.count_notok = item.count_notok; + obj.state = item.state; + obj.utask = item.utask; + obj.mgroup_name = item.mgroup_name; + data.push(obj) + }) + // 数据解析:将数据解析到gantt列数据中 + + let childTasks = data + gantt.parse({ data: childTasks }); + // 刷新数据 + gantt.refreshData(); + }) + } + + + }) //自适应甘特图的尺寸大小, 使得在不出现滚动条的情况下, 显示全部任务 // gantt.config.autosize = true; // gantt.config.open_split_tasks = true; diff --git a/src/views/em/equipment.vue b/src/views/em/equipment.vue index 06d61340..9b3e4a7e 100644 --- a/src/views/em/equipment.vue +++ b/src/views/em/equipment.vue @@ -84,7 +84,9 @@ + style="position: absolute;z-index: 10;left: 110px;top: 16px;">新增 + 导出 @@ -107,6 +109,20 @@ + + + + + + + + + {{ results_[scope.row.result] }} + + + + + @@ -215,6 +231,7 @@ export default { item: {}, visible: false, visibleRecord: false, + excelName:'' }; }, mounted() { @@ -257,6 +274,7 @@ export default { this.item = row; this.form.equipment = row.id; this.query2.equipment = row.id; + this.excelName = row.name; this.$nextTick(() => { this.visibleRecord = true; }) @@ -308,6 +326,11 @@ export default { resetQuery() { this.query = {}; }, + exportExcel() { + this.exportLoading = true; + this.$XLSX('#myTable', this.excelName) + this.exportLoading = false; + }, }, }; \ No newline at end of file diff --git a/src/views/inm/mioitem.vue b/src/views/inm/mioitem.vue index 911f4e75..e16470b2 100644 --- a/src/views/inm/mioitem.vue +++ b/src/views/inm/mioitem.vue @@ -45,9 +45,9 @@ 检验 - + 删除 diff --git a/src/views/pm/utask_dept6.vue b/src/views/pm/utask_dept6.vue index bfb8f129..508551be 100644 --- a/src/views/pm/utask_dept6.vue +++ b/src/views/pm/utask_dept6.vue @@ -86,7 +86,7 @@ - + @@ -142,16 +142,60 @@ export default { }, methods: { initDept() { - this.$API.system.dept.list.req({ page: 0, name: '6车间' }).then(res => { + let that = this; + that.$API.system.dept.list.req({ page: 0, name: '6车间' }).then(res => { if (res.length == 1) { - this.currentDept = res[0] - this.paramsUtask.belong_dept = this.currentDept.id - this.apiUtask = this.$API.pm.utask.list + that.currentDept = res[0] + that.paramsUtask.belong_dept = that.currentDept.id + that.apiUtask = that.$API.pm.utask.list + that.getGantt(); } else { - this.$message.error("未找到车间"); + that.$message.error("未找到车间"); } }) }, + getGantt(){ + let that = this; + that.$API.pm.utask.list.req(that.paramsUtask).then(res=>{ + let list = res.results; + let data = []; + list.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.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.tasks.data = data; + + gantt.parse(that.tasks); + // 刷新数据 + gantt.refreshData(); + }) + }, utaskDepuse() { let that = this; if (that.selectedIds.length > 0) { @@ -261,49 +305,58 @@ export default { objItem.material_name = row.material_.name; objItem.material_specification = row.material_.specification; objItem.material_model = row.material_.model; - objItem.progress = 1; + objItem.progress = row.count_real / row.count;; objItem.count_ok = row.count_ok; objItem.count_real = row.count_real; objItem.count_notok = row.count_notok; objItem.state = row.state; - objItem.start_date = row.start_date; + objItem.start_date = start_date; objItem.mgroup_name = row.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) - this.$API.pm.mtask.list.req({ utask: row.id, page: 0, ordering: 'start_date,mgroup__process__sort' }).then(res => { - res.forEach(item => { - let obj = {}; - obj.id = item.id; - obj.type = 'task'; - obj.parent = row.id; - obj.number = item.number; - obj.text = item.mgroup_name; - obj.state = item.state; - obj.start = item.start_date; - obj.start_date = item.start_date; - obj.duration = 1; - obj.progress = item.count_real / item.count; - obj.count = item.count; - obj.count_ok = item.count_ok; - obj.count_real = item.count_real; - obj.count_notok = item.count_notok; - obj.state = item.state; - obj.utask = item.utask; - obj.mgroup_name = item.mgroup_name; - // obj.material_name = item.material_out_.name; - // obj.material_specification = item.material_out_.specification; - data.push(obj) - }) - // console.log(that.tasks.data) - // console.log('tasks:',that.tasks) - // 数据解析:将数据解析到gantt列数据中 - that.start_date = start_date - that.end_date = end_date - that.tasks.data = data - gantt.parse(that.tasks); - // 刷新数据 - gantt.refreshData(); - }) + that.start_date = start_date + that.end_date = end_date; + that.tasks.data = data; + console.log('objItemduration',objItem.duration) + gantt.parse(that.tasks); + // 刷新数据 + gantt.refreshData(); + // this.$API.pm.mtask.list.req({ utask: row.id, page: 0, ordering: 'start_date,mgroup__process__sort' }).then(res => { + // res.forEach(item => { + // let obj = {}; + // obj.id = item.id; + // obj.type = 'task'; + // obj.parent = row.id; + // obj.number = item.number; + // obj.text = item.mgroup_name; + // obj.state = item.state; + // obj.start = item.start_date; + // obj.start_date = item.start_date; + // obj.duration = 1; + // obj.progress = item.count_real / item.count; + // obj.count = item.count; + // obj.count_ok = item.count_ok; + // obj.count_real = item.count_real; + // obj.count_notok = item.count_notok; + // obj.state = item.state; + // obj.utask = item.utask; + // obj.mgroup_name = item.mgroup_name; + // data.push(obj) + // }) + // // 数据解析:将数据解析到gantt列数据中 + // that.start_date = start_date + // that.end_date = end_date + // that.tasks.data = data + // gantt.parse(that.tasks); + // // 刷新数据 + // gantt.refreshData(); + // }) }, handleSaveSuccess(data, mode) { this.$refs.table.refresh(); diff --git a/src/views/qm/first.vue b/src/views/qm/first.vue index 3a463e6f..3df38886 100644 --- a/src/views/qm/first.vue +++ b/src/views/qm/first.vue @@ -3,6 +3,7 @@ 新增 + 导出 @@ -63,11 +64,60 @@ 编辑 - 删除 + 删除 + + + + + + + + + + {{ item.testitem_description }} + + + + + + + {{ item.testitem_name }} + + + + + + + {{ item.test_val }} + + + + + + + + + {{ item.check_val }} + + + + + + + + + 合格 + + + 不合格 + + + + @@ -85,6 +135,7 @@ export default { dialog: { check: false }, + excelName:'首件确认', // apiObj: this.$API.qm.list, apiObj: this.$API.qm.ftest.list, query: { @@ -123,6 +174,11 @@ export default { resetQuery() { this.query = {}; }, + exportExcel() { + this.exportLoading = true; + this.$XLSX('#myTable', this.excelName) + this.exportLoading = false; + }, }, }; \ No newline at end of file