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 (