|
@@ -204,7 +204,7 @@
|
|
|
<el-select
|
|
|
v-model="wbsId"
|
|
|
@change='wbsChange'
|
|
|
- :disabled="selected"
|
|
|
+ :disabled="iswbsselected"
|
|
|
placeholder="请选择WBS"
|
|
|
style="width:500px;"
|
|
|
>
|
|
@@ -588,6 +588,7 @@ export default {
|
|
|
treeList: [],
|
|
|
logTreeList: [],
|
|
|
wbsId: '',
|
|
|
+ iswbsselected:false,
|
|
|
logWbsId: '',
|
|
|
selected: false,
|
|
|
leftTreeData: [],
|
|
@@ -601,6 +602,13 @@ export default {
|
|
|
isFirst:false,
|
|
|
rightTreeData:[],//存储右边的试验树数据
|
|
|
rightTreeData1:[],//存储右边的质检树数据
|
|
|
+
|
|
|
+ rightObj:[
|
|
|
+
|
|
|
+ ],
|
|
|
+ rightObj1:[
|
|
|
+
|
|
|
+ ],
|
|
|
nowref:{}
|
|
|
|
|
|
}
|
|
@@ -672,10 +680,6 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
beforeLeave (activeName, oldActiveName) {
|
|
|
- console.log("---------------- beforeLeave ----------------------")
|
|
|
-
|
|
|
- console.log(activeName, "---------------- beforeLeave-activeName")
|
|
|
- console.log(oldActiveName, "---------------- beforeLeave-oldActiveName")
|
|
|
return new Promise((resolve, reject) => {
|
|
|
if (oldActiveName == '1' && !this.projectForm.id) {
|
|
|
this.$message({
|
|
@@ -1032,6 +1036,7 @@ export default {
|
|
|
},
|
|
|
wbsChange (value, flag) {
|
|
|
console.log(value, 'WBS节点更换测试 value')
|
|
|
+ this.iswbsselected=false
|
|
|
if(this.templateType==1){
|
|
|
this.selectData.referenceWbsTemplateId=value
|
|
|
|
|
@@ -1150,14 +1155,54 @@ export default {
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
+//格式化wbsid
|
|
|
+ formatWbsId(orid){
|
|
|
+ let refId = orid;
|
|
|
+ let WbsId=''
|
|
|
+ if ((this.templateType == 1 && this.projectForm.referenceWbsTemplateType === 'private')
|
|
|
+ || (this.templateType == 2 && this.projectForm.referenceWbsTemplateTypeTrial === 'private')
|
|
|
+ && refId != null && refId.toString().length > 0) {
|
|
|
+
|
|
|
+ console.log(1111111111111);
|
|
|
+ console.log(refId,'refId');
|
|
|
+ // 私有库右边树形数据是通过 pkeyId 查询的
|
|
|
+ let ids = refId.toString().split(",");
|
|
|
+ console.log(ids,'ids');
|
|
|
+ if (ids.length > 1) {
|
|
|
+ refId = ids[0]
|
|
|
+ console.log(refId,'refId');
|
|
|
+ console.log(this.treeList,'treeList');
|
|
|
+ let list = this.treeList[1].options;
|
|
|
+ refId = list.filter(e => e.projectId == ids[1])[0].pkeyId;
|
|
|
+ WbsId=refId
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ console.log(3333333);
|
|
|
+ WbsId=refId
|
|
|
+ }
|
|
|
+
|
|
|
+ return WbsId
|
|
|
+
|
|
|
|
|
|
+ },
|
|
|
treeChang () {
|
|
|
- console.log(this.$refs.treetotree.rightTreeData,'this.$refs.treetotree');
|
|
|
- console.log(this.templateType,'this.templateType');
|
|
|
+ let recordid= this.formatWbsId(this.wbsId)
|
|
|
+ console.log(recordid,'recordid');
|
|
|
if (this.templateType===2) {
|
|
|
- this.rightTreeData=this.$refs.treetotree.rightTreeData
|
|
|
+ this.rightTreeData=this.$refs.treetotree.rightTreeData;
|
|
|
+ // this.rightObj.push({
|
|
|
+ // wbsid:this.wbsId,objdata: this.rightTreeData
|
|
|
+ // })
|
|
|
+ this.rightObj.wbsId=recordid
|
|
|
+ this.rightObj.objdata=this.rightTreeData
|
|
|
}else{
|
|
|
this.rightTreeData1=this.$refs.treetotree.rightTreeData
|
|
|
+ // this.rightObj1.push({
|
|
|
+ // wbsid:this.wbsId,objdata: this.rightTreeData
|
|
|
+ // })
|
|
|
+ this.rightObj1.wbsId=recordid
|
|
|
+ this.rightObj1.objdata=this.rightTreeData1
|
|
|
+
|
|
|
}
|
|
|
|
|
|
this.typeChang[2] = true;
|
|
@@ -1191,6 +1236,10 @@ export default {
|
|
|
this.treeList = arr;
|
|
|
|
|
|
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)
|
|
|
|
|
|
// if(this.treeList[0].options.length > 0){
|
|
@@ -1306,6 +1355,10 @@ export default {
|
|
|
}
|
|
|
|
|
|
this.$refs.treetotree.setRightTree(projectTree.data.data);
|
|
|
+ console.log(projectTree.data.data,'projectTree.data.data');
|
|
|
+ if (projectTree.data.data.length>0) {
|
|
|
+ this.iswbsselected=true
|
|
|
+ }
|
|
|
this.rightloading = false;
|
|
|
}else{
|
|
|
this.wbsId = '';
|
|
@@ -1382,75 +1435,83 @@ export default {
|
|
|
|
|
|
let refId = this.templateType === 1 ? this.selectData.referenceWbsTemplateId : this.selectData.referenceWbsTemplateIdTrial;
|
|
|
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 && Number(this.projectForm.wbsType) > 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{
|
|
|
- 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.$refs.treetotree.setRightTree(this.rightTreeData);
|
|
|
- }else if(this.rightTreeData1.length>0&&this.templateType===1){
|
|
|
- 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)) {
|
|
|
+ if(res.data.data.length>0){
|
|
|
+ this.iswbsselected=true
|
|
|
+ }
|
|
|
+ this.$refs.treetotree.setRightTree(res.data.data);
|
|
|
+ } else {
|
|
|
+ this.$refs.treetotree.setRightTree([]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
this.rightloading = false;
|
|
|
},
|
|
|
|