From 977ce3d348f898d64ea240c8397b83d3e1cc5bb4 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 18 十二月 2019 09:23:05 +0800 Subject: [PATCH] 2019-12-18 --- src/components/tabview/index.jsx | 12 src/templates/comtableconfig/colspanform/index.jsx | 10 src/components/header/index.jsx | 4 src/components/sidemenu/index.scss | 12 src/templates/comtableconfig/columnform/index.scss | 5 src/tabviews/commontable/mainAction/index.jsx | 202 +++++++++++++- src/templates/comtableconfig/index.jsx | 36 ++ src/templates/modalconfig/index.jsx | 2 src/tabviews/datamanage/index.jsx | 3 src/locales/zh-CN/comtable.js | 3 src/tabviews/commontable/index.jsx | 138 ---------- src/templates/comtableconfig/dragelement/index.jsx | 4 src/tabviews/commontable/mainTable/index.jsx | 109 +++++++- src/locales/en-US/comtable.js | 3 src/templates/comtableconfig/dragelement/card.jsx | 5 src/components/header/index.scss | 15 src/tabviews/commontable/mainAction/index.scss | 6 src/tabviews/commontable/mutilform/index.jsx | 126 ++++++++- src/templates/comtableconfig/index.scss | 14 + src/tabviews/datamanage/action/index.jsx | 15 src/tabviews/tabform/index.jsx | 3 src/tabviews/commontable/mainTable/index.scss | 23 + src/components/sidemenu/index.jsx | 1 src/tabviews/commontable/mutilform/index.scss | 2 src/templates/comtableconfig/columnform/index.jsx | 21 + 25 files changed, 529 insertions(+), 245 deletions(-) diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index 539228e..0e9da9a 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -87,7 +87,7 @@ notification.success({ top: 92, message: this.state.dict['header.password.resetsuccess'], - duration: 5 + duration: 2 }) } else { notification.warning({ @@ -277,7 +277,7 @@ this.state.menulist.map(item => { return ( <li key={item.MenuID} onClick={() => {this.changeMenu(item)}} className={this.props.selectmenu.MenuID === item.MenuID ? 'active' : ''}> - {item.MenuName} + <span>{item.MenuName}</span> </li> ) })} diff --git a/src/components/header/index.scss b/src/components/header/index.scss index b98fff2..84221f2 100644 --- a/src/components/header/index.scss +++ b/src/components/header/index.scss @@ -53,17 +53,24 @@ line-height: 48px; li { float: left; - // color: $header-font; - font-size: 1.7rem; - margin: 0 10px; + font-size: 1.8rem; cursor: pointer; + span { + padding: 0 10px; + height: 42px; + display: inline-block; + } &:hover { + height: 42px; color: #eeeeee; + border-bottom: 4px solid #fafcfb; } &.active { + height: 42px; color: #ffffff; - font-weight: bold; + // font-weight: bold; + border-bottom: 4px solid #06b4f7; } } } diff --git a/src/components/sidemenu/index.jsx b/src/components/sidemenu/index.jsx index d0b092b..68f9051 100644 --- a/src/components/sidemenu/index.jsx +++ b/src/components/sidemenu/index.jsx @@ -159,7 +159,6 @@ }) menu.selected = true tabs.push(menu) - this.props.modifyTabview(tabs) e.preventDefault() } diff --git a/src/components/sidemenu/index.scss b/src/components/sidemenu/index.scss index 8f40c66..49ebdb2 100644 --- a/src/components/sidemenu/index.scss +++ b/src/components/sidemenu/index.scss @@ -17,12 +17,20 @@ position: relative; } .ant-menu-sub.ant-menu-inline > .ant-menu-item { // 閲嶇疆涓夌骇鑿滃崟琛岄珮 - height: 30px; - line-height: 30px; + height: 38px; + line-height: 38px; + margin: 0px; + border-bottom: 1px solid #000c17; .edit-check { top: -5px; } } + .ant-menu-sub.ant-menu-inline > .ant-menu-item.ant-menu-item-active { // 閲嶇疆涓夌骇鑿滃崟琛岄珮 + background: #06b4f7; + } + .ant-menu-sub.ant-menu-inline > .ant-menu-item.ant-menu-item-selected { // 閲嶇疆涓夌骇鑿滃崟琛岄珮 + background: #06b4f7; + } .ant-menu-inline .ant-menu-item { font-size: 1.5rem; } diff --git a/src/components/tabview/index.jsx b/src/components/tabview/index.jsx index a0ab705..acc9236 100644 --- a/src/components/tabview/index.jsx +++ b/src/components/tabview/index.jsx @@ -63,7 +63,16 @@ this.setState({ selectedTabId: menu.MenuID }) - + let tabs = JSON.parse(JSON.stringify(this.props.tabviews)) + tabs = tabs.map(tab => { + if (tab.MenuID === menu.MenuID) { + tab.selected = true + } else { + tab.selected = false + } + return tab + }) + this.props.modifyTabview(tabs) this.resetWindow(menu) } @@ -144,7 +153,6 @@ this.setState({ selectedTabId: view ? view.MenuID : '' }) - this.resetWindow(view) } } diff --git a/src/locales/en-US/comtable.js b/src/locales/en-US/comtable.js index e9f48bf..19a812b 100644 --- a/src/locales/en-US/comtable.js +++ b/src/locales/en-US/comtable.js @@ -86,7 +86,8 @@ 'header.form.format': '鏍煎紡鍖�', 'header.form.empty': '绌�', 'header.form.thdSeparator': '鍗冨垎浣�', - 'header.form.prefix': '鍓嶇疆绗�', + 'header.form.prefix': '鍓嶇紑', + 'header.form.postfix': '鍚庣紑', 'header.form.isRequired': '琛岃缃�', 'header.form.notRequired': '涓嶉�夋嫨琛�', 'header.form.requiredSgl': '閫夋嫨鍗曡', diff --git a/src/locales/zh-CN/comtable.js b/src/locales/zh-CN/comtable.js index a065c53..c6bb907 100644 --- a/src/locales/zh-CN/comtable.js +++ b/src/locales/zh-CN/comtable.js @@ -86,7 +86,8 @@ 'header.form.format': '鏍煎紡鍖�', 'header.form.empty': '绌�', 'header.form.thdSeparator': '鍗冨垎浣�', - 'header.form.prefix': '鍓嶇疆绗�', + 'header.form.prefix': '鍓嶇紑', + 'header.form.postfix': '鍚庣紑', 'header.form.isRequired': '琛岃缃�', 'header.form.notRequired': '涓嶉�夋嫨琛�', 'header.form.requiredSgl': '閫夋嫨鍗曡', diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index 00cccd9..eb03ae3 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -141,7 +141,6 @@ loading: true }, () => { this.improveSearch() - this.improveAction() this.loadmaindata() }) } else { @@ -232,142 +231,6 @@ }) } - improveAction = () => { - const { config } = this.state - - let conAction = config.action.filter(item => (item.OpenType === 'pop' || item.OpenType === 'tab' || item.OpenType === 'blank')) - - if (conAction.length > 0) { - let deffers = conAction.map(item => { - return new Promise(resolve => { - Api.getSystemCacheConfig({ - func: 'sPC_Get_LongParam', - MenuID: item.uuid - }).then(res => { - res.uuid = item.uuid - resolve(res) - }) - }) - }) - - let _action = {} - let error = '' - Promise.all(deffers).then(result => { - result.forEach(res => { - if (res.status) { - let _LongParam = '' - if (res.LongParam) { - _LongParam = window.decodeURIComponent(window.atob(res.LongParam)) - try { - _LongParam = JSON.parse(_LongParam) - } catch (e) { - _LongParam = '' - } - } - - if (_LongParam) { - _action[res.uuid] = _LongParam - } - } else { - error = res - - } - }) - - this.setState({ - configMap: {...this.state.configMap, ..._action} - }) - - if (error) { - notification.warning({ - top: 92, - message: error.message, - duration: 10 - }) - } else { - this.improveActionForm(Object.values(_action)) - } - }) - } - } - - improveActionForm = (actions) => { - let subfields = [] - actions.forEach(item => { - if (item.groups.length > 0) { - item.groups.forEach(group => { - group.sublist.forEach(field => { - if ((field.type === 'select' || field.type === 'link') && field.resourceType === '1') { - subfields.push(field) - } - }) - }) - } else { - item.fields.forEach(field => { - if ((field.type === 'select' || field.type === 'link') && field.resourceType === '1') { - subfields.push(field) - } - }) - } - }) - - let deffers = subfields.map(item => { - let arrfield = item.valueField + ',' + item.valueText - - if (item.type === 'link') { - arrfield = arrfield + ',' + item.linkField - } - - let param = { - func: 'sPC_Get_SelectedList', - LText: item.dataSourceSql, - obj_name: 'data', - arr_field: arrfield - } - - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' - param.secretkey = Utils.encrypt(param.LText, param.timestamp) - console.log(item) - return new Promise(resolve => { - Api.getSystemCacheConfig(param).then(res => { - res.search = item - resolve(res) - }) - }) - }) - - let _field = {} - let error = '' - Promise.all(deffers).then(result => { - result.forEach(res => { - if (res.status) { - let options = res.data.map(cell => { - return { - key: Utils.getuuid(), - Value: cell[res.search.valueField], - Text: cell[res.search.valueText] - } - }) - - _field[res.search.uuid] = options - } else { - error = res - } - }) - - this.setState({ - configMap: {...this.state.configMap, ..._field} - }) - - if (error) { - notification.warning({ - top: 92, - message: error.message, - duration: 10 - }) - } - }) - } async loadmaindata () { const { arr_field, pageIndex, pageSize, orderColumn, orderType, search, setting } = this.state @@ -543,7 +406,6 @@ <MainAction MenuID={this.props.MenuID} setting={setting} - configMap={this.state.configMap} refreshdata={this.refreshbyaction} gettableselected={this.gettableselected} actions={actions} diff --git a/src/tabviews/commontable/mainAction/index.jsx b/src/tabviews/commontable/mainAction/index.jsx index 0469e7c..50298f9 100644 --- a/src/tabviews/commontable/mainAction/index.jsx +++ b/src/tabviews/commontable/mainAction/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import moment from 'moment' -import { Button, Affix, Modal, notification } from 'antd' +import { Button, Affix, Modal, notification, Spin } from 'antd' import MutilForm from '../mutilform' import Utils from '@/utils/utils.js' import Api from '@/api' @@ -14,8 +14,7 @@ MenuID: PropTypes.string, actions: PropTypes.array, // 鎼滅储鏉′欢鍒楄〃 dict: PropTypes.object, // 瀛楀吀椤� - setting: PropTypes.any, - configMap: PropTypes.object + setting: PropTypes.any } state = { @@ -24,14 +23,17 @@ tabledata: null, confirmLoading: false, execAction: null, - loadingUuid: '' + loadingUuid: '', + btnloading: false, + configMap: {} } refreshdata = (item, type) => { this.props.refreshdata(item, type) } actionTrigger = (item) => { - const { setting, configMap } = this.props + const { setting } = this.props + let _this = this let data = this.props.gettableselected() || [] @@ -77,21 +79,13 @@ this.setState({loadingUuid: ''}) }) } else if (item.OpenType === 'pop') { - let param = configMap[item.uuid] - - if (!param || param.type !== 'Modal') { - notification.warning({ - top: 92, - message: '鏈幏鍙栧埌鎸夐挳閰嶇疆淇℃伅锛�', - duration: 10 - }) - } else { - this.setState({ - visible: true, - execAction: {...param, ...item}, - tabledata: data - }) - } + this.setState({ + execAction: item, + tabledata: data, + btnloading: true + }, () => { + this.improveAction(item) + }) } else { notification.warning({ top: 92, @@ -317,7 +311,6 @@ }).then(res => { if (!res) return // 澶栭儴璇锋眰 - console.log(res) return Api.genericInterface(res) }).then(response => { // 鍥炶皟璇锋眰 @@ -504,7 +497,7 @@ notification.success({ top: 92, message: this.props.dict['main.action.confirm.success'], - duration: 5 + duration: 2 }) if (btn.OpenType === 'pop') { this.setState({ @@ -531,6 +524,164 @@ }) } + improveAction = (action) => { + const { configMap, execAction } = this.state + + let _config = configMap[action.uuid] + + if (_config) { + this.setState({ + execAction: {..._config, ...execAction} + }, () => { + this.improveActionForm() + }) + } else { + Api.getSystemCacheConfig({ + func: 'sPC_Get_LongParam', + MenuID: action.uuid + }).then(res => { + let _LongParam = '' + + if (res.status && res.LongParam) { + _LongParam = window.decodeURIComponent(window.atob(res.LongParam)) + try { + _LongParam = JSON.parse(_LongParam) + } catch (e) { + _LongParam = '' + } + } + + if (!res.status) { + notification.warning({ + top: 92, + message: res.message, + duration: 10 + }) + this.setState({ + execAction: null, + tabledata: null, + btnloading: false + }) + } else if (!_LongParam || (action.OpenType === 'pop' && _LongParam.type !== 'Modal')) { + notification.warning({ + top: 92, + message: '鏈幏鍙栧埌鎸夐挳閰嶇疆淇℃伅锛�', + duration: 10 + }) + this.setState({ + execAction: null, + tabledata: null, + btnloading: false + }) + } else { + this.setState({ + configMap: {...configMap, [action.uuid]: _LongParam}, + execAction: {..._LongParam, ...execAction} + }, () => { + this.improveActionForm() + }) + } + }) + } + } + + improveActionForm = () => { + const { configMap, execAction } = this.state + let subfields = [] + + if (execAction.groups.length > 0) { + execAction.groups.forEach(group => { + group.sublist.forEach(field => { + if ((field.type === 'select' || field.type === 'link') && field.resourceType === '1') { + subfields.push(field) + } + }) + }) + } else { + execAction.fields.forEach(field => { + if ((field.type === 'select' || field.type === 'link') && field.resourceType === '1') { + subfields.push(field) + } + }) + } + + if (subfields.length === 0) { + this.setState({ + visible: true, + btnloading: false + }) + return + } + + let deffers = subfields.map(item => { + let arrfield = item.valueField + ',' + item.valueText + + if (item.type === 'link') { + arrfield = arrfield + ',' + item.linkField + } + + let param = { + func: 'sPC_Get_SelectedList', + LText: item.dataSourceSql, + obj_name: 'data', + arr_field: arrfield + } + + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + param.secretkey = Utils.encrypt(param.LText, param.timestamp) + + return new Promise(resolve => { + Api.getSystemCacheConfig(param).then(res => { + res.search = item + resolve(res) + }) + }) + }) + + let _field = {} + let error = '' + Promise.all(deffers).then(result => { + result.forEach(res => { + if (res.status) { + let options = res.data.map(cell => { + let item = { + key: Utils.getuuid(), + Value: cell[res.search.valueField], + Text: cell[res.search.valueText] + } + + if (res.search.type === 'link') { + item.parentId = cell[res.search.linkField] + } + + return item + }) + + _field[res.search.uuid] = options + } else { + error = res + } + }) + + if (error) { + notification.warning({ + top: 92, + message: error.message, + duration: 10 + }) + } + + this.setState({ + configMap: {...configMap, ..._field} + }, () => { + this.setState({ + visible: true, + btnloading: false + }) + }) + }) + } + handleOk = () => { this.formRef.handleConfirm().then(res => { this.setState({ @@ -541,7 +692,6 @@ confirmLoading: false }) }, res) - console.log(res) }, () => {}) } @@ -584,7 +734,7 @@ <MutilForm dict={this.props.dict} action={execAction} - configMap={this.props.configMap} + configMap={this.state.configMap} data={this.state.tabledata[0]} wrappedComponentRef={(inst) => this.formRef = inst} /> @@ -593,7 +743,7 @@ } render() { - const { loadingUuid } = this.state + const { loadingUuid, btnloading } = this.state if (this.props.setting.actionfixed) { // 鎸夐挳鏄惁鍥哄畾鍦ㄥご閮� return ( @@ -622,6 +772,7 @@ } })} {this.getModels()} + {btnloading && <Spin size="large" />} </div> </Affix> ) @@ -651,6 +802,7 @@ } })} {this.getModels()} + {btnloading && <Spin size="large" />} </div> ) } diff --git a/src/tabviews/commontable/mainAction/index.scss b/src/tabviews/commontable/mainAction/index.scss index 215e88d..982d5a7 100644 --- a/src/tabviews/commontable/mainAction/index.scss +++ b/src/tabviews/commontable/mainAction/index.scss @@ -5,6 +5,12 @@ margin-right: 15px; margin-bottom: 10px; } + .ant-spin { + position: fixed; + z-index: 1010; + left: 50vw; + top: calc(50vh - 70px); + } } // 璁剧疆妯℃�佹鏍峰紡锛岃瀹氭渶澶ф渶灏忛珮搴︼紝閲嶇疆婊氬姩鏉� .action-modal { diff --git a/src/tabviews/commontable/mainTable/index.jsx b/src/tabviews/commontable/mainTable/index.jsx index 89ddcea..1714101 100644 --- a/src/tabviews/commontable/mainTable/index.jsx +++ b/src/tabviews/commontable/mainTable/index.jsx @@ -38,15 +38,6 @@ width: item.Width || 120, render: (text, record) => { return this.getContent(item, record) - // let content = '' - // if (item.field) { - // content = record[item.field] || '' - // } - // return ( - // <div className="content" style={{ minWidth: (item.Width || 120) + 'px' }}> - // {content} - // </div> - // ) } } _columns.push(cell) @@ -57,7 +48,69 @@ } getContent = (item, record) => { - if (item.type === 'operation') { + if (item.type === 'text') { + let content = '' + let match = false + if (item.field && record.hasOwnProperty(item.field)) { + content = `${record[item.field]}` + } + + if (content && item.matchVal && content.indexOf(item.matchVal) > 0) { + match = true + } + + content = (item.prefix || '') + content + (item.postfix || '') + + return ( + <div className={match ? item.color : ''}> + <div className="background"></div> + <div className="content" style={{ minWidth: (item.Width || 120) + 'px' }}> + {content} + </div> + </div> + ) + } else if (item.type === 'number') { + let content = '' + let match = false + if (item.field && record.hasOwnProperty(item.field)) { + content = +record[item.field] + } + + if (content && item.match && item.matchVal) { + if (item.match === '>') { + if (content > item.matchVal) { + match = true + } + } else if (item.match === '<') { + if (content < item.matchVal) { + match = true + } + } else if (item.match === '>=') { + if (content >= item.matchVal) { + match = true + } + } else if (item.match === '<=') { + if (content <= item.matchVal) { + match = true + } + } + } + + if (content && item.format === 'thdSeparator') { + + } + + content = (item.prefix || '') + content + (item.postfix || '') + + return ( + <div className={match ? item.color : ''}> + <div className={'background'}></div> + <div className="content" style={{ minWidth: (item.Width || 120) + 'px' }}> + {content} + </div> + </div> + ) + } else if (item.type === 'operation') { return ( <div className={item.style} style={{ minWidth: (item.Width || 120) + 'px' }}> {item.operations.map(btn => { @@ -70,17 +123,39 @@ })} </div> ) - } else { - let content = '' - if (item.field) { - content = record[item.field] || '' + } else if (item.type === 'colspan') { + let contents = '' + if (item.subColumn.length > 0) { + contents = item.subColumn.map(col => { + let content = '' + if (col.type === 'text' || col.type === 'textarea') { + if (col.field && record.hasOwnProperty(col.field)) { + content = `${record[col.field]}` + } + + content = (col.prefix || '') + content + (col.postfix || '') + } else if (col.type === 'number') { + if (col.field && record.hasOwnProperty(col.field)) { + content = +record[col.field] + } + if (content && col.format === 'thdSeparator') { + + } + content = (col.prefix || '') + content + (col.postfix || '') + } + return content + }) } + return ( - // <div className="content" style={{ minWidth: (item.Width || 120) + 'px' }}> <div> - <div className={'background'}></div> <div className="content" style={{ minWidth: (item.Width || 120) + 'px' }}> - {content} + {contents && item.order === 'vertical' && contents.map((content, index) => { + return (<p key={index}>{content}</p>) + })} + {contents && item.order === 'horizontal' && contents.map((content, index) => { + return (<span key={index}>{content}</span>) + })} </div> </div> ) diff --git a/src/tabviews/commontable/mainTable/index.scss b/src/tabviews/commontable/mainTable/index.scss index 510e56b..01efcfc 100644 --- a/src/tabviews/commontable/mainTable/index.scss +++ b/src/tabviews/commontable/mainTable/index.scss @@ -50,15 +50,32 @@ right: 0px; bottom: 0px; } - .background.lightblue { - background: lightblue; - } + .content { position: relative; z-index: 1; word-wrap: break-word; word-break: break-word; } + .red { + .content { + color: red; + } + } + .redbg { + .background { + background: lightcoral; + } + } + } + .ant-table-tbody > tr > td .content { + p { + margin-bottom: 5px; + } + span { + display: inline-block; + margin-right: 5px; + } } } } diff --git a/src/tabviews/commontable/mutilform/index.jsx b/src/tabviews/commontable/mutilform/index.jsx index 9bf97eb..096534e 100644 --- a/src/tabviews/commontable/mutilform/index.jsx +++ b/src/tabviews/commontable/mutilform/index.jsx @@ -1,6 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Row, Col, Input, InputNumber, Select, DatePicker } from 'antd' +import { Form, Row, Col, Input, InputNumber, Select, DatePicker, notification } from 'antd' import moment from 'moment' import Utils from '@/utils/utils.js' import './index.scss' @@ -22,7 +22,8 @@ } componentDidMount () { - const { action } = this.props + let action = JSON.parse(JSON.stringify(this.props.action)) + let datatype = {} let readtype = {} let formlist = [] @@ -49,22 +50,53 @@ datatype[item.field] = item.type readtype[item.field] = item.readonly === 'true' - if (item.type === 'select' || item.type === 'link') { - if (item.setAll === 'true') { - item.options.unshift({ - key: Utils.getuuid(), - Value: '', - Text: this.props.dict['main.all'] - }) - } + return item + }) + } - if (item.resourceType === '1' && this.props.configMap.hasOwnProperty(item.uuid)) { - item.options = [...item.options, ...this.props.configMap[item.uuid]] - } - console.log(item) + formlist = formlist.map(item => { + if (item.type === 'select' || item.type === 'link') { + if (item.setAll === 'true') { + item.options.unshift({ + key: Utils.getuuid(), + Value: '', + Text: this.props.dict['main.all'] + }) } - return item + if (item.resourceType === '1' && this.props.configMap.hasOwnProperty(item.uuid)) { + item.options = [...item.options, ...this.props.configMap[item.uuid]] + } + + item.oriOptions = item.options + } + + if (!/^date/.test(item.type) && this.props.data && this.props.data.hasOwnProperty(item.field)) { + item.initval = this.props.data[item.field] + } + + return item + }) + + let error = false + + formlist = formlist.map(item => { + if (item.type === 'link') { + let supItem = formlist.filter(form => form.field === item.linkField)[0] + if (!supItem) { + error = true + } else { + item.options = item.oriOptions.filter(option => option.parentId === supItem.initval) + } + } + return item + }) + + if (error) { + notification.warning({ + top: 92, + message: '鍏宠仈鑿滃崟璁剧疆閿欒锛�', + duration: 10 }) } @@ -72,6 +104,60 @@ readtype: readtype, datatype: datatype, formlist: formlist + }) + } + + resetform = (formlist, supfields, index) => { + index++ + let subfields = [] + + supfields.forEach(supfield => { + formlist = formlist.map(item => { + if (item.type === 'link' && item.linkField === supfield.field) { + item.options = item.oriOptions.filter(option => option.parentId === supfield.initval) + item.initval = item.options[0] ? item.options[0].Value : '' + item.hiden = true + + subfields.push(item) + } + return item + }) + }) + + if (subfields.length === 0 || index > 6) { + return formlist + } else { + return this.resetform(formlist, subfields, index) + } + } + + selectChange = (_field, value) => { + let formlist = JSON.parse(JSON.stringify(this.state.formlist)) + + let subfields = [] + formlist = formlist.map(item => { + if (item.type === 'link' && item.linkField === _field.field) { + item.options = item.oriOptions.filter(option => option.parentId === value) + item.initval = item.options[0] ? item.options[0].Value : '' + item.hiden = true + + subfields.push(item) + } + return item + }) + + if (subfields.length === 0) return + + formlist = this.resetform(formlist, subfields, 0) + this.setState({ + formlist: formlist + }, () => { + this.setState({ + formlist: formlist.map(item => { + item.hiden = false + return item + }) + }) }) } @@ -88,7 +174,7 @@ } this.state.formlist.forEach((item, index) => { - if (!item.field && item.type !== 'title') return + if ((!item.field && item.type !== 'title') || item.hiden) return if (item.type === 'title') { fields.push( @@ -101,7 +187,7 @@ <Col span={24 / cols} key={index}> <Form.Item label={item.label}> {getFieldDecorator(item.field, { - initialValue: this.props.data ? this.props.data[item.field] : item.initval, + initialValue: item.initval, rules: [ { required: item.required === 'true', @@ -115,7 +201,7 @@ } else if (item.type === 'number') { // 鏁板瓧 let min = (item.min || item.min === 0) ? item.min : -Infinity let max = (item.max || item.max === 0) ? item.max : Infinity - let _initval = this.props.data ? this.props.data[item.field] : item.initval + let _initval = item.initval let precision = (item.decimal || item.decimal === 0) ? item.decimal : null fields.push( @@ -142,7 +228,7 @@ <Col span={24 / cols} key={index}> <Form.Item label={item.label}> {getFieldDecorator(item.field, { - initialValue: this.props.data ? this.props.data[item.field] : item.initval, + initialValue: item.initval, rules: [ { required: item.required === 'true', @@ -153,6 +239,7 @@ <Select showSearch filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} + onChange={(value) => {this.selectChange(item, value)}} // getPopupContainer={() => document.getElementById('form-box')} > {item.options.map(option => @@ -295,6 +382,7 @@ readonly: this.state.readtype[key], key: key, value: values[key].replace(/(^\s*|\s*$)/ig, '') + // value: values[key].replace(/[\x00-\xff]+/ig, '') }) } }) diff --git a/src/tabviews/commontable/mutilform/index.scss b/src/tabviews/commontable/mutilform/index.scss index 2d2bf0a..8ca26e5 100644 --- a/src/tabviews/commontable/mutilform/index.scss +++ b/src/tabviews/commontable/mutilform/index.scss @@ -3,7 +3,7 @@ padding: 0px 24px 20px; .ant-form-item { display: flex; - margin-bottom: 10px; + // margin-bottom: 10px; } .ant-form-item-control-wrapper { flex: 1; diff --git a/src/tabviews/datamanage/action/index.jsx b/src/tabviews/datamanage/action/index.jsx index e290de0..e01c3e6 100644 --- a/src/tabviews/datamanage/action/index.jsx +++ b/src/tabviews/datamanage/action/index.jsx @@ -198,7 +198,8 @@ if (!iserror) { notification.success({ top: 92, - message: _this.props.dict['main.action.confirm.success'] + message: _this.props.dict['main.action.confirm.success'], + duration: 2 }) _this.props.refreshdata(item.ReloadForm) // 鍒锋柊椤甸潰 @@ -207,7 +208,8 @@ if (res.status) { notification.success({ top: 92, - message: _this.props.dict['main.action.confirm.success'] + message: _this.props.dict['main.action.confirm.success'], + duration: 2 }) _this.props.refreshdata(item.ReloadForm) // 鍒锋柊椤甸潰 @@ -241,7 +243,8 @@ if (!iserror) { notification.success({ top: 92, - message: this.props.dict['main.action.confirm.success'] + message: this.props.dict['main.action.confirm.success'], + duration: 2 }) this.props.refreshdata(item.ReloadForm) // 鍒锋柊椤甸潰 @@ -250,7 +253,8 @@ if (res.status) { notification.success({ top: 92, - message: this.props.dict['main.action.confirm.success'] + message: this.props.dict['main.action.confirm.success'], + duration: 2 }) this.props.refreshdata(item.ReloadForm) // 鍒锋柊椤甸潰 @@ -410,7 +414,8 @@ if (result.status) { notification.success({ top: 92, - message: this.props.dict['main.action.confirm.success'] + message: this.props.dict['main.action.confirm.success'], + duration: 2 }) this.setState({ confirmLoading: false, diff --git a/src/tabviews/datamanage/index.jsx b/src/tabviews/datamanage/index.jsx index 220bc2a..804face 100644 --- a/src/tabviews/datamanage/index.jsx +++ b/src/tabviews/datamanage/index.jsx @@ -222,7 +222,8 @@ if (result.status) { notification.success({ top: 92, - message: this.state.dict['main.action.confirm.success'] + message: this.state.dict['main.action.confirm.success'], + duration: 2 }) this.refreshbyaction(_param.execAction.ReloadForm) // 鍒锋柊涓诲垪琛ㄩ〉闈� diff --git a/src/tabviews/tabform/index.jsx b/src/tabviews/tabform/index.jsx index 17767f1..85c495a 100644 --- a/src/tabviews/tabform/index.jsx +++ b/src/tabviews/tabform/index.jsx @@ -52,7 +52,8 @@ if (result.status) { notification.success({ top: 92, - message: this.props.param.dict['main.action.confirm.success'] + message: this.props.param.dict['main.action.confirm.success'], + duration: 2 }) // 鍒锋柊涓诲垪琛ㄩ〉闈� diff --git a/src/templates/comtableconfig/colspanform/index.jsx b/src/templates/comtableconfig/colspanform/index.jsx index ace7351..13cc7b5 100644 --- a/src/templates/comtableconfig/colspanform/index.jsx +++ b/src/templates/comtableconfig/colspanform/index.jsx @@ -31,7 +31,15 @@ } delete values.type - let _card = {...this.props.card, ...values, sublist: targetKeys} + let subfield = [] // 鐢ㄤ簬鏌ョ湅鍚堝苟鍒楀瓧娈� + this.props.columns.forEach(col => { + if (col.field && targetKeys.includes(col.uuid)) { + subfield.push(col.field) + } + }) + subfield = subfield.join(', ') + + let _card = {...this.props.card, ...values, sublist: targetKeys, subfield: subfield} resolve({ type: 'columns', diff --git a/src/templates/comtableconfig/columnform/index.jsx b/src/templates/comtableconfig/columnform/index.jsx index 17547c5..c7365a2 100644 --- a/src/templates/comtableconfig/columnform/index.jsx +++ b/src/templates/comtableconfig/columnform/index.jsx @@ -1,6 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Row, Col, Input, Select, InputNumber, Radio } from 'antd' +import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Icon } from 'antd' import './index.scss' class MainSearch extends Component { @@ -19,11 +19,11 @@ let _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width'] if (_type === 'text') { - _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'matchVal', 'color'] + _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color'] } else if (_type === 'number') { - _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'match', 'matchVal', 'color'] + _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'match', 'matchVal', 'color'] } else if (_type === 'textarea') { - _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'matchVal', 'color'] + _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color'] } this.setState({ @@ -44,11 +44,11 @@ let _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width'] if (value === 'text') { - _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'matchVal', 'color'] + _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color'] } else if (value === 'number') { - _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'match', 'matchVal', 'color'] + _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'match', 'matchVal', 'color'] } else if (value === 'textarea') { - _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'matchVal', 'color'] + _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color'] } this.setState({ @@ -85,7 +85,12 @@ if (item.type === 'text') { // 鏂囨湰鎼滅储 fields.push( <Col span={12} key={index}> - <Form.Item label={item.label}> + <Form.Item label={item.tooltip ? + <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}> + <Icon type="question-circle" /> + {item.label} + </Tooltip> : item.label + }> {getFieldDecorator(item.key, { initialValue: item.initVal || '', rules: [ diff --git a/src/templates/comtableconfig/columnform/index.scss b/src/templates/comtableconfig/columnform/index.scss index 4f7e976..8e195cf 100644 --- a/src/templates/comtableconfig/columnform/index.scss +++ b/src/templates/comtableconfig/columnform/index.scss @@ -6,4 +6,9 @@ width: 100%; } } + .anticon-question-circle { + color: #c49f47; + position: relative; + left: -3px; + } } \ No newline at end of file diff --git a/src/templates/comtableconfig/dragelement/card.jsx b/src/templates/comtableconfig/dragelement/card.jsx index d974ebf..617c5f5 100644 --- a/src/templates/comtableconfig/dragelement/card.jsx +++ b/src/templates/comtableconfig/dragelement/card.jsx @@ -7,7 +7,7 @@ const { MonthPicker, WeekPicker, RangePicker } = DatePicker -const Card = ({ id, type, card, moveCard, findCard, editCard, delCard, copyCard, hasDrop }) => { +const Card = ({ id, type, card, moveCard, findCard, editCard, delCard, copyCard, hasDrop, showfield }) => { const originalIndex = findCard(id).index const [{ isDragging }, drag] = useDrag({ item: { type: ItemTypes[type], id, originalIndex }, @@ -109,6 +109,9 @@ <Icon type="caret-down" /> </span>} </div> + {showfield ? <div className="ant-table-column-fields"> + <span className="ant-table-column-title">{card.type === 'colspan' ? card.subfield : card.field}</span> + </div> : null} </span> } </div> diff --git a/src/templates/comtableconfig/dragelement/index.jsx b/src/templates/comtableconfig/dragelement/index.jsx index 53de9b3..a0a26d7 100644 --- a/src/templates/comtableconfig/dragelement/index.jsx +++ b/src/templates/comtableconfig/dragelement/index.jsx @@ -7,7 +7,7 @@ import ItemTypes from './itemtypes' import './index.scss' -const Container = ({list, setting, gridBtn, type, placeholder, handleList, handleMenu, deleteMenu, copyElement, handleGridBtn }) => { +const Container = ({list, setting, gridBtn, type, placeholder, handleList, handleMenu, deleteMenu, copyElement, handleGridBtn, showfield }) => { let target = null const [cards, setCards] = useState(list) const moveCard = (id, atIndex) => { @@ -116,6 +116,7 @@ newcard.Width = 120 if (item.subType === 'colspan') { newcard.sublist = [] + newcard.subfield = [] newcard.IsSort = 'false' newcard.order = 'vertical' } @@ -218,6 +219,7 @@ id={`${card.uuid}`} type={type} card={card} + showfield={showfield} moveCard={moveCard} editCard={editCard} delCard={delCard} diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index e0fe8b5..cec7cb8 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -60,9 +60,10 @@ tables: [], // 鍙敤琛ㄥ悕 selectedTables: [], // 宸查�夎〃鍚� originMenu: null, // 鍘熷鑿滃崟 - originActions: null, - delActions: [], - funcLoading: false + originActions: null, // 鍘熷鎸夐挳淇℃伅锛屼娇鐢ㄥ凡鏈夌敤鎴锋ā鏉� + delActions: [], // 鍒犻櫎鎸夐挳鍒楄〃 + funcLoading: false, // 瀛樺偍杩囩▼鍒涘缓涓� + showColumnName: false // 鏄剧ず鍒楀瓧娈靛悕鎺у埗 } /** @@ -844,6 +845,16 @@ readonly: false }, { + type: 'text', + key: 'postfix', + label: this.state.dict['header.form.postfix'], + initVal: card.postfix || '', + // tooltip: '鍚庣紑鍊艰缃负"\\n",琛ㄧず鎹㈣', + tooltipClass: 'middle', + required: false, + readonly: false + }, + { type: 'select', key: 'match', label: this.state.dict['header.form.match'], @@ -863,9 +874,6 @@ }, { MenuID: '<=', text: '<=' - }, { - MenuID: 'between', - text: 'between' }], required: false }, @@ -1298,7 +1306,7 @@ notification.success({ top: 92, message: '鍒涘缓鎴愬姛', - duration: 5 + duration: 2 }) return true } @@ -1642,7 +1650,7 @@ notification.success({ top: 92, message: '淇濆瓨鎴愬姛', - duration: 10 + duration: 2 }) if (this.state.closeVisible) { this.props.handleConfig('') @@ -1905,7 +1913,7 @@ notification.success({ top: 92, message: '鎿嶄綔鎴愬姛', - duration: 5 + duration: 2 }) this.setState({ [addType + 'loading']: false @@ -2093,6 +2101,14 @@ }) } + onColumnNameChange = () => { + const { showColumnName } = this.state + + this.setState({ + showColumnName: !showColumnName + }) + } + render () { const configAction = this.state.config.action.filter(_action => !_action.origin && (_action.OpenType === 'pop' || _action.OpenType === 'popview' || _action.OpenType === 'blank' || _action.OpenType === 'tab') @@ -2242,6 +2258,7 @@ <Tooltip placement="bottomLeft" overlayClassName="middle" title="鍦ㄥ乏渚у伐鍏锋爮銆婃樉绀哄垪銆嬩腑锛岄�夋嫨瀵瑰簲绫诲瀷鐨勬樉绀哄垪鎷栬嚦姝ゅ娣诲姞锛涙垨鐐瑰嚮銆婃坊鍔犳樉绀哄垪銆嬫寜閽壒閲忔坊鍔狅紝閫夋嫨鎵归噺娣诲姞鏃讹紝闇�鎻愬墠閫夋嫨浣跨敤琛ㄣ�傛敞锛氭坊鍔犲悎骞跺垪鏃讹紝闇�璁剧疆鍙�夊垪銆�"> <Icon type="question-circle" /> </Tooltip> + <Switch checkedChildren="寮�" unCheckedChildren="鍏�" defaultChecked={this.state.showColumnName} onChange={this.onColumnNameChange} /> {!this.state.columnsloading ? <DragElement list={this.state.config.columns} @@ -2253,6 +2270,7 @@ handleMenu={this.handleColumn} deleteMenu={this.deleteElement} handleGridBtn={this.handleGridBtn} + showfield={this.state.showColumnName} /> : null } </div> diff --git a/src/templates/comtableconfig/index.scss b/src/templates/comtableconfig/index.scss index e5c99e6..e76a155 100644 --- a/src/templates/comtableconfig/index.scss +++ b/src/templates/comtableconfig/index.scss @@ -286,7 +286,13 @@ } } .column-list { + position: relative; padding: 0px 20px; + .ant-switch { + position: absolute; + right: 20px; + top: -10px; + } > .ant-row { background: #fafafa; border-radius: 4px; @@ -303,9 +309,15 @@ padding: 0px; min-height: 45px; > div { - padding: 12px 8px; + padding: 12px 0px 0px; cursor: move; height: 100%; + .ant-table-column-sorters { + padding: 0px 8px 12px; + } + .ant-table-column-fields { + padding: 0px 8px 5px; + } } .ant-table-column-sorter { position: relative; diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx index cf0a7cb..4d376e7 100644 --- a/src/templates/modalconfig/index.jsx +++ b/src/templates/modalconfig/index.jsx @@ -626,7 +626,7 @@ notification.success({ top: 92, message: '淇濆瓨鎴愬姛', - duration: 10 + duration: 2 }) } else { this.setState({ -- Gitblit v1.8.0