From f05f476789989b9ea51ac2b07faf537c351faf3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=87=AA=E5=B8=A6=E5=A4=A7=E4=BD=AC=E6=B0=94=E5=9C=BA?= <188633308@qq.com> Date: Tue, 22 Jun 2021 11:00:21 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E5=AE=8C=E6=88=90=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E4=B8=AD=E4=B8=8A=E4=BC=A0=E6=8E=A7=E4=BB=B6=E7=9A=84=E4=BD=BF?= =?UTF-8?q?=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Api/Ewide.Core/applicationconfig.json | 1 + .../business/house/info/form/base/aspect.vue | 28 +- .../house/info/form/base/attachments.vue | 28 +- web-react/public/seed/form-tabs/index.jsx | 16 +- web-react/public/seed/form-tabs/tab/index.jsx | 16 +- .../form-tabs/tab/{parts.jsx => part.jsx} | 18 +- web-react/public/seed/form/index.jsx | 17 +- web-react/public/seed/form/part.jsx | 18 +- web-react/src/components/index.js | 2 +- .../src/components/photo-preview/index.jsx | 74 ++++++ .../src/components/photo-swipe/index.jsx | 11 - .../pages/business/house/code/form/index.jsx | 2 +- .../business/house/info/form/base/aspect.jsx | 230 +++++++++++++++++ .../house/info/form/base/attachments.jsx | 238 +++++++++++++++++ .../house/info/form/base/building.jsx | 240 +++++++++++++++--- .../business/house/info/form/base/index.jsx | 29 ++- .../pages/business/house/info/form/index.jsx | 21 +- 17 files changed, 883 insertions(+), 106 deletions(-) rename web-react/public/seed/form-tabs/tab/{parts.jsx => part.jsx} (90%) create mode 100644 web-react/src/components/photo-preview/index.jsx delete mode 100644 web-react/src/components/photo-swipe/index.jsx create mode 100644 web-react/src/pages/business/house/info/form/base/aspect.jsx create mode 100644 web-react/src/pages/business/house/info/form/base/attachments.jsx diff --git a/Api/Ewide.Core/applicationconfig.json b/Api/Ewide.Core/applicationconfig.json index 1568099..0266d1e 100644 --- a/Api/Ewide.Core/applicationconfig.json +++ b/Api/Ewide.Core/applicationconfig.json @@ -93,6 +93,7 @@ "sysDictType:dropDowns", "sysFileInfo:upload", "sysFileInfo:download", + "sysFileInfo:detail", "sysFileInfo:preview", "sysUser:updateInfo", "sysUser:updatePwd", diff --git a/Web/src/pages/business/house/info/form/base/aspect.vue b/Web/src/pages/business/house/info/form/base/aspect.vue index 878c07e..90ae890 100644 --- a/Web/src/pages/business/house/info/form/base/aspect.vue +++ b/Web/src/pages/business/house/info/form/base/aspect.vue @@ -104,15 +104,25 @@ export default { if (record) { const fileList = !!record.houseInfo.facadePhoto ? record.houseInfo.facadePhoto.split(',') : []; for (let i = 0; i < fileList.length; i++) { - const file = await PreviewFile(fileList[i]); - const base64 = await BlobToBase64(file); - facadePhoto.push({ - uid: fileList[i], - response: fileList[i], // 用于和新上传的文件一同回传 - name: file.name, - url: base64, - status: 'done', - }); + try { + const file = await PreviewFile(fileList[i]); + const base64 = await BlobToBase64(file); + facadePhoto.push({ + uid: fileList[i], + response: fileList[i], // 用于和新上传的文件一同回传 + name: file.name, + url: base64, + status: 'done', + }); + } catch { + const { data: file } = await this.$api.sysFileInfoDetail({ id: fileList[i] }); + facadePhoto.push({ + uid: fileList[i], + response: '文件已丢失', + name: file.fileOriginName, + status: 'error', + }); + } } } defaultForm.houseInfo.facadePhoto = facadePhoto; diff --git a/Web/src/pages/business/house/info/form/base/attachments.vue b/Web/src/pages/business/house/info/form/base/attachments.vue index db16ab8..69162a5 100644 --- a/Web/src/pages/business/house/info/form/base/attachments.vue +++ b/Web/src/pages/business/house/info/form/base/attachments.vue @@ -173,15 +173,25 @@ export default { const fileList = !form.houseInfo[key] || form.houseInfo[key].length == 0 ? [] : form.houseInfo[key].split(','); for (let i = 0; i < fileList.length; i++) { - const file = await PreviewFile(fileList[i]); - const base64 = await BlobToBase64(file); - fileValue.push({ - uid: fileList[i], - response: fileList[i], // 用于和新上传的文件一同回传 - name: file.name, - url: base64, - status: 'done', - }); + try { + const file = await PreviewFile(fileList[i]); + const base64 = await BlobToBase64(file); + fileValue.push({ + uid: fileList[i], + response: fileList[i], // 用于和新上传的文件一同回传 + name: file.name, + url: base64, + status: 'done', + }); + } catch { + const { data: file } = await this.$api.sysFileInfoDetail({ id: fileList[i] }); + fileValue.push({ + uid: fileList[i], + response: '文件已丢失', + name: file.fileOriginName, + status: 'error', + }); + } } form.houseInfo[key] = fileValue; } diff --git a/web-react/public/seed/form-tabs/index.jsx b/web-react/public/seed/form-tabs/index.jsx index eb0a9c4..3cd7e70 100644 --- a/web-react/public/seed/form-tabs/index.jsx +++ b/web-react/public/seed/form-tabs/index.jsx @@ -16,6 +16,7 @@ export default class index extends Component { actived: '0', loading: true, record: null, + saveDisabled: true, saving: false, } @@ -42,6 +43,16 @@ export default class index extends Component { */ componentDidMount() {} + /** + * 接收到所有子组件已加载完成,并启用提交按钮 + */ + call(child, index) { + this.children[index] = child + if (this.children.filter(p => p).length === tabs.filter(p => p.show).length) { + this.setState({ saveDisabled: false }) + } + } + async onSubmit() { for (const child of this.children) { try { @@ -62,7 +73,7 @@ export default class index extends Component { } render() { - const { actived, loading, record, saving } = this.state + const { actived, loading, record, saveDisabled, saving } = this.state return (