From f3c411d4ddc5d1ebf7414103b1bc0d09b929c413 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期四, 20 四月 2023 10:37:58 +0800
Subject: [PATCH] 联调修改codebasic,以及代码合并

---
 Source/UBCS-WEB/src/views/code/code.vue |  253 ++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 221 insertions(+), 32 deletions(-)

diff --git a/Source/UBCS-WEB/src/views/code/code.vue b/Source/UBCS-WEB/src/views/code/code.vue
index 7061014..c684910 100644
--- a/Source/UBCS-WEB/src/views/code/code.vue
+++ b/Source/UBCS-WEB/src/views/code/code.vue
@@ -27,27 +27,27 @@
           <el-button type="text"
                     size="small"
                     icon="el-icon-edit"
-                    v-show="scope.row.lcStatusText=='缂栬緫涓�' ? true:false"
+                    v-show="scope.row.lcStatus=='Editing' ? true:false"
                     plain
                     @click="openEdit(scope.row)">缂� 杈�
           </el-button>
           <el-button type="text"
                     size="small"
                     icon="el-icon-position"
-                    v-show="scope.row.lcStatusText=='缂栬緫涓�' ? true:false"
+                    v-show="scope.row.lcStatus=='Editing' ? true:false"
                     plain
                     @click="enableOrDeactivatse(scope.row.oid,'release')">鍙� 甯�
           </el-button>
           <el-button type="text"
                     size="small"
-                    v-show="scope.row.lcStatusText=='宸插彂甯�' ? true:false"
+                    v-show="scope.row.lcStatus=='Released' ? true:false"
                     icon="el-icon-video-pause"
                     plain
                     @click="enableOrDeactivatse(scope.row.oid,'disable')">鍋� 鐢�
           </el-button>
           <el-button type="text"
                     size="small"
-                    v-show="scope.row.lcStatusText=='鍋滅敤' ? true:false"
+                    v-show="scope.row.lcStatus=='Disabled' ? true:false"
                     icon="el-icon-video-play"
                     plain
                     @click="enableOrDeactivatse(scope.row.oid,'enable')">鍚� 鐢�
@@ -112,9 +112,85 @@
         :table-loading="loadingBasic"
         :data="basicData"
         :permission="permissionList"
-        @refresh-change="refreshChange">
+        @selection-change="selectionBasicChange"
+        @refresh-change="refreshChangeBasicSec">
+
+        <!-- 鍩虹鐮佹琛ㄦ牸鍐呮搷浣滄寜閽� -->
+        <template slot="menu" slot-scope="scope">
+
+          <el-button type="text"
+                    size="small"
+                    icon="icon-shangyi"
+                    v-show="scope.row.lcStatus != 'Editing' ? true:false"
+                    plain
+                    @click="openEdit(scope.row)">鏌� 鐪�
+          </el-button>
+
+          <el-button type="text"
+                    size="small"
+                    icon="icon-shangyi"
+                    v-show="scope.row.lcStatus == 'Editing' ? true:false"
+                    plain
+                    @click="openEdit(scope.row)">缂� 杈�
+          </el-button>
+
+          <el-button type="text"
+                    size="small"
+                    icon="icon-shangyi"
+                    v-show="scope.row.secType == 'codeclassifysec' || scope.row.secType == 'codefixedsec' ? true:false"
+                    plain
+                    @click="openEdit(scope.row)">鐮佸�肩鐞�
+          </el-button>
+
+          <el-button type="text"
+                    size="small"
+                    icon="icon-shangyi"
+                    v-show="scope.row.orderNum > 1 ? true:false"
+                    plain
+                    @click="upOrderNum(scope.row)">涓� 绉�
+          </el-button>
+          
+          <el-button type="text"
+                    size="small"
+                    icon="icon-xiayi"
+                    plain
+                    @click="downOrderNum(scope.row)">涓� 绉�
+          </el-button>
+          
+        </template>
+
+        <!-- 鍩虹鐮佹琛ㄦ牸宸︿笂鏂规寜閽尯鍩� -->
+        <template slot="menuLeft" slot-scope="scope">
+          <el-button type="primary"
+                    size="small"
+                    icon="el-icon-plus"
+                    @click="addBasicCodeSec">鏂� 澧�
+          </el-button>
+          <el-button type="danger"
+                    size="small"
+                    icon="el-icon-delete"
+                    plain
+                    @click="deleteBasicCode(scope.row)">鍒� 闄�
+          </el-button>
+        </template>
+
     </avue-crud>
     </basic-container>
