src/api/index.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/tabviews/calendar/index.jsx | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/tabviews/formtab/index.jsx | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/tabviews/treepage/index.jsx | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/tabviews/zshare/actionList/normalbutton/index.jsx | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/tabviews/zshare/actionList/printbutton/index.jsx | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/tabviews/zshare/mutilform/index.jsx | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/tabviews/zshare/topSearch/index.jsx | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/utils/option.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/utils/utils.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/api/index.js
@@ -631,22 +631,12 @@ * @param {Object} param 请求参数 * @param {Boolean} SSO 是否为单点登录地址 */ getSystemCacheConfig (param, SSO = true) { param.userid = sessionStorage.getItem('UserID') || '' getSystemCacheConfig (param) { param.userid = param.userid || sessionStorage.getItem('UserID') || '' param.lang = localStorage.getItem('lang') || '' param.SessionUid = localStorage.getItem('SessionUid') || '' param.LoginUID = sessionStorage.getItem('LoginUID') || '' param.LoginUID = param.LoginUID || sessionStorage.getItem('LoginUID') || '' param.appkey = window.GLOB.appkey || '' if (sessionStorage.getItem('isEditState') === 'true' && SSO) { // 编辑状态,单点登录服务器为云端 if (options.cloudServiceApi) { // 存在云端地址时,使用云端系统参数 param.rduri = options.cloudServiceApi param.userid = sessionStorage.getItem('CloudUserID') || '' param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' } } else if (window.GLOB.mainSystemApi && SSO) { param.rduri = window.GLOB.mainSystemApi } let _param = JSON.parse(JSON.stringify(param)) // 缓存校验,去除时间和加密字符 delete _param.timestamp src/tabviews/calendar/index.jsx
@@ -26,7 +26,7 @@ class NormalTable extends Component { static propTpyes = { param: PropTypes.any, // 其他页面传递的搜索条件等参数 param: PropTypes.any, // 其他页面传递的参数 MenuID: PropTypes.string, // 菜单Id MenuNo: PropTypes.string, // 菜单参数 MenuName: PropTypes.string // 菜单名称 @@ -114,15 +114,27 @@ } } // 字段权限黑名单 if (_curUserConfig) { config.setting = {...config.setting, ..._curUserConfig.setting} config.easyCode = _curUserConfig.easyCode || config.easyCode || '' } // 字段权限黑名单、必填、字段透视 let valid = true config.search = config.search.map(item => { item.oriInitval = item.initval if (['text', 'select', 'link'].includes(item.type) && param) { if (param.searchkey === item.field) { item.initval = param.searchval } else if (param.BID && item.field === 'BID') { } else if (param.BID && item.field.toLowerCase() === 'bid') { item.initval = param.BID } else if (param.data && param.data[item.field]) { item.initval = param.data[item.field] } } if (item.required === 'true' && !item.initval) { valid = false } if (!item.blacklist || item.blacklist.length === 0) return item @@ -133,30 +145,6 @@ if (_black.length > 0) { item.Hide = 'true' } return item }) if (_curUserConfig) { config.setting = {...config.setting, ..._curUserConfig.setting} config.easyCode = _curUserConfig.easyCode || config.easyCode || '' } // 透视字段处理,初始化处理 let valid = true config.search = config.search.map(item => { item.oriInitval = item.initval if (['text', 'select', 'link'].includes(item.type) && param) { if (param.searchkey === item.field) { item.initval = param.searchval } else if (param.BID && item.field === 'BID') { item.initval = param.BID } } if (item.required === 'true' && !item.initval) { valid = false } return item src/tabviews/formtab/index.jsx
@@ -197,7 +197,6 @@ if (item.resourceType === '1' && item.dataSource) { let _option = Utils.getSelectQueryOptions(item) let _sql = Utils.formatOptions(_option.sql) let isSSO = item.database === 'sso' let param = { func: 'sPC_Get_SelectedList', @@ -218,12 +217,18 @@ if (this.props.menuType === 'HS') { // 云端数据验证 param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) } else if (window.GLOB.systemType !== 'production') { isSSO = false if (item.database === 'sso' && options.cloudServiceApi) { // 存在云端地址时,使用云端系统参数 param.rduri = options.cloudServiceApi param.userid = sessionStorage.getItem('CloudUserID') || '' param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' } } else if (item.database === 'sso' && window.GLOB.mainSystemApi && window.GLOB.systemType === 'production') { param.rduri = window.GLOB.mainSystemApi } let defer = new Promise(resolve => { Api.getSystemCacheConfig(param, isSSO).then(res => { Api.getSystemCacheConfig(param).then(res => { res.search = item resolve(res) }) src/tabviews/treepage/index.jsx
@@ -27,6 +27,7 @@ class TreePage extends Component { static propTpyes = { param: PropTypes.string, // 其他页面传递的参数 MenuID: PropTypes.string, // 菜单Id MenuNo: PropTypes.string, // 菜单参数 MenuName: PropTypes.string // 菜单名称 @@ -36,6 +37,7 @@ dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, ContainerId: Utils.getuuid(), // 菜单外层html Id loadingview: true, // 页面加载中 BID: null, // 页面跳转时携带ID viewlost: false, // 页面丢失:1、未获取到配置-页面丢失;2、页面未启用 lostmsg: '', // 页面丢失时的提示信息 config: {}, // 页面配置信息,包括按钮、搜索、显示列、标签等 @@ -62,7 +64,7 @@ * @description 获取页面配置信息 */ async loadconfig () { const { permAction } = this.props const { permAction, param } = this.props let _param = { func: 'sPC_Get_LongParam', @@ -140,6 +142,7 @@ }) this.setState({ BID: param && param.BID ? param.BID : '', loadingview: false, config: config, tabActive: _tabActive, @@ -243,7 +246,7 @@ * @description 主表数据加载 */ async loadmaindata () { const { setting, searchKey } = this.state const { setting, searchKey, BID } = this.state let param = '' this.setState({ @@ -256,6 +259,10 @@ param = this.getDefaultParam() } if (BID) { param.BID = BID } // 数据管理权限 if (this.props.dataManager) { param.dataM = 'Y' src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -847,6 +847,7 @@ } cell.data_sql = Utils.formatOptions(_option.sql) cell.base_sql = window.btoa(window.encodeURIComponent(_option.sql)) cell.arr_field = _option.field } @@ -878,6 +879,7 @@ } cell.data_sql = Utils.formatOptions(_option.sql) cell.base_sql = window.btoa(window.encodeURIComponent(_option.sql)) cell.arr_field = _option.field } src/tabviews/zshare/actionList/printbutton/index.jsx
@@ -1065,6 +1065,7 @@ } cell.data_sql = Utils.formatOptions(_option.sql) cell.base_sql = window.btoa(window.encodeURIComponent(_option.sql)) cell.arr_field = _option.field } @@ -1096,6 +1097,7 @@ } cell.data_sql = Utils.formatOptions(_option.sql) cell.base_sql = window.btoa(window.encodeURIComponent(_option.sql)) cell.arr_field = _option.field } src/tabviews/zshare/mutilform/index.jsx
@@ -5,6 +5,7 @@ import moment from 'moment' import Api from '@/api' import options from '@/store/options.js' import { formRule, calendarColors } from '@/utils/option.js' import Utils from '@/utils/utils.js' import FileUpload from '../fileupload' @@ -176,7 +177,7 @@ newval = newval.format('YYYY-MM-DD HH:mm:ss') === 'Invalid date' ? '' : newval } if (!newval && item.initval) { newval = moment().subtract(item.initval, 'days') newval = moment(moment().subtract(item.initval, 'days').format('YYYY-MM-DD') + ' 00:00:00', 'YYYY-MM-DD HH:mm:ss') } else if (!newval) { newval = null } @@ -268,110 +269,255 @@ * @description 获取下拉表单选项信息 */ improveActionForm = () => { const { BID, menuType } = this.props const { formlist } = this.state // 需要动态获取下拉菜单的表单 let deForms = formlist.filter(item => ['select', 'link', 'multiselect'].includes(item.type) && item.resourceType === '1' && (item.type === 'link' || item.hidden !== 'true')) if (deForms.length === 0) { return } else if (menuType !== 'HS' && options.sysType === 'local' && !window.GLOB.systemType) { this.improveSimpleActionForm(deForms) return } let deffers = [] let mainItems = [] // 云端或单点数据 let localItems = [] // 本地数据 formlist.forEach(item => { if ( !['select', 'link', 'multiselect'].includes(item.type) || item.resourceType !== '1' || (item.type !== 'link' && item.hidden === 'true') ) return let param = { func: 'sPC_Get_SelectedList', LText: item.data_sql, obj_name: 'data', arr_field: item.arr_field deForms.forEach(item => { if (item.database === 'sso') { mainItems.push(`select '${item.field}' as obj_name,'${item.arr_field}' as arr_field,'${item.base_sql}' as LText`) } else { localItems.push(`select '${item.field}' as obj_name,'${item.arr_field}' as arr_field,'${item.base_sql}' as LText`) } let isSSO = item.database === 'sso' }) if (menuType !== 'HS' && window.GLOB.systemType !== 'production') { localItems = [...localItems, ...mainItems] mainItems = [] } if (this.props.BID) { param.BID = this.props.BID } // 本地请求 let param = { func: 'sPC_Get_SelectedList', LText: localItems.join(' union all '), obj_name: '', arr_field: '', table_type: 'Y' } if (BID) { param.BID = BID } if (param.LText) { param.LText = Utils.formatOptions(param.LText) param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' param.secretkey = Utils.encrypt(param.LText, param.timestamp) if (this.props.menuType === 'HS') { // 云端数据验证 if (menuType === 'HS') { // 云端数据验证 param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) } else if (window.GLOB.systemType !== 'production') { isSSO = false } deffers.push( new Promise(resolve => { Api.getSystemCacheConfig(param, isSSO).then(res => { res.$search = item Api.getSystemCacheConfig(param).then(res => { if (!res.status) { notification.warning({ top: 92, message: res.message, duration: 5 }) } resolve(res) }) }) ) }) ) } if (deffers.length === 0) return // 系统请求 let mainparam = { func: 'sPC_Get_SelectedList', LText: mainItems.join(' union all '), obj_name: '', arr_field: '', table_type: 'Y' } let _field = {} let error = '' Promise.all(deffers).then(result => { result.forEach(res => { if (res.status) { let options = res.data.map(cell => { let item = { key: Utils.getuuid(), Value: cell[res.$search.valueField], Text: cell[res.$search.valueText] } if (BID) { mainparam.BID = BID } if (res.$search.type === 'link') { item.ParentID = cell[res.$search.linkField] } else if (res.$search.type === 'select' && res.$search.linkSubField && res.$search.linkSubField.length > 0) { res.$search.linkSubField.forEach(_field => { item[_field] = (cell[_field] || cell[_field] === 0) ? cell[_field] : '' }) } if (mainparam.LText) { mainparam.LText = Utils.formatOptions(mainparam.LText) mainparam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' mainparam.secretkey = Utils.encrypt(mainparam.LText, mainparam.timestamp) return item }) _field[res.$search.uuid] = options } else { error = res if (menuType === 'HS') { // 云端数据验证 mainparam.open_key = Utils.encrypt(mainparam.secretkey, mainparam.timestamp, true) if (options.cloudServiceApi) { mainparam.rduri = options.cloudServiceApi mainparam.userid = sessionStorage.getItem('CloudUserID') || '' mainparam.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' } }) if (error) { notification.warning({ top: 92, message: error.message, duration: 5 }) } else if (window.GLOB.mainSystemApi) { mainparam.rduri = window.GLOB.mainSystemApi } deffers.push( new Promise(resolve => { Api.getSystemCacheConfig(mainparam).then(res => { if (!res.status) { notification.warning({ top: 92, message: res.message, duration: 5 }) } resolve(res) }) }) ) } Promise.all(deffers).then(response => { let result = {...response[0], ...(response[1] || {})} delete result.ErrCode delete result.ErrMesg delete result.message delete result.status let _formlist = formlist.map(item => { if (item.type === 'select' || item.type === 'link' || item.type === 'multiselect') { if (item.resourceType === '1' && _field.hasOwnProperty(item.uuid)) { item.oriOptions = [...item.oriOptions, ..._field[item.uuid]] } } return item }) _formlist = _formlist.map(item => { if (item.type === 'link') { if (item.supInitVal) { item.options = item.oriOptions.filter(option => option.ParentID === item.supInitVal) } else { item.options = item.oriOptions } } else if (item.type === 'select' || item.type === 'multiselect') { item.options = item.oriOptions if (['select', 'link', 'multiselect'].includes(item.type) && result[item.field] && result[item.field].length > 0) { let options = result[item.field].map(cell => { let _cell = { key: Utils.getuuid(), Value: cell[item.valueField], Text: cell[item.valueText] } if (item.type === 'link') { _cell.ParentID = cell[item.linkField] } else if (item.type === 'select' && item.linkSubField && item.linkSubField.length > 0) { item.linkSubField.forEach(_field => { _cell[_field] = (cell[_field] || cell[_field] === 0) ? cell[_field] : '' }) } return _cell }) item.oriOptions = [...item.oriOptions, ...options] } return item }) this.setState({ formlist: _formlist formlist: _formlist.map(item => { if (item.type === 'link') { if (item.supInitVal) { item.options = item.oriOptions.filter(option => option.ParentID === item.supInitVal) } else { item.options = item.oriOptions } } else if (item.type === 'select' || item.type === 'multiselect') { item.options = item.oriOptions } return item }) }) }) } /** * @description 测试系统获取下拉表单选项信息 */ improveSimpleActionForm = (deForms) => { const { formlist } = this.state let deffers = deForms.map(form => { let param = { func: 'sPC_Get_SelectedList', LText: form.data_sql, obj_name: form.field, arr_field: form.arr_field } if (this.props.BID) { param.BID = this.props.BID } param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' param.secretkey = Utils.encrypt(param.LText, param.timestamp) return ( new Promise(resolve => { Api.getSystemCacheConfig(param).then(res => { if (!res.status) { notification.warning({ top: 92, message: res.message, duration: 5 }) } resolve(res) }) }) ) }) Promise.all(deffers).then(response => { let result = {} response.forEach(res => { result = {...result, ...res} }) delete result.ErrCode delete result.ErrMesg delete result.message delete result.status let _formlist = formlist.map(item => { if (['select', 'link', 'multiselect'].includes(item.type) && result[item.field] && result[item.field].length > 0) { let options = result[item.field].map(cell => { let _cell = { key: Utils.getuuid(), Value: cell[item.valueField], Text: cell[item.valueText] } if (item.type === 'link') { _cell.ParentID = cell[item.linkField] } else if (item.type === 'select' && item.linkSubField && item.linkSubField.length > 0) { item.linkSubField.forEach(_field => { _cell[_field] = (cell[_field] || cell[_field] === 0) ? cell[_field] : '' }) } return _cell }) item.oriOptions = [...item.oriOptions, ...options] } return item }) this.setState({ formlist: _formlist.map(item => { if (item.type === 'link') { if (item.supInitVal) { item.options = item.oriOptions.filter(option => option.ParentID === item.supInitVal) } else { item.options = item.oriOptions } } else if (item.type === 'select' || item.type === 'multiselect') { item.options = item.oriOptions } return item }) }) }) } src/tabviews/zshare/topSearch/index.jsx
@@ -5,6 +5,7 @@ import moment from 'moment' import Api from '@/api' import options from '@/store/options.js' import DateGroup from '@/tabviews/zshare/dategroup' import Utils from '@/utils/utils.js' import './index.scss' @@ -38,6 +39,9 @@ let required = {} let _list = [] let fieldMap = new Map() let mainItems = [] // 云端或单点数据 let localItems = [] // 本地数据 let deForms = [] // 测试系统,单个请求 searchlist.forEach(item => { if (fieldMap.has(item.field)) { @@ -50,13 +54,40 @@ style[item.field] = item.type required[item.field] = item.required === 'true' if (item.type === 'select' || item.type === 'link') { if (item.setAll === 'true') { if (['select', 'link', 'multiselect'].includes(item.type)) { if (item.setAll === 'true' && item.type !== 'multiselect') { item.options.unshift({ key: Utils.getuuid(), Value: '', Text: this.props.dict['main.all'] }) } // 数据源查询语句 if (item.resourceType === '1' && item.dataSource) { let _option = Utils.getSelectQueryOptions(item) if (this.props.dataManager) { // 数据权限 _option.sql = _option.sql.replace(/\$@/ig, '/*') _option.sql = _option.sql.replace(/@\$/ig, '*/') } else { _option.sql = _option.sql.replace(/@\$|\$@/ig, '') } // 测试系统单个请求 if (this.props.menuType !== 'HS' && options.sysType === 'local' && !window.GLOB.systemType) { deForms.push({ ...item, arr_field: _option.field, data_sql: Utils.formatOptions(_option.sql) }) } else { // 合并请求,区分本地及系统 if (item.database === 'sso') { mainItems.push(`select '${item.field}' as obj_name,'${_option.field}' as arr_field,'${window.btoa(window.encodeURIComponent(_option.sql))}' as LText`) } else { localItems.push(`select '${item.field}' as obj_name,'${_option.field}' as arr_field,'${window.btoa(window.encodeURIComponent(_option.sql))}' as LText`) } } } item.oriOptions = fromJS(item.options).toJS() } @@ -75,7 +106,9 @@ message: '未查询到搜索条件《' + item.label + '》关联字段!', duration: 5 }) item.supInitVal = '' } else { item.supInitVal = supItem.initval item.options = item.oriOptions.filter(option => option.ParentID === supItem.initval) } } else if (item.type === 'group' && item.Hide !== 'true') { @@ -93,135 +126,237 @@ searchlist: _list, groups: _groups }, () => { this.improveSearch() if (this.props.menuType !== 'HS' && options.sysType === 'local' && !window.GLOB.systemType) { this.improveSimpleSearch(deForms) } else { this.improveSearch(mainItems, localItems) } }) } improveSearch = () => { let searchlist = fromJS(this.props.searchlist).toJS() // 查询下拉菜单 improveSearch = (mainItems, localItems) => { const { menuType, BID } = this.props let deffers = [] searchlist.forEach(item => { if (item.type !== 'multiselect' && item.type !== 'select' && item.type !== 'link') return if (item.setAll === 'true') { item.options.unshift({ key: Utils.getuuid(), Value: '', Text: this.props.dict['main.all'] }) if (menuType !== 'HS' && window.GLOB.systemType !== 'production') { localItems = [...localItems, ...mainItems] mainItems = [] } // 本地请求 let param = { func: 'sPC_Get_SelectedList', LText: localItems.join(' union all '), obj_name: '', arr_field: '', table_type: 'Y' } if (BID) { param.BID = BID } if (param.LText) { param.LText = Utils.formatOptions(param.LText) param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' param.secretkey = Utils.encrypt(param.LText, param.timestamp) if (menuType === 'HS') { // 云端数据验证 param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) } if (item.resourceType === '1' && item.dataSource) { let _option = Utils.getSelectQueryOptions(item) let _sql = Utils.formatOptions(_option.sql) let isSSO = item.database === 'sso' let param = { func: 'sPC_Get_SelectedList', LText: _sql, obj_name: 'data', arr_field: _option.field } if (this.props.BID) { param.BID = this.props.BID } if (this.props.dataManager) { // 数据权限 param.LText = param.LText.replace(/\$@/ig, '/*') param.LText = param.LText.replace(/@\$/ig, '*/') } else { param.LText = param.LText.replace(/@\$|\$@/ig, '') } param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' param.secretkey = Utils.encrypt(param.LText, param.timestamp) if (this.props.menuType === 'HS') { // 云端数据验证 param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) } else if (window.GLOB.systemType !== 'production') { isSSO = false } let defer = new Promise(resolve => { Api.getSystemCacheConfig(param, isSSO).then(res => { res.search = item deffers.push( new Promise(resolve => { Api.getSystemCacheConfig(param).then(res => { if (!res.status) { notification.warning({ top: 92, message: res.message, duration: 5 }) } resolve(res) }) }) deffers.push(defer) } else if (item.resourceType === '1' && !item.dataSource) { notification.warning({ top: 92, message: item.label + ': ' + this.props.dict['main.datasource.settingerror'], duration: 5 }) } }) if (deffers.length === 0) { return ) } Promise.all(deffers).then(result => { result.forEach(res => { if (res.status) { searchlist = searchlist.map(item => { if (item.uuid === res.search.uuid) { res.data.forEach(cell => { let _item = { key: Utils.getuuid(), Value: cell[res.search.valueField], Text: cell[res.search.valueText] } // 系统请求 let mainparam = { func: 'sPC_Get_SelectedList', LText: mainItems.join(' union all '), obj_name: '', arr_field: '', table_type: 'Y' } if (res.search.type === 'link') { _item.ParentID = cell[res.search.linkField] } if (BID) { mainparam.BID = BID } item.options.push(_item) if (mainparam.LText) { mainparam.LText = Utils.formatOptions(mainparam.LText) mainparam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' mainparam.secretkey = Utils.encrypt(mainparam.LText, mainparam.timestamp) if (menuType === 'HS') { // 云端数据验证 mainparam.open_key = Utils.encrypt(mainparam.secretkey, mainparam.timestamp, true) if (options.cloudServiceApi) { mainparam.rduri = options.cloudServiceApi mainparam.userid = sessionStorage.getItem('CloudUserID') || '' mainparam.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' } } else if (window.GLOB.mainSystemApi) { mainparam.rduri = window.GLOB.mainSystemApi } deffers.push( new Promise(resolve => { Api.getSystemCacheConfig(mainparam).then(res => { if (!res.status) { notification.warning({ top: 92, message: res.message, duration: 5 }) } return item resolve(res) }) } else { notification.warning({ top: 92, message: res.search.label + ':' + res.message, duration: 5 }) ) } Promise.all(deffers).then(response => { let result = {...response[0], ...(response[1] || {})} delete result.ErrCode delete result.ErrMesg delete result.message delete result.status let _searchlist = this.state.searchlist.map(item => { if (['select', 'link', 'multiselect'].includes(item.type) && result[item.field] && result[item.field].length > 0) { let options = result[item.field].map(cell => { let _item = { key: Utils.getuuid(), Value: cell[item.valueField], Text: cell[item.valueText] } if (item.type === 'link') { _item.ParentID = cell[item.linkField] } return _item }) item.oriOptions = [...item.oriOptions, ...options] } }) let _list = [] let fieldMap = new Map() searchlist.forEach(item => { if (fieldMap.has(item.field)) { item.field = item.field + '@tail@' } fieldMap.set(item.field, true) if (item.type === 'select' || item.type === 'link') { item.oriOptions = fromJS(item.options).toJS() } _list.push(item) }) _list = _list.map(item => { if (item.type === 'link') { let supItem = _list.filter(form => form.field === item.linkField)[0] if (supItem) { item.options = item.oriOptions.filter(option => option.ParentID === supItem.initval) } } return item }) this.setState({searchlist: _list}) this.setState({ searchlist: _searchlist.map(item => { if (item.type === 'link') { if (item.supInitVal) { item.options = item.oriOptions.filter(option => option.ParentID === item.supInitVal) } else { item.options = item.oriOptions } } else if (item.type === 'select' || item.type === 'multiselect') { item.options = item.oriOptions } return item }) }) }) } // 测试系统单个请求下拉选项 improveSimpleSearch = (deForms) => { if (deForms.length === 0) return let deffers = deForms.map(item => { let param = { func: 'sPC_Get_SelectedList', LText: item.data_sql, obj_name: item.field, arr_field: item.arr_field } if (this.props.BID) { param.BID = this.props.BID } param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' param.secretkey = Utils.encrypt(param.LText, param.timestamp) return ( new Promise(resolve => { Api.getSystemCacheConfig(param).then(res => { if (!res.status) { notification.warning({ top: 92, message: res.message, duration: 5 }) } resolve(res) }) }) ) }) Promise.all(deffers).then(response => { let result = {} response.forEach(res => { result = {...result, ...res} }) delete result.ErrCode delete result.ErrMesg delete result.message delete result.status let _searchlist = this.state.searchlist.map(item => { if (['select', 'link', 'multiselect'].includes(item.type) && result[item.field] && result[item.field].length > 0) { let options = result[item.field].map(cell => { let _item = { key: Utils.getuuid(), Value: cell[item.valueField], Text: cell[item.valueText] } if (item.type === 'link') { _item.ParentID = cell[item.linkField] } return _item }) item.oriOptions = [...item.oriOptions, ...options] } return item }) this.setState({ searchlist: _searchlist.map(item => { if (item.type === 'link') { if (item.supInitVal) { item.options = item.oriOptions.filter(option => option.ParentID === item.supInitVal) } else { item.options = item.oriOptions } } else if (item.type === 'select' || item.type === 'multiselect') { item.options = item.oriOptions } return item }) }) }) } src/utils/option.js
@@ -90,7 +90,7 @@ export const dateOptions = { date: [ {value: '', text: _dict['model.empty']}, {value: '0', text: '当天'}, {value: '0', text: '今天'}, {value: 1, text: '昨天'}, {value: 2, text: '前天'}, {value: 3, text: '前三天'}, @@ -130,7 +130,7 @@ ], datetime: [ {value: '', text: _dict['model.empty']}, {value: '0', text: '现在'}, {value: '0', text: '今天'}, {value: 1, text: '昨天'}, {value: 3, text: '前三天'}, {value: 7, text: '前七天'}, src/utils/utils.js
@@ -689,7 +689,7 @@ arrfield = arrfield.join(',') if (item.orderBy) { sql = 'select distinct ' + arrfield + ',' + item.orderBy + ' as orderfield from ' + _datasource + ' order by orderfield ' + item.orderType sql = `select ${arrfield} from (select distinct ${arrfield},${item.orderBy} as orderfield from ${_datasource} ) a order by orderfield ${item.orderType}` } else { sql = 'select distinct ' + arrfield + ' from ' + _datasource }