From 7bdcc45e2ba5513a7b2cba65f9daafe1a76872bc Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期三, 16 八月 2023 10:26:58 +0800
Subject: [PATCH] 主题库行编辑(8-16)

---
 Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue |   62 ++++++++++++++++++++++--------
 1 files changed, 45 insertions(+), 17 deletions(-)

diff --git a/Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue b/Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue
index ed0186c..7944637 100644
--- a/Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue
+++ b/Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue
@@ -327,8 +327,11 @@
         <template slot-scope="{ row }">
           <el-input v-if="editingRows === row && editShows== item.prop && item.prop != 'codeDateFormat' && (item.edit == 'text'  ||item.edit == 'refer' )"
                     ref="inputRef"
+                    :id="'inputRef' + row.oid"
+                    v-show="!AddCellFlag"
                     v-model="row[item.prop]"
-                    autofocus @blur="saveRows"></el-input>
+                    @blur="saveRows"
+                    autofocus></el-input>
           <el-input-number v-if="editingRows === row && editShows== item.prop && item.edit == 'number'" v-model="row[item.prop]"
                            :style="{width:(item.width-10)+'px'}"
                            controls-position="right"
@@ -371,6 +374,7 @@
 import {AttrByBtm, gridCodeClassifyTemplateAttr, batchAddSave, copyto, listByFlag} from '@/api/template/templateAttr'
 import {getList} from "@/api/refer/table";
 import func from "@/util/func";
+import {getCurrentInstance} from "vue";
 
 export default {
   name: "attrCrud .vue",
@@ -427,7 +431,7 @@
       }
     },
     crudArrayFlag: {
-      handler(newval, olaval) {
+      handler(newval, oldval) {
         console.log('crudArrayFlag', newval)
       }
     },
@@ -452,6 +456,16 @@
         }
       }
     },