+
+     <!-- 鍩虹缂栫爜瑙勫垯瀵硅瘽妗� @closed="closeRefresh"-->
+     <el-dialog title="娣诲姞鐮佹淇℃伅"
+                    append-to-body
+                    :visible.sync="addBasicCodeSettingBox"
+                    width="780px"
+                    style=" margin-top: -8vh;"
+                    destroy-on-close>
+        <add-basic-code ref='addBasicChild'></add-basic-code>
+        <el-divider direction="horizontal"></el-divider>
+        <div slot="footer" class="dialog-footer">
+          <el-button @click="addBasicCodeSettingBox = false">鍙� 娑�</el-button>
+          <el-button type="primary" @click="saveBasicCode">淇� 瀛�</el-button>
+        </div>
+      </el-dialog>
 
   </basic-container>
  
@@ -122,7 +198,7 @@
 
 <script>
   import { gridCodeRule, getDetail, add, update, remove, listUseRange, updateStatus } from "@/api/code/mdmrule";
-  import { gridCodeBasicSec } from "@/api/code/codebasic";
+  import { gridCodeBasicSec, downOrderNum, upOrderNum, deleteData, editSave, getObjectByOid, listDataByOids, refDataGrid} from "@/api/code/codebasic";
   import optionBasic from "@/const/code/codebasic";
   import optionRule from "@/const/code/mdmrule";
   import {mapGetters} from "vuex";
@@ -133,7 +209,7 @@
         form: {},
         query: {},
         loading: true,
