|
@@ -679,10 +679,6 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
beforeLeave (activeName, oldActiveName) {
|
|
beforeLeave (activeName, oldActiveName) {
|
|
- console.log("---------------- beforeLeave ----------------------")
|
|
|
|
-
|
|
|
|
- console.log(activeName, "---------------- beforeLeave-activeName")
|
|
|
|
- console.log(oldActiveName, "---------------- beforeLeave-oldActiveName")
|
|
|
|
return new Promise((resolve, reject) => {
|
|
return new Promise((resolve, reject) => {
|
|
if (oldActiveName == '1' && !this.projectForm.id) {
|
|
if (oldActiveName == '1' && !this.projectForm.id) {
|
|
this.$message({
|
|
this.$message({
|
|
@@ -1238,6 +1234,10 @@ export default {
|
|
this.treeList = arr;
|
|
this.treeList = arr;
|
|
|
|
|
|
this.wbsId = this.templateType == 1 ? this.selectData.referenceWbsTemplateId : this.selectData.referenceWbsTemplateIdTrial
|
|
this.wbsId = this.templateType == 1 ? this.selectData.referenceWbsTemplateId : this.selectData.referenceWbsTemplateIdTrial
|
|
|
|
+ console.log(this.wbsId===-1);
|
|
|
|
+ if(this.wbsId===-1){
|
|
|
|
+ this.wbsId=''
|
|
|
|
+ }
|
|
this.wbsChange(this.wbsId, true)
|
|
this.wbsChange(this.wbsId, true)
|
|
|
|
|
|
// if(this.treeList[0].options.length > 0){
|
|
// if(this.treeList[0].options.length > 0){
|
|
@@ -1429,76 +1429,80 @@ export default {
|
|
|
|
|
|
let refId = this.templateType === 1 ? this.selectData.referenceWbsTemplateId : this.selectData.referenceWbsTemplateIdTrial;
|
|
let refId = this.templateType === 1 ? this.selectData.referenceWbsTemplateId : this.selectData.referenceWbsTemplateIdTrial;
|
|
console.log(refId,'refId');
|
|
console.log(refId,'refId');
|
|
- let WbsId=''
|
|
|
|
- if (this.projectForm.referenceWbsTemplateType === 'private' && refId != null && refId.toString().length > 0) {
|
|
|
|
- // 私有库右边树形数据是通过 pkeyId 查询的
|
|
|
|
- let ids = refId.toString().split(",");
|
|
|
|
- if (ids.length > 1) {
|
|
|
|
- refId = ids[0]
|
|
|
|
- let list = this.treeList[1].options;
|
|
|
|
- refId = list.filter(e => e.projectId == ids[1])[0].pkeyId;
|
|
|
|
- console.log(refId,'refId');
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- //引用被删会出现 wbsType -1
|
|
|
|
- if (refId && refId > 0) {
|
|
|
|
- let priv = {};
|
|
|
|
- if (this.projectForm.referenceWbsTemplateType == 'private') {
|
|
|
|
- //私有
|
|
|
|
- let list = this.treeList[1].options;
|
|
|
|
- for (let i = 0; i < list.length; i++) {
|
|
|
|
- if (list[i].pkeyId == refId) {
|
|
|
|
- refId = list[i].wbsId + ',' + list[i].projectId;
|
|
|
|
- priv.wbsId = list[i].wbsId;
|
|
|
|
- priv.projectId = list[i].projectId;
|
|
|
|
- priv.value= list[i].value
|
|
|
|
- priv.pkeyId= list[i].pkeyId
|
|
|
|
-
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- //公有
|
|
|
|
- WbsId = refId;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- if(this.nowref.value===refId){
|
|
|
|
- WbsId=this.nowref.id
|
|
|
|
|
|
+ if(!refId){
|
|
|
|
+ console.log('不存在refId');
|
|
|
|
+ this.$refs.treetotree.setRightTree([]);
|
|
}else{
|
|
}else{
|
|
- if (this.projectForm.referenceWbsTemplateType == 'private' && refId != null && refId.toString().length > 0) {
|
|
|
|
- WbsId = priv.pkeyId||this.selectData.referenceWbsTemplateIdTrial
|
|
|
|
- }
|
|
|
|
- else {//公有
|
|
|
|
- WbsId=this.templateType === 1 ?this.selectData.referenceWbsTemplateId: this.selectData.referenceWbsTemplateIdTrial
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- console.log(WbsId,'WbsId');
|
|
|
|
- console.log(this.rightObj1,'this.rightObj111111111');
|
|
|
|
- console.log(this.rightObj,'this.rightObj000000000000');
|
|
|
|
- // findProjectTree(this.projectForm.id, this.templateType === 1 ? WbsId : this.selectData.referenceWbsTemplateIdTrial).then((res) => {
|
|
|
|
- findProjectTree(this.projectForm.id, WbsId).then((res) => {
|
|
|
|
- if (this.rightTreeData.length>0&&this.templateType===2&&this.rightObj.wbsId==WbsId) {
|
|
|
|
- this.$refs.treetotree.setRightTree(this.rightTreeData);
|
|
|
|
- }else if(this.rightTreeData1.length>0&&this.templateType===1&&this.rightObj1.wbsId==WbsId){
|
|
|
|
- this.$refs.treetotree.setRightTree(this.rightTreeData1);
|
|
|
|
- }
|
|
|
|
- else{
|
|
|
|
- if (Array.isArray(res.data.data)) {
|
|
|
|
- this.$refs.treetotree.setRightTree(res.data.data);
|
|
|
|
- } else {
|
|
|
|
- this.$refs.treetotree.setRightTree([]);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ let WbsId=''
|
|
|
|
+ if (this.projectForm.referenceWbsTemplateType === 'private' && refId != null && refId.toString().length > 0) {
|
|
|
|
+ // 私有库右边树形数据是通过 pkeyId 查询的
|
|
|
|
+ let ids = refId.toString().split(",");
|
|
|
|
+ if (ids.length > 1) {
|
|
|
|
+ refId = ids[0]
|
|
|
|
+ let list = this.treeList[1].options;
|
|
|
|
+ refId = list.filter(e => e.projectId == ids[1])[0].pkeyId;
|
|
|
|
+ console.log(refId,'refId');
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //引用被删会出现 wbsType -1
|
|
|
|
+ if (refId && refId > 0) {
|
|
|
|
+ let priv = {};
|
|
|
|
+ if (this.projectForm.referenceWbsTemplateType == 'private') {
|
|
|
|
+ //私有
|
|
|
|
+ let list = this.treeList[1].options;
|
|
|
|
+ for (let i = 0; i < list.length; i++) {
|
|
|
|
+ if (list[i].pkeyId == refId) {
|
|
|
|
+ refId = list[i].wbsId + ',' + list[i].projectId;
|
|
|
|
+ priv.wbsId = list[i].wbsId;
|
|
|
|
+ priv.projectId = list[i].projectId;
|
|
|
|
+ priv.value= list[i].value
|
|
|
|
+ priv.pkeyId= list[i].pkeyId
|
|
|
|
+
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ //公有
|
|
|
|
+ WbsId = refId;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if(this.nowref.value===refId){
|
|
|
|
+ WbsId=this.nowref.id
|
|
|
|
+ }else{
|
|
|
|
+ if (this.projectForm.referenceWbsTemplateType == 'private' && refId != null && refId.toString().length > 0) {
|
|
|
|
+ WbsId = priv.pkeyId||this.selectData.referenceWbsTemplateIdTrial
|
|
|
|
+ }
|
|
|
|
+ else {//公有
|
|
|
|
+ WbsId=this.templateType === 1 ?this.selectData.referenceWbsTemplateId: this.selectData.referenceWbsTemplateIdTrial
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ console.log(WbsId,'WbsId');
|
|
|
|
+ // findProjectTree(this.projectForm.id, this.templateType === 1 ? WbsId : this.selectData.referenceWbsTemplateIdTrial).then((res) => {
|
|
|
|
+ findProjectTree(this.projectForm.id, WbsId).then((res) => {
|
|
|
|
+ if (this.rightTreeData.length>0&&this.templateType===2&&this.rightObj.wbsId==WbsId) {
|
|
|
|
+ this.$refs.treetotree.setRightTree(this.rightTreeData);
|
|
|
|
+ }else if(this.rightTreeData1.length>0&&this.templateType===1&&this.rightObj1.wbsId==WbsId){
|
|
|
|
+ this.$refs.treetotree.setRightTree(this.rightTreeData1);
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ if (Array.isArray(res.data.data)) {
|
|
|
|
+ this.$refs.treetotree.setRightTree(res.data.data);
|
|
|
|
+ } else {
|
|
|
|
+ this.$refs.treetotree.setRightTree([]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
this.rightloading = false;
|
|
this.rightloading = false;
|
|
},
|
|
},
|
|
|
|
|