| | |
| | | |
| | | /** |
| | | * @description 直接请求 |
| | | * @param {Object} param 查询及提交参数 |
| | | */ |
| | | directRequest (url, method = 'post', param, cross) { |
| | | if (cross === 'true' && param) { |
| | | return axios({ |
| | | url, |
| | | method, |
| | | data: param |
| | | }) |
| | | } else if (cross === 'true') { |
| | | return axios({ |
| | | url, |
| | | method |
| | | }) |
| | | } |
| | | |
| | | let params = { method: 'post' } |
| | | let _url = url |
| | | |
| | | if (method === 'get' && param) { |
| | | let keys = Object.keys(param).map(key => `${key}=${param[key]}`) |
| | | keys = keys.join('&') |
| | | if (keys) { |
| | | _url = _url + '?' + keys |
| | | } |
| | | } else if (method === 'post' && param) { |
| | | params.data = param |
| | | } |
| | | |
| | | _url = _url.replace(/&/ig, '%26') |
| | | params.url = '/trans/redirect?rd=' + _url + '&method=' + method |
| | | |
| | | directRequest (params) { |
| | | return axios(params) |
| | | } |
| | | |
| | |
| | | |
| | | .component-wrap >.ant-col { |
| | | min-height: 0; |
| | | } |
| | | |
| | | .ant-col.ant-col-0 { |
| | | display: inline-block; |
| | | } |
| | |
| | | padding: 4px 20px 4px 5px; |
| | | font-size: 13px; |
| | | } |
| | | .check-card-edit-box { |
| | | .no-margin-bottom { |
| | | margin-bottom: 0px; |
| | | } |
| | | .card-cell { |
| | | padding: 4px 6px; |
| | | } |
| | | .card-color-cell { |
| | | padding: 4px 6px; |
| | | min-height: 32px; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | .ant-form-item::after { |
| | |
| | | lostmsg: '', // 页面丢失时的提示信息 |
| | | config: {}, // 页面配置信息,包括按钮、搜索、显示列、标签等 |
| | | userConfig: null, // 用户自定义设置 |
| | | searchlist: null, // 搜索条件 |
| | | arr_field: '', // 查询字段集 |
| | | setting: null, // 页面全局设置:数据源、按钮及显示列固定、主键等 |
| | | data: null, // 列表数据集 |
| | |
| | | config.setting.customScript = _customScript |
| | | } |
| | | |
| | | config.type = 'table' |
| | | config.wrap = { |
| | | show: config.setting.show || '', |
| | | float: config.setting.float || '', |
| | | advanceType: config.setting.advanceType || '', |
| | | advanceWidth: config.setting.advanceWidth || '', |
| | | drawerPlacement: config.setting.drawerPlacement || '', |
| | | searchRatio: config.setting.searchRatio || '', |
| | | searchLwidth: config.setting.searchLwidth, |
| | | borderRadius: config.setting.borderRadius, |
| | | } |
| | | |
| | | this.setState({ |
| | | hasReqFields, |
| | | BID: param && param.$BID ? param.$BID : '', |
| | |
| | | config: config, |
| | | userConfig: userConfig, |
| | | setting: config.setting, |
| | | searchlist: config.search, |
| | | arr_field: config.columns.map(item => item.field).join(','), |
| | | search: Utils.initMainSearch(config.search) |
| | | }, () => { |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { BID, setting, searchlist, loadingview, viewlost, config, loading, data, triggerTime } = this.state |
| | | const { BID, loadingview, viewlost, config, loading, data, triggerTime } = this.state |
| | | |
| | | return ( |
| | | <div className="calendar-page"> |
| | | {loadingview && <Spin size="large" />} |
| | | {searchlist && searchlist.length > 0 ? |
| | | <MainSearch BID={BID} searchlist={searchlist} setting={setting} refreshdata={this.refreshbysearch}/> : null |
| | | {config.search && config.search.length > 0 ? |
| | | <MainSearch BID={BID} config={config} refreshdata={this.refreshbysearch}/> : null |
| | | } |
| | | {config && config.calendar ? <CalendarComponent calendar={config.calendar} loading={loading} data={data} triggerDate={this.triggerDate} changeDate={this.changeDate}/> : null} |
| | | {!window.GLOB.mkHS && window.GLOB.systemType !== 'production' ? <PagemsgComponent menu={{MenuName: this.props.MenuName, MenuNo: this.props.MenuNo}} config={config} dict={this.state.dict} /> : null} |
| | |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import options from '@/store/options.js' |
| | | import UtilsDM from '@/utils/utils-datamanage.js' |
| | | import { updateCommonTable } from '@/utils/utils-update.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | |
| | | lostmsg: '', // 页面丢失时的提示信息 |
| | | config: {}, // 页面配置信息,包括按钮、搜索、显示列、标签等 |
| | | shortcuts: null, // 快捷键 |
| | | searchlist: null, // 搜索条件 |
| | | actions: null, // 按钮集 |
| | | columns: null, // 显示列 |
| | | arr_field: '', // 查询字段集 |
| | |
| | | statFields: [], // 合计字段 |
| | | statFValue: [], // 合计值 |
| | | absFields: [], // 绝对值字段 |
| | | loadCustomApi: true, // 加载外部资源 |
| | | hasReqFields: false, |
| | | autoMatic: null, |
| | | visible: false |
| | |
| | | config.setting.customScript = '' // 自定义脚本 |
| | | config.setting.dataresource = config.setting.dataresource || '' |
| | | |
| | | if (config.setting.interType === 'system' || (config.setting.interType === 'custom' && config.setting.requestMode === 'system')) { |
| | | if (config.setting.interType === 'system') { |
| | | if (config.setting.scripts && config.setting.scripts.length > 0) { |
| | | let _customScript = '' |
| | | config.setting.scripts.forEach(item => { |
| | |
| | | } |
| | | } |
| | | |
| | | config.type = 'table' |
| | | config.wrap = { |
| | | show: config.setting.show || '', |
| | | float: config.setting.float || '', |
| | | advanceType: config.setting.advanceType || '', |
| | | advanceWidth: config.setting.advanceWidth || '', |
| | | drawerPlacement: config.setting.drawerPlacement || '', |
| | | searchRatio: config.setting.searchRatio || '', |
| | | searchLwidth: config.setting.searchLwidth, |
| | | borderRadius: config.setting.borderRadius, |
| | | } |
| | | |
| | | this.setState({ |
| | | pageSize: config.setting.pageSize || 10, |
| | | loadingview: false, |
| | |
| | | statFields, |
| | | shortcuts: shortcuts.length > 0 ? shortcuts : null, |
| | | setting: config.setting, |
| | | searchlist: config.search, |
| | | actions: _actions, |
| | | columns: _columns, |
| | | arr_field: _arrField.join(','), |
| | |
| | | |
| | | loadData = (id) => { |
| | | const { MenuID } = this.props |
| | | const { setting, search, loadCustomApi, hasReqFields, ContainerId } = this.state |
| | | const { setting, search, hasReqFields, ContainerId } = this.state |
| | | |
| | | this.setState({ |
| | | selectedData: [] |
| | |
| | | } |
| | | } |
| | | |
| | | if (window.GLOB.systemType === 'production' && setting.interType === 'custom' && !setting.proInterface) { |
| | | if (setting.interType === 'custom') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '未设置正式系统地址!', |
| | | message: '系统不在支持自定义接口!', |
| | | duration: 3 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | if (setting.interType === 'custom' && loadCustomApi) { |
| | | if (setting.execTime === 'once') { |
| | | this.setState({loadCustomApi: false}) |
| | | } |
| | | |
| | | this.loadOutResource() |
| | | if (setting.execType === 'async') { |
| | | this.loadmaindata(id) |
| | | } |
| | | } else { |
| | | this.loadmaindata(id) |
| | | } |
| | | } |
| | | |
| | | loadOutResource = () => { |
| | | const { setting, search, BID } = this.state |
| | | |
| | | let param = UtilsDM.getPrevQueryParams(setting, search, BID) |
| | | |
| | | if (setting.execType === 'sync') { |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | } |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | if (res.mk_ex_invoke === 'false' || res.mk_ex_invoke === false) { |
| | | this.loadmaindata() |
| | | } else { |
| | | this.customOuterRequest(res) |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | notification.error({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }, () => { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | customOuterRequest = (result) => { |
| | | const { setting } = this.state |
| | | let url = '' |
| | | |
| | | if (window.GLOB.systemType === 'production') { |
| | | url = setting.proInterface |
| | | } else { |
| | | url = setting.interface |
| | | } |
| | | |
| | | let mkey = result.mk_api_key || '' |
| | | |
| | | delete result.mk_ex_invoke // 是否继续执行 |
| | | delete result.status |
| | | delete result.message |
| | | delete result.ErrCode |
| | | delete result.ErrMesg |
| | | delete result.mk_api_key // 当前请求的key值,用于回调 |
| | | |
| | | let param = {} |
| | | |
| | | Object.keys(result).forEach(key => { |
| | | key = key.replace(/^mk_/ig, '') |
| | | param[key] = result[key] |
| | | }) |
| | | |
| | | Api.directRequest(url, setting.method, param, setting.cross).then(res => { |
| | | if (typeof(res) !== 'object') { |
| | | let error = '未知的返回结果!' |
| | | |
| | | if (typeof(res) === 'string') { |
| | | error = res.replace(/'/ig, '"') |
| | | } |
| | | |
| | | let _result = { |
| | | mk_api_key: mkey, |
| | | $ErrCode: 'E', |
| | | $ErrMesg: error |
| | | } |
| | | |
| | | this.customCallbackRequest(_result) |
| | | } else { |
| | | if (Array.isArray(res)) { |
| | | res = { data: res } |
| | | } |
| | | res.mk_api_key = mkey |
| | | this.customCallbackRequest(res) |
| | | } |
| | | }, (e) => { |
| | | let _result = { |
| | | mk_api_key: mkey, |
| | | $ErrCode: 'E', |
| | | $ErrMesg: e && e.statusText ? e.statusText : '' |
| | | } |
| | | |
| | | this.customCallbackRequest(_result) |
| | | }) |
| | | } |
| | | |
| | | customCallbackRequest = (result) => { |
| | | const { setting, BID } = this.state |
| | | let errSql = '' |
| | | if (result.$ErrCode === 'E') { |
| | | errSql = ` |
| | | set @ErrorCode='E' |
| | | set @retmsg='${result.$ErrMesg}' |
| | | ` |
| | | delete result.$ErrCode |
| | | delete result.$ErrMesg |
| | | } |
| | | |
| | | let lines = UtilsDM.getCallBackSql(setting, result) |
| | | let param = {} |
| | | |
| | | if (setting.callbackType === 'script') { // 使用自定义脚本 |
| | | let sql = lines.map(item => (` |
| | | ${item.insert} |
| | | ${item.selects.join(` union all |
| | | `)} |
| | | `)) |
| | | sql = sql.join('') |
| | | |
| | | param = UtilsDM.getCallBackQueryParams(setting, sql, errSql, BID) |
| | | } else { |
| | | param.func = 's_ex_result_back' |
| | | param.s_ex_result = lines.map((item, index) => ({ |
| | | MenuID: this.state.config.MenuID, |
| | | MenuName: this.state.config.MenuName, |
| | | TableName: item.table, |
| | | LongText: window.btoa(window.encodeURIComponent(`${item.insert} ${item.selects.join(` union all `)}`)), |
| | | Sort: index + 1 |
| | | })) |
| | | |
| | | if (window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud')) { |
| | | let sql = lines.map(item => (` |
| | | ${item.insert} |
| | | ${item.selects.join(` union all |
| | | `)} |
| | | `)) |
| | | sql = sql.join('') |
| | | console.info(sql.replace(/\n\s{10}/ig, '\n')) |
| | | } |
| | | } |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | this.loadmaindata() |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | notification.error({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }, () => { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | }) |
| | | this.loadmaindata(id) |
| | | } |
| | | |
| | | /** |
| | |
| | | getStatFieldsValue = () => { |
| | | const { setting, search, BID, orderBy, statFields } = this.state |
| | | |
| | | if (statFields.length === 0 || !(setting.interType === 'system' || (setting.interType === 'custom' && setting.requestMode === 'system')) || !setting.dataresource) return |
| | | if (statFields.length === 0 || setting.interType !== 'system' || !setting.dataresource) return |
| | | |
| | | let _orderBy = orderBy || setting.order |
| | | let param = UtilsDM.getStatQueryDataParams(setting, statFields, search, _orderBy, BID) |
| | |
| | | reloadview = () => { |
| | | this.setState({ loadingview: true, viewlost: false, config: {}, setting: null, |
| | | data: null, total: 0, loading: false, pageIndex: 1, shortcuts: null, |
| | | pageSize: 10, orderBy: '', search: '', BIDs: {}, pickup: false, searchlist: null |
| | | pageSize: 10, orderBy: '', search: '', BIDs: {}, pickup: false |
| | | }, () => { |
| | | this.loadconfig() |
| | | }) |
| | |
| | | |
| | | render() { |
| | | const { MenuID } = this.props |
| | | const { BID, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, pickup, config, chartId, search, selectedData, shortcuts, autoMatic } = this.state |
| | | const { BID, setting, pageSize, actions, columns, loadingview, viewlost, pickup, config, chartId, search, selectedData, shortcuts, autoMatic } = this.state |
| | | |
| | | return ( |
| | | <div className="commontable" id={this.state.ContainerId}> |
| | | {loadingview ? <Spin size="large" /> : null} |
| | | {searchlist && searchlist.length ? |
| | | <MainSearch BID={BID} searchlist={searchlist} setting={setting} refreshdata={this.refreshbysearch}/> : null |
| | | {config.search && config.search.length ? |
| | | <MainSearch BID={BID} config={config} refreshdata={this.refreshbysearch}/> : null |
| | | } |
| | | {setting && config.charts ? <Row className="chart-view" gutter={16}> |
| | | {/* 视图组 */} |
| | |
| | | import zhCN from '@/locales/zh-CN/main.js' |
| | | import enUS from '@/locales/en-US/main.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import options from '@/store/options.js' |
| | | import UtilsDM from '@/utils/utils-datamanage.js' |
| | | import { updateSubTable } from '@/utils/utils-update.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | |
| | | viewlost: false, // 页面丢失:1、未获取到配置-页面丢失;2、页面未启用 |
| | | lostmsg: '', // 页面丢失时的提示信息 |
| | | config: null, // 页面配置信息,包括按钮、搜索、显示列、标签等 |
| | | searchlist: null, // 搜索条件 |
| | | actions: null, // 按钮集 |
| | | columns: null, // 显示列 |
| | | arr_field: '', // 查询字段集 |
| | |
| | | statFields: [], // 合计字段 |
| | | statFValue: [], // 合计值 |
| | | absFields: [], // 绝对值字段 |
| | | loadCustomApi: true, // 加载外部资源 |
| | | hasReqFields: false, |
| | | BID: '', |
| | | BData: '' |
| | |
| | | config.setting.execute = config.setting.default !== 'false' // 默认sql是否执行,转为boolean 统一格式 |
| | | config.setting.customScript = '' // 自定义脚本 |
| | | |
| | | if (config.setting.interType === 'system' || (config.setting.interType === 'custom' && config.setting.requestMode === 'system')) { |
| | | if (config.setting.interType === 'system') { |
| | | if (config.setting.scripts && config.setting.scripts.length > 0) { |
| | | let _customScript = '' |
| | | config.setting.scripts.forEach(item => { |
| | |
| | | } |
| | | } |
| | | |
| | | config.type = 'table' |
| | | config.wrap = { |
| | | show: config.setting.show || '', |
| | | float: config.setting.float || '', |
| | | advanceType: config.setting.advanceType || '', |
| | | advanceWidth: config.setting.advanceWidth || '', |
| | | drawerPlacement: config.setting.drawerPlacement || '', |
| | | searchRatio: config.setting.searchRatio || '', |
| | | searchLwidth: config.setting.searchLwidth, |
| | | borderRadius: config.setting.borderRadius, |
| | | } |
| | | |
| | | this.setState({ |
| | | pageSize: config.setting.pageSize || 10, |
| | | BID: this.props.BID || '', |
| | |
| | | absFields, |
| | | statFields, |
| | | setting: config.setting, |
| | | searchlist: config.search, |
| | | actions: _actions, |
| | | columns: _columns, |
| | | arr_field: _arrField.join(','), |
| | |
| | | |
| | | loadData = (id) => { |
| | | const { mainSearch } = this.props |
| | | const { setting, BID, search, loadCustomApi, hasReqFields } = this.state |
| | | const { setting, BID, search, hasReqFields } = this.state |
| | | |
| | | let searches = fromJS(search).toJS() |
| | | if (mainSearch && mainSearch.length > 0) { // 主表搜索条件 |
| | |
| | | } |
| | | } |
| | | |
| | | if (setting.interType === 'custom') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '系统不在支持自定义接口!', |
| | | duration: 3 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | if (this.props.Tab.supMenu && !BID) { // 主表ID不存在时,不查询子表 |
| | | this.setState({ |
| | | data: [], |
| | |
| | | }) |
| | | MKEmitter.emit('changeTableLine', this.props.Tab.ContainerId, this.props.Tab.uuid, '', '') |
| | | return |
| | | } else if (window.GLOB.systemType === 'production' && setting.interType === 'custom' && !setting.proInterface) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '未设置正式系统地址!', |
| | | duration: 3 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | }) |
| | | MKEmitter.emit('changeTableLine', this.props.Tab.ContainerId, this.props.Tab.uuid, '', '') |
| | | |
| | | if (setting.interType === 'custom' && loadCustomApi) { |
| | | if (setting.execTime === 'once') { |
| | | this.setState({loadCustomApi: false}) |
| | | } |
| | | |
| | | this.loadOutResource(searches) |
| | | if (setting.execType === 'async') { |
| | | this.loadmaindata(id) |
| | | } |
| | | } else { |
| | | this.loadmaindata(id) |
| | | } |
| | | } |
| | | |
| | | loadOutResource = (searches) => { |
| | | const { setting, BID } = this.state |
| | | |
| | | let param = UtilsDM.getPrevQueryParams(setting, searches, BID) |
| | | |
| | | if (setting.execType === 'sync') { |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | } |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | if (res.mk_ex_invoke === 'false' || res.mk_ex_invoke === false) { |
| | | this.loadmaindata() |
| | | } else { |
| | | this.customOuterRequest(res) |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | notification.error({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }, () => { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | customOuterRequest = (result) => { |
| | | const { setting } = this.state |
| | | let url = '' |
| | | |
| | | if (window.GLOB.systemType === 'production') { |
| | | url = setting.proInterface |
| | | } else { |
| | | url = setting.interface |
| | | } |
| | | |
| | | let mkey = result.mk_api_key || '' |
| | | |
| | | delete result.mk_ex_invoke |
| | | delete result.status |
| | | delete result.message |
| | | delete result.ErrCode |
| | | delete result.ErrMesg |
| | | delete result.mk_api_key |
| | | |
| | | let param = {} |
| | | |
| | | Object.keys(result).forEach(key => { |
| | | key = key.replace(/^mk_/ig, '') |
| | | param[key] = result[key] |
| | | }) |
| | | |
| | | Api.directRequest(url, setting.method, param, setting.cross).then(res => { |
| | | if (typeof(res) !== 'object') { |
| | | let error = '未知的返回结果!' |
| | | |
| | | if (typeof(res) === 'string') { |
| | | error = res.replace(/'/ig, '"') |
| | | } |
| | | |
| | | let _result = { |
| | | mk_api_key: mkey, |
| | | $ErrCode: 'E', |
| | | $ErrMesg: error |
| | | } |
| | | |
| | | this.customCallbackRequest(_result) |
| | | } else { |
| | | if (Array.isArray(res)) { |
| | | res = { data: res } |
| | | } |
| | | res.mk_api_key = mkey |
| | | this.customCallbackRequest(res) |
| | | } |
| | | }, (e) => { |
| | | let _result = { |
| | | mk_api_key: mkey, |
| | | $ErrCode: 'E', |
| | | $ErrMesg: e && e.statusText ? e.statusText : '' |
| | | } |
| | | |
| | | this.customCallbackRequest(_result) |
| | | }) |
| | | } |
| | | |
| | | customCallbackRequest = (result) => { |
| | | const { setting, BID } = this.state |
| | | let errSql = '' |
| | | if (result.$ErrCode === 'E') { |
| | | errSql = ` |
| | | set @ErrorCode='E' |
| | | set @retmsg='${result.$ErrMesg}' |
| | | ` |
| | | delete result.$ErrCode |
| | | delete result.$ErrMesg |
| | | } |
| | | |
| | | let lines = UtilsDM.getCallBackSql(setting, result) |
| | | let param = {} |
| | | |
| | | if (setting.callbackType === 'script') { // 使用自定义脚本 |
| | | let sql = lines.map(item => (` |
| | | ${item.insert} |
| | | ${item.selects.join(` union all |
| | | `)} |
| | | `)) |
| | | sql = sql.join('') |
| | | |
| | | param = UtilsDM.getCallBackQueryParams(setting, sql, errSql, BID) |
| | | } else { |
| | | param.func = 's_ex_result_back' |
| | | param.s_ex_result = lines.map((item, index) => ({ |
| | | MenuID: this.props.MenuID, |
| | | MenuName: this.props.Tab.label, |
| | | TableName: item.table, |
| | | LongText: window.btoa(window.encodeURIComponent(`${item.insert} ${item.selects.join(` union all `)}`)), |
| | | Sort: index + 1 |
| | | })) |
| | | |
| | | if (window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud')) { |
| | | let sql = lines.map(item => (` |
| | | ${item.insert} |
| | | ${item.selects.join(` union all |
| | | `)} |
| | | `)) |
| | | sql = sql.join('') |
| | | console.info(sql.replace(/\n\s{10}/ig, '\n')) |
| | | } |
| | | } |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | this.loadmaindata() |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | notification.error({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }, () => { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | }) |
| | | this.loadmaindata(id) |
| | | } |
| | | |
| | | /** |
| | |
| | | getStatFieldsValue = (searches) => { |
| | | const { setting, BID, orderBy, statFields } = this.state |
| | | |
| | | if (statFields.length === 0 || !(setting.interType === 'system' || (setting.interType === 'custom' && setting.requestMode === 'system')) || !setting.dataresource) return |
| | | if (statFields.length === 0 || setting.interType !== 'system' || !setting.dataresource) return |
| | | |
| | | let _orderBy = orderBy || setting.order |
| | | let param = UtilsDM.getStatQueryDataParams(setting, statFields, searches, _orderBy, BID) |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { config, BID, BData, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, pickup, chartId, selectedData } = this.state |
| | | const { config, BID, BData, setting, pageSize, actions, columns, loadingview, viewlost, pickup, chartId, selectedData } = this.state |
| | | |
| | | return ( |
| | | <div className="subtable" id={'subtable' + this.props.MenuID}> |
| | | {loadingview && <Spin />} |
| | | {searchlist && searchlist.length ? |
| | | <SubSearch BID={BID} setting={setting} searchlist={searchlist} refreshdata={this.refreshbysearch}/> : null |
| | | {config.search && config.search.length ? |
| | | <SubSearch BID={BID} config={config} refreshdata={this.refreshbysearch}/> : null |
| | | } |
| | | {config && config.charts ? <Row className="chart-view" gutter={16}> |
| | | {/* 视图组 */} |
| | |
| | | import zhCN from '@/locales/zh-CN/main.js' |
| | | import enUS from '@/locales/en-US/main.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import options from '@/store/options.js' |
| | | import UtilsDM from '@/utils/utils-datamanage.js' |
| | | import { updateSubTabTable } from '@/utils/utils-update.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | |
| | | viewlost: false, // 页面丢失:1、未获取到配置-页面丢失;2、页面未启用 |
| | | lostmsg: '', // 页面丢失时的提示信息 |
| | | config: null, // 页面配置信息,包括按钮、搜索、显示列、标签等 |
| | | searchlist: null, // 搜索条件 |
| | | actions: null, // 按钮集 |
| | | columns: null, // 显示列 |
| | | arr_field: '', // 查询字段集 |
| | |
| | | statFields: [], // 合计字段 |
| | | statFValue: [], // 合计值 |
| | | absFields: [], // 绝对值字段 |
| | | loadCustomApi: true, // 加载外部资源 |
| | | hasReqFields: false |
| | | } |
| | | |
| | |
| | | config.setting.execute = config.setting.default !== 'false' // 默认sql是否执行,转为boolean 统一格式 |
| | | config.setting.customScript = '' // 自定义脚本 |
| | | |
| | | if (config.setting.interType === 'system' || (config.setting.interType === 'custom' && config.setting.requestMode === 'system')) { |
| | | if (config.setting.interType === 'system') { |
| | | if (config.setting.scripts && config.setting.scripts.length > 0) { |
| | | let _customScript = '' |
| | | config.setting.scripts.forEach(item => { |
| | |
| | | } |
| | | } |
| | | |
| | | config.type = 'table' |
| | | config.wrap = { |
| | | show: config.setting.show || '', |
| | | float: config.setting.float || '', |
| | | advanceType: config.setting.advanceType || '', |
| | | advanceWidth: config.setting.advanceWidth || '', |
| | | drawerPlacement: config.setting.drawerPlacement || '', |
| | | searchRatio: config.setting.searchRatio || '', |
| | | searchLwidth: config.setting.searchLwidth, |
| | | borderRadius: config.setting.borderRadius, |
| | | } |
| | | |
| | | this.setState({ |
| | | pageSize: config.setting.pageSize || 10, |
| | | loadingview: false, |
| | |
| | | absFields, |
| | | statFields, |
| | | setting: config.setting, |
| | | searchlist: config.search, |
| | | actions: _actions, |
| | | columns: _columns, |
| | | arr_field: _arrField.join(','), |
| | |
| | | } |
| | | |
| | | loadData = (id) => { |
| | | const { setting, search, hasReqFields, loadCustomApi } = this.state |
| | | const { setting, search, hasReqFields } = this.state |
| | | |
| | | let searches = fromJS(search).toJS() |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | if (window.GLOB.systemType === 'production' && setting.interType === 'custom' && !setting.proInterface) { |
| | | if (setting.interType === 'custom') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '未设置正式系统地址!', |
| | | message: '系统不在支持自定义接口!', |
| | | duration: 3 |
| | | }) |
| | | return |
| | |
| | | selectedData: [] |
| | | }) |
| | | |
| | | if (setting.interType === 'custom' && loadCustomApi) { |
| | | if (setting.execTime === 'once') { |
| | | this.setState({loadCustomApi: false}) |
| | | } |
| | | |
| | | this.loadOutResource(searches) |
| | | if (setting.execType === 'async') { |
| | | this.loadmaindata(id) |
| | | } |
| | | } else { |
| | | this.loadmaindata(id) |
| | | } |
| | | } |
| | | |
| | | loadOutResource = (searches) => { |
| | | const { setting } = this.state |
| | | |
| | | let param = UtilsDM.getPrevQueryParams(setting, searches, this.props.BID) |
| | | |
| | | if (setting.execType === 'sync') { |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | } |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | if (res.mk_ex_invoke === 'false' || res.mk_ex_invoke === false) { |
| | | this.loadmaindata() |
| | | } else { |
| | | this.customOuterRequest(res) |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | notification.error({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }, () => { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | customOuterRequest = (result) => { |
| | | const { setting } = this.state |
| | | let url = '' |
| | | |
| | | if (window.GLOB.systemType === 'production') { |
| | | url = setting.proInterface |
| | | } else { |
| | | url = setting.interface |
| | | } |
| | | |
| | | let mkey = result.mk_api_key || '' |
| | | |
| | | delete result.mk_ex_invoke |
| | | delete result.status |
| | | delete result.message |
| | | delete result.ErrCode |
| | | delete result.ErrMesg |
| | | delete result.mk_api_key |
| | | |
| | | let param = {} |
| | | |
| | | Object.keys(result).forEach(key => { |
| | | key = key.replace(/^mk_/ig, '') |
| | | param[key] = result[key] |
| | | }) |
| | | |
| | | Api.directRequest(url, setting.method, param, setting.cross).then(res => { |
| | | if (typeof(res) !== 'object') { |
| | | let error = '未知的返回结果!' |
| | | |
| | | if (typeof(res) === 'string') { |
| | | error = res.replace(/'/ig, '"') |
| | | } |
| | | |
| | | let _result = { |
| | | mk_api_key: mkey, |
| | | $ErrCode: 'E', |
| | | $ErrMesg: error |
| | | } |
| | | |
| | | this.customCallbackRequest(_result) |
| | | } else { |
| | | if (Array.isArray(res)) { |
| | | res = { data: res } |
| | | } |
| | | res.mk_api_key = mkey |
| | | this.customCallbackRequest(res) |
| | | } |
| | | }, (e) => { |
| | | let _result = { |
| | | mk_api_key: mkey, |
| | | $ErrCode: 'E', |
| | | $ErrMesg: e && e.statusText ? e.statusText : '' |
| | | } |
| | | |
| | | this.customCallbackRequest(_result) |
| | | }) |
| | | } |
| | | |
| | | customCallbackRequest = (result) => { |
| | | const { setting } = this.state |
| | | let errSql = '' |
| | | if (result.$ErrCode === 'E') { |
| | | errSql = ` |
| | | set @ErrorCode='E' |
| | | set @retmsg='${result.$ErrMesg}' |
| | | ` |
| | | delete result.$ErrCode |
| | | delete result.$ErrMesg |
| | | } |
| | | |
| | | let lines = UtilsDM.getCallBackSql(setting, result) |
| | | let param = {} |
| | | |
| | | if (setting.callbackType === 'script') { // 使用自定义脚本 |
| | | let sql = lines.map(item => (` |
| | | ${item.insert} |
| | | ${item.selects.join(` union all |
| | | `)} |
| | | `)) |
| | | sql = sql.join('') |
| | | |
| | | param = UtilsDM.getCallBackQueryParams(setting, sql, errSql, this.props.BID) |
| | | } else { |
| | | let name = this.props.Tab ? (this.props.Tab.label || '') : '' |
| | | param.func = 's_ex_result_back' |
| | | param.s_ex_result = lines.map((item, index) => ({ |
| | | MenuID: this.props.MenuID, |
| | | MenuName: name, |
| | | TableName: item.table, |
| | | LongText: window.btoa(window.encodeURIComponent(`${item.insert} ${item.selects.join(` union all `)}`)), |
| | | Sort: index + 1 |
| | | })) |
| | | |
| | | if (window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud')) { |
| | | let sql = lines.map(item => (` |
| | | ${item.insert} |
| | | ${item.selects.join(` union all |
| | | `)} |
| | | `)) |
| | | sql = sql.join('') |
| | | console.info(sql.replace(/\n\s{10}/ig, '\n')) |
| | | } |
| | | } |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | this.loadmaindata() |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | notification.error({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }, () => { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | }) |
| | | this.loadmaindata(id) |
| | | } |
| | | |
| | | /** |
| | |
| | | const { BID } = this.props |
| | | const { setting, orderBy, statFields } = this.state |
| | | |
| | | if (statFields.length === 0 || !(setting.interType === 'system' || (setting.interType === 'custom' && setting.requestMode === 'system')) || !setting.dataresource) return |
| | | if (statFields.length === 0 || setting.interType !== 'system' || !setting.dataresource) return |
| | | |
| | | let _orderBy = orderBy || setting.order |
| | | let param = UtilsDM.getStatQueryDataParams(setting, statFields, searches, _orderBy, BID) |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { config, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, selectedData } = this.state |
| | | const { config, setting, pageSize, actions, columns, loadingview, viewlost, selectedData } = this.state |
| | | |
| | | return ( |
| | | <div className="subtabtable" id={'subtabtable' + this.props.MenuID}> |
| | | {loadingview && <Spin />} |
| | | {searchlist && searchlist.length ? |
| | | <SubSearch BID={this.props.BID} setting={setting} searchlist={searchlist} refreshdata={this.refreshbysearch}/> : null |
| | | {config.search && config.search.length ? |
| | | <SubSearch BID={this.props.BID} config={config} refreshdata={this.refreshbysearch}/> : null |
| | | } |
| | | {config ? <div style={{minHeight: '25px'}}> |
| | | <SubAction |
| | |
| | | return _params |
| | | } |
| | | |
| | | getLineParam = (data, formdata, retmsg) => { |
| | | const { setting, btn, columns } = this.props |
| | | let _params = [] |
| | | |
| | | if (btn.Ot === 'notRequired') { |
| | | if (retmsg) { |
| | | let param = { |
| | | $callbacksql: this.getSysDeclareSql(btn, formdata, data[0], columns, '', this.props.BID) |
| | | } |
| | | |
| | | _params.push(param) |
| | | } else { |
| | | _params.push({}) |
| | | } |
| | | } else if ( btn.Ot === 'requiredSgl' || btn.Ot === 'requiredOnce' ) { |
| | | let param = {} |
| | | |
| | | if (this.props.BID) { |
| | | param.BID = this.props.BID |
| | | } |
| | | |
| | | let primaryId = '' |
| | | |
| | | if ((btn.Ot === 'requiredSgl' || btn.Ot === 'requiredOnce') && setting.primaryKey) { |
| | | let ids = data.map(d => { return d[setting.primaryKey] || ''}) |
| | | ids = ids.filter(Boolean) |
| | | primaryId = ids.join(',') |
| | | } |
| | | |
| | | if (setting.primaryKey) { |
| | | param[setting.primaryKey] = primaryId // 设置主键参数 |
| | | } |
| | | |
| | | if (btn.OpenType === 'pop' || btn.OpenType === 'formSubmit' || btn.OpenType === 'form') { // 表单 |
| | | formdata.forEach(_data => { |
| | | param[_data.key] = _data.value |
| | | }) |
| | | } |
| | | |
| | | if (retmsg) { |
| | | param.$callbacksql = this.getSysDeclareSql(btn, formdata, data[0], columns, primaryId, this.props.BID) |
| | | } |
| | | |
| | | _params.push(param) |
| | | } else if (btn.Ot === 'required') { |
| | | _params = data.map((cell, index) => { |
| | | let param = {} |
| | | |
| | | if (this.props.BID) { |
| | | param.BID = this.props.BID |
| | | } |
| | | |
| | | let primaryId = setting.primaryKey ? cell[setting.primaryKey] || '' : '' |
| | | |
| | | if (btn.OpenType === 'pop') { // 表单 |
| | | if (index !== 0) { |
| | | let _cell = {} |
| | | Object.keys(cell).forEach(key => { |
| | | _cell[key.toLowerCase()] = cell[key] |
| | | }) |
| | | formdata = formdata.map(_data => { |
| | | if (_data.readin && _cell.hasOwnProperty(_data.key.toLowerCase())) { |
| | | _data.value = _cell[_data.key.toLowerCase()] |
| | | } |
| | | return _data |
| | | }) |
| | | } |
| | | |
| | | formdata.forEach(_data => { |
| | | param[_data.key] = _data.value |
| | | }) |
| | | } |
| | | if (setting.primaryKey) { |
| | | param[setting.primaryKey] = primaryId |
| | | } |
| | | |
| | | if (retmsg) { |
| | | param.$callbacksql = this.getSysDeclareSql(btn, formdata, cell, columns, primaryId, this.props.BID) |
| | | } |
| | | |
| | | return param |
| | | }) |
| | | } |
| | | |
| | | return _params |
| | | } |
| | | |
| | | /** |
| | | * @description 获取回调脚本的字段定义 |
| | | */ |
| | |
| | | item.script_type = 'Y' |
| | | return item |
| | | }) |
| | | } else { |
| | | } else if (btn.procMode === 'inner') { |
| | | _params = this.getInnerParam(data, formdata, btn.callbackType === 'script') |
| | | } else { |
| | | _params = this.getLineParam(data, formdata, btn.callbackType === 'script') |
| | | } |
| | | |
| | | if (_params.length > 1 && btn.progress === 'progressbar' && btn.$toolbtn) { |
| | |
| | | item.script_type = 'Y' |
| | | return item |
| | | }) |
| | | } else { |
| | | } else if (btn.procMode === 'inner') { |
| | | params = this.getInnerParam(data, formdata, btn.callbackType === 'script') |
| | | } else { |
| | | params = this.getLineParam(data, formdata, btn.callbackType === 'script') |
| | | } |
| | | |
| | | if (params.length > 1 && btn.progress === 'progressbar' && btn.$toolbtn) { |
| | |
| | | param[key] = result[key] |
| | | }) |
| | | |
| | | Api.directRequest(url, btn.method, param, btn.cross).then(res => { |
| | | let _params = { |
| | | url: url, |
| | | method: btn.method || 'post' |
| | | } |
| | | |
| | | if (btn.cross === 'true') { |
| | | if (JSON.stringify(param) !== '{}') { |
| | | _params.data = param |
| | | } |
| | | } else { |
| | | let _url = url |
| | | if (_params.method === 'get' && JSON.stringify(param) !== '{}') { |
| | | let keys = Object.keys(param).map(key => `${key}=${param[key]}`) |
| | | _url = _url + '?' + keys.join('&') |
| | | } else if (_params.method === 'post') { |
| | | _params.data = param |
| | | } |
| | | |
| | | _url = _url.replace(/&/ig, '%26') |
| | | |
| | | _params.url = '/trans/redirect?rd=' + _url + '&method=' + _params.method |
| | | |
| | | _params.method = 'post' |
| | | } |
| | | |
| | | Api.directRequest(_params).then(res => { |
| | | if (typeof(res) !== 'object') { |
| | | let error = '未知的返回结果!' |
| | | |
| | |
| | | if (options.length * config.width > 24) { |
| | | extend += ' mutile-line' |
| | | } |
| | | if (config.border === 'hide') { |
| | | extend += ' border-hide' |
| | | } |
| | | |
| | | return ( |
| | | <div className={'check-card-form-box ' + extend}> |
| | |
| | | border: 1px solid #bcbcbc; |
| | | background: #ffffff; |
| | | border-radius: 4px; |
| | | padding: 6px; |
| | | padding: 4px 6px; |
| | | margin-bottom: 2px; |
| | | line-height: 1.5; |
| | | transition: all 0.3s; |
| | |
| | | position: relative; |
| | | border: 1px solid transparent; |
| | | border-radius: 4px; |
| | | padding: 6px; |
| | | padding: 4px 6px; |
| | | margin-bottom: 2px; |
| | | min-height: 35px; |
| | | min-height: 32px; |
| | | cursor: pointer; |
| | | |
| | | .anticon-check { |
| | |
| | | .card-cell, .card-pic-cell { |
| | | cursor: not-allowed; |
| | | } |
| | | } |
| | | .check-card-form-box.border-hide { |
| | | .card-cell { |
| | | border: 0px; |
| | | } |
| | | } |
| | |
| | | .ant-calendar-picker-container { |
| | | z-index: 10 !important; |
| | | } |
| | | .check-card-form-box { |
| | | .no-margin-bottom { |
| | | margin-bottom: 0px; |
| | | } |
| | | .card-cell { |
| | | padding: 4px 6px; |
| | | } |
| | | .card-color-cell { |
| | | padding: 4px 6px; |
| | | min-height: 32px; |
| | | } |
| | | } |
| | | .advance-button { |
| | | position: absolute; |
| | | left: 0; |
| | |
| | | class MainSearch extends Component { |
| | | static propTpyes = { |
| | | BID: PropTypes.any, // 父级Id,用于查询下拉选择项 |
| | | searchlist: PropTypes.array, // 搜索条件列表 |
| | | config: PropTypes.object, // 组件配置信息(自定义页面) |
| | | setting: PropTypes.object, // 组件配置信息(自定义页面) |
| | | refreshdata: PropTypes.func // 刷新数据 |
| | | } |
| | | |
| | |
| | | sign = '' |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { config, searchlist, setting } = this.props |
| | | const { config } = this.props |
| | | |
| | | let _searchlist = [] |
| | | let fieldMap = new Map() |
| | |
| | | let hasReqFields = false |
| | | |
| | | let forbid = false // header中不设置高级搜索 |
| | | let _setting = {showAdv: false, show: false} |
| | | let _setting = {showAdv: false, show: false, style: null} |
| | | |
| | | if (setting) { |
| | | _setting.show = setting.show !== 'false' |
| | | _setting.float = setting.float || 'left' |
| | | _setting.advanceType = setting.advanceType || 'modal' |
| | | _setting.advWidth = setting.advanceWidth || 1000 |
| | | _setting.placement = setting.drawerPlacement || 'right' |
| | | _setting.ratio = setting.searchRatio || 6 |
| | | _setting.labelwidth = setting.searchLwidth !== undefined ? setting.searchLwidth : 33.3 |
| | | if (config.wrap) { |
| | | _setting.show = config.wrap.show !== 'false' |
| | | _setting.advanceType = config.wrap.advanceType || 'modal' |
| | | _setting.advWidth = config.wrap.advanceWidth || 1000 |
| | | _setting.placement = config.wrap.drawerPlacement || 'right' |
| | | _setting.ratio = config.wrap.searchRatio || 6 |
| | | _setting.labelwidth = config.wrap.searchLwidth !== undefined ? config.wrap.searchLwidth : 33.3 |
| | | _setting.labelCol = {style: {width: _setting.labelwidth + '%'}} |
| | | _setting.wrapperCol = {style: {width: (100 - _setting.labelwidth) + '%'}} |
| | | _setting.style = null |
| | | } else if (config) { |
| | | if (config.wrap) { |
| | | _setting.show = config.wrap.show !== 'false' |
| | | _setting.advanceType = config.wrap.advanceType || 'modal' |
| | | _setting.advWidth = config.wrap.advanceWidth || 1000 |
| | | _setting.placement = config.wrap.drawerPlacement || 'right' |
| | | _setting.ratio = config.wrap.searchRatio || 6 |
| | | _setting.labelwidth = config.wrap.searchLwidth !== undefined ? config.wrap.searchLwidth : 33.3 |
| | | _setting.labelCol = {style: {width: _setting.labelwidth + '%'}} |
| | | _setting.wrapperCol = {style: {width: (100 - _setting.labelwidth) + '%'}} |
| | | _setting.borderRadius = config.wrap.borderRadius |
| | | } |
| | | _setting.style = null |
| | | |
| | | if (config.type === 'search') { |
| | | _setting.float = config.wrap.float || 'left' |
| | | _setting.style = config.style |
| | | } else if (config.type === 'table') { |
| | | _setting.float = 'left' |
| | | } else { |
| | | _setting.float = 'right' |
| | | _setting.show = false |
| | | forbid = true |
| | | } |
| | | _setting.borderRadius = config.wrap.borderRadius |
| | | } |
| | | |
| | | if (config.type === 'search') { |
| | | _setting.float = config.wrap.float || 'left' |
| | | _setting.style = config.style |
| | | } else if (config.type === 'table') { |
| | | _setting.float = 'left' |
| | | } else { |
| | | _setting.float = 'right' |
| | | _setting.show = false |
| | | forbid = true |
| | | } |
| | | |
| | | if (_setting.advanceType === 'drawer' && _setting.advWidth) { |
| | |
| | | } |
| | | } |
| | | |
| | | if (searchlist) { |
| | | _searchlist = fromJS(searchlist).toJS() |
| | | } else if (config) { |
| | | _searchlist = fromJS(config.search).toJS() |
| | | } |
| | | _searchlist = fromJS(config.search).toJS() |
| | | |
| | | _searchlist.forEach(item => { |
| | | if (item.linkField) { |
| | |
| | | content: '*'; |
| | | } |
| | | } |
| | | .check-card-form-box { |
| | | .no-margin-bottom { |
| | | margin-bottom: 0px; |
| | | } |
| | | .card-cell { |
| | | padding: 4px 6px; |
| | | } |
| | | .card-color-cell { |
| | | padding: 4px 6px; |
| | | min-height: 32px; |
| | | } |
| | | } |
| | | .search-button { |
| | | min-height: 55px; |
| | | .ant-btn-link, .ant-btn-link:hover, .ant-btn-link:active{ |
| | |
| | | } |
| | | }) |
| | | |
| | | if ((config.setting.interType === 'system' || config.setting.requestMode === 'system') && config.setting.default === 'false' && config.setting.scripts && config.setting.scripts.filter(item => item.status !== 'false').length === 0) { |
| | | if (config.setting.interType === 'system' && config.setting.default === 'false' && config.setting.scripts && config.setting.scripts.filter(item => item.status !== 'false').length === 0) { |
| | | return '数据源中不执行默认sql,且未添加自定义脚本,不可启用!' |
| | | } else if (config.setting.interType === 'custom' && config.setting.procMode !== 'inner' && config.setting.preScripts && config.setting.preScripts.filter(item => item.status !== 'false').length === 0) { |
| | | return '数据源未设置前置脚本,不可启用!' |
| | |
| | | } |
| | | |
| | | let cls = '' |
| | | if (_options.length * width <= 24 && this.state.appType !== 'mob') { |
| | | if (_options.length * width <= 24) { |
| | | cls = 'no-margin-bottom' |
| | | } |
| | | if (display === 'picture') { |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { config } = this.props |
| | | |
| | | return ( |
| | | <div className="check-card-edit-box" style={{marginTop: '5px'}}> |
| | | <div className={'check-card-edit-box border-' + (config.border || 'show')} style={{marginTop: '5px'}}> |
| | | <Row gutter={12}>{this.getCards()}</Row> |
| | | </div> |
| | | ) |
| | |
| | | position: relative; |
| | | border: 1px solid #bcbcbc; |
| | | border-radius: 4px; |
| | | padding: 6px; |
| | | padding: 4px 6px; |
| | | margin-bottom: 12px; |
| | | |
| | | .bg-mask { |
| | |
| | | .card-color-cell { |
| | | border: 1px solid transparent; |
| | | border-radius: 4px; |
| | | padding: 6px; |
| | | padding: 4px 6px; |
| | | background-size: cover; |
| | | background-position: center; |
| | | margin-bottom: 12px; |
| | | min-height: 35px; |
| | | min-height: 32px; |
| | | } |
| | | |
| | | .content-line { |
| | |
| | | .no-margin-bottom { |
| | | margin-bottom: 2px; |
| | | } |
| | | } |
| | | .check-card-edit-box.border-hide { |
| | | .card-cell { |
| | | border: 0px; |
| | | } |
| | | } |
| | |
| | | padding: 4px 20px 4px 5px; |
| | | font-size: 13px; |
| | | } |
| | | .check-card-edit-box { |
| | | .no-margin-bottom { |
| | | margin-bottom: 0px; |
| | | } |
| | | .card-cell { |
| | | padding: 4px 6px; |
| | | } |
| | | .card-color-cell { |
| | | padding: 4px 6px; |
| | | min-height: 32px; |
| | | } |
| | | } |
| | | } |
| | | .ant-form-explain { |
| | | display: none; |
| | |
| | | } else { |
| | | reRequired.fields = true |
| | | if (this.record.resourceType === '0') { // 自定义资源 |
| | | shows.push('options', 'fields', 'selectStyle') |
| | | shows.push('options', 'fields', 'selectStyle', 'border') |
| | | } else if (this.record.resourceType === '1') { // 数据源 |
| | | shows.push('dataSource', 'cardValField', 'fields', 'orderBy', 'orderType', 'database', 'selectStyle') |
| | | shows.push('dataSource', 'cardValField', 'fields', 'orderBy', 'orderType', 'database', 'selectStyle', 'border') |
| | | } |
| | | if (this.record.selectStyle === 'custom') { |
| | | shows.push('backgroundColor') |
| | |
| | | } |
| | | }) |
| | | |
| | | if ((config.setting.interType === 'system' || config.setting.requestMode === 'system') && config.setting.default === 'false' && config.setting.scripts && config.setting.scripts.filter(item => item.status !== 'false').length === 0) { |
| | | if (config.setting.interType === 'system' && config.setting.default === 'false' && config.setting.scripts && config.setting.scripts.filter(item => item.status !== 'false').length === 0) { |
| | | return '数据源中不执行默认sql,且未添加自定义脚本,不可启用!' |
| | | } else if (config.setting.interType === 'custom' && config.setting.procMode !== 'inner' && config.setting.preScripts && config.setting.preScripts.filter(item => item.status !== 'false').length === 0) { |
| | | return '数据源未设置前置脚本,不可启用!' |
| | |
| | | { |
| | | type: 'number', |
| | | key: 'width', |
| | | min: 1, |
| | | min: 0, |
| | | max: 24, |
| | | precision: 0, |
| | | label: '元素宽度', |
| | | initVal: card.width || 4, |
| | | tooltip: '栅格布局,每行等分为24列。', |
| | | initVal: card.width === 0 ? 0 : (card.width || 4), |
| | | tooltip: '栅格布局,每行等分为24列。注:当宽度为0时,元素根据内容自适应', |
| | | required: true |
| | | }, |
| | | { |
| | |
| | | }, { |
| | | value: 'search', |
| | | text: '搜索框' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'border', |
| | | label: '边框', |
| | | initVal: card.border || 'show', |
| | | required: false, |
| | | options: [{ |
| | | value: 'show', |
| | | text: '显示' |
| | | }, { |
| | | value: 'hide', |
| | | text: '隐藏' |
| | | }] |
| | | }, |
| | | { |
| | |
| | | { |
| | | type: 'number', |
| | | key: 'width', |
| | | min: 1, |
| | | min: 0, |
| | | max: 24, |
| | | precision: 0, |
| | | label: '元素宽度', |
| | | initVal: card.width || 4, |
| | | tooltip: '栅格布局,每行等分为24列。', |
| | | initVal: card.width === 0 ? 0 : (card.width || 4), |
| | | tooltip: '栅格布局,每行等分为24列。注:当宽度为0时,元素根据内容自适应', |
| | | required: true |
| | | }, |
| | | { |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'border', |
| | | label: '边框', |
| | | initVal: card.border || 'show', |
| | | required: false, |
| | | options: [{ |
| | | value: 'show', |
| | | text: '显示' |
| | | }, { |
| | | value: 'hide', |
| | | text: '隐藏' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'selectStyle', |
| | | label: '选中效果', |
| | | tooltip: '背景及文字变化时会使用系统色。', |
| | |
| | | } else { |
| | | reRequired.fields = true |
| | | if (this.record.resourceType === '0') { // 自定义资源 |
| | | shows.push('options', 'fields', 'selectStyle') |
| | | shows.push('options', 'fields', 'selectStyle', 'border') |
| | | } else if (this.record.resourceType === '1') { // 数据源 |
| | | shows.push('dataSource', 'cardValField', 'fields', 'orderBy', 'orderType', 'disableField', 'database', 'selectStyle') |
| | | shows.push('dataSource', 'cardValField', 'fields', 'orderBy', 'orderType', 'disableField', 'database', 'selectStyle', 'border') |
| | | } |
| | | if (this.record.selectStyle === 'custom') { |
| | | shows.push('backgroundColor') |
| | |
| | | static getQueryDataParams (setting, arrFields, search = [], orderBy = '', pageIndex = 1, pageSize = 10, BID, id) { |
| | | let param = null |
| | | |
| | | if (setting.interType === 'system' || (setting.interType === 'custom' && setting.requestMode === 'system')) { |
| | | if (setting.interType === 'system') { |
| | | param = this.getDefaultQueryParam(setting, arrFields, search, orderBy, pageIndex, pageSize, id, BID) |
| | | } else { |
| | | param = this.getCustomQueryParam(setting, search, orderBy, pageIndex, pageSize, id) |
| | |
| | | param.PageSize = pageSize |
| | | } |
| | | |
| | | if (setting.interType === 'inner' || (setting.interType === 'custom' && setting.requestMode === 'inner')) { |
| | | if (setting.interType === 'inner') { |
| | | param.func = setting.innerFunc |
| | | } else { |
| | | if (window.GLOB.mkHS) { |
| | |
| | | param.LText = Utils.formatOptions(LText) |
| | | param.DateCount = Utils.formatOptions(DateCount) |
| | | |
| | | // 多层结构数据 |
| | | // LText = `SELECT a.id as bid,a.ID,a.workerCode,a.workerName,a.jobName,a.Initials,case when isnull(m.friend_id ,'') ='' then '' |
| | | // when isnull(m.status,0)=10 then '已添加' else '待通过' end as friend_text |
| | | // ,case when images='' then 'http://epc.mk9h.cn/Content/images/upload/img/kane.jpg' else images end as icon FROM |
| | | // (select friend_id,status from oa_mail_list where userid='sso202004100959326131C0805998B6745F886F9' and Initials=case when right('0',1)='0' then Initials else '0' end |
| | | // and status=10 and deleted=0) m |
| | | // inner join (select * from BD_workers where |
| | | // Initials=case when right('0',1)='0' then Initials else '0' end and deleted=0 ) a |
| | | // on a.id=m.friend_id ` |
| | | // param.custom_script = '' |
| | | // param.LText = Utils.formatOptions(LText) |
| | | // param.DateCount = '' |
| | | // param.prm_field = 'workerCode' |
| | | // param.arr_field = 'workerName,jobName' |
| | | // param.tabid = 'ID' |
| | | // param.parid = 'BID' |
| | | // param.sub_name = 'sub_data' |
| | | // param.sub_field = 'BID,friend_text,icon,Initials' |
| | | |
| | | if (setting.sub_field) { |
| | | param.sub_name = setting.subdata |
| | | param.tabid = setting.primaryKey || '' |
| | |
| | | } |
| | | |
| | | return param |
| | | } |
| | | |
| | | /** |
| | | * @description 数据源名称,用于统一查询 |
| | | * @param {Object} setting 数据源设置 |
| | | * @param {String} arrFields 查询字段 |
| | | * @param {Array} search 搜索条件 |
| | | * @param {String} orderBy 排序方式 |
| | | * @param {Number} pageIndex 页码 |
| | | * @param {Number} pageSize 每页数量 |
| | | * @param {String} BID 上级ID |
| | | * @return {Object} param |
| | | */ |
| | | static getPrevQueryParams (setting, search = [], BID) { |
| | | let param = null |
| | | if (setting.procMode !== 'inner') { |
| | | param = this.getDefaultPrevQueryParam(setting, search, BID) |
| | | } else { |
| | | param = Utils.formatCustomMainSearch(search) |
| | | param.func = setting.prevFunc || '' |
| | | } |
| | | |
| | | if (BID) { |
| | | param.BID = BID |
| | | } |
| | | |
| | | return param |
| | | } |
| | | |
| | | /** |
| | | * @description 获取系统前置脚本 |
| | | */ |
| | | static getDefaultPrevQueryParam (setting, search, BID) { |
| | | let param = { |
| | | func: 'sPC_TableData_InUpDe', |
| | | exec_type: 'y', |
| | | script_type: 'Y' |
| | | } |
| | | |
| | | let sql = '' |
| | | let userName = sessionStorage.getItem('User_Name') || '' |
| | | let fullName = sessionStorage.getItem('Full_Name') || '' |
| | | let RoleID = sessionStorage.getItem('role_id') || '' |
| | | let departmentcode = sessionStorage.getItem('departmentcode') || '' |
| | | let organization = sessionStorage.getItem('organization') || '' |
| | | let mk_user_type = sessionStorage.getItem('mk_user_type') || '' |
| | | let nation = sessionStorage.getItem('nation') || '' |
| | | let province = sessionStorage.getItem('province') || '' |
| | | let city = sessionStorage.getItem('city') || '' |
| | | let district = sessionStorage.getItem('district') || '' |
| | | let address = sessionStorage.getItem('address') || '' |
| | | |
| | | if (sessionStorage.getItem('isEditState') === 'true') { |
| | | userName = sessionStorage.getItem('CloudUserName') || '' |
| | | fullName = sessionStorage.getItem('CloudFullName') || '' |
| | | } |
| | | |
| | | setting.preScripts.forEach(item => { |
| | | if (item.status === 'false') return |
| | | sql += `${item.sql} |
| | | ` |
| | | }) |
| | | |
| | | if (sql) { |
| | | sql = `/*前置脚本*/ |
| | | declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@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) |
| | | Select @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}' |
| | | ${sql} |
| | | aaa: |
| | | if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ |
| | | ` |
| | | |
| | | let allSearch = Utils.getAllSearchOptions(search) |
| | | allSearch.forEach(item => { |
| | | sql = sql.replace(new RegExp('@' + item.key + '@', 'ig'), `'${item.value}'`) |
| | | }) |
| | | |
| | | if (sessionStorage.getItem('dataM') === 'true') { // 数据权限 |
| | | sql = sql.replace(/\$@/ig, '/*') |
| | | sql = sql.replace(/@\$/ig, '*/') |
| | | } else { |
| | | sql = sql.replace(/@\$|\$@/ig, '') |
| | | } |
| | | |
| | | sql = sql.replace(/@userName@/ig, `'${userName}'`) |
| | | sql = sql.replace(/@fullName@/ig, `'${fullName}'`) |
| | | |
| | | sql = sql.replace(/@ID@/ig, `''`) |
| | | sql = sql.replace(/@BID@/ig, `'${BID || ''}'`) |
| | | sql = sql.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) |
| | | sql = sql.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) |
| | | sql = sql.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) |
| | | sql = sql.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) |
| | | sql = sql.replace(/@typename@/ig, `'admin'`) |
| | | |
| | | // 测试系统打印查询语句 |
| | | if (window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud')) { |
| | | console.info(sql.replace(/\n\s{8}/ig, '\n')) |
| | | } |
| | | } |
| | | |
| | | param.LText = Utils.formatOptions(sql) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | if (window.GLOB.mkHS) { // 函数 sPC_TableData_InUpDe 云端验证 |
| | | param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) |
| | | } |
| | | |
| | | if (setting.$name) { |
| | | param.menuname = setting.$name |
| | | } |
| | | |
| | | return param |
| | | } |
| | | |
| | | /** |
| | | * @description 获取系统回调脚本 |
| | | */ |
| | | static getCallBackQueryParams (setting, sql, errSql, BID) { |
| | | let param = { |
| | | func: 'sPC_TableData_InUpDe', |
| | | exec_type: 'y', |
| | | } |
| | | |
| | | let userName = sessionStorage.getItem('User_Name') || '' |
| | | let fullName = sessionStorage.getItem('Full_Name') || '' |
| | | let RoleID = sessionStorage.getItem('role_id') || '' |
| | | let departmentcode = sessionStorage.getItem('departmentcode') || '' |
| | | let organization = sessionStorage.getItem('organization') || '' |
| | | let mk_user_type = sessionStorage.getItem('mk_user_type') || '' |
| | | let nation = sessionStorage.getItem('nation') || '' |
| | | let province = sessionStorage.getItem('province') || '' |
| | | let city = sessionStorage.getItem('city') || '' |
| | | let district = sessionStorage.getItem('district') || '' |
| | | let address = sessionStorage.getItem('address') || '' |
| | | |
| | | if (sessionStorage.getItem('isEditState') === 'true') { |
| | | userName = sessionStorage.getItem('CloudUserName') || '' |
| | | fullName = sessionStorage.getItem('CloudFullName') || '' |
| | | } |
| | | |
| | | let _prevCustomScript = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@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) |
| | | Select @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}' |
| | | ${errSql} |
| | | ` |
| | | let _backCustomScript = ` |
| | | ` |
| | | |
| | | setting.cbScripts.forEach(script => { |
| | | if (script.status === 'false') return |
| | | |
| | | if (script.position === 'front') { |
| | | _prevCustomScript += ` |
| | | /* 自定义脚本 */ |
| | | ${script.sql} |
| | | ` |
| | | } else { |
| | | _backCustomScript += ` |
| | | /* 自定义脚本 */ |
| | | ${script.sql} |
| | | ` |
| | | } |
| | | }) |
| | | |
| | | _backCustomScript += ` |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` |
| | | |
| | | sql = _prevCustomScript + sql |
| | | sql = sql + _backCustomScript |
| | | |
| | | if (sessionStorage.getItem('dataM') === 'true') { // 数据权限 |
| | | sql = sql.replace(/\$@/ig, '/*') |
| | | sql = sql.replace(/@\$/ig, '*/') |
| | | } else { |
| | | sql = sql.replace(/@\$|\$@/ig, '') |
| | | } |
| | | |
| | | sql = sql.replace(/@ID@/ig, `''`) |
| | | sql = sql.replace(/@BID@/ig, `'${BID || ''}'`) |
| | | sql = sql.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) |
| | | sql = sql.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) |
| | | sql = sql.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) |
| | | sql = sql.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) |
| | | sql = sql.replace(/@typename@/ig, `'admin'`) |
| | | |
| | | if (window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud')) { |
| | | console.info(sql.replace(/\n\s{8}/ig, '\n')) |
| | | } |
| | | |
| | | param.LText = sql |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | |
| | | if (setting.$name) { |
| | | param.menuname = setting.$name |
| | | } |
| | | |
| | | if (BID) { |
| | | param.BID = BID |
| | | } |
| | | |
| | | if (window.GLOB.mkHS) { // 系统函数云端验证 |
| | | param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) |
| | | } |
| | | |
| | | return param |
| | | } |
| | | |
| | | /** |
| | | * @description 获取回调sql |
| | | */ |
| | | static getCallBackSql (setting, result) { |
| | | let lines = [] |
| | | let pre = setting.callbackType === 'script' ? '@' : '' |
| | | |
| | | let getDefaultSql = (obj, tb, bid, level) => { |
| | | let keys = [] |
| | | let vals = [] |
| | | let subObjs = [] |
| | | let id = Utils.getuuid() |
| | | |
| | | delete obj.$$key |
| | | |
| | | Object.keys(obj).forEach(key => { |
| | | let val = obj[key] |
| | | if (val === null || val === undefined) return |
| | | if (typeof(val) === 'object') { |
| | | if (Array.isArray(val)) { |
| | | val.forEach(item => { |
| | | if (typeof(item) !== 'object' || Array.isArray(item)) return |
| | | if (Object.keys(item).length > 0) { |
| | | item.$$key = tb + '_' + key |
| | | subObjs.push(item) |
| | | } |
| | | }) |
| | | } else if (Object.keys(val).length > 0) { |
| | | val.$$key = tb + '_' + key |
| | | subObjs.push(val) |
| | | } |
| | | } else { |
| | | if (typeof(val) === 'string') { |
| | | val = val.replace(/'/ig, '"') |
| | | } |
| | | keys.push(key) |
| | | vals.push(`'${val}'`) |
| | | } |
| | | }) |
| | | |
| | | lines.push({ |
| | | table: tb, |
| | | insert: `Insert into ${pre}${tb} (${keys.join(',')},mk_level,mk_id,mk_bid)`, |
| | | select: `Select ${vals.join(',')},'${level}','${id}','${bid}'` |
| | | }) |
| | | |
| | | subObjs.forEach(item => { |
| | | getDefaultSql(item, item.$$key, id, level + 1) |
| | | }) |
| | | } |
| | | |
| | | getDefaultSql(result, setting.cbTable, '', 1) |
| | | |
| | | let lineMap = new Map() |
| | | lines.forEach(line => { |
| | | if (lineMap.has(line.table)) { |
| | | let _line = lineMap.get(line.table) |
| | | _line.selects.push(line.select) |
| | | lineMap.set(line.table, _line) |
| | | } else { |
| | | lineMap.set(line.table, { |
| | | table: line.table, |
| | | insert: line.insert, |
| | | selects: [line.select] |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | return [...lineMap.values()] |
| | | } |
| | | } |
| | | |
| | |
| | | // md5("/ws/location/v1/ip?callback=callbackFunction&key=key&output=jsonp secret key") |
| | | // md5("/ws/location/v1/ip?callback=callbackFunction&key=BA7BZ-4QB65-LFCIA-QPDA6-4G6O7-MJB4Q&output=jsonpuThL4ZM3XOj642ksEQh76tyHFjh4") |
| | | |
| | | // 获取ip及城市信息 |
| | | // let ipurl = window.atob('aHR0cHM6Ly9lcGMubWs5a$mkC5jbi93ZWJhcGkvaXBsb2M='.replace(/\$mk/ig, '')) |
| | | // Api.directRequest(ipurl, 'get', null, 'true').then(res => { |
| | | // if (!res || !res.ip) return |
| | | // sessionStorage.setItem('ipAddress', res.ip) |
| | | // }) |
| | | |
| | | setTimeout(() => { |
| | | Api.delCacheConfig() |
| | | }, 50) |
| | | |
| | | if (window.GLOB.filter) { |
| | | let view = document.getElementById('mk-login-view') |
| | | |
| | |
| | | param.sign = md5(values) |
| | | param.t = new Date().getTime() |
| | | |
| | | Api.directRequest(_rduri + '/' + _func, 'post', param, 'true').then(res => { |
| | | Api.directRequest({ |
| | | url: _rduri + '/' + _func, |
| | | method: 'post', |
| | | data: param |
| | | }).then(res => { |
| | | if (res.status) { |
| | | if (res.EPC === str) { |
| | | let box = [] |