进度工程管理(分部分项管理):导入导出编辑

This commit is contained in:
骆乐 2022-11-02 10:22:59 +08:00
parent dd3d35c37f
commit ed12e2f634
4 changed files with 283 additions and 243 deletions

View File

@ -15,8 +15,9 @@ export const deletetProgressItemApi = data => post('/xmgl/progressItem/delete',
// 分布分项管理2 -- 页面
export const getProgressListDataApi = data => get('/xmgl/progressTask/getParentChildList', data);// 获取列表
export const importDataApi = data => get('/xmgl/progressTask/importData', data);// 导入
export const editProgressListDataApi = data => post('/xmgl/progressTask/updateProgressTask', data);// 编辑
export const getProgressTaskApi = data => get('/xmgl/progressTask/getById', data);// 查看详情

View File

@ -1,29 +1,40 @@
<template>
<div style="height: 900px">
<div ref="gantt" style="height: 100%"></div>
<div ref="gantt" style="height: 100%" v-loading="ganttLoading"></div>
</div>
</template>
<script>
import { gantt } from "dhtmlx-gantt";
import moment from "moment";
import {getProgressListDataApi} from "@/assets/js/api/scheduleInfo";
export default {
name: "gantt",
props: {
tasks: {
type: Object,
default() {
return { data: [], links: [] };
},
},
},
// props: {
// tasks: {
// type: Object,
// default() {
// return { data: [], links: [] };
// },
// },
// },
data() {
return {
title: "",
width: 800,
visible: false,
disablesubmit: false,
ganttLoading: false,
tasks: {
data: [],
links: []
},
projectSn:''
};
},
created(){
this.projectSn = this.$store.state.projectSn;
this.getProgressListData()
},
mounted: function () {
//
gantt.config.xml_date = "%Y-%m-%d";
@ -131,10 +142,13 @@ export default {
//
gantt.config.columns = [
{ name: "text", label: "计划名称", tree: true, width: "*" },
{ name: "start_date", label: "开始时间", align: "center" },
{ name: "end_date", label: "结束时间", align: "center" },
{ name: "startDate", label: "预计开始时间", align: "center" },
{ name: "finishDate", label: "预计结束时间", align: "center" },
{ name: "actualStartDate", label: "实际开始时间", align: "center" },
{ name: "actualFinishDate", label: "实际结束时间", align: "center" },
{ name: "duration", label: "工期", align: "center" },
{
name: "progress",
name: "progressRatio",
label: "进度",
align: "center",
template: function (obj) {
@ -192,7 +206,7 @@ export default {
return task.text;
};
gantt.init(this.$refs.gantt);
gantt.parse(this.$props.tasks);
gantt.parse(this.tasks);
let this_ = this;
//
gantt.attachEvent("onAfterTaskAdd", function (id, item) {
@ -229,8 +243,31 @@ export default {
});
},
methods: {
//
getProgressListData() {
this.ganttLoading= true;
this.tasks.data = [];
let data = {
projectSn: this.projectSn,
};
getProgressListDataApi(data).then((res) => {
if (res.code == 200) {
console.log("获取到的列表", res);
this.tasks.data = res.result;
// :gantt
gantt.parse(this.tasks);
console.log('获取到的列表',this.tasks)
//
gantt.refreshData();
this.ganttLoading= false;
}else{
this.$message.error('查询失败!');
}
});
},
changeTask() {
const taskCount = gantt.getTaskCount();
console.log('看一下',taskCount)
let taskData = [];
let openTask = [];
for (let i = 0; i < taskCount; i++) {
@ -254,11 +291,11 @@ export default {
}
taskData.push(taskOne);
}
this.$props.tasks.data = taskData;
this.tasks.data = taskData;
//
gantt.clearAll();
//
gantt.parse(this.$props.tasks);
gantt.parse(this.tasks);
//使
openTask.forEach((id) => {
gantt.open(id);

View File

@ -256,7 +256,7 @@
</div>
</template>
<script>
import { getDetailInfoApi, addPlanInfoApi } from "@/assets/js/api/scheduleInfo";
import { getProgressTaskApi,getDetailInfoApi, addPlanInfoApi } from "@/assets/js/api/scheduleInfo";
export default {
props: ["id"],
mounted() {},
@ -341,17 +341,17 @@ export default {
//
getDetailInfo() {
let data = {
projectSn: this.projectSn,
itemId: this.seedId,
id: this.seedId,
};
getDetailInfoApi(data).then((res) => {
getProgressTaskApi(data).then((res) => {
if (res.code == 200) {
this.itemForm = res.result.itemDetail;
this.planList = res.result.feedbackList;
//
this.fileList = res.result.itemDetail.fileUrl
? [JSON.parse(res.result.itemDetail.fileUrl)]
: [];
console.log('查看详情',res)
// this.itemForm = res.result.itemDetail;
// this.planList = res.result.feedbackList;
// //
// this.fileList = res.result.itemDetail.fileUrl
// ? [JSON.parse(res.result.itemDetail.fileUrl)]
// : [];
} else {
this.$message.error(res.message);
}

View File

@ -13,24 +13,19 @@
class="expintBtn"
size="medium"
type="primary"
@click="downloadMmp"
@click="downloadFn"
>
下载模板
<a class="down" :href="downUrl" download>下载模板</a>
</el-button>
<el-button @click="test">
测试
</el-button>
<!-- uploadUrl + :data="{ projectSn: projectSn,createUserId: createUserId}"
:action="$http.defaults.baseURL + '/xmgl/progressTask/importData'" -->
<el-upload
class="upload-demo expintBtn"
name="mppFile"
action=""
:before-upload="beforeUpload"
:on-success="handleImportSuccess"
:on-change="handleImportChange"
:before-upload="beforeUpload"
:file-list="fileList"
:http-request="upload"
:action="$http.defaults.baseURL + 'xmgl/progressTask/importData'"
:data="{ projectSn: projectSn, createUserId: createUserId }"
:show-file-list="false"
>
<el-button size="medium" type="primary">导入</el-button>
@ -46,11 +41,15 @@
lazy
row-key="id"
default-expand-all
:tree-props="{ children: 'children'}"
:tree-props="{ children: 'children' }"
@row-click="showDetail"
>
<!-- 分部分项工程名称 -->
<el-table-column width="400" prop="taskName" :label="$t('message.projectManage.NameOfSubProject')">
<el-table-column
width="400"
prop="taskName"
:label="$t('message.projectManage.NameOfSubProject')"
>
</el-table-column>
<!-- 计划开始日期 -->
<el-table-column
@ -61,7 +60,13 @@
<!-- 预计完成日期 -->
<el-table-column
prop="finishDate"
:label="$t('message.projectManage.predictCompleteDate')"
label="计划完成日期"
>
</el-table-column>
<!-- 实际开始日期 -->
<el-table-column
prop="actualStartDate"
label="实际开始日期"
>
</el-table-column>
<!-- 实际完成日期 -->
@ -86,8 +91,7 @@
>
<template slot-scope="scope">
<el-tag
v-show="
(scope.row.id && scope.row.status == 0)"
v-show="scope.row.id && scope.row.status == 0"
type="info"
effect="plain"
size="medium"
@ -96,8 +100,7 @@
{{ $t("message.projectManage.notStart") }}
</el-tag>
<el-tag
v-show="
(scope.row.id && scope.row.status == 1)"
v-show="scope.row.id && scope.row.status == 1"
type="warning"
effect="plain"
size="medium"
@ -106,8 +109,7 @@
{{ $t("message.projectManage.underway") }}
</el-tag>
<el-tag
v-show="
(scope.row.id && scope.row.status == 2)"
v-show="scope.row.id && scope.row.status == 2"
type="success"
effect="plain"
size="medium"
@ -119,7 +121,10 @@
</el-table-column>
<el-table-column width="150" label="操作">
<template slot-scope="scope">
<el-button @click.native.stop="editBefore(scope.row)" type="text">
<el-button
@click.native.stop="editBefore(scope.row)"
type="text"
>
<i class="el-icon-edit"></i>编辑
</el-button>
</template>
@ -227,6 +232,13 @@
<el-option label="已完成" :value="2"></el-option>
</el-select>
</el-form-item>
<!-- 进度 -->
<el-form-item label="进度" prop="progressRatio">
<el-input
v-model="workerInfo.progressRatio"
:placeholder="$t('message.workType.placeholder')"
></el-input>
</el-form-item>
<!-- 任务模式 -->
<el-form-item label="任务模式" prop="taskTypeId">
<el-select v-model="workerInfo.taskTypeId" placeholder="请选择">
@ -258,7 +270,7 @@
<!-- 任务工期 -->
<el-form-item label="任务工期" prop="duration">
<el-input
:disabled = "showTime"
:disabled="workerInfo.taskTypeId == '1'"
v-model="workerInfo.duration"
:placeholder="$t('message.workType.placeholder')"
></el-input>
@ -305,10 +317,7 @@
<script>
import {
getProgressListDataApi,
importDataApi,
editProgressListDataApi,
addProgressManageApi,
addProgressItemApi,
getPrincipalLsitApi,
@ -318,7 +327,7 @@ import {
deletetProgressItemApi,
} from "@/assets/js/api/scheduleInfo";
import detailpage from "./projectNodeDetail";
import axios from 'axios'
import axios from "axios";
export default {
components: {
detailpage,
@ -327,8 +336,9 @@ export default {
data() {
return {
fileList: [], //
downUrl: "", //
projectSn: "",
createUserId:"",
createUserId: "",
listData: [],
isAddSon: false,
uploadUrl: "",
@ -336,21 +346,22 @@ export default {
dialogVisible: false, //
workerInfo: {
taskName: "",
startDate:"",
finishDate:"",
actualStartDate:"",
actualFinishDate:"",
personCharge:"",
status:"",
taskTypeId:"",
fileUrl:"",
duration:"",
remark:"",
startDate: "",
finishDate: "",
actualStartDate: "",
actualFinishDate: "",
personCharge: "",
status: "",
taskTypeId: "",
progressRatio: "",
fileUrl: "",
duration: "",
remark: "",
},
principalLsit: [], //
fileList: [],
seedId: "",
showTime:false, //
showTime: false, //
queryInfo: {},
type: "add",
// type: "detail",
@ -383,50 +394,34 @@ export default {
},
created() {
this.projectSn = this.$store.state.projectSn;
this.createUserId = this.$store.state.userInfo.userId
this.createUserId = this.$store.state.userInfo.userId;
this.uploadUrl = this.$store.state.UPLOADURL;
this.fileUrl = this.$store.state.FILEURL;
this.getProgressListData();
},
methods: {
//
test(){
console.log('----测试')
importDataApi({projectSn: this.projectSn,createUserId: this.createUserId}).then((res)=>{
console.log('=====',res)
})
},
//
downloadMmp(){
},
beforeUpload(file){
// console.log('',file)
const fd = new FormData();
fd.append("file", file);
downloadFn() {
this.downUrl =
this.$store.state.BASEURL + "xmgl/progressTask/downloadTemplate";
},
//
handleImportSuccess(res){
console.log('上传成功',res)
handleImportSuccess(res) {
console.log("上传成功", res);
},
//
handleImportChange(file, fileList){
console.log((file, fileList))
//
beforeUpload(file) {
console.log("=========", file);
},
upload(param) {
const formData = new FormData()
formData.append('file', param.file)
const url = this.$http.defaults.baseURL + '/xmgl/progressTask/importData'
axios.get(url, formData).then(res => {
console.log('成功了吗',res)
}).catch(response => {
console.log('图片上传失败')
})
// mpp
handleImportChange(file, fileList) {
console.log("=[====]");
// console.log((file, fileList))
},
//
showDetail(row){
console.log('查详情',row)
showDetail(row) {
console.log("查详情", row);
this.type = "detail";
this.seedId = row.id;
},
@ -455,7 +450,7 @@ export default {
};
getPrincipalLsitApi(data).then((res) => {
if (res.code == 200) {
console.log('负责人',res)
console.log("负责人", res);
this.principalLsit = res.result;
}
});
@ -486,21 +481,24 @@ export default {
//
editBefore(val) {
console.log('=====',val)
this.workerInfo = (JSON.parse(JSON.stringify(val)))
console.log("=====", val);
this.workerInfo = JSON.parse(JSON.stringify(val));
this.fileList = val.fileUrl ? JSON.parse(val.fileUrl) : [];
this.dialogVisible = true;
},
//
submitBtn() {
// if(this.workerInfo.state == "2" && this.workerInfo.actualStartDate == "" && this.workerInfo.actualFinishDate == "" ){
// this.$message.error("");
// }
this.$refs.addEditForm.validate((valid) => {
if(valid) {
if(this.workerInfo.state == "1" && this.workerInfo.actualStartDate == "") {
this.$message.error("请输入实际开始时间");
}else {
if (valid) {
if (this.workerInfo.status == "1" && this.workerInfo.actualStartDate == null) {
this.$message.error("请输入实际开始时间!");
} else if (this.workerInfo.status == "2") {
if (this.workerInfo.actualStartDate == null) {
this.$message.error("请输入实际开始时间!");
} else if (this.workerInfo.actualFinishDate == null) {
this.$message.error("请输入实际完成时间!");
}
} else {
//
let data = this.workerInfo;
data.projectSn = this.projectSn;
@ -518,11 +516,15 @@ export default {
return false;
}
});
}
},
},
};
</script>
<style lang="less" scoped>
.down {
text-decoration: none;
color: #fff;
}
.expintBtn {
display: inline-block !important;
margin-right: 10px;