diff --git a/src/components/XyTable/index.vue b/src/components/XyTable/index.vue index bce399c..7b4fd53 100644 --- a/src/components/XyTable/index.vue +++ b/src/components/XyTable/index.vue @@ -895,7 +895,9 @@ export default { ); })} - { this.auths.length > 0 ? this.isCreateAuthBtns() : '' } + { + $scopedSlots.btns ? $scopedSlots.btns() : (this.auths.length > 0 ? this.isCreateAuthBtns() : '') + } ) : ( diff --git a/src/router/index.js b/src/router/index.js index edb8ed8..48f985b 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -62,23 +62,28 @@ export const constantRoutes = [ children: [ { path: 'home', - component: () => import('@/views/reception/home') + component: () => import('@/views/reception/home'), + meta: { title: '内部质量保证体系资料汇编'} }, { path: 'department', - component: () => import('@/views/reception/department') + component: () => import('@/views/reception/department'), + meta: { title: '部门'} }, { path: 'label', - component: () => import('@/views/reception/label') + component: () => import('@/views/reception/label'), + meta: { title: '标签'} }, { path: 'list1', - component: () => import('@/views/reception/list1') + component: () => import('@/views/reception/list1'), + meta: { title: '内部质量保证体系资料汇编'} }, { path: 'list2', - component: () => import('@/views/reception/list2') + component: () => import('@/views/reception/list2'), + meta: { title: '内部质量保证体系资料汇编'} } ], hidden: true diff --git a/src/views/component/dialog.vue b/src/views/component/dialog.vue index e0ff0cf..dd408d3 100644 --- a/src/views/component/dialog.vue +++ b/src/views/component/dialog.vue @@ -60,7 +60,7 @@ export default { }, }, this.$scopedSlots[i.field] - ? this.$scopedSlots[i.field]({ fieldInfo: i, form: this.form }) + ? this.$scopedSlots[i.field]({ fieldInfo: i, form: this.form, file: this.file }) : [ h( domMap.get(i.edit_input), @@ -119,6 +119,9 @@ export default { "uploaded-a": file.status === "success", }, + style: { + 'padding': '0 4px' + }, }, file.name ), @@ -216,7 +219,7 @@ export default { ? info._params.map((i) => h("el-option", { props: { - label: i.key || i.name || i.no || i.value || i.id, + label: i.key || i.value || i.name || i.no || i.mingcheng || i.id, value: info._relations ? i[info._relations.foreign_key] : i.value, }, }) @@ -337,14 +340,21 @@ export default { this.form = Object.assign({}, this.form); this.formInfo.forEach((i) => { - if (i && i.edit_input === "file") { - this.file[i.field] = [ - { - name: res[i.link_with_name]?.original_name, - url: res[i.link_with_name]?.url, - response: res[i.link_with_name], - }, - ]; + if (i && (i.edit_input === "file" || i.edit_input === 'files')) { + res[i._relations.link_with_name] ? ( + this.file[i.field] = res[i._relations.link_with_name] instanceof Array ? res[i._relations.link_with_name].map(i => { + return { + name: i?.original_name, + url: i?.url, + response: i + } + }) : [{ + name: res[i._relations.link_with_name]?.original_name, + url: res[i._relations.link_with_name]?.url, + response: res[i._relations.link_with_name] + }] + ) : this.file[i.field] = [] + } }); }, @@ -354,6 +364,11 @@ export default { if (this.form.hasOwnProperty("id")) { delete this.form.id; } + + //TODO:业务特殊处理 + if (/^\/manage/.test(this.$route.path)) { + this.form['zhuangtai'] = 0 + } } if (this.type === "editor") { Object.defineProperty(this.form, "id", { @@ -366,16 +381,32 @@ export default { this.$refs["elForm"].validate((validate) => { if (validate) { this.formInfo.forEach((info) => { - if (info.edit_input === "files") { - this.form[info.field] = info._fileList.map( - (i) => i?.response?.id - ); - } - if (info.edit_input === "file") { - this.form[info.field] = this.file[info.field][0]?.response?.id; + if (info._relations?.link_with_name) { + if (info.edit_input === "files" || info.edit_input === "file") { + this.form[info._relations.link_with_name] = this.file[info.field].map(i => { + return { + [info._relations.foreign_key]: i?.response?.id + } + }); + delete this.form[info.field] + } else { + this.form[info._relations.link_with_name] = this.form[info.field] instanceof Array ? this.form[info.field].map(i => { + return { + [info._relations.foreign_key]: i + } + }) : [{ [info._relations.foreign_key]: this.form[info.field] }] + delete this.form[info.field] + } } + // if (info.edit_input === "files") { + // this.form[info.field] = this.file[info.field].map( + // (i) => i?.response?.id + // ); + // } + // if (info.edit_input === "file") { + // this.form[info.field] = this.file[info.field][0]?.response?.id; + // } }); - console.log(this.form); save(Object.assign(this.form, { table_name: this.tableName })).then( (res) => { this.$Message.success({ @@ -417,6 +448,13 @@ export default { if (i.edit_input === "checkbox") { this.form[i.field] = []; } + + //TODO:业务特殊处理 + if (this.tableName === 'materials') { + if (i.field === 'leixing') { + this.form[i.field] = Number(this.$route.meta.params.type); + } + } } }); }, diff --git a/src/views/component/table.vue b/src/views/component/table.vue index 6135c74..54fbe06 100644 --- a/src/views/component/table.vue +++ b/src/views/component/table.vue @@ -5,7 +5,7 @@
@@ -14,7 +14,7 @@