From 437c69e4277c9ab81da46fe2ecd3857a7ccf3b14 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 24 二月 2025 21:52:57 +0800 Subject: [PATCH] 2025-02-24 --- src/tabviews/zshare/actionList/normalbutton/index.jsx | 351 ++++++++++++++++++++++++++++++++++++++++------------------ 1 files changed, 243 insertions(+), 108 deletions(-) diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index 158e42d..c20b5df 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -13,7 +13,8 @@ import MKEmitter from '@/utils/events.js' import MkIcon from '@/components/mk-icon' import MkCounter from './mkcounter' -// import './index.scss' + +import './index.scss' const MutilForm = asyncSpinComponent(() => import('@/tabviews/zshare/mutilform')) const { confirm } = Modal @@ -45,7 +46,8 @@ autoMatic: false, check: false, count: 0, - dict: window.GLOB.dict + dict: window.GLOB.dict, + submitType: '' } preCallback = null @@ -307,16 +309,16 @@ } } - // if (window.GLOB.systemType === 'production') { - // let _change = { - // prompt: '鎻愮ず妗�', - // exec: '鐩存帴鎵ц', - // pop: '寮圭獥锛堣〃鍗曪級', - // formSubmit: '琛ㄥ崟', - // form: '琛ㄥ崟', - // } - // MKEmitter.emit('queryTrigger', {menuId: btn.uuid, name: _change[btn.OpenType]}) - // } + if (window.GLOB.systemType === 'production') { + let _change = { + prompt: '鎻愮ず妗�', + exec: '鐩存帴鎵ц', + pop: '寮圭獥锛堣〃鍗曪級', + formSubmit: '琛ㄥ崟', + form: '琛ㄥ崟', + } + MKEmitter.emit('queryTrigger', {menuId: btn.uuid, name: _change[btn.OpenType]}) + } } preTrigger = (callback) => { @@ -423,6 +425,13 @@ duration: 5 }) return false + } else if (btn.Ot !== 'notRequired' && data[0] && !data[0].$$uuid) { + notification.warning({ + top: 92, + message: '鏈幏鍙栧埌ID鍊硷紒', + duration: 5 + }) + return false } else if (btn.Ot === 'requiredSgl' && data.length !== 1) { // 闇�瑕侀�夋嫨鍗曡鏃讹紝鏍¢獙鏁版嵁 notification.warning({ @@ -445,6 +454,7 @@ getSystemParam = (data, formdata, retmsg) => { const { setting, columns, btn } = this.props + const { submitType } = this.state let _params = [] if ( btn.Ot === 'notRequired' || btn.Ot === 'requiredSgl' || btn.Ot === 'requiredOnce' ) { @@ -468,11 +478,11 @@ param.ID = primaryId if (retmsg) { - const { sql, callbacksql } = getSysDefaultSql(btn, setting, '', param, data[0], columns, retmsg) // 鏁版嵁婧� + const { sql, callbacksql } = getSysDefaultSql(btn, setting, '', param, data[0], columns, retmsg, submitType) // 鏁版嵁婧� param.LText = sql param.$callbacksql = callbacksql } else { - param.LText = getSysDefaultSql(btn, setting, '', param, data[0], columns, false) // 鏁版嵁婧� + param.LText = getSysDefaultSql(btn, setting, '', param, data[0], columns, false, submitType) // 鏁版嵁婧� if (btn.output) { param.key_back_type = 'Y' } @@ -495,11 +505,11 @@ param.ID = Utils.getguid() if (retmsg) { - const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, retmsg) // 鏁版嵁婧� + const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, retmsg, submitType) // 鏁版嵁婧� param.LText = sql param.$callbacksql = callbacksql } else { - param.LText = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, false) // 鏁版嵁婧� + param.LText = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, false, submitType) // 鏁版嵁婧� if (btn.output) { param.key_back_type = 'Y' } @@ -521,11 +531,11 @@ param.ID = primaryId if (retmsg) { - const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, retmsg) // 鏁版嵁婧� + const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, retmsg, submitType) // 鏁版嵁婧� param.LText = sql param.$callbacksql = callbacksql } else { - param.LText = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, false) // 鏁版嵁婧� + param.LText = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, false, submitType) // 鏁版嵁婧� if (btn.output) { param.key_back_type = 'Y' } @@ -587,11 +597,11 @@ param.ID = primaryId if (retmsg) { - const { sql, callbacksql } = getSysDefaultSql(btn, setting, '', param, cell, columns, retmsg) // 鏁版嵁婧� + const { sql, callbacksql } = getSysDefaultSql(btn, setting, '', param, cell, columns, retmsg, submitType) // 鏁版嵁婧� param.LText = sql param.$callbacksql = callbacksql } else { - param.LText = getSysDefaultSql(btn, setting, '', param, cell, columns, false) // 鏁版嵁婧� + param.LText = getSysDefaultSql(btn, setting, '', param, cell, columns, false, submitType) // 鏁版嵁婧� if (btn.output) { param.key_back_type = 'Y' } @@ -627,11 +637,11 @@ param.ID = Utils.getguid() if (retmsg) { - const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, cell, columns, retmsg) // 鏁版嵁婧� + const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, cell, columns, retmsg, submitType) // 鏁版嵁婧� param.LText = sql param.$callbacksql = callbacksql } else { - param.LText = getSysDefaultSql(btn, setting, formdata, param, cell, columns, false) // 鏁版嵁婧� + param.LText = getSysDefaultSql(btn, setting, formdata, param, cell, columns, false, submitType) // 鏁版嵁婧� if (btn.output) { param.key_back_type = 'Y' } @@ -653,11 +663,11 @@ param.ID = primaryId if (retmsg) { - const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, cell, columns, retmsg) // 鏁版嵁婧� + const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, cell, columns, retmsg, submitType) // 鏁版嵁婧� param.LText = sql param.$callbacksql = callbacksql } else { - param.LText = getSysDefaultSql(btn, setting, formdata, param, cell, columns, false) // 鏁版嵁婧� + param.LText = getSysDefaultSql(btn, setting, formdata, param, cell, columns, false, submitType) // 鏁版嵁婧� if (btn.output) { param.key_back_type = 'Y' } @@ -808,6 +818,8 @@ getExps = (ex, formdata, cell, id, process) => { const { columns, BID, btn } = this.props + const { submitType } = this.state + let exps = [] let values = { time_id: Utils.getguid(), @@ -826,6 +838,7 @@ datam: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', datam_begin: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', datam_end: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', + mk_submit_type: submitType || '' // mk_check_begin: '', // mk_check_end: '' } @@ -836,13 +849,11 @@ let formkeys = [] formdata && formdata.forEach(form => { - if (!ex.reps.includes(form.key)) return - formkeys.push(form.key) let val = form.value if (form.type === 'number' || form.type === 'rate') { - if (isNaN(val)) { + if (isNaN(val) || val === '') { val = 0 } } else if (['date', 'datemonth'].includes(form.type)) { @@ -889,6 +900,13 @@ }) } }) + + if (btn.verify && btn.verify.printEnable === 'true' && !btn.output && !ex.reps.includes('ID') && values.id) { + exps.push({ + key: 'ID', + value: values.id + }) + } if (process && btn.verify.workFlow === 'true') { let flow = window.GLOB.UserCacheMap.get(btn.$flowId) @@ -1080,6 +1098,10 @@ error = '琛屼俊鎭腑鏃犲伐浣滄祦鍙傛暟' } + if (!error && btn.verify.flowSql !== 'true' && btn.verify.flowType !== 'start' && line && line.approvalMethod === 'countersign') { + error = '浼氱娴佺▼闇�瑕佷娇鐢ㄩ粯璁よ剼鏈�' + } + if (error) { status = 0 statusName = '寮傚父' @@ -1105,23 +1127,25 @@ } else { let works_flow_countersign = '' let works_flow_sign_values = '' - let works_flow_sign_field = '' + let works_flow_sign_field = 'statuscharone' let works_flow_sign_label = '' let works_begin_branch = '' - if (line.approvalMethod === 'countersign' && node.checkIds.length > 1) { - works_flow_countersign = 'Y' - let mark = line.mark || '宸插鏍�' - let fields = ['statuscharone', 'statuschartwo', 'statuscharthree', 'statuscharfour', 'statuscharfive'] - node.checkUsers.forEach((user, index) => { - if (user.worker_id === userid) { - works_flow_sign_field = fields[index] - works_flow_sign_label = `${user.parentNames[2] || ''}${user.workername || ''}${mark}` - } else { - works_flow_sign_values += `${user.parentNames[2] || ''}${user.workername || ''}${mark}` - } - }) - } else { - works_begin_branch = line.mknode === 'startEdge' ? 'Y' : '' + if (line) { + if (line.approvalMethod === 'countersign' && node.checkIds.length > 1) { + works_flow_countersign = 'Y' + let mark = line.mark || '宸插鏍�' + let fields = ['statuscharone', 'statuschartwo', 'statuscharthree', 'statuscharfour', 'statuscharfive'] + node.checkUsers.forEach((user, index) => { + if (user.worker_id === userid) { + works_flow_sign_field = fields[index] + works_flow_sign_label = `${user.parentNames[2] || ''}${user.workername || ''}${mark}` + } else { + works_flow_sign_values += `${user.parentNames[2] || ''}${user.workername || ''}${mark}` + } + }) + } else { + works_begin_branch = line.mknode === 'startEdge' ? 'Y' : '' + } } exps.push( @@ -1156,10 +1180,11 @@ return { $backend: true, + $type: 's_TableData_InUpDe', data: [{ id: ex.id, - exps: exps, menuname: btn.logLabel || '', + exps: exps, md5_id: md5_id }] } @@ -1284,9 +1309,10 @@ * @description 鑾峰彇鍥炶皟鑴氭湰鐨勫瓧娈靛畾涔� */ getSysDeclareSql = (btn, formdata, data, columns, BID = '') => { - let datavars = {} // 澹版槑鐨勫彉閲忥紝琛ㄥ崟鍙婃樉绀哄垪 + const { submitType } = this.state + // 闇�瑕佸0鏄庣殑鍙橀噺闆� - let _vars = ['tbid', 'errorcode', 'retmsg', 'billcode', 'bvoucher', 'fibvoucherdate', 'fiyear', 'username', 'fullname', 'modulardetailcode', 'roleid', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'mk_deleted', 'bid'] + let _vars = ['tbid', 'errorcode', 'retmsg', 'billcode', 'bvoucher', 'fibvoucherdate', 'fiyear', 'username', 'fullname', 'modulardetailcode', 'roleid', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'mk_deleted', 'bid', 'mk_submit_type'] // sql璇彞 let _sql = '' @@ -1299,14 +1325,13 @@ // 鑾峰彇瀛楁閿�煎 formdata && formdata.forEach(form => { let _key = form.key.toLowerCase() - datavars[_key] = form.value if (!_initvars.includes(_key)) { _initvars.push(_key) let val = form.value if (form.type === 'number' || form.type === 'rate') { - if (isNaN(val)) { + if (isNaN(val) || val === '') { val = 0 } _initFormfields.push(`@${_key}=${val}`) @@ -1354,14 +1379,12 @@ // 娣诲姞鏁版嵁涓瓧娈碉紝琛ㄥ崟鍊间紭鍏�(鎸夐挳涓嶉�夎鎴栧琛屾嫾鎺ユ椂璺宠繃) if (data && btn.Ot !== 'notRequired' && columns && columns.length > 0) { - datavars = {..._data, ...datavars} - const setField = (col) => { if (!col.field) return let _key = col.field.toLowerCase() if (!_initvars.includes(_key)) { - let _val = datavars.hasOwnProperty(_key) ? datavars[_key] : '' + let _val = _data.hasOwnProperty(_key) ? _data[_key] : '' if (col.datatype && /^date/ig.test(col.datatype) && !_val) { _val = '1949-10-01' @@ -1416,7 +1439,7 @@ _declarefields = ',' + _declarefields } _sql = `/* 绯荤粺鐢熸垚 */ - Declare @tbid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@BillCode nvarchar(50),@BVoucher nvarchar(50),@FIBVoucherDate nvarchar(50), @FiYear nvarchar(50),@ModularDetailCode nvarchar(50), @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100),@mk_deleted int,@bid nvarchar(50)${_declarefields} + Declare @tbid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@BillCode nvarchar(50),@BVoucher nvarchar(50),@FIBVoucherDate nvarchar(50), @FiYear nvarchar(50),@ModularDetailCode nvarchar(50), @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100),@mk_deleted int,@bid nvarchar(50),@mk_submit_type nvarchar(50)${_declarefields} ` let userName = sessionStorage.getItem('User_Name') || '' @@ -1434,7 +1457,7 @@ // 鍒濆鍖栧嚟璇佸強鐢ㄦ埛淇℃伅瀛楁 _sql += ` /* 鍑瘉鍙婄敤鎴蜂俊鎭垵濮嬪寲璧嬪�� */ - select @BVoucher='',@FIBVoucherDate='',@FiYear='',@ErrorCode='',@retmsg='',@UserName='${userName}', @FullName='${fullName}', @RoleID='${RoleID}', @mk_departmentcode='${departmentcode}', @mk_organization='${organization}', @mk_user_type='${mk_user_type}', @mk_nation='${nation}', @mk_province='${province}', @mk_city='${city}', @mk_district='${district}', @mk_address='${address}', @mk_deleted=1, @bid='${BID}', @BillCode='', @ModularDetailCode='' + select @BVoucher='',@FIBVoucherDate='',@FiYear='',@ErrorCode='',@retmsg='',@UserName='${userName}', @FullName='${fullName}', @RoleID='${RoleID}', @mk_departmentcode='${departmentcode}', @mk_organization='${organization}', @mk_user_type='${mk_user_type}', @mk_nation='${nation}', @mk_province='${province}', @mk_city='${city}', @mk_district='${district}', @mk_address='${address}', @mk_deleted=1, @bid='${BID}', @mk_submit_type='${submitType}', @BillCode='', @ModularDetailCode='' ` // 琛ㄥ崟鍙橀噺璧嬪�� @@ -1570,7 +1593,7 @@ }, 600) } - this.triggerNote(res, _param.ID) // 娑堟伅 + this.triggerNote(res, _param) // 娑堟伅 this.execSuccess(res) } else { this.execError(res) @@ -1585,6 +1608,7 @@ if (window.backend && params[0].$backend && (!btn.verify || (btn.verify.printEnable !== 'true' && !btn.output))) { params = [{ $backend: true, + $type: 's_TableData_InUpDe', data: params.map(item => item.data[0]) }] } @@ -1594,7 +1618,7 @@ setTimeout(() => { Api.genericInterface(param).then(res => { if (res.status) { - this.triggerNote(res, param.ID) // 娑堟伅 + this.triggerNote(res, param) // 娑堟伅 } resolve(res) }, (error) => { @@ -1806,6 +1830,16 @@ }) } + if (/@.*@/.test(url)) { + Object.keys(param).forEach(key => { + let reg = new RegExp('@' + key + '@', 'ig') + if (reg.test(url)) { + url = url.replace(reg, param[key]) + delete param[key] + } + }) + } + let _params = { url: url, method: btn.method || 'post' @@ -1918,6 +1952,10 @@ if (params.length === 0) { this.execSuccess(result) _resolve() + } else if (btn.execInterval) { + setTimeout(() => { + this.customLoopRequest(params, _resolve) + }, btn.execInterval) } else { this.customLoopRequest(params, _resolve) } @@ -1955,6 +1993,10 @@ if (params.length === 0) { this.execSuccess(result) _resolve() + } else if (btn.execInterval) { + setTimeout(() => { + this.customLoopRequest(params, _resolve) + }, btn.execInterval) } else { this.customLoopRequest(params, _resolve) } @@ -1972,11 +2014,15 @@ Api.genericInterface(param, btn.$callbackScript, 'callback').then(res => { if (res.status) { - this.triggerNote(res, param.ID) // 娑堟伅 + this.triggerNote(res, param) // 娑堟伅 if (params.length === 0) { this.execSuccess(res) _resolve() + } else if (btn.execInterval) { + setTimeout(() => { + this.customLoopRequest(params, _resolve) + }, btn.execInterval) } else { this.customLoopRequest(params, _resolve) } @@ -2319,11 +2365,15 @@ Api.genericInterface(param).then(res => { if (res.status) { - this.triggerNote(res, param.ID) // 娑堟伅 + this.triggerNote(res, param) // 娑堟伅 if (params.length === 0) { this.execSuccess(res) _resolve() + } else if (btn.execInterval) { + setTimeout(() => { + this.innerLoopRequest(params, btn, _resolve) + }, btn.execInterval) } else { this.innerLoopRequest(params, btn, _resolve) } @@ -2353,7 +2403,7 @@ Api.genericInterface(param).then(res => { if (res.status) { - this.triggerNote(res, param.ID) // 娑堟伅 + this.triggerNote(res, param) // 娑堟伅 if (params.length === 0) { this.execSuccess(res) @@ -2377,7 +2427,7 @@ return new Promise(resolve => { Api.genericInterface(unCheckParam).then(result => { if (result.status) { - that.triggerNote(result, param.ID) // 娑堟伅 + that.triggerNote(result, param) // 娑堟伅 if (params.length === 0) { that.execSuccess(result) @@ -2573,6 +2623,10 @@ if (params.length === 0) { this.execSuccess(result) _resolve() + } else if (btn.execInterval) { + setTimeout(() => { + this.outerLoopRequest(params, _resolve) + }, btn.execInterval) } else { this.outerLoopRequest(params, _resolve) } @@ -2617,6 +2671,10 @@ if (params.length === 0) { this.execSuccess(result) _resolve() + } else if (btn.execInterval) { + setTimeout(() => { + this.outerLoopRequest(params, _resolve) + }, btn.execInterval) } else { this.outerLoopRequest(params, _resolve) } @@ -2634,12 +2692,16 @@ Api.genericInterface(param, btn.$callbackScript, 'callback').then(res => { if (res.status) { - this.triggerNote(res, param.ID) // 娑堟伅 + this.triggerNote(res, param) // 娑堟伅 // 涓�娆¤姹傛垚鍔燂紝杩涜涓嬩竴椤硅姹� if (params.length === 0) { this.execSuccess(res) _resolve() + } else if (btn.execInterval) { + setTimeout(() => { + this.outerLoopRequest(params, _resolve) + }, btn.execInterval) } else { this.outerLoopRequest(params, _resolve) } @@ -2777,7 +2839,11 @@ duration: 5 }) } else if (window.GLOB.localSystemApi) { - Api.cacheInterface({rduri: window.GLOB.localSystemApi.replace('dostars', 'excache')}).then(result => { + Api.cacheInterface({ + userid: sessionStorage.getItem('LocalUserID') || sessionStorage.getItem('UserID') || '', + LoginUID: sessionStorage.getItem('LocalLoginUID') || sessionStorage.getItem('LoginUID') || '', + rduri: window.GLOB.localSystemApi.replace('dostars', 'excache') + }).then(result => { if (!result.status) { notification.warning({ top: 92, @@ -2852,7 +2918,7 @@ res.message = res.message.replace(/\s*<<.*>>\s*/g, '') val = val ? val[0].replace(/<<|>>/g, '') : '' - if (/^http/.test(val)) { + if (/^(http|\/\/)/.test(val)) { let audio = document.createElement('audio') audio.src = val audio.play() @@ -2862,9 +2928,9 @@ res.ErrCode = '-1' } } - if (/@close_tab@|@close_popup@|@goback@|@no_target_menu@/i.test(res.message)) { - sign = res.message.match(/@close_tab@|@close_popup@|@goback@|@no_target_menu@/i)[0].toLowerCase() - res.message = res.message.replace(/@close_tab@|@close_popup@|@goback@|@no_target_menu@/i, '') + if (/@close_tab@|@close_popup@|@goback@|@no_target_menu@|@open_target_menu@/i.test(res.message)) { + sign = res.message.match(/@close_tab@|@close_popup@|@goback@|@no_target_menu@|@open_target_menu@/i)[0].toLowerCase() + res.message = res.message.replace(/@close_tab@|@close_popup@|@goback@|@no_target_menu@|@open_target_menu@/i, '') } let id = '' @@ -2928,12 +2994,35 @@ } let tabId = '' + let menu = null if (btn.refreshTab && btn.refreshTab.length > 0) { tabId = btn.refreshTab[btn.refreshTab.length - 1] } + if (window.backend && btn.outerFunc && ['bd_workers_create_user_sso', 's_susers_del', 's_susers_add', 's_susers_update', 's_susers_start', 's_susers_admin'].includes(btn.outerFunc)) { + this.clearBackSqlCache() + } + + if (btn.openmenu && Array.isArray(btn.openmenu) && btn.openmenu.length > 0 && sign !== '@no_target_menu@') { + let menuId = btn.openmenu.slice(-1)[0] + if (window.GLOB.mkThdMenus.has(menuId)) { + menu = {...window.GLOB.mkThdMenus.get(menuId), param: { $BID: id }} + } else if (btn.MenuID) { + menu = { + MenuID: btn.MenuID, + MenuName: btn.MenuName, + type: btn.tabType, + param: { $BID: id } + } + } + } + if (tabId && btn.$MenuID === tabId) { // 鍒锋柊褰撳墠鑿滃崟鏃讹紝鍋滄鍏朵粬鎿嶄綔 - MKEmitter.emit('reloadMenuView', tabId) + MKEmitter.emit('reloadMenuView', tabId, btn.urlPar === 'true') + + if (menu) { + MKEmitter.emit('modifyTabs', menu, true) + } return } @@ -2975,7 +3064,7 @@ } if (tabId) { - MKEmitter.emit('reloadMenuView', tabId) + MKEmitter.emit('reloadMenuView', tabId, btn.urlPar === 'true') } if (btn.switchTab && btn.switchTab.length > 0) { @@ -2989,24 +3078,8 @@ node && node.scrollIntoView({behavior: 'smooth', block: 'center', inline: 'nearest'}) } - if (btn.openmenu && Array.isArray(btn.openmenu) && btn.openmenu.length > 0 && sign !== '@no_target_menu@') { - let menuId = btn.openmenu.slice(-1)[0] - let menu = null - - if (window.GLOB.mkThdMenus.has(menuId)) { - menu = {...window.GLOB.mkThdMenus.get(menuId), param: { $BID: id }} - } else if (btn.MenuID) { - menu = { - MenuID: btn.MenuID, - MenuName: btn.MenuName, - type: btn.tabType, - param: { $BID: id } - } - } - - if (menu) { - MKEmitter.emit('modifyTabs', menu, true) - } + if (menu) { + MKEmitter.emit('modifyTabs', menu, true) } if (btn.execSuccess === 'popclose' && btn.$tabId) { // 鏍囩鍏抽棴鍒锋柊 @@ -3042,7 +3115,19 @@ } } - triggerNote = (res, ID) => { + clearBackSqlCache = () => { + Api.cacheInterface({}).then(res => { + if (!res.status) { + notification.warning({ + top: 92, + message: res.message || '缂撳瓨娓呯┖澶辫触锛�', + duration: 5 + }) + } + }) + } + + triggerNote = (res, param) => { const { btn } = this.props if (!btn.verify) return @@ -3054,7 +3139,16 @@ } if (btn.verify.printEnable === 'true') { - this.billPrint(id || ID) + let _id = id || param.ID + + if (!_id && param.data && param.data[0] && param.data[0].exps) { + param.data[0].exps.forEach(cell => { + if (cell.key === 'ID') { + _id = cell.value + } + }) + } + this.billPrint(_id) } if (!id) return @@ -3590,7 +3684,7 @@ res.message = res.message.replace(/\s*<<.*>>\s*/g, '') val = val ? val[0].replace(/<<|>>/g, '') : '' - if (/^http/.test(val)) { + if (/^(http|\/\/)/.test(val)) { let audio = document.createElement('audio') audio.src = val audio.play() @@ -3599,9 +3693,9 @@ if (!res.message) { res.ErrCode = '-1' } - } else if (/@close_tab@|@close_popup@|@goback@/i.test(res.message)) { - sign = res.message.match(/@close_tab@|@close_popup@|@goback@/i)[0].toLowerCase() - res.message = res.message.replace(/@close_tab@|@close_popup@|@goback@/i, '') + } else if (/@close_tab@|@close_popup@|@goback@|@open_target_menu@/i.test(res.message)) { + sign = res.message.match(/@close_tab@|@close_popup@|@goback@|@open_target_menu@/i)[0].toLowerCase() + res.message = res.message.replace(/@close_tab@|@close_popup@|@goback@|@open_target_menu@/i, '') } if (res.ErrCode === 'E') { @@ -3674,7 +3768,7 @@ tabId = btn.refreshTab[btn.refreshTab.length - 1] } if (tabId && btn.$MenuID === tabId) { // 鍒锋柊褰撳墠鑿滃崟鏃讹紝鍋滄鍏朵粬鎿嶄綔 - MKEmitter.emit('reloadMenuView', tabId) + MKEmitter.emit('reloadMenuView', tabId, btn.urlPar === 'true') return } @@ -3706,7 +3800,7 @@ } if (tabId) { - MKEmitter.emit('reloadMenuView', tabId) + MKEmitter.emit('reloadMenuView', tabId, btn.urlPar === 'true') } } @@ -3730,6 +3824,35 @@ if (window.GLOB.breakpoint) { MKEmitter.emit('refreshDebugTable') + } + + if (sign === '@open_target_menu@' && btn.openmenu && Array.isArray(btn.openmenu) && btn.openmenu.length > 0) { + let id = '' + if (this.state.selines && this.state.selines.length > 0 && btn.Ot !== 'notRequired') { + if (btn.Ot === 'requiredOnce') { + id = this.state.selines.map(d => d.$$uuid).filter(Boolean).join(',') + } else { + id = this.state.selines[0].$$uuid + } + } + + let menuId = btn.openmenu.slice(-1)[0] + let menu = null + + if (window.GLOB.mkThdMenus.has(menuId)) { + menu = {...window.GLOB.mkThdMenus.get(menuId), param: { $BID: id || '' }} + } else if (btn.MenuID) { + menu = { + MenuID: btn.MenuID, + MenuName: btn.MenuName, + type: btn.tabType, + param: { $BID: id || '' } + } + } + + if (menu) { + MKEmitter.emit('modifyTabs', menu, true) + } } if (btn.execError === 'popclose' && btn.$tabId) { // 鏍囩鍏抽棴鍒锋柊 @@ -3840,11 +3963,11 @@ /** * @description 妯℃�佹锛堣〃鍗曪級锛岀‘璁� */ - handleOk = () => { + handleOk = (submitType = '') => { if (!this.formRef) return this.formRef.handleConfirm().then(res => { - this.setState({ confirmLoading: true }) + this.setState({ confirmLoading: true, submitType: submitType }) this.execSubmit(this.state.selines, () => { this.setState({ confirmLoading: false }) }, res) }) @@ -3857,7 +3980,8 @@ this.setState({ loading: false, visible: false, - confirmLoading: false + confirmLoading: false, + submitType: '' }) this.preCallback && this.preCallback() @@ -3899,6 +4023,10 @@ let key = item.field.toLowerCase() let _readin = item.readin !== 'false' + if (item.type === 'linkMain' && item.verifyVal === 'true') { + _item.$verify = true + _item.label = item.label + } if (_item.type === 'date') { // 鏃堕棿鍏煎 _item.precision = item.precision || 'day' } else if (_item.type === 'datetime') { @@ -4030,13 +4158,14 @@ */ getModels = () => { const { BID, btn, BData } = this.props - const { btnconfig, visible, dict } = this.state + const { btnconfig, visible, dict, confirmLoading, submitType, loadingNumber, loadingTotal } = this.state if (!btnconfig || !btnconfig.setting) return null let title = btn.label let width = btnconfig.setting.width > 100 ? btnconfig.setting.width : btnconfig.setting.width + 'vw' let clickouter = btnconfig.setting.clickouter === 'close' + let num = loadingNumber && !loadingTotal ? `(${loadingNumber}) ` : '' if (btnconfig.setting.display === 'drawer') { let height = '100vh' @@ -4059,19 +4188,23 @@ <MutilForm BID={BID} action={btnconfig} - inputSubmit={this.handleOk} + inputSubmit={() => this.handleOk()} data={this.state.selines[0]} BData={BData} wrappedComponentRef={(inst) => this.formRef = inst} /> - <div className="ant-drawer-footer" style={{ position: 'absolute', zIndex: 1, right: 0, bottom: 0, width: '100%', borderTop: '1px solid #e9e9e9', padding: '10px 16px', background: '#fff', textAlign: 'right'}}> + {btnconfig.setting.formType === 'check' ? <div className="ant-drawer-footer" style={{ position: 'absolute', zIndex: 1, right: 0, bottom: 0, width: '100%', borderTop: '1px solid #e9e9e9', padding: '10px 16px', background: '#fff', textAlign: 'right'}}> <Button onClick={this.handleCancel} style={{ marginRight: 8 }}> - {btnconfig.setting.formType !== 'check' ? dict['cancel'] || '鍙栨秷' : dict['close'] || '鍏抽棴'} + {dict['close'] || '鍏抽棴'} </Button> - {btnconfig.setting.formType !== 'check' ? <Button onClick={this.handleOk} loading={this.state.confirmLoading} type="primary"> - {dict['ok'] || '纭畾'} - </Button> : null} - </div> + </div> : <div className="ant-drawer-footer" style={{ position: 'absolute', zIndex: 1, right: 0, bottom: 0, width: '100%', borderTop: '1px solid #e9e9e9', padding: '10px 16px', background: '#fff', textAlign: 'right'}}> + <Button onClick={this.handleCancel} style={{ marginRight: 8 }}> + {dict['cancel'] || '鍙栨秷'} + </Button> + {btn.extBtn === 'true' ? <Button className={'extend-btn ' + (btn.extStyle || '')} disabled={confirmLoading && submitType !== btn.extValue} loading={confirmLoading && submitType === btn.extValue} onClick={() => this.handleOk(btn.extValue)}>{btn.extLabel}</Button> : null} + {btn.extBtn === 'true' ? <Button className={'confirm-btn ' + (btn.confStyle || '')} disabled={confirmLoading && submitType !== ''} loading={confirmLoading && submitType === ''} onClick={() => this.handleOk()}>{btn.confLabel || dict['ok'] || '纭畾'}</Button> : null} + {btn.extBtn !== 'true' ? <Button type="primary" loading={confirmLoading} onClick={() => this.handleOk()}>{dict['ok'] || '纭畾'}</Button> : null} + </div>} </Drawer> ) } else { @@ -4097,18 +4230,20 @@ wrapClassName={'action-modal' + (btnconfig.setting.moveable === 'true' ? ' moveable-modal modal-' + btn.uuid : '')} visible={visible} width={width} - okText={dict['ok'] || '纭畾'} - cancelText={dict['cancel'] || '鍙栨秷'} - onOk={this.handleOk} maskStyle={btnconfig.setting.moveable === 'true' ? {backgroundColor: 'rgba(0, 0, 0, 0.15)'} : null} - confirmLoading={this.state.confirmLoading} onCancel={this.handleCancel} + footer={[ + <Button key="cancel" onClick={this.handleCancel}>{dict['cancel'] || '鍙栨秷'}</Button>, + btn.extBtn === 'true' ? <Button key="extend" className={'extend-btn ' + (btn.extStyle || '')} disabled={confirmLoading && submitType !== btn.extValue} loading={confirmLoading && submitType === btn.extValue} onClick={() => this.handleOk(btn.extValue)}>{submitType === btn.extValue ? num : ''}{btn.extLabel}</Button> : null, + btn.extBtn === 'true' ? <Button key="confirm" className={'confirm-btn ' + (btn.confStyle || '')} disabled={confirmLoading && submitType !== ''} loading={confirmLoading && submitType === ''} onClick={() => this.handleOk()}>{submitType === '' ? num : ''}{btn.confLabel || dict['ok'] || '纭畾'}</Button> : null, + btn.extBtn !== 'true' ? <Button key="confirm" type="primary" loading={confirmLoading} onClick={() => this.handleOk()}>{num}{dict['ok'] || '纭畾'}</Button> : null + ]} destroyOnClose > <MutilForm BID={BID} action={btnconfig} - inputSubmit={this.handleOk} + inputSubmit={() => this.handleOk()} data={this.state.selines[0]} BData={BData} wrappedComponentRef={(inst) => this.formRef = inst} -- Gitblit v1.8.0