|
@@ -23,6 +23,8 @@
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<el-tree
|
|
<el-tree
|
|
|
|
+ :default-expanded-keys="expandedKeys"
|
|
|
|
+ :default-checked-keys="defaultcheckedkeys"
|
|
:data="treeData"
|
|
:data="treeData"
|
|
:props="treeProps"
|
|
:props="treeProps"
|
|
@node-click="handleNodeClick"
|
|
@node-click="handleNodeClick"
|
|
@@ -661,7 +663,7 @@
|
|
</div>
|
|
</div>
|
|
<span slot="footer" class="dialog-footer">
|
|
<span slot="footer" class="dialog-footer">
|
|
<el-button @click="eleDialog = false">取 消</el-button>
|
|
<el-button @click="eleDialog = false">取 消</el-button>
|
|
- <el-button type="primary" @click="submitEleDialog">确 定</el-button>
|
|
|
|
|
|
+ <el-button type="primary" @click="submitEleDialog" :disabled="eleDialogBtn">确 定</el-button>
|
|
</span>
|
|
</span>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
</div>
|
|
</div>
|
|
@@ -694,6 +696,11 @@ export default {
|
|
return {
|
|
return {
|
|
//#region 左侧树节点
|
|
//#region 左侧树节点
|
|
treeData: [],
|
|
treeData: [],
|
|
|
|
+ expandedKeys:[],//默认展开的节点
|
|
|
|
+ defaultcheckedkeys:[],//默认选中
|
|
|
|
+ curNode:{},//当前选中的节点
|
|
|
|
+ eleDialogBtn:false,//保存元素表按钮
|
|
|
|
+ excelId:'',
|
|
treeProps: {
|
|
treeProps: {
|
|
label: "name",
|
|
label: "name",
|
|
children: "children",
|
|
children: "children",
|
|
@@ -792,12 +799,18 @@ export default {
|
|
components: {
|
|
components: {
|
|
draggable,
|
|
draggable,
|
|
},
|
|
},
|
|
- watch:{
|
|
|
|
- activeName(nweval){
|
|
|
|
- console.log(nweval,'新增元素');
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ watch: {
|
|
|
|
+ //设置保存后默认展开节点
|
|
|
|
+ // treeData: {
|
|
|
|
+ // handler () {
|
|
|
|
+ // this.expandedKeys.push(this.curNode.id);
|
|
|
|
+ // this.defaultcheckedkeys.push(this.curNode.id)
|
|
|
|
+ // this.getExcelHtmlCol(this.curNode.id);
|
|
|
|
+ // },
|
|
|
|
+ // deep: true
|
|
|
|
+ // },
|
|
|
|
+
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
//数组去重
|
|
//数组去重
|
|
@@ -832,6 +845,27 @@ export default {
|
|
this.allTreeShow = false;
|
|
this.allTreeShow = false;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ treeFilterAgin() {
|
|
|
|
+ this.allTreeShow = true;
|
|
|
|
+ if (!this.allTreeData.length) {
|
|
|
|
+ this.treeloading = true;
|
|
|
|
+ tabLazytreeAll({
|
|
|
|
+ modeId: this.$route.params.id,
|
|
|
|
+ name: "",
|
|
|
|
+ }).then((res) => {
|
|
|
|
+ this.treeloading = false;
|
|
|
|
+ this.allTreeData = res.data.data;
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ console.log("过滤");
|
|
|
|
+ this.$refs.treeall.filter(this.filterText);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ this.$refs.treeall.filter(this.filterText);
|
|
|
|
+ }
|
|
|
|
+ } ,
|
|
|
|
+
|
|
|
|
+
|
|
clearInput() {
|
|
clearInput() {
|
|
|
|
|
|
(this.selectedId = ""),
|
|
(this.selectedId = ""),
|
|
@@ -896,11 +930,12 @@ export default {
|
|
return data.title.indexOf(value) !== -1;
|
|
return data.title.indexOf(value) !== -1;
|
|
},
|
|
},
|
|
//#region
|
|
//#region
|
|
- handleNodeClick(data) {
|
|
|
|
|
|
+ handleNodeClick(data,node) {
|
|
//树节点点击事件
|
|
//树节点点击事件
|
|
console.log(data,'树节点点击事件');
|
|
console.log(data,'树节点点击事件');
|
|
if (data.fileType == 3) {
|
|
if (data.fileType == 3) {
|
|
this.getExcelHtmlCol(data.id); //获取excel模板
|
|
this.getExcelHtmlCol(data.id); //获取excel模板
|
|
|
|
+ this.excelId=data.id//表格id
|
|
if (this.dataType.length == 0) {
|
|
if (this.dataType.length == 0) {
|
|
this.dictionarydataType(); //数据类型字典
|
|
this.dictionarydataType(); //数据类型字典
|
|
}
|
|
}
|
|
@@ -914,8 +949,15 @@ export default {
|
|
this.addElementForm.tableType = "";
|
|
this.addElementForm.tableType = "";
|
|
this.eleForm.tableType = "";
|
|
this.eleForm.tableType = "";
|
|
}
|
|
}
|
|
|
|
+ if (data.tableOwner > 0 && data.tableOwner < 100) {
|
|
|
|
+ this.eleForm.tableOwner= data.tableOwner + ""
|
|
|
|
+ } else {
|
|
|
|
+ this.eleForm.tableOwner = "";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
this.from.id = data.id;
|
|
this.from.id = data.id;
|
|
|
|
+ this.curNode=node
|
|
|
|
|
|
this.tableData = [];
|
|
this.tableData = [];
|
|
|
|
|
|
@@ -1050,15 +1092,12 @@ export default {
|
|
this.addTableData = [];
|
|
this.addTableData = [];
|
|
},
|
|
},
|
|
addtoElement(){
|
|
addtoElement(){
|
|
- console.log('添加到元素库');
|
|
|
|
- console.log(this.tableData,'this.tableData');
|
|
|
|
this.eleDialog=true;
|
|
this.eleDialog=true;
|
|
this.eleForm.tableOwner=''
|
|
this.eleForm.tableOwner=''
|
|
|
|
|
|
},
|
|
},
|
|
submitEleDialog(){
|
|
submitEleDialog(){
|
|
- console.log(this.eleForm,'addElementForm');
|
|
|
|
-
|
|
|
|
|
|
+ console.log('确定');
|
|
if (
|
|
if (
|
|
this.eleForm.nodeName &&
|
|
this.eleForm.nodeName &&
|
|
this.eleForm.tableType &&
|
|
this.eleForm.tableType &&
|
|
@@ -1073,7 +1112,7 @@ export default {
|
|
elementList: this.tableData,
|
|
elementList: this.tableData,
|
|
excelTabId: this.from.id,
|
|
excelTabId: this.from.id,
|
|
submitStatus: 3,
|
|
submitStatus: 3,
|
|
- });
|
|
|
|
|
|
+ })
|
|
} else {
|
|
} else {
|
|
this.$message({
|
|
this.$message({
|
|
type: "warning",
|
|
type: "warning",
|
|
@@ -1081,29 +1120,14 @@ export default {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
- this.eleDialog=false;
|
|
|
|
|
|
+
|
|
|
|
+ // this.allTreeData=[]//清空搜索树数据
|
|
|
|
+
|
|
|
|
+
|
|
// this.eleForm={}
|
|
// this.eleForm={}
|
|
},
|
|
},
|
|
AssociatedPublicClose() {
|
|
AssociatedPublicClose() {
|
|
console.log("AssociatedPublicClose");
|
|
console.log("AssociatedPublicClose");
|
|
-
|
|
|
|
- //关联公共WBS模板关闭事件
|
|
|
|
- // this.addElementForm = {
|
|
|
|
- // id: "",
|
|
|
|
- // initTableName: "",
|
|
|
|
- // nodeName: this.addElementForm.nodeName,
|
|
|
|
- // tableType: '',
|
|
|
|
- // tableOwner: '',
|
|
|
|
- // wbsId: '',
|
|
|
|
- // parentId: '',
|
|
|
|
- // }
|
|
|
|
- // this.GLExcelFrom = {
|
|
|
|
- // name: '',
|
|
|
|
- // search: ''
|
|
|
|
- // }
|
|
|
|
- // this.exceldata = []
|
|
|
|
- // this.addElement = false
|
|
|
|
-
|
|
|
|
//清理之前填写的数据
|
|
//清理之前填写的数据
|
|
this.addElementForm.wbsId = "";
|
|
this.addElementForm.wbsId = "";
|
|
// this.addElementForm.tableType = '';
|
|
// this.addElementForm.tableType = '';
|
|
@@ -1322,6 +1346,7 @@ export default {
|
|
this.activeName="link"
|
|
this.activeName="link"
|
|
},
|
|
},
|
|
async submitExcelRelationWbsTreeAndElement(da) {
|
|
async submitExcelRelationWbsTreeAndElement(da) {
|
|
|
|
+ this.eleDialogBtn=true
|
|
//保存接口
|
|
//保存接口
|
|
da.elementList.forEach((ele) => {
|
|
da.elementList.forEach((ele) => {
|
|
ele.eName = ele.textInfo;
|
|
ele.eName = ele.textInfo;
|
|
@@ -1331,16 +1356,57 @@ export default {
|
|
const { data: res } = await submitExcelRelationWbsTreeAndElement(da);
|
|
const { data: res } = await submitExcelRelationWbsTreeAndElement(da);
|
|
console.log(res);
|
|
console.log(res);
|
|
if (res.code == 200) {
|
|
if (res.code == 200) {
|
|
|
|
+ // this.refreshNodeBy()//刷新树形控件数据
|
|
|
|
+ this.eleDialogBtn=false
|
|
this.$message({
|
|
this.$message({
|
|
type: "success",
|
|
type: "success",
|
|
message: "设置成功",
|
|
message: "设置成功",
|
|
});
|
|
});
|
|
this.AssociatedPublicTap = false;
|
|
this.AssociatedPublicTap = false;
|
|
this.AssociatedPublicClose();
|
|
this.AssociatedPublicClose();
|
|
|
|
+ this.eleDialog=false;
|
|
|
|
+
|
|
}
|
|
}
|
|
},
|
|
},
|
|
//#endregion
|
|
//#endregion
|
|
-
|
|
|
|
|
|
+ // tree局部刷新
|
|
|
|
+ refreshNodeBy(){
|
|
|
|
+ console.log('刷新');
|
|
|
|
+ console.log(this.curNode,'this.curNode.id');
|
|
|
|
+ this.curNode.loaded = false;
|
|
|
|
+ // this.curNode.expand(); // 主动调用展开节点方法,重新查询该节点下的所有子节点
|
|
|
|
+ if(this.allTreeShow){
|
|
|
|
+ console.log('搜索树');
|
|
|
|
+ this.treeFilterAgin()
|
|
|
|
+ }else{
|
|
|
|
+ if (this.curNode.level === 0) {
|
|
|
|
+ tabLazytree({modeId:this.$route.params.id,parentId:0}).then((res)=>{
|
|
|
|
+ if(res.code==200){
|
|
|
|
+ if (res.data.length > 0) {
|
|
|
|
+ res.data.forEach((val) => {
|
|
|
|
+ val.hasChildren = !val.hasChildren;
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ this.treeData=res.data
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ if (this.curNode.level > 0) {
|
|
|
|
+ tabLazytree({modeId:this.$route.params.id,parentId:this.curNode.data.parentId}).then((res)=>{
|
|
|
|
+ if(res.code==200){
|
|
|
|
+ if (res.data.length > 0) {
|
|
|
|
+ res.data.forEach((val) => {
|
|
|
|
+ val.hasChildren = !val.hasChildren;
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ this.treeData=res.data
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ },
|
|
//#region 接口
|
|
//#region 接口
|
|
async tabLazytree(modeId, parentId) {
|
|
async tabLazytree(modeId, parentId) {
|
|
const { data: res } = await tabLazytree({ modeId, parentId });
|
|
const { data: res } = await tabLazytree({ modeId, parentId });
|