From 6577612f57dc34ca19636991446c5e3206806a80 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期四, 20 四月 2023 10:45:26 +0800
Subject: [PATCH] 代码合并

---
 Source/UBCS-WEB/src/views/code/code.vue |  456 +++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 345 insertions(+), 111 deletions(-)

diff --git a/Source/UBCS-WEB/src/views/code/code.vue b/Source/UBCS-WEB/src/views/code/code.vue
index 0a2fa7a..c684910 100644
--- a/Source/UBCS-WEB/src/views/code/code.vue
+++ b/Source/UBCS-WEB/src/views/code/code.vue
@@ -1,89 +1,96 @@
 <template>
-  <basic-container>
+  <basic-container style="height: 350px;">
+
     <!-- 缂栫爜瑙勫垯淇℃伅灞曠ず鍖哄煙 -->
-    <avue-crud :option="option"
-               :table-loading="loading"
-               :data="data"
-               :page.sync="page"
-               :permission="permissionList"
-               v-model="form"
-               ref="crud"
-               :before-open="beforeOpen"
-               @row-update="rowUpdate"
-               @row-save="rowSave"
-               @search-change="searchChange"
-               @search-reset="searchReset"
-               @selection-change="selectionChange"
-               @current-change="currentChange"
-               @size-change="sizeChange"
-               @refresh-change="refreshChange"
-               @on-load="onLoad">
-      <!-- 琛ㄦ牸鍐呮搷浣滄寜閽� -->
-      <template slot="menu" slot-scope="scope">
-        <el-button type="text"
-                   size="small"
-                   icon="el-icon-edit"
-                   v-show="scope.row.lcStatusText=='缂栬緫涓�' ? true:false"
-                   plain
-                   @click="openEdit(scope.row)">缂� 杈�
-        </el-button>
-        <el-button type="text"
-                   size="small"
-                   icon="iconfont iconicon_shakehands"
-                   v-show="scope.row.lcStatusText=='缂栬緫涓�' ? true:false"
-                   plain
-                   @click="enableOrDeactivatse(scope.row.oid,'release')">鍙� 甯�
-        </el-button>
-        <el-button type="text"
-                   size="small"
-                   v-show="scope.row.lcStatusText=='宸插彂甯�' ? true:false"
-                   icon="iconfont iconicon_details"
-                   plain
-                   @click="enableOrDeactivatse(scope.row.oid,'disable')">鍋� 鐢�
-        </el-button>
-        <el-button type="text"
-                   size="small"
-                   v-show="scope.row.lcStatusText=='鍋滅敤' ? true:false"
-                   icon="iconfont iconicon_task_done"
-                   plain
-                   @click="enableOrDeactivatse(scope.row.oid,'enable')">鍚� 鐢�
-        </el-button>
-      </template>
-      <!-- 琛ㄦ牸宸︿笂鏂规寜閽尯鍩� -->
-      <template slot="menuLeft" slot-scope="scope">
-        <el-button type="danger"
-                   size="small"
-                   icon="el-icon-delete"
-                   plain
-                   @click="handleDelete">鍒� 闄�
-        </el-button>
-        <el-button size="small"
-                   icon="el-icon-coin"
-                   plain
-                   @click="cloneCodeSetting">鍏� 闅�
-        </el-button>
-        <el-button size="small"
-                   icon="el-icon-coine"
-                   plain
-                   @click="handleDelete">浠庡叾浠栬鍒欎腑鍏嬮殕鐮佹
-        </el-button>
-        <el-button size="small"
-                   icon="el-icon-notebook-1"
-                   plain
-                   @click="handleRange">浣跨敤鑼冨洿
-        </el-button>
-        <el-button size="small"
-                   icon="el-icon-notebook-2"
-                   plain
-                   @click="handleDelete">娓呯┖鐮佸��
-        </el-button>
-      </template>
-    </avue-crud>
+    <basic-container>
+      <p style="margin-top: -12px; margin-bottom: 4px; font-weight: 570; font-size: 19px; color: #0e2d5f;">缂栫爜瑙勫垯</p>
+      <avue-crud :option="optionRule"
+                :table-loading="loading"
+                :data="data"
+                :page.sync="page"
+                :permission="permissionList"
+                v-model="form"
+                ref="crud"
+                :before-open="beforeOpen"
+                @cell-click="loadBasic"
+                @row-update="rowUpdate"
+                @row-save="rowSave"
+                @search-change="searchChange"
+                @search-reset="searchReset"
+                @selection-change="selectionChange"
+                @current-change="currentChange"
+                @size-change="sizeChange"
+                @refresh-change="refreshChange"
+                @on-load="onLoad">
+        <!-- 琛ㄦ牸鍐呮搷浣滄寜閽� -->
+        <template slot="menu" slot-scope="scope">
+          <el-button type="text"
+                    size="small"
+                    icon="el-icon-edit"
+                    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.lcStatus=='Editing' ? true:false"
+                    plain
+                    @click="enableOrDeactivatse(scope.row.oid,'release')">鍙� 甯�
+          </el-button>
+          <el-button type="text"
+                    size="small"
+                    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.lcStatus=='Disabled' ? true:false"
+                    icon="el-icon-video-play"
+                    plain
+                    @click="enableOrDeactivatse(scope.row.oid,'enable')">鍚� 鐢�
+          </el-button>
+        </template>
+        <!-- 琛ㄦ牸宸︿笂鏂规寜閽尯鍩� -->
+        <template slot="menuLeft" slot-scope="scope">
+          <el-button type="danger"
+                    size="small"
+                    icon="el-icon-delete"
+                    plain
+                    @click="handleDelete">鍒� 闄�
+          </el-button>
+          <el-button size="small"
+                    icon="icon-kelong"
+                    plain
+                    @click="cloneCodeSetting">鍏� 闅�
+          </el-button>
+          <el-button size="small"
+                    icon="icon-lianjiekelong"
+                    style="font-size: 12px;"
+                    plain
+                    @click="handleDelete">浠庡叾浠栬鍒欎腑鍏嬮殕鐮佹
+          </el-button>
+          <el-button size="small"
+                    icon="el-icon-s-help"
+                    plain
+                    @click="handleRange">浣跨敤鑼冨洿
+          </el-button>
+          <el-button size="small"
+                    icon="icon-qingkong"
+                    plain
+                    @click="handleDelete">娓呯┖鐮佸��
+          </el-button>
+        </template>
+      </avue-crud>
+    </basic-container>
+
     <!-- 瀵硅瘽妗� -->
     <el-dialog title="缂栫爜瑙勫垯浣跨敤鑼冨洿"
