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

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 -- 页面 // 分布分项管理2 -- 页面
export const getProgressListDataApi = data => get('/xmgl/progressTask/getParentChildList', data);// 获取列表 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 editProgressListDataApi = data => post('/xmgl/progressTask/updateProgressTask', data);// 编辑
export const getProgressTaskApi = data => get('/xmgl/progressTask/getById', data);// 查看详情

View File

@ -1,29 +1,40 @@
<template> <template>
<div style="height: 900px"> <div style="height: 900px">
<div ref="gantt" style="height: 100%"></div> <div ref="gantt" style="height: 100%" v-loading="ganttLoading"></div>
</div> </div>
</template> </template>
<script> <script>
import { gantt } from "dhtmlx-gantt"; import { gantt } from "dhtmlx-gantt";
import moment from "moment"; import moment from "moment";
import {getProgressListDataApi} from "@/assets/js/api/scheduleInfo";
export default { export default {
name: "gantt", name: "gantt",
props: { // props: {
tasks: { // tasks: {
type: Object, // type: Object,
default() { // default() {
return { data: [], links: [] }; // return { data: [], links: [] };
}, // },
}, // },
}, // },
data() { data() {
return { return {
title: "", title: "",
width: 800, width: 800,
visible: false, visible: false,
disablesubmit: false, disablesubmit: false,
ganttLoading: false,
tasks: {
data: [],
links: []
},
projectSn:''
}; };
}, },
created(){
this.projectSn = this.$store.state.projectSn;
this.getProgressListData()
},
mounted: function () { mounted: function () {
// //
gantt.config.xml_date = "%Y-%m-%d"; gantt.config.xml_date = "%Y-%m-%d";
@ -131,10 +142,13 @@ export default {
// //
gantt.config.columns = [ gantt.config.columns = [
{ name: "text", label: "计划名称", tree: true, width: "*" }, { name: "text", label: "计划名称", tree: true, width: "*" },
{ name: "start_date", label: "开始时间", align: "center" }, { name: "startDate", label: "预计开始时间", align: "center" },
{ name: "end_date", 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: "进度", label: "进度",
align: "center", align: "center",
template: function (obj) { template: function (obj) {
@ -192,7 +206,7 @@ export default {
return task.text; return task.text;
}; };
gantt.init(this.$refs.gantt); gantt.init(this.$refs.gantt);
gantt.parse(this.$props.tasks); gantt.parse(this.tasks);
let this_ = this; let this_ = this;
// //
gantt.attachEvent("onAfterTaskAdd", function (id, item) { gantt.attachEvent("onAfterTaskAdd", function (id, item) {
@ -229,8 +243,31 @@ export default {
}); });
}, },
methods: { 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() { changeTask() {
const taskCount = gantt.getTaskCount(); const taskCount = gantt.getTaskCount();
console.log('看一下',taskCount)
let taskData = []; let taskData = [];
let openTask = []; let openTask = [];
for (let i = 0; i < taskCount; i++) { for (let i = 0; i < taskCount; i++) {
@ -254,11 +291,11 @@ export default {
} }
taskData.push(taskOne); taskData.push(taskOne);
} }
this.$props.tasks.data = taskData; this.tasks.data = taskData;
// //
gantt.clearAll(); gantt.clearAll();
// //
gantt.parse(this.$props.tasks); gantt.parse(this.tasks);
//使 //使
openTask.forEach((id) => { openTask.forEach((id) => {
gantt.open(id); gantt.open(id);

View File

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

View File

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