| | |
| | | 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);
|
| | | },
|
| | | }
|
| | | } |
| | | 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); |
| | | }, |
| | | } |
| | | } |