修改进度管理(甘特图)

This commit is contained in:
yjl 2023-02-07 10:10:36 +08:00
parent 72685cde60
commit 58ed28cbb1
8 changed files with 166 additions and 110 deletions

42
package-lock.json generated
View File

@ -12,7 +12,7 @@
"better-scroll": "^2.4.1", "better-scroll": "^2.4.1",
"core-js": "^3.6.5", "core-js": "^3.6.5",
"css-declaration-sorter": "^6.3.1", "css-declaration-sorter": "^6.3.1",
"dhtmlx-gantt": "^7.1.12", "dhtmlx-gantt": "^7.1.13",
"dom-to-image": "^2.6.0", "dom-to-image": "^2.6.0",
"echarts": "^5.1.0", "echarts": "^5.1.0",
"echarts4": "npm:echarts@^4.8.0", "echarts4": "npm:echarts@^4.8.0",
@ -21,6 +21,8 @@
"flv.js": "^1.6.2", "flv.js": "^1.6.2",
"gantt-elastic": "^1.0.12", "gantt-elastic": "^1.0.12",
"html2canvas": "^1.0.0-rc.7", "html2canvas": "^1.0.0-rc.7",
"jquery": "^3.6.3",
"jquery-ui-dist": "^1.13.2",
"js-base64": "^3.7.2", "js-base64": "^3.7.2",
"js-md5": "^0.7.3", "js-md5": "^0.7.3",
"lrz": "^4.9.41", "lrz": "^4.9.41",
@ -6812,9 +6814,9 @@
"integrity": "sha512-ZIzRpLJrOj7jjP2miAtgqIfmzbxa4ZOr5jJc601zklsfEx9oTzmmj2nVpIPRpNlRTIh8lc1kyViIY7BWSGNmKw==" "integrity": "sha512-ZIzRpLJrOj7jjP2miAtgqIfmzbxa4ZOr5jJc601zklsfEx9oTzmmj2nVpIPRpNlRTIh8lc1kyViIY7BWSGNmKw=="
}, },
"node_modules/dhtmlx-gantt": { "node_modules/dhtmlx-gantt": {
"version": "7.1.12", "version": "7.1.13",
"resolved": "https://registry.npmmirror.com/dhtmlx-gantt/-/dhtmlx-gantt-7.1.12.tgz", "resolved": "https://registry.npmmirror.com/dhtmlx-gantt/-/dhtmlx-gantt-7.1.13.tgz",
"integrity": "sha512-8xC/DbBR/jqy6bnTT+qc6uKZPdQwYqpw6U8LJRb2A9Uz0BdYvKCptVfXIQOERFOLEqjymSzbCu4z/OwmabuCrg==" "integrity": "sha512-PnVk6HI8LcOu1E6o9sJ5UpeWRiaXLnNa5t3i0oFPXPVkDrDyZdNr0KduryF45R7DWMSyMkxJ9RGJ+iUiqQCDhg=="
}, },
"node_modules/diffie-hellman": { "node_modules/diffie-hellman": {
"version": "5.0.3", "version": "5.0.3",
@ -9680,6 +9682,19 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/jquery": {
"version": "3.6.3",
"resolved": "https://registry.npmmirror.com/jquery/-/jquery-3.6.3.tgz",
"integrity": "sha512-bZ5Sy3YzKo9Fyc8wH2iIQK4JImJ6R0GWI9kL1/k7Z91ZBNgkRXE6U0JfHIizZbort8ZunhSI3jw9I6253ahKfg=="
},
"node_modules/jquery-ui-dist": {
"version": "1.13.2",
"resolved": "https://registry.npmmirror.com/jquery-ui-dist/-/jquery-ui-dist-1.13.2.tgz",
"integrity": "sha512-oVDRd1NLtTbBwpRKAYdIRgpWVDzeBhfy7Gu0RmY6JEaZtmBq6kDn1pm5SgDiAotrnDS+RoTRXO6xvcNTxA9tOA==",
"dependencies": {
"jquery": ">=1.8.0 <4.0.0"
}
},
"node_modules/js-base64": { "node_modules/js-base64": {
"version": "3.7.2", "version": "3.7.2",
"resolved": "https://registry.npmmirror.com/js-base64/-/js-base64-3.7.2.tgz", "resolved": "https://registry.npmmirror.com/js-base64/-/js-base64-3.7.2.tgz",
@ -26787,9 +26802,9 @@
"integrity": "sha512-ZIzRpLJrOj7jjP2miAtgqIfmzbxa4ZOr5jJc601zklsfEx9oTzmmj2nVpIPRpNlRTIh8lc1kyViIY7BWSGNmKw==" "integrity": "sha512-ZIzRpLJrOj7jjP2miAtgqIfmzbxa4ZOr5jJc601zklsfEx9oTzmmj2nVpIPRpNlRTIh8lc1kyViIY7BWSGNmKw=="
}, },
"dhtmlx-gantt": { "dhtmlx-gantt": {
"version": "7.1.12", "version": "7.1.13",
"resolved": "https://registry.npmmirror.com/dhtmlx-gantt/-/dhtmlx-gantt-7.1.12.tgz", "resolved": "https://registry.npmmirror.com/dhtmlx-gantt/-/dhtmlx-gantt-7.1.13.tgz",
"integrity": "sha512-8xC/DbBR/jqy6bnTT+qc6uKZPdQwYqpw6U8LJRb2A9Uz0BdYvKCptVfXIQOERFOLEqjymSzbCu4z/OwmabuCrg==" "integrity": "sha512-PnVk6HI8LcOu1E6o9sJ5UpeWRiaXLnNa5t3i0oFPXPVkDrDyZdNr0KduryF45R7DWMSyMkxJ9RGJ+iUiqQCDhg=="
}, },
"diffie-hellman": { "diffie-hellman": {
"version": "5.0.3", "version": "5.0.3",
@ -29114,6 +29129,19 @@
} }
} }
}, },
"jquery": {
"version": "3.6.3",
"resolved": "https://registry.npmmirror.com/jquery/-/jquery-3.6.3.tgz",
"integrity": "sha512-bZ5Sy3YzKo9Fyc8wH2iIQK4JImJ6R0GWI9kL1/k7Z91ZBNgkRXE6U0JfHIizZbort8ZunhSI3jw9I6253ahKfg=="
},
"jquery-ui-dist": {
"version": "1.13.2",
"resolved": "https://registry.npmmirror.com/jquery-ui-dist/-/jquery-ui-dist-1.13.2.tgz",
"integrity": "sha512-oVDRd1NLtTbBwpRKAYdIRgpWVDzeBhfy7Gu0RmY6JEaZtmBq6kDn1pm5SgDiAotrnDS+RoTRXO6xvcNTxA9tOA==",
"requires": {
"jquery": ">=1.8.0 <4.0.0"
}
},
"js-base64": { "js-base64": {
"version": "3.7.2", "version": "3.7.2",
"resolved": "https://registry.npmmirror.com/js-base64/-/js-base64-3.7.2.tgz", "resolved": "https://registry.npmmirror.com/js-base64/-/js-base64-3.7.2.tgz",

View File

@ -12,7 +12,7 @@
"better-scroll": "^2.4.1", "better-scroll": "^2.4.1",
"core-js": "^3.6.5", "core-js": "^3.6.5",
"css-declaration-sorter": "^6.3.1", "css-declaration-sorter": "^6.3.1",
"dhtmlx-gantt": "^7.1.12", "dhtmlx-gantt": "^7.1.13",
"dom-to-image": "^2.6.0", "dom-to-image": "^2.6.0",
"echarts": "^5.1.0", "echarts": "^5.1.0",
"echarts4": "npm:echarts@^4.8.0", "echarts4": "npm:echarts@^4.8.0",
@ -21,6 +21,8 @@
"flv.js": "^1.6.2", "flv.js": "^1.6.2",
"gantt-elastic": "^1.0.12", "gantt-elastic": "^1.0.12",
"html2canvas": "^1.0.0-rc.7", "html2canvas": "^1.0.0-rc.7",
"jquery": "^3.6.3",
"jquery-ui-dist": "^1.13.2",
"js-base64": "^3.7.2", "js-base64": "^3.7.2",
"js-md5": "^0.7.3", "js-md5": "^0.7.3",
"lrz": "^4.9.41", "lrz": "^4.9.41",

View File

@ -78,7 +78,8 @@ if (process.env.NODE_ENV == 'development') {
// axios.defaults.baseURL = 'http://218.92.215.138:9090/' //盐城 新佳城小区 123456 // axios.defaults.baseURL = 'http://218.92.215.138:9090/' //盐城 新佳城小区 123456
// axios.defaults.baseURL = 'http://36.137.53.203:9090/' //盐城 gdjt 123456789 // axios.defaults.baseURL = 'http://36.137.53.203:9090/' //盐城 gdjt 123456789
// axios.defaults.baseURL = 'http://183.234.150.152:9090/' //华发 huaxin 123456789 // axios.defaults.baseURL = 'http://183.234.150.152:9090/' //华发 huaxin 123456789
// axios.defaults.baseURL = 'http://139.9.66.234:7072/' //三江集团 // axios.defaults.baseURL = 'http://139.9.66.234:7072/' //三江集团测试环境
// axios.defaults.baseURL = 'http://116.169.63.183:7070' //三江集团正式环境
} else if (process.env.NODE_ENV == 'debug') { } else if (process.env.NODE_ENV == 'debug') {
axios.defaults.baseURL = 'https://www.ceshi.com' axios.defaults.baseURL = 'https://www.ceshi.com'

View File

@ -63,8 +63,8 @@ export default new Vuex.Store({
// BASEURL:'http://192.168.34.116:6023/', // BASEURL:'http://192.168.34.116:6023/',
// UPLOADURL: 'http://192.168.34.116:6023/upload/image', // UPLOADURL: 'http://192.168.34.116:6023/upload/image',
// FILEURL: 'http://192.168.34.116:6023/image/', // FILEURL: 'http://192.168.34.116:6023/image/',
// UPLOADURL: 'http://124.71.67.160:8088/upload/image', UPLOADURL: 'http://124.71.67.160:8088/upload/image',
// FILEURL: 'http://124.71.67.160:8088/image/', FILEURL: 'http://124.71.67.160:8088/image/',
//--- //---
// UPLOADURL: 'http://192.168.34.125:6023/upload/image', // UPLOADURL: 'http://192.168.34.125:6023/upload/image',
// FILEURL: 'http://192.168.34.125:6023/image/', // FILEURL: 'http://192.168.34.125:6023/image/',
@ -72,8 +72,10 @@ export default new Vuex.Store({
// UPLOADURL:'http://'+"61.190.32.219:9050"+'/upload/image',//正式 // UPLOADURL:'http://'+"61.190.32.219:9050"+'/upload/image',//正式
// FILEURL:'http://'+"61.190.32.219:9050"+'/image/',//正式 // FILEURL:'http://'+"61.190.32.219:9050"+'/image/',//正式
// FILEURL:'http://'+"47.97.202.104:6023"+'/image/',//正式 // FILEURL:'http://'+"47.97.202.104:6023"+'/image/',//正式
UPLOADURL: 'http://182.90.224.147:100/upload/image',//演示平台 // UPLOADURL: 'http://182.90.224.147:100/upload/image',//演示平台
FILEURL: 'http://182.90.224.147:100/image/',//演示平台 // FILEURL: 'http://182.90.224.147:100/image/',//演示平台
// UPLOADURL: 'http://139.9.66.234:7072/upload/image',//三江集团
// FILEURL: 'http://139.9.66.234:7072/image/',//三江集团
ACCOUNTTYPE: [ ACCOUNTTYPE: [
"系统管理员", "系统管理员",

View File

@ -2571,7 +2571,8 @@ export default {
if (type == 1) { if (type == 1) {
if ( if (
file.type != "image/jpeg" && file.type != "image/jpeg" &&
file.type != "image/jpg" file.type != "image/jpg"&&
file.type != "image/png"
// file.type != "image/png" // file.type != "image/png"
) { ) {
this.$message.error(this.$t("message.laborMange.hint8")); this.$message.error(this.$t("message.laborMange.hint8"));
@ -2584,7 +2585,7 @@ export default {
// type==1 2 3 4 5 6 // type==1 2 3 4 5 6
if (type == 1) { if (type == 1) {
let imgStatus = file2.size / 1024 < 500; let imgStatus = file2.size / 1024 < 500;
if (!imgStatus) { if (imgStatus) {
this.cropperOption.img = this.cropperOption.img =
this.$store.state.FILEURL + file.data[0].imageUrl; this.$store.state.FILEURL + file.data[0].imageUrl;
this.cropperDialog = true; this.cropperDialog = true;
@ -2629,7 +2630,6 @@ export default {
}, },
// //
checkImgLibrary(url) { checkImgLibrary(url) {
console.log(url);
checkImgLibraryApi({ fileUrl: url, projectSn: this.projectSn }).then( checkImgLibraryApi({ fileUrl: url, projectSn: this.projectSn }).then(
(res) => { (res) => {
if (res.result && res.result.length > 0) { if (res.result && res.result.length > 0) {
@ -2649,8 +2649,12 @@ export default {
}, },
// //
checkFace(url) { checkFace(url) {
console.log('url',url);
checkFaceApi({ fileUrl: url }).then((res) => { checkFaceApi({ fileUrl: url }).then((res) => {
if (res.result.checkType == 1) { console.log('res数据',res);
if (res.result.checkType ==1) {
this.workerInfo.fieldAcquisitionUrl = url; this.workerInfo.fieldAcquisitionUrl = url;
this.cropperDialog = false; this.cropperDialog = false;
} else { } else {
@ -2682,7 +2686,8 @@ export default {
// this.checkFace(res.data.data[0].imageUrl) // this.checkFace(res.data.data[0].imageUrl)
if (this.isSzProject == 1) { if (this.isSzProject == 1) {
this.checkImgLibrary(res.data.data[0].imageUrl); this.checkImgLibrary(res.data.data[0].imageUrl);
} else { }
else {
this.checkFace(res.data.data[0].imageUrl); this.checkFace(res.data.data[0].imageUrl);
} }
} }

View File

@ -189,13 +189,13 @@
range-separator="至" range-separator="至"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
:picker-options="pickerOptions"
clearable clearable
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
format="yyyy-MM-dd" format="yyyy-MM-dd"
@input="getContractTime" @input="getContractTime"
> >
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
:label="$t('message.extendInfo.actualConstructionTime')" :label="$t('message.extendInfo.actualConstructionTime')"
@ -203,13 +203,12 @@
> >
<!-- 实际 --> <!-- 实际 -->
<el-date-picker <el-date-picker
v-model="editProjectForm.realTime" v-model="editProjectForm.realTime"
type="daterange" type="daterange"
unlink-panels unlink-panels
range-separator="至" range-separator="至"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
:picker-options="pickerOptions"
clearable clearable
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
format="yyyy-MM-dd" format="yyyy-MM-dd"
@ -320,7 +319,7 @@ export default {
projectDialogTitle: this.$t("message.extendInfo.editProjectInfo"), projectDialogTitle: this.$t("message.extendInfo.editProjectInfo"),
editProjectDialog: false, editProjectDialog: false,
editProjectForm: { editProjectForm: {
contractTime: ['',''], contractTime: ["", ""],
realTime: [], realTime: [],
contractSignTime: "", contractSignTime: "",
contractPeriodEndTime: "", contractPeriodEndTime: "",
@ -349,39 +348,7 @@ export default {
value: "code", value: "code",
}, },
showMap: false, showMap: false,
//
pickerOptions: {
shortcuts: [
{
text: '最近一周',
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
picker.$emit('pick', [start, end]);
},
},
{
text: '最近一个月',
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
picker.$emit('pick', [start, end]);
},
},
{
text: '最近三个月',
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
picker.$emit('pick', [start, end]);
},
},
],
},
}; };
}, },
created() { created() {
@ -389,6 +356,7 @@ export default {
this.getProjectExtendInfo(); this.getProjectExtendInfo();
}, },
methods: { methods: {
// //
getProjectExtendInfo() { getProjectExtendInfo() {
let data = { let data = {

View File

@ -27,9 +27,11 @@ import {
editProgressTaskApi, // editProgressTaskApi, //
getParentChildListApi, // getParentChildListApi, //
} from "@/assets/js/api/scheduleInfo"; } from "@/assets/js/api/scheduleInfo";
import $ from 'jquery'
import 'jquery-ui-dist/jquery-ui'
import 'jquery-ui-dist/jquery-ui.min.css'
import { gantt } from "dhtmlx-gantt"; import { gantt } from "dhtmlx-gantt";
import moment from "moment"; import moment from "moment";
import { Model } from "echarts";
export default { export default {
name: "gantt", name: "gantt",
props: { props: {
@ -45,6 +47,7 @@ export default {
}, },
data() { data() {
return { return {
events:[],
dataLinks: [], dataLinks: [],
title: "", title: "",
width: 800, width: 800,
@ -128,8 +131,8 @@ export default {
confirm_deleting: "是否删除计划?", confirm_deleting: "是否删除计划?",
section_description: "备注:", section_description: "备注:",
section_time: "计划时间:", section_time: "计划时间:",
section_actual: "开始时间:",
section_time2: "开始时间:", section_time2: "开始时间:",
section_deadline: "实际时间:",
section_type: "类型", section_type: "类型",
section_text: "任务名称:", section_text: "任务名称:",
section_color: "颜色:", section_color: "颜色:",
@ -147,8 +150,6 @@ export default {
column_add: "", column_add: "",
column_id: "", column_id: "",
column_predecessors: "", column_predecessors: "",
column_actual_start_date: "",
column_actual_end_date: "",
column_duration: "", column_duration: "",
/* link confirmation */ /* link confirmation */
@ -170,7 +171,6 @@ export default {
years: "年", years: "年",
}, },
}; };
gantt.plugins({ marker: true, tooltip: true }); // marker gantt.plugins({ marker: true, tooltip: true }); // marker
// //
gantt.templates.tooltip_text = function (start, end, task) { gantt.templates.tooltip_text = function (start, end, task) {
@ -219,14 +219,14 @@ export default {
resize: true, resize: true,
}, },
{ {
name: "actual_start_date", name: "planned_start",
label: "实际开始日期", label: "实际开始日期",
align: "center", align: "center",
width: "100", width: "100",
resize: true, resize: true,
}, },
{ {
name: "actual_end_date", name: "planned_end",
label: "实际完成日期", label: "实际完成日期",
align: "center", align: "center",
width: "100", width: "100",
@ -244,7 +244,55 @@ export default {
}, },
{ name: "add", label: "" }, { name: "add", label: "" },
]; ];
function startDatepicker(node){
return $(node).find("input[name='start']");
}
function endDateInput(node){
return $(node).find("input[name='end']");
}
gantt.form_blocks["datepicker"] = {
render(sns) { //sns - the section's configuration object
return "<div class='gantt-lb-datepicker'>"+
"<input type='text' name='start' placeholder='请选择实际开始时间' style='height:20px;margin:0 0px 0 10px'>"+'-'+
"<input type='text' name='end' placeholder='请选择实际结束时间' style='height:20px'>"+
"</div>";;
},
set_value(node, value, task, section) {
startDatepicker(node).datepicker({
dateFormat: "yy-mm-dd",
onSelect: () => {
}
});
startDatepicker(node).datepicker("setDate", task.planned_start);
endDateInput(node).datepicker({
dateFormat: "yy-mm-dd",
onSelect: function (dateStr) {
// gantt.ext.inlineEditors.save()
}
});
endDateInput(node).datepicker("setDate", task.planned_end);
},
get_value(node, task, section) {
if(task.planned_start && task.planned_end) {
var start = startDatepicker(node).datepicker('getDate');
var end = endDateInput(node).datepicker('getDate');
task.planned_start = start;
task.planned_end = end;
}
// task.duration = gantt.calculateDuration(task);
},
focus(node) {
}
}
// //
gantt.config.lightbox.sections = [ gantt.config.lightbox.sections = [
// //
{ {
@ -263,8 +311,13 @@ export default {
type: "time", type: "time",
time_format: ["%Y", "%m", "%d"], time_format: ["%Y", "%m", "%d"],
}, },
// /// ///
// { name: "actualTime", height: 72, map_to: "auto", type: "date" }, {
name: "deadline",
height: 30,
type: "datepicker",
map_to:"auto",
},
// //
{ {
@ -330,9 +383,9 @@ export default {
// //
gantt.templates.task_time = function (start, end, task) { gantt.templates.task_time = function (start, end, task) {
return ( return (
moment(task.startDate).format("YYYY-MM-DD") + moment(task.start_date).format("YYYY-MM-DD") +
" - " + " - " +
moment(task.finishDate).format("YYYY-MM-DD") moment(task.end_date).format("YYYY-MM-DD")
); );
}; };
// //
@ -340,7 +393,6 @@ export default {
return task.text; return task.text;
}; };
gantt.init(this.$refs.gantt); gantt.init(this.$refs.gantt);
gantt.parse(this.$props.tasks);
let this_ = this; let this_ = this;
// //
gantt.attachEvent("onAfterTaskAdd", function (id, item) { gantt.attachEvent("onAfterTaskAdd", function (id, item) {
@ -372,8 +424,8 @@ export default {
taskName: item.text, taskName: item.text,
taskTypeId: Number(item.taskTypeId) - 1, taskTypeId: Number(item.taskTypeId) - 1,
finishDate: moment(item.end_date).format("YYYY-MM-DD"),// finishDate: moment(item.end_date).format("YYYY-MM-DD"),//
actualStartDate: moment(item.actual_start_date).format("YYYY-MM-DD"),// actualStartDate: moment(item.planned_start).format("YYYY-MM-DD"),//
actualFinishDate: moment(item.actual_end_date).format("YYYY-MM-DD"),// actualFinishDate: moment(item.planned_end).format("YYYY-MM-DD"),//
}; };
addProgressTaskApi(data).then((res) => { addProgressTaskApi(data).then((res) => {
console.log("添加的数据", res); console.log("添加的数据", res);
@ -400,7 +452,7 @@ export default {
}); });
}); });
// //
gantt.attachEvent("onAfterTaskUpdate", function (id, item) { const onAfterTaskDrag =gantt.attachEvent("onAfterTaskUpdate", function (id, item) {
console.log("修改任务后触发", item); console.log("修改任务后触发", item);
let data = { let data = {
duration: Number(item.ck), duration: Number(item.ck),
@ -414,14 +466,15 @@ export default {
taskName: item.text, taskName: item.text,
taskTypeId: Number(item.taskTypeId) - 1, taskTypeId: Number(item.taskTypeId) - 1,
finishDate: moment(item.end_date).format("YYYY-MM-DD"),// finishDate: moment(item.end_date).format("YYYY-MM-DD"),//
actualStartDate: moment(item.actual_start_date).format("YYYY-MM-DD"),// actualStartDate: moment(item.planned_start).format("YYYY-MM-DD"),//
actualFinishDate: moment(item.actual_end_date).format("YYYY-MM-DD"),// actualFinishDate: moment(item.planned_end).format("YYYY-MM-DD"),//
}; };
editProgressTaskApi(data).then((res) => { editProgressTaskApi(data).then((res) => {
console.log("修改的数据", res); console.log("修改的数据", res);
this_.getParentChildList(); this_.getParentChildList();
}); });
}); });
this_.events.push(onAfterTaskDrag)
// //
gantt.attachEvent("onTaskDrag", function (id, mode, task, original) { gantt.attachEvent("onTaskDrag", function (id, mode, task, original) {
@ -446,19 +499,21 @@ export default {
this.projectSn = this.$store.state.projectSn; this.projectSn = this.$store.state.projectSn;
this.getParentChildList(); this.getParentChildList();
}, },
beforeDestroy () {
this.events.forEach(ele => {
gantt.detachEvent(ele)
})
},
methods: { methods: {
// //
changeTask() { changeTask(ganttValue) {
// return // return
console.log("开始数据整理"); const taskCount = ganttValue.length;
const taskCount = gantt.getTaskCount();
let taskData = []; let taskData = [];
let openTask = []; let openTask = [];
for (let i = 0; i < taskCount; i++) { for (let i = 0; i < taskCount; i++) {
let taskOne = {}; let taskOne = {};
const obj = gantt.getTaskByIndex(i); const obj = ganttValue[i];
console.log("整理数据的 ", obj);
console.log("整理数据的 大小", typeof obj.id);
if (obj == null || typeof obj.id === "number") { if (obj == null || typeof obj.id === "number") {
continue; continue;
} }
@ -470,12 +525,9 @@ export default {
// //
taskOne.id = obj.id; taskOne.id = obj.id;
taskOne.text = obj.taskName || obj.text; taskOne.text = obj.taskName || obj.text;
// if (obj.start_date != null) {
// taskOne.start_date = moment(obj.start_date).format("YYYY-MM-DD");
// }
// if (obj.end_date != null) {
// taskOne.end_date = moment(obj.end_date).format("YYYY-MM-DD");
// }
if (obj.startDate != null) { if (obj.startDate != null) {
taskOne.start_date = moment(obj.startDate).format("YYYY-MM-DD"); taskOne.start_date = moment(obj.startDate).format("YYYY-MM-DD");
@ -484,14 +536,12 @@ export default {
taskOne.end_date = moment(obj.finishDate).format("YYYY-MM-DD"); taskOne.end_date = moment(obj.finishDate).format("YYYY-MM-DD");
} }
if (obj.actualStartDate != null) { if (obj.actualStartDate != null) {
taskOne.actual_start_date = moment(obj.actualStartDate).format( taskOne.planned_start = moment(obj.actualStartDate).format(
"YYYY-MM-DD" "YYYY-MM-DD"
); );
} }
if (obj.actualFinishDate != null) { if (obj.actualFinishDate != null) {
taskOne.actual_end_date = moment(obj.actualFinishDate).format( taskOne.planned_end = moment(obj.actualFinishDate).format("YYYY-MM-DD");
"YYYY-MM-DD"
);
} }
taskOne.duration = obj.duration; taskOne.duration = obj.duration;
@ -509,6 +559,9 @@ export default {
if (obj.parentId) { if (obj.parentId) {
taskOne.parent = obj.parentId; taskOne.parent = obj.parentId;
} }
if(i == 0) {
console.log("第一条数据结构 ", JSON.stringify(taskOne));
}
taskData.push(taskOne); taskData.push(taskOne);
} }
this.$props.tasks.data = taskData; this.$props.tasks.data = taskData;
@ -527,15 +580,11 @@ export default {
getParentChildListApi({ projectSn: this.projectSn }).then((res) => { getParentChildListApi({ projectSn: this.projectSn }).then((res) => {
this.check(res.result); this.check(res.result);
this.dataList = res.result; this.dataList = res.result;
console.log("甘特图列表数据", this.tasks.data);
console.log(" this.$props.tasks", this.$props.tasks);
this.$props.tasks.data = this.tasks.data; this.$props.tasks.data = this.tasks.data;
console.log(" this.$props.tasks 赋值后", this.$props.tasks); // gantt.parse(this.$props.tasks);
this.changeTask(this.tasks.data);
gantt.parse(this.$props.tasks);
this.changeTask();
}); });
}, },
check(val) { check(val) {
@ -543,7 +592,6 @@ export default {
val.forEach((res) => { val.forEach((res) => {
this.tasks.data.push(res); this.tasks.data.push(res);
if (res.predecessorIds != "" && res.predecessorIds != null) { if (res.predecessorIds != "" && res.predecessorIds != null) {
console.log("res.predecessorIds---", res.predecessorIds);
let dataLinks = res.predecessorIds.split(","); let dataLinks = res.predecessorIds.split(",");
let dataLink = { let dataLink = {
source: dataLinks[dataLinks.length - 1], source: dataLinks[dataLinks.length - 1],
@ -594,17 +642,6 @@ export default {
<style lang="less" scoped> <style lang="less" scoped>
@import "~dhtmlx-gantt/codebase/dhtmlxgantt.css"; @import "~dhtmlx-gantt/codebase/dhtmlxgantt.css";
// ::v-deep .gantt_cell{
// width: 200px;
// // border: 1px solid red;
// /* */
// white-space: nowrap;
// /* */
// text-overflow: ellipsis;
// /* */
// overflow: hidden;
// }
::v-deep .gantt_tree_content { ::v-deep .gantt_tree_content {
height: 100%; height: 100%;
white-space: nowrap; white-space: nowrap;
@ -613,4 +650,5 @@ export default {
overflow: hidden; overflow: hidden;
cursor: pointer; cursor: pointer;
} }
</style> </style>

View File

@ -4143,10 +4143,10 @@
"integrity" "sha512-ZIzRpLJrOj7jjP2miAtgqIfmzbxa4ZOr5jJc601zklsfEx9oTzmmj2nVpIPRpNlRTIh8lc1kyViIY7BWSGNmKw==" "integrity" "sha512-ZIzRpLJrOj7jjP2miAtgqIfmzbxa4ZOr5jJc601zklsfEx9oTzmmj2nVpIPRpNlRTIh8lc1kyViIY7BWSGNmKw=="
"version" "2.0.4" "version" "2.0.4"
"dhtmlx-gantt@^7.1.12": "dhtmlx-gantt@^7.1.13":
"integrity" "sha512-8xC/DbBR/jqy6bnTT+qc6uKZPdQwYqpw6U8LJRb2A9Uz0BdYvKCptVfXIQOERFOLEqjymSzbCu4z/OwmabuCrg==" "integrity" "sha512-PnVk6HI8LcOu1E6o9sJ5UpeWRiaXLnNa5t3i0oFPXPVkDrDyZdNr0KduryF45R7DWMSyMkxJ9RGJ+iUiqQCDhg=="
"resolved" "https://registry.npmmirror.com/dhtmlx-gantt/-/dhtmlx-gantt-7.1.12.tgz" "resolved" "https://registry.npmmirror.com/dhtmlx-gantt/-/dhtmlx-gantt-7.1.13.tgz"
"version" "7.1.12" "version" "7.1.13"
"diffie-hellman@^5.0.0": "diffie-hellman@^5.0.0":
"integrity" "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==" "integrity" "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg=="
@ -6267,6 +6267,18 @@
"merge-stream" "^2.0.0" "merge-stream" "^2.0.0"
"supports-color" "^7.0.0" "supports-color" "^7.0.0"
"jquery-ui-dist@^1.13.2":
"integrity" "sha512-oVDRd1NLtTbBwpRKAYdIRgpWVDzeBhfy7Gu0RmY6JEaZtmBq6kDn1pm5SgDiAotrnDS+RoTRXO6xvcNTxA9tOA=="
"resolved" "https://registry.npmmirror.com/jquery-ui-dist/-/jquery-ui-dist-1.13.2.tgz"
"version" "1.13.2"
dependencies:
"jquery" ">=1.8.0 <4.0.0"
"jquery@^3.6.3", "jquery@>=1.8.0 <4.0.0":
"integrity" "sha512-bZ5Sy3YzKo9Fyc8wH2iIQK4JImJ6R0GWI9kL1/k7Z91ZBNgkRXE6U0JfHIizZbort8ZunhSI3jw9I6253ahKfg=="
"resolved" "https://registry.npmmirror.com/jquery/-/jquery-3.6.3.tgz"
"version" "3.6.3"
"js-base64@^2.1.9": "js-base64@^2.1.9":
"integrity" "sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ==" "integrity" "sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ=="
"resolved" "https://registry.npmmirror.com/js-base64/-/js-base64-2.6.4.tgz" "resolved" "https://registry.npmmirror.com/js-base64/-/js-base64-2.6.4.tgz"