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"
:page-sizes="pageSizes"
:pager-count="pagerCount"
:total="total"
:total="Number(total)"
v-bind="$attrs"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"

View File

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

View File

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

View File

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

View File

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