From 2210c590f886d75bc760fa08caa18dd0181026b5 Mon Sep 17 00:00:00 2001 From: fujunling <2984387807@qq.com> Date: 星期四, 01 六月 2023 18:48:08 +0800 Subject: [PATCH] 动态表单分组 --- /dev/null | 636 --------------- Source/UBCS-WEB/src/components/FormTemplate/FormTempalte.vue | 762 ++++++++++++++++++ Source/UBCS-WEB/src/components/FormTemplate/ResembleQuery.vue | 184 ++++ Source/UBCS-WEB/src/components/FormTemplate/index.vue | 777 +---------------- Source/UBCS-WEB/src/components/FormTemplate/CodeApply.vue | 85 ++ Source/UBCS-WEB/src/views/MasterData/FormTempalteTest.vue | 23 Source/UBCS-WEB/src/main.js | 3 Source/UBCS-WEB/src/api/formTemplate.js | 11 8 files changed, 1,141 insertions(+), 1,340 deletions(-) diff --git a/Source/UBCS-WEB/src/api/formTemplate.js b/Source/UBCS-WEB/src/api/formTemplate.js index 17498e9..acbb3d4 100644 --- a/Source/UBCS-WEB/src/api/formTemplate.js +++ b/Source/UBCS-WEB/src/api/formTemplate.js @@ -20,8 +20,17 @@ // 鐩镐技椤规煡璇� export const findLike = (data) => { return request({ - url: 'api/mdmEngineController/resembleQuery', + url: 'api/ubcs-code/ubcs-code/mdmEngineController/resembleQuery', method: 'post', data }) +} + +// 鑾峰彇鏁版嵁 +export const getCodeRule = (params) => { + return request({ + url: 'api/ubcs-code/ubcs-code/mdmEngineController/getCodeRuleByClassifyOid', + method: 'get', + params + }) } \ No newline at end of file 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..8b86bd3 --- /dev/null +++ b/Source/UBCS-WEB/src/components/FormTemplate/CodeApply.vue @@ -0,0 +1,85 @@ +<template> + <div></div> +</template> + +<script> +import { getCodeRule } from "@/api/formTemplate.js"; + +export default { + name: "CodeApply", + props: { + codeClassifyOid: { + type: String, + default: '' + } + }, + data() { + return { + secVOList: [], + formItems: [], + trendsSpan: 8 + }; + }, + created() { + this.handleResize(); + this.getCodeRule(); + }, + 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; + } + }); + }, + 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); + }); + }, + }, + }, +}; +</script> + +<style lang="less" scoped></style> diff --git a/Source/UBCS-WEB/src/components/FormTemplate/FindLike.vue b/Source/UBCS-WEB/src/components/FormTemplate/FindLike.vue deleted file mode 100644 index 3dc09e9..0000000 --- a/Source/UBCS-WEB/src/components/FormTemplate/FindLike.vue +++ /dev/null @@ -1,636 +0,0 @@ -<template> - <div v-if="visible"> - <el-tabs v-model="activeName" type="card" @tab-click="handleClick"> - <el-tab-pane label="鐩镐技椤规暟鎹�" name="findlike"> - <el-table - :data="tableData" - v-loading="loading" - height="250" - :border="true" - > - <el-table-column - v-for="item in column" - :key="item.prop" - :prop="item.prop" - :label="item.label" - > - <template #default="{ row }"> - <el-button type="text" @click="openFormTemlpate(row)">{{ - row.id - }}</el-button> - </template> - </el-table-column> - </el-table> - </el-tab-pane> - </el-tabs> - - <FormTemplate - type="detail" - :visible.sync="templateVisible" - templateOid="78B8C7C5-A042-0B96-FE6D-65421451782A" - codeClassifyOid="4524E801-6CC6-92E8-1AC3-2AB9604E8F96" - ></FormTemplate> - </div> -</template> - -<script> -import { findLike } from "@/api/formTemplate"; -import FormTemplate from "./index.vue"; -export default { - name: "FindLike", - components: { FormTemplate }, - props: { - column: { - type: Array, - default: () => [{ prop: "id", label: "浠e彿" }], - }, - }, - data() { - return { - visible: false, - templateVisible: false, - activeName: 'findlike', - tableData: [ - { - lastmodifier: "1(涓氬姟娴嬭瘯)", - revisionseq: "1", - versionvalue: "1", - secondfl: "", - versionseq: "1", - checkinby: "", - firstfl: "", - jiliangdwname: "", - materialtype: "1001", - materialtypeText: "鏉愭枡", - chukufangshi: "鍏堣繘鍏堝嚭", - hesuanfenlei: "", - lctid: "wupinLC", - id: "******", - isfirstv: "1", - revisionoid: "C2FD69E0-59CA-7A3C-D3BE-A95AB67F81D4", - checkouttime: "", - btmname: "wupin", - codeclsfid: "4524E801-6CC6-92E8-1AC3-2AB9604E8F96", - revisionvalue: "1", - secretgradeText: "鏅�氬晢瀵�", - name: "", - secretgrade: "2", - isfirstr: "1", - xinghaoguige: "", - materialname: "test12", - codetemplateoid: "78B8C7C5-A042-0B96-FE6D-65421451782A", - description: "", - oid: "5052756D-CE43-8F30-AE6B-A4F4102A66C5", - thrifl: "", - revisionrule: "numberversionrule", - lcstatus_text: "缂栬緫涓�", - oldcode: "223", - hesuanfenleiname: "", - codeclsfpath: - "D9CF223F-317D-71EB-BD11-433A94CAD9F3##535FC9B6-FE27-241F-5FCA-ED4DC17CF95B##8EB35A1D-AB8B-2255-565C-84D309E0C62B##4524E801-6CC6-92E8-1AC3-2AB9604E8F96", - owner: "1", - xiaoshouwl: "false", - checkoutby: "", - creator: "1(涓氬姟娴嬭瘯)", - createtime: "2023-04-12 21:53:06.637", - tuhao: "yy002", - beizhushuoming: "", - versionrule: "0", - jiliangdw: "涓�", - islastr: "1", - copyfromversion: "", - materialclassify: "", - lastmodifytime: "2023-04-12 21:53:06.637", - nameoid: "69E5E86F-AD62-1DBE-05D3-E0CE4C07408F", - lcstatus: "Editing", - islastv: "1", - checkintime: "", - ts: "2023-04-12 21:53:06.637", - }, - { - lastmodifier: "1(涓氬姟娴嬭瘯)", - revisionseq: "1", - versionvalue: "1", - secondfl: "", - versionseq: "1", - checkinby: "", - firstfl: "", - jiliangdwname: "", - materialtype: "1001", - materialtypeText: "鏉愭枡", - chukufangshi: "鍏堣繘鍏堝嚭", - hesuanfenlei: "", - lctid: "wupinLC", - id: "******", - isfirstv: "1", - revisionoid: "C33464B7-79A8-095B-D6FC-F9EB2EA0C985", - checkouttime: "", - btmname: "wupin", - codeclsfid: "4524E801-6CC6-92E8-1AC3-2AB9604E8F96", - revisionvalue: "1", - secretgradeText: "鏅�氬晢瀵�", - name: "", - secretgrade: "2", - isfirstr: "1", - xinghaoguige: "", - materialname: "test12", - codetemplateoid: "78B8C7C5-A042-0B96-FE6D-65421451782A", - description: "", - oid: "4AF61981-D2E8-D8A2-9704-D12B043C22D1", - thrifl: "", - revisionrule: "numberversionrule", - lcstatus_text: "缂栬緫涓�", - oldcode: "223", - hesuanfenleiname: "", - codeclsfpath: - "D9CF223F-317D-71EB-BD11-433A94CAD9F3##535FC9B6-FE27-241F-5FCA-ED4DC17CF95B##8EB35A1D-AB8B-2255-565C-84D309E0C62B##4524E801-6CC6-92E8-1AC3-2AB9604E8F96", - owner: "1", - xiaoshouwl: "false", - checkoutby: "", - creator: "1(涓氬姟娴嬭瘯)", - createtime: "2023-04-12 21:51:06.262", - tuhao: "yy002", - beizhushuoming: "", - versionrule: "0", - jiliangdw: "涓�", - islastr: "1", - copyfromversion: "", - materialclassify: "", - lastmodifytime: "2023-04-12 21:51:06.262", - nameoid: "53E9B351-C410-2A78-3DC0-159BB3E695F9", - lcstatus: "Editing", - islastv: "1", - checkintime: "", - ts: "2023-04-12 21:51:06.262", - }, - { - lastmodifier: "1(涓氬姟娴嬭瘯)", - revisionseq: "1", - versionvalue: "1", - secondfl: "", - versionseq: "1", - checkinby: "", - firstfl: "", - jiliangdwname: "", - materialtype: "1001", - materialtypeText: "鏉愭枡", - chukufangshi: "鍏堣繘鍏堝嚭", - hesuanfenlei: "", - lctid: "wupinLC", - id: "******", - isfirstv: "1", - revisionoid: "00813CDD-4066-5FF5-0AAF-4AFCDB0C2CAE", - checkouttime: "", - btmname: "wupin", - codeclsfid: "4524E801-6CC6-92E8-1AC3-2AB9604E8F96", - revisionvalue: "1", - secretgradeText: "鏅�氬晢瀵�", - name: "", - secretgrade: "2", - isfirstr: "1", - xinghaoguige: "", - materialname: "test12", - codetemplateoid: "78B8C7C5-A042-0B96-FE6D-65421451782A", - description: "", - oid: "47E45EAF-74E3-C722-3FCA-8FC8F996684F", - thrifl: "", - revisionrule: "numberversionrule", - lcstatus_text: "缂栬緫涓�", - oldcode: "223", - hesuanfenleiname: "", - codeclsfpath: - "D9CF223F-317D-71EB-BD11-433A94CAD9F3##535FC9B6-FE27-241F-5FCA-ED4DC17CF95B##8EB35A1D-AB8B-2255-565C-84D309E0C62B##4524E801-6CC6-92E8-1AC3-2AB9604E8F96", - owner: "1", - xiaoshouwl: "false", - checkoutby: "", - creator: "1(涓氬姟娴嬭瘯)", - createtime: "2023-04-12 21:41:14.965", - tuhao: "yy002", - beizhushuoming: "", - versionrule: "0", - jiliangdw: "涓�", - islastr: "1", - copyfromversion: "", - materialclassify: "", - lastmodifytime: "2023-04-12 21:41:14.965", - nameoid: "0AA8ACA8-1961-A670-93C5-744DCFF64238", - lcstatus: "Editing", - islastv: "1", - checkintime: "", - ts: "2023-04-12 21:41:14.965", - }, - { - lastmodifier: "1(涓氬姟娴嬭瘯)", - revisionseq: "1", - versionvalue: "1", - secondfl: "", - versionseq: "1", - checkinby: "", - firstfl: "", - jiliangdwname: "", - materialtype: "1001", - materialtypeText: "鏉愭枡", - chukufangshi: "鍏堣繘鍏堝嚭", - hesuanfenlei: "", - lctid: "wupinLC", - id: "******", - isfirstv: "1", - revisionoid: "413C9BA4-877D-AC01-554D-4DF3CCC0CCA5", - checkouttime: "", - btmname: "wupin", - codeclsfid: "4524E801-6CC6-92E8-1AC3-2AB9604E8F96", - revisionvalue: "1", - secretgradeText: "鏅�氬晢瀵�", - name: "", - secretgrade: "2", - isfirstr: "1", - xinghaoguige: "", - materialname: "test12", - codetemplateoid: "78B8C7C5-A042-0B96-FE6D-65421451782A", - description: "", - oid: "E2F85B5B-9812-0A03-59D1-F4A48BCDA20B", - thrifl: "", - revisionrule: "numberversionrule", - lcstatus_text: "缂栬緫涓�", - oldcode: "223", - hesuanfenleiname: "", - codeclsfpath: - "D9CF223F-317D-71EB-BD11-433A94CAD9F3##535FC9B6-FE27-241F-5FCA-ED4DC17CF95B##8EB35A1D-AB8B-2255-565C-84D309E0C62B##4524E801-6CC6-92E8-1AC3-2AB9604E8F96", - owner: "1", - xiaoshouwl: "false", - checkoutby: "", - creator: "1(涓氬姟娴嬭瘯)", - createtime: "2023-04-12 21:38:11.315", - tuhao: "yy002", - beizhushuoming: "", - versionrule: "0", - jiliangdw: "涓�", - islastr: "1", - copyfromversion: "", - materialclassify: "", - lastmodifytime: "2023-04-12 21:38:11.315", - nameoid: "231D873D-ADF0-1E46-5E02-A2C0C1667324", - lcstatus: "Editing", - islastv: "1", - checkintime: "", - ts: "2023-04-12 21:38:11.315", - }, - { - lastmodifier: "1(涓氬姟娴嬭瘯)", - revisionseq: "1", - versionvalue: "1", - secondfl: "", - versionseq: "1", - checkinby: "", - firstfl: "", - jiliangdwname: "", - materialtype: "1001", - materialtypeText: "鏉愭枡", - chukufangshi: "鍏堣繘鍏堝嚭", - hesuanfenlei: "", - lctid: "wupinLC", - id: "******", - isfirstv: "1", - revisionoid: "99E22C15-228E-E64B-E0F4-BB699CF1E686", - checkouttime: "", - btmname: "wupin", - codeclsfid: "4524E801-6CC6-92E8-1AC3-2AB9604E8F96", - revisionvalue: "1", - secretgradeText: "鏅�氬晢瀵�", - name: "", - secretgrade: "2", - isfirstr: "1", - xinghaoguige: "", - materialname: "test1223", - codetemplateoid: "78B8C7C5-A042-0B96-FE6D-65421451782A", - description: "", - oid: "A750F940-B2EA-DB08-5240-1379FE34E9C1", - thrifl: "", - revisionrule: "numberversionrule", - lcstatus_text: "缂栬緫涓�", - oldcode: "223", - hesuanfenleiname: "", - codeclsfpath: - "D9CF223F-317D-71EB-BD11-433A94CAD9F3##535FC9B6-FE27-241F-5FCA-ED4DC17CF95B##8EB35A1D-AB8B-2255-565C-84D309E0C62B##4524E801-6CC6-92E8-1AC3-2AB9604E8F96", - owner: "1", - xiaoshouwl: "false", - checkoutby: "", - creator: "1(涓氬姟娴嬭瘯)", - createtime: "2023-04-12 21:26:31.626", - tuhao: "yy002", - beizhushuoming: "", - versionrule: "0", - jiliangdw: "涓�", - islastr: "1", - copyfromversion: "", - materialclassify: "", - lastmodifytime: "2023-04-12 21:26:31.626", - nameoid: "B38F560F-38EF-4E80-A843-0EF0556DBE1A", - lcstatus: "Editing", - islastv: "1", - checkintime: "", - ts: "2023-04-12 21:26:31.626", - }, - { - lastmodifier: "1(涓氬姟娴嬭瘯)", - revisionseq: "1", - versionvalue: "1", - secondfl: "", - versionseq: "1", - checkinby: "", - firstfl: "", - jiliangdwname: "", - materialtype: "1001", - materialtypeText: "鏉愭枡", - chukufangshi: "鍏堣繘鍏堝嚭", - hesuanfenlei: "", - lctid: "wupinLC", - id: "******", - isfirstv: "1", - revisionoid: "0D8A595E-962C-E88A-1B75-CCBA29675B7A", - checkouttime: "", - btmname: "wupin", - codeclsfid: "4524E801-6CC6-92E8-1AC3-2AB9604E8F96", - revisionvalue: "1", - secretgradeText: "鏅�氬晢瀵�", - name: "", - secretgrade: "2", - isfirstr: "1", - xinghaoguige: "", - materialname: "test12", - codetemplateoid: "78B8C7C5-A042-0B96-FE6D-65421451782A", - description: "", - oid: "80602381-F29D-E6A3-9DD4-FEF211DB8EAA", - thrifl: "", - revisionrule: "numberversionrule", - lcstatus_text: "缂栬緫涓�", - oldcode: "223", - hesuanfenleiname: "", - codeclsfpath: - "D9CF223F-317D-71EB-BD11-433A94CAD9F3##535FC9B6-FE27-241F-5FCA-ED4DC17CF95B##8EB35A1D-AB8B-2255-565C-84D309E0C62B##4524E801-6CC6-92E8-1AC3-2AB9604E8F96", - owner: "1", - xiaoshouwl: "false", - checkoutby: "", - creator: "1(涓氬姟娴嬭瘯)", - createtime: "2023-04-12 21:20:08.311", - tuhao: "yy002", - beizhushuoming: "", - versionrule: "0", - jiliangdw: "涓�", - islastr: "1", - copyfromversion: "", - materialclassify: "", - lastmodifytime: "2023-04-12 21:20:08.311", - nameoid: "DBDF377F-F7CF-67BA-673B-D8DE7E6D6587", - lcstatus: "Editing", - islastv: "1", - checkintime: "", - ts: "2023-04-12 21:20:08.311", - }, - { - lastmodifier: "1(涓氬姟娴嬭瘯)", - revisionseq: "1", - versionvalue: "1", - secondfl: "", - versionseq: "1", - checkinby: "", - firstfl: "", - jiliangdwname: "", - materialtype: "1001", - materialtypeText: "鏉愭枡", - chukufangshi: "鍏堣繘鍏堝嚭", - hesuanfenlei: "", - lctid: "wupinLC", - id: "******", - isfirstv: "1", - revisionoid: "3EFB6B91-E320-58DD-8402-956E9D416D2C", - checkouttime: "", - btmname: "wupin", - codeclsfid: "4524E801-6CC6-92E8-1AC3-2AB9604E8F96", - revisionvalue: "1", - secretgradeText: "鏅�氬晢瀵�", - name: "", - secretgrade: "2", - isfirstr: "1", - xinghaoguige: "", - materialname: "test12", - codetemplateoid: "78B8C7C5-A042-0B96-FE6D-65421451782A", - description: "", - oid: "0B6D7C29-DE6A-9D81-BC11-EB39D454877F", - thrifl: "", - revisionrule: "numberversionrule", - lcstatus_text: "缂栬緫涓�", - oldcode: "223", - hesuanfenleiname: "", - codeclsfpath: - "D9CF223F-317D-71EB-BD11-433A94CAD9F3##535FC9B6-FE27-241F-5FCA-ED4DC17CF95B##8EB35A1D-AB8B-2255-565C-84D309E0C62B##4524E801-6CC6-92E8-1AC3-2AB9604E8F96", - owner: "1", - xiaoshouwl: "false", - checkoutby: "", - creator: "1(涓氬姟娴嬭瘯)", - createtime: "2023-04-12 21:16:24.964", - tuhao: "yy002", - beizhushuoming: "", - versionrule: "0", - jiliangdw: "涓�", - islastr: "1", - copyfromversion: "", - materialclassify: "", - lastmodifytime: "2023-04-12 21:16:24.964", - nameoid: "3B3C476A-74E2-FF4A-7228-01D1F1EA18B8", - lcstatus: "Editing", - islastv: "1", - checkintime: "", - ts: "2023-04-12 21:16:24.964", - }, - { - lastmodifier: "1(涓氬姟娴嬭瘯)", - revisionseq: "1", - versionvalue: "1", - secondfl: "", - versionseq: "1", - checkinby: "", - firstfl: "", - jiliangdwname: "", - materialtype: "1001", - materialtypeText: "鏉愭枡", - chukufangshi: "鍏堣繘鍏堝嚭", - hesuanfenlei: "", - lctid: "wupinLC", - id: "******", - isfirstv: "1", - revisionoid: "F3EB357A-1285-6BED-105E-4E4F1230CB76", - checkouttime: "", - btmname: "wupin", - codeclsfid: "4524E801-6CC6-92E8-1AC3-2AB9604E8F96", - revisionvalue: "1", - secretgradeText: "鏅�氬晢瀵�", - name: "", - secretgrade: "2", - isfirstr: "1", - xinghaoguige: "", - materialname: "test12", - codetemplateoid: "78B8C7C5-A042-0B96-FE6D-65421451782A", - description: "", - oid: "247CF179-AA18-E636-F66E-054BF1A4A03C", - thrifl: "", - revisionrule: "numberversionrule", - lcstatus_text: "缂栬緫涓�", - oldcode: "223", - hesuanfenleiname: "", - codeclsfpath: - "D9CF223F-317D-71EB-BD11-433A94CAD9F3##535FC9B6-FE27-241F-5FCA-ED4DC17CF95B##8EB35A1D-AB8B-2255-565C-84D309E0C62B##4524E801-6CC6-92E8-1AC3-2AB9604E8F96", - owner: "1", - xiaoshouwl: "false", - checkoutby: "", - creator: "1(涓氬姟娴嬭瘯)", - createtime: "2023-04-12 20:28:37.591", - tuhao: "yy002", - beizhushuoming: "", - versionrule: "0", - jiliangdw: "涓�", - islastr: "1", - copyfromversion: "", - materialclassify: "", - lastmodifytime: "2023-04-12 20:28:37.591", - nameoid: "F95AF399-F100-8CD0-F944-DE528F8DFC93", - lcstatus: "Editing", - islastv: "1", - checkintime: "", - ts: "2023-04-12 20:28:37.591", - }, - { - lastmodifier: "1(涓氬姟娴嬭瘯)", - revisionseq: "1", - versionvalue: "1", - secondfl: "", - versionseq: "1", - checkinby: "", - firstfl: "", - jiliangdwname: "", - materialtype: "1001", - materialtypeText: "鏉愭枡", - chukufangshi: "鍏堣繘鍏堝嚭", - hesuanfenlei: "", - lctid: "wupinLC", - id: "******", - isfirstv: "1", - revisionoid: "610F9365-8E6E-699F-07A0-BC35601BD952", - checkouttime: "", - btmname: "wupin", - codeclsfid: "4524E801-6CC6-92E8-1AC3-2AB9604E8F96", - revisionvalue: "1", - secretgradeText: "鏅�氬晢瀵�", - name: "", - secretgrade: "2", - isfirstr: "1", - xinghaoguige: "", - materialname: "test12", - codetemplateoid: "78B8C7C5-A042-0B96-FE6D-65421451782A", - description: "", - oid: "9DBE4C77-D0E6-4326-621D-EA9AACD86AD4", - thrifl: "", - revisionrule: "numberversionrule", - lcstatus_text: "缂栬緫涓�", - oldcode: "223", - hesuanfenleiname: "", - codeclsfpath: - "D9CF223F-317D-71EB-BD11-433A94CAD9F3##535FC9B6-FE27-241F-5FCA-ED4DC17CF95B##8EB35A1D-AB8B-2255-565C-84D309E0C62B##4524E801-6CC6-92E8-1AC3-2AB9604E8F96", - owner: "1", - xiaoshouwl: "false", - checkoutby: "", - creator: "1(涓氬姟娴嬭瘯)", - createtime: "2023-04-12 20:27:05.35", - tuhao: "yy002", - beizhushuoming: "", - versionrule: "0", - jiliangdw: "涓�", - islastr: "1", - copyfromversion: "", - materialclassify: "", - lastmodifytime: "2023-04-12 20:27:05.35", - nameoid: "B1B51981-A1D9-20A0-F974-5A61C1B9F3FF", - lcstatus: "Editing", - islastv: "1", - checkintime: "", - ts: "2023-04-12 20:27:05.35", - }, - { - lastmodifier: "1(涓氬姟娴嬭瘯)", - revisionseq: "1", - versionvalue: "1", - secondfl: "", - versionseq: "1", - checkinby: "", - firstfl: "", - jiliangdwname: "", - materialtype: "1001", - materialtypeText: "鏉愭枡", - chukufangshi: "鍏堣繘鍏堝嚭", - hesuanfenlei: "", - lctid: "wupinLC", - id: "******", - isfirstv: "1", - revisionoid: "7AF39DAB-A6EA-C0E0-303F-BD8B493553AE", - checkouttime: "", - btmname: "wupin", - codeclsfid: "4524E801-6CC6-92E8-1AC3-2AB9604E8F96", - revisionvalue: "1", - secretgradeText: "鏅�氬晢瀵�", - name: "", - secretgrade: "2", - isfirstr: "1", - xinghaoguige: "", - materialname: "test12", - codetemplateoid: "78B8C7C5-A042-0B96-FE6D-65421451782A", - description: "", - oid: "CD5EF43C-41E5-A0AC-42B1-BBEE6535AE1C", - thrifl: "", - revisionrule: "numberversionrule", - lcstatus_text: "缂栬緫涓�", - oldcode: "223", - hesuanfenleiname: "", - codeclsfpath: - "D9CF223F-317D-71EB-BD11-433A94CAD9F3##535FC9B6-FE27-241F-5FCA-ED4DC17CF95B##8EB35A1D-AB8B-2255-565C-84D309E0C62B##4524E801-6CC6-92E8-1AC3-2AB9604E8F96", - owner: "1", - xiaoshouwl: "false", - checkoutby: "", - creator: "1(涓氬姟娴嬭瘯)", - createtime: "2023-04-12 20:25:28.642", - tuhao: "yy002", - beizhushuoming: "", - versionrule: "0", - jiliangdw: "涓�", - islastr: "1", - copyfromversion: "", - materialclassify: "", - lastmodifytime: "2023-04-12 20:25:28.642", - nameoid: "9BC308A8-35D7-49FD-4E49-B93CB21E22A3", - lcstatus: "Editing", - islastv: "1", - checkintime: "", - ts: "2023-04-12 20:25:28.642", - }, - ], - loading: false, - templateOid: "", - codeClassifyOid: "", - }; - }, - methods: { - findLinkClick(data) { - this.visible = true; - // findLike(data).then((res) => { - // this.tableData = res.data.data - // }); - }, - openFormTemlpate(row) { - this.codetemplateoid = row.codetemplateoid; - this.codeClassifyOid = row.codeclsfid; - this.templateVisible = true; - }, - }, -}; -</script> - -<style lang="less" scoped></style> diff --git a/Source/UBCS-WEB/src/components/FormTemplate/FormTempalte.vue b/Source/UBCS-WEB/src/components/FormTemplate/FormTempalte.vue new file mode 100644 index 0000000..b827c1f --- /dev/null +++ b/Source/UBCS-WEB/src/components/FormTemplate/FormTempalte.vue @@ -0,0 +1,762 @@ +<template> + <avue-form v-model="form" :option="option" v-loading="loading" ref="form"> + <template :slot="item.prop + 'Label'" v-for="item in option.column"> + <span> + <span>{{ item.label }} </span> + <el-tooltip + v-if="item.keyAttr" + class="item" + effect="dark" + content="璇ュ睘鎬т负鍏抽敭灞炴��" + placement="top-start" + > + <i class="el-icon-star-on key_attr_icon"></i> + </el-tooltip> + </span> + </template> + </avue-form> +</template> + +<script> +import { getFormTemplate } from "@/api/formTemplate"; +import { getDictionary } from "../../api/system/dict"; +export default { + name: "FormTemplate", + props: { + disabledProp: { + type: Array, + default: () => ["id"], + }, + templateOid: { + type: String, + default: "", + }, + codeClassifyOid: { + type: String, + default: "", + }, + editForm: { + type: Object, + default: () => ({}), + }, + type: { + type: String, + default: "add", + }, + dialogOpen: { + type: Boolean, + default: false, + }, + selfColumnType: { + type: Object, + default: () => ({}), + }, + selfColumnConfig: { + type: Object, + default: () => ({}), + }, + }, + data() { + return { + formIndex: 0, + form: {}, + option: { + emptyBtn: false, + submitBtn: false, + labelWidth: "130", + column: [], + group: [], + }, + loading: false, + templateData: {}, + columnType: { + text: "input", + combox: "select", + truefalse: "switch", + number: "number", + textarea: "textarea", + datetime: "datetime", + date: "date", + }, + // 鍋囨暟鎹� + testItems: [ + { + comboxKey: null, + customClass: null, + data: null, + dateFormate: "", + defaultValue: "", + displayExtension: null, + extendAttrMap: null, + extendAttrString: null, + field: "id", + hidden: false, + keyAttr: false, + prefix: "", + readOnly: false, + referConfig: null, + required: false, + selectLibFlag: "", + showField: null, + suffix: "", + text: "浼犲�肩鐢ㄥ姛鑳�", + tooltips: "", + type: "combox", + unique: false, + verify: "", + }, + { + customClass: null, + data: null, + dateFormate: "", + defaultValue: "", + displayExtension: null, + extendAttrMap: null, + extendAttrString: null, + field: "state", + hidden: false, + keyAttr: false, + prefix: "", + readOnly: true, + referConfig: null, + required: false, + selectLibFlag: "", + showField: null, + suffix: "", + text: "鎺ュ彛绂佺敤鍔熻兘", + tooltips: "", + type: "combox", + unique: false, + verify: "", + }, + { + comboxKey: null, + customClass: null, + data: null, + dateFormate: "", + defaultValue: "", + displayExtension: null, + extendAttrMap: null, + extendAttrString: null, + field: "oldcode", + hidden: false, + keyAttr: false, + prefix: "el-icon-search", + readOnly: false, + referConfig: null, + required: false, + selectLibFlag: "", + showField: null, + suffix: "鏂囨湰鍚庣紑娴嬭瘯", + text: "鍓嶅悗缂�鍔熻兘", + tooltips: "", + type: "text", + unique: false, + verify: "", + }, + { + comboxKey: null, + customClass: null, + data: null, + dateFormate: "", + defaultValue: "", + displayExtension: null, + extendAttrMap: null, + extendAttrString: null, + field: "materialname", + hidden: false, + keyAttr: false, + prefix: "", + readOnly: false, + referConfig: null, + required: true, + selectLibFlag: "", + showField: null, + suffix: "", + text: "姝e垯鏍¢獙鍔熻兘", + tooltips: "璇疯緭鍏ユ暟瀛�", + type: "text", + unique: false, + verify: "/[0-9]/", + }, + { + comboxKey: null, + customClass: null, + data: [ + { + attributes: {}, + key: "model_type", + value: "妯″瀷", + }, + { + attributes: {}, + key: "part_type", + value: "闆朵欢", + }, + ], + dateFormate: "", + defaultValue: "", + displayExtension: null, + extendAttrMap: null, + extendAttrString: null, + field: "dataSelect", + hidden: false, + keyAttr: false, + prefix: "", + readOnly: false, + referConfig: null, + required: false, + selectLibFlag: "", + showField: null, + suffix: "", + text: "鐩存帴杩斿洖涓嬫媺", + tooltips: "", + type: "combox", + unique: false, + verify: "", + }, + { + comboxKey: "formTemplateTest", + customClass: null, + data: [], + dateFormate: "", + defaultValue: "", + displayExtension: null, + extendAttrMap: null, + extendAttrString: null, + field: "dictSelect", + hidden: false, + keyAttr: false, + prefix: "", + readOnly: false, + referConfig: null, + required: false, + selectLibFlag: "", + showField: null, + suffix: "", + text: "瀛楀吀杩斿洖涓嬫媺", + tooltips: "", + type: "combox", + unique: false, + verify: "", + }, + { + comboxKey: null, + customClass: null, + data: null, + dateFormate: "", + defaultValue: "", + displayExtension: null, + extendAttrMap: null, + extendAttrString: null, + field: "firstfl", + hidden: false, + keyAttr: false, + prefix: "", + readOnly: false, + referConfig: null, + required: false, + selectLibFlag: "", + showField: null, + suffix: "", + text: "鏁板瓧杈撳叆妗�", + tooltips: "", + type: "number", + unique: false, + verify: "", + }, + { + comboxKey: null, + customClass: null, + data: null, + dateFormate: "yyyy-MM-dd HH:mm:ss", + defaultValue: "", + displayExtension: null, + extendAttrMap: null, + extendAttrString: null, + field: "datetime", + hidden: false, + keyAttr: false, + prefix: "", + readOnly: false, + referConfig: null, + required: false, + selectLibFlag: "", + showField: null, + suffix: "", + text: "鏃ユ湡鏃堕棿閫夋嫨鍣�", + tooltips: "", + type: "datetime", + unique: false, + verify: "", + }, + { + comboxKey: null, + customClass: null, + data: null, + dateFormate: "", + defaultValue: "", + displayExtension: null, + extendAttrMap: null, + extendAttrString: null, + field: "time", + hidden: false, + keyAttr: false, + prefix: "", + readOnly: false, + referConfig: null, + required: false, + selectLibFlag: "", + showField: null, + suffix: "", + text: "鏃堕棿閫夋嫨鍣�", + tooltips: "", + type: "date", + unique: false, + verify: "", + }, + { + comboxKey: null, + customClass: null, + data: null, + dateFormate: "", + defaultValue: "false", + displayExtension: null, + extendAttrMap: null, + extendAttrString: null, + field: "xiaoshouwl", + hidden: false, + keyAttr: false, + prefix: "", + readOnly: false, + referConfig: null, + required: false, + selectLibFlag: "", + showField: null, + suffix: "", + text: "寮�鍏�", + tooltips: "", + type: "truefalse", + unique: false, + verify: "", + }, + { + comboxKey: null, + customClass: null, + data: null, + dateFormate: "", + defaultValue: "鎴戞槸榛樿鍊�", + displayExtension: null, + extendAttrMap: null, + extendAttrString: null, + field: "tuhao", + hidden: false, + keyAttr: false, + prefix: "", + readOnly: false, + referConfig: null, + required: false, + selectLibFlag: "", + showField: null, + suffix: "", + text: "榛樿鍊煎姛鑳�", + tooltips: "鎻愮ず", + type: "text", + unique: false, + verify: "", + }, + { + comboxKey: null, + customClass: null, + data: null, + dateFormate: "", + defaultValue: "", + displayExtension: null, + extendAttrMap: null, + extendAttrString: null, + field: "xinghaoguige", + hidden: false, + keyAttr: true, + prefix: "", + readOnly: false, + referConfig: null, + required: false, + selectLibFlag: "", + showField: null, + suffix: "", + text: "灞炴�у叧閿��", + tooltips: "", + type: "text", + unique: false, + verify: "", + }, + { + comboxKey: null, + customClass: null, + data: null, + dateFormate: "", + defaultValue: "", + displayExtension: null, + extendAttrMap: null, + extendAttrString: null, + field: "jiliangdw", + hidden: false, + keyAttr: false, + prefix: "", + readOnly: false, + tip: "鎴戞槸鎻愮ず鍔熻兘", + required: false, + selectLibFlag: "", + showField: "jiliangdwname", + suffix: "", + text: "鎻愮ず鍔熻兘", + tooltips: "", + type: "text", + unique: false, + verify: "", + }, + { + comboxKey: null, + customClass: null, + data: null, + dateFormate: "", + defaultValue: "", + displayExtension: "this.form.sum = this.form.fun1 + this.form.fun2", + extendAttrMap: null, + extendAttrString: null, + field: "fun1", + hidden: false, + keyAttr: false, + prefix: "", + readOnly: false, + referConfig: null, + required: false, + selectLibFlag: "", + showField: null, + suffix: "", + text: "鍙傛暟1娴嬭瘯js", + tooltips: "", + type: "text", + unique: false, + verify: "", + }, + { + comboxKey: null, + customClass: null, + data: null, + dateFormate: "", + defaultValue: "", + displayExtension: "this.form.sum = this.form.fun1 + this.form.fun2", + extendAttrMap: null, + extendAttrString: null, + field: "fun2", + hidden: false, + keyAttr: false, + prefix: "", + readOnly: false, + required: false, + selectLibFlag: "", + showField: "hesuanfenleiname", + suffix: "", + text: "鍙傛暟2娴嬭瘯js", + tooltips: "", + type: "text", + unique: false, + verify: "", + }, + { + comboxKey: null, + customClass: null, + data: null, + dateFormate: "", + defaultValue: "", + displayExtension: "", + extendAttrMap: null, + extendAttrString: null, + field: "sum", + hidden: false, + keyAttr: false, + prefix: "", + readOnly: true, + required: false, + selectLibFlag: "", + showField: "", + suffix: "", + text: "鍙傛暟1鍙傛暟2姹傚拰", + tooltips: "", + type: "text", + unique: false, + verify: "", + }, + { + comboxKey: null, + customClass: null, + data: null, + dateFormate: "", + defaultValue: "", + displayExtension: null, + extendAttrMap: null, + extendAttrString: null, + field: "textarea", + hidden: false, + keyAttr: false, + prefix: "", + readOnly: false, + referConfig: null, + required: false, + selectLibFlag: "", + showField: null, + suffix: "", + text: "鏂囨湰鍩�", + tooltips: "", + type: "textarea", + unique: false, + verify: "", + }, + { + comboxKey: null, + customClass: null, + data: null, + dateFormate: "", + defaultValue: "", + displayExtension: null, + extendAttrMap: null, + extendAttrString: null, + field: "cz", + hidden: false, + keyAttr: false, + prefix: "", + readOnly: true, + referConfig: true, + required: false, + selectLibFlag: "", + showField: "depId", + suffix: "", + text: "鍙傜収", + tooltips: "", + type: "text", + unique: false, + verify: "", + }, + ], + trendsSpan: 8, + defaultValue: {}, + // 琛ㄥ崟灞炴�� + attributes: [], + // 琛ㄥ崟鍏冪礌 + items: [], + }; + }, + mounted() { + this.handleResize(); + }, + methods: { + getFormTemplate() { + this.loading = true; + getFormTemplate({ + templateOid: this.templateOid, + codeClassifyOid: this.codeClassifyOid, + }) + .then((res) => { + if (res.status === 200) { + this.templateData = res.data; + // 琛ㄥ崟鍏冪礌锛堣繃婊ら渶瑕侀殣钘忕殑灞炴�э級 + this.items = res.data.formDefineVO.items; + this.templateRender(); + this.$emit("getFormTemplateEnd", res.data); + } + this.loading = false; + }) + .catch((err) => { + this.loading = false; + console.log(err); + }); + }, + templateRender() { + // 鏃犻渶鍒嗙粍鏁版嵁 + let column = []; + let group = []; + let dictKeys = []; + this.items.forEach((formItem) => { + if (formItem.type === "line") { + group.push({ + label: formItem.text, + prop: formItem.text, + collapse: true, + column: [], + }); + } + if ( + formItem.type === "combox" && + formItem.comboxKey && + (!Array.isArray(formItem.dicData) || formItem.dicData.length === 0) + ) { + dictKeys.push({ dictKey: formItem.comboxKey, field: formItem.field }); + } + // 绂佺敤閮ㄥ垎灞炴�э紙澶栭儴浼犲�肩鐢ㄥ拰鍙傜収绂佺敤锛� + if ( + this.disabledProp.includes(formItem.field) || + this.$utilFunc.isValuableObj(formItem.referConfig) + ) { + formItem.readOnly = true; + } + // 璁剧疆琛ㄥ崟鏍¢獙鐨勮鍒欙紝鏂囨湰 + let message = "璇烽�夋嫨"; + let trigger = "change"; + if (formItem.type === "text") { + message = "璇疯緭鍏�"; + trigger = "blur"; + } else if (formItem.type === "file") { + message = "璇蜂笂浼�"; + } + let columnItem = { + label: formItem.text, + labelslot: true, + prop: this.$utilFunc.isValuableObj(formItem.referConfig) + ? formItem.showField || formItem.field + : formItem.field, + field: formItem.field, + type: this.columnType[formItem.type], + dicData: this.getDataList(formItem.type, formItem.data), + disabled: this.type === "detail" ? true : formItem.readOnly, + prepend: this.preOrSufFixShow("text", formItem.prefix), + append: this.preOrSufFixShow("text", formItem.suffix), + prefixIcon: this.preOrSufFixShow("icon", formItem.prefix), + suffixIcon: this.preOrSufFixShow("icon", formItem.suffix), + valueFormat: formItem.dateFormate, + format: formItem.dateFormate, + keyAttr: formItem.keyAttr, + value: formItem.defaultValue, + tip: formItem.tooltips, + tipPlacement: "right", + comboxKey: formItem.comboxKey, + display: !formItem.hidden, + filterable: true, + change: () => { + this.changeFun(formItem.displayExtension, formItem.prop); + }, + span: formItem.type === "textarea" ? 24 : this.trendsSpan, + click: this.clickFun(formItem.referConfig), + rules: [ + { + required: formItem.required, + message: `璇�${message}${formItem.text}`, + trigger, + }, + { + // 濡傛灉娌℃湁姝e垯鍒欏尮閰嶄换浣曞瓧绗� + pattern: formItem.verify ? formItem.verify : /[\s\S.]*/g, + message: formItem.tooltips, + trigger, + }, + ], + props: { + label: "value", + value: "key", + }, + }; + columnItem = this.resetFormConfig(columnItem); + if (group.length === 0) { + column.push(columnItem); + } else { + group[group.length - 1]["column"].push(columnItem); + } + }); + this.$set(this.option, "column", column); + this.$set(this.option, "group", group); + this.formIndex++; + this.geDictData(dictKeys); + }, + // 浣跨敤浼犲叆鐨勮〃鍗曟暟鎹厤缃� + resetFormConfig(formItem) { + for (const key in this.selfColumnConfig) { + if (Object.hasOwnProperty.call(this.selfColumnConfig, key)) { + const element = this.selfColumnConfig[key]; + formItem[key] = element; + } + } + return formItem; + }, + handleResize() { + let windowWidth = document.body.clientWidth; + this.trendsSpan = 24 / Math.floor(windowWidth / 500); + this.formIndex++; + }, + // 鍓嶅悗缂� + preOrSufFixShow(type, val) { + if (this.$utilFunc.isEmpty(val) && typeof val !== "string") return; + const isIcon = val.slice(0, 8) === "el-icon-"; + if ((type === "text" && !isIcon) || (type === "icon" && isIcon)) { + return val; + } + }, + changeFun(displayExtension, prop) { + // executeCode({displayExtension, data: this.form}).then(res => { + // this.form[prop] = res.data.data + // }) + }, + clickFun(referConfig) { + if (this.type === "detail") { + return; + } + }, + // 鑾峰彇swich鍜屽凡鎷垮埌鐨勪笅鎷夋暟鎹� + getDataList(type, dicData) { + if (type === "truefalse") { + return [ + { + key: false, + value: "鍚�", + }, + { + key: true, + value: "鏄�", + }, + ]; + } else if (type === "combox") { + return dicData; + } + return []; + }, + // 鑾峰彇瀛楀吀鏁版嵁 + geDictData(dictKeys) { + dictKeys.forEach((dictObj) => { + getDictionary({ code: dictObj.dictKey }).then((res) => { + if (res.data && res.data.code === 200) { + this.option.column = this.option.column.map((item) => { + if (item.field === dictObj.field) { + let dictData = (res.data.data || []).map((itm) => { + itm.value = itm.dictValue; + itm.key = itm.dictKey; + return itm; + }); + item.dicData = dictData; + } + return item; + }); + } + }); + }); + }, + }, + watch: { + dialogOpen: { + immediate: true, + handler(newV) { + if (newV) { + this.getFormTemplate(); + } + }, + }, + form: { + deep: true, + immediate: true, + handler(newV) { + this.$emit("getFormData", newV); + }, + }, + }, +}; +</script> + +<style lang="less" scoped></style> diff --git a/Source/UBCS-WEB/src/components/FormTemplate/ResembleQuery.vue b/Source/UBCS-WEB/src/components/FormTemplate/ResembleQuery.vue new file mode 100644 index 0000000..894b3c0 --- /dev/null +++ b/Source/UBCS-WEB/src/components/FormTemplate/ResembleQuery.vue @@ -0,0 +1,184 @@ +<template> + <div> + <el-table :data="tableData" v-loading="loading" height="250" :border="true"> + <el-table-column + type="index" + width="60" + label="搴忓彿" + align="center" + ></el-table-column> + <el-table-column + v-for="item in column[0]" + :key="item.field" + :prop="item.field" + :label="item.title" + :min-width="item.width" + align="center" + > + <template #default="{ row }" v-if="item.field === 'id'"> + <el-button type="text" @click="openFormTemlpate(row)">{{ + row.id + }}</el-button> + </template> + <template #default="{ row }" v-else> + <span>{{ row[item.field] }}</span> + </template> + </el-table-column> + </el-table> + <FormTemplate + ref="FormTemplate" + type="detail" + :visible.sync="formTemplateVisible" + :templateOid="this.resembleTemplateOid" + :codeClassifyOid="this.resembleCodeClassifyOid" + ></FormTemplate> + </div> +</template> + +<script> +import { findLike } from "@/api/formTemplate.js"; + +export default { + name: "ResembleQuery", + props: { + column: { + type: Array, + default: () => [], + }, + codeClassifyOid: { + type: String, + default: "", + }, + templateOid: { + type: String, + default: "", + }, + hasResemble: { + type: Boolean, + default: false, + }, + type: { + type: String, + default: "add", + }, + form: { + type: Object, + default: () => ({}), + }, + codeRuleOid: { + type: String, + default: '' + } + }, + data() { + return { + tableVisible: true, + formTemplateVisible: false, + activeName: "findlike", + tableData: [], + loading: false, + resembleTemplateOid: "78B8C7C5-A042-0B96-FE6D-65421451782A", + resembleCodeClassifyOid: "4524E801-6CC6-92E8-1AC3-2AB9604E8F96", + defaultValue: {}, + secVOList: [], + defaultKeys: [ + "oid", + "id", + "name", + "description", + "revisionoid", + "nameoid", + "btmname", + "lastr", + "firstr", + "lastv", + "firstv", + "creator", + "createtime", + "lastModifier", + "lastmodifytime", + "revisionrule", + "revisionseq", + "revisionvalue", + "versionrule", + "versionseq", + "versionvalue", + "lcstatus", + "ts", + "owner", + "checkinby", + "checkintime", + "checkoutby", + "checkouttime", + "copyfromversion", + "secretgrade", + ], + formItems: [], + }; + }, + created() { + this.getCodeRule(); + }, + computed: { + showCodeOrder() { + if (this.type === "add") { + if (this.secVOList.length == 0 && this.hasResemble) { + return false; + } + } else { + if (this.hasResemble) { + return false; + } + } + return true; + }, + }, + methods: { + // 鐩镐技椤规煡璇� + resembleQuery(form) { + this.loading = true; + this.activeName = "findlike"; + const { defaultValue, formValue } = this.getDefaultValueAndFormValues(form); + let params = { + codeClassifyOid: this.codeClassifyOid, + codeRuleOid: this.codeRuleOid, + templateOid: this.templateOid, + data: formValue, + }; + params = Object.assign(params, defaultValue); + this.tableVisible = true; + findLike(params).then((res) => { + this.loading = false; + this.tableData = res.data.data || []; + }); + }, + + openFormTemlpate(row) { + this.$nextTick(() => { + console.log(this.$refs.FormTemplate); + }); + this.codetemplateoid = row.codetemplateoid; + this.formTemplateVisible = true; + }, + getDefaultValueAndFormValues(form) { + let defaultValue = {}; + let formValue = {}; + for (const key in form) { + if (Object.hasOwnProperty.call(form, key)) { + const element = form[key]; + if (this.defaultKeys.includes(key)) { + defaultValue[key] = element; + } else { + formValue[key] = element; + } + } + } + return { + defaultValue, + formValue, + }; + }, + }, + +}; +</script> \ No newline at end of file diff --git a/Source/UBCS-WEB/src/components/FormTemplate/index.vue b/Source/UBCS-WEB/src/components/FormTemplate/index.vue index 189b7b1..8a1c2d1 100644 --- a/Source/UBCS-WEB/src/components/FormTemplate/index.vue +++ b/Source/UBCS-WEB/src/components/FormTemplate/index.vue @@ -5,569 +5,82 @@ top="0vh" :title="title" class="avue-dialog avue-dialog--top" - :width="dialogOptions.width" + :width="width" append-to-body - v-if="dialogVisible" > - <avue-form - v-model="form" - :option="option" - v-loading="loading" - ref="form" - :key="index" - > - <template :slot="item.prop + 'Label'" v-for="item in option.column"> - <span> - <span>{{ item.label }} </span> - <el-tooltip - v-if="item.keyAttr" - class="item" - effect="dark" - content="璇ュ睘鎬т负鍏抽敭灞炴��" - placement="top-start" - > - <i class="el-icon-star-on key_attr_icon"></i> - </el-tooltip> - <el-tooltip - v-if="item.tip" - class="item" - effect="dark" - :content="item.tip" - placement="top-start" - > - <i class="el-icon-warning"></i> - </el-tooltip> - </span> - </template> - </avue-form> - <FindLike ref="findLike"></FindLike> + <FormTempalte + v-bind="$attrs" + :dialogOpen="visible" + :type="type" + @getFormTemplateEnd="getFormTemplate" + @getFormData="getFormData" + ></FormTempalte> + + <div class="tab_box"> + <el-tabs v-model="activeName" type="card"> + <el-tab-pane label="鐮佸�肩敵璇�" name="codeApply" v-if="showCodeApply"> + <CodeApply v-bind="$attrs"></CodeApply> + </el-tab-pane> + <el-tab-pane + label="鐩镐技椤规煡璇�" + name="resembleQuery" + v-if="showResembleQuery" + > + <ResembleQuery + v-bind="$attrs" + ref="resembleQueryRef" + :hasResemble="this.hasResemble" + :column="this.resembleTableColumn" + :form="this.form" + ></ResembleQuery> + </el-tab-pane> + </el-tabs> + </div> <div class="avue-dialog__footer" v-if="type !== 'detail'"> <el-button @click="close()">鍙� 娑�</el-button> - <el-button @click="close()" type="primary" :loading="submitBtnLoading">纭� 瀹�</el-button> - <el-button @click="findLinkSubmit" type="primary">鐩镐技鍍忔煡璇�</el-button> + <el-button @click="close()" type="primary" :loading="submitBtnLoading" + >纭� 瀹�</el-button + > + <el-button @click="resembleQuerySubmit" type="primary" v-if="hasResemble" + >鐩镐技鍍忔煡璇�</el-button + > </div> </el-dialog> </template> <script> -import { getFormTemplate, executeCode, findLike } from "@/api/formTemplate"; -import { getDictionary } from "../../api/system/dict"; -import FindLike from "./FindLike.vue"; +import FormTempalte from "./FormTempalte"; +import ResembleQuery from "./ResembleQuery"; +import CodeApply from "./CodeApply"; export default { - name: "FormTemplate", - components: { FindLike }, + name: "FormTemplateDialog", + components: { ResembleQuery, FormTempalte, CodeApply }, props: { visible: { type: Boolean, default: false, }, - disabledProp: { - type: Array, - default: () => ["id"], - }, - templateOid: { - type: String, - default: "", - }, - codeClassifyOid: { - type: String, - default: "", - }, type: { type: String, - default: 'add' + default: "add", }, title: { type: String, - default: '琛ㄥ崟妯℃澘' - } + default: "琛ㄥ崟妯℃澘", + }, + width: { + type: String, + default: "80%", + }, }, data() { return { - index: 0, - form: {}, loading: false, - dialogOptions: { - width: "60%", - }, - option: { - emptyBtn: false, - submitBtn: false, - labelWidth: "120", - column: [], - }, - templateData: {}, - columnType: { - text: "input", - combox: "select", - truefalse: "switch", - number: "number", - textarea: "textarea", - datetime: "datetime", - date: "date" - }, - // 鍋囨暟鎹� - testItems: [ - { - comboxKey: null, - customClass: null, - data: null, - dateFormate: "", - defaultValue: "", - displayExtension: null, - extendAttrMap: null, - extendAttrString: null, - field: "id", - hidden: false, - keyAttr: false, - prefix: "", - readOnly: false, - referConfig: null, - required: false, - selectLibFlag: "", - showField: null, - suffix: "", - text: "浼犲�肩鐢ㄥ姛鑳�", - tooltips: "", - type: "combox", - unique: false, - verify: "", - }, - { - customClass: null, - data: null, - dateFormate: "", - defaultValue: "", - displayExtension: null, - extendAttrMap: null, - extendAttrString: null, - field: "state", - hidden: false, - keyAttr: false, - prefix: "", - readOnly: true, - referConfig: null, - required: false, - selectLibFlag: "", - showField: null, - suffix: "", - text: "鎺ュ彛绂佺敤鍔熻兘", - tooltips: "", - type: "combox", - unique: false, - verify: "", - }, - { - comboxKey: null, - customClass: null, - data: null, - dateFormate: "", - defaultValue: "", - displayExtension: null, - extendAttrMap: null, - extendAttrString: null, - field: "oldcode", - hidden: false, - keyAttr: false, - prefix: "el-icon-search", - readOnly: false, - referConfig: null, - required: false, - selectLibFlag: "", - showField: null, - suffix: "鏂囨湰鍚庣紑娴嬭瘯", - text: "鍓嶅悗缂�鍔熻兘", - tooltips: "", - type: "text", - unique: false, - verify: "", - }, - { - comboxKey: null, - customClass: null, - data: null, - dateFormate: "", - defaultValue: "", - displayExtension: null, - extendAttrMap: null, - extendAttrString: null, - field: "materialname", - hidden: false, - keyAttr: false, - prefix: "", - readOnly: false, - referConfig: null, - required: true, - selectLibFlag: "", - showField: null, - suffix: "", - text: "姝e垯鏍¢獙鍔熻兘", - tooltips: "璇疯緭鍏ユ暟瀛�", - type: "text", - unique: false, - verify: "/[0-9]/", - }, - { - comboxKey: null, - customClass: null, - data: [ - { - attributes: {}, - key: "model_type", - value: "妯″瀷", - }, - { - attributes: {}, - key: "part_type", - value: "闆朵欢", - }, - ], - dateFormate: "", - defaultValue: "", - displayExtension: null, - extendAttrMap: null, - extendAttrString: null, - field: "dataSelect", - hidden: false, - keyAttr: false, - prefix: "", - readOnly: false, - referConfig: null, - required: false, - selectLibFlag: "", - showField: null, - suffix: "", - text: "鐩存帴杩斿洖涓嬫媺", - tooltips: "", - type: "combox", - unique: false, - verify: "", - }, - { - comboxKey: "formTemplateTest", - customClass: null, - data: [], - dateFormate: "", - defaultValue: "", - displayExtension: null, - extendAttrMap: null, - extendAttrString: null, - field: "dictSelect", - hidden: false, - keyAttr: false, - prefix: "", - readOnly: false, - referConfig: null, - required: false, - selectLibFlag: "", - showField: null, - suffix: "", - text: "瀛楀吀杩斿洖涓嬫媺", - tooltips: "", - type: "combox", - unique: false, - verify: "", - }, - { - comboxKey: null, - customClass: null, - data: null, - dateFormate: "", - defaultValue: "", - displayExtension: null, - extendAttrMap: null, - extendAttrString: null, - field: "firstfl", - hidden: false, - keyAttr: false, - prefix: "", - readOnly: false, - referConfig: null, - required: false, - selectLibFlag: "", - showField: null, - suffix: "", - text: "鏁板瓧杈撳叆妗�", - tooltips: "", - type: "number", - unique: false, - verify: "", - }, - { - comboxKey: null, - customClass: null, - data: null, - dateFormate: "yyyy-MM-dd HH:mm:ss", - defaultValue: "", - displayExtension: null, - extendAttrMap: null, - extendAttrString: null, - field: "datetime", - hidden: false, - keyAttr: false, - prefix: "", - readOnly: false, - referConfig: null, - required: false, - selectLibFlag: "", - showField: null, - suffix: "", - text: "鏃ユ湡鏃堕棿閫夋嫨鍣�", - tooltips: "", - type: "datetime", - unique: false, - verify: "", - }, - { - comboxKey: null, - customClass: null, - data: null, - dateFormate: "", - defaultValue: "", - displayExtension: null, - extendAttrMap: null, - extendAttrString: null, - field: "time", - hidden: false, - keyAttr: false, - prefix: "", - readOnly: false, - referConfig: null, - required: false, - selectLibFlag: "", - showField: null, - suffix: "", - text: "鏃堕棿閫夋嫨鍣�", - tooltips: "", - type: "date", - unique: false, - verify: "", - }, - { - comboxKey: null, - customClass: null, - data: null, - dateFormate: "", - defaultValue: "false", - displayExtension: null, - extendAttrMap: null, - extendAttrString: null, - field: "xiaoshouwl", - hidden: false, - keyAttr: false, - prefix: "", - readOnly: false, - referConfig: null, - required: false, - selectLibFlag: "", - showField: null, - suffix: "", - text: "寮�鍏�", - tooltips: "", - type: "truefalse", - unique: false, - verify: "", - }, - { - comboxKey: null, - customClass: null, - data: null, - dateFormate: "", - defaultValue: "鎴戞槸榛樿鍊�", - displayExtension: null, - extendAttrMap: null, - extendAttrString: null, - field: "tuhao", - hidden: false, - keyAttr: false, - prefix: "", - readOnly: false, - referConfig: null, - required: false, - selectLibFlag: "", - showField: null, - suffix: "", - text: "榛樿鍊煎姛鑳�", - tooltips: "鎻愮ず", - type: "text", - unique: false, - verify: "", - }, - { - comboxKey: null, - customClass: null, - data: null, - dateFormate: "", - defaultValue: "", - displayExtension: null, - extendAttrMap: null, - extendAttrString: null, - field: "xinghaoguige", - hidden: false, - keyAttr: true, - prefix: "", - readOnly: false, - referConfig: null, - required: false, - selectLibFlag: "", - showField: null, - suffix: "", - text: "灞炴�у叧閿��", - tooltips: "", - type: "text", - unique: false, - verify: "", - }, - { - comboxKey: null, - customClass: null, - data: null, - dateFormate: "", - defaultValue: "", - displayExtension: null, - extendAttrMap: null, - extendAttrString: null, - field: "jiliangdw", - hidden: false, - keyAttr: false, - prefix: "", - readOnly: false, - tip: "鎴戞槸鎻愮ず鍔熻兘", - required: false, - selectLibFlag: "", - showField: "jiliangdwname", - suffix: "", - text: "鎻愮ず鍔熻兘", - tooltips: "", - type: "text", - unique: false, - verify: "", - }, - { - comboxKey: null, - customClass: null, - data: null, - dateFormate: "", - defaultValue: "", - displayExtension: "this.form.sum = this.form.fun1 + this.form.fun2", - extendAttrMap: null, - extendAttrString: null, - field: "fun1", - hidden: false, - keyAttr: false, - prefix: "", - readOnly: false, - referConfig: null, - required: false, - selectLibFlag: "", - showField: null, - suffix: "", - text: "鍙傛暟1娴嬭瘯js", - tooltips: "", - type: "text", - unique: false, - verify: "", - }, - { - comboxKey: null, - customClass: null, - data: null, - dateFormate: "", - defaultValue: "", - displayExtension: "this.form.sum = this.form.fun1 + this.form.fun2", - extendAttrMap: null, - extendAttrString: null, - field: "fun2", - hidden: false, - keyAttr: false, - prefix: "", - readOnly: false, - required: false, - selectLibFlag: "", - showField: "hesuanfenleiname", - suffix: "", - text: "鍙傛暟2娴嬭瘯js", - tooltips: "", - type: "text", - unique: false, - verify: "", - }, - { - comboxKey: null, - customClass: null, - data: null, - dateFormate: "", - defaultValue: "", - displayExtension: "", - extendAttrMap: null, - extendAttrString: null, - field: "sum", - hidden: false, - keyAttr: false, - prefix: "", - readOnly: true, - required: false, - selectLibFlag: "", - showField: "", - suffix: "", - text: "鍙傛暟1鍙傛暟2姹傚拰", - tooltips: "", - type: "text", - unique: false, - verify: "", - }, - { - comboxKey: null, - customClass: null, - data: null, - dateFormate: "", - defaultValue: "", - displayExtension: null, - extendAttrMap: null, - extendAttrString: null, - field: "textarea", - hidden: false, - keyAttr: false, - prefix: "", - readOnly: false, - referConfig: null, - required: false, - selectLibFlag: "", - showField: null, - suffix: "", - text: "鏂囨湰鍩�", - tooltips: "", - type: "textarea", - unique: false, - verify: "", - }, - { - comboxKey: null, - customClass: null, - data: null, - dateFormate: "", - defaultValue: "", - displayExtension: null, - extendAttrMap: null, - extendAttrString: null, - field: "cz", - hidden: false, - keyAttr: false, - prefix: "", - readOnly: true, - referConfig: true, - required: false, - selectLibFlag: "", - showField: "depId", - suffix: "", - text: "鍙傜収", - tooltips: "", - type: "text", - unique: false, - verify: "", - }, - ], - submitBtnLoading: false + submitBtnLoading: false, + hasResemble: false, + resembleTableColumn: [], + activeName: "resembleQuery", + form: {} }; }, created() {}, @@ -580,170 +93,38 @@ this.$emit("update:visible", val); }, }, + showCodeApply() { + if (this.type === "add") { + if (this.hasResemble && this.resembleTableColumn.length === 0) { + return false; + } + } else { + if (this.hasResemble) { + return false; + } + } + return true; + }, + showResembleQuery() { + return this.hasResemble; + }, }, methods: { - getFormTemplate() { - this.loading = true; - getFormTemplate({ - templateOid: this.templateOid, - codeClassifyOid: this.codeClassifyOid, - }) - .then((res) => { - if (res.status === 200) { - this.templateData = res.data; - this.templateRender(); - } - this.loading = false; - console.log(res.data); - }) - .catch((err) => { - this.loading = false; - console.log(err); - }); + close() { + this.dialogVisible = false; }, - templateRender() { - const items = this.templateData.formDefineVO.items; - let column = []; - let dictKeys = []; - items.forEach((item) => { - // 闅愯棌琛ㄥ崟鍏冪礌 - if (item.hide) { - return; - } - if ( - item.type === "combox" && - item.comboxKey && - (!Array.isArray(item.dicData) || item.dicData.length === 0) - ) { - dictKeys.push({ dictKey: item.comboxKey, field: item.field }); - } - // 绂佺敤閮ㄥ垎灞炴�э紙澶栭儴浼犲�肩鐢ㄥ拰鍙傜収绂佺敤锛� - if (this.disabledProp.includes(item.field) || this.$utilFunc.isValuableObj(item.referConfig)) { - item.readOnly = true; - } - // 璁剧疆琛ㄥ崟鏍¢獙鐨勮鍒欙紝鏂囨湰 - let message = "璇烽�夋嫨"; - let trigger = "change"; - if (item.type === "text") { - message = "璇疯緭鍏�"; - trigger = "blur"; - } else if (item.type === "file") { - message = "璇蜂笂浼�"; - } - let columnItem = { - label: item.text, - labelslot: true, - prop: this.$utilFunc.isValuableObj(item.referConfig) ? (item.showField || item.field) : item.field, - type: this.columnType[item.type], - dicData: this.getDataList(item.type, item.data), - disabled: this.type === 'detail' ? true : item.readOnly, - prepend: this.preOrSufFixShow("text", item.prefix), - append: this.preOrSufFixShow("text", item.suffix), - prefixIcon: this.preOrSufFixShow("icon", item.prefix), - suffixIcon: this.preOrSufFixShow("icon", item.suffix), - valueFormat: item.dateFormate, - format: item.dateFormate, - keyAttr: item.keyAttr, - value: item.defaultValue, - tip: item.tip, - comboxKey: item.comboxKey, - change: () => { - this.changeFun(item.displayExtension, item.prop); - }, - span: item.type === "file" || item.type === "textarea" ? 24 : null, - click: this.clickFun(item.referConfig), - rules: [ - { - required: item.required, - message: `璇�${message}${item.text}`, - trigger, - }, - { - // 濡傛灉娌℃湁姝e垯鍒欏尮閰嶄换浣曞瓧绗� - pattern: item.verify ? item.verify : /[\s\S.]*/g, - message: item.tooltips, - trigger, - }, - ], - props: { - label: "value", - value: "key", - }, - }; - column.push(columnItem); - this.$set(this.option, "column", column); - }); - this.index++; - this.geDictData(dictKeys); + getFormTemplate(data) { + this.hasResemble = + data.resembleTableVO && + data.resembleTableVO.cols && + data.resembleTableVO.cols.length > 0; + this.resembleTableColumn = data.resembleTableVO.cols || []; }, - changeFun(displayExtension, prop) { - // executeCode({displayExtension, data: this.form}).then(res => { - // this.form[prop] = res.data.data - // }) + getFormData(form) { + this.form = form }, - clickFun(referConfig) { - if (this.type === 'detail') { - return - } - }, - // 鍓嶅悗缂� - preOrSufFixShow(type, val) { - if (this.$utilFunc.isEmpty(val) && typeof val !== "string") return; - const isIcon = val.slice(0, 8) === "el-icon-"; - if ((type === "text" && !isIcon) || (type === "icon" && isIcon)) { - return val; - } - }, - // 鑾峰彇swich鍜屽凡鎷垮埌鐨勪笅鎷夋暟鎹� - getDataList(type, dicData) { - if (type === "truefalse") { - return [ - { - key: false, - value: "鍚�", - }, - { - key: true, - value: "鏄�", - }, - ]; - } else if (type === "combox") { - return dicData; - } - return []; - }, - // 鑾峰彇瀛楀吀鏁版嵁 - geDictData(dictKeys) { - dictKeys.forEach((dictObj) => { - getDictionary({ code: dictObj.dictKey }).then((res) => { - if (res.data && res.data.code === 200) { - this.option.column = this.option.column.map((item) => { - if (item.field === dictObj.field) { - let dictData = (res.data.data || []).map((itm) => { - itm.value = itm.dictValue; - itm.key = itm.dictKey; - return itm; - }); - item.dicData = dictData; - } - return item; - }); - } - }); - }); - }, - findLinkSubmit() { - this.templateData.templateVO.data = this.form - console.log(this.$refs.findLike, 'this.$refs.findLike'); - this.$refs.findLike.findLinkClick(this.templateData.templateVO) - } - }, - watch: { - visible(newV) { - if (newV) { - this.getFormTemplate(); - // this.templateRender() - } + resembleQuerySubmit() { + this.$refs.resembleQueryRef.resembleQuery(this.form); }, }, }; diff --git a/Source/UBCS-WEB/src/main.js b/Source/UBCS-WEB/src/main.js index 3cf0e47..0ea5d3e 100644 --- a/Source/UBCS-WEB/src/main.js +++ b/Source/UBCS-WEB/src/main.js @@ -42,6 +42,7 @@ import businessAdd from "@/views/modeling/BusinessAdd" import TableCrud from "@/components/Crud/Crud" import originalAdd from "@/views/modeling/originalAdd" +import FormTemplateDialog from "@/components/FormTemplate/index" // 灏嗗伐鍏峰嚱鏁版坊鍔犲埌鍏ㄥ眬 import utilFunc from './util/func' @@ -85,7 +86,7 @@ Vue.component('attrCrud',attrCrud) Vue.component('TableCrud',TableCrud) Vue.component('originalAdd',originalAdd) - +Vue.component('FormTemplateDialog',FormTemplateDialog) // 鍔犺浇鐩稿叧url鍦板潃 Object.keys(urls).forEach(key => { diff --git a/Source/UBCS-WEB/src/views/MasterData/FormTempalteTest.vue b/Source/UBCS-WEB/src/views/MasterData/FormTempalteTest.vue index 0ab521c..7630e2b 100644 --- a/Source/UBCS-WEB/src/views/MasterData/FormTempalteTest.vue +++ b/Source/UBCS-WEB/src/views/MasterData/FormTempalteTest.vue @@ -1,18 +1,33 @@ <template> <div> <el-button @click="visible = true">娴嬭瘯</el-button> - <FormTemplate :visible.sync="visible" templateOid="78B8C7C5-A042-0B96-FE6D-65421451782A" codeClassifyOid="4524E801-6CC6-92E8-1AC3-2AB9604E8F96"></FormTemplate> + <FormTemplateDialog + :visible.sync="visible" + :FormTemplateProp="FormTemplateProp" + :type="this.type" + :editForm="editForm" + :templateOid="this.templateOid" + :codeClassifyOid="this.codeClassifyOid" + :disabledProp="disabledProp" + ></FormTemplateDialog> </div> -</template>codeClassifyOid +</template> +codeClassifyOid <script> -import FormTemplate from "../../components/FormTemplate/index"; export default { name: "FormTempalteTest", - components: { FormTemplate }, data() { return { visible: false, + // 榛樿绂佺敤鐨勮〃鍏冪礌 + disabledProp: ["id"], + // 淇敼鍥炴樉鐨勬暟鎹� + editForm: {}, + // 琛ㄥ崟绫诲瀷 + type: "add", + templateOid: "D32FC682-4376-A148-DF8D-6261206E6412", + codeClassifyOid: "91E05D2B-FEB2-6D41-5CE5-5B489615A29C", }; }, }; -- Gitblit v1.9.3