From 41f11d5fd764a2bc7e8463a70bb340467d99a3ca Mon Sep 17 00:00:00 2001
From: wangting <675591594@qq.com>
Date: 星期五, 14 七月 2023 09:42:36 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 Source/UBCS-WEB/src/views/code/code.vue |  122 +++++++++++++++++++++++++++-------------
 1 files changed, 82 insertions(+), 40 deletions(-)

diff --git a/Source/UBCS-WEB/src/views/code/code.vue b/Source/UBCS-WEB/src/views/code/code.vue
index eff5c3f..275d740 100644
--- a/Source/UBCS-WEB/src/views/code/code.vue
+++ b/Source/UBCS-WEB/src/views/code/code.vue
@@ -99,6 +99,13 @@
               @click="clearAllCodeSec">
               娓呯┖鐮佸��
           </el-button>
+          <el-button
+              size="small"
+              icon="el-icon-guide"
+              plain
+              @click="escapeOwner">
+              杞Щ鎵�鏈夎��
+          </el-button>
         </template>
       </avue-crud>
     </basic-container>
@@ -418,6 +425,8 @@
       append-to-body
       style="height: 115vh; margin-top: -13vh; overflow: hidden"
       destroy-on-close
+      lock-scroll
+      :close-on-click-modal="false"
       @close="clearBasicAddForm">
 
       <!--  绗竴灞傚璇濇,娣诲姞鐮佹淇℃伅瀵硅瘽妗嗕腑鐨勫唴瀹� -->
@@ -527,7 +536,7 @@
                   </el-option>
                 </el-select>
               </el-form-item>
-              <el-form-item label="琛ヤ綅鏃剁殑瀛楃:" :label-width="rightFormLabelWidth">
+              <el-form-item v-if="form.codeFillType!='code_fill_none'" label="琛ヤ綅鏃剁殑瀛楃:" :label-width="rightFormLabelWidth">
                 <el-select v-model="form.codeFillSeparator" @blur="inputSelectBlur" filterable placeholder="璇烽�夋嫨" :disabled="basicSecOnlyRead">
                   <el-option
                     v-for="item in enumParam.codeFillSeparator"
@@ -575,7 +584,7 @@
                   </el-option>
                 </el-select>
               </el-form-item>
-              <el-form-item id="ShowOrHide" v-mode="showCutLength" v-if="showCutLength==true" label="鍊兼埅鍙栭暱搴�:" :label-width="rightFormLabelWidth">
+              <el-form-item id="ShowOrHide" v-if="form.valueCutType!='code_cut_none'" label="鍊兼埅鍙栭暱搴�:" :label-width="rightFormLabelWidth">
                 <el-input v-model.number="form.valueCutLength" ref="valueCutLength"  :readonly="basicSecOnlyRead"></el-input>
               </el-form-item>
               <el-form-item label="鍙栧�肩被鍨�:" :label-width="rightFormLabelWidth">
@@ -667,7 +676,7 @@
                   </el-option>
                 </el-select>
               </el-form-item>
-              <el-form-item label="琛ヤ綅鏃剁殑瀛楃:" :label-width="rightFormLabelWidth">
+              <el-form-item v-if="form.codeFillType!='code_fill_none'" label="琛ヤ綅鏃剁殑瀛楃:" :label-width="rightFormLabelWidth">
                 <el-select v-model="form.codeFillSeparator" filterable @blur="inputSelectBlur" placeholder="璇烽�夋嫨" :disabled="basicSecOnlyRead">
                   <el-option
                     v-for="item in enumParam.codeFillSeparator"
@@ -838,7 +847,6 @@
             total: 0
           },
           selectionList: [],
-          showCutLength: false,
           /*缂栫爜瑙勫垯琛ㄦ牸閰嶇疆*/
           optionRule: optionRule,
           data: [],
