From 26f2f1b596e14e20d53ac768728ab2f3772c98a4 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期一, 14 八月 2023 16:45:45 +0800
Subject: [PATCH] 主题库点击保存后取消行编辑状态
---
Source/UBCS-WEB/src/components/FormTemplate/CodeApply.vue | 130 ++++++++++++++++++++++++------------------
1 files changed, 74 insertions(+), 56 deletions(-)
diff --git a/Source/UBCS-WEB/src/components/FormTemplate/CodeApply.vue b/Source/UBCS-WEB/src/components/FormTemplate/CodeApply.vue
index 8b86bd3..6f9190d 100644
--- a/Source/UBCS-WEB/src/components/FormTemplate/CodeApply.vue
+++ b/Source/UBCS-WEB/src/components/FormTemplate/CodeApply.vue
@@ -1,84 +1,102 @@
<template>
- <div></div>
+ <FormTemplate
+ ref="FormTemplate"
+ :selfColumnType="selfColumnType"
+ :selfColumnConfig="selfColumnConfig"
+ ></FormTemplate>
</template>
<script>
-import { getCodeRule } from "@/api/formTemplate.js";
-
export default {
name: "CodeApply",
+ components: { FormTemplate: () => import('./FormTemplate.vue') },
props: {
- codeClassifyOid: {
- type: String,
- default: ''
- }
},
data() {
return {
secVOList: [],
formItems: [],
- trendsSpan: 8
+ trendsSpan: 8,
+ selfColumnType: {
+ codefixedsec: "combox",
+ codeclassifysec: "refer",
+ codevariablesec: "text",
+ coderefersec: "refer",
+ },
+ selfColumnConfig: {
+ function: {
+ required: this.isRequired,
+ dicData: this.getOptionList,
+ type: this.getType,
+ },
+ exchange: {
+ text: "name",
+ field: "oid",
+ prop: "oid",
+ showField: "name",
+ parentClassifySecOid: "parentClassifySecOid",
+ label: "name",
+ maxlength: "codeSecLength",
+ data: "fixedValueVOList",
+ },
+ directVoluation: {
+ search: true,
+ props: {
+ label: "id",
+ value: "id",
+ },
+ },
+ },
};
},
created() {
this.handleResize();
- this.getCodeRule();
},
- mounted() {
-
- },
+ mounted() {},
methods: {
- getCodeRule() {
- getCodeRule({ codeClassifyOid: this.codeClassifyOid }).then((res) => {
- if (res.data && res.data.code === 200) {
- this.defaultValue = res.data.data;
- this.secVOList = res.data.data.secVOList || [];
- this.codeRuleOid = res.data.data.oid;
- }
- });
+ getType(item) {
+ return this.selfColumnType[item.sectype];
+ },
+ 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 [];
+ }
+ },
+ init(columnList) {
+ this.$refs.FormTemplate.templateRender(columnList);
},
handleResize() {
let windowWidth = document.body.clientWidth;
this.trendsSpan = 24 / Math.floor(windowWidth / 500);
},
- },
- watch: {
- secVOList: {
- deep: true,
- handler(newV) {
- this.formItems = [];
- newV.forEach((item) => {
- let itemObj = {};
- let options = [];
- //鍥哄畾鐮佹
- if (item.sectype == "codefixedsec") {
- options = item.fixedValueVOList.map((item) => {
- item.key = item.id;
- item.value = item.id;
- });
- itemObj = {
- field: item.oid,
- title: item.name,
- required: item.nullableFlag != "true",
- type: "combox",
- data: options,
- search: true,
- };
- //鍙彉鐮佹
- } else if (item.sectype == "codevariablesec") {
- itemObj = {
- field: item.oid,
- title: item.name,
- required: item.nullableFlag != "true",
- type: "text",
- };
- }
- itemObj.span = item.type === "textarea" ? 24 : this.trendsSpan,
- this.formItems.push(itemObj);
- });
- },
+
+
+ async validate() {
+ return await this.$refs.FormTemplate.validate();
},
},
+ watch: {},
};
</script>
--
Gitblit v1.9.3