| | |
| | | import { notification, Spin, Switch, Row, Col, Tabs, 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 { updateSubTable } 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, |
| | | BID: '', |
| | | BData: '' |
| | | } |
| | |
| | | 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 |
| | |
| | | item.$menuId = this.props.MenuID |
| | | item.$old = true |
| | | |
| | | if (item.OpenType === 'excelOut') { // 导出 |
| | | item.$menuName = Tab.label |
| | | |
| | | if (!item.verify || !item.verify.columns || item.verify.columns.length === 0) { |
| | | item.errorType = 'error1' |
| | | } else if (item.intertype === 'system' && item.verify.dataType !== 'custom' && config.setting.interType !== 'system') { |
| | | item.errorType = 'error2' |
| | | } |
| | | } |
| | | |
| | | if (item.OpenType === 'funcbutton' && item.funcType === 'print' && item.verify) { // 打印机设置 |
| | | let _item = window.GLOB.UserCacheMap.get(Tab.uuid + item.uuid) |
| | | |
| | |
| | | } |
| | | |
| | | 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}'` }, |
| | |
| | | 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 |
| | | search: Utils.initMainSearch(config.search) |
| | | }, () => { |
| | | if (config.setting.onload !== 'false' && (!Tab.supMenu || this.props.BID || Tab.isTreeNode)) { // 初始化可加载 |
| | | this.loadData() |
| | |
| | | |
| | | loadData = (id) => { |
| | | const { mainSearch } = this.props |
| | | const { setting, BID, search, hasReqFields } = this.state |
| | | const { setting, BID, search, config } = this.state |
| | | |
| | | let searches = fromJS(search).toJS() |
| | | if (mainSearch && mainSearch.length > 0) { // 主表搜索条件 |
| | | searches = [...mainSearch, ...searches] |
| | | } |
| | | |
| | | 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 { mainSearch } = this.props |
| | | const { setting, BID, arr_field, search, orderBy, pageIndex, pageSize, absFields } = this.state |
| | | const { setting, BID, search, orderBy, pageIndex, pageSize, absFields } = this.state |
| | | |
| | | let searches = fromJS(search).toJS() |
| | | if (mainSearch && mainSearch.length > 0) { // 主表搜索条件 |
| | |
| | | }) |
| | | |
| | | 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) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | |
| | |
| | | */ |
| | | async loadmainLinedata (id) { |
| | | const { mainSearch } = this.props |
| | | const { setting, BID, arr_field, search, orderBy, pageIndex, pageSize, absFields } = this.state |
| | | const { setting, BID, search, orderBy, pageIndex, pageSize, absFields } = this.state |
| | | |
| | | let searches = fromJS(search).toJS() |
| | | if (mainSearch && mainSearch.length > 0) { // 主表搜索条件 |
| | |
| | | }) |
| | | |
| | | 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) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | * @description 导出Excel时,获取页面搜索排序等参数 |
| | | */ |
| | | queryModuleParam = (menuId, callback) => { |
| | | const { Tab, mainSearch, MenuID } = this.props |
| | | const { arr_field, orderBy, search, setting} = this.state |
| | | const { mainSearch, MenuID } = this.props |
| | | const { orderBy, search, setting} = this.state |
| | | |
| | | if (MenuID !== menuId) return |
| | | |
| | |
| | | } |
| | | |
| | | callback({ |
| | | arr_field: arr_field, |
| | | orderBy: orderBy || setting.order, |
| | | search: searches, |
| | | menuName: Tab.label |
| | | search: searches |
| | | }) |
| | | } |
| | | |
| | |
| | | return ( |
| | | <div className="subtable" id={'subtable' + this.props.MenuID}> |
| | | {loadingview && <Spin />} |
| | | {config.search && config.search.length ? |
| | | {config && config.search && config.search.length ? |
| | | <SubSearch BID={BID} config={config} refreshdata={this.refreshbysearch}/> : null |
| | | } |
| | | {config && config.charts ? <Row className="chart-view" gutter={16}> |
| | |
| | | setting={setting} |
| | | columns={columns} |
| | | pageSize={pageSize} |
| | | dict={this.state.dict} |
| | | data={this.state.data} |
| | | total={this.state.total} |
| | | MenuID={this.props.MenuID} |
| | |
| | | setting={setting} |
| | | columns={columns} |
| | | pageSize={pageSize} |
| | | dict={this.state.dict} |
| | | data={this.state.data} |
| | | total={this.state.total} |
| | | MenuID={this.props.MenuID} |