From 9cf19c6dea4c3af2f04da6c923b3984469f00c99 Mon Sep 17 00:00:00 2001
From: zhangxp <zhangxp@chicecm.com>
Date: 星期三, 23 八月 2023 10:00:43 +0800
Subject: [PATCH] 最大流水号

---
 Source/UBCS-WEB/src/views/code/code.vue                                |   26 +++++
 Source/UBCS-WEB/src/components/code-dialog-page/maxSerialnumDialog.vue |  231 ++++++++++++++++++++++++++++++++++++++++++++++
 Source/UBCS-WEB/src/main.js                                            |    2 
 Source/UBCS-WEB/vue.config.js                                          |    4 
 Source/UBCS-WEB/src/api/code/maxSerialNum.js                           |    9 +
 5 files changed, 270 insertions(+), 2 deletions(-)

diff --git a/Source/UBCS-WEB/src/api/code/maxSerialNum.js b/Source/UBCS-WEB/src/api/code/maxSerialNum.js
new file mode 100644
index 0000000..e3b2db8
--- /dev/null
+++ b/Source/UBCS-WEB/src/api/code/maxSerialNum.js
@@ -0,0 +1,9 @@
+import request from '@/router/axios';
+
+export const getCodePrice = (data) => {
+  return request({
+    url: '/api/ubcs-code/ubcs-code/mdmRule/getCodeRuleAndBasicSecByRuleOid',
+    method: 'get',
+    params: data
+  })
+}
\ No newline at end of file
diff --git a/Source/UBCS-WEB/src/components/code-dialog-page/maxSerialnumDialog.vue b/Source/UBCS-WEB/src/components/code-dialog-page/maxSerialnumDialog.vue
new file mode 100644
index 0000000..9998cb7
--- /dev/null
+++ b/Source/UBCS-WEB/src/components/code-dialog-page/maxSerialnumDialog.vue
@@ -0,0 +1,231 @@
+<template>
+    <el-dialog title="鏈�澶ф祦姘村彿" width="30%" append-to-body="true" :visible.sync="visible">
+        <el-tabs v-model="activeName" type="border-card" @tab-click="handleClick">
+            <el-tab-pane label="鏈�澶ф祦姘村彿" name="codeApply">
+                <form-template v-bind="$attrs" type="add" :selfColumnType="selfColumnType" :selfColumnConfig="selfColumnConfig"
+                    ref="CodeApply" @getFormData="getCodeApplyFormData"
+                    @referConfigDataUpdate="referConfigDataUpdate"></form-template>
+            </el-tab-pane>
+        </el-tabs>
+    </el-dialog>
+</template>
+<script>
+import FormTemplate from "@/components/FormTemplate/FormTemplate";
+import { getCodePrice } from "@/api/code/maxSerialNum.js"
+export default {
+    name: 'maxSerialnumDialog',
+    components: {
+        FormTemplate
+    },
+    props: {
+        // 鏄惁鎵撳紑
+        visible: {
+            typeof: Boolean,
+            default: false
+        },
+        // ruleOid
+        ruleOid: {
+            typeof: String,
+            default: ""
+        }
+    },
+    watch: {
+        visible(n) {
+            this.dialogVisible = n;
+        },
+        dialogVisible(n) {
+            this.$emit('update:visible', n)
+            if (n) this.apiGetCode()
+        },
+        selfColumnConfig: {
+            handler(newval) {
+                console.log('selfColumnConfig', newval)
+            },
+            immediate: true,
+            deep: true
+        }
+    },
+    data() {
+        return {
+            dialogVisible: this.visible,
+            activeName: 'codePrice',
+            codeApplyForm: {},
+            secVOList: [],
+            selfColumnType: {
+                codefixedsec: "combox",
+                codeclassifysec: "refer",
+                codevariablesec: "text",
+                coderefersec: "refer",
+            },
+            selfColumnConfig: {
+                function: {
+                    required: this.isRequired,
+                    dicData: this.getOptionList,
+                    type: this.getType,
+                    referConfig: this.getReferConfig,
+                    readOnly: this.getDisabled,
+                },
+                exchange: {
+                    text: "name",
+                    field: "oid",
+                    prop: "oid",
+                    showField: "name",
+                    parentClassifySecOid: "parentClassifySecOid",
+                    label: "name",
+                    maxlength: "codeSecLength",
+                    data: "fixedValueVOList",
+                },
+                directVoluation: {
+                    search: true,
+                    props: {
+                        label: "id",
+                        value: "id",
+                    },
+                },
+            },
+        }
+    },
+    methods: {
+        async apiGetCode() {
+            const response = await getCodePrice({ ruleOid: this.ruleOid })
+            const res = response.data
+            if (res.success && res.code === 200) {
+                console.log(response)
+                const typeList = [
+                    "codefixedsec",
+                    "codeclassifysec",
+                    "codevariablesec",
+                    "coderefersec",
+                ];
+                this.secVOList = (res.data.secVOList || []).filter((item) =>
+                    typeList.includes(item.secType)
+                );
+                console.log(this.secVOList)
+                if (this.secVOList.length > 0) {
+                    // this.showCodeApply = true;
+                    this.activeName = "codePrice";
+                    this.$nextTick(() => {
+                        this.$refs.CodeApply.templateRender(this.secVOList);
+                    });
+                } else {
+                    // this.showCodeApply = false;
+                }
+            }
+        },
+        handleClick(tab, event) {
+            console.log(event)
+        },
+        getCodeApplyFormData(codeApplyForm) {
+            this.codeApplyForm = codeApplyForm;
+        },
+        // 鍙傜収缁勪欢鏁版嵁鍙樻洿
+        referConfigDataUpdate(data) {
+            console.log(data)
+            const { field } = data;
+            this.secVOList = this.secVOList.map((item) => {
+                if (item.parentClassifySecOid === field) {
+                    this.$refs.CodeApply.form[item.oid] = undefined;
+                    this.$refs.CodeApply.form[item.name] = undefined;
+                }
+                return item;
+            });
+            console.log(this.secVOList)
+            this.$refs.CodeApply.templateRender(this.secVOList);
+        },
+        isRequired(item) {
+            return item.nullableFlag != "true";
+        },
+        getType(item) {
+            return this.selfColumnType[item.secType];
+        },
+        getDisabled(item) {
+            if (item.secType === "codeclassifysec") {
+                if (item.parentClassifySecOid) {
+                    if (!this.codeApplyForm[item.parentClassifySecOid]) {
+                        return true;
+                    } else {
+                        return false;
+                    }
+                }
+            }
+        },
+        getReferConfig(item) {
+            console.log(item)
+            let params = {};
+            if (item.secType == "codeclassifysec") {
+                params = {
+                    isMuti: false,
+                    type: "grid",
+                    tableConfig: {
+                        limit: -1,
+                        cols: [
+                            {
+                                field: "id",
+                                title: "鑻辨枃鍚嶇О",
+                                sort: true,
+                                width: 150,
+                            },
+                            {
+                                field: "name",
+                                title: "涓枃鍚嶇О",
+                                sort: true,
+                                width: 150,
+                            },
+                            {
+                                field: "description",
+                                title: "鎻忚堪",
+                                width: 250,
+                            },
+                        ],
+                        queryColumns: [
+                            {
+                                field: "id",
+                                title: "鑻辨枃鍚嶇О",
+                            },
+                            {
+                                field: "name",
+                                title: "涓枃鍚嶇О",
+                            },
+                        ],
+                    },
+                    url: "api/ubcs-code/ubcs-code/mdmEngineController/listCodeClassifyValueBySecOid",
+                    extraParams: {
+                        classifySecOid: item.oid,
+                        parentClassifyValueOid: item.parentClassifySecOid
+                            ? this.codeApplyForm[item.parentClassifySecOid]
+                            : "",
+                    },
+                };
+            } else if (item.secType == "coderefersec") {
+                params = JSON.parse(item.referValueInfo);
+            }
+            console.log(params)
+            return params;
+
+        },
+        getOptionList(item) {
+            if (
+                Array.isArray(item.fixedValueVOList) &&
+                item.fixedValueVOList.length > 0
+            ) {
+                const configAttr = {
+                    key: "id",
+                    value: "id",
+                };
+                const optionList = item.fixedValueVOList.map((item) => {
+                    for (const key in configAttr) {
+                        if (Object.hasOwnProperty.call(configAttr, key)) {
+                            const element = configAttr[key];
+                            item[key] = item[element];
+                        }
+                    }
+                    return item;
+                });
+                return optionList;
+            } else {
+                return [];
+            }
+        },
+    }
+}
+</script>
\ No newline at end of file
diff --git a/Source/UBCS-WEB/src/main.js b/Source/UBCS-WEB/src/main.js
index a4c5b4c..c409b2d 100644
--- a/Source/UBCS-WEB/src/main.js
+++ b/Source/UBCS-WEB/src/main.js
@@ -53,6 +53,7 @@
 import businesswork from "@/components/work/BusinessWork"
 import MasterTransfer from "@/components/Master/MasterTransfer";
 import ThemeImport from "@/components/Theme/ThemeImport";
