From 669aa8cc11c670a7e934cd52f7dbf0b43d0e5ba5 Mon Sep 17 00:00:00 2001 From: xy <271556543@qq.com> Date: Fri, 9 Jun 2023 14:20:55 +0800 Subject: [PATCH] 2023-6-9 --- src/views/component/table.vue | 33 ++++---- src/views/system/components/editPane.vue | 93 +++++++++++++++++++++- src/views/system/components/formEditor.vue | 2 +- 3 files changed, 105 insertions(+), 23 deletions(-) diff --git a/src/views/component/table.vue b/src/views/component/table.vue index 21c1727..f8df830 100644 --- a/src/views/component/table.vue +++ b/src/views/component/table.vue @@ -464,44 +464,41 @@ export default { // }) // } // this.form = res.fields - this.table = res.fields + this.table = this.form ?.filter((i) => i.list_show) .map((i) => { let linkOb = {}; - if (i.parameter_id) { - linkOb.customFn = (row) => { - return {row[i.link_with_name]?.value}; - }; - } - if (i.link_table_name) { - if (i.link_relation === "hasOne") { - linkOb.customFn = (row) => { + if (i._relations) { + let { link_relation, foreign_key, link_with_name } = i._relations + if (link_relation === 'newHasOne' || link_relation === 'hasOne') { + linkOb.customFn = row => { if (i.edit_input === "file") { return ( - {row[i.link_with_name]?.original_name} + {row[link_with_name]?.original_name} ); } else { return ( - {row[i.link_with_name]?.name || - row[i.link_with_name]?.no || - row[i.link_with_name]?.value} + {row[link_with_name]?.name || + row[link_with_name]?.no || + row[link_with_name]?.value} ); } - }; + } } - if (i.link_relation === "hasMany") { + + if (link_relation === "hasMany" || link_relation === 'newHasMany') { linkOb.customFn = (row) => { return (