From 9791e56cf79dda75702d2b72e89106c65cb13242 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期二, 19 三月 2024 11:37:15 +0800
Subject: [PATCH] 更新代码
---
Source/UBCS-WEB/src/mixins/codeApply.js | 369 +++++++++++++++++++++++++++-------------------------
1 files changed, 190 insertions(+), 179 deletions(-)
diff --git a/Source/UBCS-WEB/src/mixins/codeApply.js b/Source/UBCS-WEB/src/mixins/codeApply.js
index 2dac60e..4416eab 100644
--- a/Source/UBCS-WEB/src/mixins/codeApply.js
+++ b/Source/UBCS-WEB/src/mixins/codeApply.js
@@ -1,179 +1,190 @@
-import { getCodeRule } from "@/api/formTemplate.js";
-export default {
- data() {
- return {
- secVOList: [],
- showCodeApply: false,
- 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,
- span: 12,
- props: {
- label: "id",
- value: "id",
- },
- },
- },
- codeApplyForm: {},
- }
- },
- created() {
- this.getCodeRule()
- },
- methods: {
- // 鑾峰彇鐮佸�肩敵璇锋暟鎹�
- getCodeRule() {
- getCodeRule({ codeClassifyOid: this.codeClassifyOid }).then((res) => {
- if (res.data && res.data.code === 200) {
- const typeList = [
- "codefixedsec",
- "codeclassifysec",
- "codevariablesec",
- "coderefersec",
- ];
- this.secVOList = res.data.data.secVOList || []
- let localSecVOList = (res.data.data.secVOList || []).filter((item) =>
- typeList.includes(item.secType)
- );
- if (localSecVOList.length > 0) {
- this.showCodeApply = true
- this.$nextTick(() => {
- this.$refs.CodeApply.templateRender(localSecVOList);
- });
- }
-
- }
- });
- },
- getCodeApplyFormData(codeApplyForm) {
- this.codeApplyForm = codeApplyForm;
- },
- getType(item) {
- console.log(item.secType, 'item.secType');
- return this.selfColumnType[item.secType];
- },
- getReferConfig(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.referConfig);
- }
- return params;
- },
- getDisabled(item) {
- if (item.secType === "codeclassifysec") {
- if (item.parentClassifySecOid) {
- if (!this.codeApplyForm[item.parentClassifySecOid]) {
- return true;
- } else {
- return false;
- }
- }
- }
- },
- isRequired(item) {
- return item.nullableFlag != "true";
- },
- 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 [];
- }
- },
- // 鍙傜収缁勪欢鏁版嵁鍙樻洿
- 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);
- },
- }
-}
\ No newline at end of file
+import { getCodeRule } from "@/api/formTemplate.js";
+export default {
+ data() {
+ return {
+ secVOList: [],
+ localSecVOList: [],
+ showCodeApply: false,
+ 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,
+ span: 12,
+ props: {
+ label: "id",
+ value: "id",
+ },
+ },
+ },
+ codeApplyForm: {},
+ }
+ },
+ created() {
+ if (this.type === 'batchImportApply') {
+ this.getCodeRule()
+ }
+ },
+ methods: {
+ // 鑾峰彇鐮佸�肩敵璇锋暟鎹�
+ getCodeRule() {
+ getCodeRule({ codeClassifyOid: this.localCodeClassifyOid || this.codeClassifyOid }).then((res) => {
+ if (res.data && res.data.code === 200) {
+ const typeList = [
+ "codefixedsec",
+ "codeclassifysec",
+ "codevariablesec",
+ "coderefersec",
+ ];
+ this.secVOList = res.data.data.secVOList || []
+ this.localSecVOList = (res.data.data.secVOList || []).filter((item) =>
+ typeList.includes(item.secType)
+ );
+ if (this.localSecVOList.length > 0) {
+ this.showCodeApply = true
+ this.$nextTick(() => {
+ if (this.batchApplyCodeTableData) {
+ this.batchApplyCodeTableData[this.codeRuleOid]["localSecVOList"] = this.localSecVOList
+ }
+ this.$refs.CodeApply.templateRender(this.localSecVOList);
+ });
+ } else {
+ this.showCodeApply = false
+ }
+
+ }
+ });
+ },
+ getCodeApplyFormData(codeApplyForm) {
+ this.codeApplyForm = codeApplyForm;
+ if (this.batchApplyCodeTableData) {
+ this.batchApplyCodeTableData[this.codeRuleOid]["codeApply"] = codeApplyForm
+ }
+ },
+ getType(item) {
+ console.log(item.secType, 'item.secType');
+ return this.selfColumnType[item.secType];
+ },
+ getReferConfig(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);
+ }
+ return params;
+ },
+ getDisabled(item) {
+ if (item.secType === "codeclassifysec") {
+ if (item.parentClassifySecOid) {
+ if (!this.codeApplyForm[item.parentClassifySecOid]) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ }
+ },
+ isRequired(item) {
+ return item.nullableFlag != "true";
+ },
+ 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 [];
+ }
+ },
+ // 鍙傜収缁勪欢鏁版嵁鍙樻洿
+ referConfigDataUpdate(data) {
+ const { field } = data;
+ this.localSecVOList = this.localSecVOList.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.localSecVOList);
+ },
+ }
+}
--
Gitblit v1.9.3