+import maxSerialnumDialog from '@/components/code-dialog-page/maxSerialnumDialog'
 // 灏嗗伐鍏峰嚱鏁版坊鍔犲埌鍏ㄥ眬
 import utilFunc from './util/func'
 Vue.prototype.$utilFunc = utilFunc
@@ -106,6 +107,7 @@
 Vue.component('businesswork', businesswork)
 Vue.component('MasterTransfer', MasterTransfer)
 Vue.component('ThemeImport', ThemeImport)
+Vue.component('maxSerialnumDialog', maxSerialnumDialog)
 
 // 鍔犺浇鐩稿叧url鍦板潃
 Object.keys(urls).forEach(key => {
diff --git a/Source/UBCS-WEB/src/views/code/code.vue b/Source/UBCS-WEB/src/views/code/code.vue
index 08666d7..4b4fadd 100644
--- a/Source/UBCS-WEB/src/views/code/code.vue
+++ b/Source/UBCS-WEB/src/views/code/code.vue
@@ -106,6 +106,13 @@
                 @click="escapeOwner">
                 杞Щ鎵�鏈夎��
             </el-button>
+            <el-button
+                size="small"
+                icon="el-icon-guide"
+                plain
+                @click="maxSerialNum">
+                鏈�澶ф祦姘村彿
+            </el-button>
           </template>
         </avue-crud>
       </basic-container>
@@ -248,6 +255,9 @@
             <el-button type="primary" @click="escapeOwnerConfirm">纭� 瀹�</el-button>
           </span>
       </el-dialog>
+
+      <!-- 鏈�澶ф祦姘村彿瀵硅瘽妗� -->
+      <max-serialnum-dialog :visible.sync="maxSerial.visible" :ruleOid="maxSerial.ruleOid"></max-serialnum-dialog>
 
       <!-- 鍩虹鐮佹灞曠ず鍖哄煙 -->
       <basic-container class="code-basicsec-container">
@@ -875,6 +885,12 @@
           ruleOwner: '', // 褰撳墠瑕佽浆绉荤粰鍝釜瑙勫垯绠$悊鍛樼殑ID
           releadDisabled: false, // 閬垮厤瑙勫垯鍙戝竷閲嶅鎻愪氦
 
+          /*鏈�澶ф祦姘村彿*/
+          maxSerial:{
+            visible:false,
+
+          },
+          
           /*浣跨敤鑼冨洿瀵硅瘽妗嗘樉绀烘帶鍒�*/
           codeRangeSettingBox: false,
           useRangeData: [],
@@ -2787,6 +2803,16 @@
           let enumList = this.getLocalStorageEnum("codeGetValueType");
           this.enumParam.codeGetValueType =  enumList.length>0 ? enumList:[];
         },
+        // 鏈�澶ф祦姘村彿
+        maxSerialNum(){
+          console.log(this.selectionList)
+          if (this.selectionList.length === 0) {
+            this.$message.warning("璇烽�夋嫨涓�鏉$紪鐮佽鍒欙紒");
+            return;
+          }
+          this.maxSerial.visible = true
+          this.maxSerial.ruleOid = this.selectionList[0]['oid']
+        }
 
       }
   };
diff --git a/Source/UBCS-WEB/vue.config.js b/Source/UBCS-WEB/vue.config.js
index b400aa7..e8138f2 100644
--- a/Source/UBCS-WEB/vue.config.js
+++ b/Source/UBCS-WEB/vue.config.js
@@ -28,8 +28,8 @@
         //鏈湴鏈嶅姟鎺ュ彛鍦板潃
         // target: 'http://127.0.0.1',
         // target: 'http://192.168.1.51:37000',
-        target: 'http://dev.vci-tech.com:37000',
-        // target: 'http://192.168.1.104:37000',
+        // target: 'http://dev.vci-tech.com:37000',
+        target: 'http://192.168.1.16:37000',
         // target: 'http://192.168.0.105:37000',
         // target: 'http://192.168.0.103:37000',
         // target: 'http://192.168.1.63:37000',

--
Gitblit v1.9.3