From 3d4bc79a80eb9cff0f8ef7c53f9685c9ff9fbd2d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 02 九月 2021 23:17:36 +0800 Subject: [PATCH] 2021-09-02 --- src/tabviews/verupmanage/actionList/index.jsx | 118 +++++++++++++++++++++++----------------------------------- 1 files changed, 47 insertions(+), 71 deletions(-) diff --git a/src/tabviews/verupmanage/actionList/index.jsx b/src/tabviews/verupmanage/actionList/index.jsx index 9deeecd..23dd7ef 100644 --- a/src/tabviews/verupmanage/actionList/index.jsx +++ b/src/tabviews/verupmanage/actionList/index.jsx @@ -2,13 +2,16 @@ import PropTypes from 'prop-types' import moment from 'moment' import { Button, Modal, notification, message } from 'antd' -import MutilForm from '@/tabviews/zshare/mutilform' -import Utils from '@/utils/utils.js' + +import asyncSpinComponent from '@/utils/asyncSpinComponent' +import Utils, { getSysDefaultSql } from '@/utils/utils.js' import options from '@/store/options.js' +import { updateForm } from '@/utils/utils-update.js' import Api from '@/api' import './index.scss' const { confirm } = Modal +const MutilForm = asyncSpinComponent(() => import('@/tabviews/zshare/mutilform')) class MainAction extends Component { static propTpyes = { @@ -18,7 +21,7 @@ type: PropTypes.string, // 鍒ゆ柇褰撳墠涓轰富琛紙main锛夈�佸瓙琛紙sub锛夈�佸瓙琛ㄦ爣绛撅紙subtab锛� MenuID: PropTypes.string, // 鑿滃崟ID actions: PropTypes.array, // 鎸夐挳缁� - logcolumns: PropTypes.array, // 鏄剧ず鍒� + columns: PropTypes.array, // 鏄剧ず鍒� dict: PropTypes.object, // 瀛楀吀椤� setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 ContainerId: PropTypes.any, // tab椤甸潰ID锛岀敤浜庡脊绐楁帶鍒� @@ -109,6 +112,7 @@ this.setState({loadingUuid: ''}) }) } else if (item.OpenType === 'pop') { + item = updateForm(item) if (item.setting.display === 'prompt') { // 濡傛灉琛ㄥ崟浠ユ槸鍚︽灞曠ず锛屼笉璇锋眰涓嬫媺鑿滃崟淇℃伅 this.setState({ execAction: item, @@ -136,7 +140,7 @@ * @description 鎸夐挳鎻愪氦鎵ц */ execSubmit = (btn, data, _resolve, formdata) => { - const { setting, logcolumns } = this.props + const { setting, columns } = this.props if (btn.intertype === 'inner') { // 鎵ц鏂瑰紡涓哄琛屾嫾鎺ワ紝涓旀墦寮�鏂瑰紡涓鸿〃鍗曟椂锛屼細杞负寰幆鍙戦�佽姹� @@ -171,16 +175,12 @@ } } else if (btn.sql) { param.ID = primaryId - param.LText = Utils.getSysDefaultSql(btn, setting, '', param, data[0], logcolumns) // 鏁版嵁婧� - - let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText) - - param.LText2 = LText2 - param.LText1 = LText1 - param.LText = LText - + param.LText = getSysDefaultSql(btn, setting, '', param, data[0], columns) // 鏁版嵁婧� + + param.exec_type = 'y' // 鍚庡彴瑙g爜 param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) + param.secretkey = Utils.encrypt('', param.timestamp) + param.LText = Utils.formatOptions(param.LText) } } else if (btn.OpenType === 'pop') { // 琛ㄥ崟 if (btn.innerFunc) { @@ -203,28 +203,20 @@ } } param.ID = primaryId || Utils.getguid() - param.LText = Utils.getSysDefaultSql(btn, setting, formdata, param, data[0], logcolumns) // 鏁版嵁婧� - - let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText) - - param.LText2 = LText2 - param.LText1 = LText1 - param.LText = LText - + param.LText = getSysDefaultSql(btn, setting, formdata, param, data[0], columns) // 鏁版嵁婧� + + param.exec_type = 'y' // 鍚庡彴瑙g爜 param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) + param.secretkey = Utils.encrypt('', param.timestamp) + param.LText = Utils.formatOptions(param.LText) } else if (btn.sql) { param.ID = primaryId - param.LText = Utils.getSysDefaultSql(btn, setting, formdata, param, data[0], logcolumns) // 鏁版嵁婧� - - let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText) - - param.LText2 = LText2 - param.LText1 = LText1 - param.LText = LText - + param.LText = getSysDefaultSql(btn, setting, formdata, param, data[0], columns) // 鏁版嵁婧� + + param.exec_type = 'y' // 鍚庡彴瑙g爜 param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) + param.secretkey = Utils.encrypt('', param.timestamp) + param.LText = Utils.formatOptions(param.LText) } } @@ -265,16 +257,12 @@ } } else if (btn.sql) { param.ID = primaryId - param.LText = Utils.getSysDefaultSql(btn, setting, '', param, cell, logcolumns) // 鏁版嵁婧� + param.LText = getSysDefaultSql(btn, setting, '', param, cell, columns) // 鏁版嵁婧� - let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText) - - param.LText2 = LText2 - param.LText1 = LText1 - param.LText = LText - + param.exec_type = 'y' // 鍚庡彴瑙g爜 param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) + param.secretkey = Utils.encrypt('', param.timestamp) + param.LText = Utils.formatOptions(param.LText) } } else if (btn.OpenType === 'pop') { // 琛ㄥ崟 if (btn.innerFunc) { @@ -293,16 +281,12 @@ } } else if (btn.sql && btn.sqlType === 'insert') { // 绯荤粺鍑芥暟娣诲姞鏃讹紝鐢熸垚uuid param.ID = _formPrimaryId || Utils.getguid() - param.LText = Utils.getSysDefaultSql(btn, setting, formdata, param, cell, logcolumns) // 鏁版嵁婧� + param.LText = getSysDefaultSql(btn, setting, formdata, param, cell, columns) // 鏁版嵁婧� - let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText) - - param.LText2 = LText2 - param.LText1 = LText1 - param.LText = LText - + param.exec_type = 'y' // 鍚庡彴瑙g爜 param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) + param.secretkey = Utils.encrypt('', param.timestamp) + param.LText = Utils.formatOptions(param.LText) } else if (btn.sql) { if (index !== 0) { formdata = formdata.map(_data => { @@ -314,16 +298,12 @@ } param.ID = primaryId - param.LText = Utils.getSysDefaultSql(btn, setting, formdata, param, cell, logcolumns) // 鏁版嵁婧� + param.LText = getSysDefaultSql(btn, setting, formdata, param, cell, columns) // 鏁版嵁婧� - let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText) - - param.LText2 = LText2 - param.LText1 = LText1 - param.LText = LText - + param.exec_type = 'y' // 鍚庡彴瑙g爜 param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) + param.secretkey = Utils.encrypt('', param.timestamp) + param.LText = Utils.formatOptions(param.LText) } } @@ -460,6 +440,7 @@ let param = params.shift() let _outParam = null let _localParam = null + let errRes = null if (widthNumber) { this.setState({ @@ -563,9 +544,11 @@ } }).then(res => { if (!res) return - + if (_localParam) { - + if (!res.status) { + errRes = res + } return Api.getLocalConfig(_localParam) } else if (res.status) { if (params.length === 0) { @@ -581,7 +564,7 @@ }).then(res => { if (!res) return - if (res.status) { + if (res.status && !errRes) { if (params.length === 0) { this.execSuccess(btn, res) _resolve() @@ -589,7 +572,7 @@ this.outerLoopRequest(params, btn, _resolve, widthNumber) } } else { - this.execError(res, btn) + this.execError(errRes || res, btn) _resolve() } }) @@ -672,17 +655,10 @@ const { BData } = this.props const { execAction, tabledata } = this.state let _this = this - let _fields = [] - - if (execAction.groups.length > 0) { - execAction.groups.forEach(group => { - _fields = [..._fields, ...group.sublist] - }) - } else { - _fields = execAction.fields - } - let result = _fields.map(item => { + let result = [] + execAction.fields.forEach(item => { + if (!item.field) return let _readin = item.readin !== 'false' let _initval = item.initval @@ -703,14 +679,14 @@ _fieldlen = item.decimal ? item.decimal : 0 } - return { + result.push({ key: item.field, readonly: item.readonly === 'true', readin: _readin, fieldlen: _fieldlen, type: item.type, value: _initval - } + }) }) confirm({ -- Gitblit v1.8.0