|
@@ -1,10 +1,11 @@
|
|
-{{ src/components/Gantt.vue }}
|
|
|
|
|
|
+b{{ src/components/Gantt.vue }}
|
|
<template>
|
|
<template>
|
|
<div ref="gantt"></div>
|
|
<div ref="gantt"></div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import {gantt} from 'dhtmlx-gantt';
|
|
import {gantt} from 'dhtmlx-gantt';
|
|
|
|
+import { notification } from 'ant-design-vue';
|
|
import {getDeviceList, getJhList, getManagerList, getCgqList, saveProject} from '@/api/api'
|
|
import {getDeviceList, getJhList, getManagerList, getCgqList, saveProject} from '@/api/api'
|
|
export default {
|
|
export default {
|
|
name: 'gantt',
|
|
name: 'gantt',
|
|
@@ -59,9 +60,9 @@ export default {
|
|
position: "项目经理"
|
|
position: "项目经理"
|
|
}
|
|
}
|
|
getManagerList(query).then((res) => {
|
|
getManagerList(query).then((res) => {
|
|
- console.log(17,res)
|
|
|
|
this.tasks.collections.manager = res.map(response =>{
|
|
this.tasks.collections.manager = res.map(response =>{
|
|
return {
|
|
return {
|
|
|
|
+ key: response.name,
|
|
value: response.id,
|
|
value: response.id,
|
|
label: response.name
|
|
label: response.name
|
|
}
|
|
}
|
|
@@ -74,6 +75,7 @@ export default {
|
|
getCgqList().then((res) => {
|
|
getCgqList().then((res) => {
|
|
this.tasks.collections.chuanganqi = res.map(response =>{
|
|
this.tasks.collections.chuanganqi = res.map(response =>{
|
|
return {
|
|
return {
|
|
|
|
+ key: response.xuliehao,
|
|
value: response.id,
|
|
value: response.id,
|
|
label: response.xuliehao
|
|
label: response.xuliehao
|
|
}
|
|
}
|
|
@@ -83,25 +85,47 @@ export default {
|
|
},
|
|
},
|
|
// 通过委托编号查询检测项目
|
|
// 通过委托编号查询检测项目
|
|
getinit(queryParam){
|
|
getinit(queryParam){
|
|
- console.log(22,queryParam)
|
|
|
|
|
|
+ this.tasks.queryParam = queryParam
|
|
getJhList(queryParam).then((res) => {
|
|
getJhList(queryParam).then((res) => {
|
|
- console.log(res.result)
|
|
|
|
|
|
+ console.log(17,res)
|
|
this.tasks.data = []
|
|
this.tasks.data = []
|
|
gantt.clearAll();
|
|
gantt.clearAll();
|
|
- this.tasks.data = res.result.map(res => {
|
|
|
|
- return {
|
|
|
|
- id: res.testItemsId,
|
|
|
|
- // text:res.reportNo,
|
|
|
|
- start_date: res.jihuaStartDate,
|
|
|
|
- // end_date: res.jihuaEndDate,
|
|
|
|
- duration: res.lastTime,
|
|
|
|
- sampleName: res.sampleName,
|
|
|
|
- testItems: res.testItems,
|
|
|
|
- taskProgress: res.status
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- console.log(33,this.tasks)
|
|
|
|
|
|
+ if (res.result.length > 0 ) {
|
|
|
|
+ this.tasks.data = res.result.map(res => {
|
|
|
|
+ return {
|
|
|
|
+ id: res.testItemsId,
|
|
|
|
|
|
|
|
+ weituoId: res.weituoId,
|
|
|
|
+ testItemsId: res.testItemsId,
|
|
|
|
+ yangpinId:res.yangpinId,
|
|
|
|
+ shebeiId:res.shebeiId,
|
|
|
|
+ pm: res.pm,
|
|
|
|
+ reportNo: res.reportNo,
|
|
|
|
+ chuanganqi:res.chuanganqi,
|
|
|
|
+ testPlanId:res.testPlanId,
|
|
|
|
+ status:res.status,
|
|
|
|
+
|
|
|
|
+ // text:res.reportNo,
|
|
|
|
+ start_date: res.jihuaStartDate,
|
|
|
|
+ // jihuaEndDate: res.jihuaEndDate,
|
|
|
|
+ duration: res.lastTime,
|
|
|
|
+ sampleName: res.sampleName,
|
|
|
|
+ testItems: res.testItems,
|
|
|
|
+ deviceName: res.deviceName,
|
|
|
|
+ status: res.status,
|
|
|
|
+ statusC: res.statusC
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ // gantt.init(this.$refs.gantt);
|
|
|
|
+ // // gantt.parse(this.$props.tasks);
|
|
|
|
+ // gantt.parse(this.tasks);
|
|
|
|
+ } else {
|
|
|
|
+ notification.open({
|
|
|
|
+ message: '注意',
|
|
|
|
+ description: '该委托编号不存在',
|
|
|
|
+ });
|
|
|
|
+ }
|
|
gantt.init(this.$refs.gantt);
|
|
gantt.init(this.$refs.gantt);
|
|
// gantt.parse(this.$props.tasks);
|
|
// gantt.parse(this.$props.tasks);
|
|
gantt.parse(this.tasks);
|
|
gantt.parse(this.tasks);
|
|
@@ -111,9 +135,45 @@ export default {
|
|
searchReset() {
|
|
searchReset() {
|
|
var json = gantt.serialize();
|
|
var json = gantt.serialize();
|
|
console.log(json)
|
|
console.log(json)
|
|
- saveProject(json.data).then((res) => {
|
|
|
|
- console.log(res)
|
|
|
|
|
|
+ var data = json.data.map( res => {
|
|
|
|
+ return{
|
|
|
|
+ weituoId: res.weituoId,
|
|
|
|
+ testItemsId: res.testItemsId,
|
|
|
|
+ yangpinId:res.yangpinId,
|
|
|
|
+ shebeiId:res.shebeiId,
|
|
|
|
+ pm: res.pm,
|
|
|
|
+ jihuaStartDate: res.start_date,
|
|
|
|
+ lastTime: res.duration,
|
|
|
|
+ // jihuaEndDate: res.jihuaEndDate,
|
|
|
|
+ reportNo: res.reportNo,
|
|
|
|
+ chuanganqi:res.chuanganqi,
|
|
|
|
+ testPlanId:res.testPlanId,
|
|
|
|
+ status:res.status,
|
|
|
|
+ testItems: res.testItems,
|
|
|
|
+ }
|
|
})
|
|
})
|
|
|
|
+ console.log(data.length)
|
|
|
|
+ if (data.length > 0) {
|
|
|
|
+ saveProject(data).then((res) => {
|
|
|
|
+ console.log(res)
|
|
|
|
+ notification.open({
|
|
|
|
+ message: '注意',
|
|
|
|
+ description: res.message,
|
|
|
|
+ // onClick: () => {
|
|
|
|
+ // console.log('Notification Clicked!');
|
|
|
|
+ // },
|
|
|
|
+ });
|
|
|
|
+ this.getinit(this.tasks.queryParam)
|
|
|
|
+ })
|
|
|
|
+ }else {
|
|
|
|
+ notification.open({
|
|
|
|
+ message: '注意',
|
|
|
|
+ description: '数据为空,提交失败',
|
|
|
|
+ // onClick: () => {
|
|
|
|
+ // console.log('Notification Clicked!');
|
|
|
|
+ // },
|
|
|
|
+ });
|
|
|
|
+ }
|
|
},
|
|
},
|
|
// // 今日线
|
|
// // 今日线
|
|
// createTodayLine() {
|
|
// createTodayLine() {
|
|
@@ -198,13 +258,9 @@ export default {
|
|
};
|
|
};
|
|
// 重置布局
|
|
// 重置布局
|
|
gantt.resetLayout();
|
|
gantt.resetLayout();
|
|
- // var state = gantt.getState();
|
|
|
|
-
|
|
|
|
- // console.log(55,state.min_date);
|
|
|
|
-
|
|
|
|
- // console.log(66,state.max_date);
|
|
|
|
gantt.config.start_on_monday = true;
|
|
gantt.config.start_on_monday = true;
|
|
- gantt.config.work_time = true;
|
|
|
|
|
|
+ // 注意取消工作日!!!!(gantt.config.work_time = false;)
|
|
|
|
+ gantt.config.work_time = false;
|
|
gantt.config.fit_tasks = true; //自动调整图表坐标轴区间用于适配task的长度
|
|
gantt.config.fit_tasks = true; //自动调整图表坐标轴区间用于适配task的长度
|
|
// 甘特图汉化
|
|
// 甘特图汉化
|
|
gantt.locale = {
|
|
gantt.locale = {
|
|
@@ -238,13 +294,14 @@ export default {
|
|
section_head: "项目经理:",
|
|
section_head: "项目经理:",
|
|
section_device: "试验设备:",
|
|
section_device: "试验设备:",
|
|
section_sensor: "传感器:",
|
|
section_sensor: "传感器:",
|
|
|
|
+ section_reportNo: "报告编号:",
|
|
section_priority: '优先级:',
|
|
section_priority: '优先级:',
|
|
- taskProgress: '任务状态',
|
|
|
|
- taskProgress_0: "未确认",
|
|
|
|
- taskProgress_1: "已确认",
|
|
|
|
- taskProgress_2: "完成",
|
|
|
|
- taskProgress_3: "已延期",
|
|
|
|
- taskProgress_4: "搁置中",
|
|
|
|
|
|
+ status: '任务状态',
|
|
|
|
+ status_0: "未确认",
|
|
|
|
+ status_1: "已确认",
|
|
|
|
+ status_2: "完成",
|
|
|
|
+ status_3: "已延期",
|
|
|
|
+ status_4: "搁置中",
|
|
section_template: 'Details',
|
|
section_template: 'Details',
|
|
/* grid columns */
|
|
/* grid columns */
|
|
column_text: "计划名称",
|
|
column_text: "计划名称",
|
|
@@ -252,6 +309,7 @@ export default {
|
|
column_testItems: "检测项目",
|
|
column_testItems: "检测项目",
|
|
column_start_date: "开始时间",
|
|
column_start_date: "开始时间",
|
|
column_duration: "持续时间",
|
|
column_duration: "持续时间",
|
|
|
|
+ column_lastTime: "持续时间",
|
|
column_add: "",
|
|
column_add: "",
|
|
column_priority: "难度",
|
|
column_priority: "难度",
|
|
/* link confirmation */
|
|
/* link confirmation */
|
|
@@ -305,36 +363,59 @@ export default {
|
|
// },
|
|
// },
|
|
// ];
|
|
// ];
|
|
// 左侧列表内容
|
|
// 左侧列表内容
|
|
|
|
+
|
|
gantt.config.columns = [
|
|
gantt.config.columns = [
|
|
// { name: "text", min_width:100,max_width:200, label:"任务", align: "left",resize: true, tree: true },
|
|
// { name: "text", min_width:100,max_width:200, label:"任务", align: "left",resize: true, tree: true },
|
|
{ name: "testItems", label: "检测项目", width: 130, resize: true, align: "left",resize: true, tree: true },
|
|
{ name: "testItems", label: "检测项目", width: 130, resize: true, align: "left",resize: true, tree: true },
|
|
{ name: "sampleName", label: "样品名称", width: 90, resize: true, align: "center" },
|
|
{ name: "sampleName", label: "样品名称", width: 90, resize: true, align: "center" },
|
|
{ name: "start_date", label: "开始时间", width: 100, resize: true, align: "center" },
|
|
{ name: "start_date", label: "开始时间", width: 100, resize: true, align: "center" },
|
|
{ name: "end_date", label: "结束时间", width: 100, resize: true, align: "center" },
|
|
{ name: "end_date", label: "结束时间", width: 100, resize: true, align: "center" },
|
|
- // { name: "taskProgress", label: "状态", width: 130, resize: true, align: "center", options: [
|
|
|
|
- // { key: "0", label: gantt.locale.labels.taskProgress_0 },
|
|
|
|
- // { key: "1", label: gantt.locale.labels.taskProgress_1 },
|
|
|
|
- // { key: "2", label: gantt.locale.labels.taskProgress_2 },
|
|
|
|
- // ],
|
|
|
|
- // template:function(obj){
|
|
|
|
- // console.log(obj)
|
|
|
|
- // let re = '';
|
|
|
|
- // switch (obj.taskProgress) {
|
|
|
|
- // case "0":
|
|
|
|
- // re = `<div class='taskProgress color_bg_1' >未开始</div>`
|
|
|
|
- // break;
|
|
|
|
- // case "1":
|
|
|
|
- // re = `<div class='taskProgress color_bg_2' >进行中</div>`
|
|
|
|
- // break;
|
|
|
|
- // case "2":
|
|
|
|
- // re = `<div class='taskProgress color_bg_3' >已完成</div>`
|
|
|
|
- // break;
|
|
|
|
- // }
|
|
|
|
- // return re
|
|
|
|
- // }
|
|
|
|
|
|
+ { name: "statusC", label: "状态", width: 100, resize: true, align: "center" },
|
|
|
|
+ // { name: "status", label: "状态", width: 130, resize: true, align: "center",
|
|
|
|
+ // // options: [
|
|
|
|
+ // // { key: "0", label: gantt.locale.labels.status_0 },
|
|
|
|
+ // // { key: "1", label: gantt.locale.labels.status_1 },
|
|
|
|
+ // // { key: "2", label: gantt.locale.labels.status_2 },
|
|
|
|
+ // // ],
|
|
|
|
+ // // template:function(obj){
|
|
|
|
+ // // console.log(obj)
|
|
|
|
+ // // console.log(obj.status)
|
|
|
|
+ // // let re = '';
|
|
|
|
+ // // switch (obj.status) {
|
|
|
|
+ // // case "0":
|
|
|
|
+ // // re = `<b>未开始</b>`
|
|
|
|
+ // // break;
|
|
|
|
+ // // case "1":
|
|
|
|
+ // // re = `<b >进行中</b>`
|
|
|
|
+ // // break;
|
|
|
|
+ // // case "2":
|
|
|
|
+ // // re = `<b>已完成</b>`
|
|
|
|
+ // // break;
|
|
|
|
+ // // }
|
|
|
|
+ // // return re
|
|
|
|
+ // // }
|
|
// },
|
|
// },
|
|
- { name: "add", label:"", width: 30 }
|
|
|
|
|
|
+ // { name: "add", label:"", width: 30 }
|
|
];
|
|
];
|
|
|
|
+ // 更改左侧显示的结束日期时间
|
|
|
|
+ gantt.templates.task_end_date = function(date){
|
|
|
|
+ return gantt.templates.task_date(new Date(date.valueOf() - 1));
|
|
|
|
+ };
|
|
|
|
+ var gridDateToStr = gantt.date.date_to_str("%Y-%m-%d");
|
|
|
|
+ gantt.templates.grid_date_format = function(date, column){
|
|
|
|
+ if(column === "end_date"){
|
|
|
|
+ return gridDateToStr(new Date(date.valueOf() - 1));
|
|
|
|
+ }else{
|
|
|
|
+ return gridDateToStr(date);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ gantt.templates.task_text = function (start, end, task) {
|
|
|
|
+ console.log(task)
|
|
|
|
+ // return "<b>设备:</b> " + task.shebeiId + ",<b> 项目经理:</b> " + task.pm;
|
|
|
|
+ // return "<b> 项目经理:</b> " + task.pm;
|
|
|
|
+ // return "<b>项目经理:</b> "+ task.pm + ", <b>设备:</b> " + task.deviceName;
|
|
|
|
+ return task.pm + ", " + task.deviceName;
|
|
|
|
+ };
|
|
//弹出层(灯箱)
|
|
//弹出层(灯箱)
|
|
gantt.config.lightbox.sections = [
|
|
gantt.config.lightbox.sections = [
|
|
// { name: "text", height: 30, map_to: "text", type: "textarea", focus: true, width: "*" },
|
|
// { name: "text", height: 30, map_to: "text", type: "textarea", focus: true, width: "*" },
|
|
@@ -343,12 +424,15 @@ export default {
|
|
time_format: ["%Y", "%m", "%d"],
|
|
time_format: ["%Y", "%m", "%d"],
|
|
|
|
|
|
},
|
|
},
|
|
- { name: "head", height: 30, map_to: "head_id", type: "select", options:gantt.serverList("manager") },
|
|
|
|
|
|
+ { name: "head", height: 30, map_to: "pm", type: "select", options:gantt.serverList("manager") },
|
|
|
|
+ {
|
|
|
|
+ name: "device", height: 30, map_to: "shebeiId", type: "select", options: gantt.serverList('staff',[]),
|
|
|
|
+ },
|
|
{
|
|
{
|
|
- name: "device", height: 30, map_to: "device_id", type: "select", options: gantt.serverList('staff',[]),
|
|
|
|
|
|
+ name: "sensor", height: 30, map_to: "chuanganqi", type: "select", options: gantt.serverList('chuanganqi',[]),
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- name: "sensor", height: 30, map_to: "sensor_id", type: "select", options: gantt.serverList('chuanganqi',[]),
|
|
|
|
|
|
+ name: "reportNo", height: 30, map_to: "reportNo", type: "text", type: "textarea",focus: true,
|
|
},
|
|
},
|
|
// { name: "description", height: 70, map_to: "description", type: "textarea" },
|
|
// { name: "description", height: 70, map_to: "description", type: "textarea" },
|
|
// {
|
|
// {
|
|
@@ -371,7 +455,7 @@ export default {
|
|
|
|
|
|
<style>
|
|
<style>
|
|
@import "~dhtmlx-gantt/codebase/dhtmlxgantt.css";
|
|
@import "~dhtmlx-gantt/codebase/dhtmlxgantt.css";
|
|
- .taskProgress{
|
|
|
|
|
|
+ .status{
|
|
margin: 0 auto;
|
|
margin: 0 auto;
|
|
margin-top: 5px;
|
|
margin-top: 5px;
|
|
height: 24px;
|
|
height: 24px;
|