Merge branch 'dev-yjl' into 'shenzhen-dev'

甘特图页面、及bug修复

See merge request !63
This commit is contained in:
yjlHub 2022-11-23 16:18:35 +08:00
commit c6bfea0dec
5 changed files with 173 additions and 65 deletions

View File

@ -7,7 +7,7 @@
:layout="layout" :layout="layout"
:page-sizes="pageSizes" :page-sizes="pageSizes"
:pager-count="pagerCount" :pager-count="pagerCount"
:total="total" :total="Number(total)"
v-bind="$attrs" v-bind="$attrs"
@size-change="handleSizeChange" @size-change="handleSizeChange"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"

View File

@ -50,7 +50,7 @@
<div class="header-box"> <div class="header-box">
<img src="@/assets/images/laborManage/greenCode.png" alt="" /> <img src="@/assets/images/laborManage/greenCode.png" alt="" />
<div> <div>
<p v-if="projectType == 'common' || projectType == 'zjsj'"> 绿码人数 </p> <p v-if="projectType == 'common' || projectType == 'zjsj'"> 健康码人数 </p>
<p v-else>昌通码绿码人数</p> <p v-else>昌通码绿码人数</p>
<h2>{{ statisticalData.greenCodeNum }}</h2> <h2>{{ statisticalData.greenCodeNum }}</h2>
</div> </div>
@ -419,7 +419,7 @@ export default {
containLabel: true, containLabel: true,
}, },
legend: { legend: {
data: ["昌通码绿码人数", "异常码人数", "进入人数", "外出人数"], data: ["健康码人数", "异常码人数", "进入人数", "外出人数"],
bottom: "-1%", bottom: "-1%",
}, },
xAxis: [ xAxis: [
@ -464,7 +464,7 @@ export default {
], ],
series: [ series: [
{ {
name: "昌通码绿码人数", name: "健康码人数",
type: "bar", type: "bar",
barWidth: 30, // barWidth: 30, //
itemStyle: { itemStyle: {

View File

@ -90,7 +90,7 @@
:page-sizes="$store.state.PAGESIZRS" :page-sizes="$store.state.PAGESIZRS"
:page-size="pageSize" :page-size="pageSize"
layout="total, sizes, prev, pager, next" layout="total, sizes, prev, pager, next"
:total="total" :total="Number(total)"
background background
></el-pagination> ></el-pagination>
</div> </div>

View File

@ -180,7 +180,7 @@
:page-sizes="$store.state.PAGESIZRS" :page-sizes="$store.state.PAGESIZRS"
:page-size="searchForm.pageSize" :page-size="searchForm.pageSize"
layout="total, sizes, prev, pager, next" layout="total, sizes, prev, pager, next"
:total="pageTotal" :total="Number(pageTotal)"
></el-pagination> ></el-pagination>
</div> </div>
<!-- 新增任务弹窗 --> <!-- 新增任务弹窗 -->
@ -575,22 +575,22 @@
</div> </div>
</template> </template>
<script> <script>
function getNowWithLine() { // function getNowWithLine() {
var date = new Date(); // var date = new Date();
var seperator1 = "-"; // var seperator1 = "-";
var seperator2 = ":"; // var seperator2 = ":";
var month = date.getMonth() + 1; // var month = date.getMonth() + 1;
var strDate = date.getDate(); // var strDate = date.getDate();
if (month >= 1 && month <= 9) { // if (month >= 1 && month <= 9) {
month = "0" + month; // month = "0" + month;
} // }
if (strDate >= 0 && strDate <= 9) { // if (strDate >= 0 && strDate <= 9) {
strDate = "0" + strDate; // strDate = "0" + strDate;
} // }
var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate; // var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate;
return currentdate; // return currentdate;
} // }
let currentdate = getNowWithLine() // let currentdate = getNowWithLine()
import { import {
gethiddenDangerInspectRecordApi, gethiddenDangerInspectRecordApi,
getselectHiddenDangerRectifyRecordListApi, getselectHiddenDangerRectifyRecordListApi,
@ -635,7 +635,7 @@ export default {
checkItem2:'', checkItem2:'',
changeUser: '', changeUser: '',
enterpriseSn: '', enterpriseSn: '',
changeLimitTime: currentdate, changeLimitTime: '',
}, },
opts:{ opts:{
value: "id", value: "id",

View File

@ -21,22 +21,20 @@ export default {
default() { default() {
return { return {
data: [], data: [],
links: [ links: [],
{ source: 1, target: 2, type: "1" }, //sourceidtargetpredecessorIds","
{ source: 2, target: 3, type: "0" },
],
}; };
}, },
}, },
}, },
data() { data() {
return { return {
dataLinks: [],
title: "", title: "",
width: 800, width: 800,
visible: false, visible: false,
disablesubmit: false, disablesubmit: false,
projectSn: "", //sn projectSn: "", //sn
dataList:[],// dataList: [], //
}; };
}, },
mounted: function () { mounted: function () {
@ -45,7 +43,7 @@ export default {
// //
gantt.config.autofit = true; gantt.config.autofit = true;
// //
gantt.config.grid_width = 850; gantt.config.grid_width = 1000;
//线 //线
gantt.config.drag_links = true; gantt.config.drag_links = true;
// //
@ -119,7 +117,7 @@ export default {
//----- //-----
section_status: "完成状态:", section_status: "完成状态:",
section_progress: "进度比例:", section_progress: "进度比例:",
section_taskmode: "任务模式:", section_taskTypeId: "任务模式:",
section_taskduration: "任务工期:", section_taskduration: "任务工期:",
/* grid columns */ /* grid columns */
@ -157,18 +155,19 @@ export default {
// //
gantt.config.columns = [ gantt.config.columns = [
{ name: "id", label: "id", width: "160", align: "center" }, { name: "id", label: "id", width: "160", align: "center" },
{ {
name: "text", name: "text",
label: "任务名称", label: "任务名称",
tree: true, tree: true,
width: "120", width: "150",
align: "center", align: "center",
resize: true, resize: true,
}, },
{ {
name: "predecessorIds", name: "predecessorIds",
label: "前置任务", label: "前置任务",
width: "100", width: "140",
align: "center", align: "center",
resize: true, resize: true,
}, },
@ -202,7 +201,7 @@ export default {
}, },
{ name: "duration", label: "任务工期", align: "center" }, { name: "duration", label: "任务工期", align: "center" },
{ {
name: "duration", name: "progressRatio",
label: "进度比例", label: "进度比例",
align: "center", align: "center",
resize: true, resize: true,
@ -238,21 +237,21 @@ export default {
map_to: "status", map_to: "status",
type: "select", type: "select",
options: [ options: [
{ value: 0, label: "未开始" }, { key: 0, label: "未开始" },
{ value: 1, label: "进行中" }, { key: 1, label: "进行中" },
{ value: 2, label: "已完成" }, { key: 2, label: "已完成" },
], ],
}, },
// //
{ {
name: "taskmode", name: "taskTypeId",
height: 30, height: 30,
map_to: "taskTypeId", map_to: "taskTypeId",
type: "select", type: "select",
options: [ options: [
{ value: 0, label: "手动" }, { key: 0, label: "手动" },
{ value: 1, label: "自动" }, { key: 1, label: "自动" },
], ],
}, },
// //
@ -309,31 +308,81 @@ export default {
let this_ = this; let this_ = this;
// //
gantt.attachEvent("onAfterTaskAdd", function (id, item) { gantt.attachEvent("onAfterTaskAdd", function (id, item) {
console.log("添加后触发", item); console.log("添加后触发", this_.dataList);
// addProgressTaskApi(this.dataList).then((res) => { console.log("添加后触发 item", item);
// console.log("",res);
// });
this_.changeTask(); if (item.parent != 0 && item.parent != null) {
this_.checkLinks(this_.dataList, item.parent);
} else {
console.log("父亲调用");
this_.dataList.forEach((res) => {
this_.dataLinks.push(res.id);
});
}
console.log("添加后触发 predecessorIds 2-- ", this_.dataLinks);
let data = {
children: [],
duration: item.duration,
feedbackList: [],
parentId: item.parent,
predecessorIds: this_.dataLinks.join(","),
progressRatio: item.progress,
remark: item.remark,
startDate: item.start_date,
status: item.status,
projectSn: this_.$store.state.projectSn,
createUserId: this_.$store.state.userInfo.userId,
taskName: item.text,
taskTypeId: item.taskTypeId,
finishDate: item.end_date,
};
addProgressTaskApi(data).then((res) => {
console.log("添加的数据", res);
this_.getParentChildList();
});
this_.dataLinks = []
}); });
// //
gantt.attachEvent("onAfterTaskDrag", function (id, mode, e) { gantt.attachEvent("onAfterTaskDrag", function (id, mode, e) {
console.log("移动进度后触发mode", mode); // console.log("mode", mode);
this_.changeTask(); // this_.changeTask();
}); });
// //
gantt.attachEvent("onAfterTaskMove", function (id, parent, tindex) { gantt.attachEvent("onAfterTaskMove", function (id, parent, tindex) {
console.log("移动任务后触发", mode); // console.log("", mode);
this_.changeTask(); // this_.changeTask();
}); });
// //
gantt.attachEvent("onAfterTaskDelete", function (id, item) { gantt.attachEvent("onAfterTaskDelete", function (id, item) {
console.log("删除任务后触发"); console.log("删除任务后触发,", id);
this_.changeTask(); deleteTaskAlarmApi({ id: id }).then((res) => {
console.log("添加的数据", res);
gantt.parse(this.$props.tasks);
this_.getParentChildList();
});
}); });
// //
gantt.attachEvent("onAfterTaskUpdate", function (id, item) { gantt.attachEvent("onAfterTaskUpdate", function (id, item) {
console.log("修改任务后触发"); console.log("修改任务后触发",item);
this_.changeTask(); let data = {
duration: item.duration,
progressRatio: item.progress,
remark: item.remark,
startDate: item.start_date,
status: item.status,
id: id,
projectSn: this_.$store.state.projectSn,
createUserId: this_.$store.state.userInfo.userId,
taskName: item.text,
taskTypeId: item.taskTypeId,
finishDate: item.end_date,
};
editProgressTaskApi(data).then((res) => {
console.log("修改的数据", res);
this_.getParentChildList();
});
}); });
// //
@ -343,13 +392,15 @@ export default {
// //
gantt.attachEvent("onLightboxSave", function (id, item) { gantt.attachEvent("onLightboxSave", function (id, item) {
setTimeout(function () { // setTimeout(function () {
console.log("保存验证,", item); item.ck = item.duration;
if (!item.taskName) {
gantt.message({ type: "error", taskName: "请填写任务名称!" }); console.log("保存验证,", item);
return false; // if (!item.taskName) {
} // gantt.message({ type: "error", taskName: "!" });
}, 2000); // return false;
// }
// }, 2000);
return true; return true;
}); });
}, },
@ -368,6 +419,10 @@ export default {
let taskOne = {}; let taskOne = {};
const obj = gantt.getTaskByIndex(i); const obj = gantt.getTaskByIndex(i);
console.log("整理数据的 ", obj); console.log("整理数据的 ", obj);
console.log("整理数据的 大小", taskCount);
if (obj == null) {
continue;
}
taskOne.taskName = obj.taskName; taskOne.taskName = obj.taskName;
// //
if (obj.$open == true) { if (obj.$open == true) {
@ -403,19 +458,21 @@ export default {
taskOne.duration = obj.duration; taskOne.duration = obj.duration;
taskOne.progress = obj.progressRatio; taskOne.progress = obj.progressRatio;
taskOne.projectSn = obj.projectSn;
taskOne.description = obj.remark; taskOne.description = obj.remark;
taskOne.predecessorIds = obj.predecessorIds; taskOne.predecessorIds = obj.predecessorIds;
taskOne.parent = obj.parent taskOne.parent = obj.parent;
taskOne.color = "#3db9d3"; taskOne.color = "#3db9d3";
taskOne.status = obj.status;
taskOne.taskTypeId = obj.taskTypeId;
if (obj.parentId) { if (obj.parentId) {
taskOne.parent = obj.parentId; taskOne.parent = obj.parentId;
} }
taskData.push(taskOne); taskData.push(taskOne);
} }
this.$props.tasks.data = taskData; this.$props.tasks.data = taskData;
console.log(this.$props.tasks); console.log(this.$props.tasks);
console.log(this.$props.tasks);
// //
gantt.clearAll(); gantt.clearAll();
// //
@ -428,14 +485,65 @@ export default {
// //
getParentChildList() { getParentChildList() {
getParentChildListApi({ projectSn: this.projectSn }).then((res) => { getParentChildListApi({ projectSn: this.projectSn }).then((res) => {
this.tasks.data = res.result; this.check(res.result);
this.dataList=res.result this.dataList = res.result;
console.log("甘特图列表数据", this.tasks.data); console.log("甘特图列表数据", this.tasks.data);
console.log(" this.dataList", this.dataList); console.log(" this.dataList", this.dataList);
gantt.parse(this.$props.tasks); gantt.parse(this.$props.tasks);
this.changeTask(); this.changeTask();
}); });
}, },
check(val) {
let arr = [];
val.forEach((res) => {
this.tasks.data.push(res);
if (res.predecessorIds != "" && res.predecessorIds != null) {
console.log("res.predecessorIds---", res.predecessorIds);
let dataLinks = res.predecessorIds.split(",");
let dataLink = {
source: dataLinks[dataLinks.length - 1],
target: res.id,
type: "1",
};
this.tasks.links.push(dataLink);
}
if (res.children.length >= 1) {
res.children.forEach((restwo) => {
arr.push(restwo);
});
}
});
if (arr.length >= 1) {
this.check(arr);
}
},
checkLinks(val, id) {
let arrLink = [];
val.forEach((res) => {
if (res.id === id) {
console.log(
"找到爸爸了 --" + id + "---- children -" + res.children
);
if (res.children != null && res.children.length >= 1) {
res.children.forEach((resLink) => {
this.dataLinks.push(resLink.id);
});
console.log("找到爸爸了 ,返回的数据 ", this.dataLinks);
}
} else {
if (res.children != null && res.children.length != 0) {
res.children.forEach((resLink) => {
arrLink.push(resLink);
});
}
}
});
if (arrLink.length >= 1) {
this.checkLinks(arrLink, id);
}
},
}, },
}; };
</script> </script>