From aa77770e096bf38405710caa761c0c3384cb01b6 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Mon, 14 Nov 2022 19:20:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=BA=E5=91=98=E5=8D=A1=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/resource/FormItem.js | 97 ++++++++++++++++++- pc4mobx/organization/stores/jobextend.js | 2 +- pc4mobx/organization/style/card.less | 1 + 3 files changed, 98 insertions(+), 2 deletions(-) diff --git a/pc4mobx/organization/components/resource/FormItem.js b/pc4mobx/organization/components/resource/FormItem.js index 511e3a9..e52ca52 100644 --- a/pc4mobx/organization/components/resource/FormItem.js +++ b/pc4mobx/organization/components/resource/FormItem.js @@ -1,5 +1,7 @@ import { WeaFormItem, + WeaTab, + WeaTableEdit } from 'ecCom' import { @@ -13,21 +15,98 @@ import { } from '../../public/i18n'; import '../../style/common.less'; -import { chunk } from 'lodash'; +import { chunk,isEmpty } from 'lodash'; +import { toJS } from "mobx"; + export default class FormItem extends React.Component { constructor(props) { super(props); this.state = { + tableInfo:[], + tabInfo:[], + detailSelectedKey: '0' } } + componentDidMount() { + const { + groupInfo + } = this.props; + let tableInfo = this.handleTable(groupInfo.tables); + let tabInfo = this.getTabInfo(tableInfo); + let detailSelectedKey = '0'; + if (!isEmpty(tabInfo)) detailSelectedKey = tabInfo[0].key; + this.setState({ + tableInfo:tableInfo, + tabInfo:tabInfo, + detailSelectedKey:detailSelectedKey + }) + + } + + handleTable = (datas) => { + return datas && datas.map(data => { + const { tabinfo: { columns } } = data; + const length = columns.length; + columns.map(c => { + c.width = `${95 / length}%` + }) + return data + }) + } + + getTabInfo = (tableInfo) => { + let tabInfo = []; + tableInfo && tableInfo.forEach((c, idx) => { + if (!c.hide) { + tabInfo.push({ + key: `${idx}`, + title: c.tabname, + }) + } + }) + return tabInfo; + } + + getTabChildren = () => { + let { tableInfo, tabkey, detailSelectedKey } = this.state; + let tabChildren = []; + tableInfo = toJS(tableInfo); + + tableInfo && tableInfo.map((t, i) => { + if (detailSelectedKey == i) { + tabChildren.push( + { + Object.assign(rowSelection, { + getCheckboxProps: record => ({ + disabled: record.viewAttr === 1, // 配置无法勾选的列 + }) + }) + return rowSelection; + }} + /> + ); + } + }) + return tabChildren; + } + render() { const { groupInfo } = this.props, { + tableInfo, + tabInfo, + detailSelectedKey } = this.state; const newData = chunk(groupInfo.items, 3); + return (
@@ -55,6 +134,22 @@ export default class FormItem extends React.Component { ); })}
+ { + !isEmpty(tabInfo) &&
+ { + this.setState({ + detailSelectedKey:v + }) + }} + /> + {this.getTabChildren()} +
+ } ) diff --git a/pc4mobx/organization/stores/jobextend.js b/pc4mobx/organization/stores/jobextend.js index f77b83a..41a5ea0 100644 --- a/pc4mobx/organization/stores/jobextend.js +++ b/pc4mobx/organization/stores/jobextend.js @@ -11,7 +11,7 @@ import { export class JobExtendStore { @observable form = new WeaForm(); - @observable tableInfo = [] + @observable tableInfo = []; @observable condition = []; @observable isEditor = false; @observable isNew = true; diff --git a/pc4mobx/organization/style/card.less b/pc4mobx/organization/style/card.less index 6cccbdd..1e5ba3f 100644 --- a/pc4mobx/organization/style/card.less +++ b/pc4mobx/organization/style/card.less @@ -108,6 +108,7 @@ margin-top: 20px; width: 100%; background-color: #ffffff; + padding-bottom: 40px; .title { width: 100%; height: 30px;