From 56c45e1f4be85d6bbfb3a03437021c6742b32ad9 Mon Sep 17 00:00:00 2001 From: ludc Date: 星期四, 24 八月 2023 18:29:30 +0800 Subject: [PATCH] 前端代码打包 --- Source/UBCS-WEB/src/components/code-dialog-page/maxSerialnumDialog.vue | 308 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 308 insertions(+), 0 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 new file mode 100644 index 0000000..83740c1 --- /dev/null +++ b/Source/UBCS-WEB/src/components/code-dialog-page/maxSerialnumDialog.vue @@ -0,0 +1,308 @@ +<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> +</template> +<script> +import FormTemplate from "@/components/FormTemplate/FormTemplate"; +import { getCodePrice, saveMaxSerialNum } 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', + 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]/; // 鍖归厤涓枃瀛楃鐨勬鍒欒〃杈惧紡 + 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 + 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, + 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 []; + } + }, + } +} +</script> \ No newline at end of file -- Gitblit v1.9.3