From f54de22ea19bc69352a271c2063bd6cbfbdb1c60 Mon Sep 17 00:00:00 2001 From: zhangwenshuai Date: Wed, 5 Aug 2020 11:55:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9modal=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/apolloTable/detailForm/index.less | 34 ++++++---- components/apolloTable/detailForm/index.tsx | 24 +++---- components/apolloTable/editFormV3/index.less | 54 ++++++++-------- components/apolloTable/editFormV3/index.tsx | 68 +++++++++----------- 4 files changed, 91 insertions(+), 89 deletions(-) diff --git a/components/apolloTable/detailForm/index.less b/components/apolloTable/detailForm/index.less index 6aad50f..36faad0 100644 --- a/components/apolloTable/detailForm/index.less +++ b/components/apolloTable/detailForm/index.less @@ -1,44 +1,42 @@ @import '~@/theme/common'; .wrap { - position: relative; - // width: 580px; - width: 100%; - height: 90vh; background: #fff; - .titleRow { + display: flex; + flex-direction: column; + height: 100%; + .topWrap { display: flex; - flex-direction: row; + height: 60px; align-items: center; justify-content: space-between; padding: 0 @paddingLg; .titleCls { font-size: 14px; color: #5a6876; - line-height: 62px; - z-index: 10; - background: #fff; } .editClick { cursor: pointer; .detailEdit { color: @primaryColor; font-size: 14px; - margin-left: 6px; } } } .formWrap { + position: relative; + flex: 1; padding: @paddingLg; - height: calc(100% - 130px); overflow-x: hidden; overflow-y: auto; - margin-bottom: 68px; - position: relative; background: rgb(250, 250, 250); .row { display: flex; background-color: rgba(251, 251, 251, 1); + border: 1px solid #ececec; + &:first-child { + border-top: none; + } .listLeft { width: 150px; @@ -59,4 +57,14 @@ } } } + .bottomWrap { + display: flex; + height: 68px; + align-items: center; + justify-content: space-between; + padding: 0 @paddingLg; + .delBtnCls { + color: @errorColor; + } + } } diff --git a/components/apolloTable/detailForm/index.tsx b/components/apolloTable/detailForm/index.tsx index b443460..e0e3eb5 100644 --- a/components/apolloTable/detailForm/index.tsx +++ b/components/apolloTable/detailForm/index.tsx @@ -1,10 +1,11 @@ import React from 'react'; +import { Button } from 'antd'; import { config } from '../component/base/config'; import { transferAttr } from '../component/base/_utils/transferAttr'; import styles from './index.less'; const DetailForm = (props: any) => { - const { data, rowData, title, goEdit, hideEditBtn } = props; + const { data, rowData, name, goEdit, hideEditBtn, isShowDelBtn, handleDelete, delLabel } = props; const renderDetailForm = (item: any) => { const { columnType, columnAttrObj, value, renderDetailForm } = item; let detailConfig; @@ -49,28 +50,27 @@ const DetailForm = (props: any) => { }; return (
-
-
{title}
+
+
{name}
{!hideEditBtn && renderBtn()}
{data.map((item: any, index: number) => { - const border = - index === 0 - ? { border: '1px solid #ECECEC' } - : { - borderBottom: '1px solid #ECECEC', - borderLeft: '1px solid #ECECEC', - borderRight: '1px solid #ECECEC', - }; return ( -
+
{`${item.columnChsName}:`}
{renderDetailForm(item)}
); })}
+
+ {isShowDelBtn && ( + + )} +
); }; diff --git a/components/apolloTable/editFormV3/index.less b/components/apolloTable/editFormV3/index.less index aae7e38..624b369 100644 --- a/components/apolloTable/editFormV3/index.less +++ b/components/apolloTable/editFormV3/index.less @@ -1,26 +1,28 @@ @import '~@/theme/common'; .wrap { - position: relative; - width: 100%; - .titleCls { - position: absolute; - left: 26px; - // width: 520px; - font-size: 16px; - color: @textPrimaryColor; - line-height: 62px; - z-index: 10; - background: #fff; + background: white; + display: flex; + flex-direction: column; + height: 100%; + .topWrap { + display: flex; + height: 60px; + align-items: center; + justify-content: space-between; + padding: 0 @paddingLg; + .titleCls { + font-size: @textFontGen; + color: #5a6876; + } } .formItemCls { - padding: 0 45px 0 26px; - height: 75vh; + flex: 1; + padding: 0 @paddingLg; overflow-x: hidden; overflow-y: auto; border-bottom: 1px solid #ececec; - margin: 62px 0 68px; position: relative; :global(.ant-form-item-control) { @@ -43,20 +45,16 @@ } } - .itemCls { - } - - .btnCls { - min-width: 68px; - margin-left: 10px; - } - - .buttonWrap { - position: absolute; - bottom: 16px; - left: 26px; - right: 45px; - + .bottomWrap { + display: flex; + height: 68px; + align-items: center; + justify-content: space-between; + padding: 0 @paddingLg; + .btnCls { + min-width: 68px; + margin-left: 10px; + } .delBtnCls { color: @errorColor; } diff --git a/components/apolloTable/editFormV3/index.tsx b/components/apolloTable/editFormV3/index.tsx index be26336..5513a9d 100644 --- a/components/apolloTable/editFormV3/index.tsx +++ b/components/apolloTable/editFormV3/index.tsx @@ -32,9 +32,7 @@ class FormWrap extends Component { handleSubmit = (e) => { e.preventDefault(); e.stopPropagation(); - const { - rowId, form, handleSubmit, data, rowData, detailType, - } = this.props; + const { rowId, form, handleSubmit, data, rowData, detailType } = this.props; form.validateFieldsAndScroll((err, values) => { if (!err) { const newValues: any[] = []; @@ -95,12 +93,12 @@ class FormWrap extends Component { // 可输可选组件清空时数据格式有问题,单独处理一下 if (item.requiredFlag && Number(item.columnType) === 15 && typeof value === 'object') { if ( - !value.label - && value.label !== 0 - && !value.text - && value.text !== 0 - && !value.value - && value.value !== 0 + !value.label && + value.label !== 0 && + !value.text && + value.text !== 0 && + !value.value && + value.value !== 0 ) { return callback('必填项不能为空'); } @@ -204,14 +202,14 @@ class FormWrap extends Component { }; render() { - const { - loading, isShowDelBtn, data, btnWrapStyle, name, colsNum, delLabel, hideOperateBtn, - } = this.props; + const { loading, isShowDelBtn, data, btnWrapStyle, name, colsNum, delLabel, hideOperateBtn } = this.props; return (
-

{name}

+
+
{name}
+
-
-
- {isShowDelBtn && ( - + )} + {!hideOperateBtn && ( +
+ - )} - {!hideOperateBtn && ( -
- - -
- )} -
+ +
+ )}
-- 2.21.0