-               append-to-body
-               :visible.sync="codeRangeSettingBox"
-               width="800px">
+                append-to-body
+                :visible.sync="codeRangeSettingBox"
+                width="800px">
       <avue-crud
               :option="dialogeOption" 
               :table-loading="dialogLoading"
@@ -92,41 +99,140 @@
     </el-dialog>
     <!-- 鍏嬮殕瀵硅瘽妗� -->
     <el-dialog title="鍏嬮殕缂栫爜瑙勫垯"
-               append-to-body
-               :visible.sync="cloneSettingBox"
-               width="800px">
+                append-to-body
+                :visible.sync="cloneSettingBox"
+                width="800px">
       <clone-code></clone-code>
     </el-dialog>
 
-    <!-- 鍩虹缂栫爜淇℃伅 -->
+    <!-- 鍩虹鐮佹灞曠ず鍖哄煙 -->
+    <basic-container>
+        <p style="margin-top: -12px; margin-bottom: 4px; font-weight: 570; font-size: 19px; color: #0e2d5f;">鐮佹绠$悊</p>
+        <avue-crud :option="optionBasic"
+        :table-loading="loadingBasic"
+        :data="basicData"
+        :permission="permissionList"
+        @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>
+ 
 </template>
 
 <script>
-  import {gridCodeRule, getDetail, add, update, remove, listUseRange, updateStatus} from "@/api/code/mdmrule";
-  import option from "@/const/code/mdmrule";
+  import { gridCodeRule, getDetail, add, update, remove, listUseRange, updateStatus } from "@/api/code/mdmrule";
+  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";
+
 export default {
     data() {
       return {
         form: {},
         query: {},
         loading: true,
-        
+        currentCodeRuleOid: '',
         page: {
           pageSize: 10,
           currentPage: 1,
           total: 0
         },
         selectionList: [],
-        option: option,
+        //缂栫爜瑙勫垯琛ㄦ牸閰嶇疆
+        optionRule: optionRule,
+
         data: [],
 
-        /*浣跨敤鑼冨洿*/
-        codeRangeSettingBox: false,
-        /*鍏嬮殕寮圭獥*/
+        /*鍏嬮殕鎸夐挳瀵硅瘽妗嗘帶鍒�*/
         cloneSettingBox: false,
+        optionBasic: optionBasic,
+
+        //鍩虹鐮佹灞曠ず
+        basicData:[],
+        loadingBasic: true,
+        selectionBasicList: [],
+        addBasicCodeSettingBox: false,
+        
+        /*浣跨敤鑼冨洿瀵硅瘽妗嗘帶鍒�*/
+        codeRangeSettingBox: false,
         useRangeData: [],
         dialogLoading: true,
         /*浣跨敤鑼冨洿瀵硅瘽妗�*/
@@ -173,14 +279,134 @@
       },
     },
     methods: {
-      //鏌ヨ浣跨敤鑼冨洿
-      handleRange(){
-        if (this.selectionList.length === 0) {
-          this.$message.warning("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�!");
+
+      // 鎵撳紑鏂板绐楀彛
+      addBasicCodeSec(){
+        if(!this.tipsMessage(this.selectionList)){
           return;
         }
-        if (this.selectionList.length > 1) {
-          this.$message.warning("姣忔鍙兘閫夋嫨涓�鏉℃暟鎹�!");
+        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;
+        });
+      },
+      selectionBasicChange(list) {
+        this.selectionBasicList = list;
+        //console.log(this.selectionBasicList);
+      },
+      // 涓婄Щ涓嬬Щ鍩虹鐮佹
+      upOrderNum(row){
+        //console.log(row.oid);
+        if(!this.tipsMessage(this.selectionList)){
+          return;
+        }
+        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;
@@ -201,7 +427,7 @@
       refreshUseRangeChange(){
         this.getRangeCodeList();
       },
-      //鍚敤涓庡仠鐢�
+      // 鍚敤涓庡仠鐢�
       enableOrDeactivatse(oId,update){
         updateStatus({"oid":oId,"ts":new Date().getTime,"update":update}).then(() => {
           this.onLoad(this.page);
@@ -213,7 +439,7 @@
           window.console.log(error);
         });
       },
-      //鍏嬮殕
+      // 鍏嬮殕
       cloneCodeSetting() {
         if (this.selectionList.length === 0) {
           this.$message.warning("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�!");
@@ -226,7 +452,6 @@
         localStorage.setItem("cloneOid",this.selectionList[0].oid)
         this.cloneSettingBox = true;
       },
-      
       // 娣诲姞
       rowSave(row, done, loading) {
         add(row).then(() => {
@@ -261,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("纭畾灏嗛�夋嫨鏁版嵁鍒犻櫎?", {
@@ -275,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(() => {
@@ -289,7 +509,7 @@
             this.$refs.crud.toggleSelection();
           });
       },
-      //鎵撳紑淇敼
+      // 鎵撳紑淇敼
       beforeOpen(done, type) {
         if (["edit", "view"].includes(type)) {
           getDetail(this.form.oid).then(res => {
@@ -310,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 = [];
@@ -332,6 +556,7 @@
           this.page.total = data.total;
           this.data = data.records;
           this.loading = false;
+          this.loadBasic(data.records[0])
           this.selectionClear();
         });
       }
@@ -340,4 +565,13 @@
 </script>
 
 <style>
+
+  .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