From 03fc4cfd7abfd125b942417284999a0aea7305d9 Mon Sep 17 00:00:00 2001
From: xiejun <xiejun@vci-tech.com>
Date: 星期三, 15 一月 2025 21:35:07 +0800
Subject: [PATCH] 产品型号集成,类型转换,人员组织加日志,申请接口引用码段值校验
---
Source/UBCS-WEB/src/components/code-dialog-page/maxSerialnumDialog.vue | 647 ++++++++++++++++++++++++++++++++--------------------------
1 files changed, 356 insertions(+), 291 deletions(-)
diff --git a/Source/UBCS-WEB/src/components/code-dialog-page/maxSerialnumDialog.vue b/Source/UBCS-WEB/src/components/code-dialog-page/maxSerialnumDialog.vue
index dc5182c..e6e7b24 100644
--- a/Source/UBCS-WEB/src/components/code-dialog-page/maxSerialnumDialog.vue
+++ b/Source/UBCS-WEB/src/components/code-dialog-page/maxSerialnumDialog.vue
@@ -1,300 +1,365 @@
<template>
- <el-dialog title="鏈�澶ф祦姘村彿" width="30%" append-to-body="true" class="avue-dialog avue-dialog--top" top="-3%" :visible.sync="dialogVisible">
- <el-form :label-position="right" ref="ruleForm" label-width="80px" :model="formModel" :rules="rules">
- <el-form-item label="娴佹按鍙�" prop="maxSecNum">
- <el-input v-model="formModel.maxSecNum"></el-input>
- </el-form-item>
- </el-form>
- <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" :trendsSpan="24"
- :selfColumnConfig="selfColumnConfig" ref="CodeApply" @getFormData="getCodeApplyFormData"
- @referConfigDataUpdate="referConfigDataUpdate"></form-template>
- </el-tab-pane>
- </el-tabs>
- <div slot="footer" class="dialog-footer">
- <el-button @click="cancel">鍙� 娑�</el-button>
- <el-button type="primary" :loading="confirmLoadding" @click="comfirm">纭� 瀹�</el-button>
- </div>
- </el-dialog>
+ <el-dialog title="鏈�澶ф祦姘村彿" width="30%" append-to-body="true" class="avue-dialog avue-dialog--top" top="-3%" :visible.sync="dialogVisible">
+ <el-form :label-position="right" ref="ruleForm" label-width="80px" :model="formModel" :rules="rules" v-loading="loading">
+ <el-form-item label="娴佹按鍙�" prop="maxSecNum">
+ <el-input v-model="formModel.maxSecNum" @blur="handleBlur"></el-input>
+ </el-form-item>
+ </el-form>
+ <el-tabs v-model="activeName" type="border-card" @tab-click="handleClick">
+ <el-tab-pane label="鏈�澶ф祦姘村彿" name="codeApply">
+ <form-template key="codeApplyMaxForm" data-key="codeApplyMaxForm" v-bind="$attrs" type="add" :selfColumnType="selfColumnType" :trendsSpan="24"
+ :selfColumnConfig="selfColumnConfig" ref="CodeApply" @getFormData="getCodeApplyFormData"
+ @referConfigDataUpdate="referConfigDataUpdate"></form-template>
+ </el-tab-pane>
+ </el-tabs>
+ <div slot="footer" class="dialog-footer">
+ <el-button @click="cancel">鍙� 娑�</el-button>
+ <el-button type="primary" :loading="confirmLoadding" @click="comfirm">纭� 瀹�</el-button>
+ </div>
+ </el-dialog>
</template>
<script>
import FormTemplate from "@/components/FormTemplate/FormTemplate";
-import { getCodePrice, saveMaxSerialNum } from "@/api/code/maxSerialNum.js"
+import { getCodePrice, saveMaxSerialNum, getMaxSerialNumber } from "@/api/code/maxSerialNum.js"
export default {
- name: 'maxSerialnumDialog',
- components: {
- FormTemplate
+ name: 'maxSerialnumDialog',
+ components: {
+ FormTemplate
+ },
+ props: {
+ // 鏄惁鎵撳紑
+ visible: {
+ typeof: Boolean,
+ default: false
},
- 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',
- confirmLoadding: false,
- codeApplyForm: {},
- secVOList: [],
- formModel: {
- maxSecNum: '',
- codeRuleOid: '',
- secDTOList: []
- },
- rules: {
- maxSecNum: [
- { required: true, message: '璇疯緭鍏ユ祦姘村彿', trigger: 'blur' }
- ],
- },
- selfColumnType: {
- codefixedsec: "combox",//鍥哄畾鐮佹
- codeclassifysec: "refer",//鍒嗙被鐮佹
- codevariablesec: "text",//鍙彉鐮佹
- coderefersec: "refer",//寮曠敤鐮佹
- codeattrsec: "text",
- codelevelsec: "text",
- codedatesec: "date"
- },
- 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",
- dateFormate: "codeDateFormatStr"
- },
- directVoluation: {
- search: true,
- props: {
- label: "id",
- value: "id",
- },
- },
- },
- }
- },
- methods: {
- // 鑾峰彇鐮佹
- async apiGetCode() {
- this.activeName = "codeApply";
- const response = await getCodePrice({ ruleOid: this.ruleOid })
- const res = response.data
- if (res.success && res.code === 200) {
- const typeList = [
- "codefixedsec",
- "codeclassifysec",
- "codevariablesec",
- "coderefersec",
- "codeattrsec",
- "codelevelsec",
- "codedatesec"
- ];
- this.secVOList = (res.data.secVOList || []).filter((item) =>
- typeList.includes(item.secType)
- );
- if (this.secVOList.length > 0) {
- this.$nextTick(() => {
- this.$refs.CodeApply.templateRender(this.secVOList);
- });
- } else {
- this.$refs.CodeApply.loading = false;
- }
- }
- },
- handleClick(tab, event) {
- // console.log(event)
- },
- getCodeApplyFormData(codeApplyForm) {
- this.codeApplyForm = codeApplyForm;
- },
- // 鍙栨秷
- cancel() {
- this.dialogVisible = false
- this.formModel['secDTOList'] = []
- this.formModel['codeRuleOid'] = ''
- this.formModel['maxSecNum'] = ''
- this.$refs.ruleForm.clearValidate('maxSecNum')
-
- },
- // 纭
- async comfirm() {
- const objcodekey = Object.keys(this.codeApplyForm)
- const filteredObj = objcodekey.reduce((acc, key) => {
- const pattern = /[\u4e00-\u9fa5]/; // 鍖归厤涓枃瀛楃鐨勬鍒欒〃杈惧紡
- const patterns = /\$/;
- if (!pattern.test(key)&&!patterns.test(key)) {
- acc[key] = this.codeApplyForm[key];
- }
- return acc;
- }, {});
-
- const arrCode = Object.entries(filteredObj).map(([key, value]) => {
- return {
- secOid: key,
- secValue: value
- }
- })
- this.formModel['secDTOList'] = arrCode
- this.formModel['codeRuleOid'] = this.ruleOid
- this.confirmLoadding = true
- const rule = await this.$refs.CodeApply.validate()
- this.$refs.ruleForm.validate(res => {
- if (rule && res) {
- saveMaxSerialNum(this.formModel).then(res => {
- if (res.data.success) {
- this.$message.success('鎿嶄綔鎴愬姛锛�');
- this.confirmLoadding = false
- this.cancel()
- }
- })
- } else {
- this.confirmLoadding = false
- }
- })
-
- },
- // 鍙傜収缁勪欢鏁版嵁鍙樻洿
- referConfigDataUpdate(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;
- });
- 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) {
- let params = {};
- if (item.secType == "codeclassifysec") {
- params = {
- isMuti: false,
- valueField: 'id',
- 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 [];
- }
- },
+ // 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
+ },
+ },
+ mounted() {
+ },
+ data() {
+ return {
+ loading:false,
+ maxNum:Number,
+ ruleFormFlag:Boolean,
+ dialogVisible: this.visible,
+ activeName: 'codePrice',
+ confirmLoadding: false,
+ codeApplyForm: {},
+ secVOList: [],
+ formModel: {
+ maxSecNum: '',
+ codeRuleOid: '',
+ secDTOList: []
+ },
+ rules: {
+ maxSecNum: [
+ { required: true, message: '璇疯緭鍏ユ祦姘村彿', trigger: 'blur' },
+ {
+ validator: (rule, value, callback) => {
+ if (value < this.maxNum) {
+ callback(new Error('涓嶈兘灏忎簬褰撳墠鏈�澶ф祦姘村彿'));
+ } else {
+ callback();
+ }
+ },
+ trigger: 'blur'
+ }
+ ],
+ },
+ selfColumnType: {
+ codefixedsec: "combox",//鍥哄畾鐮佹
+ codeclassifysec: "refer",//鍒嗙被鐮佹
+ codevariablesec: "text",//鍙彉鐮佹
+ coderefersec: "refer",//寮曠敤鐮佹
+ codeattrsec: "text",
+ codelevelsec: "text",
+ codedatesec: "date"
+ },
+ 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",
+ dateFormate: "codeDateFormatStr"
+ },
+ directVoluation: {
+ search: true,
+ props: {
+ label: "id",
+ value: "id",
+ },
+ },
+ },
+ }
+ },
+ methods: {
+ //娓呴櫎姝e垯
+ handleBlur() {
+ this.$refs.ruleForm.clearValidate('maxSecNum');
+ },
+ // 鑾峰彇鐮佹
+ async apiGetCode() {
+ this.activeName = "codeApply";
+ const response = await getCodePrice({ ruleOid: this.ruleOid })
+ const res = response.data
+ if (res.success && res.code === 200) {
+ const typeList = [
+ "codefixedsec",
+ "codeclassifysec",
+ "codevariablesec",
+ "coderefersec",
+ "codeattrsec",
+ "codelevelsec",
+ "codedatesec"
+ ];
+ this.secVOList = (res.data.secVOList || []).filter((item) =>
+ typeList.includes(item.secType)
+ );
+ if (this.secVOList.length > 0) {
+ this.$nextTick(() => {
+ this.$refs.CodeApply.templateRender(this.secVOList);
+ });
+ } else {
+ this.$refs.CodeApply.loading = false;
+ }
+ }
+ },
+ handleClick(tab, event) {
+ // console.log(event)
+ },
+ getCodeApplyFormData(codeApplyForm) {
+ this.codeApplyForm = codeApplyForm;
+ //鏈�澶ф祦姘碞umber
+ const objcodekey = Object.keys(codeApplyForm)
+ const filteredObj = objcodekey.reduce((acc, key) => {
+ const pattern = /[\u4e00-\u9fa5]/; // 鍖归厤涓枃瀛楃鐨勬鍒欒〃杈惧紡
+ const patterns = /\$/;
+ if (!pattern.test(key)&&!patterns.test(key)) {
+ acc[key] = this.codeApplyForm[key];
+ }
+ return acc;
+ }, {});
+
+ /*const arrCode = Object.entries(filteredObj).map(([key, value]) => {
+ return {
+ secOid: key,
+ secValue: value
+ }
+ })*/
+
+ this.ruleFormFlag = Object.values(codeApplyForm).every(value => {
+ return value !== null && value !== undefined && value !== '';
+ });
+ if (this.ruleFormFlag && this.secVOList.length>0) {
+ this.loading=true;
+ let params = {};
+ params['codeRuleOid'] = this.ruleOid;
+ Object.keys(filteredObj).forEach((key) => {
+ params[key] = filteredObj[key];
+ });
+ getMaxSerialNumber(params).then(res => {
+ this.formModel.maxSecNum = res.data.data;
+ this.loading=false;
+ this.maxNum=res.data.data
+ });
+ }
+ },
+
+ // 鍙栨秷
+ cancel() {
+ this.dialogVisible = false
+ this.formModel['secDTOList'] = []
+ this.formModel['codeRuleOid'] = ''
+ this.formModel['maxSecNum'] = ''
+ this.$refs.ruleForm.clearValidate('maxSecNum')
+
+ },
+ // 纭
+ async comfirm() {
+ const objcodekey = Object.keys(this.codeApplyForm)
+ const filteredObj = objcodekey.reduce((acc, key) => {
+ const pattern = /[\u4e00-\u9fa5]/; // 鍖归厤涓枃瀛楃鐨勬鍒欒〃杈惧紡
+ const patterns = /\$/;
+ if (!pattern.test(key)&&!patterns.test(key)) {
+ acc[key] = this.codeApplyForm[key];
+ }
+ return acc;
+ }, {});
+ const arrCode = Object.entries(filteredObj).map(([key, value]) => {
+ return {
+ secOid: key,
+ secValue: value
+ }
+ })
+ this.formModel['secDTOList'] = arrCode
+ this.formModel['codeRuleOid'] = this.ruleOid
+ this.confirmLoadding = true;
+ // this.FormRule= await this.$refs.CodeApply.validate();
+ const rule = await this.$refs.CodeApply.validate();
+ // console.log(rule)
+ this.$refs.ruleForm.validate(res => {
+ if (rule && res) {
+ // console.log(rule,res)
+ saveMaxSerialNum(this.formModel).then(res => {
+ if (res.data.success) {
+ this.$message.success('鎿嶄綔鎴愬姛锛�');
+ this.confirmLoadding = false
+ this.cancel()
+ }
+ }).catch(error=>{
+ this.confirmLoadding = false
+ })
+ } else {
+ this.confirmLoadding = false
+ }
+ })
+
+ },
+ // 鍙傜収缁勪欢鏁版嵁鍙樻洿
+ referConfigDataUpdate(data) {
+ const {field} = data;
+ let childItems=[];
+ this.secVOList = this.secVOList.map((item) => {
+ if (item.parentClassifySecOid === field) {
+ this.$refs.CodeApply.form[item.oid] = undefined;
+ this.$refs.CodeApply.form[item.name] = undefined;
+ item.readOnly = false;
+ item.referConfig.extraParams.parentClassifyValueOid = data.value;
+ item.referConfig.reloadData = true;
+ item.dataKey=item.oid+'_'+new Date().getTime();
+ childItems.push(item)
+ }
+ return item;
+ });
+ //this.$refs.CodeApply.templateRender(this.secVOList);
+ this.$refs.CodeApply.changeChildItem(childItems);
+ },
+ 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) {
+ let params = {};
+ if (item.secType == "codeclassifysec") {
+ params = {
+ isMuti: false,
+ valueField: 'oid',
+ 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>
--
Gitblit v1.9.3