|
@@ -994,6 +994,7 @@ export default {
|
|
|
}else{
|
|
|
this.selectData.referenceWbsTemplateIdTrial=value
|
|
|
}
|
|
|
+
|
|
|
this.leftloading = true;
|
|
|
if (value.toString().indexOf(',') >= 0) {
|
|
|
//私有库
|
|
@@ -1078,7 +1079,7 @@ export default {
|
|
|
arr[1].options = data.wbsTreePrivates;
|
|
|
}
|
|
|
this.treeList = arr;
|
|
|
- this.wbsId = this.templateType === 1 ? this.selectData.referenceWbsTemplateId : this.selectData.referenceWbsTemplateIdTrial
|
|
|
+
|
|
|
this.wbsChange(this.wbsId)
|
|
|
}).finally(() => {
|
|
|
resolve();
|
|
@@ -1095,14 +1096,13 @@ export default {
|
|
|
},
|
|
|
|
|
|
templateTypeChange () {
|
|
|
- console.log(this.wbsId,'this.wbsId');
|
|
|
- console.log(this.templateType,'this.wbsId');
|
|
|
findWbsTreeList(this.templateType).then((res) => {
|
|
|
let arr = [
|
|
|
{label: '公有库', options: []},
|
|
|
{label: '私有库', options: []}
|
|
|
];
|
|
|
let data = res.data.data;
|
|
|
+ console.log(data,'库数据');
|
|
|
if (data.wbsInfos && data.wbsInfos.length) {
|
|
|
data.wbsInfos.forEach((element) => {
|
|
|
element.label = element.wbsName;
|
|
@@ -1118,10 +1118,9 @@ export default {
|
|
|
arr[1].options = data.wbsTreePrivates;
|
|
|
}
|
|
|
this.treeList = arr;
|
|
|
- console.log(this.treeList,'this.treeList');
|
|
|
- this.wbsId = this.templateType === 1 ? this.selectData.referenceWbsTemplateId : this.selectData.referenceWbsTemplateIdTrial
|
|
|
-
|
|
|
- this.wbsChange(this.wbsId)
|
|
|
+
|
|
|
+ this.wbsId = this.templateType == 1 ? this.selectData.referenceWbsTemplateId : this.selectData.referenceWbsTemplateIdTrial
|
|
|
+ this.wbsChange(this.wbsId)
|
|
|
|
|
|
// if(this.treeList[0].options.length > 0){
|
|
|
// this.wbsId = this.treeList[0].options[0].value;
|
|
@@ -1160,6 +1159,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
async treeInit () {
|
|
|
+ console.log('treeInit');
|
|
|
|
|
|
let refId = this.projectForm.referenceWbsTemplateId;
|
|
|
//引用被删会出现 wbsType -1
|
|
@@ -1186,6 +1186,12 @@ export default {
|
|
|
this.wbsId = refId;
|
|
|
}
|
|
|
|
|
|
+ if(this.templateType == 1){
|
|
|
+ this.selectData.referenceWbsTemplateId =this.wbsId
|
|
|
+ }else{
|
|
|
+ this.selectData.referenceWbsTemplateIdTrial=this.wbsId
|
|
|
+ }
|
|
|
+
|
|
|
let projectTree = await findProjectTree(this.projectForm.id, refId)
|
|
|
if (Array.isArray(projectTree.data.data)) {
|
|
|
this.leftloading = true;
|
|
@@ -1218,6 +1224,65 @@ export default {
|
|
|
} else {
|
|
|
this.getTreeList();
|
|
|
}
|
|
|
+
|
|
|
+ this.treeInitTrial()
|
|
|
+ },
|
|
|
+ //初始化试验
|
|
|
+ async treeInitTrial () {
|
|
|
+ let refId = this.projectForm.referenceWbsTemplateIdTrial;
|
|
|
+ //引用被删会出现 wbsType -1
|
|
|
+ if (refId && refId > 0 && Number(this.projectForm.wbsType) > 0) {
|
|
|
+ //有引用id,回显
|
|
|
+ //this.selected = true;
|
|
|
+
|
|
|
+ findWbsTreeList(2).then((res) => {
|
|
|
+ let arr = [{
|
|
|
+ label: '公有库',
|
|
|
+ options: [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '私有库',
|
|
|
+ options: [],
|
|
|
+ }];
|
|
|
+ let data = res.data.data;
|
|
|
+ if (data.wbsInfos && data.wbsInfos.length) {
|
|
|
+ data.wbsInfos.forEach((element) => {
|
|
|
+ element.label = element.wbsName;
|
|
|
+ element.value = element.id;
|
|
|
+ })
|
|
|
+ arr[0].options = data.wbsInfos;
|
|
|
+ }
|
|
|
+ if (data.wbsTreePrivates && data.wbsTreePrivates.length) {
|
|
|
+ data.wbsTreePrivates.forEach((element) => {
|
|
|
+ element.label = element.projectName;
|
|
|
+ element.value = element.wbsId + ',' + element.projectId;
|
|
|
+ })
|
|
|
+ arr[1].options = data.wbsTreePrivates;
|
|
|
+ }
|
|
|
+
|
|
|
+ let WbsId = 0;
|
|
|
+ if (this.projectForm.referenceWbsTemplateTypeTrial == 'private') {
|
|
|
+ //私有
|
|
|
+ let list = arr[1].options;
|
|
|
+ for (let i = 0; i < list.length; i++) {
|
|
|
+ if (list[i].pkeyId == refId) {
|
|
|
+ WbsId = list[i].wbsId + ',' + list[i].projectId;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //公有
|
|
|
+ WbsId = refId;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.selectData.referenceWbsTemplateIdTrial = WbsId
|
|
|
+
|
|
|
+ console.log("treeInitTrial", this.selectData)
|
|
|
+ })
|
|
|
+
|
|
|
+ } else {
|
|
|
+ this.getTreeList();
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
getRightTree() {
|
|
@@ -1235,6 +1300,7 @@ export default {
|
|
|
|
|
|
|
|
|
findProjectTree(this.projectForm.id, WbsId).then((res) => {
|
|
|
+ console.log('findProjectTree');
|
|
|
if (Array.isArray(res.data.data)) {
|
|
|
this.$refs.treetotree.setRightTree(res.data.data);
|
|
|
} else {
|