From 4a2835ddadb796c69f180097b95f971dbab4687d Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期三, 13 九月 2023 09:09:14 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 Source/UBCS-WEB/src/components/code-dialog-page/cloneOtherBasicSecDialog.vue |  248 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 248 insertions(+), 0 deletions(-)

diff --git a/Source/UBCS-WEB/src/components/code-dialog-page/cloneOtherBasicSecDialog.vue b/Source/UBCS-WEB/src/components/code-dialog-page/cloneOtherBasicSecDialog.vue
new file mode 100644
index 0000000..2338530
--- /dev/null
+++ b/Source/UBCS-WEB/src/components/code-dialog-page/cloneOtherBasicSecDialog.vue
@@ -0,0 +1,248 @@
+<template>
+  <el-dialog
+    :close-on-click-modal="false"
+    :visible.sync="cloneOtherCodeRuleSettingBox"
+    append-to-body
+    class="avue-dialog avue-dialog--top"
+    style="height: 100vh"
+    @close="closeCloneOtherBasicSecDialog"
+    title="鍏嬮殕缂栫爜瑙勫垯鐨勫熀纭�淇℃伅"
+    top="-3%"
+    width="800px">
+    <div>
+      <el-row>
+        <p
+          style="margin-top: -20px;
+            margin-bottom: 4px;
+            font-weight: 570;
+            font-size: 19px;
+            color: #0e2d5f;">
+          缂栫爜瑙勫垯
+        </p>
+        <avue-crud
+          ref="crudCloneCodeRuleOther"
+          :data="codeRuleData"
+          :option="cloneCodeRuleOption"
+          :page.sync="codeRulePage"
+          :table-loading="codeRuleloading"
+          class="other-clone-coderule-crud"
+          @row-click="codeOtherCloneRuleRowClick"
+          @selection-change="selectionOtherCloneCodeRuleChange"
+          @search-change="searchOtherCloneChange"
+          @search-reset="searchOtherCloneReset"
+          @on-load="onLoad">
+          <template #radio="{row}">
+            <el-radio v-model="selectOtherCodeRuleRowIndex"
+                :label="row.$index">&nbsp;</el-radio>
+          </template>
+        </avue-crud>
+      </el-row>
+      <el-row style="margin-top: 10px; border-top: 1px solid #ebeef5">
+        <p
+          style="
+            margin-top: 10px;
+            margin-bottom: 4px;
+            font-weight: 570;
+            font-size: 19px;
+            color: #0e2d5f;
+          "
+        >
+          鐮佹淇℃伅
+        </p>
+        <avue-crud
+          ref="crudCloneCodeBasicOther"
+          :data="cloneBasicData"
+          :option="cloneBasicOption"
+          :table-loading="codeBasicloading"
+          class="other-clone-codebasic-crud"
+          @row-click="codeOtherCloneBasicRowClick"
+          @selection-change="selectionOtherCloneCodeBasicChange">
+        </avue-crud>
+      </el-row>
+    </div>
+    <div slot="footer" class="dialog-footer" style="height: 50px">
+      <el-button type="primary" @click="saveOtherCodeBasic" :loading="cloneSaveLoding">淇� 瀛�</el-button>
+      <el-button @click="cloneOtherCodeRuleSettingBox = false">鍙� 娑�</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+import cloneBasicOption from "@/const/code/cloneBasicDialogOption";
+import cloneCodeRuleOption from "@/const/code/cloneCodeRuleDialogOption";
+import {gridCodeRule} from "@/api/code/mdmrule";
+import {gridCodeBasicSec,cloneCodeBasic} from "@/api/code/codebasic";
+export default {
+    name: "cloneRuleDialog",
+    props: {
+        // 瀵硅瘽妗嗘樉绀洪殣钘忔帶鍒�
+        visible: {
+            type: "Boolean",
+            default: false,
+        },
+        // 琚厠闅嗙殑瑙勫垯oid
+        quiltCloneCodeRule:{
+            type: "Object",
+        }
+    },
+    data() {
+        return {
+            cloneOtherCodeRuleSettingBox: this.visible, 
+            /*鍏嬮殕缂栫爜瑙勫垯瀵硅瘽妗嗘帶鍒跺彉閲�*/
+            cloneBasicOption: cloneBasicOption,
+            cloneCodeRuleOption: cloneCodeRuleOption,
+            selectionOtherCloneCodeBasicList: [], // 姝ょ晫闈㈠唴褰撳墠閫変腑鐨勫熀纭�鐮佹
+            selectionOtherCloneCodeRuleList: {}, // 姝ょ晫闈㈠唴褰撳墠閫変腑鐨勭紪鐮佽鍒�
+            selectOtherCodeRuleRowIndex: '',
+            cloneOtherQuery: {}, // 鏌ヨ鏉′欢瀵硅薄
+            codeRulePage: {
+                pageSize: 10,
+                currentPage: 1,
+                total: 0,
+            },
+            codeRuleloading: false,
+            codeRuleData: [],
+            codeBasicloading: false,
+            cloneBasicData: [],
+            cloneSaveLoding: false,
+        };
+    },
+    watch: {
+        // 鐩戝惉鐖剁粍浠朵紶鐨勭獥鍙f樉绀洪殣钘忕殑鍊硷紝浠ュ強鍊肩殑鍥炲~
+        visible() {
+            //console.log(this.visible);
+            if(this.visible){
+                //console.log(this.quiltCloneCodeRule);
+                let conditionMap = {};
+                conditionMap["conditionMap[oid_notequal]"] = this.quiltCloneCodeRule.oid.trim();
+                this.cloneOtherQuery = conditionMap;
+                this.onLoad(this.codeRulePage);
+            }else{
+                this.codeRuleData = [];
+                this.cloneBasicData = [];
+            }
+            this.cloneOtherCodeRuleSettingBox = this.visible;
+        },
+        selectionOtherCloneCodeRuleList(){
+            this.loadBasic(this.selectionOtherCloneCodeRuleList);
+        },
+    },
+    methods: {
+
+        //鍏抽棴绐楀彛鏃惰Е鍙�
+        closeCloneOtherBasicSecDialog(){
+            this.$emit('update:visible',false);
+        },
+        /** 浠庡叾浠栫紪鐮佽鍒欎腑鍏嬮殕鐮佹瀵硅瘽妗�-鍗曞嚮缂栫爜瑙勫垯瀹炵幇琛岄�夋嫨*/
+        codeOtherCloneRuleRowClick(row) {
+            this.selectOtherCodeRuleRowIndex = row.$index
+            this.selectionOtherCloneCodeRuleList = row;
+            this.loadBasic(row);
+        },
+        /** 浠庡叾浠栫紪鐮佽鍒欎腑鍏嬮殕鐮佹瀵硅瘽妗�-鍗曞嚮鍩虹鐮佹瀹炵幇琛岄�夋嫨*/
+        codeOtherCloneBasicRowClick(row) {
+            this.$refs.crudCloneCodeBasicOther.toggleSelection();
+            this.selectionOtherCloneCodeBasicList = row;
+            this.$refs.crudCloneCodeBasicOther.setCurrentRow(row);
+            this.$refs.crudCloneCodeBasicOther.toggleRowSelection(row); //閫変腑褰撳墠琛�
+        },
+        selectionOtherCloneCodeBasicChange(list) {
+            this.selectionOtherCloneCodeBasicList = list;
+            this.$refs.crudCloneCodeBasicOther.setCurrentRow(
+                this.selectionOtherCloneCodeBasicList.slice(-1)[0]
+            );
+        },
+        /** 浠庡叾浠栬鍒欏厠闅嗙爜娈电晫闈㈤噸缃悳绱㈠姛鑳� */
+        searchOtherCloneReset() {
+            let conditionMap = {};
+            conditionMap["conditionMap[oid_notequal]"] = this.quiltCloneCodeRule.oid.trim();
+            this.cloneOtherQuery = conditionMap;
+            this.onLoad(this.codeRulePage);
+        },
+        /** 浠庡叾浠栬鍒欏厠闅嗙爜娈电晫闈㈡悳绱㈠姛鑳�*/
+        searchOtherCloneChange(params, done) {
+            this.codeRulePage.currentPage = 1;
+            // 澶氫釜conditionMap杩欐牱浼犲弬锛屽揩閫熸煡璇㈤粯璁ら噰鐢ㄦā绯婃煡璇�
+            if (params) {
+                Object.keys(params).forEach((key) => {
+                    this.cloneOtherQuery["conditionMap" + "[" + key + "_like]"] =
+                    params[key].trim();
+                });
+            }
+            this.onLoad(this.codeRulePage,this.cloneOtherQuery);
+            done();
+        },
+        /** 淇濆瓨浠庡叾浠栫紪鐮佽鍒欎腑鍏嬮殕鐮佹淇℃伅*/
+        async saveOtherCodeBasic() {
+            this.cloneSaveLoding = true;
+            let oid = this.quiltCloneCodeRule.oid;
+            let fromDialogPkCodebasic = this.selectionOtherCloneCodeBasicList;
+            if (fromDialogPkCodebasic.length <= 0) {
+                this.$message.warning("璇烽�夋嫨鐮佹鏁版嵁!");
+                return;
+            }
+            let oidArr = [];
+            fromDialogPkCodebasic.forEach((ele) => {
+                oidArr.push(ele.oid);
+            });
+            let data = {
+                pkCodeRule: oid,
+                oidArr: oidArr.join(","),
+            };
+            //console.log(data);
+            await cloneCodeBasic(data).then( () => {
+                this.cloneOtherCodeRuleSettingBox = false;
+                this.$message({
+                    type: "success",
+                    message: "鎿嶄綔鎴愬姛!",
+                });
+                // 璋冪敤鐖剁粍浠舵柟娉曢噸鏂板姞杞界爜娈佃〃
+                this.$emit('refreshRuleTable',{"currentPage":1,"pageSize":10});
+            },(error) => {
+                window.console.log(error);
+            });
+            this.cloneSaveLoding = false;
+        },
+        /** 鐐瑰嚮瑙﹀彂鍔犺浇鍩虹鐮佹淇℃伅*/
+        loadBasic(row) {
+            this.codeBasicloading = true;
+            // console.log(row)
+            if (row != "" && row != null && row !="undefined") {
+                let conditionMap = {};
+                conditionMap["conditionMap[pkCodeRule]"] = row.oid.trim();
+                gridCodeBasicSec(1, -1, conditionMap).then((res) => {
+                    const data = res.data.data;
+                    this.cloneBasicData = data.records;
+                    this.codeBasicloading = false;
+                });
+            }else {
+                this.cloneBasicData = [];
+                this.codeBasicloading = false;
+            }
+        },
+        // 瑙勫垯琛ㄦ牸鐩稿叧鏂规硶
+        onLoad(page, params = {}) {
+            this.codeRuleloading = true;
+            gridCodeRule(page.currentPage, page.pageSize, Object.assign({},this.cloneOtherQuery, params)).then((res) => {
+                // console.log(res.data);
+                const data = res.data.data;
+                this.codeRulePage.total = data.total;
+                this.codeRuleData = data.records;
+                this.codeRuleloading = false;
+                if(this.codeRuleData.length > 0) {
+                    this.$nextTick(() => {
+                        this.selectOtherCodeRuleRowIndex = this.codeRuleData[0].$index
+                        this.selectionOtherCloneCodeRuleList = this.codeRuleData[0];
+                    });
+                }else{
+                    this.cloneBasicData = [];
+                }
+            });
+        },
+
+    }
+};
+</script>
+
+<style>
+</style>
\ No newline at end of file

--
Gitblit v1.9.3