@@ -1094,6 +1102,9 @@
       },
       watch:{
 
+      },
+      mounted(){
+        this.loadTotalEnum();
       },
       methods: {
 
@@ -1390,6 +1401,11 @@
             });
           }else {
             this.codeClassifyForm.oid = this.selectedFixedOrCodeclassifyValue.attributes.oid;
+            // 鍒嗙被鐮佹锛屽瓙鍒嗙被鍜岀埗鍒嗙被涔嬮棿涓嶈兘鐩镐簰鏇存敼
+            if(this.checkClassUpdate(this.codefixedsecOrCodeclassifysecOid,this.codeClassifyForm.codeClassifySecOid)){
+              return;
+            }
+            this.$delete(this.codeClassifyForm,"parentClassifyValueOid");
             editCodeClassifyValue(this.codeClassifyForm).then(() => {
                 this.loadClassifyValueData({"oid":this.codefixedsecOrCodeclassifysecOid})
                 this.$message({
@@ -1426,6 +1442,9 @@
               });
             });
           }else{
+            if(this.checkClassUpdate(this.codefixedsecOrCodeclassifysecOid,this.codeClassifyForm.codeClassifySecOid)){
+              return;
+            } 
             //鍒嗙被鐮佹鐮佸�煎垹闄�
             this.$confirm("鏄惁鍒犻櫎杩欐潯鏁版嵁锛熷鏋滆寮曠敤灏嗕笉鑳借鍒犻櫎锛�", {
               confirmButtonText: "纭畾",
@@ -1446,7 +1465,6 @@
               });
             });
           }
-
         },
         //瀵瑰浐瀹氱爜鍊艰〃杩涜锛氫笂绉汇�佷笅绉汇�佺Щ闄ゆ搷浣�
         codeFixedValueOpetion(condition,row){
@@ -1486,10 +1504,13 @@
         },
         //瀵瑰垎绫荤爜鍊艰〃杩涜锛氫笂绉汇�佷笅绉汇�佺Щ闄ゆ搷浣�
         codeClassifyValueOpetion(condition){
+          if(this.checkClassUpdate(this.codefixedsecOrCodeclassifysecOid,this.codeClassifyForm.codeClassifySecOid)){
+            return;
+          } 
           //姝ゅ娑夊強鍒版繁娴呮嫹璐濋棶棰橈紝浣嗘槸鎵ц涓婁笅绉讳繚瀛樻搷浣滀箣鍚庝細閲嶆柊鍔犺浇treedata锛屾墍浠ュ奖鍝嶄笉澶�
           let currentTreeList = this.getCodeClassifyValueTreeData();
           let saveData = [];
-          console.log(currentTreeList.treeList);
+          // console.log(currentTreeList.treeList);
           if(condition == 'up'){
             if(currentTreeList.index-1>=0){
               // 璋冩暣椤哄簭
@@ -1509,8 +1530,6 @@
               this.saveCodeFixedOrClassifyValueOption('classifyValue',saveData);
             }
           }
-          console.log(saveData);
-          console.log(this.classifyValueTreeData);
         },
         //閫変腑琚皟鏁撮『搴忕殑涓や釜鏍戠殑鑺傜偣
         getCodeClassifyValueTreeData(){
@@ -1549,7 +1568,7 @@
           }
         },
         //涓婄Щ涓嬬Щ绛夋搷浣滅殑淇濆瓨
