Selaa lähdekoodia

编辑WBS库,单选选框,下拉框回显

gangyj 2 vuotta sitten
vanhempi
commit
50ac1a0f8c

+ 33 - 3
src/views/manager/projectinfo/treeTemplate/dynamicExcel.vue

@@ -197,7 +197,7 @@ export default {
     //excel父节点点击检测
     parentClick(e){
       let target = e.target;
-
+      //console.log(target)
       let bgs = document.querySelectorAll("#parent .oldlace-bg")
       //console.log(bgs)
       for (let i = 0; i < bgs.length; i++) {
@@ -207,10 +207,10 @@ export default {
       if(target.getAttribute('trindex') !== null && target.getAttribute('tdindex')){
         let tdEle = this.getParentTD(target);
         if(tdEle){
+          //橙色背景
           target.classList.add("oldlace-bg");
-
         }
-      }
+      }   
     },
 
     getParentTD(ele){
@@ -243,6 +243,36 @@ export default {
         }
       }
 
+      let radioLabels = tdEle.querySelectorAll('.el-radio .el-radio__label');
+      if(radioLabels.length > 0){
+        let radioDatas = [];
+        for (let i = 0; i < radioLabels.length; i++) {
+          radioDatas.push({
+            dictValue:radioLabels[i].innerText
+          });
+        }
+        return {
+          type:'radio',
+          radioDatas
+        }
+      }
+
+      let elSelect = tdEle.querySelectorAll('.el-select');
+      //console.dir(elSelect[0])
+      if(elSelect.length){
+        let options = elSelect[0].__vue__.options;
+        let selectDatas = [];
+        for (let i = 0; i < options.length; i++) {
+          selectDatas.push({
+            dictValue:options[i].label
+          });
+        }
+        return {
+          type:'select',
+          selectDatas
+        }
+      }
+
       return {};
     },
 

+ 11 - 3
src/views/manager/projectinfo/treeTemplate/template/setInputTPT.vue

@@ -107,9 +107,17 @@ export default {
   watch:{
     myHtmlData:function(newV){
       //console.log(newV)
-      if(newV.type && newV.type == 'checkbox'){
-        this.from.type ='checkbox';
-        this.setInputTable = newV.checkLabelDatas;
+      if(newV.type){
+        if(newV.type == 'checkbox'){
+          this.from.type ='checkbox';
+          this.setInputTable = newV.checkLabelDatas;
+        }else if(newV.type == 'radio'){
+          this.from.type ='radio';
+          this.setInputTable = newV.radioDatas;
+        }else if(newV.type == 'select'){
+          this.from.type ='select';
+          this.setInputTable = newV.selectDatas;
+        }
       }else{
         this.from.type ='';
         this.setInputTable = [];