From d503e021821712364103d59e7da791b1540fd8b8 Mon Sep 17 00:00:00 2001 From: xy <271556543@qq.com> Date: Fri, 21 Jun 2024 17:38:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 2 +- .env.staging | 12 +- src/api/common.js | 11 +- src/utils/createDialog.js | 217 +++++++++++----------- src/views/assets/component/addHistory.vue | 53 ++---- src/views/assets/component/addHouse.vue | 7 +- src/views/assets/component/addLand.vue | 2 +- src/views/assets/component/addLease.vue | 96 ++++------ src/views/assets/lease.vue | 28 +-- src/views/component/detail.vue | 143 +++++++++++--- src/views/component/dialog.vue | 9 +- 11 files changed, 317 insertions(+), 263 deletions(-) diff --git a/.env.development b/.env.development index 45c14b8..c2030b4 100644 --- a/.env.development +++ b/.env.development @@ -4,5 +4,5 @@ ENV='development' # base api VUE_APP_BASE_API=http://wuxiwuye.ali251.langye.net/ VUE_APP_UPLOAD_API=http://wuxiwuye.ali251.langye.net/api/admin/upload-file -VUE_APP_PREVIEW=http://view.ali251.langye.net:8012/onlinePreview +VUE_APP_PREVIEW=//view.langye.net:8012/onlinePreview diff --git a/.env.staging b/.env.staging index 262c76b..f018ffa 100644 --- a/.env.staging +++ b/.env.staging @@ -4,10 +4,10 @@ NODE_ENV = production ENV = 'staging' # base api -#VUE_APP_BASE_API=http://wuxiwuye.ali251.langye.net/ -#VUE_APP_UPLOAD_API=http://wuxiwuye.ali251.langye.net/api/admin/upload-file -#VUE_APP_PREVIEW=http://view.ali251.langye.net:8012/onlinePreview +VUE_APP_BASE_API=http://wuxiwuye.ali251.langye.net/ +VUE_APP_UPLOAD_API=http://wuxiwuye.ali251.langye.net/api/admin/upload-file +VUE_APP_PREVIEW=http://view.ali251.langye.net:8012/onlinePreview # base api -VUE_APP_BASE_API=http://192.168.221.31:9001/ -VUE_APP_UPLOAD_API=http://192.168.221.31:9001/api/admin/upload-file -VUE_APP_PREVIEW=http://192.168.221.31:8012/onlinePreview +#VUE_APP_BASE_API=http://192.168.221.31:9001/ +#VUE_APP_UPLOAD_API=http://192.168.221.31:9001/api/admin/upload-file +#VUE_APP_PREVIEW=http://192.168.221.31:8012/onlinePreview diff --git a/src/api/common.js b/src/api/common.js index 716454c..2bc8bdf 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -1,9 +1,6 @@ import request from '@/utils/request' - - - export function listCommondepartment(params) { return request({ url: '/api/admin/other/admin-department-list', @@ -44,3 +41,11 @@ export function checkSms (params) { params }) } + +export function getFiles (params) { + return request({ + url: "/api/admin/other/files", + method: "get", + params + }) +} diff --git a/src/utils/createDialog.js b/src/utils/createDialog.js index b1a87e4..7d34f2d 100644 --- a/src/utils/createDialog.js +++ b/src/utils/createDialog.js @@ -184,123 +184,124 @@ export class CreateDialog { .filter((i) => i.form_show) .forEach((i, index) => { let replace = this.replaces.find((j) => j.key === i.field); - - dom.push( - h( - "el-form-item", - { - ref: `elFormItem${i.field}`, - style: { - width: "100%", - }, - props: { - label: i.name, - prop: i.field, - required: - i.validation instanceof Array - ? !!i.validation.find((i) => i === "required") - : false, + if (!(replace && !replace.show)) { + dom.push( + h( + "el-form-item", + { + ref: `elFormItem${i.field}`, + style: { + width: "100%", + }, + props: { + label: i.name, + prop: i.field, + required: + i.validation instanceof Array + ? !!i.validation.find((i) => i === "required") + : false, + }, }, - }, - replace && replace.render - ? [replace.render] - : [ - h( - domMap.get(i.edit_input), - { - ref: `elEdit_${i.field}`, - style: { - width: "100%", - }, - props: { - ...addPropsMap.get(i.edit_input), - ...this.extraProps(i), - placeholder: i.help, - value: that.form[i.field], - readonly: that.type === "show", - //disabled: that.type === 'show', - }, - attrs: { - placeholder: i.help || `请填写${i.name}`, - }, - on: { - [this.getEventType(i.edit_input)]: ( - e - ) => { - if (i.field) { - that.form[i.field] = e; - that.form = Object.assign( - {}, - that.form - ); - } + replace && replace.render + ? [replace.render] + : [ + h( + domMap.get(i.edit_input), + { + ref: `elEdit_${i.field}`, + style: { + width: "100%", }, - }, - scopedSlots: - i.edit_input === "file" || - i.edit_input === "files" - ? { - file: (scope) => { - let { file } = scope; - return [ - h("div", {}, [ - h("i", { - class: { - "el-icon-circle-check": - file.status === - "success", - "el-icon-loading": - file.status === - "uploading", - }, - style: { - color: - file.status === - "success" - ? "green" - : "", - }, - }), - h( - "a", - { - attrs: { - href: file.url, - download: file.name, - target: "_blank", - }, + props: { + ...addPropsMap.get(i.edit_input), + ...this.extraProps(i), + placeholder: i.help, + value: that.form[i.field], + readonly: that.type === "show", + //disabled: that.type === 'show', + }, + attrs: { + placeholder: i.help || `请填写${i.name}`, + }, + on: { + [this.getEventType(i.edit_input)]: ( + e + ) => { + if (i.field) { + that.form[i.field] = e; + that.form = Object.assign( + {}, + that.form + ); + } + }, + }, + scopedSlots: + i.edit_input === "file" || + i.edit_input === "files" + ? { + file: (scope) => { + let { file } = scope; + return [ + h("div", {}, [ + h("i", { class: { - "uploaded-a": + "el-icon-circle-check": file.status === "success", + "el-icon-loading": + file.status === + "uploading", }, style: { - padding: "0 4px", + color: + file.status === + "success" + ? "green" + : "", + }, + }), + h( + "a", + { + attrs: { + href: file.url, + download: file.name, + target: "_blank", + }, + class: { + "uploaded-a": + file.status === + "success", + }, + style: { + padding: "0 4px", + }, }, + file.original_name || file.name + ), + ]), + h("i", { + class: "el-icon-close", + on: { + ["click"]: () => + this.fileRemoveHandler( + file, + i.field + ), }, - file.name - ), - ]), - h("i", { - class: "el-icon-close", - on: { - ["click"]: () => - this.fileRemoveHandler( - file, - i.field - ), - }, - }), - ]; - }, - } - : "", - }, - this.optionsRender(h, i) - ), - ] - ) - ); + }), + ]; + }, + } + : "", + }, + this.optionsRender(h, i) + ), + ] + ) + ); + } }); this.replaces.forEach((replace) => { diff --git a/src/views/assets/component/addHistory.vue b/src/views/assets/component/addHistory.vue index 2cb1adc..d4bb6bc 100644 --- a/src/views/assets/component/addHistory.vue +++ b/src/views/assets/component/addHistory.vue @@ -89,30 +89,16 @@ export default { this.$integrateData(this.form, res); this.formInfo.forEach((i) => { - 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?.name, - url: i?.url, - response: i, - }; - }) - : [ - { - name: res[i._relations.link_with_name]?.name, - url: res[i._relations.link_with_name]?.url, - response: res[i._relations.link_with_name], - }, - ]) - : (this.file[i.field] = []); + if (i.edit_input === "file") { + + } + if (i.edit_input === "files") { + this.file[i.field] = res[`${i.field}_upload_details`] } - this.form = Object.assign({}, this.form); - this.originalForm = deepCopy(res); }); + this.form = Object.assign({}, this.form); + this.originalForm = deepCopy(res); }, submit() { @@ -153,30 +139,13 @@ export default { } } - if ( - info._relations?.link_relation === "newHasMany" || - info._relations?.link_relation === "hasMany" - ) { - if (info.edit_input === "files") { - this.form[info._relations.link_with_name] = this.file[ - info.field - ]?.map((i) => { - let copyRelation = i?.response ? deepCopy(i?.response) : ""; - //TODO: 待修改 - if (/:\/\/:\/\//g.test(copyRelation?.url)) { - copyRelation.url.replace(/:\/\/:\/\//g,'://') - } - delete copyRelation.id; - return { - file_id: i?.response?.id, - ...copyRelation, - }; - }); - } + if (info.edit_input === "files") { + this.form[info.field] = this.file[ + info.field + ]?.map((i) => i?.response?.id); } }) - delete this.form['tupian'] save(Object.assign(this.form, { table_name: 'his_evolutions' })).then(res => { this.$Message.success({ content: `${this.type === "add" ? "新增" : "编辑"}成功`, diff --git a/src/views/assets/component/addHouse.vue b/src/views/assets/component/addHouse.vue index 84feaae..94d3222 100644 --- a/src/views/assets/component/addHouse.vue +++ b/src/views/assets/component/addHouse.vue @@ -73,7 +73,7 @@ export default { res[i._relations.link_with_name] instanceof Array ? res[i._relations.link_with_name].map((i) => { return { - name: i?.name, + name: i?.original_name || i?.name, url: i?.url, response: i, }; @@ -87,10 +87,9 @@ export default { ]) : (this.file[i.field] = []); } - - this.form = Object.assign({}, this.form); - this.originalForm = deepCopy(res); }); + this.form = Object.assign({}, this.form); + this.originalForm = deepCopy(res); }, submit() { diff --git a/src/views/assets/component/addLand.vue b/src/views/assets/component/addLand.vue index b6589ce..80b4119 100644 --- a/src/views/assets/component/addLand.vue +++ b/src/views/assets/component/addLand.vue @@ -178,7 +178,7 @@ export default { res[i._relations.link_with_name] instanceof Array ? res[i._relations.link_with_name].map((i) => { return { - name: i?.name, + name: i?.original_name || i?.name, url: i?.url, response: i, }; diff --git a/src/views/assets/component/addLease.vue b/src/views/assets/component/addLease.vue index 1037c8c..978effc 100644 --- a/src/views/assets/component/addLease.vue +++ b/src/views/assets/component/addLease.vue @@ -9,7 +9,18 @@ export default { }, render(h) { let dialog = new CreateDialog(this,[ - + { + show: false, + key: 'land_id', + label: '', + render: () => {} + }, + { + show: false, + key: 'house_id', + label: '', + render: () => {} + } ],{ width: "650px" }) @@ -87,30 +98,15 @@ export default { this.$integrateData(this.form, res); this.formInfo.forEach((i) => { - 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]?.name, - url: res[i._relations.link_with_name]?.url, - response: res[i._relations.link_with_name], - }, - ]) - : (this.file[i.field] = []); - } + if (i.edit_input === "file") { - this.form = Object.assign({}, this.form); - this.originalForm = deepCopy(res); + } + if (i.edit_input === "files") { + this.file[i.field] = res[`${i.field}_upload_details`] + } }); + this.form = Object.assign({}, this.form); + this.originalForm = deepCopy(res); }, submit() { @@ -159,40 +155,31 @@ export default { info._relations?.link_relation === "newHasMany" || info._relations?.link_relation === "hasMany" ) { - if (info.edit_input === "files") { - 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, - }; - }); - } else { - copyForm[info._relations.link_with_name] = 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 - ) + copyForm[info._relations.link_with_name] = 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.foreign_key]: i, - ...copyRelation, - }; - }); - } - + ) + : ""; + delete copyRelation.id; + return { + [info._relations.foreign_key]: i, + ...copyRelation, + }; + }); delete copyForm[info.field]; } + if (info.edit_input === "files") { + copyForm[info.field] = this.file[ + info.field + ]?.map((i) => i?.response?.id); + } if ( info._relations?.link_relation === "newHasOne" || info._relations?.link_relation === "hasOne" @@ -231,7 +218,6 @@ export default { } }); - delete this.form['tupian'] save(Object.assign(copyForm, { table_name: 'leases' })).then(res => { this.$Message.success({ content: `${this.type === "add" ? "新增" : "编辑"}成功`, diff --git a/src/views/assets/lease.vue b/src/views/assets/lease.vue index 5837e40..132fd83 100644 --- a/src/views/assets/lease.vue +++ b/src/views/assets/lease.vue @@ -90,20 +90,20 @@ export default { prop: 'yongtu', width: 160 }, - { - label: "附件", - prop: 'file', - minWidth: 180, - customFn:row => { - return ( -
- { - row.id_lease_file_files_lease_id_relation.map(i => ((window.open(i.url))}}>{i.original_name})) - } -
- ) - } - } + // { + // label: "附件", + // prop: 'file', + // minWidth: 180, + // customFn:row => { + // return ( + //
+ // { + // row.file.map(i => ((window.open(i.url))}}>{i.original_name})) + // } + //
+ // ) + // } + // } ], }; }, diff --git a/src/views/component/detail.vue b/src/views/component/detail.vue index ee4e65e..c65df37 100644 --- a/src/views/component/detail.vue +++ b/src/views/component/detail.vue @@ -80,19 +80,21 @@ detail.id_asset_picture_files_house_id_relation.length > 0) " > -
- +
+ + fit="contain" + > +
+ v-for="(img,index) in item.tupian_detail" + :key="img.id"> - -
{{ ++index }}. {{ img.original_name }}
+ +
{{ ++index }}. {{ img.original_name }}
+
点击下载
@@ -176,6 +178,8 @@
安全检查
+ + @@ -190,6 +194,8 @@
维修保养
+ +
@@ -293,14 +299,32 @@ - - + + -