Quellcode durchsuchen

编辑WBS库,多选框回显

gangyj vor 2 Jahren
Ursprung
Commit
f2be51af0a

+ 39 - 2
src/views/manager/projectinfo/treeTemplate/dynamicExcel.vue

@@ -172,11 +172,24 @@ export default {
     },
     },
 
 
     getInformation (name, tr, td) {//鼠标点击事件
     getInformation (name, tr, td) {//鼠标点击事件
-      this.htmlData = {
+      //console.log(event)
+      let tdEle = null;
+      //获取TD元素
+      if(event.target.nodeName == "TD"){
+        tdEle = event.target
+      }else{
+        tdEle = this.getParentTD(event.target);
+      }
+      let moreObj = {};
+      if(tdEle){
+        moreObj = this.getWidget(tdEle);
+      }
+
+      this.htmlData = Object.assign({
         name,
         name,
         tr,
         tr,
         td
         td
-      }
+      },moreObj) 
     },
     },
 
 
     //excel父节点点击检测
     //excel父节点点击检测
@@ -208,6 +221,30 @@ export default {
       }
       }
       return targetParent;
       return targetParent;
     },
     },
+
+
+    //获取控件信息
+    getWidget(tdEle){
+      let checkLabels = tdEle.querySelectorAll('.el-checkbox-group span.el-checkbox__label');
+      //console.log(checkLabels)
+      if(checkLabels.length > 0){
+        let checkLabelDatas = [];
+        for (let i = 0; i < checkLabels.length; i++) {
+          //console.dir(checkLabels[i])
+          checkLabelDatas.push({
+            dictValue:checkLabels[i].innerText
+          });
+        }
+        return {
+          type:'checkbox',
+          checkLabelDatas
+        }
+      }
+
+      return {};
+    },
+
+
   },
   },
   components: {
   components: {
     setInputTPT,
     setInputTPT,

+ 17 - 0
src/views/manager/projectinfo/treeTemplate/template/setInputTPT.vue

@@ -99,6 +99,23 @@ import { dictionary, saveInput, getColByTabId } from "@/api/manager/AdjustForm";
 import { getExcelHtml } from '@/api/exctab/excelmodel'
 import { getExcelHtml } from '@/api/exctab/excelmodel'
 export default {
 export default {
   props: ['pkeyId', 'htmlData'],
   props: ['pkeyId', 'htmlData'],
+  computed:{
+    myHtmlData:function(){
+      return this.htmlData;
+    }
+  },
+  watch:{
+    myHtmlData:function(newV){
+      //console.log(newV)
+      if(newV.type && newV.type == 'checkbox'){
+        this.from.type ='checkbox';
+        this.setInputTable = newV.checkLabelDatas;
+      }else{
+        this.from.type ='';
+        this.setInputTable = [];
+      }
+    }
+  },
   data () {
   data () {
     return {
     return {
       elementName: [],
       elementName: [],