From 3d462841427d2f1f94358b46870ddabde4945ca6 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期四, 12 十月 2023 10:39:35 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
Source/UBCS-WEB/src/components/code-dialog-page/maxSerialnumDialog.vue | 597 ++++++++++++++++++++++++++++++-----------------------------
1 files changed, 300 insertions(+), 297 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 6db53ba..183b735 100644
--- a/Source/UBCS-WEB/src/components/code-dialog-page/maxSerialnumDialog.vue
+++ b/Source/UBCS-WEB/src/components/code-dialog-page/maxSerialnumDialog.vue
@@ -1,306 +1,309 @@
<template>
- <el-dialog title="鏈�澶ф祦姘村彿" width="30%" append-to-body="true" :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">
+ <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 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"
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",
- codeattrsec: "text",
- codelevelsec: "text",
- coderefersec: "refer",
- 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.showCodeApply = true;
-
- this.$nextTick(() => {
- this.$refs.CodeApply.templateRender(this.secVOList);
- });
- } else {
- // this.showCodeApply = 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() {
- console.log(this.codeApplyForm)
- const objcodekey = Object.keys(this.codeApplyForm)
- console.log(objcodekey)
- const filteredObj = objcodekey.reduce((acc, key) => {
- const pattern = /[\u4e00-\u9fa5]/; // 鍖归厤涓枃瀛楃鐨勬鍒欒〃杈惧紡
- if (!pattern.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
- console.log(this.formModel)
- this.confirmLoadding = true
- const rule = await this.$refs.CodeApply.validate()
- this.$refs.ruleForm.validate(res => {
- if (rule && res) {
- console.log(rule)
- saveMaxSerialNum(this.formModel).then(res => {
- if (res.data.success) {
- this.$message.success('鎿嶄綔鎴愬姛锛�');
- this.confirmLoadding = false
- this.cancel()
- }
- })
- } else {
- this.confirmLoadding = false
- }
- })
-
- },
- // 鍙傜収缁勪欢鏁版嵁鍙樻洿
- 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;
- });
- 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 [];
- }
- },
+ // 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()
+ }
+ }).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>
\ No newline at end of file
+</script>
--
Gitblit v1.9.3