From c51f5e007a3e03c9d6731ab7f28f0080de009990 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 17 十一月 2021 18:38:32 +0800 Subject: [PATCH] 2021-11-17 --- src/tabviews/formtab/actionList/index.jsx | 100 ++++++++++++++++++++++++++++++------------------- 1 files changed, 61 insertions(+), 39 deletions(-) diff --git a/src/tabviews/formtab/actionList/index.jsx b/src/tabviews/formtab/actionList/index.jsx index 595e2fa..17b6493 100644 --- a/src/tabviews/formtab/actionList/index.jsx +++ b/src/tabviews/formtab/actionList/index.jsx @@ -2,7 +2,7 @@ import PropTypes from 'prop-types' import moment from 'moment' import { Button, Modal, notification, message } from 'antd' -import Utils from '@/utils/utils.js' +import Utils, { getSysDefaultSql } from '@/utils/utils.js' import options from '@/store/options.js' import Api from '@/api' import './index.scss' @@ -15,7 +15,6 @@ MenuID: PropTypes.string, // 鑿滃崟ID primaryId: PropTypes.string, // 涓婚敭 actions: PropTypes.array, // 鎸夐挳缁� - logcolumns: PropTypes.array, // 鏄剧ず鍒� dict: PropTypes.object, // 瀛楀吀椤� data: PropTypes.any, // 鏁版嵁 setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 @@ -25,7 +24,6 @@ state = { formdata: null, - tabledata: null, loadingUuid: '' } @@ -34,7 +32,6 @@ */ actionTrigger = (item) => { const { data } = this.props - let _this = this if (item.btnType !== 'cancel') { @@ -67,61 +64,88 @@ * @description 鎸夐挳鎻愪氦鎵ц */ execSubmit = (btn, data, _resolve, formdata) => { - const { setting, logcolumns, primaryId } = this.props + const { setting, primaryId } = this.props let _primaryId = primaryId if (btn.intertype === 'inner') { - // 浣跨敤鍐呴儴鎺ュ彛鏃讹紝鍐呴儴鍑芥暟鍜屾暟鎹簮涓嶅彲鍚屾椂涓虹┖, 浣跨敤绯荤粺鍑芥暟鏃讹紝绫诲瀷涓嶅彲涓虹┖ - if (!btn.innerFunc && (!btn.sql || (btn.sql && !btn.sqlType))) { + let param = { // 绯荤粺瀛樺偍杩囩▼ + func: btn.innerFunc, + BID: '' + } + + param[setting.primaryKey] = primaryId + + formdata.forEach(_data => { + param[_data.key] = _data.value + }) + + if (!param[setting.primaryKey]) { + param[setting.primaryKey] = Utils.getguid() + } + + _primaryId = param[setting.primaryKey] + + Api.genericInterface(param).then((res) => { + if (res.status) { + this.execSuccess(btn, res, _primaryId, formdata) + } else { + this.execError(res, btn) + } + _resolve() + }) + } else if (btn.intertype === 'system') { + // 浣跨敤绯荤粺鎺ュ彛鏃讹紝鏁版嵁婧愪笉鍙负绌�, 浣跨敤绯荤粺鍑芥暟鏃讹紝绫诲瀷涓嶅彲涓虹┖ + if (!btn.sql || !btn.sqlType) { this.actionSettingError() _resolve() return } // 鍒涘缓鍑瘉鏃讹紝闇�瑕侀�夋嫨琛屾椂 - if (!data && !btn.innerFunc && btn.verify && btn.verify.voucher && btn.verify.voucher.enabled) { + if (!data && btn.verify && btn.verify.voucher && btn.verify.voucher.enabled) { notification.warning({ top: 92, message: '浣跨敤鍒涘缓鍑瘉鍑芥暟锛岄渶瑕侀�夋嫨琛岋紒', - duration: 10 + duration: 5 }) return } let param = { // 绯荤粺瀛樺偍杩囩▼ func: 'sPC_TableData_InUpDe', + exec_type: 'y', // 鍚庡彴瑙g爜 BID: '' } - if (btn.innerFunc) { - param.func = btn.innerFunc - - param[setting.primaryKey] = primaryId - - formdata.forEach(_data => { - param[_data.key] = _data.value - }) - - if (!param[setting.primaryKey]) { - param[setting.primaryKey] = Utils.getguid() - } - - _primaryId = param[setting.primaryKey] - - } else if (btn.sql && btn.sqlType === 'insert') { // 绯荤粺鍑芥暟娣诲姞鏃讹紝鐢熸垚uuid + if (btn.sql && btn.sqlType === 'insert') { // 绯荤粺鍑芥暟娣诲姞鏃讹紝鐢熸垚uuid param.ID = Utils.getguid() - param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata, param, data, logcolumns)) // 鏁版嵁婧� - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' - param.secretkey = Utils.encrypt(param.LText, param.timestamp) + param.LText = getSysDefaultSql(btn, setting, formdata, param, data, []) // 鏁版嵁婧� + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + param.secretkey = Utils.encrypt('', param.timestamp) + param.LText = Utils.formatOptions(param.LText) + + _primaryId = param.ID + } else if (btn.sql && btn.sqlType === 'insertOrUpdate') { // 绯荤粺鍑芥暟娣诲姞鎴栦慨鏀规椂 + param.ID = primaryId || Utils.getguid() + param.LText = getSysDefaultSql(btn, setting, formdata, param, data, []) // 鏁版嵁婧� + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + param.secretkey = Utils.encrypt('', param.timestamp) + param.LText = Utils.formatOptions(param.LText) _primaryId = param.ID } else if (btn.sql) { param.ID = primaryId - param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata, param, data, logcolumns)) // 鏁版嵁婧� - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' - param.secretkey = Utils.encrypt(param.LText, param.timestamp) + param.LText = getSysDefaultSql(btn, setting, formdata, param, data, []) // 鏁版嵁婧� + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + param.secretkey = Utils.encrypt('', param.timestamp) + param.LText = Utils.formatOptions(param.LText) } + + if (this.props.menuType === 'HS' && param.timestamp) { // 浜戠楠岃瘉 + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) + } + Api.genericInterface(param).then((res) => { if (res.status) { this.execSuccess(btn, res, _primaryId, formdata) @@ -191,9 +215,9 @@ res.rduri = btn.interface } } else { - if (btn.sysInterface === 'true') { - res.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi - } else { + if (btn.sysInterface === 'true' && window.GLOB.mainSystemApi) { + res.rduri = window.GLOB.mainSystemApi + } else if (btn.sysInterface !== 'true') { res.rduri = btn.interface } } @@ -201,8 +225,6 @@ if (btn.outerFunc) { res.func = btn.outerFunc } - - res.appkey = window.GLOB.appkey || '' // 澶栭儴璇锋眰鏃讹紝缁熶竴娣诲姞appkey return Api.genericInterface(res) }).then(response => { @@ -282,14 +304,14 @@ notification.error({ top: 92, message: res.message || res.ErrMesg, - duration: btn.errorTime || 15 + duration: 10 }) } else if (res.ErrCode === 'F') { notification.error({ className: 'notification-custom-error', top: 92, message: res.message || res.ErrMesg, - duration: btn.errorTime || 15 + duration: 10 }) } else if (res.ErrCode === 'NM') { message.error(res.message || res.ErrMesg) @@ -305,7 +327,7 @@ notification.warning({ top: 92, message: this.props.dict['main.action.settingerror'], - duration: 10 + duration: 5 }) } -- Gitblit v1.8.0