diff --git a/src/views/component/detail.vue b/src/views/component/detail.vue index 216b7ef..2e3a247 100644 --- a/src/views/component/detail.vue +++ b/src/views/component/detail.vue @@ -140,14 +140,60 @@ export default { ]; Promise.all(promiseAll).then(res => { - let dataTable = this.allTables.find(t => t.table_name === res[1].relation[0].link_table_name); - formShow({ id: dataTable.id }).then(res1 => { + if (item.edit_input !== 'files') { + let dataTable = this.allTables.find(t => t.table_name === res[1].relation[0].link_table_name); + formShow({ id: dataTable.id }).then(res1 => { + this.linkTableList.push({ + value: res[0].data?.map(o => o[res[1]?.relation[0]?.link_with_name]), + field: this.formatColumn(res1), + title: res[1]?.name + }) + }) + } else { this.linkTableList.push({ value: res[0].data?.map(o => o[res[1]?.relation[0]?.link_with_name]), - field: this.formatColumn(res1), + field: [ + { + type: 'index', + label: '序号', + width: 50 + }, + { + prop: 'original_name', + label: '文件名' + }, + { + label: '操作', + width: 100, + customFn:row => { + return ( +
+ this.down(row) + }} + > + this.open(row.url) + }} + > +
+ ) + } + } + ], title: res[1]?.name }) - }) + } }) } }, diff --git a/src/views/component/dialog.vue b/src/views/component/dialog.vue index 32da9be..2cdf3e3 100644 --- a/src/views/component/dialog.vue +++ b/src/views/component/dialog.vue @@ -505,9 +505,9 @@ export default { } } - if (copyForm[info._relations?.link_with_name]?.length > 0) { - delete copyForm[info.field]; - } + // if (copyForm[info._relations?.link_with_name]?.length > 0) { + // delete copyForm[info.field]; + // } if ( info._relations?.link_relation === "newHasMany" || info._relations?.link_relation === "hasMany" @@ -516,33 +516,22 @@ export default { copyForm[info._relations.link_with_name] = this.file[ info.field ]?.map((i) => { - let copyRelation = i?.response ? deepCopy(i?.response) : ""; - - delete copyRelation.id; return { upload_id: i?.response?.id, - ...copyRelation, + original_name: i?.response?.original_name }; }); } else { copyForm[info._relations.link_with_name] = copyForm[ info.field + ] instanceof Array ? copyForm[ + info.field ]?.map((i) => { - // let copyRelation = info._params.find( - // (param) => param[info._relations?.foreign_key] === i - // ) - // ? deepCopy( - // info._params.find( - // (param) => param[info._relations?.foreign_key] === i - // ) - // ) - // : ""; - // delete copyRelation.id; return { [info._relations.custom_form_field]: i, //...copyRelation, }; - }); + }) : ''; } delete copyForm[info.field]; @@ -552,7 +541,7 @@ export default { info._relations?.link_relation === "hasOne" ) { if (info.edit_input === "file") { - copyForm[info.field] = this.file[info.field][0]?.response?.id; + copyForm[info.field] = this.file[info.field] ? this.file[info.field][0]?.response?.id : ''; } else { // let copyRelation = deepCopy( // info._params.find( @@ -648,6 +637,7 @@ export default { this.$nextTick(() => this.getDetail()); } } else { + this.originalForm = {}; this.file = {}; this.id = ""; this.type = ""; diff --git a/src/views/component/linkPickModal.vue b/src/views/component/linkPickModal.vue index 4f93029..9914a71 100644 --- a/src/views/component/linkPickModal.vue +++ b/src/views/component/linkPickModal.vue @@ -2,6 +2,57 @@