From 7051e15582aee4163b3c8dd13dc85f4f1e2ce6eb Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 07 二月 2020 02:11:43 +0800 Subject: [PATCH] 2020-02-07 --- src/tabviews/formtab/index.scss | 118 ++++ src/tabviews/formtab/index.jsx | 466 +++++-------------- src/tabviews/formtab/actionList/index.jsx | 577 ++++++++++++++++++++++++ src/tabviews/formtab/formgroup/index.jsx | 165 ++---- src/tabviews/subtable/index.jsx | 7 src/tabviews/subtabtable/index.jsx | 7 src/tabviews/commontable/index.jsx | 6 src/tabviews/formtab/actionList/index.scss | 42 + src/templates/comtableconfig/index.jsx | 8 src/templates/subtableconfig/index.jsx | 15 src/tabviews/tableshare/actionList/index.jsx | 2 11 files changed, 956 insertions(+), 457 deletions(-) diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index 7861c7e..aaad835 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -407,7 +407,8 @@ let param = { func: 'sPC_Get_TableData', obj_name: 'data', - arr_field: arr_field + arr_field: arr_field, + appkey: window.GLOB.appkey || '' } let orderBy = orderColumn ? (orderColumn + ' ' + orderType) : setting.order @@ -606,7 +607,8 @@ let param = { func: 'sPC_Get_TableData', obj_name: 'data', - arr_field: _arr_labels + arr_field: _arr_labels, + appkey: window.GLOB.appkey || '' } let orderBy = orderColumn ? (orderColumn + ' ' + orderType) : setting.order diff --git a/src/tabviews/formtab/actionList/index.jsx b/src/tabviews/formtab/actionList/index.jsx new file mode 100644 index 0000000..52a82ef --- /dev/null +++ b/src/tabviews/formtab/actionList/index.jsx @@ -0,0 +1,577 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import moment from 'moment' +import { Button, Modal, notification, Spin, message } from 'antd' +import Utils from '@/utils/utils.js' +import Api from '@/api' +import './index.scss' + +const { confirm } = Modal + +class MainAction extends Component { + static propTpyes = { + BData: PropTypes.any, // 涓昏〃鏁版嵁 + type: PropTypes.string, // 鍒ゆ柇褰撳墠涓轰富琛紙main锛夈�佸瓙琛紙sub锛夈�佸瓙琛ㄦ爣绛撅紙subtab锛� + MenuID: PropTypes.string, // 鑿滃崟ID + actions: PropTypes.array, // 鎸夐挳缁� + logcolumns: PropTypes.array, // 鏃ュ織涓樉绀哄垪 + dict: PropTypes.object, // 瀛楀吀椤� + setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 + triggerPopview: PropTypes.func // 寮圭獥鏍囩椤佃Е鍙� + } + + state = { + visible: false, + formdata: null, + tabledata: null, + confirmLoading: false, + loadingUuid: '', + btnloading: false + } + + /** + * @description 瑙﹀彂鎸夐挳鎿嶄綔 + */ + actionTrigger = (item, record) => { + const { setting } = this.props + + let _this = this + let data = this.props.gettableselected() || [] + + if (record) { // 琛ㄦ牸涓Е鍙戞寜閽� + data = [record] + } + + if (item.Ot !== 'notRequired' && data.length === 0) { + // 闇�瑕侀�夋嫨琛屾椂锛屾牎楠屾暟鎹� + notification.warning({ + top: 92, + message: this.props.dict['main.action.confirm.selectline'], + duration: 10 + }) + return + } else if (item.Ot === 'requiredSgl' && data.length !== 1) { + // 闇�瑕侀�夋嫨鍗曡鏃讹紝鏍¢獙鏁版嵁 + notification.warning({ + top: 92, + message: this.props.dict['main.action.confirm.selectSingleLine'], + duration: 10 + }) + return + } else if (item.Ot !== 'notRequired' && !setting.primaryKey) { + // 闇�瑕侀�夋嫨琛屾椂锛屾牎楠屾槸鍚﹁缃富閿� + notification.warning({ + top: 92, + message: '鏈缃富閿紒', + duration: 10 + }) + return + } + + if (item.OpenType === 'prompt') { + confirm({ + title: this.props.dict['main.action.confirm.tip'], + onOk() { + return new Promise(resolve => { + _this.execSubmit(item, data, resolve) + }) + }, + onCancel() {} + }) + } else if (item.OpenType === 'exec') { + this.setState({loadingUuid: item.uuid}) + this.execSubmit(item, data, () => { + this.setState({loadingUuid: ''}) + }) + } else if (item.OpenType === 'pop') { + this.setState({ + tabledata: data, + btnloading: true + }) + } else { + notification.warning({ + top: 92, + message: '瀹屽杽涓�傘�傘��', + duration: 10 + }) + } + } + + /** + * @description 鎸夐挳鎻愪氦鎵ц + */ + execSubmit = (btn, data, _resolve, formdata) => { + const { setting, logcolumns } = this.props + + if (btn.intertype === 'inner') { + // 浣跨敤鍐呴儴鎺ュ彛鏃讹紝鍐呴儴鍑芥暟鍜屾暟鎹簮涓嶅彲鍚屾椂涓虹┖, 浣跨敤绯荤粺鍑芥暟鏃讹紝绫诲瀷涓嶅彲涓虹┖ + if (!btn.innerFunc && (!btn.sql || (btn.sql && !btn.sqlType))) { + this.actionSettingError() + _resolve() + return + } + + // 鎵ц鏂瑰紡涓哄琛屾嫾鎺ワ紝涓旀墦寮�鏂瑰紡涓鸿〃鍗曟椂锛屼細杞负寰幆鍙戦�佽姹� + // 鎵撳紑鏂瑰紡涓烘ā鎬佹锛屼娇鐢ㄥ唴閮ㄥ嚱鏁版坊鍔� + if ( + btn.Ot === 'notRequired' || + btn.Ot === 'requiredSgl' || + (btn.Ot === 'requiredOnce' && btn.OpenType !== 'pop') || + (btn.OpenType === 'pop' && !btn.innerFunc && btn.sql && btn.sqlType === 'insert') + ) { + + // 鍒涘缓鍑瘉鏃讹紝闇�瑕侀�夋嫨琛屾椂 + if (data.length === 0 && !btn.innerFunc && btn.verify && btn.verify.voucher && btn.verify.voucher.enabled) { + notification.warning({ + top: 92, + message: '浣跨敤鍒涘缓鍑瘉鍑芥暟锛岄渶瑕侀�夋嫨琛岋紒', + duration: 10 + }) + return + } + + let param = { // 绯荤粺瀛樺偍杩囩▼ + func: 'sPC_TableData_InUpDe', + BID: '' + } + let primaryId = setting.primaryKey && data[0] ? (data[0][setting.primaryKey] || '') : '' + + if (btn.OpenType === 'prompt' || btn.OpenType === 'exec') { // 鏄惁寮规鎴栫洿鎺ユ墽琛� + let ID = '' + if (btn.Ot === 'notRequired') { + + } else if (btn.Ot === 'requiredSgl') { + ID = data[0][setting.primaryKey] + } else if (btn.Ot === 'requiredOnce') { // id鍊兼嫾鎺� + let ids = data.map(d => { return d[setting.primaryKey]}) + ID = ids.join(',') + } + + if (btn.innerFunc) { // 浣跨敤鑷畾涔夊嚱鏁� + param.func = btn.innerFunc + if (setting.primaryKey) { // 涓婚敭瀛樺湪鏃讹紝璁剧疆涓婚敭鍙傛暟 + param[setting.primaryKey] = ID + } + } else if (btn.sql) { + param.ID = primaryId + param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, '', param, data[0], logcolumns)) // 鏁版嵁婧� + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + param.secretkey = Utils.encrypt(param.LText, param.timestamp) + } + } else if (btn.OpenType === 'pop') { // 琛ㄥ崟 + if (btn.innerFunc) { + param.func = btn.innerFunc + + if (setting.primaryKey) { // 涓婚敭瀛樺湪鏃讹紝璁剧疆涓婚敭鍙傛暟 + param[setting.primaryKey] = primaryId + } + + formdata.forEach(_data => { + param[_data.key] = _data.value + }) + + } else if (btn.sql && btn.sqlType === 'insert') { // 绯荤粺鍑芥暟娣诲姞鏃讹紝鐢熸垚uuid + param.ID = Utils.getguid() + param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata, param, data[0], logcolumns)) // 鏁版嵁婧� + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + param.secretkey = Utils.encrypt(param.LText, param.timestamp) + } else if (btn.sql) { + param.ID = primaryId + param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata, param, data[0], logcolumns)) // 鏁版嵁婧� + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + param.secretkey = Utils.encrypt(param.LText, param.timestamp) + } + } + + Api.genericInterface(param).then((res) => { + if (res.status) { + this.execSuccess(btn, res) + } else { + this.execError(res, btn) + } + _resolve() + }) + } else if (btn.Ot === 'required' || (btn.Ot === 'requiredOnce' && btn.OpenType === 'pop')) { + let _params = data.map(cell => { + let param = { + func: 'sPC_TableData_InUpDe', + BID: '' + } + let primaryId = setting.primaryKey ? cell[setting.primaryKey] : '' + + if (btn.OpenType === 'prompt' || btn.OpenType === 'exec') { // 鏄惁寮规鎴栫洿鎺ユ墽琛� + + if (btn.innerFunc) { + param.func = btn.innerFunc + if (setting.primaryKey) { + param[setting.primaryKey] = primaryId + } + } else if (btn.sql) { + param.ID = primaryId + param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, '', param, cell, logcolumns)) // 鏁版嵁婧� + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + param.secretkey = Utils.encrypt(param.LText, param.timestamp) + } + } else if (btn.OpenType === 'pop') { // 琛ㄥ崟 + if (btn.innerFunc) { + param.func = btn.innerFunc + + formdata.forEach(_data => { + param[_data.key] = _data.value + }) + + if (setting.primaryKey) { + param[setting.primaryKey] = primaryId + } + } else if (btn.sql) { + param.ID = primaryId + param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata, param, cell, logcolumns)) // 鏁版嵁婧� + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + param.secretkey = Utils.encrypt(param.LText, param.timestamp) + } + } + + return param + }) + + if (_params.length <= 20) { + let deffers = _params.map(param => { + return new Promise(resolve => { + Api.genericInterface(param).then(res => { + resolve(res) + }) + }) + }) + Promise.all(deffers).then(result => { + let iserror = false + let errorMsg = '' + result.forEach(res => { + if (res.status) { + errorMsg = res + } else { + iserror = true + errorMsg = res + } + }) + if (!iserror) { + this.execSuccess(btn, errorMsg) + } else { + this.execError(errorMsg, btn) + } + _resolve() + }) + } else { // 瓒呭嚭20涓姹傛椂寰幆鎵ц + this.innerLoopRequest(_params, btn, _resolve) + } + } else { + this.actionSettingError() + _resolve() + return + } + } else if (btn.intertype === 'outer') { + /** *********************璋冪敤澶栭儴鎺ュ彛************************* */ + + if (!btn.interface) { // 鎺ュ彛鍦板潃涓嶅瓨鍦ㄦ椂鎶ラ敊 + this.actionSettingError() + _resolve() + return + } + + let _params = [] // 璇锋眰鍙傛暟鏁扮粍 + + if (btn.Ot === 'notRequired' || btn.Ot === 'requiredSgl' || btn.Ot === 'requiredOnce') { + let param = { + BID: '' + } + + if (btn.OpenType === 'pop' && formdata) { // 琛ㄥ崟 + formdata.forEach(_data => { + param[_data.key] = _data.value + }) + } + + // 鑾峰彇id + if (btn.Ot === 'notRequired') { + + } else if (btn.Ot === 'requiredSgl' && setting.primaryKey) { + param[setting.primaryKey] = data[0][setting.primaryKey] + } else if (btn.Ot === 'requiredOnce' && setting.primaryKey) { + let ids = data.map(d => { return d[setting.primaryKey]}) + param[setting.primaryKey] = ids.join(',') + } + + _params.push(param) + } else if (btn.Ot === 'required') { + // 閫夋嫨澶氳锛屽惊鐜皟鐢� + + let _formparam = {} + if (btn.OpenType === 'pop' && formdata) { // 琛ㄥ崟 + formdata.forEach(_data => { + _formparam[_data.key] = _data.value + }) + } + + _params = data.map(cell => { + let _cell = { + BID: '', + } + if (setting.primaryKey) { + _cell[setting.primaryKey] = cell[setting.primaryKey] + } + + _cell = {..._formparam, ..._cell} + + return _cell + }) + } else { + this.actionSettingError() + _resolve() + return + } + + // 寰幆璋冪敤澶栭儴鎺ュ彛锛堝寘鎷唴閮ㄥ強鍥炶皟鍑芥暟锛� + this.outerLoopRequest(_params, btn, _resolve) + + } else { + this.actionSettingError() + _resolve() + return + } + } + + /** + * @description 鍐呴儴璇锋眰寰幆鎵ц + */ + innerLoopRequest = (params, btn, _resolve) => { + if (!params && params.length === 0) return + + let param = params.shift() + + Api.genericInterface(param).then(res => { + if (res.status) { + if (params.length === 0) { + this.execSuccess(btn, res) + _resolve() + } else { + this.innerLoopRequest(params, btn, _resolve) + } + } else { + this.execError(res, btn) + _resolve() + } + }) + } + + /** + * @description 澶栭儴璇锋眰寰幆鎵ц + */ + outerLoopRequest = (params, btn, _resolve) => { + if (!params && params.length === 0) return + + let param = params.shift() + let _outParam = null + + new Promise(resolve => { + // 鍐呴儴璇锋眰 + if (btn.innerFunc) { + param.func = btn.innerFunc + // 瀛樺湪鍐呴儴鍑芥暟鏃讹紝鏁版嵁棰勫鐞� + Api.genericInterface(param).then(res => { + if (res.status) { + delete res.ErrCode + delete res.ErrMesg + delete res.message + delete res.status + + // 浣跨敤澶勭悊鍚庣殑鏁版嵁璋冪敤澶栭儴鎺ュ彛 + resolve(res) + } else { + this.execError(res, btn) + resolve(false) + _resolve() + } + }) + } else { + resolve(param) + } + }).then(res => { + if (!res) return + // 澶栭儴璇锋眰 + _outParam = JSON.parse(JSON.stringify(res)) + + if (btn.sysInterface === 'true') { + res.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi + } else { + res.rduri = btn.interface + } + // res.method = btn.method + if (btn.outerFunc) { + res.func = btn.outerFunc + } + + res.appkey = window.GLOB.appkey || '' // 澶栭儴璇锋眰鏃讹紝缁熶竴娣诲姞appkey + + return Api.genericInterface(res) + }).then(response => { + if (!response) return + // 鍥炶皟璇锋眰 + if (btn.callbackFunc) { + // 瀛樺湪鍥炶皟鍑芥暟鏃讹紝璋冪敤 + delete response.message + delete response.status + + response.func = btn.callbackFunc + + let _callbackparam = {..._outParam, ...response} + return Api.genericInterface(_callbackparam) + } else { + if (response.status) { + // 涓�娆¤姹傛垚鍔燂紝杩涜涓嬩竴椤硅姹� + + if (params.length === 0) { + this.execSuccess(btn, response) + _resolve() + } else { + this.outerLoopRequest(params, btn, _resolve) + } + } else { + this.execError(response, btn) + _resolve() + } + } + }).then(res => { + if (!res) return + + if (res.status) { + if (params.length === 0) { + this.execSuccess(btn, res) + _resolve() + } else { + this.outerLoopRequest(params, btn, _resolve) + } + } else { + this.execError(res, btn) + _resolve() + } + }) + } + + /** + * @description 鎿嶄綔鎴愬姛鍚庡鐞� + * 1銆乪xcel瀵煎嚭锛屾垚鍔熷悗鍙栨秷瀵煎嚭鎸夐挳鍔犺浇涓姸鎬� + * 2銆佺姸鎬佺爜涓� S 鏃讹紝鏄剧ず鎴愬姛淇℃伅鍚庣郴缁熼粯璁や俊鎭� + * 3銆佺姸鎬佺爜涓� -1 鏃讹紝涓嶆樉绀轰换浣曚俊鎭� + * 4銆佹ā鎬佹鎵ц鎴愬姛鍚庢槸鍚﹀叧闂� + * 5銆侀�氱煡涓诲垪琛ㄥ埛鏂� + */ + execSuccess = (btn, res) => { + if (btn.OpenType === 'excelOut') { // 瀵煎嚭excel + this.setState({ + loadingUuid: '' + }) + } else if (res && res.ErrCode === 'S') { // 鎵ц鎴愬姛 + notification.success({ + top: 92, + message: res.ErrMesg || this.props.dict['main.action.confirm.success'], + duration: 2 + }) + } else if (res && res.ErrCode === '-1') { // 瀹屾垚鍚庝笉鎻愮ず + + } + + if (btn.OpenType === 'pop' && btn.setting && btn.setting.finish !== 'unclose') { + this.setState({ + visible: false + }) + } + + this.props.refreshdata(btn, 'success') + } + + /** + * @description 鎿嶄綔澶辫触鍚庡鐞� + * 1銆佺姸鎬佺爜涓� E銆丯銆丗銆丯M 鏃讹紝鏄剧ず鐩稿簲鎻愮ず淇℃伅 + * 2銆乪xcel瀵煎嚭锛屽け璐ュ悗鍙栨秷瀵煎嚭鎸夐挳鍔犺浇涓姸鎬� + * 3銆侀�氱煡涓诲垪琛ㄥ埛鏂� + */ + execError = (res, btn) => { + if (res.ErrCode === 'E') { + Modal.error({ + title: res.message || res.ErrMesg, + }) + } else if (res.ErrCode === 'N') { + notification.error({ + top: 92, + message: res.message || res.ErrMesg, + duration: btn.errorTime || 15 + }) + } else if (res.ErrCode === 'F') { + notification.error({ + className: 'notification-custom-error', + top: 92, + message: res.message || res.ErrMesg, + duration: btn.errorTime || 15 + }) + } else if (res.ErrCode === 'NM') { + message.error(res.message || res.ErrMesg) + } + + this.props.refreshdata(btn, 'error') + } + + /** + * @description 鎸夐挳閰嶇疆淇℃伅閿欒鎻愮ず + */ + actionSettingError = () => { + notification.warning({ + top: 92, + message: this.props.dict['main.action.settingerror'], + duration: 10 + }) + } + + + render() { + const { loadingUuid, btnloading } = this.state + + return ( + <div className="button-list toolbar-button"> + {this.props.actions.map((item, index) => { + if (loadingUuid === item.uuid) { + return ( + <Button + className={'mk-btn mk-' + item.class} + icon={item.icon} + key={'action' + index} + onClick={() => {this.actionTrigger(item)}} + loading + >{item.label}</Button> + ) + } else { + return ( + <Button + className={'mk-btn mk-' + item.class} + icon={item.icon} + key={'action' + index} + onClick={() => {this.actionTrigger(item)}} + >{item.label}</Button> + ) + } + })} + <Button + className={'mk-btn'} + // icon={item.icon} + onClick={() => {this.actionTrigger()}} + >纭畾</Button> + <Button + className={'mk-btn'} + // icon={item.icon} + onClick={() => {this.actionTrigger()}} + >杩斿洖</Button> + {btnloading && <Spin size="large" />} + </div> + ) + } +} + +export default MainAction \ No newline at end of file diff --git a/src/tabviews/formtab/actionList/index.scss b/src/tabviews/formtab/actionList/index.scss new file mode 100644 index 0000000..1d576f0 --- /dev/null +++ b/src/tabviews/formtab/actionList/index.scss @@ -0,0 +1,42 @@ +.button-list.toolbar-button { + padding: 10px 20px 5px; + background: #ffffff; + button { + min-width: 65px; + margin-right: 15px; + margin-bottom: 10px; + } + .ant-spin { + position: fixed; + z-index: 1010; + left: calc(50vw - 22px); + top: calc(50vh - 70px); + } +} +// 璁剧疆妯℃�佹鏍峰紡锛岃瀹氭渶澶ф渶灏忛珮搴︼紝閲嶇疆婊氬姩鏉� +.action-modal { + .ant-modal { + max-width: 95vw; + } + .ant-modal-body { + max-height: calc(100vh - 235px); + min-height: 150px; + overflow-y: auto; + padding-bottom: 35px; + } + .ant-modal-body::-webkit-scrollbar { + width: 10px; + height: 10px; + } + .ant-modal-body::-webkit-scrollbar-thumb { + border-radius: 5px; + box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.13); + background: rgba(0, 0, 0, 0.13); + } + .ant-modal-body::-webkit-scrollbar-track { + box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05); + border-radius: 3px; + border: 1px solid rgba(0, 0, 0, 0.07); + background: rgba(0, 0, 0, 0); + } +} \ No newline at end of file diff --git a/src/tabviews/formtab/formgroup/index.jsx b/src/tabviews/formtab/formgroup/index.jsx index b7d9516..906308d 100644 --- a/src/tabviews/formtab/formgroup/index.jsx +++ b/src/tabviews/formtab/formgroup/index.jsx @@ -1,6 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Row, Col, Input, InputNumber, Select, DatePicker, notification } from 'antd' +import { Form, Row, Col, Input, InputNumber, Select, DatePicker, notification, Collapse } from 'antd' import moment from 'moment' import { formRule } from '@/utils/option.js' import Utils from '@/utils/utils.js' @@ -9,13 +9,14 @@ const {MonthPicker} = DatePicker const { TextArea } = Input +const { Panel } = Collapse class MainSearch extends Component { static propTpyes = { - action: PropTypes.object, // 鎸夐挳淇℃伅銆佽〃鍗曞垪琛� + setting: PropTypes.object, // 鍩烘湰淇℃伅 + groups: PropTypes.array, // 琛ㄥ崟缁� dict: PropTypes.object, // 瀛楀吀椤� data: PropTypes.any, // 琛ㄦ牸鏁版嵁 - BData: PropTypes.any, // 涓昏〃鏁版嵁 configMap: PropTypes.object, // 鎸夐挳鍙婁笅鎷夎〃鍗曢厤缃俊鎭泦 inputSubmit: PropTypes.func // input鍥炶溅鎻愪氦 } @@ -27,90 +28,50 @@ } componentDidMount () { - const { data, BData } = this.props - let action = JSON.parse(JSON.stringify(this.props.action)) + const { data, groups } = this.props let datatype = {} let readtype = {} - let formlist = [] - if (action.groups.length > 0) { - action.groups.forEach(group => { - if (group.sublist.length === 0) return + let _formlist = [] - if (!group.default) { - formlist.push({ - type: 'title', - label: group.label, - uuid: group.uuid - }) - } - - group.sublist.forEach(item => { - datatype[item.field] = item.type - readtype[item.field] = item.readonly === 'true' - formlist.push(item) - }) - }) - } else { - formlist = action.fields.map(item => { + let _groups = groups.map(group => { + group.sublist = group.sublist.map(item => { datatype[item.field] = item.type readtype[item.field] = item.readonly === 'true' + + if (!/^date/.test(item.type) && data && data.hasOwnProperty(item.field)) { + item.initval = data[item.field] + } + + _formlist.push(item) return item }) - } - let _inputfields = formlist.filter(item => item.type === 'text' || item.type === 'number') // 鐢ㄤ簬杩囨护涓嬫媺鑿滃崟鍏宠仈琛ㄥ崟 - - formlist = formlist.map(item => { - if (item.type === 'select' || item.type === 'link' || item.type === 'multiselect') { - if (item.setAll === 'true') { - item.options.unshift({ - key: Utils.getuuid(), - Value: '', - Text: this.props.dict['main.all'] - }) - } - - if (item.resourceType === '1' && this.props.configMap.hasOwnProperty(item.uuid)) { - item.options = [...item.options, ...this.props.configMap[item.uuid]] - } - - item.oriOptions = JSON.parse(JSON.stringify(item.options)) - - if (item.linkSubField && item.linkSubField.length > 0) { - let _fields = _inputfields.map(_item => _item.field) - item.linkSubField = item.linkSubField.filter(_item => _fields.includes(_item)) - } - } - - if (item.type === 'linkMain' && BData && BData.hasOwnProperty(item.field)) { - item.initval = BData[item.field] - } else if (!/^date/.test(item.type) && this.props.data && this.props.data.hasOwnProperty(item.field)) { - item.initval = this.props.data[item.field] - } - - return item + return group }) let error = false - formlist = formlist.map(item => { - if (item.type === 'link') { - let supItem = formlist.filter(form => form.field === item.linkField)[0] - - if (!supItem && data && data.hasOwnProperty(item.linkField)) { - supItem = {initval: data[item.linkField]} + _groups = _groups.map(group => { + group.sublist = group.sublist.map(item => { + if (item.type === 'link') { + let supItem = _formlist.filter(form => form.field === item.linkField)[0] + + if (!supItem && data && data.hasOwnProperty(item.linkField)) { + supItem = {initval: data[item.linkField]} + } + + if (!supItem) { + error = true + } else { + item.options = item.oriOptions.filter(option => option.parentId === supItem.initval) + } } - - if (!supItem) { - error = true - } else { - item.options = item.oriOptions.filter(option => option.parentId === supItem.initval) - } - } + return item + }) - return item + return group }) if (error) { @@ -124,21 +85,8 @@ this.setState({ readtype: readtype, datatype: datatype, - formlist: formlist - }, () => { - if (action.setting && action.setting.focus) { - try { - let _form = document.getElementById('main-form-box') - let _item = _form.getElementsByTagName('input') - _item = [..._item] - _item.forEach(input => { - if (!input || input.id !== action.setting.focus) return - input.select() - }) - } catch { - console.warn('琛ㄥ崟鑾峰彇澶辫触锛�') - } - } + formlist: _formlist, + groups: _groups }) } @@ -204,28 +152,22 @@ }) } - getFields() { + getFields(formlist) { const { getFieldDecorator } = this.props.form const fields = [] let cols = 2 - if (this.props.action.setting && this.props.action.setting.cols) { - cols = parseInt(this.props.action.setting.cols) + if (this.props.setting && this.props.setting.cols) { + cols = parseInt(this.props.setting.cols) if (cols > 3 || cols < 1) { cols = 2 } } - this.state.formlist.forEach((item, index) => { - if ((!item.field && item.type !== 'title') || item.hidden === 'true') return + formlist.forEach((item, index) => { + if (item.hidden === 'true') return - if (item.type === 'title') { - fields.push( - <Col span={24} key={index}> - <p>{item.label}</p> - </Col> - ) - } else if (item.type === 'text') { + if (item.type === 'text') { fields.push( <Col span={24 / cols} key={index}> <Form.Item label={item.label}> @@ -395,7 +337,6 @@ } ] })( - // <DatePicker showTime getCalendarContainer={() => document.getElementById('form-box')} /> <DatePicker showTime /> )} </Form.Item> @@ -453,15 +394,7 @@ </Col> ) } else if (item.type === 'funcvar') { - // fields.push( - // <Col span={24 / cols} key={index}> - // <Form.Item label={item.label}> - // {getFieldDecorator(item.field, { - // initialValue: item.linkfield || '', - // })(<Input placeholder="" autoComplete="off" disabled={item.readonly === 'true'} />)} - // </Form.Item> - // </Col> - // ) + } else if (item.type === 'textarea') { let _labelcol = cols !== 3 ? 8 / cols : 3 let _wrapcol = cols !== 3 ? 16 + (cols - 1) * 4 : 21 @@ -619,6 +552,7 @@ } render() { + const { groups } = this.props const formItemLayout = { labelCol: { xs: { span: 24 }, @@ -629,9 +563,20 @@ sm: { span: 16 } } } + + let keys = groups.map(group => group.uuid) return ( - <Form {...formItemLayout} className="ant-advanced-search-form main-form-field" id="main-form-box"> - <Row gutter={24}>{this.getFields()}</Row> + <Form {...formItemLayout}> + <Collapse + defaultActiveKey={keys} + expandIconPosition='right' + > + {groups.map(group => + <Panel header={group.label} key={group.uuid}> + <Row gutter={24}>{this.getFields(group.sublist)}</Row> + </Panel> + )} + </Collapse> </Form> ) } diff --git a/src/tabviews/formtab/index.jsx b/src/tabviews/formtab/index.jsx index 84aca6d..98b0f19 100644 --- a/src/tabviews/formtab/index.jsx +++ b/src/tabviews/formtab/index.jsx @@ -2,7 +2,7 @@ import PropTypes from 'prop-types' import {connect} from 'react-redux' import { is, fromJS } from 'immutable' -import { BackTop, notification, Spin, Tabs, Icon, Modal, Button} from 'antd' +import { BackTop, notification, Spin, Tabs, Icon} from 'antd' import moment from 'moment' import Api from '@/api' @@ -11,14 +11,12 @@ import Utils from '@/utils/utils.js' import FormGroup from './formgroup' -import MainAction from '@/tabviews/tableshare/actionList' +import FormAction from './actionList' import SubTable from '@/tabviews/subtable' import NotFount from '@/components/404' -import asyncComponent from '@/utils/asyncLoadComponent' import {refreshTabView} from '@/store/action' import './index.scss' -const SubTabTable = asyncComponent(() => import('@/tabviews/subtabtable')) const { TabPane } = Tabs class NormalTable extends Component { @@ -35,22 +33,16 @@ viewlost: false, // 椤甸潰涓㈠け锛�1銆佹湭鑾峰彇鍒伴厤缃�-椤甸潰涓㈠け锛�2銆侀〉闈㈡湭鍚敤 lostmsg: '', // 椤甸潰涓㈠け鏃剁殑鎻愮ず淇℃伅 config: {}, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷寜閽�佽〃鍗曘�佹爣绛剧瓑 + groups: null, // 琛ㄥ崟缁� actions: null, // 鎸夐挳闆� arr_field: '', // 浣跨敤 sPC_Get_TableData 鏃剁殑鏌ヨ瀛楁闆� setting: null, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 data: null, // 鍒楄〃鏁版嵁闆� - loading: false, // 鍒楄〃鏁版嵁鍔犺浇涓� - pageIndex: 1, // 椤电爜 - pageSize: 10, // 姣忛〉鏁版嵁鏉℃暟 - orderColumn: '', // 鎺掑簭瀛楁 - orderType: 'asc', // 鎺掑簭鏂瑰紡 - search: '', // 鎼滅储鏉′欢鏁扮粍锛屼娇鐢ㄦ椂闇�鍒嗗満鏅鐞� configMap: {}, // 椤甸潰閰嶇疆淇℃伅锛氫笅鎷夈�佹寜閽瓑 BIDs: {}, // 涓婄骇琛╥d setsingle: false, // 涓昏〃鍗曢�夊閫夊垏鎹� pickup: false, // 涓昏〃鏁版嵁闅愯棌鏄剧ず鍒囨崲 isLinkMain: false, // 鏄惁瀛樺湪涓庝富琛ㄥ叧鑱旂殑瀛愯〃 - popAction: false, // 寮规椤甸潰锛屾寜閽俊鎭� popData: false, // 寮规椤甸潰锛屾墍閫夌殑琛ㄦ牸鏁版嵁 visible: false // 寮规鏄剧ず闅愯棌鎺у埗 } @@ -109,7 +101,7 @@ }) _arrField = _arrField.join(',') } - console.log(config) + // 鏉冮檺杩囨护 config.action = config.action.filter(item => permAction[item.uuid]) // config.tabgroups.forEach(group => { @@ -139,19 +131,33 @@ } }) + let _data = null + let _isCustomData = false + + if (this.props.param && this.props.param.data) { + _data = this.props.param.data + } + + if ((config.setting.interType === 'inner' && config.setting.innerFunc) || (config.setting.interType === 'outer' && config.setting.interface)) { + _isCustomData = true + _data = null + } + + this.setState({ - loadingview: false, config: config, setting: config.setting, actions: config.action, isLinkMain: _isLinkMain, arr_field: _arrField, - search: Utils.initMainSearch(config.search), // 鎼滅储鏉′欢鍒濆鍖栵紙鍚湁鏃堕棿鏍煎紡锛岄渶瑕佽浆鍖栵級 - loading: true + data: _data, + BIDs: { + mainTable: (!_isCustomData && _data && _data[0] && _data[0][config.setting.primaryKey]) || '' + } }, () => { - this.improveSearch() + this.improveSelectOption(config.groups) - if (config.setting.onload !== 'false') { + if (_isCustomData) { this.loadmaindata() } }) @@ -169,77 +175,87 @@ } /** - * @description 鎼滅储鏉′欢涓嬫媺閫夐」棰勫姞杞� + * @description 琛ㄥ崟涓嬫媺閫夐」鍔犺浇 */ - improveSearch = () => { - let searchlist = JSON.parse(JSON.stringify(this.state.searchlist)) + improveSelectOption = (groups) => { let deffers = [] - searchlist.forEach(item => { - if (item.type !== 'multiselect' && item.type !== 'select' && item.type !== 'link') return - if (item.setAll === 'true') { - item.options.unshift({ - key: Utils.getuuid(), - Value: '', - Text: this.state.dict['main.all'] - }) - } + groups.forEach(group => { + group.sublist = group.sublist.map(item => { + if (item.type !== 'multiselect' && item.type !== 'select' && item.type !== 'link') return item - if (item.resourceType === '1' && item.dataSource) { - let _option = Utils.getSelectQueryOptions(item) - let _sql = Utils.formatOptions(_option.sql) - - let param = { - func: 'sPC_Get_SelectedList', - LText: _sql, - obj_name: 'data', - arr_field: _option.field + if (item.setAll === 'true') { + item.options.unshift({ + key: Utils.getuuid(), + Value: '', + Text: this.state.dict['main.all'] + }) + } + + if (item.resourceType === '1' && item.dataSource) { + let _option = Utils.getSelectQueryOptions(item) + let _sql = Utils.formatOptions(_option.sql) + let isSSO = item.database === 'sso' + + let param = { + func: 'sPC_Get_SelectedList', + LText: _sql, + obj_name: 'data', + arr_field: _option.field + } + + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + param.secretkey = Utils.encrypt(param.LText, param.timestamp) + + let defer = new Promise(resolve => { + Api.getSystemCacheConfig(param, isSSO).then(res => { + res.search = item + resolve(res) + }) + }) + deffers.push(defer) + } else if (item.resourceType === '1' && !item.dataSource) { + notification.warning({ + top: 92, + message: item.label + ': ' + this.state.dict['main.datasource.settingerror'], + duration: 10 + }) } - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' - param.secretkey = Utils.encrypt(param.LText, param.timestamp) - - let defer = new Promise(resolve => { - Api.getSystemCacheConfig(param).then(res => { - res.search = item - resolve(res) - }) - }) - deffers.push(defer) - } else if (item.resourceType === '1' && !item.dataSource) { - notification.warning({ - top: 92, - message: item.label + ': ' + this.state.dict['main.datasource.settingerror'], - duration: 10 - }) - } + return item + }) }) - + if (deffers.length === 0) { - this.setState({searchlist: JSON.parse(JSON.stringify(searchlist))}) + this.setState({ + loadingview: false, + groups: groups + }) return } Promise.all(deffers).then(result => { + let _result = {} result.forEach(res => { if (res.status) { - searchlist = searchlist.map(item => { - if (item.uuid === res.search.uuid) { - res.data.forEach(cell => { - let _item = { - key: Utils.getuuid(), - Value: cell[res.search.valueField], - Text: cell[res.search.valueText] - } + 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] - } - - item.options.push(_item) + if (res.search.type === 'link') { + _item.parentId = cell[res.search.linkField] + } else if (res.search.type === 'select' && res.search.linkSubField && res.search.linkSubField.length > 0) { + res.search.linkSubField.forEach(_field => { + _item[_field] = (cell[_field] || cell[_field] === 0) ? cell[_field] : '' }) } - return item + + return _item }) + + _result[res.search.uuid] = _options } else { notification.warning({ top: 92, @@ -249,7 +265,23 @@ } }) - this.setState({searchlist}) + groups.forEach(group => { + group.sublist = group.sublist.map(item => { + if (item.type === 'select' || item.type === 'link' || item.type === 'multiselect') { + if (_result[item.uuid]) { + item.options = [...item.options, ..._result[item.uuid]] + } + item.oriOptions = JSON.parse(JSON.stringify(item.options)) + } + + return item + }) + }) + + this.setState({ + loadingview: false, + groups: groups + }) }) } @@ -257,38 +289,18 @@ * @description 涓昏〃鏁版嵁鍔犺浇 */ async loadmaindata () { - const { setting, BIDs } = this.state - let param = '' - - if (setting.interType !== 'inner' || (setting.interType === 'inner' && setting.innerFunc)) { - param = this.getCustomParam() - } else { - param = this.getDefaultParam() - } - - this.setState({ - pickup: false - }) - - this.handleTableId('mainTable', '') + const { setting } = this.state + let param = this.getCustomParam() let result = await Api.genericInterface(param) if (result.status) { this.setState({ - data: result.data.map((item, index) => { - item.key = index - return item - }), - loading: false, + data: result.data, BIDs: { - ...BIDs, - mainTable: '' + mainTable: (result.data[0] && result.data[0][setting.primaryKey]) || '' } }) } else { - this.setState({ - loading: false - }) notification.error({ top: 92, message: result.message, @@ -301,22 +313,21 @@ * @description 鑾峰彇鐢ㄦ埛鑷畾涔夊瓨鍌ㄨ繃绋嬩紶鍙� */ getCustomParam = () => { - const { pageIndex, pageSize, orderColumn, orderType, search, setting } = this.state + const { setting } = this.state - let _search = Utils.formatCustomMainSearch(search) - - let param = { - PageIndex: pageIndex, - PageSize: pageSize, - OrderCol: orderColumn, - OrderType: orderType, - ..._search - } + let param = {} if (setting.interType === 'inner') { param.func = setting.innerFunc } else { - param.rduri = setting.interface + if (setting.sysInterface === 'true') { + param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi + } else { + param.rduri = setting.interface + } + + param.appkey = window.GLOB.appkey || '' // 璋冪敤澶栭儴鎺ュ彛澧炲姞appkey + if (setting.outerFunc) { param.func = setting.outerFunc } @@ -326,174 +337,18 @@ } /** - * @description 鑾峰彇绯荤粺瀛樺偍杩囩▼ sPC_Get_TableData 鐨勫弬鏁� - */ - getDefaultParam = () => { - const { arr_field, pageIndex, pageSize, orderColumn, orderType, search, setting } = this.state - - let _search = Utils.joinMainSearchkey(search) - - _search = _search ? 'where ' + _search : '' - - let param = { - func: 'sPC_Get_TableData', - obj_name: 'data', - arr_field: arr_field - } - - let orderBy = orderColumn ? (orderColumn + ' ' + orderType) : setting.order - let _dataresource = setting.dataresource - - if (/\s/.test(_dataresource)) { - _dataresource = '(' + _dataresource + ') tb' - } - - let LText = `select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows` - - param.LText = Utils.formatOptions(LText) - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' - param.secretkey = Utils.encrypt(param.LText, param.timestamp) - - return param - } - - /** - * @description 鎼滅储鏉′欢鏀瑰彉鏃讹紝閲嶇疆琛ㄦ牸鏁版嵁 - * 鍚湁鍒濆涓嶅姞杞界殑椤甸潰锛屼慨鏀硅缃� - */ - refreshbysearch = (searches) => { - const { setting } = this.state - - if (setting.onload === 'false') { - this.setState({ - loading: true, - pageIndex: 1, - search: searches, - setting: {...setting, onload: 'true'} - }, () => { - this.loadmaindata() - }) - } else { - this.refs.mainTable.resetTable() - - this.setState({ - loading: true, - pageIndex: 1, - search: searches - }, () => { - this.loadmaindata() - }) - } - } - - /** - * @description 琛ㄦ牸鏉′欢鏀瑰彉鏃堕噸缃暟鎹紙鍒嗛〉鎴栨帓搴忥級 - */ - refreshbytable = (pagination, filters, sorter) => { - if (sorter.order) { - let _chg = { - ascend: 'asc', - descend: 'desc' - } - sorter.order = _chg[sorter.order] - } - - this.setState({ - loading: true, - pageIndex: pagination.current, - pageSize: pagination.pageSize, - orderColumn: sorter.field || this.state.setting.orderColumn, - orderType: sorter.order || 'asc' - }, () => { - this.loadmaindata() - }) - } - - /** - * @description 琛ㄦ牸鍒锋柊 - */ - reloadtable = () => { - this.refs.mainTable.resetTable() - this.setState({ - loading: true, - pageIndex: 1 - }, () => { - this.loadmaindata() - }) - } - - /** - * @description 椤甸潰鍒锋柊锛岄噸鏂拌幏鍙栭厤缃� - */ - reloadview = () => { - this.setState({ - loadingview: true, - viewlost: false, - lostmsg: '', - config: {}, - searchlist: null, - actions: null, - arr_field: '', - setting: null, - data: null, - loading: false, - pageIndex: 1, - pageSize: 10, - orderColumn: '', - orderType: 'asc', - search: '', - configMap: {}, - BIDs: {}, - setsingle: false, - pickup: false, - isLinkMain: false - }, () => { - this.loadconfig() - }) - } - - /** * @description 鎸夐挳鎿嶄綔瀹屾垚鍚庯紙鎴愬姛鎴栧け璐ワ級锛岄〉闈㈠埛鏂帮紝閲嶇疆椤电爜鍙婇�夋嫨椤� */ refreshbyaction = (btn, type) => { if (btn.execSuccess === 'grid' && type === 'success') { - this.reloadtable() + } else if (btn.execError === 'grid' && type === 'error') { - this.reloadview() + } else if (btn.execSuccess === 'view' && type === 'success') { - this.reloadtable() + } else if (btn.execError === 'view' && type === 'error') { - this.reloadview() - } else if (btn.popClose === 'view' && type === 'pop') { - this.reloadview() - } else if (btn.popClose === 'grid' && type === 'pop') { - this.reloadtable() + } - } - - /** - * @description 瀛愯〃鎿嶄綔瀹屾垚鍚庡埛鏂颁富琛� - */ - handleMainTable = () => { - this.reloadtable() - } - - /** - * @description 鑾峰彇琛ㄦ牸閫夋嫨椤� - */ - gettableselected = () => { - let data = [] - this.refs.mainTable.state.selectedRowKeys.forEach(item => { - data.push(this.refs.mainTable.props.data[item]) - }) - return data - } - - /** - * @description 琛ㄦ牸涓紝鎸夐挳瑙﹀彂浜嬩欢浼犻�� - */ - buttonTrigger = (btn, record) => { - this.refs.mainButton.actionTrigger(btn, record) } /** @@ -508,50 +363,6 @@ [type]: id } }) - } - - /** - * @description 琛ㄦ牸鍗曢�夊閫夊垏鎹� - */ - checkChange = () => { - const { setsingle, BIDs } = this.state - - let _BIDs = JSON.parse(JSON.stringify(BIDs)) - _BIDs.mainTable = '' - - this.setState({ - setsingle: !setsingle, - pickup: false, - BIDs: _BIDs - }) - } - - /** - * @description 鏁版嵁灞曞紑鍚堝苟鍒囨崲 - */ - pickupChange = () => { - const { pickup } = this.state - this.setState({ - pickup: !pickup - }) - } - - /** - * @description 瑙﹀彂鎸夐挳寮圭獥锛堟爣绛鹃〉锛� - */ - triggerPopview = (btn, data) => { - this.setState({ - popAction: btn, - popData: data[0] ? data[0] : null, - visible: true - }) - } - - popclose = () => { - this.setState({ - visible: false - }) - this.refreshbyaction(this.state.popAction, 'pop') } UNSAFE_componentWillMount () { @@ -573,31 +384,28 @@ } render() { - const { setting, actions, loadingview, viewlost, isLinkMain, config } = this.state + const { setting, actions, loadingview, viewlost, isLinkMain, config, groups, data } = this.state return ( - <div className={'commontable ' + (isLinkMain ? 'pick-control' : '')} id={'commontable' + this.props.MenuID}> + <div className={'formtab ' + (isLinkMain ? 'pick-control' : '')} id={'formtab' + this.props.MenuID}> {loadingview && <Spin size="large" />} - {config ? + {groups && (groups.length > 1 || groups[0].sublist.length > 0) ? <FormGroup dict={this.state.dict} - groups={config.groups} + data={data} + groups={groups} + setting={setting} wrappedComponentRef={(inst) => this.formGroupRef = inst} /> : null } - {actions && setting.onload !== 'false' ? - <MainAction - ref="mainButton" - BID="" - type="main" + {actions ? + <FormAction setting={setting} actions={actions} dict={this.state.dict} MenuID={this.props.MenuID} logcolumns={[]} refreshdata={this.refreshbyaction} - triggerPopview={this.triggerPopview} - gettableselected={this.gettableselected} /> : null } {setting && setting.onload !== 'false' && @@ -631,20 +439,6 @@ ) }) } - <Modal - className="popview-modal" - title={this.state.popAction.label} - width={'80vw'} - maskClosable={false} - visible={this.state.visible} - onCancel={this.popclose} - footer={[ - <Button key="cancel" onClick={this.popclose}>{this.state.dict['main.close']}</Button> - ]} - destroyOnClose - > - {<SubTabTable SupMenuID={this.props.MenuID} MenuID={this.state.popAction.linkTab} BID={''} ID={this.state.popData ? this.state.popData[setting.primaryKey] : ''} />} - </Modal> <BackTop> <div className="ant-back-top"> <div className="ant-back-top-content"> diff --git a/src/tabviews/formtab/index.scss b/src/tabviews/formtab/index.scss index ef364c5..57a7eac 100644 --- a/src/tabviews/formtab/index.scss +++ b/src/tabviews/formtab/index.scss @@ -1,10 +1,122 @@ -.commontable { +.formtab { position: relative; min-height: calc(100vh - 94px); - padding-top: 16px; padding-bottom: 80px; .box404 { padding-top: 30px; + } + .ant-collapse { + border-radius: 0; + border: 0; + margin-top: 30px; + .ant-collapse-header { + cursor: default; + border-radius: 0!important; + background: #1890ff; + color: #ffffff; + padding-left: 30px; + padding-right: 20px; + .anticon { + font-size: 16px; + } + .ant-collapse-extra { + .anticon-edit { + position: absolute; + left: 5px; + top: 2px; + } + } + } + .ant-collapse-item:last-child { + border-radius: 0; + .ant-collapse-content { + border-radius: 0; + } + } + .ant-collapse-content-box { + padding: 16px 30px; + > .ant-row { + min-height: 90px; + padding-bottom: 30px; + .page-card { + position: relative; + background: #ffffff; + border-radius: 2px; + padding-top: 15px; + .ant-form-item { + cursor: move; + display: flex; + margin-bottom: 0px; + .ant-form-item-label { + label { + width: 100%; + cursor: move; + overflow: hidden; + display: inline-block; + text-overflow: ellipsis; + white-space: nowrap; + } + } + .ant-form-item-label.ant-col-cuslabel { + width: 11%; + } + .ant-form-item-control-wrapper.ant-col-cuswrap { + width: 89%; + } + .ant-form-item-control-wrapper { + .ant-input-number { + width: 100%; + margin-top: 4px; + } + .ant-select { + width: 100%; + margin-top: 4px; + } + .ant-calendar-picker { + margin-top: 4px; + } + .ant-btn { + margin-top: 4px; + } + .input-mask { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + opacity: 0; + z-index: 2; + } + .data-range .ant-calendar-picker-input { + padding: 4px 20px 4px 5px; + font-size: 13px; + } + } + } + .edit { + position: absolute; + left: 15px; + top: 5px; + color: #1890ff; + cursor: pointer; + display: none; + } + .edit.close { + left: 40px; + color: #ff4d4f; + } + } + .page-card:hover { + .edit { + display: inline-block; + } + } + .ant-calendar-picker { + min-width: 100px!important; + width: 100%; + } + } + } } .ant-modal-mask { position: absolute; @@ -72,7 +184,7 @@ margin-top: 20px; } } -.commontable.pick-control { +.formtab.pick-control { >.button-list { padding-right: 140px; } diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index a5d0b46..cf38080 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -368,7 +368,8 @@ func: 'sPC_Get_TableData', obj_name: 'data', arr_field: arr_field, - BID: BID + BID: BID, + appkey: window.GLOB.appkey || '' } let orderBy = orderColumn ? (orderColumn + ' ' + orderType) : setting.order @@ -542,7 +543,9 @@ let param = { func: 'sPC_Get_TableData', obj_name: 'data', - arr_field: _arr_labels + arr_field: _arr_labels, + BID: this.props.BID, + appkey: window.GLOB.appkey || '' } let orderBy = orderColumn ? (orderColumn + ' ' + orderType) : setting.order diff --git a/src/tabviews/subtabtable/index.jsx b/src/tabviews/subtabtable/index.jsx index 3c578f8..185ac6f 100644 --- a/src/tabviews/subtabtable/index.jsx +++ b/src/tabviews/subtabtable/index.jsx @@ -331,7 +331,8 @@ func: 'sPC_Get_TableData', obj_name: 'data', arr_field: arr_field, - BID: this.props.BID + BID: this.props.BID, + appkey: window.GLOB.appkey || '' } let orderBy = orderColumn ? (orderColumn + ' ' + orderType) : setting.order @@ -504,7 +505,9 @@ let param = { func: 'sPC_Get_TableData', obj_name: 'data', - arr_field: _arr_labels + arr_field: _arr_labels, + BID: this.props.BID, + appkey: window.GLOB.appkey || '' } let orderBy = orderColumn ? (orderColumn + ' ' + orderType) : setting.order diff --git a/src/tabviews/tableshare/actionList/index.jsx b/src/tabviews/tableshare/actionList/index.jsx index a0ddc24..a6f359b 100644 --- a/src/tabviews/tableshare/actionList/index.jsx +++ b/src/tabviews/tableshare/actionList/index.jsx @@ -177,7 +177,7 @@ func: 'sPC_TableData_InUpDe', BID: this.props.BID } - let primaryId = setting.primaryKey && data[0] ? data[0][setting.primaryKey] : '' + let primaryId = setting.primaryKey && data[0] ? (data[0][setting.primaryKey] || '') : '' if (btn.OpenType === 'prompt' || btn.OpenType === 'exec') { // 鏄惁寮规鎴栫洿鎺ユ墽琛� let ID = '' diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index 8d41a7a..9946b3d 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -1338,6 +1338,8 @@ // 鏈缃暟鎹簮鎴栨爣绛句笉鍚堟硶鏃讹紝鍚敤鐘舵�佷负false if (_config.setting.interType === 'inner' && !_config.setting.innerFunc && !_config.setting.dataresource) { _config.enabled = false + } else if (!_config.setting.primaryKey) { + _config.enabled = false } else if (_config.tabgroups.length > 1) { _config.tabgroups.forEach(group => { if (_config[group].length === 0) { @@ -2138,6 +2140,12 @@ message: '鑿滃崟灏氭湭璁剧疆鏁版嵁婧愶紝涓嶅彲鍚敤锛�', duration: 10 }) + } else if (!config.setting.primaryKey) { + notification.warning({ + top: 92, + message: '鑿滃崟灏氭湭璁剧疆涓婚敭锛屼笉鍙惎鐢紒', + duration: 10 + }) } else if (!tabinvalid) { notification.warning({ top: 92, diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx index 3c345ab..89bffe5 100644 --- a/src/templates/subtableconfig/index.jsx +++ b/src/templates/subtableconfig/index.jsx @@ -1162,6 +1162,13 @@ let _LongParam = '' let _config = {...config, tables: this.state.selectedTables, ...res} + // 鏈缃暟鎹簮鎴栦富閿椂锛屽惎鐢ㄧ姸鎬佷负false + if (_config.setting.interType === 'inner' && !_config.setting.innerFunc && !_config.setting.dataresource) { + _config.enabled = false + } else if (!_config.setting.primaryKey) { + _config.enabled = false + } + // 淇濆瓨鏃跺垹闄ら厤缃被鍨嬶紝system 銆乽ser delete _config.type delete _config.isAdd @@ -1830,7 +1837,13 @@ if (config.setting.interType === 'inner' && !config.setting.innerFunc && !config.setting.dataresource) { notification.warning({ top: 92, - message: '鑿滃崟灏氭湭璁剧疆鏁版嵁婧愶紝涓嶅彲鍚敤锛�', + message: '灏氭湭璁剧疆鏁版嵁婧愶紝涓嶅彲鍚敤锛�', + duration: 10 + }) + } else if (!config.setting.primaryKey) { + notification.warning({ + top: 92, + message: '灏氭湭璁剧疆涓婚敭锛屼笉鍙惎鐢紒', duration: 10 }) } else { -- Gitblit v1.8.0