From f39675fad28f66dd32aee1d3ee805ad99007bce5 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期五, 02 六月 2023 21:13:16 +0800
Subject: [PATCH] 代码整合

---
 Source/UBCS-WEB/src/components/FormTemplate/CodeApply.vue |  122 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 122 insertions(+), 0 deletions(-)

diff --git a/Source/UBCS-WEB/src/components/FormTemplate/CodeApply.vue b/Source/UBCS-WEB/src/components/FormTemplate/CodeApply.vue
new file mode 100644
index 0000000..242fbac
--- /dev/null
+++ b/Source/UBCS-WEB/src/components/FormTemplate/CodeApply.vue
@@ -0,0 +1,122 @@
+<template>
+  <FormTempalte
+    ref="FormTempalte"
+    :visible="visible"
+    :selfColumnType="selfColumnType"
+    :selfColumnConfig="selfColumnConfig"
+    :columnList="columnList"
+  ></FormTempalte>
+</template>
+
+<script>
+import { getCodeRule } from "@/api/formTemplate.js";
+import FormTempalte from "./FormTempalte.vue";
+export default {
+  name: "CodeApply",
+  components: { FormTempalte },
+  props: {
+    visible: {
+      type: Boolean,
+      default: false
+    },
+    codeClassifyOid: {
+      type: String,
+      default: "",
+    },
+  },
+  data() {
+    return {
+      secVOList: [],
+      formItems: [],
+      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",
+          },
+        },
+      },
+      columnList: [],
+    };
+  },
+  created() {
+    this.handleResize();
+  },
+  mounted() {},
+  methods: {
+    getType(item) {
+      return this.selfColumnType[item.sectype];
+    },
+    getCodeRule() {
+      getCodeRule({ codeClassifyOid: this.codeClassifyOid }).then((res) => {
+        if (res.data && res.data.code === 200) {
+          this.defaultValue = res.data.data;
+          this.columnList = res.data.data.secVOList || [];
+          console.log(res.data.data.secVOList, 'res.data.data.secVOList');
+          this.codeRuleOid = res.data.data.oid;
+          this.$nextTick(() => {
+            this.$refs.FormTempalte.init(res.data.data.secVOList)
+          })
+        }
+      });
+    },
+    handleResize() {
+      let windowWidth = document.body.clientWidth;
+      this.trendsSpan = 24 / Math.floor(windowWidth / 500);
+    },
+    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 [];
+      }
+    },
+  },
+  watch: {
+  },
+};
+</script>
+
+<style lang="less" scoped></style>

--
Gitblit v1.9.3