-        saveCodeFixedOrClassifyValueOption(condition,editOrderNumdata){
+        async saveCodeFixedOrClassifyValueOption(condition,editOrderNumdata){
           //淇濆瓨瀵瑰浐瀹氱爜娈电爜鍊肩殑涓婄Щ涓嬬Щ绉诲嚭绛夋搷浣�
           if(condition == "fixedValue"){
             let data = {
@@ -1568,7 +1587,7 @@
             });
           }else {
             //淇濆瓨瀵瑰垎绫荤爜鍊肩爜娈电爜鍊肩殑涓婄Щ涓嬬Щ绉诲嚭绛夋搷浣�
-            saveCodeClassifyValueOrder({
+            await saveCodeClassifyValueOrder({
               "codeClassifySecOid": this.codefixedsecOrCodeclassifysecOid,
               "dtoList": JSON.stringify(editOrderNumdata),
             }).then(() => {
@@ -1607,7 +1626,21 @@
           this.codeClassifyForm.id = node.attributes.id;
           this.codeClassifyForm.name = node.attributes.name;
           this.codeClassifyForm.parentClassifyValueOid = node.attributes.oid;
-          //console.log(this.codeClassifyForm);
+          // console.log(this.codeClassifyForm);
+        },
+        /**
+         * 鍒嗙被鐮佹鐮佸�硷紝淇敼銆佸垹闄ゃ�佷笂涓嬬Щ涔嬪墠锛屾鏌ユ槸鍚︿负瀛愬垎绫诲拰鐖跺垎绫讳箣闂寸浉浜掓洿鏀�
+         * @currentRowClassOid 褰撳墠閫変腑琛宱id
+         * @updateClassOid 瑕佷慨鏀圭殑鍒嗙被鐮佸�紀id
+         */
+         checkClassUpdate(currentRowClassOid,updateClassOid){
+          if(currentRowClassOid!=updateClassOid){
+            this.$message({
+              type: "error",
+              message: "鎿嶄綔澶辫触銆愬瓙鍒嗙被涓庣埗鍒嗙被涔嬮棿涓嶈兘鐩镐簰淇敼鐮佸�笺��!"
+            });
+          }
+          return currentRowClassOid!=updateClassOid;
         },
 
 
@@ -1678,17 +1711,15 @@
             this.loadBasic(this.selectionList[0]);
           }else{
             // 鍙兘鍙傜収寮曠敤鐨勪笟鍔$被鍨嬩細鍙戠敓鏀瑰彉鎵�浠ヨ繖鍎跨洿鎺ュreferConfig鐨刯son杩涜鏀瑰彉
-            let referConfig = JSON.parse(this.form.referConfig);
-            referConfig.referType = this.form.referBtmId;
-            referConfig.referTypeName = this.form.referBtmName;
-            this.form.referConfig = JSON.stringify(referConfig);
-
-            let referValueInfo = JSON.parse(this.form.referValueInfo);
-            referValueInfo.referType = this.form.referBtmId;
-            this.form.referValueInfo = JSON.stringify(referValueInfo);
+            if(this.form.referConfig === "coderefersec" || this.form.referConfig != undefined){
+              let referConfig = JSON.parse(this.form.referConfig);
+              referConfig.referType = this.form.referBtmId;
+              referConfig.referTypeName = this.form.referBtmName;
+              this.form.referConfig = JSON.stringify(referConfig);
+              let referValueInfo = JSON.parse(this.form.referValueInfo);
+              referValueInfo.referType = this.form.referBtmId;
+            }
             editSave(this.form).then(() => {
-               // 鍏抽棴瀵硅瘽妗�
-              this.addBasicCodeSettingBox = false
               this.$message({
                 type: "success",
                 message: "鎿嶄綔鎴愬姛!"
@@ -1697,6 +1728,8 @@
                 window.console.log(error);
             });
             this.loadBasic(this.selectionList[0]);
+            // 鍏抽棴瀵硅瘽妗�
+            this.addBasicCodeSettingBox = false
           }
         },
         // 鍥犱负elementui鐨勮〃鍗曟牎楠岃缃笉涓婃墍浠ラ噰鐢ㄥ垽鏂殑鏂瑰紡鏉ュ仛琛ㄥ崟妫�楠屾柟寮�
@@ -1704,6 +1737,7 @@
           let form = this.form;
           //console.log(form);
           const regNumber = /^[0-9]+\.{0,1}[0-9]*$/; //鏁板瓧鎴栧皬鏁版鍒欐牎楠�
+          const regPos =  /^[0-9]*[1-9][0-9]*$/; //闈炶礋鏁存暟姝e垯鏍¢獙
           const tipsMsg = "蹇呭~椤逛笉鑳戒负绌�";
           if(form.id == ''){
             this.$message.warning("(鐮佹缂栧彿)"+tipsMsg);
@@ -1724,7 +1758,7 @@
             //鍥哄畾鐮佹
             if(form.codeSecLengthType == ''){
               this.$message.warning("(鐮佹闀垮害绫诲瀷)"+tipsMsg);
-              this.$refs.codeSecLengthType.$el.querySelector('select').focus();
+              // this.$refs.codeSecLengthType.$el.querySelector('select').focus();
               return false;
             }
             if(form.codeSecLength == ''){
@@ -1805,14 +1839,19 @@
               this.$message.warning('(灞傜骇绫诲瀷)'+tipsMsg);
               return false;
             }
-            if(!regNumber.test(form.codeLevelValue)){
-              this.$message.warning('灞傜骇鐨勫��)鍙兘濉啓鏁板瓧');
+            if(form.codeLevelType != 'code_level_min'&& !regNumber.test(form.codeLevelValue)){
+              this.$message.warning('(灞傜骇鐨勫��)鍙兘濉啓鏁板瓧');
               this.$refs.codeLevelValue.$el.querySelector('input').focus();
               return false;
             }
             if(form.valueCutType == ''){
               this.$message.warning('(瀛楃鎴彇绫诲瀷)'+tipsMsg);
-              this.$refs.valueCutType.$el.querySelector('select').focus();
+              // this.$refs.valueCutType.$el.querySelector('select').focus();
+              return false;
+            }
+            if(form.valueCutType != 'code_cut_none' && !regPos.test(form.valueCutLength)){
+              this.$message.warning('(鍊兼埅鍙栭暱搴�)鍙兘濉啓姝f暣鏁�');
+              this.$refs.valueCutLength.$el.querySelector('input').focus();
               return false;
             }
           }else if(this.form.secType==='coderefersec'){
@@ -1972,7 +2011,7 @@
           this.sendGridCodeBasicSec({"pkCodeRule":this.selectionList[this.selectionList.length-1].oid},false);
         },
         // 涓婄Щ涓嬬Щ鍩虹鐮佹
-        upOrderNum(row){
+        async upOrderNum(row){
           if(!this.tipsMessage(this.selectionList)){
             return;
           }
@@ -1984,7 +2023,7 @@
             this.$message.warning("鏈幏鍙栧埌蹇呭~鍙傛暟!");
             return;
           }
-          upOrderNum(row.oid).then(() => {
+          await upOrderNum(row.oid).then(() => {
             this.loadBasic(this.selectionList[0]);
             this.$message({
               type: "success",
@@ -2289,6 +2328,7 @@
         },
         // 娣诲姞
         rowSave(row, done, loading) {
+          console.log(row);
           add(row).then(() => {
             this.onLoad(this.page);
             this.$message({
@@ -2386,13 +2426,11 @@
         },
         changeCutType(value){
           if (value != 'code_cut_none'){
-            this.showCutLength = true;
             if(this.form.valueCutLength == ''){
               this.form.valueCutLength = 1;
             }
           }else{
             this.form.valueCutLength = '';
-            this.showCutLength = false;
           }
         },
         // 鍗曞嚮缂栫爜瑙勫垯瀹炵幇琛岄�夋嫨
@@ -2604,12 +2642,6 @@
               valueCutLength: row!=null&&row.valueCutLength != '' ? row.valueCutLength:'',    //
               codeGetValueType: row!=null&&row.codeGetValueType != '' ? row.codeGetValueType:'code_get_value_all_up',  //鍙栧�肩被鍨� 鏋氫妇鏌ヨ
             });
-            if(this.form.valueCutType === 'code_cut_none'){
-              this.showCutLength = false;
-            }else{
-              this.showCutLength = true;
-            }
-
             this.loadCodeLevelType();
             this.loadCodeCutType();
             this.loadCodeGetValueType();
@@ -2651,15 +2683,25 @@
           // console.log(this.form);
         },
         // 绗竴娆¤姹傜殑鏋氫妇鏁版嵁鏀剧紦瀛�
-        getLocalStorageEnum(key){
-          let enumCach = JSON.parse(localStorage.getItem(key));
+        getLocalStorageEnum(enumKey){
+          let enumCach = JSON.parse(localStorage.getItem(enumKey));
           if(enumCach == null) {
-            getDictionary({code: key}).then(res=>{
+            getDictionary({code: enumKey}).then(res=>{
               enumCach = res.data.data;
-              localStorage.setItem(key,JSON.stringify(res.data.data));
+              localStorage.setItem(enumKey,JSON.stringify(res.data.data));
             })
           }
           return enumCach;
+        },
+        // 缁熶竴鍔犺浇鎵�鏈夋灇涓炬煡璇紝涓昏鏄负閬垮厤鍒囨崲鐮佹绫诲瀷鏃惰繕鏈姞杞藉畬鎴愮殑鎯呭喌
+        loadTotalEnum(){
+          this.loadCodeSecType();
+          this.loadCodeSecLength();
+          this.loadCodeFillType();
+          this.loadCodeFillSeparator();
+          this.loadCodeLevelType();
+          this.loadCodeCutType();
+          this.loadCodeGetValueType();
         },
         //鏋氫妇鍜屽彲杈撳彲閫夊唴瀹规煡璇�
         loadCodeSecType(){
@@ -2690,7 +2732,7 @@
         loadCodeGetValueType(){
           this.enumParam.codeGetValueType =  this.getLocalStorageEnum("codeGetValueType");
         },
-
+        
       }
   };
 

--
Gitblit v1.9.3