| | |
| | | import { notification, Spin, Modal } from 'antd' |
| | | |
| | | import Api from '@/api' |
| | | import zhCN from '@/locales/zh-CN/main.js' |
| | | import enUS from '@/locales/en-US/main.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import UtilsDM from '@/utils/utils-datamanage.js' |
| | | import { updateSubTabTable } from '@/utils/utils-update.js' |
| | |
| | | } |
| | | |
| | | state = { |
| | | dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | loadingview: true, // 页面加载中 |
| | | viewlost: false, // 页面丢失:1、未获取到配置-页面丢失;2、页面未启用 |
| | | lostmsg: '', // 页面丢失时的提示信息 |
| | | config: null, // 页面配置信息,包括按钮、搜索、显示列、标签等 |
| | | actions: null, // 按钮集 |
| | | columns: null, // 显示列 |
| | | arr_field: '', // 查询字段集 |
| | | setting: null, // 页面全局设置:数据源、按钮及显示列固定、主键等 |
| | | data: [], // 列表数据集 |
| | | selectedData: [], // 已选表格数据 |
| | |
| | | statFields: [], // 合计字段 |
| | | statFValue: [], // 合计值 |
| | | absFields: [], // 绝对值字段 |
| | | hasReqFields: false |
| | | } |
| | | |
| | | /** |
| | |
| | | this.setState({ |
| | | loadingview: false, |
| | | viewlost: true, |
| | | lostmsg: this.state.dict['main.view.unenabled'] |
| | | lostmsg: '抱歉,您访问的页面未启用,请联系管理员。' |
| | | }) |
| | | return |
| | | } |
| | |
| | | // 权限过滤 |
| | | config.action = config.action.filter(item => item.hidden !== 'true') |
| | | |
| | | config.search = Utils.initSearchVal(config.search) |
| | | |
| | | let hasReqFields = false |
| | | config.search.forEach(field => { |
| | | if (field.required) { |
| | | hasReqFields = true |
| | | } |
| | | }) |
| | | Utils.initSearchVal(config) |
| | | |
| | | // 字段权限黑名单 |
| | | let roleId = sessionStorage.getItem('role_id') || '' // 角色ID |
| | |
| | | |
| | | let _actions = [] // 工具栏按钮 |
| | | let _operations = [] // 操作列按钮(存在时) |
| | | let colors = { primary: '#1890ff', yellow: '#c49f47', orange: 'orange', danger: '#ff4d4f', green: '#26C281', dgreen: '#32c5d2', purple: '#8E44AD', cyan: '#13c2c2', gray: '#E7E7EF', default: 'rgba(0, 0, 0, 0.65)' } |
| | | |
| | | config.action.forEach(item => { |
| | | item.logLabel = Tab.label + '-' + item.label // 用于sPC_TableData_InUpDe记录操作按钮 |
| | | item.$menuId = this.props.MenuID |
| | | item.$old = true |
| | | |
| | | if (item.OpenType === 'popview') return |
| | | |
| | | if (item.OpenType === 'excelOut') { // 导出 |
| | | item.$menuName = Tab.label |
| | | } |
| | | |
| | | if (item.verify && item.verify.invalid === 'true') { |
| | | if (item.sqlType === 'insert') { |
| | | item.verify.invalid = 'false' |
| | | } else if (item.Ot === 'notRequired') { |
| | | item.verify.invalid = 'false' |
| | | } else if (item.intertype !== 'system' && item.procMode !== 'system') { |
| | | item.verify.invalid = 'false' |
| | | } |
| | | } |
| | | |
| | | if (item.controlField) { |
| | | if (/,/ig.test(item.controlVal)) { |
| | |
| | | } |
| | | } |
| | | |
| | | item.show = 'button' |
| | | |
| | | let _c = item.class ? item.class.replace('border-', '') : '' |
| | | let color = colors[_c] || '#1890ff' |
| | | |
| | | if (item.position === 'toolbar') { |
| | | item.$toolbtn = true |
| | | |
| | | if (item.class === 'default') { |
| | | item.style = {color: 'rgba(0, 0, 0, 0.65)', backgroundColor: '#fff', borderColor: '#d9d9d9', marginRight: '15px'} |
| | | } else if (item.class.indexOf('border') > -1) { |
| | | item.style = {color: color, backgroundColor: '#fff', borderColor: color, marginRight: '15px'} |
| | | } else { |
| | | item.style = {color: item.class === 'gray' ? 'rgba(0, 0, 0, 0.65)' : '#fff', backgroundColor: color, borderColor: color, marginRight: '15px'} |
| | | } |
| | | |
| | | _actions.push(item) |
| | | } else if (item.position === 'grid') { |
| | | item.style = {color: color, backgroundColor: 'transparent', borderColor: 'transparent'} |
| | | _operations.push(item) |
| | | } |
| | | }) |
| | |
| | | } |
| | | |
| | | if (sessionStorage.getItem('dataM') === 'true') { // 数据权限 |
| | | config.setting.dataresource = config.setting.dataresource.replace(/\$@/ig, '/*') |
| | | config.setting.dataresource = config.setting.dataresource.replace(/@\$/ig, '*/') |
| | | config.setting.customScript = config.setting.customScript.replace(/\$@/ig, '/*') |
| | | config.setting.customScript = config.setting.customScript.replace(/@\$/ig, '*/') |
| | | config.setting.dataresource = config.setting.dataresource.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/') |
| | | config.setting.customScript = config.setting.customScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/') |
| | | } else { |
| | | config.setting.dataresource = config.setting.dataresource.replace(/@\$|\$@/ig, '') |
| | | config.setting.customScript = config.setting.customScript.replace(/@\$|\$@/ig, '') |
| | |
| | | |
| | | let userName = sessionStorage.getItem('User_Name') || '' |
| | | let fullName = sessionStorage.getItem('Full_Name') || '' |
| | | |
| | | if (sessionStorage.getItem('isEditState') === 'true') { |
| | | userName = sessionStorage.getItem('CloudUserName') || '' |
| | | fullName = sessionStorage.getItem('CloudFullName') || '' |
| | | } |
| | | |
| | | let regs = [ |
| | | { reg: /@userName@/ig, value: `'${userName}'` }, |
| | |
| | | config.setting.dataresource = config.setting.dataresource.replace(cell.reg, cell.value) |
| | | config.setting.customScript = config.setting.customScript.replace(cell.reg, cell.value) |
| | | }) |
| | | } else { |
| | | config.setting.dataresource = '' |
| | | } |
| | | |
| | | if (config.setting.selected !== 'init' && config.setting.selected !== 'always') { |
| | |
| | | searchRatio: config.setting.searchRatio || '', |
| | | searchLwidth: config.setting.searchLwidth, |
| | | borderRadius: config.setting.borderRadius, |
| | | resetContrl: config.setting.resetContrl, |
| | | } |
| | | |
| | | config.setting.arr_field = _arrField.join(',') |
| | | |
| | | this.setState({ |
| | | pageSize: config.setting.pageSize || 10, |
| | |
| | | setting: config.setting, |
| | | actions: _actions, |
| | | columns: _columns, |
| | | arr_field: _arrField.join(','), |
| | | search: Utils.initMainSearch(config.search), // 搜索条件初始化(含有时间格式,需要转化) |
| | | hasReqFields |
| | | }, () => { |
| | | if (config.setting.onload !== 'false') { // 初始化可加载 |
| | | this.loadData() |
| | |
| | | } |
| | | |
| | | loadData = (id) => { |
| | | const { setting, search, hasReqFields } = this.state |
| | | const { setting, search, config } = this.state |
| | | |
| | | let searches = fromJS(search).toJS() |
| | | |
| | | if (hasReqFields) { |
| | | if (config.$s_req) { |
| | | let requireFields = searches.filter(item => item.required && item.value === '') |
| | | if (requireFields.length > 0) { |
| | | this.setState({ |
| | |
| | | */ |
| | | async loadmaindata (id) { |
| | | const { BID } = this.props |
| | | const { setting, arr_field, search, orderBy, pageIndex, pageSize, absFields } = this.state |
| | | const { setting, search, orderBy, pageIndex, pageSize, absFields } = this.state |
| | | |
| | | let searches = fromJS(search).toJS() |
| | | |
| | |
| | | }) |
| | | |
| | | let _orderBy = orderBy || setting.order |
| | | let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID) |
| | | let param = UtilsDM.getQueryDataParams(setting, searches, _orderBy, pageIndex, pageSize, BID) |
| | | |
| | | delete param.s_version_up |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | |
| | |
| | | */ |
| | | async loadmainLinedata (id) { |
| | | const { BID } = this.props |
| | | const { setting, arr_field, search, orderBy, pageIndex, pageSize, absFields } = this.state |
| | | const { setting, search, orderBy, pageIndex, pageSize, absFields } = this.state |
| | | |
| | | let searches = fromJS(search).toJS() |
| | | |
| | |
| | | }) |
| | | |
| | | let _orderBy = orderBy || setting.order |
| | | let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID, id) |
| | | let param = UtilsDM.getQueryDataParams(setting, searches, _orderBy, pageIndex, pageSize, BID, id) |
| | | |
| | | delete param.s_version_up |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | * @description 导出Excel时,获取页面搜索排序等参数 |
| | | */ |
| | | queryModuleParam = (menuId, callback) => { |
| | | const { Tab, MenuID } = this.props |
| | | const { arr_field, orderBy, search, setting} = this.state |
| | | const { MenuID } = this.props |
| | | const { orderBy, search, setting} = this.state |
| | | |
| | | if (MenuID !== menuId) return |
| | | |
| | | callback({ |
| | | arr_field: arr_field, |
| | | orderBy: orderBy || setting.order, |
| | | search: search, |
| | | menuName: Tab.label |
| | | search: search |
| | | }) |
| | | } |
| | | |
| | |
| | | actions={actions} |
| | | columns={columns} |
| | | BID={this.props.BID} |
| | | dict={this.state.dict} |
| | | BData={this.props.BData} |
| | | selectedData={selectedData} |
| | | MenuID={this.props.SupMenuID} |
| | |
| | | columns={columns} |
| | | pageSize={pageSize} |
| | | data={this.state.data} |
| | | dict={this.state.dict} |
| | | BData={this.props.BData} |
| | | total={this.state.total} |
| | | MenuID={this.props.MenuID} |