+    // editingRows:{
+    //   handler(newval,oldval){
+    //     if(newval){
+    //       const inputElement = document.querySelector(`#inputRef${newval.oid}`);
+    //       if (inputElement) {
+    //         inputElement.focus();
+    //       };
+    //     }
+    //   }
+    // },
     ProData: {
       handler(newval, oldval) {
         if (newval) {
@@ -481,6 +495,8 @@
   },
   data() {
     return {
+      // 淇濆瓨鍗曞厓鏍肩姸鎬�
+      AddCellFlag:false,
       //鍏ㄥ睆缂栬緫楂樺害鐘舵��
       editStyleFlag: false,
       loading: false,
@@ -1075,11 +1091,13 @@
         column: [
           {
             label: "灞炴�ц嫳鏂囧悕绉�",
-            prop: "id"
+            prop: "id",
+            width:100,
           },
           {
             label: "灞炴�т腑鏂囧悕绉�",
-            prop: "name"
+            prop: "name",
+            width:100,
           },
           {
             label: "闀垮害",
@@ -1120,7 +1138,7 @@
             prop: "precisionLength"
           },
           {
-            label: "灏忕簿鍒诲害",
+            label: "灏忔暟鍒诲害",
             prop: "scaleLength"
           },
           {
@@ -1562,9 +1580,6 @@
     //鍙緭鍙�変笅鎷�
     selectChangeHandler(editConfig, index) {
       let that = this;
-      /*if(that.option.column[index].data && that.option.column[index].data.length>=0){
-        return;
-      }*/
       listByFlag(editConfig.extraParams).then(res => {
         that.option.column[index].data = res.data.data;
       })
@@ -1583,7 +1598,7 @@
         item.attributeGroup = this.attrModel
       })
       if (this.CurrentCell) {
-        this.$set(this.CurrentCell, 'attributeGroup', this.attrModel)
+        this.$set(this.CurrentCell, 'attributeGroup', this.attrModel);
       } else {
         this.$set(this.attrSelectList[0], 'attributeGroup', this.attrModel)
       }
@@ -1740,7 +1755,7 @@
     addsHandler(event) {
       this.$refs.referAttrCrud.sort("orderNum");
       var ischeck = true;
-      console.log(this.ProData)
+      console.log('ProData',this.ProData)
       this.ProData.forEach((item, index) => {
         if ((item.requireFlag && item.requireFlag.toString() == 'true') && (item.readOnlyFlag && item.readOnlyFlag.toString() == 'true')) {
           this.$message.warning(item.name + "(" + item.id + ")蹇呰緭鐨勫睘鎬т笉鑳芥槸鍙");
@@ -1796,6 +1811,7 @@
           this.editOpenFlag = false;
           // 璋冪敤鐖剁粍浠朵慨鏀规寜閽姸鎬�
           this.$emit('editCloseChildren')
+          this.AddCellFlag=true;
         }).catch(() => {
           this.$message.warning('淇濆瓨澶辫触锛岃鏌ョ湅鎺у埗鍙拌緭鍑猴紒')
         });
@@ -1810,6 +1826,10 @@
         this.editShows = column.property;
         this.rowOid = row.oid;
         this.CurrentCell = row;
+          // const inputElement = document.querySelector(`#inputRef${row.oid}`);
+          // if (inputElement) {
+          //   inputElement.focus();
+          // };
         if (column.property == 'referConfig') {
           this.referConfigVisble = true;
           this.referConfigOption = {
@@ -1836,7 +1856,7 @@
           }
         } else if (column.property == 'componentRule') {
           if (this.CurrentCell) {
-            this.CurrentCell.componentRule = this.componentRuleText;
+            // this.CurrentCell.componentRule = this.componentRuleText;
           }
           this.isShowformulaEdit = true;
         } else if (column.property == 'enumString') {
@@ -1867,6 +1887,11 @@
     },
     saveRows() {
       this.editingRows = null;
+      this.editShows = null;
+      // const inputElement = document.querySelector(`#inputRef${this.CurrentCell.oid}`);
+      // if (inputElement) {
+      //   inputElement.blur();
+      // }
     },
     // 鏋氫妇娉ㄥ叆娣诲姞涓�琛岀┖鏁版嵁
     addRow() {
@@ -1970,6 +1995,7 @@
     rulesHandle() {
       if (this.CurrentCell) {
         this.$set(this.CurrentCell, 'verifyRule', this.RulesForm.expressionText)
+        this.AddCellFlag = !this.AddCellFlag;
       } else {
         this.attrSelectList.forEach((item) => {
           this.$set(item, 'verifyRule', this.RulesForm.expressionText)
@@ -2026,12 +2052,11 @@
     },
     //鍒嗙被娉ㄥ叆娓呯┖
     injectHandleReset() {
-      // this.injectOption.classifyInvokeAttrName = "鍒嗙被鍚嶇О";
-      // this.injectOption.classifyInvokeAttr = "name";
-      // this.injectOption.classifyInvokeLevel = "min";
-      // this.injectOption.classifyInvokeEditFlag = "true";
-      // this.injectOption.classifyNumber = "0";
       this.$set(this.CurrentCell, 'classifyInvokeText', '')
+      this.$set(this.CurrentCell, 'classifyInvokeAttr:', '')
+      this.$set(this.CurrentCell, 'classitwInvokeAttrName', '')
+      this.$set(this.CurrentCell, 'classifyInvokeEditFlag', 'false')
+      this.$set(this.CurrentCell, 'classifyInvokeLevel', 'none')
       this.injectVisible = false;
     },
     // 鍒嗙被娉ㄥ叆鍙栨秷
@@ -2089,6 +2114,7 @@
         this.editStyleFlag = true;
         this.attrEditVisible = true;
         this.attrFlag = true;
+        this.AddCellFlag=true;
       }
 
     },
@@ -2102,6 +2128,7 @@
     updataFormlaContent(val) {
       if (this.CurrentCell) {
         this.$set(this.CurrentCell, 'componentRule', val.replace(/"/g, ''))
+        this.componentRuleText= this.CurrentCell.componentRule
       } else {
         this.$set(this.attrRow, 'componentRule', val.replace(/"/g, ''))
       }
@@ -2116,13 +2143,14 @@
         this.$set(this.attrRow, 'referConfig', JSON.stringify(content))
       }
     },
-    // 鎺掑簭
+    // 鎺掑簭 this.AddCellFlag=false;
     sortChange(val) {
       console.log(val)
     },
     //寮�鍚紪杈�
     editOpen() {
       this.editOpenFlag = true;
+      this.AddCellFlag=false;
     },
     //瀹氫箟涓�涓叧闂紪杈戠殑鏂规硶渚涘瓙缁勪欢浣跨敤
     editClose() {

--
Gitblit v1.9.3