| | |
| | | import MkIcon from '@/components/mk-icon' |
| | | // import './index.scss' |
| | | |
| | | const { confirm } = Modal |
| | | |
| | | class ExcelInButton extends Component { |
| | | static propTpyes = { |
| | | BID: PropTypes.string, // 主表ID |
| | |
| | | |
| | | param.excel_in_type = 'true' |
| | | param.LText1 = Utils.formatOptions(result.insert) |
| | | param.LText2 = Utils.formatOptions(result.bottom) |
| | | param.LText = Utils.formatOptions(result.sql) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.LText2 = result.bottom |
| | | param.LText = result.sql |
| | | |
| | | let unCheckParam = null |
| | | |
| | | if (/\$check@|@check\$/ig.test(param.LText2) || /\$check@|@check\$/ig.test(param.LText)) { |
| | | unCheckParam = fromJS(param).toJS() |
| | | param.LText = param.LText.replace(/\$check@|@check\$/ig, '') |
| | | param.LText2 = param.LText2.replace(/\$check@|@check\$/ig, '') |
| | | } |
| | | |
| | | param.LText2 = Utils.formatOptions(param.LText2) |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | if (window.GLOB.mkHS && param.timestamp) { // 云端验证 |
| | | param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) |
| | | } |
| | | |
| | | param.menuname = btn.logLabel |
| | | |
| | | |
| | | if (window.GLOB.probation) { |
| | | param.s_debug_type = 'Y' |
| | | } |
| | | |
| | | Api.genericInterface(param).then((res) => { |
| | | if (res.status) { |
| | | this.execSuccess(res) |
| | | } else { |
| | | this.execError(res) |
| | | if (unCheckParam) { |
| | | unCheckParam.LText = unCheckParam.LText.replace(/\$check@/ig, '/*').replace(/@check\$/ig, '*/') |
| | | unCheckParam.LText = Utils.formatOptions(unCheckParam.LText) |
| | | unCheckParam.LText2 = unCheckParam.LText2.replace(/\$check@/ig, '/*').replace(/@check\$/ig, '*/') |
| | | unCheckParam.LText2 = Utils.formatOptions(unCheckParam.LText2) |
| | | |
| | | unCheckParam.secretkey = Utils.encrypt(unCheckParam.LText, unCheckParam.timestamp) |
| | | |
| | | unCheckParam.menuname = btn.logLabel |
| | | |
| | | if (window.GLOB.probation) { |
| | | unCheckParam.s_debug_type = 'Y' |
| | | } |
| | | }, () => { |
| | | this.execError({}) |
| | | }) |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | this.execSuccess(res) |
| | | } else if (res.ErrCode === 'C') { |
| | | const _this = this |
| | | confirm({ |
| | | title: '继续执行?', |
| | | content: res.message, |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | Api.genericInterface(unCheckParam).then(result => { |
| | | if (result.status) { |
| | | _this.execSuccess(result) |
| | | } else { |
| | | _this.execError(result) |
| | | } |
| | | resolve() |
| | | }) |
| | | }) |
| | | }, |
| | | onCancel() { |
| | | _this.execError(res) |
| | | } |
| | | }) |
| | | } else { |
| | | this.execError(res) |
| | | } |
| | | }, () => { |
| | | this.execError({}) |
| | | }) |
| | | } else { |
| | | Api.genericInterface(param).then((res) => { |
| | | if (res.status) { |
| | | this.execSuccess(res) |
| | | } else { |
| | | this.execError(res) |
| | | } |
| | | }, () => { |
| | | this.execError({}) |
| | | }) |
| | | } |
| | | } else if (btn.intertype === 'inner' && btn.innerFunc) { // 自定义存储过程 |
| | | param.func = btn.innerFunc |
| | | |
| | |
| | | loadingTotal: '', |
| | | disabled: false, |
| | | hidden: false, |
| | | checkParam: null, |
| | | autoMatic: false, |
| | | check: false |
| | | } |
| | |
| | | let param = { // 系统存储过程 |
| | | func: 'sPC_TableData_InUpDe' |
| | | } |
| | | let check_param = null |
| | | |
| | | if (this.props.BID) { |
| | | param.BID = this.props.BID |
| | |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | if (/\$check@|@check\$/ig.test(param.LText)) { |
| | | check_param = fromJS(param).toJS() |
| | | check_param.LText = check_param.LText.replace(/\$check@/ig, '/*') |
| | | check_param.LText = check_param.LText.replace(/@check\$/ig, '*/') |
| | | check_param.LText = Utils.formatOptions(check_param.LText) |
| | | |
| | | if (btn.intertype === 'system') { |
| | | param.$unCheckParam = fromJS(param).toJS() |
| | | } |
| | | param.LText = param.LText.replace(/\$check@|@check\$/ig, '') |
| | | } |
| | | |
| | |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | if (/\$check@|@check\$/ig.test(param.LText)) { |
| | | check_param = fromJS(param).toJS() |
| | | check_param.LText = check_param.LText.replace(/\$check@/ig, '/*') |
| | | check_param.LText = check_param.LText.replace(/@check\$/ig, '*/') |
| | | check_param.LText = Utils.formatOptions(check_param.LText) |
| | | |
| | | if (btn.intertype === 'system') { |
| | | param.$unCheckParam = fromJS(param).toJS() |
| | | } |
| | | param.LText = param.LText.replace(/\$check@|@check\$/ig, '') |
| | | } |
| | | |
| | |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | if (/\$check@|@check\$/ig.test(param.LText)) { |
| | | check_param = fromJS(param).toJS() |
| | | check_param.LText = check_param.LText.replace(/\$check@/ig, '/*') |
| | | check_param.LText = check_param.LText.replace(/@check\$/ig, '*/') |
| | | check_param.LText = Utils.formatOptions(check_param.LText) |
| | | |
| | | if (btn.intertype === 'system') { |
| | | param.$unCheckParam = fromJS(param).toJS() |
| | | } |
| | | param.LText = param.LText.replace(/\$check@|@check\$/ig, '') |
| | | } |
| | | |
| | |
| | | |
| | | if (window.GLOB.mkHS) { // 函数 sPC_TableData_InUpDe 云端验证 |
| | | param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) |
| | | if (check_param) { |
| | | check_param.open_key = Utils.encryptOpenKey(check_param.secretkey, check_param.timestamp) |
| | | } |
| | | } |
| | | |
| | | param.menuname = btn.logLabel |
| | |
| | | param.s_debug_type = 'Y' |
| | | } |
| | | |
| | | if (check_param) { |
| | | check_param.menuname = btn.logLabel |
| | | this.setState({checkParam: check_param}) |
| | | } |
| | | |
| | | if (window.GLOB.breakpoint) { |
| | | param.func = 'sPC_TableData_InUpDe_debug' |
| | | } |
| | | |
| | | if (param.$unCheckParam) { |
| | | param.$unCheckParam.LText = param.$unCheckParam.LText.replace(/\$check@/ig, '/*').replace(/@check\$/ig, '*/') |
| | | param.$unCheckParam.LText = Utils.formatOptions(param.$unCheckParam.LText) |
| | | param.$unCheckParam.menuname = btn.logLabel |
| | | |
| | | if (window.GLOB.probation) { |
| | | param.$unCheckParam.s_debug_type = 'Y' |
| | | } |
| | | } |
| | | |
| | | _params.push(param) |
| | |
| | | } else { |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '') |
| | | } |
| | | param.LText = param.LText.replace(/\$check@|@check\$/ig, '') |
| | | |
| | | param.exec_type = 'y' // 后台解码 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | if (/\$check@|@check\$/ig.test(param.LText)) { |
| | | if (btn.intertype === 'system') { |
| | | param.$unCheckParam = fromJS(param).toJS() |
| | | } |
| | | param.LText = param.LText.replace(/\$check@|@check\$/ig, '') |
| | | } |
| | | |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | } else if (btn.OpenType === 'pop') { // 表单 |
| | | if (index !== 0) { |
| | |
| | | } else { |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '') |
| | | } |
| | | param.LText = param.LText.replace(/\$check@|@check\$/ig, '') |
| | | |
| | | param.exec_type = 'y' // 后台解码 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | if (/\$check@|@check\$/ig.test(param.LText)) { |
| | | if (btn.intertype === 'system') { |
| | | param.$unCheckParam = fromJS(param).toJS() |
| | | } |
| | | param.LText = param.LText.replace(/\$check@|@check\$/ig, '') |
| | | } |
| | | |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | } else { |
| | | param.ID = primaryId |
| | |
| | | } else { |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '') |
| | | } |
| | | param.LText = param.LText.replace(/\$check@|@check\$/ig, '') |
| | | |
| | | param.exec_type = 'y' // 后台解码 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | if (/\$check@|@check\$/ig.test(param.LText)) { |
| | | if (btn.intertype === 'system') { |
| | | param.$unCheckParam = fromJS(param).toJS() |
| | | } |
| | | param.LText = param.LText.replace(/\$check@|@check\$/ig, '') |
| | | } |
| | | |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | } |
| | | } |
| | |
| | | |
| | | if (window.GLOB.breakpoint) { |
| | | param.func = 'sPC_TableData_InUpDe_debug' |
| | | } |
| | | |
| | | if (param.$unCheckParam) { |
| | | param.$unCheckParam.LText = param.$unCheckParam.LText.replace(/\$check@/ig, '/*').replace(/@check\$/ig, '*/') |
| | | param.$unCheckParam.LText = Utils.formatOptions(param.$unCheckParam.LText) |
| | | param.$unCheckParam.menuname = btn.logLabel |
| | | |
| | | if (window.GLOB.probation) { |
| | | param.$unCheckParam.s_debug_type = 'Y' |
| | | } |
| | | } |
| | | |
| | | return param |
| | |
| | | params = this.getInnerParam(data, formdata) |
| | | } |
| | | |
| | | if (params.length <= 20) { |
| | | if (params[0].$unCheckParam) { |
| | | this.checkLoopRequest(params, btn, _resolve) |
| | | } else if (params.length <= 20) { |
| | | let deffers = params.map((param, i) => { |
| | | return new Promise(resolve => { |
| | | setTimeout(() => { |
| | |
| | | } else { |
| | | this.innerLoopRequest(params, btn, _resolve) |
| | | } |
| | | } else { |
| | | this.execError(res) |
| | | _resolve() |
| | | } |
| | | }, () => { |
| | | this.updateStatus() |
| | | _resolve() |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 数据检验循环执行 |
| | | */ |
| | | checkLoopRequest = (params, btn, _resolve) => { |
| | | let param = params.shift() |
| | | let unCheckParam = param.$unCheckParam |
| | | |
| | | delete param.$unCheckParam |
| | | |
| | | this.setState({ |
| | | loadingNumber: params.length |
| | | }) |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | this.triggerNote(res) // 消息 |
| | | |
| | | if (params.length === 0) { |
| | | this.execSuccess(res) |
| | | _resolve() |
| | | } else { |
| | | this.checkLoopRequest(params, btn, _resolve) |
| | | } |
| | | } else if (res.ErrCode === 'C') { |
| | | const _this = this |
| | | confirm({ |
| | | title: '继续执行?', |
| | | content: res.message, |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | Api.genericInterface(unCheckParam).then(result => { |
| | | if (result.status) { |
| | | _this.triggerNote(result) // 消息 |
| | | |
| | | if (params.length === 0) { |
| | | _this.execSuccess(result) |
| | | _resolve() |
| | | } else { |
| | | _this.checkLoopRequest(params, btn, _resolve) |
| | | } |
| | | } else { |
| | | _this.execError(res) |
| | | _resolve() |
| | | } |
| | | resolve() |
| | | }) |
| | | }) |
| | | }, |
| | | onCancel() { |
| | | _this.execError(res) |
| | | _resolve() |
| | | } |
| | | }) |
| | | } else { |
| | | this.execError(res) |
| | | _resolve() |
| | |
| | | loadingNumber: '', |
| | | loadingTotal: '', |
| | | }) |
| | | |
| | | if (res.ErrCode === 'C') { |
| | | const _this = this |
| | | if (this.state.checkParam) { |
| | | let param = this.state.checkParam |
| | | confirm({ |
| | | title: res.message || res.ErrMesg, |
| | | content: '继续执行?', |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | Api.genericInterface(param).then((result) => { |
| | | if (result.status) { |
| | | _this.execSuccess(result) |
| | | } else { |
| | | _this.execError(result) |
| | | } |
| | | resolve() |
| | | }, () => { |
| | | _this.setState({ |
| | | visible: false |
| | | }) |
| | | resolve() |
| | | }) |
| | | }) |
| | | }, |
| | | onCancel() { |
| | | _this.setState({ |
| | | visible: false |
| | | }) |
| | | if (btn.execError !== 'never') { |
| | | MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn, '', this.state.selines) |
| | | } |
| | | } |
| | | }) |
| | | this.setState({checkParam: null}) |
| | | return |
| | | } else { |
| | | Modal.error({ |
| | | title: res.message || res.ErrMesg, |
| | | }) |
| | | } |
| | | } |
| | | |
| | | if (btnconfig && btnconfig.setting && btnconfig.setting.errFocus) { |
| | | MKEmitter.emit('mkFC', 'focus', btnconfig.setting.errFocus) |
| | |
| | | } |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`) |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/\$check@|@check\$/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`) |
| | | param.LText = param.LText.replace(/\n/g, ' ') |
| | | |
| | | // 外联数据库替换 |
| | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | exec_type: 'y', |
| | | LText: this.props.initsql + values.sql |
| | | } |
| | | |
| | | param.LText = `${this.props.initsql} |
| | | /* 自定义验证 */ |
| | | select @tbid='', @ErrorCode='',@retmsg='' |
| | | select top 1 @tbid='X' from (${values.sql}) a |
| | | If @tbid = '' |
| | | Begin |
| | | select @ErrorCode='${values.errorCode}',@retmsg='${values.errmsg}' |
| | | goto aaa |
| | | end |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` |
| | | |
| | | if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | window.GLOB.funcs.forEach(item => { |
| | |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.LText = param.LText.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`) |
| | | |
| | | console.info(`/* sql 验证 */\n${param.LText.replace(/\n\s{10}/ig, '\n')}`) |
| | | |
| | | param.LText = param.LText.replace(/\n/g, ' ') |
| | | |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | |
| | | resolve(_fields) |
| | | } |
| | | }).then(_fields => { |
| | | let _usefulfields = ['UserName', 'FullName', 'RoleID', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'BillCode', 'BVoucher', 'FIBVoucherDate', 'FiYear', 'ModularDetailCode'] |
| | | let _declare = ['@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)', '@ErrorCode nvarchar(50)', '@retmsg nvarchar(4000)', '@BillCode nvarchar(50)', '@BVoucher nvarchar(50)', '@FIBVoucherDate nvarchar(50)', '@FiYear nvarchar(50)', '@ModularDetailCode nvarchar(50)', '@bid nvarchar(50)'] |
| | | let _usefulfields = ['UserName', 'FullName', 'RoleID', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'BillCode', 'BVoucher', 'FIBVoucherDate', 'FiYear', 'ModularDetailCode', 'tbid'] |
| | | let _declare = ['@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)', '@ErrorCode nvarchar(50)', '@retmsg nvarchar(4000)', '@BillCode nvarchar(50)', '@BVoucher nvarchar(50)', '@FIBVoucherDate nvarchar(50)', '@FiYear nvarchar(50)', '@ModularDetailCode nvarchar(50)', '@bid nvarchar(50)', '@tbid nvarchar(50)'] |
| | | let _select = ['@UserName=\'\'', '@FullName=\'\'', '@RoleID=\'\'', '@mk_departmentcode=\'\'', '@mk_organization=\'\'', '@mk_user_type=\'\'', '@mk_nation=\'\'', '@mk_province=\'\'', '@mk_city=\'\'', '@mk_district=\'\'', '@mk_address=\'\'', '@ErrorCode=\'\'', '@retmsg=\'\'', '@BillCode=\'\'', '@BVoucher=\'\'', '@FIBVoucherDate=\'\'', '@FiYear=\'\'', '@ModularDetailCode=\'\'', '@bid=\'\''] |
| | | let fieldArr = _usefulfields.map(_f => _f.toLowerCase()) |
| | | let hasBid = false |
| | |
| | | let hasColumn = false |
| | | if (columns && columns.length > 0) { |
| | | if (btnTab) { // 表单标签 |
| | | if (btnTab.Ot !== 'notRequired' && btnTab.Ot !== 'requiredOnce') { |
| | | hasColumn = true |
| | | } |
| | | } else if (card.Ot !== 'notRequired' && card.Ot !== 'requiredOnce') { |
| | | hasColumn = btnTab.Ot !== 'notRequired' |
| | | } else if (card.Ot !== 'notRequired') { |
| | | hasColumn = true |
| | | } |
| | | } |