-        
+        currentCodeRuleOid: '',
         page: {
           pageSize: 10,
           currentPage: 1,
@@ -152,7 +228,9 @@
         //鍩虹鐮佹灞曠ず
         basicData:[],
         loadingBasic: true,
-
+        selectionBasicList: [],
+        addBasicCodeSettingBox: false,
+        
         /*浣跨敤鑼冨洿瀵硅瘽妗嗘帶鍒�*/
         codeRangeSettingBox: false,
         useRangeData: [],
@@ -201,27 +279,134 @@
       },
     },
     methods: {
-      //鐐瑰嚮鍑哄彂鍔犺浇鍩虹鐮佹淇℃伅
+
+      // 鎵撳紑鏂板绐楀彛
+      addBasicCodeSec(){
+        if(!this.tipsMessage(this.selectionList)){
+          return;
+        }
+        if(this.selectionList[0].lcStatus != 'Editing'){
+          this.$message.warning('缂栫爜瑙勫垯鐘舵�佷笉鏄�"缂栬緫涓�"锛屼笉鍏佽缂栬緫鐮佹!');
+          return;
+        }
+        this.addBasicCodeSettingBox = true;
+        this.$nextTick(() => {
+          this.$refs.addBasicChild.loadCodeSecType();
+        })
+      },
+      // 鏂板鍩虹鐮佹
+      saveBasicCode(){
+        if(this.selectionList[0].oid == null){
+          this.$message.warning('缂哄け蹇呰鍙傛暟锛岃閲嶆柊閫夋嫨缂栫爜瑙勫垯鍚庨噸璇�!');
+          return;
+        }
+        this.$refs.addBasicChild.addSave(this.selectionList[0].oid);
+        // 鍏抽棴绐楀彛
+        this.addBasicCodeSettingBox = false
+        // 鐐瑰嚮鏂板鍩虹鐮佹涔嬪悗鍏抽棴绐楀彛涔嬪悗瑙﹀彂閲嶆柊鍔犺浇
+        this.loadBasic(this.selectionList[0]);
+      },
+      // 鍒ゆ柇鏁版嵁鏄惁閫夋嫨浠ュ強鍙兘閫夋嫨鍗曟潯鏁版嵁
+      tipsMessage(list){
+        if(list.length != 1){
+          this.$message.warning("璇烽�夋嫨涓�鏉$紪鐮佽鍒欐暟鎹�!");
+          return false;
+        }
+        return true;
+      },
+      // 鍩虹鐮佹鍒犻櫎
+      deleteBasicCode(){
+        if(!this.tipsMessage(this.selectionBasicList)){
+          return;
+        }
+        let oid = this.selectionBasicList[0].oid;
+        this.$confirm("鏄惁鍒犻櫎杩欐潯鏁版嵁锛熷鏋滆寮曠敤灏嗕笉鑳借鍒犻櫎锛�", {
+          confirmButtonText: "纭畾",
+          cancelButtonText: "鍙栨秷",
+          type: "warning"
+        })
+        .then(() => {
+          let ts = this.selectionBasicList[0].ts;
+          return deleteData({"oid": oid,"ts": ts});
+        })
+        .then(() => {
+          this.loadBasic({"oid":this.currentCodeRuleOid == null ? this.selectionList[0].oid:this.currentCodeRuleOid});
+          this.$message({
+            type: "success",
+            message: "鎿嶄綔鎴愬姛!"
+          });
+          //this.$refs.crud.toggleSelection();
+        });
+      },
+      // 鐐瑰嚮瑙﹀彂鍔犺浇鍩虹鐮佹淇℃伅
       loadBasic(row){
         this.loadingBasic = true;
         //console.log(row.oid);
+        this.currentCodeRuleOid = row.oid;
         gridCodeBasicSec(1, -1, {"pkCodeRule":row.oid}).then(res => {
           const data = res.data.data;
           this.basicData = data.records;
           //console.log(this.basicData);
           this.loadingBasic = false;
         });
-        
       },
-
-      //鏌ヨ浣跨敤鑼冨洿
-      handleRange(){
-        if (this.selectionList.length === 0) {
-          this.$message.warning("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�!");
+      selectionBasicChange(list) {
+        this.selectionBasicList = list;
+        //console.log(this.selectionBasicList);
+      },
+      // 涓婄Щ涓嬬Щ鍩虹鐮佹
+      upOrderNum(row){
+        //console.log(row.oid);
+        if(!this.tipsMessage(this.selectionList)){
           return;
         }
-        if (this.selectionList.length > 1) {
-          this.$message.warning("姣忔鍙兘閫夋嫨涓�鏉℃暟鎹�!");
+        let codeRuleOid = this.selectionList[0].oid;
+        if (this.selectionList[0].lcStatus != 'Editing') {
+          this.$message.warning("鍙湁缂栫爜瑙勫垯鐨勭姸鎬佹槸 [缂栬緫涓璢 鐨勬椂鍊欙紝鎵嶈兘璋冩暣鐮佹椤哄簭!");
+          return; 
+        }
+        if(row.oid==null || row.oid==''){
+          this.$message.warning("鏈幏鍙栧埌蹇呭~鍙傛暟!");
+          return;        
+        }
+        upOrderNum(row.oid).then(() => {
+          this.loadBasic({"oid":codeRuleOid});
+          this.$message({
+            type: "success",
+            message: "鎿嶄綔鎴愬姛!"
+          });
+        })
+      },
+      downOrderNum(row){
+        //console.log(row.oid);
+        if(!this.tipsMessage(this.selectionList)){
+          return;
+        }
+        let codeRuleOid = this.selectionList[0].oid;
+        //console.log(this.selectionList);
+        if (this.selectionList[0].lcStatus != 'Editing') {
+          this.$message.warning("鍙湁缂栫爜瑙勫垯鐨勭姸鎬佹槸 [缂栬緫涓璢 鐨勬椂鍊欙紝鎵嶈兘璋冩暣鐮佹椤哄簭!");
+          return; 
+        }
+        if(row.oid==null || row.oid==''){
+          this.$message.warning("鏈幏鍙栧埌蹇呭~鍙傛暟!");
+          return;        
+        }
+        downOrderNum(row.oid).then(() => {
+          this.loadBasic({"oid":codeRuleOid});
+          this.$message({
+            type: "success",
+            message: "鎿嶄綔鎴愬姛!"
+          });
+        })
+      },
+      //鍩虹鐮佹鏌ヨ
+      refreshChangeBasicSec(){
+        this.loadBasic({"oid":this.currentCodeRuleOid == null ? this.selectionList[0].oid:this.currentCodeRuleOid});
+      },
+      // 鏌ヨ浣跨敤鑼冨洿
+      handleRange(){
+        if(!this.tipsMessage(this.selectionList)){
           return;
         }
         this.codeRangeSettingBox = true;
@@ -242,7 +427,7 @@
       refreshUseRangeChange(){
         this.getRangeCodeList();
       },
-      //鍚敤涓庡仠鐢�
+      // 鍚敤涓庡仠鐢�
       enableOrDeactivatse(oId,update){
         updateStatus({"oid":oId,"ts":new Date().getTime,"update":update}).then(() => {
           this.onLoad(this.page);
@@ -254,7 +439,7 @@
           window.console.log(error);
         });
       },
-      //鍏嬮殕
+      // 鍏嬮殕
       cloneCodeSetting() {
         if (this.selectionList.length === 0) {
           this.$message.warning("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�!");
@@ -267,7 +452,6 @@
         localStorage.setItem("cloneOid",this.selectionList[0].oid)
         this.cloneSettingBox = true;
       },
-      
       // 娣诲姞
       rowSave(row, done, loading) {
         add(row).then(() => {
@@ -302,12 +486,7 @@
       },
       // 鍒犻櫎
       handleDelete() {
-        if (this.selectionList.length === 0) {
-          this.$message.warning("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
-          return;
-        }
-        if (this.selectionList.length > 1) {
-          this.$message.warning("姣忔鍙兘閫夋嫨涓�鏉℃暟鎹�");
+        if(!this.tipsMessage(this.selectionList)){
           return;
         }
         this.$confirm("纭畾灏嗛�夋嫨鏁版嵁鍒犻櫎?", {
@@ -316,9 +495,9 @@
           type: "warning"
         })
           .then(() => {
-            let ts = new Date().getTime();
             // 鍙敮鎸佹瘡娆″崟鏉¤褰曞垹闄�
-            let oid = this.selectionList[0].oid
+            let oid = this.selectionList[0].oid;
+            let ts = this.selectionList[0].ts;
             return remove({oid: oid,ts: ts});
           })
           .then(() => {
@@ -330,7 +509,7 @@
             this.$refs.crud.toggleSelection();
           });
       },
-      //鎵撳紑淇敼
+      // 鎵撳紑淇敼
       beforeOpen(done, type) {
         if (["edit", "view"].includes(type)) {
           getDetail(this.form.oid).then(res => {
@@ -351,6 +530,10 @@
       },
       selectionChange(list) {
         this.selectionList = list;
+        if(this.selectionList.length > 0){
+          this.currentCodeRuleOid = this.selectionList [list.length-1];
+          this.loadBasic(this.selectionList[list.length-1]);
+        }
       },
       selectionClear() {
         this.selectionList = [];
@@ -382,7 +565,13 @@
 </script>
 
 <style>
-.icon-lianjiekelong {
-  font-size: 12px;
-}
+
+  .el-divider--horizontal {
+      margin-top: 19px !important;
+      margin-bottom: -20px !important;
+      height: 2px;
+      margin: 0;
+  }
+
+
 </style>
\ No newline at end of file

--
Gitblit v1.9.3