|
|
@@ -1,13 +1,18 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
- <el-form ref="form" :model="form" :rules="rules" class="el-form-box" label-width="120px">
|
|
|
-
|
|
|
+ <el-form
|
|
|
+ ref="form"
|
|
|
+ :model="form"
|
|
|
+ :rules="rules"
|
|
|
+ class="el-form-box"
|
|
|
+ label-width="120px"
|
|
|
+ >
|
|
|
<el-row>
|
|
|
<el-col :span="8">
|
|
|
-<!-- prop="projectId" -->
|
|
|
- <el-form-item label="关联项目" >
|
|
|
+ <!-- prop="projectId" -->
|
|
|
+ <el-form-item label="关联项目">
|
|
|
<ele-tree-select
|
|
|
- :disabled="dialogType=='view'"
|
|
|
+ :disabled="dialogType == 'view'"
|
|
|
ref="projectTreeSelect"
|
|
|
clearable
|
|
|
filterable
|
|
|
@@ -25,19 +30,26 @@
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="关联项目阶段" prop="projectStageId">
|
|
|
- <el-select v-model="form.projectStageId" :disabled="dialogType=='view'" style="width: 100%"
|
|
|
- @change="changeProjectStage" clearable>
|
|
|
- <el-option v-for="item in projectStageList" :label="item.name" :value="item.id"
|
|
|
- :key="item.id"></el-option>
|
|
|
+ <el-select
|
|
|
+ v-model="form.projectStageId"
|
|
|
+ :disabled="dialogType == 'view'"
|
|
|
+ style="width: 100%"
|
|
|
+ @change="changeProjectStage"
|
|
|
+ clearable
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in projectStageList"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id"
|
|
|
+ :key="item.id"
|
|
|
+ ></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
- <el-form-item
|
|
|
- label="关联项目BOM"
|
|
|
- prop="projectBomId">
|
|
|
+ <el-form-item label="关联项目BOM" prop="projectBomId">
|
|
|
<ele-tree-select
|
|
|
- :disabled="dialogType=='view'"
|
|
|
+ :disabled="dialogType == 'view'"
|
|
|
clearable
|
|
|
ref="projectRef"
|
|
|
filterable
|
|
|
@@ -60,12 +72,11 @@
|
|
|
<!-- :key="item.id"></el-option>-->
|
|
|
<!-- </el-select>-->
|
|
|
<!-- </el-form-item>-->
|
|
|
- <el-form-item
|
|
|
- label="关联计划">
|
|
|
+ <el-form-item label="关联计划">
|
|
|
<el-row>
|
|
|
<el-col :span="24">
|
|
|
<ele-tree-select
|
|
|
- :disabled="dialogType=='view'"
|
|
|
+ :disabled="dialogType == 'view'"
|
|
|
clearable
|
|
|
ref="planTreeRef"
|
|
|
filterable
|
|
|
@@ -96,22 +107,30 @@
|
|
|
|
|
|
<!-- </el-col>-->
|
|
|
</el-row>
|
|
|
-
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="关联计划节点" prop="planStageId">
|
|
|
- <el-select v-model="form.planStageId" :disabled="dialogType=='view'" style="width: 100%"
|
|
|
- @change="changePlanStage" clearable>
|
|
|
- <el-option v-for="item in planStageList" :label="item.name" :value="item.id"
|
|
|
- :key="item.id"></el-option>
|
|
|
+ <el-select
|
|
|
+ v-model="form.planStageId"
|
|
|
+ :disabled="dialogType == 'view'"
|
|
|
+ style="width: 100%"
|
|
|
+ @change="changePlanStage"
|
|
|
+ clearable
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in planStageList"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id"
|
|
|
+ :key="item.id"
|
|
|
+ ></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="关联任务" prop="taskId">
|
|
|
<ele-tree-select
|
|
|
- :disabled="dialogType=='view'"
|
|
|
+ :disabled="dialogType == 'view'"
|
|
|
ref="taskTreeSelect"
|
|
|
clearable
|
|
|
filterable
|
|
|
@@ -129,83 +148,97 @@
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="前置任务">
|
|
|
- <el-select v-model="form.beforeTaskId" :disabled="dialogType=='view'" style="width: 100%" clearable>
|
|
|
- <el-option v-for="item in beforeTaskList" :label="item.name" :value="item.id"
|
|
|
- :key="item.id"></el-option>
|
|
|
+ <el-select
|
|
|
+ v-model="form.beforeTaskId"
|
|
|
+ :disabled="dialogType == 'view'"
|
|
|
+ style="width: 100%"
|
|
|
+ clearable
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in beforeTaskList"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id"
|
|
|
+ :key="item.id"
|
|
|
+ ></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
-
|
|
|
-
|
|
|
</el-form>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import {projectsBomGetTreeDataAPI, projectsSelectTreeDataAPI} from "@/api/project-manage";
|
|
|
-import PersonSelect from "@/components/CommomSelect/person-select.vue";
|
|
|
-import {getBeforeTaskListAPI} from "@/api/project-manage/task";
|
|
|
-import {getTargetPlanTreeAPI} from "@/api/project-manage/plan";
|
|
|
+import {
|
|
|
+ projectsBomGetTreeDataAPI,
|
|
|
+ projectsSelectTreeDataAPI
|
|
|
+} from '@/api/project-manage';
|
|
|
+import PersonSelect from '@/components/CommomSelect/person-select.vue';
|
|
|
+import { getBeforeTaskListAPI } from '@/api/project-manage/task';
|
|
|
+import { getTargetPlanTreeAPI } from '@/api/project-manage/plan';
|
|
|
|
|
|
export default {
|
|
|
- name: "task-form",
|
|
|
- components: {PersonSelect},
|
|
|
+ name: 'task-form',
|
|
|
+ components: { PersonSelect },
|
|
|
props: {
|
|
|
dialogType: {
|
|
|
type: String,
|
|
|
- default: '',
|
|
|
+ default: ''
|
|
|
},
|
|
|
dialogForm: {
|
|
|
type: Object,
|
|
|
default: () => {
|
|
|
- return {}
|
|
|
+ return {};
|
|
|
}
|
|
|
},
|
|
|
deptList: {
|
|
|
type: Array,
|
|
|
default() {
|
|
|
- return []
|
|
|
+ return [];
|
|
|
}
|
|
|
},
|
|
|
userList: {
|
|
|
type: Array,
|
|
|
default() {
|
|
|
- return []
|
|
|
+ return [];
|
|
|
}
|
|
|
},
|
|
|
deptTreeList: {
|
|
|
type: Array,
|
|
|
default() {
|
|
|
- return []
|
|
|
+ return [];
|
|
|
}
|
|
|
- },
|
|
|
+ }
|
|
|
},
|
|
|
watch: {
|
|
|
dialogForm: {
|
|
|
handler(val) {
|
|
|
for (const key in this.form) {
|
|
|
- if(key=='relationType'){
|
|
|
- this.form[key] = this.dialogForm[key]
|
|
|
- }else {
|
|
|
- this.form[key] = this.dialogForm[key] || this.form[key]
|
|
|
+ if (key == 'relationType') {
|
|
|
+ this.form[key] = this.dialogForm[key];
|
|
|
+ } else {
|
|
|
+ this.form[key] = this.dialogForm[key] || this.form[key];
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
this.$nextTick(async () => {
|
|
|
await this.getUserList(this.dialogForm.responsibleDeptId);
|
|
|
//通过项目去查
|
|
|
if (this.dialogForm.projectId) {
|
|
|
- await this.getBeforeTaskList(this.dialogForm.projectId)
|
|
|
+ await this.getBeforeTaskList(this.dialogForm.projectId);
|
|
|
//查项目阶段
|
|
|
- await this.getProjectsSelectTreeData({
|
|
|
- treeType: 0,
|
|
|
- id: this.dialogForm.projectId,
|
|
|
- isTask: 0,
|
|
|
- isPlan: 0
|
|
|
- }, 'projectStageList')
|
|
|
+ await this.getProjectsSelectTreeData(
|
|
|
+ {
|
|
|
+ treeType: 0,
|
|
|
+ id: this.dialogForm.projectId,
|
|
|
+ isTask: 0,
|
|
|
+ isPlan: 0
|
|
|
+ },
|
|
|
+ 'projectStageList'
|
|
|
+ );
|
|
|
//查项目BOM
|
|
|
- this.projectBOMList = await projectsBomGetTreeDataAPI(this.dialogForm.projectId)
|
|
|
+ this.projectBOMList = await projectsBomGetTreeDataAPI(
|
|
|
+ this.dialogForm.projectId
|
|
|
+ );
|
|
|
//查项目阶段关联的计划
|
|
|
let params = {
|
|
|
projectId: this.form.projectId,
|
|
|
@@ -213,8 +246,8 @@ export default {
|
|
|
projectStageId: this.form.projectStageId,
|
|
|
processStatus: [2],
|
|
|
status: [0, 1]
|
|
|
- }
|
|
|
- this.targetPlanList = await this.getTargetPlanTree(params)
|
|
|
+ };
|
|
|
+ this.targetPlanList = await this.getTargetPlanTree(params);
|
|
|
if (!this.dialogForm.projectStageId) {
|
|
|
//查项目关联的计划
|
|
|
// await this.getProjectsSelectTreeData({
|
|
|
@@ -224,12 +257,15 @@ export default {
|
|
|
// isPlan: 1
|
|
|
// }, 'targetPlanList')
|
|
|
//查项目关联的任务
|
|
|
- await this.getProjectsSelectTreeData({
|
|
|
- treeType: 0,
|
|
|
- id: this.dialogForm.projectId,
|
|
|
- isTask: 1,
|
|
|
- isPlan: 0
|
|
|
- }, 'taskList')
|
|
|
+ await this.getProjectsSelectTreeData(
|
|
|
+ {
|
|
|
+ treeType: 0,
|
|
|
+ id: this.dialogForm.projectId,
|
|
|
+ isTask: 1,
|
|
|
+ isPlan: 0
|
|
|
+ },
|
|
|
+ 'taskList'
|
|
|
+ );
|
|
|
}
|
|
|
}
|
|
|
//通过项目阶段去查
|
|
|
@@ -242,48 +278,59 @@ export default {
|
|
|
// }, 'targetPlanList')
|
|
|
if (!this.dialogForm.targetPlanId) {
|
|
|
//查项目阶段关联的任务
|
|
|
- await this.getProjectsSelectTreeData({
|
|
|
- treeType: 1,
|
|
|
- id: this.dialogForm.projectStageId,
|
|
|
- isTask: 1,
|
|
|
- isPlan: 0
|
|
|
- }, 'taskList')
|
|
|
+ await this.getProjectsSelectTreeData(
|
|
|
+ {
|
|
|
+ treeType: 1,
|
|
|
+ id: this.dialogForm.projectStageId,
|
|
|
+ isTask: 1,
|
|
|
+ isPlan: 0
|
|
|
+ },
|
|
|
+ 'taskList'
|
|
|
+ );
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
//通过计划去查
|
|
|
if (this.dialogForm.targetPlanId) {
|
|
|
//查计划关联下的节点
|
|
|
- await this.getProjectsSelectTreeData({
|
|
|
- treeType: 2,
|
|
|
- id: this.dialogForm.targetPlanId,
|
|
|
- isTask: 0,
|
|
|
- isPlan: 0
|
|
|
- }, 'planStageList')
|
|
|
- if (!this.dialogForm.planStageId) {
|
|
|
- //查计划关联下的任务
|
|
|
- await this.getProjectsSelectTreeData({
|
|
|
+ await this.getProjectsSelectTreeData(
|
|
|
+ {
|
|
|
treeType: 2,
|
|
|
id: this.dialogForm.targetPlanId,
|
|
|
- isTask: 1,
|
|
|
+ isTask: 0,
|
|
|
isPlan: 0
|
|
|
- }, 'taskList')
|
|
|
+ },
|
|
|
+ 'planStageList'
|
|
|
+ );
|
|
|
+ if (!this.dialogForm.planStageId) {
|
|
|
+ //查计划关联下的任务
|
|
|
+ await this.getProjectsSelectTreeData(
|
|
|
+ {
|
|
|
+ treeType: 2,
|
|
|
+ id: this.dialogForm.targetPlanId,
|
|
|
+ isTask: 1,
|
|
|
+ isPlan: 0
|
|
|
+ },
|
|
|
+ 'taskList'
|
|
|
+ );
|
|
|
}
|
|
|
}
|
|
|
//通过计划节点去查
|
|
|
if (this.dialogForm.planStageId) {
|
|
|
//查计划关联下的任务
|
|
|
- await this.getProjectsSelectTreeData({
|
|
|
- treeType: 3,
|
|
|
- id: this.dialogForm.planStageId,
|
|
|
- isTask: 1,
|
|
|
- isPlan: 0
|
|
|
- }, 'taskList')
|
|
|
+ await this.getProjectsSelectTreeData(
|
|
|
+ {
|
|
|
+ treeType: 3,
|
|
|
+ id: this.dialogForm.planStageId,
|
|
|
+ isTask: 1,
|
|
|
+ isPlan: 0
|
|
|
+ },
|
|
|
+ 'taskList'
|
|
|
+ );
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
deep: true
|
|
|
- },
|
|
|
+ }
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
@@ -297,7 +344,7 @@ export default {
|
|
|
taskId: '',
|
|
|
relationType: '',
|
|
|
relationId: '',
|
|
|
- relationName: '',
|
|
|
+ relationName: ''
|
|
|
},
|
|
|
projectList: [],
|
|
|
projectStageList: [],
|
|
|
@@ -307,45 +354,67 @@ export default {
|
|
|
taskList: [],
|
|
|
beforeTaskList: [],
|
|
|
rules: {
|
|
|
- type: {required: true, message: '请选择任务类型', trigger: 'change'},
|
|
|
- name: {required: true, message: '请输入任务名称', trigger: 'blur'},
|
|
|
- planStartDate: {required: true, message: '请选择计划开始日期', trigger: 'change'},
|
|
|
- projectId: {required: true, message: '请选择关联项目', trigger: ['change', 'blur']},
|
|
|
- responsibleDeptId: {required: true, message: '请选择负责部门', trigger: 'change'},
|
|
|
- cost: {required: true, message: '请输入费用', trigger: ['change', 'blur']},
|
|
|
+ type: { required: true, message: '请选择任务类型', trigger: 'change' },
|
|
|
+ name: { required: true, message: '请输入任务名称', trigger: 'blur' },
|
|
|
+ planStartDate: {
|
|
|
+ required: true,
|
|
|
+ message: '请选择计划开始日期',
|
|
|
+ trigger: 'change'
|
|
|
+ },
|
|
|
+ projectId: {
|
|
|
+ required: true,
|
|
|
+ message: '请选择关联项目',
|
|
|
+ trigger: ['change', 'blur']
|
|
|
+ },
|
|
|
+ responsibleDeptId: {
|
|
|
+ required: true,
|
|
|
+ message: '请选择负责部门',
|
|
|
+ trigger: 'change'
|
|
|
+ },
|
|
|
+ cost: {
|
|
|
+ required: true,
|
|
|
+ message: '请输入费用',
|
|
|
+ trigger: ['change', 'blur']
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
+ };
|
|
|
},
|
|
|
async created() {
|
|
|
- this.targetPlanList = await this.getTargetPlanTree({projectId: '', processStatus: [2], status: [0, 1]})
|
|
|
+ this.targetPlanList = await this.getTargetPlanTree({
|
|
|
+ projectId: '',
|
|
|
+ processStatus: [2],
|
|
|
+ status: [0, 1]
|
|
|
+ });
|
|
|
//查项目
|
|
|
- await this.getProjectsSelectTreeData({treeType: 0, isTask: 0, isPlan: 0}, 'projectList')
|
|
|
-
|
|
|
+ await this.getProjectsSelectTreeData(
|
|
|
+ { treeType: 0, isTask: 0, isPlan: 0 },
|
|
|
+ 'projectList'
|
|
|
+ );
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
//关联项目改变
|
|
|
async changeProject(val) {
|
|
|
//项目阶段
|
|
|
- this.projectStageList = []
|
|
|
+ this.projectStageList = [];
|
|
|
//项目BOM
|
|
|
- this.projectBOMList = []
|
|
|
+ this.projectBOMList = [];
|
|
|
//项目关联计划
|
|
|
- this.targetPlanList = []
|
|
|
+ this.targetPlanList = [];
|
|
|
//项目关联计划下的节点
|
|
|
- this.planStageList = []
|
|
|
+ this.planStageList = [];
|
|
|
//项目关联的任务
|
|
|
- this.taskList = []
|
|
|
+ this.taskList = [];
|
|
|
//前置任务
|
|
|
- this.beforeTaskList = []
|
|
|
+ this.beforeTaskList = [];
|
|
|
|
|
|
- this.form.projectStageId = null
|
|
|
- this.form.targetPlanId = null
|
|
|
- this.form.planStageId = null
|
|
|
- this.form.taskId = null
|
|
|
- this.form.beforeTaskId = null
|
|
|
- this.form.projectBomId = null
|
|
|
- this.$emit('changeProject', val)
|
|
|
+ this.form.projectStageId = null;
|
|
|
+ this.form.targetPlanId = null;
|
|
|
+ this.form.planStageId = null;
|
|
|
+ this.form.taskId = null;
|
|
|
+ this.form.beforeTaskId = null;
|
|
|
+ this.form.projectBomId = null;
|
|
|
+ this.$emit('changeProject', val);
|
|
|
//查计划
|
|
|
let params = {
|
|
|
projectId: val,
|
|
|
@@ -353,164 +422,189 @@ export default {
|
|
|
projectStageId: this.form.projectStageId,
|
|
|
processStatus: [2],
|
|
|
status: [0, 1]
|
|
|
- }
|
|
|
- this.targetPlanList = await this.getTargetPlanTree(params)
|
|
|
- if (!val) return
|
|
|
+ };
|
|
|
+ this.targetPlanList = await this.getTargetPlanTree(params);
|
|
|
+ if (!val) return;
|
|
|
//查前置任务
|
|
|
- await this.getBeforeTaskList(val)
|
|
|
+ await this.getBeforeTaskList(val);
|
|
|
|
|
|
// let node = this.$refs.projectTreeSelect?.$refs?.tree?.getCurrentNode() || {};
|
|
|
- this.setTaskInfo(0, val, '项目')
|
|
|
+ this.setTaskInfo(0, val, '项目');
|
|
|
//查项目阶段
|
|
|
- await this.getProjectsSelectTreeData({treeType: 0, id: val, isTask: 0, isPlan: 0}, 'projectStageList')
|
|
|
+ await this.getProjectsSelectTreeData(
|
|
|
+ { treeType: 0, id: val, isTask: 0, isPlan: 0 },
|
|
|
+ 'projectStageList'
|
|
|
+ );
|
|
|
//查项目关联的计划
|
|
|
// await this.getProjectsSelectTreeData({treeType: 0, id: val, isTask: 0, isPlan: 1}, 'targetPlanList')
|
|
|
//查项目关联的任务
|
|
|
- await this.getProjectsSelectTreeData({treeType: 0, id: val, isTask: 1, isPlan: 0}, 'taskList')
|
|
|
+ await this.getProjectsSelectTreeData(
|
|
|
+ { treeType: 0, id: val, isTask: 1, isPlan: 0 },
|
|
|
+ 'taskList'
|
|
|
+ );
|
|
|
//查项目关联的BOM
|
|
|
- this.projectBOMList = await projectsBomGetTreeDataAPI(val)
|
|
|
+ this.projectBOMList = await projectsBomGetTreeDataAPI(val);
|
|
|
if (val) {
|
|
|
- this.$refs.form.clearValidate('projectId')
|
|
|
+ this.$refs.form.clearValidate('projectId');
|
|
|
} else {
|
|
|
- this.$refs.form.validateField('projectId')
|
|
|
+ this.$refs.form.validateField('projectId');
|
|
|
}
|
|
|
},
|
|
|
//关联项目阶段改变
|
|
|
async changeProjectStage(val) {
|
|
|
//项目关联计划
|
|
|
- this.targetPlanList = []
|
|
|
+ this.targetPlanList = [];
|
|
|
//项目关联计划下的节点
|
|
|
- this.planStageList = []
|
|
|
+ this.planStageList = [];
|
|
|
//项目关联的任务
|
|
|
- this.taskList = []
|
|
|
+ this.taskList = [];
|
|
|
|
|
|
- this.form.targetPlanId = null
|
|
|
- this.form.planStageId = null
|
|
|
- this.form.taskId = null
|
|
|
+ this.form.targetPlanId = null;
|
|
|
+ this.form.planStageId = null;
|
|
|
+ this.form.taskId = null;
|
|
|
let params = {
|
|
|
projectId: this.form.projectId,
|
|
|
projectBomId: this.form.projectBomId,
|
|
|
projectStageId: val,
|
|
|
processStatus: [2],
|
|
|
status: [0, 1]
|
|
|
- }
|
|
|
- this.targetPlanList = await this.getTargetPlanTree(params)
|
|
|
+ };
|
|
|
+ this.targetPlanList = await this.getTargetPlanTree(params);
|
|
|
if (!val) {
|
|
|
if (this.form.projectId) {
|
|
|
- await this.changeProject(this.form.projectId)
|
|
|
+ await this.changeProject(this.form.projectId);
|
|
|
}
|
|
|
- return
|
|
|
+ return;
|
|
|
}
|
|
|
- this.setTaskInfo(1, val, '项目阶段')
|
|
|
+ this.setTaskInfo(1, val, '项目阶段');
|
|
|
//查项目阶段关联的计划
|
|
|
// await this.getProjectsSelectTreeData({treeType: 1, id: val, isTask: 0, isPlan: 1}, 'targetPlanList')
|
|
|
//查项目阶段关联的任务
|
|
|
- await this.getProjectsSelectTreeData({treeType: 1, id: val, isTask: 1, isPlan: 0}, 'taskList')
|
|
|
+ await this.getProjectsSelectTreeData(
|
|
|
+ { treeType: 1, id: val, isTask: 1, isPlan: 0 },
|
|
|
+ 'taskList'
|
|
|
+ );
|
|
|
},
|
|
|
//关联项目BOM改变
|
|
|
async changeProjectBom(val) {
|
|
|
//项目关联计划
|
|
|
- this.targetPlanList = []
|
|
|
+ this.targetPlanList = [];
|
|
|
//项目关联计划下的节点
|
|
|
- this.planStageList = []
|
|
|
+ this.planStageList = [];
|
|
|
//项目关联的任务
|
|
|
- this.taskList = []
|
|
|
+ this.taskList = [];
|
|
|
|
|
|
- this.form.targetPlanId = null
|
|
|
- this.form.planStageId = null
|
|
|
- this.form.taskId = null
|
|
|
+ this.form.targetPlanId = null;
|
|
|
+ this.form.planStageId = null;
|
|
|
+ this.form.taskId = null;
|
|
|
let params = {
|
|
|
projectId: this.form.projectId,
|
|
|
projectBomId: val,
|
|
|
projectStageId: this.form.projectStageId,
|
|
|
processStatus: [2],
|
|
|
status: [0, 1]
|
|
|
- }
|
|
|
- this.targetPlanList = await this.getTargetPlanTree(params)
|
|
|
+ };
|
|
|
+ this.targetPlanList = await this.getTargetPlanTree(params);
|
|
|
if (!val) {
|
|
|
if (this.form.projectId) {
|
|
|
- await this.changeProject(this.form.projectId)
|
|
|
+ await this.changeProject(this.form.projectId);
|
|
|
}
|
|
|
- return
|
|
|
+ return;
|
|
|
}
|
|
|
- this.setTaskInfo(5, val, '项目BOM')
|
|
|
+ this.setTaskInfo(5, val, '项目BOM');
|
|
|
//查项目BOM关联的计划
|
|
|
// await this.getProjectsSelectTreeData({treeType: 1, id: val, isTask: 0, isPlan: 1}, 'targetPlanList')
|
|
|
//查项目BOM关联的任务
|
|
|
- await this.getProjectsSelectTreeData({treeType: 1, id: val, isTask: 1, isPlan: 0}, 'taskList')
|
|
|
+ await this.getProjectsSelectTreeData(
|
|
|
+ { treeType: 1, id: val, isTask: 1, isPlan: 0 },
|
|
|
+ 'taskList'
|
|
|
+ );
|
|
|
},
|
|
|
//关联计划改变
|
|
|
async changeTargetPlan(val) {
|
|
|
//项目关联计划下的节点
|
|
|
- this.planStageList = []
|
|
|
+ this.planStageList = [];
|
|
|
//项目关联的任务
|
|
|
- this.taskList = []
|
|
|
+ this.taskList = [];
|
|
|
|
|
|
- this.form.planStageId = null
|
|
|
- this.form.taskId = null
|
|
|
+ this.form.planStageId = null;
|
|
|
+ this.form.taskId = null;
|
|
|
if (!val) {
|
|
|
if (this.form.projectStageId) {
|
|
|
- await this.changeProjectStage(this.form.projectStageId)
|
|
|
+ await this.changeProjectStage(this.form.projectStageId);
|
|
|
} else if (this.form.projectId) {
|
|
|
- await this.changeProject(this.form.projectId)
|
|
|
+ await this.changeProject(this.form.projectId);
|
|
|
}
|
|
|
- return
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
- let nodeData = this.$refs?.planTreeRef?.$refs?.tree?.getCurrentNode() || {}
|
|
|
- await this.getProjectsSelectTreeData({
|
|
|
- treeType: 0,
|
|
|
- id: nodeData.projectId,
|
|
|
- isTask: 0,
|
|
|
- isPlan: 0
|
|
|
- }, 'projectStageList')
|
|
|
- this.projectBOMList = await projectsBomGetTreeDataAPI(nodeData.projectId)
|
|
|
- this.form.projectId = nodeData.projectId
|
|
|
- this.form.projectBomId = nodeData.projectBomId
|
|
|
- this.form.projectStageId = nodeData.projectStageId
|
|
|
- this.setTaskInfo(2, val, '计划')
|
|
|
- this.$emit('changeProject', this.form.projectId)
|
|
|
+ let nodeData =
|
|
|
+ this.$refs?.planTreeRef?.$refs?.tree?.getCurrentNode() || {};
|
|
|
+ await this.getProjectsSelectTreeData(
|
|
|
+ {
|
|
|
+ treeType: 0,
|
|
|
+ id: nodeData.projectId,
|
|
|
+ isTask: 0,
|
|
|
+ isPlan: 0
|
|
|
+ },
|
|
|
+ 'projectStageList'
|
|
|
+ );
|
|
|
+ this.projectBOMList = await projectsBomGetTreeDataAPI(nodeData.projectId);
|
|
|
+ this.form.projectId = nodeData.projectId;
|
|
|
+ this.form.projectBomId = nodeData.projectBomId;
|
|
|
+ this.form.projectStageId = nodeData.projectStageId;
|
|
|
+ this.setTaskInfo(2, val, '计划');
|
|
|
+ this.$emit('changeProject', this.form.projectId);
|
|
|
//查项目关联的计划下的节点
|
|
|
- await this.getProjectsSelectTreeData({treeType: 2, id: val, isTask: 0, isPlan: 0}, 'planStageList')
|
|
|
+ await this.getProjectsSelectTreeData(
|
|
|
+ { treeType: 2, id: val, isTask: 0, isPlan: 0 },
|
|
|
+ 'planStageList'
|
|
|
+ );
|
|
|
//查项目关联的计划的任务
|
|
|
- await this.getProjectsSelectTreeData({treeType: 2, id: val, isTask: 1, isPlan: 0}, 'taskList')
|
|
|
+ await this.getProjectsSelectTreeData(
|
|
|
+ { treeType: 2, id: val, isTask: 1, isPlan: 0 },
|
|
|
+ 'taskList'
|
|
|
+ );
|
|
|
},
|
|
|
//关联计划节点改变
|
|
|
async changePlanStage(val) {
|
|
|
//项目关联的任务
|
|
|
- this.taskList = []
|
|
|
- this.form.taskId = null
|
|
|
+ this.taskList = [];
|
|
|
+ this.form.taskId = null;
|
|
|
if (!val) {
|
|
|
if (this.form.targetPlanId) {
|
|
|
- await this.changeTargetPlan(this.form.targetPlanId)
|
|
|
+ await this.changeTargetPlan(this.form.targetPlanId);
|
|
|
} else if (this.form.projectStageId) {
|
|
|
- await this.changeProjectStage(this.form.projectStageId)
|
|
|
+ await this.changeProjectStage(this.form.projectStageId);
|
|
|
} else if (this.form.projectId) {
|
|
|
- await this.changeProject(this.form.projectId)
|
|
|
+ await this.changeProject(this.form.projectId);
|
|
|
}
|
|
|
- return
|
|
|
+ return;
|
|
|
}
|
|
|
- this.setTaskInfo(3, val, '计划节点')
|
|
|
+ this.setTaskInfo(3, val, '计划节点');
|
|
|
//查项目关联的任务
|
|
|
- await this.getProjectsSelectTreeData({treeType: 3, id: val, isTask: 1, isPlan: 0}, 'taskList')
|
|
|
+ await this.getProjectsSelectTreeData(
|
|
|
+ { treeType: 3, id: val, isTask: 1, isPlan: 0 },
|
|
|
+ 'taskList'
|
|
|
+ );
|
|
|
},
|
|
|
//关联任务改变
|
|
|
async changeTask(val) {
|
|
|
if (!val) {
|
|
|
if (this.form.planStageId) {
|
|
|
- this.setTaskInfo(3, this.form.planStageId, '计划节点')
|
|
|
+ this.setTaskInfo(3, this.form.planStageId, '计划节点');
|
|
|
} else if (this.form.targetPlanId) {
|
|
|
- this.setTaskInfo(2, this.form.targetPlanId, '计划')
|
|
|
+ this.setTaskInfo(2, this.form.targetPlanId, '计划');
|
|
|
} else if (this.form.projectStageId) {
|
|
|
- this.setTaskInfo(1, this.form.projectStageId, '项目阶段')
|
|
|
- }else if (this.form.projectBomId) {
|
|
|
- this.setTaskInfo(5, this.form.projectBomId, '项目Bom')
|
|
|
+ this.setTaskInfo(1, this.form.projectStageId, '项目阶段');
|
|
|
+ } else if (this.form.projectBomId) {
|
|
|
+ this.setTaskInfo(5, this.form.projectBomId, '项目Bom');
|
|
|
} else if (this.form.projectId) {
|
|
|
- this.setTaskInfo(0, this.form.projectId, '项目')
|
|
|
+ this.setTaskInfo(0, this.form.projectId, '项目');
|
|
|
}
|
|
|
- return
|
|
|
+ return;
|
|
|
}
|
|
|
- this.setTaskInfo(4, val, '任务')
|
|
|
+ this.setTaskInfo(4, val, '任务');
|
|
|
},
|
|
|
//设置任务类型
|
|
|
setTaskInfo(type, id, name) {
|
|
|
@@ -520,41 +614,40 @@ export default {
|
|
|
},
|
|
|
//查项目关联信息集合
|
|
|
async getProjectsSelectTreeData(params, listName) {
|
|
|
- params.ifFilter = this.dialogType == 'view' ? '0' : '1'
|
|
|
- this[listName] = await projectsSelectTreeDataAPI(params)
|
|
|
+ params.ifFilter = this.dialogType == 'view' ? '0' : '1';
|
|
|
+ this[listName] = await projectsSelectTreeDataAPI(params);
|
|
|
},
|
|
|
async getBeforeTaskList(val) {
|
|
|
- this.beforeTaskList = await getBeforeTaskListAPI(val)
|
|
|
+ this.beforeTaskList = await getBeforeTaskListAPI(val);
|
|
|
},
|
|
|
// 获取人员数据
|
|
|
getUserList(groupId) {
|
|
|
if (groupId) {
|
|
|
- this.$refs.directorRef.getList({groupId});
|
|
|
+ this.$refs.directorRef.getList({ groupId });
|
|
|
}
|
|
|
},
|
|
|
personChange(val, info) {
|
|
|
this.form.responsibleUserName = info.name;
|
|
|
},
|
|
|
async getTargetPlanTree(data = {}) {
|
|
|
- return await getTargetPlanTreeAPI(data)
|
|
|
+ return await getTargetPlanTreeAPI(data);
|
|
|
},
|
|
|
validForm() {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- this.$refs.form.validate(valid => {
|
|
|
+ this.$refs.form.validate((valid) => {
|
|
|
if (!valid) {
|
|
|
- this.$message.warning('有必填项未填,请检查')
|
|
|
- reject('有必填项未填,请检查')
|
|
|
+ this.$message.warning('有必填项未填,请检查');
|
|
|
+ reject('有必填项未填,请检查');
|
|
|
} else {
|
|
|
- resolve(this.form)
|
|
|
+ resolve(this.form);
|
|
|
}
|
|
|
- })
|
|
|
- })
|
|
|
+ });
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
-
|
|
|
</style>
|