|
@@ -181,13 +181,8 @@
|
|
|
</el-tab-pane>
|
|
|
<el-tab-pane label="分配WBS" name="2">
|
|
|
<div>
|
|
|
- <div class="text-align-c">
|
|
|
- <span class="mg-r-20">选择WBS</span>
|
|
|
- <el-select v-model="wbsId" @change="wbsChange" placeholder="请选择WBS" style="width:500px;">
|
|
|
- <el-option v-for="item in wbsList" :key="item.id" :label="item.wbsName" :value="item.id"></el-option>
|
|
|
- </el-select>
|
|
|
- </div>
|
|
|
- <tree-tree :left-tree-data="leftTreeData"></tree-tree>
|
|
|
+ <div v-if="!wbsId" class="text-align-c">项目暂未分配wbs树</div>
|
|
|
+ <tree-tree :left-tree-data="leftTreeData" ref="treetotree" @onAddTree="treeChang" @onDelTree="treeChang" ></tree-tree>
|
|
|
</div>
|
|
|
</el-tab-pane>
|
|
|
<el-tab-pane label="分配项目人员" name="3">
|
|
@@ -256,13 +251,12 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import {getProjectDeatil} from "@/api/manager/projectinfo";
|
|
|
+ import {getProjectDeatil,findProjectTree} from "@/api/manager/projectinfo";
|
|
|
import {submitContractInfo,getContractInfo,delFileFromUrl,
|
|
|
findJobByRoleId,findAllUserByCondition,findUserByName,
|
|
|
- saveUserInfoByProject,removeUsersByIds,resetPasswordByUserId} from "@/api/manager/contractinfo";
|
|
|
+ saveUserInfoByProject,removeUsersByIds,resetPasswordByUserId,
|
|
|
+ submitWbsTreeInContract,getContractInfoTree} from "@/api/manager/contractinfo";
|
|
|
import {getRoleTree} from "@/api/system/role";
|
|
|
- import {getList as getwbsList} from "@/api/manager/wbsinfo";
|
|
|
- import {getAlltree} from "@/api/manager/wbstree";
|
|
|
import {getDictionary} from "@/api/system/dict";
|
|
|
import {remove as removeFile} from "@/api/resource/attach";
|
|
|
import website from '@/config/website';
|
|
@@ -318,7 +312,6 @@
|
|
|
copyText:'',
|
|
|
|
|
|
wbsId:'',
|
|
|
- wbsList:[],
|
|
|
leftTreeData:[],
|
|
|
}
|
|
|
},
|
|
@@ -332,12 +325,13 @@
|
|
|
},
|
|
|
deep: true
|
|
|
},
|
|
|
- activeType: function (newValue) {
|
|
|
+ activeType: async function (newValue) {
|
|
|
if(newValue == '3'){
|
|
|
this.getRoleList();
|
|
|
this.getUserByName();
|
|
|
}else if(newValue == '2'){
|
|
|
- this.getWBSList();
|
|
|
+ await this.getLeftTree();
|
|
|
+ this.getRightTree();
|
|
|
}
|
|
|
},
|
|
|
rId:function(newValue){
|
|
@@ -371,20 +365,20 @@
|
|
|
})
|
|
|
},
|
|
|
methods: {
|
|
|
- init(){
|
|
|
+ async init(){
|
|
|
this.pid = this.$route.query.pid;
|
|
|
this.cid = this.$route.query.cid;
|
|
|
if(!this.cid){
|
|
|
this.contractForm.pid = this.pid;
|
|
|
}else{
|
|
|
- this.getContractInfo();
|
|
|
+ await this.getContractInfo();
|
|
|
}
|
|
|
+ await this.getProjectDeatil();
|
|
|
if(this.$route.query.type){
|
|
|
this.activeType = this.$route.query.type;
|
|
|
}
|
|
|
|
|
|
this.getContractTypeList();
|
|
|
- this.getProjectDeatil();
|
|
|
this.setHeaders();
|
|
|
},
|
|
|
beforeLeave(activeName, oldActiveName){
|
|
@@ -418,21 +412,31 @@
|
|
|
},
|
|
|
|
|
|
getProjectDeatil(){
|
|
|
- getProjectDeatil(this.pid).then((res)=>{
|
|
|
- this.projectInfo = res.data.data;
|
|
|
+ return new Promise((resolve)=>{
|
|
|
+ getProjectDeatil(this.pid).then((res)=>{
|
|
|
+ this.projectInfo = res.data.data;
|
|
|
+ this.wbsId = this.projectInfo.referenceWbsTemplateId;
|
|
|
+ resolve();
|
|
|
+ }).finally(()=>{
|
|
|
+ resolve();
|
|
|
+ })
|
|
|
})
|
|
|
},
|
|
|
getContractInfo(){
|
|
|
- getContractInfo(this.cid).then((res)=>{
|
|
|
- this.contractForm = res.data.data;
|
|
|
- if(this.contractForm.startFileUrl){
|
|
|
- this.isBackShow = true;
|
|
|
- }
|
|
|
- if(this.contractForm.projectPlace){
|
|
|
- this.flageData = ['','',this.contractForm.projectPlace]
|
|
|
- }
|
|
|
- this.$nextTick(()=>{
|
|
|
- this.typeChang['1'] = false;
|
|
|
+ return new Promise((resolve)=>{
|
|
|
+ getContractInfo(this.cid).then((res)=>{
|
|
|
+ this.contractForm = res.data.data;
|
|
|
+ if(this.contractForm.startFileUrl){
|
|
|
+ this.isBackShow = true;
|
|
|
+ }
|
|
|
+ if(this.contractForm.projectPlace){
|
|
|
+ this.flageData = ['','',this.contractForm.projectPlace]
|
|
|
+ }
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ this.typeChang['1'] = false;
|
|
|
+ })
|
|
|
+ }).finally(()=>{
|
|
|
+ resolve();
|
|
|
})
|
|
|
})
|
|
|
},
|
|
@@ -440,6 +444,8 @@
|
|
|
async saveQuit(){
|
|
|
if(this.activeType == '1'){
|
|
|
await this.savecontract();
|
|
|
+ }else if(this.activeType == '2'){
|
|
|
+ await this.saveWbsTree();
|
|
|
}
|
|
|
this.$message({
|
|
|
type: "success",
|
|
@@ -451,6 +457,8 @@
|
|
|
if(this.activeType == '1'){
|
|
|
let res = await this.savecontract();
|
|
|
this.contractForm.id = res.data.data.id;
|
|
|
+ }else if(this.activeType == '2'){
|
|
|
+ await this.saveWbsTree();
|
|
|
}
|
|
|
this.$message({
|
|
|
type: "success",
|
|
@@ -666,17 +674,47 @@
|
|
|
})
|
|
|
},
|
|
|
|
|
|
- getWBSList(){
|
|
|
- getwbsList().then((res)=>{
|
|
|
- this.wbsList = res.data.data.records;
|
|
|
+ getLeftTree(){
|
|
|
+ return new Promise((resolve)=>{
|
|
|
+ if(!this.leftTreeData.length){
|
|
|
+ findProjectTree(this.projectInfo.id,this.wbsId).then((res)=>{
|
|
|
+ if(Array.isArray(res.data.data)){
|
|
|
+ this.leftTreeData = res.data.data;
|
|
|
+ }else{
|
|
|
+ this.leftTreeData = [];
|
|
|
+ }
|
|
|
+ resolve();
|
|
|
+ }).finally(()=>{
|
|
|
+ resolve();
|
|
|
+ })
|
|
|
+ }
|
|
|
+ resolve();
|
|
|
})
|
|
|
},
|
|
|
- wbsChange(wbsid){
|
|
|
- getAlltree(this.userInfo.tenant_id,'',wbsid).then((res)=>{
|
|
|
- this.leftTreeData = res.data.data;
|
|
|
+ getRightTree(){
|
|
|
+ getContractInfoTree(this.wbsId,this.projectInfo.id,this.contractForm.id).then((res)=>{
|
|
|
+ if(Array.isArray(res.data.data)){
|
|
|
+ this.$refs.treetotree.setRightTree(res.data.data);
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
|
|
|
+ saveWbsTree(){
|
|
|
+ let obj = {};
|
|
|
+ let ids = this.$refs.treetotree.getTreeAllId('rightTree');
|
|
|
+ obj = {
|
|
|
+ wbsId:this.wbsId,
|
|
|
+ projectId:this.projectInfo.id,
|
|
|
+ contractId:this.contractForm.id,
|
|
|
+ wbsTreeIds:ids
|
|
|
+ }
|
|
|
+ return submitWbsTreeInContract(obj);
|
|
|
+ },
|
|
|
+
|
|
|
+ treeChang(){
|
|
|
+ this.typeChang[2] = true;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
};
|
|
|
</script>
|