| | |
| | | new Promise((resolve) => { |
| | | let request = window.GLOB.IndexDB.transaction(['configs']).objectStore('configs').openCursor() |
| | | let menus = [] |
| | | let ids = [] |
| | | |
| | | request.onerror = () => { |
| | | resolve(menus) |
| | |
| | | request.onsuccess = (e) => { |
| | | let cursor = e.target.result |
| | | if (cursor) { |
| | | menus.push(`'${cursor.value.menuid}','${cursor.value.open_edition || 'mk'}'`) |
| | | if (cursor.value.menuid && !ids.includes(cursor.value.menuid)) { |
| | | menus.push(`'${cursor.value.menuid}','${cursor.value.open_edition || 'mk'}'`) |
| | | ids.push(cursor.value.menuid) |
| | | } |
| | | cursor.continue() |
| | | } else { |
| | | resolve(menus) |
| | |
| | | key: 'execSuccess', |
| | | label: '成功后', |
| | | initVal: card.execSuccess || 'grid', |
| | | tooltip: refresh.length ? '执行刷新源组件时,请在源按钮中设置关闭后刷新那一项,注:此时会同步刷新当前组件和上级组件-行。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。' : '选择刷新行时,如果选择多条数据会刷新表格。注:上级组件在数据源中添加。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。', |
| | | tooltip: refresh.length ? '执行刷新源组件时,请在源按钮中设置关闭后刷新那一项,注:此时会同步刷新当前组件和上级组件-行。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。返回信息中包含@close_tab@、@close_popup@、@goback@ 会执行(关闭标签-管理系统)、(关闭弹窗)、(返回上一页-子应用)等动作。' : '选择刷新行时,如果选择多条数据会刷新表格。注:上级组件在数据源中添加。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。返回信息中包含@close_tab@、@close_popup@、@goback@ 会执行(关闭标签-管理系统)、(关闭弹窗)、(返回上一页-子应用)等动作。', |
| | | required: true, |
| | | options: [{ |
| | | value: 'never', |
| | |
| | | key: 'execError', |
| | | label: '失败后', |
| | | initVal: card.execError || 'never', |
| | | tooltip: refresh.length ? '执行刷新源组件时,请在源按钮中设置关闭后刷新那一项,注:此时会同步刷新当前组件和上级组件-行。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。' : '选择刷新行时,如果选择多条数据会刷新表格,注:上级组件在数据源中添加。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。', |
| | | tooltip: refresh.length ? '执行刷新源组件时,请在源按钮中设置关闭后刷新那一项,注:此时会同步刷新当前组件和上级组件-行。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。返回信息中包含@close_tab@、@close_popup@、@goback@ 会执行(关闭标签-管理系统)、(关闭弹窗)、(返回上一页-子应用)等动作。' : '选择刷新行时,如果选择多条数据会刷新表格,注:上级组件在数据源中添加。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。返回信息中包含@close_tab@、@close_popup@、@goback@ 会执行(关闭标签-管理系统)、(关闭弹窗)、(返回上一页-子应用)等动作。', |
| | | required: true, |
| | | options: [{ |
| | | value: 'never', |
| | |
| | | key: 'execSuccess', |
| | | label: '成功后', |
| | | initVal: card.execSuccess || 'grid', |
| | | tooltip: refresh.length ? '执行刷新源组件时,请在源按钮中设置关闭后刷新那一项,注:此时会同步刷新当前组件和上级组件-行。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。' : '选择刷新行时,如果选择多条数据会刷新表格。注:上级组件在数据源中添加。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。', |
| | | tooltip: refresh.length ? '执行刷新源组件时,请在源按钮中设置关闭后刷新那一项,注:此时会同步刷新当前组件和上级组件-行。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。返回信息中包含@close_tab@、@close_popup@、@goback@ 会执行(关闭标签-管理系统)、(关闭弹窗)、(返回上一页-子应用)等动作。' : '选择刷新行时,如果选择多条数据会刷新表格。注:上级组件在数据源中添加。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。返回信息中包含@close_tab@、@close_popup@、@goback@ 会执行(关闭标签-管理系统)、(关闭弹窗)、(返回上一页-子应用)等动作。', |
| | | required: true, |
| | | options: [{ |
| | | value: 'never', |
| | |
| | | key: 'execError', |
| | | label: '失败后', |
| | | initVal: card.execError || 'never', |
| | | tooltip: refresh.length ? '执行刷新源组件时,请在源按钮中设置关闭后刷新那一项,注:此时会同步刷新当前组件和上级组件-行。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。' : '选择刷新行时,如果选择多条数据会刷新表格,注:上级组件在数据源中添加。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。', |
| | | tooltip: refresh.length ? '执行刷新源组件时,请在源按钮中设置关闭后刷新哪一项,注:此时会同步刷新当前组件和上级组件-行。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。返回信息中包含@close_tab@、@close_popup@、@goback@ 会执行(关闭标签-管理系统)、(关闭弹窗)、(返回上一页-子应用)等动作。' : '选择刷新行时,如果选择多条数据会刷新表格,注:上级组件在数据源中添加。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。返回信息中包含@close_tab@、@close_popup@、@goback@ 会执行(关闭标签-管理系统)、(关闭弹窗)、(返回上一页-子应用)等动作。', |
| | | required: true, |
| | | options: [{ |
| | | value: 'never', |
| | |
| | | })(<InputNumber min={0} max={500} precision={0} />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {config.type === 'card' && (config.subtype === 'balcony' || config.subtype === 'propcard') && timer && timer !== '2s' ? <Col span={22}> |
| | | {timer && timer !== '2s' ? <Col span={22}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="可以指定字段用于控制定时器的关闭。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {(config.subtype === 'balcony' || config.subtype === 'propcard') && clearField && timer && timer !== '2s' ? <Col span={22}> |
| | | {clearField && timer && timer !== '2s' ? <Col span={22}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="当字段值与关闭值相等时,关闭定时器,多个值可用逗号分隔。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (/,,/ig.test(values.sql)) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '自定义sql语句中,不可出现连续的英文逗号(,,)', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let error = Utils.verifySql(values.sql, 'customscript') |
| | |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (/,,/ig.test(values.sql)) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '自定义sql语句中,不可出现连续的英文逗号(,,)', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let error = Utils.verifySql(values.sql, 'customscript') |
| | |
| | | }) |
| | | reject() |
| | | return |
| | | } else if (/,,/ig.test(values.dataresource)) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '数据源中,不可出现连续的英文逗号(,,)', |
| | | duration: 5 |
| | | }) |
| | | reject() |
| | | return |
| | | } |
| | | |
| | | let error = Utils.verifySql(values.dataresource) |
| | |
| | | loading: false |
| | | }) |
| | | |
| | | if (config.timer && config.clearField) { |
| | | if (config.timer && config.clearField && result.data && result.data[0]) { |
| | | let vals = (config.clearValue || '').split(',') |
| | | if (vals.includes(_data[config.clearField])) { |
| | | if (vals.includes(result.data[0][config.clearField])) { |
| | | this.timer && this.timer.stop() |
| | | } |
| | | } |
| | |
| | | total: result.total, |
| | | loading: false |
| | | }) |
| | | |
| | | if (config.timer && config.clearField && result.data && result.data[0]) { |
| | | let vals = (config.clearValue || '').split(',') |
| | | if (vals.includes(result.data[0][config.clearField])) { |
| | | this.timer && this.timer.stop() |
| | | } |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | total: result.total, |
| | | loading: false |
| | | }) |
| | | |
| | | if (config.timer && config.clearField && result.data && result.data[0]) { |
| | | let vals = (config.clearValue || '').split(',') |
| | | if (vals.includes(result.data[0][config.clearField])) { |
| | | this.timer && this.timer.stop() |
| | | } |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | } |
| | | }) |
| | | |
| | | if (config.timer && config.clearField) { |
| | | if (config.timer && config.clearField && result.data && result.data[0]) { |
| | | let vals = (config.clearValue || '').split(',') |
| | | if (vals.includes(_data[config.clearField])) { |
| | | if (vals.includes(result.data[0][config.clearField])) { |
| | | this.timer && this.timer.stop() |
| | | } |
| | | } |
| | |
| | | total: result.total, |
| | | loading: false |
| | | }) |
| | | |
| | | if (config.timer && config.clearField && result.data && result.data[0]) { |
| | | let vals = (config.clearValue || '').split(',') |
| | | if (vals.includes(result.data[0][config.clearField])) { |
| | | this.timer && this.timer.stop() |
| | | } |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | let data = result.data.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$$BID = BID || '' |
| | | item.$$BData = BData || '' |
| | | item.$Index = index + 1 |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | data: result.data.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$$BID = BID || '' |
| | | item.$$BData = BData || '' |
| | | item.$Index = index + 1 |
| | | return item |
| | | }), |
| | | data: data, |
| | | loading: false |
| | | }, () => { |
| | | this.openModal(result.ErrCode) |
| | | }) |
| | | |
| | | if (config.timer && config.clearField && result.data && result.data[0]) { |
| | | let vals = (config.clearValue || '').split(',') |
| | | if (vals.includes(result.data[0][config.clearField])) { |
| | | this.timer && this.timer.stop() |
| | | } |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | this.openModal(result.ErrCode) |
| | | } |
| | | }) |
| | | |
| | | if (config.timer && config.clearField && result.data && result.data[0]) { |
| | | let vals = (config.clearValue || '').split(',') |
| | | if (vals.includes(result.data[0][config.clearField])) { |
| | | this.timer && this.timer.stop() |
| | | } |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | this.data = result.data || [] |
| | | this.handleData() |
| | | } |
| | | |
| | | if (config.timer && config.clearField && result.data && result.data[0]) { |
| | | let vals = (config.clearValue || '').split(',') |
| | | if (vals.includes(result.data[0][config.clearField])) { |
| | | this.timer && this.timer.stop() |
| | | } |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | |
| | | if (config.timer && config.clearField && result.data && result.data[0]) { |
| | | let vals = (config.clearValue || '').split(',') |
| | | if (vals.includes(result.data[0][config.clearField])) { |
| | | this.timer && this.timer.stop() |
| | | } |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | this.data = result.data || [] |
| | | this.handleData() |
| | | } |
| | | |
| | | if (config.timer && config.clearField && result.data && result.data[0]) { |
| | | let vals = (config.clearValue || '').split(',') |
| | | if (vals.includes(result.data[0][config.clearField])) { |
| | | this.timer && this.timer.stop() |
| | | } |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | this.data = result.data || [] |
| | | this.handleData() |
| | | } |
| | | |
| | | if (config.timer && config.clearField && result.data && result.data[0]) { |
| | | let vals = (config.clearValue || '').split(',') |
| | | if (vals.includes(result.data[0][config.clearField])) { |
| | | this.timer && this.timer.stop() |
| | | } |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | this.data = result.data || [] |
| | | this.handleData() |
| | | } |
| | | |
| | | if (config.timer && config.clearField && result.data && result.data[0]) { |
| | | let vals = (config.clearValue || '').split(',') |
| | | if (vals.includes(result.data[0][config.clearField])) { |
| | | this.timer && this.timer.stop() |
| | | } |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | start = pageSize * (pageIndex - 1) + 1 |
| | | } |
| | | |
| | | this.setState({ |
| | | data: result.data.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[setting.primaryKey] || '' |
| | | item.$$key = '' + item.key + item.$$uuid |
| | | item.$$BID = BID || '' |
| | | item.$$BData = BData || '' |
| | | item.$Index = start + index + '' |
| | | let data = result.data.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[setting.primaryKey] || '' |
| | | item.$$key = '' + item.key + item.$$uuid |
| | | item.$$BID = BID || '' |
| | | item.$$BData = BData || '' |
| | | item.$Index = start + index + '' |
| | | |
| | | if (config.absFields) { |
| | | config.absFields.forEach(f => { |
| | | if (!isNaN(item[f])) { |
| | | item[f] = Math.abs(item[f]) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (setting.controlField) { |
| | | if (setting.controlVal.includes(item[setting.controlField])) { |
| | | item.$disabled = true |
| | | if (config.absFields) { |
| | | config.absFields.forEach(f => { |
| | | if (!isNaN(item[f])) { |
| | | item[f] = Math.abs(item[f]) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (setting.controlField) { |
| | | if (setting.controlVal.includes(item[setting.controlField])) { |
| | | item.$disabled = true |
| | | } |
| | | |
| | | return item |
| | | }), |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | data: data, |
| | | selectedData: [], |
| | | total: result.total, |
| | | loading: false |
| | | }) |
| | | |
| | | if (config.timer && config.clearField && result.data && result.data[0]) { |
| | | let vals = (config.clearValue || '').split(',') |
| | | if (vals.includes(result.data[0][config.clearField])) { |
| | | this.timer && this.timer.stop() |
| | | } |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | let data = result.data.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$$BID = BID || '' |
| | | item.$$BData = BData || '' |
| | | item.$Index = index + 1 + '' |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | data: result.data.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$$BID = BID || '' |
| | | item.$$BData = BData || '' |
| | | item.$Index = index + 1 + '' |
| | | return item |
| | | }), |
| | | data: data, |
| | | loading: false |
| | | }) |
| | | |
| | | if (config.timer && config.clearField && result.data && result.data[0]) { |
| | | let vals = (config.clearValue || '').split(',') |
| | | if (vals.includes(result.data[0][config.clearField])) { |
| | | this.timer && this.timer.stop() |
| | | } |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | }, () => { |
| | | this.handleData() |
| | | }) |
| | | |
| | | if (config.timer && config.clearField && result.data && result.data[0]) { |
| | | let vals = (config.clearValue || '').split(',') |
| | | if (vals.includes(result.data[0][config.clearField])) { |
| | | this.timer && this.timer.stop() |
| | | } |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | cell.logLabel = item.$menuname + '-' + cell.label |
| | | cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' |
| | | cell.$menuId = item.uuid |
| | | cell.$MenuID = Tab.$MenuID |
| | | cell.$tabId = Tab.uuid |
| | | cell.$toolbtn = true |
| | | |
| | |
| | | cell.Ot = cell.Ot || 'requiredSgl' |
| | | cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' |
| | | cell.$menuId = item.uuid |
| | | cell.$MenuID = Tab.$MenuID |
| | | cell.$tabId = Tab.uuid |
| | | |
| | | if (!mutil && cell.syncComponentId === item.setting.supModule) { |
| | |
| | | cell.Ot = cell.Ot || 'requiredSgl' |
| | | cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' |
| | | cell.$menuId = item.uuid |
| | | cell.$MenuID = Tab.$MenuID |
| | | cell.$tabId = Tab.uuid |
| | | |
| | | if (!mutil && cell.syncComponentId === item.setting.supModule) { |
| | |
| | | cell.logLabel = item.$menuname + '-' + cell.label |
| | | cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' |
| | | cell.$menuId = item.uuid |
| | | cell.$MenuID = Tab.$MenuID |
| | | cell.$tabId = Tab.uuid |
| | | |
| | | if (cell.syncComponentId === item.wrap.supModule) { |
| | |
| | | cell.Ot = cell.Ot || 'requiredSgl' |
| | | cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' |
| | | cell.$menuId = item.uuid |
| | | cell.$MenuID = Tab.$MenuID |
| | | cell.$tabId = Tab.uuid |
| | | |
| | | if (cell.syncComponentId === item.setting.supModule) { |
| | |
| | | const { btn } = this.props |
| | | const { btnconfig, autoMatic } = this.state |
| | | |
| | | if (res.message && /^@speak@/.test(res.message)) { |
| | | res.message = res.message.replace('@speak@', '') |
| | | let sign = '' |
| | | if (/^@speak@/i.test(res.message)) { |
| | | res.message = res.message.replace(/^@speak@/i, '') |
| | | let val = res.message.match(/<<.*>>/) |
| | | res.message = res.message.replace(/\s*<<.*>>\s*/g, '') |
| | | val = val ? val[0].replace(/<<|>>/g, '') : '' |
| | |
| | | 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, '') |
| | | } |
| | | |
| | | if ((res.ErrCode === 'S' || !res.ErrCode) || autoMatic) { // 执行成功 |
| | |
| | | return |
| | | } |
| | | |
| | | if (btn.execSuccess === 'closetab') { |
| | | if (btn.execSuccess === 'closetab' || sign === '@close_tab@') { |
| | | MKEmitter.emit('closeTabView', btn.$MenuID) |
| | | } else if (btn.execSuccess === 'closepoptab') { |
| | | } else if (btn.execSuccess === 'closepoptab' || sign === '@close_popup@') { |
| | | MKEmitter.emit('popclose') |
| | | } else if (btn.execSuccess !== 'never') { |
| | | MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execSuccess, btn, id, this.state.selines) |
| | |
| | | * 2、excel导出,失败后取消导出按钮加载中状态 |
| | | * 3、通知主列表刷新 |
| | | */ |
| | | execError = (res) => { |
| | | execError = (res = {}) => { |
| | | const { btn } = this.props |
| | | const { btnconfig, autoMatic } = this.state |
| | | |
| | | if (res.message && /^@speak@/.test(res.message)) { |
| | | res.message = res.message.replace('@speak@', '') |
| | | let sign = '' |
| | | if (/^@speak@/i.test(res.message)) { |
| | | res.message = res.message.replace(/^@speak@/i, '') |
| | | let val = res.message.match(/<<.*>>/) |
| | | res.message = res.message.replace(/\s*<<.*>>\s*/g, '') |
| | | val = val ? val[0].replace(/<<|>>/g, '') : '' |
| | |
| | | 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, '') |
| | | } |
| | | |
| | | if (res.ErrCode === 'E' && !autoMatic) { |
| | |
| | | MKEmitter.emit('mkFC', 'focus', btnconfig.setting.errFocus) |
| | | } |
| | | |
| | | if (btn.execError === 'closepoptab') { |
| | | if (sign === '@close_tab@') { |
| | | MKEmitter.emit('closeTabView', btn.$MenuID) |
| | | } else if (btn.execError === 'closepoptab' || sign === '@close_popup@') { |
| | | MKEmitter.emit('popclose') |
| | | } else if (btn.execError !== 'never') { |
| | | MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn, '', this.state.selines) |
| | |
| | | |
| | | state = {} |
| | | delButtons = [] |
| | | baseMsg = {} |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.state), fromJS(nextState)) |
| | |
| | | } |
| | | |
| | | execUpdate = (_resolve) => { |
| | | const { config } = this.props |
| | | const config = fromJS(this.props.config).toJS() |
| | | this.delButtons = [] |
| | | this.baseMsg = { |
| | | fstMenuId: config.fstMenuId, |
| | | parentId: config.ParentId, |
| | | MenuName: config.MenuName, |
| | | MenuNo: config.MenuNo, |
| | | } |
| | | |
| | | let _config = { |
| | | version: 1.0, |
| | |
| | | let formActions = [] |
| | | let popActions = [] |
| | | let errors = [] |
| | | let formTabs = [] |
| | | let mainTb = {name: '主表', uuid: Utils.getuuid(), useMSearch: 'false', isMain: true} |
| | | |
| | | let oldtabs = { |
| | | mainTable: mainTb.uuid |
| | | } |
| | | |
| | | let tbl = this.getTable(config, mainTb, errors, formActions, popActions, oldtabs) |
| | | let tbl = this.getTable(config, mainTb, errors, formActions, formTabs, popActions, oldtabs) |
| | | |
| | | if (config.autoMatic && config.autoMatic.enable === 'true') { |
| | | if (tbl.action.filter(item => item.uuid === config.autoMatic.action && (['pop', 'prompt', 'exec'].includes(item.OpenType) || (item.OpenType === 'funcbutton' && item.funcType === 'print'))).length === 0) { |
| | |
| | | _config.components = _config.components.map(item => { |
| | | if (item.type === 'tabs') { |
| | | item.subtabs = item.subtabs.map(tab => { |
| | | tab.components[0] = this.getTable(menus[tab.components[0].linkTab], tab.components[0], errors, formActions, popActions, oldtabs) |
| | | tab.components[0] = this.getTable(menus[tab.components[0].linkTab], tab.components[0], errors, formActions, formTabs, popActions, oldtabs) |
| | | |
| | | return tab |
| | | }) |
| | |
| | | return item |
| | | }) |
| | | |
| | | this.setPopView(_resolve, _config, formActions, popActions, errors) |
| | | this.setPopView(_resolve, _config, formActions, formTabs, popActions, errors) |
| | | }) |
| | | } else { |
| | | this.setPopView(_resolve, _config, formActions, popActions, errors) |
| | | this.setPopView(_resolve, _config, formActions, formTabs, popActions, errors) |
| | | } |
| | | } |
| | | |
| | | setPopView = (_resolve, _config, formActions, popActions, errors) => { |
| | | setPopView = (_resolve, _config, formActions, formTabs, popActions, errors) => { |
| | | if (popActions.length > 0) { |
| | | let defers = popActions.map((item, i) => { |
| | | return new Promise((resolve) => { |
| | |
| | | MenuName: btn.label, |
| | | tables: _config.tables || [], |
| | | Template: 'BaseTable', |
| | | components: [this.getTable(menus[btn.uuid], mainTb, errors, formActions)], |
| | | components: [this.getTable(menus[btn.uuid], mainTb, errors, formActions, formTabs)], |
| | | viewType: 'popview', |
| | | style: { backgroundColor: '#ffffff', backgroundImage: '', paddingTop: '16px', paddingBottom: '40px', paddingLeft: '16px', paddingRight: '16px' } |
| | | } |
| | |
| | | MenuName: btn.label, |
| | | tables: _config.tables || [], |
| | | Template: 'BaseTable', |
| | | components: [this.getTable(menus[btn.uuid], mainTb, errors, formActions)], |
| | | components: [this.getTable(menus[btn.uuid], mainTb, errors, formActions, formTabs)], |
| | | viewType: 'popview', |
| | | style: { backgroundColor: '#ffffff', backgroundImage: '', paddingTop: '16px', paddingBottom: '40px', paddingLeft: '16px', paddingRight: '16px' } |
| | | } |
| | |
| | | MenuName: btn.label, |
| | | tables: _config.tables || [], |
| | | Template: 'BaseTable', |
| | | components: [this.getTable(menus[btn.uuid], mainTb, errors, formActions)], |
| | | components: [this.getTable(menus[btn.uuid], mainTb, errors, formActions, formTabs)], |
| | | viewType: 'popview', |
| | | style: { backgroundColor: '#ffffff', backgroundImage: '', paddingTop: '16px', paddingBottom: '40px', paddingLeft: '16px', paddingRight: '16px' } |
| | | } |
| | |
| | | MenuName: btn.label, |
| | | tables: _config.tables || [], |
| | | Template: 'BaseTable', |
| | | components: [this.getTable(menus[btn.uuid], mainTb, errors, formActions)], |
| | | components: [this.getTable(menus[btn.uuid], mainTb, errors, formActions, formTabs)], |
| | | viewType: 'popview', |
| | | style: { backgroundColor: '#ffffff', backgroundImage: '', paddingTop: '16px', paddingBottom: '40px', paddingLeft: '16px', paddingRight: '16px' } |
| | | } |
| | |
| | | } |
| | | }) |
| | | |
| | | this.setPopForm(_resolve, _config, formActions, errors) |
| | | this.setPopForm(_resolve, _config, formActions, formTabs, errors) |
| | | }) |
| | | } else { |
| | | this.setPopForm(_resolve, _config, formActions, errors) |
| | | this.setPopForm(_resolve, _config, formActions, formTabs, errors) |
| | | } |
| | | } |
| | | |
| | | setPopForm = (_resolve, _config, formActions, errors) => { |
| | | setPopForm = (_resolve, _config, formActions, formTabs, errors) => { |
| | | if (formActions.length > 0) { |
| | | let defers = formActions.map((item, i) => { |
| | | return new Promise((resolve) => { |
| | |
| | | } |
| | | }) |
| | | |
| | | this.saveConfig(_resolve, _config, errors) |
| | | this.saveConfig(_resolve, _config, errors, formTabs) |
| | | }) |
| | | } else { |
| | | this.saveConfig(_resolve, _config, errors) |
| | | this.saveConfig(_resolve, _config, errors, formTabs) |
| | | } |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | saveConfig = (_resolve, _config, errors) => { |
| | | saveConfig = (_resolve, _config, errors, formTabs) => { |
| | | let err = errors.join(';') |
| | | let _this = this |
| | | |
| | |
| | | content: '', |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | _this.saveNewMenu(resolve, _config) |
| | | _this.saveNewMenu(resolve, _config, formTabs) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } else { |
| | | this.saveNewMenu(_resolve, _config) |
| | | this.saveNewMenu(_resolve, _config, formTabs) |
| | | } |
| | | } |
| | | |
| | | saveNewMenu = (_resolve, _config) => { |
| | | saveNewMenu = (_resolve, _config, formTabs) => { |
| | | _config.components.forEach(item => { |
| | | if (item.type === 'tabs') { |
| | | item.subtabs.forEach(tab => { |
| | |
| | | }) |
| | | |
| | | tab.components[0].$tables = getTables(tab.components[0]) |
| | | |
| | | tab.components[0].errors = [] |
| | | let columns = tab.components[0].columns.map(c => c.field) |
| | | if (tab.components[0].setting.interType === 'system' && tab.components[0].setting.execute !== 'false' && !tab.components[0].setting.dataresource) { |
| | | tab.components[0].errors.push({ level: 0, detail: '未设置数据源!'}) |
| | | } else if (tab.components[0].setting.interType === 'system' && tab.components[0].setting.execute === 'false' && tab.components[0].scripts.filter(script => script.status !== 'false').length === 0) { |
| | | tab.components[0].errors.push({ level: 0, detail: '数据源中无可用脚本!'}) |
| | | } else if (!tab.components[0].setting.primaryKey) { |
| | | tab.components[0].errors.push({ level: 0, detail: '未设置主键!'}) |
| | | } else if (!columns.includes(tab.components[0].setting.primaryKey)) { |
| | | tab.components[0].errors.push({ level: 0, detail: '主键已失效!'}) |
| | | } else if (!tab.components[0].setting.supModule) { |
| | | tab.components[0].errors.push({ level: 0, detail: '未设置上级组件!'}) |
| | | } |
| | | }) |
| | | } else { |
| | | item.action.forEach(btn => { |
| | |
| | | }) |
| | | |
| | | item.$tables = getTables(item) |
| | | } |
| | | }) |
| | | |
| | | let tbs = [] |
| | | _config.components.forEach(item => { |
| | | if (item.type === 'tabs') { |
| | | item.subtabs.forEach(tab => { |
| | | if (tab.components[0].$tables) { |
| | | tbs.push(...tab.components[0].$tables) |
| | | } |
| | | |
| | | tab.components[0].errors = [] |
| | | let columns = tab.components[0].columns.map(c => c.field) |
| | | if (tab.components[0].setting.interType === 'system' && tab.components[0].setting.execute !== 'false' && !tab.components[0].setting.dataresource) { |
| | | tab.components[0].errors.push({ level: 0, detail: '未设置数据源!'}) |
| | | } else if (tab.components[0].setting.interType === 'system' && tab.components[0].setting.execute === 'false' && tab.components[0].scripts.filter(script => script.status !== 'false').length === 0) { |
| | | tab.components[0].errors.push({ level: 0, detail: '数据源中无可用脚本!'}) |
| | | } else if (!tab.components[0].setting.primaryKey) { |
| | | tab.components[0].errors.push({ level: 0, detail: '未设置主键!'}) |
| | | } else if (!columns.includes(tab.components[0].setting.primaryKey)) { |
| | | tab.components[0].errors.push({ level: 0, detail: '主键已失效!'}) |
| | | } else if (!tab.components[0].setting.supModule) { |
| | | tab.components[0].errors.push({ level: 0, detail: '未设置上级组件!'}) |
| | | } |
| | | }) |
| | | } else { |
| | | if (item.$tables) { |
| | | tbs.push(...item.$tables) |
| | | } |
| | | |
| | | item.errors = [] |
| | | let columns = item.columns.map(c => c.field) |
| | |
| | | } |
| | | }) |
| | | |
| | | this.submitConfig(_resolve, _config, tbs) |
| | | // if (formTabs.length > 0) { |
| | | // this.transformTabs(_resolve, _config, formTabs) |
| | | // } else { |
| | | this.submitConfig(_resolve, _config) |
| | | // } |
| | | } |
| | | |
| | | submitConfig = (_resolve, config, tbs) => { |
| | | transformTabs = (_resolve, _config, formTabs) => { |
| | | let tab = formTabs.shift() |
| | | |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: tab.uuid |
| | | }).then(res => { |
| | | if (res.status) { |
| | | let _LongParam = '' |
| | | if (res.LongParam) { |
| | | try { |
| | | _LongParam = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam))) |
| | | } catch (e) { |
| | | console.warn('Parse Failure') |
| | | _LongParam = '' |
| | | } |
| | | } |
| | | |
| | | if (_LongParam && (_LongParam.type === 'FormTab' || _LongParam.Template === 'FormTab') && _LongParam.enabled) { |
| | | if (!_LongParam.tabgroups) { |
| | | _LongParam.tabgroups = [] |
| | | } else if (typeof(_LongParam.tabgroups[0]) === 'string') { |
| | | let _tabgroups = [] |
| | | _LongParam.tabgroups.forEach(groupId => { |
| | | let _group = { |
| | | uuid: groupId, |
| | | sublist: fromJS(_LongParam[groupId]).toJS() |
| | | } |
| | | |
| | | delete _LongParam[groupId] |
| | | |
| | | _tabgroups.push(_group) |
| | | }) |
| | | |
| | | _LongParam.tabgroups = _tabgroups |
| | | } |
| | | |
| | | _LongParam.tabgroups = _LongParam.tabgroups.filter(group => group.sublist.length > 0) |
| | | |
| | | _LongParam.tabgroups.forEach(group => { |
| | | group.sublist = group.sublist.map(tab => { |
| | | if (tab.supMenu === 'mainTable') { |
| | | tab.supMenu = '' |
| | | } |
| | | return tab |
| | | }) |
| | | }) |
| | | |
| | | _LongParam.action = _LongParam.action.map(item => { |
| | | if (item.intertype === 'inner' && !item.innerFunc) { |
| | | item.intertype = 'system' |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | delete _LongParam.funcs |
| | | delete _LongParam.tables |
| | | } else { |
| | | _config.components[0].action = _config.components[0].action.filter(btn => btn.uuid !== tab.uuid) |
| | | } |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | _resolve() |
| | | } |
| | | }) |
| | | } |
| | | |
| | | submitConfig = (_resolve, config) => { |
| | | let tbs = [] |
| | | config.components.forEach(item => { |
| | | if (item.type === 'tabs') { |
| | | item.subtabs.forEach(tab => { |
| | | if (tab.components[0].$tables) { |
| | | tbs.push(...tab.components[0].$tables) |
| | | } |
| | | }) |
| | | } else { |
| | | if (item.$tables) { |
| | | tbs.push(...item.$tables) |
| | | } |
| | | } |
| | | }) |
| | | |
| | | let arr = [] |
| | | tbs = tbs.filter(tb => { |
| | | let _tb = tb.toLowerCase() |
| | |
| | | }) |
| | | } |
| | | |
| | | getTable = (config, newCon, errors, formActions, popActions, oldtabs) => { |
| | | getTable = (config, newCon, errors, formActions, formTabs, popActions, oldtabs) => { |
| | | let _card = { |
| | | uuid: newCon.uuid, |
| | | type: 'table', |
| | |
| | | return _card |
| | | } |
| | | |
| | | if (newCon.supModule && oldtabs[newCon.supModule]) { |
| | | if (oldtabs && newCon.supModule && oldtabs[newCon.supModule]) { |
| | | _card.setting.supModule = [oldtabs[newCon.supModule]] |
| | | } else { |
| | | _card.setting.supModule = ['empty'] |
| | |
| | | |
| | | popActions.push({origin: btn.uuid, linkTab: btn.linkTab || '', uuid: _btn.uuid, name: newCon.name, label: btn.label}) |
| | | } else if (_btn.OpenType === 'tab') { |
| | | if (btn.tabTemplate === 'FormTab' || !btn.linkmenu || btn.linkmenu.length !== 3) { |
| | | if (btn.tabTemplate === 'FormTab') { |
| | | if (newCon.isMain !== true) { |
| | | errors.push(newCon.name + '中按钮《' + btn.label + '》不在支持') |
| | | return |
| | | } |
| | | |
| | | delete _btn.tabTemplate |
| | | |
| | | _btn.MenuID = 'tab' + md5(btn.uuid).substr(3) |
| | | _btn.MenuName = this.baseMsg.MenuName + '-' + btn.label |
| | | _btn.MenuNo = this.baseMsg.MenuNo + '_' + _btn.MenuID.substr(-4).toUpperCase() |
| | | _btn.hidden = _btn.hidden || 'false' |
| | | _btn.tabType = 'CustomPage' |
| | | _btn.linkmenu = [this.baseMsg.fstMenuId, this.baseMsg.parentId, _btn.MenuID] |
| | | |
| | | let _tab = {...btn} |
| | | |
| | | _tab.MenuID = _btn.MenuID |
| | | _tab.MenuNo = _btn.MenuNo |
| | | _tab.MenuName = _btn.MenuName |
| | | |
| | | formTabs.push(_tab) |
| | | } else if (!btn.linkmenu || btn.linkmenu.length !== 3) { |
| | | |
| | | errors.push(newCon.name + '中按钮《' + btn.label + '》不在支持') |
| | | return |
| | |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (/,,/ig.test(values.sql)) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '自定义sql语句中,不可出现连续的英文逗号(,,)', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let error = Utils.verifySql(values.sql, 'customscript') |
| | |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (/,,/ig.test(values.sql)) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '自定义sql语句中,不可出现连续的英文逗号(,,)', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let error = Utils.verifySql(values.sql, 'customscript') |
| | |
| | | }) |
| | | reject() |
| | | return |
| | | } else if (/,,/ig.test(values.dataresource)) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '数据源中,不可出现连续的英文逗号(,,)', |
| | | duration: 5 |
| | | }) |
| | | reject() |
| | | return |
| | | } |
| | | |
| | | let error = Utils.verifySql(values.dataresource) |
| | |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (/,,/ig.test(values.sql)) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '自定义sql语句中,不可出现连续的英文逗号(,,)', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let error = Utils.verifySql(values.sql, 'customscript') |
| | |
| | | }) |
| | | reject() |
| | | return |
| | | } else if (/,,/ig.test(values.dataresource)) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '数据源中,不可出现连续的英文逗号(,,)', |
| | | duration: 5 |
| | | }) |
| | | reject() |
| | | return |
| | | } |
| | | |
| | | let error = Utils.verifySql(values.dataresource) |
| | |
| | | }) |
| | | reject() |
| | | return |
| | | } else if (/,,/ig.test(values.dataresource)) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '数据源中,不可出现连续的英文逗号(,,)', |
| | | duration: 5 |
| | | }) |
| | | reject() |
| | | return |
| | | } |
| | | |
| | | let error = Utils.verifySql(values.dataresource) |
| | |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (/,,/ig.test(values.sql)) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '自定义sql语句中,不可出现连续的英文逗号(,,)', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let error = Utils.verifySql(values.sql, 'customscript') |
| | |
| | | }) |
| | | reject() |
| | | return |
| | | } else if (/,,/ig.test(values.dataresource)) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '数据源中,不可出现连续的英文逗号(,,)', |
| | | duration: 5 |
| | | }) |
| | | reject() |
| | | return |
| | | } |
| | | |
| | | let error = Utils.verifySql(values.dataresource) |
| | |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (/,,/ig.test(values.sql)) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '自定义sql语句中,不可出现连续的英文逗号(,,)', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let error = Utils.verifySql(values.sql, 'customscript') |
| | |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (/,,/ig.test(values.sql)) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '自定义sql语句中,不可出现连续的英文逗号(,,)', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let error = Utils.verifySql(values.sql, 'customscript') |
| | |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (/,,/ig.test(values.sql)) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '自定义sql语句中,不可出现连续的英文逗号(,,)', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let error = Utils.verifySql(values.sql) |
| | |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (/,,/ig.test(values.sql)) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '自定义sql语句中,不可出现连续的英文逗号(,,)', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let error = Utils.verifySql(values.sql, 'customscript') |
| | |
| | | let _invalid = _verify.invalid |
| | | |
| | | if (!_invalid) { // 选择行时,失效验证默认开启 |
| | | _invalid = card.Ot !== 'notRequired' ? 'true' : 'false' |
| | | if (config.setting && config.setting.maxScript && config.setting.maxScript >= 300) { |
| | | _invalid = 'false' |
| | | } else { |
| | | _invalid = card.Ot !== 'notRequired' ? 'true' : 'false' |
| | | } |
| | | } |
| | | if (card.sqlType === 'custom') { // 自定义验证时,不使用默认sql |
| | | _verify.default = 'false' |
| | |
| | | /* 失效验证 */ |
| | | select @tbid='', @ErrorCode='',@retmsg='' |
| | | select @tbid='X' from ${datasource} right join (select ID from dbo.SplitComma(@ID@)) sp |
| | | on tb.id =sp.id where tb.id is null |
| | | on tb.${primaryKey} =sp.id where tb.${primaryKey} is null |
| | | |
| | | If @tbid!='' |
| | | Begin |
| | |
| | | {key: 'alter', reg: /(^|\s)alter\s/ig}, |
| | | {key: 'object', reg: /(^|\s)object(\s|\()/ig}, |
| | | {key: 'kill', reg: /(^|\s)kill\s/ig}, |
| | | {key: '--', reg: /--/ig} |
| | | {key: '--', reg: /--/ig}, |
| | | {key: ',,', reg: /,,/ig} |
| | | ] |
| | | |
| | | let error = '' |