1 文件已重命名
17个文件已修改
5个文件已添加
| | |
| | | 'header.form.action.type': '操作类型', |
| | | 'header.form.action.insert': '添加', |
| | | 'header.form.action.update': '修改', |
| | | 'header.form.action.insertOrUpdate': '添加或修改', |
| | | 'header.form.action.LogicDelete': '逻辑删除', |
| | | 'header.form.action.delete': '物理删除', |
| | | 'header.form.valueField': '值·字段', |
| | |
| | | 'header.form.action.type': '操作类型', |
| | | 'header.form.action.insert': '添加', |
| | | 'header.form.action.update': '修改', |
| | | 'header.form.action.insertOrUpdate': '添加或修改', |
| | | 'header.form.action.LogicDelete': '逻辑删除', |
| | | 'header.form.action.delete': '物理删除', |
| | | 'header.form.valueField': '值·字段', |
| | |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'funcvar') { |
| | | |
| | | fields.push( |
| | | <Col span={24 / cols} key={index}> |
| | | <Form.Item label={item.label}> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: '系统自动生成', |
| | | })(<Input placeholder="" autoComplete="off" disabled={true} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'textarea') { |
| | | let _labelcol = cols !== 3 ? 8 / cols : 3 |
| | | let _wrapcol = cols !== 3 ? 16 + (cols - 1) * 4 : 21 |
| | |
| | | }) |
| | | |
| | | Object.keys(values).forEach(key => { |
| | | if (this.state.datatype[key] === 'funcvar') return |
| | | |
| | | let _value = '' |
| | | if (this.state.datatype[key] === 'datetime') { |
| | | if (values[key]) { |
| | |
| | | import NotFount from '@/components/404' |
| | | import './index.scss' |
| | | |
| | | const SecretKeyTable = asyncLoadComponent(() => import('./secretKeyTable')) |
| | | const SubTable = asyncLoadComponent(() => import('@/tabviews/subtable')) |
| | | const MainAction = asyncComponent(() => import('@/tabviews/zshare/actionList')) |
| | | const SubTabTable = asyncComponent(() => import('@/tabviews/subtabtable')) |
| | |
| | | * @description 获取页面配置信息 |
| | | */ |
| | | async loadconfig () { |
| | | // const { permAction } = this.props |
| | | |
| | | let param = { |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: this.props.MenuID |
| | |
| | | operations: _operations |
| | | }) |
| | | } |
| | | |
| | | let custabs = ['1586577325055l2ng7t75g7i4ek2ng8o'] |
| | | config.tabgroups.forEach(group => { |
| | | if (!config[group]) return |
| | | |
| | | config[group] = config[group].map(tab => { |
| | | if (custabs.includes(tab.linkTab)) { |
| | | tab.type = 'SecretKeyTable' |
| | | } |
| | | return tab |
| | | }) |
| | | }) |
| | | |
| | | this.setState({ |
| | | loadingview: false, |
| | |
| | | handleTableId={this.handleTableId} |
| | | handleMainTable={(type) => this.handleMainTable(type, _tab)} |
| | | /> : null} |
| | | {_tab.type === 'SecretKeyTable' ? |
| | | <SecretKeyTable |
| | | menuType="HS" |
| | | Tab={_tab} |
| | | MenuID={_tab.linkTab} |
| | | SupMenuID={this.props.MenuID} |
| | | refreshtabs={this.state.refreshtabs} |
| | | ContainerId={this.state.ContainerId} |
| | | BID={this.state.BIDs[_tab.supMenu] || ''} |
| | | BData={this.state.BIDs[_tab.supMenu + 'data'] || ''} |
| | | handleTableId={this.handleTableId} |
| | | handleMainTable={(type) => this.handleMainTable(type, _tab)} |
| | | /> : null} |
| | | </TabPane> |
| | | ) |
| | | })} |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | // import moment from 'moment' |
| | | import { Button, Modal, notification, message } from 'antd' |
| | | import MutilForm from '@/tabviews/zshare/mutilform' |
| | | import Utils from '@/utils/utils.js' |
| | | import { refCodes } from '../config' |
| | | // import options from '@/store/options.js' |
| | | // import Api from '@/api' |
| | | import './index.scss' |
| | | |
| | | const { confirm } = Modal |
| | | |
| | | class MainAction extends Component { |
| | | static propTpyes = { |
| | | BID: PropTypes.string, // 主表ID |
| | | datalist: PropTypes.any, // 列表数据 |
| | | Tab: PropTypes.any, // 如果当前元素为标签时,tab为标签信息 |
| | | type: PropTypes.string, // 判断当前为主表(main)、子表(sub)、子表标签(subtab) |
| | | MenuID: PropTypes.string, // 菜单ID |
| | | actions: PropTypes.array, // 按钮组 |
| | | logcolumns: PropTypes.array, // 显示列 |
| | | dict: PropTypes.object, // 字典项 |
| | | setting: PropTypes.any, // 页面通用设置 |
| | | ContainerId: PropTypes.any, // tab页面ID,用于弹窗控制 |
| | | refreshdata: PropTypes.func, // 执行完成后数据刷新 |
| | | gettableselected: PropTypes.func // 获取表格中数据 |
| | | } |
| | | |
| | | state = { |
| | | visible: false, |
| | | formdata: null, |
| | | tabledata: null, |
| | | confirmLoading: false, |
| | | execAction: null, |
| | | configMap: {}, |
| | | loadingNumber: '' |
| | | } |
| | | |
| | | refreshdata = (item, type) => { |
| | | this.props.refreshdata(item, type) |
| | | } |
| | | |
| | | /** |
| | | * @description 触发按钮操作 |
| | | */ |
| | | actionTrigger = (item) => { |
| | | const { setting, BID } = this.props |
| | | |
| | | if (!BID) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '需要上级主键值!', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let _this = this |
| | | let data = this.props.gettableselected() || [] |
| | | |
| | | if (item.Ot !== 'notRequired' && data.length === 0) { |
| | | // 需要选择行时,校验数据 |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.props.dict['main.action.confirm.selectline'], |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } else if (item.Ot === 'requiredSgl' && data.length !== 1) { |
| | | // 需要选择单行时,校验数据 |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.props.dict['main.action.confirm.selectSingleLine'], |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } else if (item.Ot !== 'notRequired' && !setting.primaryKey) { |
| | | // 需要选择行时,校验是否设置主键 |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '未设置主键!', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | if (item.sqlType === 'delete') { |
| | | let sysKeys = data.filter(cell => cell.uuid === 'sso_system' || cell.uuid === 'local_system') |
| | | if (sysKeys.length > 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '系统密钥不可删除!', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } |
| | | } |
| | | |
| | | if (item.OpenType === 'prompt') { |
| | | confirm({ |
| | | title: this.props.dict['main.action.confirm.tip'], |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | _this.execSubmit(item, data, resolve) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } else if (item.OpenType === 'pop') { |
| | | this.setState({ |
| | | visible: true, |
| | | execAction: item, |
| | | tabledata: data |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 按钮提交执行 |
| | | */ |
| | | execSubmit = (btn, data, _resolve, formdata) => { |
| | | let datalist = JSON.parse(JSON.stringify(this.props.datalist)) |
| | | |
| | | let cell = {} |
| | | if (formdata) { |
| | | formdata.forEach(_cell => { |
| | | cell[_cell.key] = _cell.value |
| | | }) |
| | | } |
| | | |
| | | if (btn.sqlType === 'insert') { |
| | | let newkey = { |
| | | uuid: Utils.getuuid(), |
| | | keyType: 'other', |
| | | ...cell |
| | | } |
| | | datalist.push(newkey) |
| | | } else if (btn.sqlType === 'update') { |
| | | let newkey = { |
| | | ...data[0], |
| | | ...cell |
| | | } |
| | | |
| | | datalist = datalist.map(item => { |
| | | if (item.uuid === newkey.uuid) { |
| | | return newkey |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | } else if (btn.sqlType === 'update') { |
| | | let keys = data.map(item => item.uuid) |
| | | |
| | | datalist = datalist.filter(item => !keys.includes(item.uuid)) |
| | | } else if (btn.sqlType === 'revert') { |
| | | datalist = [ |
| | | {uuid: 'sso_system', public: 'a', private: 'apple', keyType: 'sso'}, |
| | | {uuid: 'local_system', public: 'b', private: 'banana', keyType: 'local'}, |
| | | {uuid: 'other_system1', public: 'c', private: 'cherry', keyType: 'other'}, |
| | | {uuid: 'other_system2', public: 'd', private: 'damson', keyType: 'other'} |
| | | ] |
| | | } |
| | | console.log(datalist) |
| | | let _number = Math.floor(Math.random() * 10) |
| | | console.log(_number) |
| | | let keyString = window.btoa(window.encodeURIComponent(JSON.stringify(datalist))) |
| | | console.log(keyString) |
| | | let regular = refCodes[_number] |
| | | console.log(regular) |
| | | keyString = keyString.replace(new RegExp(regular.char,'g'), regular.md5str) |
| | | console.log(keyString) |
| | | // window.btoa(window.encodeURIComponent(JSON.stringify(val))) |
| | | |
| | | // for (let i = 0; i < a.length; i++) { |
| | | // if (a[i] !== b[i]) { |
| | | // console.log(i) |
| | | // console.log(src.substring(i- 10, i+ 10)) |
| | | // } |
| | | // } |
| | | // let param = { refCodes |
| | | // func: 'sPC_TableData_InUpDe', |
| | | // BID: this.props.BID |
| | | // } |
| | | // Api.genericInterface(param).then((res) => { |
| | | // if (res.status) { |
| | | // this.execSuccess(btn, res) |
| | | // } else { |
| | | // this.execError(res, btn) |
| | | // } |
| | | // _resolve() |
| | | // }) |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @description 操作成功后处理 |
| | | * 1、excel导出,成功后取消导出按钮加载中状态 |
| | | * 2、状态码为 S 时,显示成功信息后系统默认信息 |
| | | * 3、状态码为 -1 时,不显示任何信息 |
| | | * 4、模态框执行成功后是否关闭 |
| | | * 5、通知主列表刷新 |
| | | */ |
| | | execSuccess = (btn, res) => { |
| | | if (res && res.ErrCode === 'S') { // 执行成功 |
| | | notification.success({ |
| | | top: 92, |
| | | message: res.ErrMesg || this.props.dict['main.action.confirm.success'], |
| | | duration: btn.verify && btn.verify.stime ? btn.verify.stime : 2 |
| | | }) |
| | | } else if (res && res.ErrCode === 'Y') { // 执行成功 |
| | | Modal.success({ |
| | | title: res.ErrMesg || this.props.dict['main.action.confirm.success'] |
| | | }) |
| | | } else if (res && res.ErrCode === '-1') { // 完成后不提示 |
| | | |
| | | } |
| | | |
| | | if (btn.OpenType === 'pop' && btn.setting && btn.setting.finish !== 'unclose') { |
| | | this.setState({ |
| | | visible: false |
| | | }) |
| | | } |
| | | |
| | | this.refreshdata(btn, 'success') |
| | | } |
| | | |
| | | /** |
| | | * @description 操作失败后处理 |
| | | * 1、状态码为 E、N、F、NM 时,显示相应提示信息 |
| | | * 2、excel导出,失败后取消导出按钮加载中状态 |
| | | * 3、通知主列表刷新 |
| | | */ |
| | | execError = (res, btn) => { |
| | | if (res.ErrCode === 'E') { |
| | | Modal.error({ |
| | | title: res.message || res.ErrMesg, |
| | | }) |
| | | } else if (res.ErrCode === 'N') { |
| | | notification.error({ |
| | | top: 92, |
| | | message: res.message || res.ErrMesg, |
| | | duration: btn.verify && btn.verify.ntime ? btn.verify.ntime : 15 |
| | | }) |
| | | } else if (res.ErrCode === 'F') { |
| | | notification.error({ |
| | | className: 'notification-custom-error', |
| | | top: 92, |
| | | message: res.message || res.ErrMesg, |
| | | duration: btn.verify && btn.verify.ftime ? btn.verify.ftime : 15 |
| | | }) |
| | | } else if (res.ErrCode === 'NM') { |
| | | message.error(res.message || res.ErrMesg) |
| | | } |
| | | |
| | | this.refreshdata(btn, 'error') |
| | | } |
| | | |
| | | /** |
| | | * @description 模态框(表单),确认 |
| | | */ |
| | | handleOk = () => { |
| | | this.formRef.handleConfirm().then(res => { |
| | | this.setState({ |
| | | confirmLoading: true |
| | | }) |
| | | |
| | | this.execSubmit(this.state.execAction, this.state.tabledata, () => { |
| | | this.setState({ |
| | | confirmLoading: false |
| | | }) |
| | | }, res) |
| | | }, () => {}) |
| | | } |
| | | |
| | | /** |
| | | * @description 模态框(表单),取消 |
| | | */ |
| | | handleCancel = () => { |
| | | this.setState({ |
| | | visible: false |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 显示模态框 |
| | | */ |
| | | getModels = () => { |
| | | const { execAction } = this.state |
| | | |
| | | if (!execAction || !this.state.visible) return |
| | | |
| | | let title = '' |
| | | let width = '62vw' |
| | | let clickouter = false |
| | | let container = document.body |
| | | |
| | | if (execAction && execAction.setting) { |
| | | title = execAction.setting.title |
| | | width = execAction.setting.width + 'vw' |
| | | |
| | | if (execAction.setting.container === 'tab' && this.props.ContainerId) { |
| | | width = execAction.setting.width + '%' |
| | | container = () => document.getElementById(this.props.ContainerId) |
| | | } |
| | | |
| | | if (execAction.setting.clickouter === 'close') { |
| | | clickouter = true |
| | | } |
| | | } |
| | | |
| | | if (this.props.type === 'subtab') { |
| | | container = document.body |
| | | } |
| | | |
| | | return ( |
| | | <Modal |
| | | title={title} |
| | | maskClosable={clickouter} |
| | | getContainer={container} |
| | | wrapClassName='action-modal' |
| | | visible={this.state.visible} |
| | | width={width} |
| | | onOk={this.handleOk} |
| | | confirmLoading={this.state.confirmLoading} |
| | | onCancel={this.handleCancel} |
| | | destroyOnClose |
| | | > |
| | | <MutilForm |
| | | dict={this.props.dict} |
| | | action={execAction} |
| | | inputSubmit={this.handleOk} |
| | | configMap={this.state.configMap} |
| | | data={this.state.tabledata[0]} |
| | | BData={this.props.BData} |
| | | wrappedComponentRef={(inst) => this.formRef = inst} |
| | | /> |
| | | </Modal> |
| | | ) |
| | | } |
| | | |
| | | render() { |
| | | return ( |
| | | <div className="button-list toolbar-button"> |
| | | {this.props.actions.map((item, index) => { |
| | | return ( |
| | | <Button |
| | | className={'mk-btn mk-' + item.class} |
| | | icon={item.icon} |
| | | key={'action' + index} |
| | | onClick={() => {this.actionTrigger(item)}} |
| | | >{item.label}</Button> |
| | | ) |
| | | })} |
| | | {this.getModels()} |
| | | </div> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default MainAction |
New file |
| | |
| | | .button-list.toolbar-button { |
| | | position: relative; |
| | | padding: 10px 20px 5px; |
| | | background: #ffffff; |
| | | button { |
| | | min-width: 65px; |
| | | margin-right: 15px; |
| | | margin-bottom: 10px; |
| | | overflow: hidden; |
| | | } |
| | | .ant-spin { |
| | | position: fixed; |
| | | z-index: 1010; |
| | | left: calc(50vw - 22px); |
| | | top: calc(50vh - 70px); |
| | | } |
| | | } |
| | | // 设置模态框样式,规定最大最小高度,重置滚动条 |
| | | .action-modal { |
| | | .ant-modal { |
| | | max-width: 95vw; |
| | | } |
| | | .ant-modal-body { |
| | | max-height: calc(100vh - 235px); |
| | | min-height: 150px; |
| | | overflow-y: auto; |
| | | padding-bottom: 35px; |
| | | } |
| | | .ant-modal-body::-webkit-scrollbar { |
| | | width: 10px; |
| | | height: 10px; |
| | | } |
| | | .ant-modal-body::-webkit-scrollbar-thumb { |
| | | border-radius: 5px; |
| | | box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.13); |
| | | background: rgba(0, 0, 0, 0.13); |
| | | } |
| | | .ant-modal-body::-webkit-scrollbar-track { |
| | | box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05); |
| | | border-radius: 3px; |
| | | border: 1px solid rgba(0, 0, 0, 0.07); |
| | | background: rgba(0, 0, 0, 0); |
| | | } |
| | | } |
New file |
| | |
| | | // HS页面配置 |
| | | export const verupMainTable = {} |
| | | |
| | | export const buttonConfig = { |
| | | '1586616122586986g400tf610dc3rhcd': { |
| | | "type":"Modal", |
| | | "setting":{ |
| | | "title":"添加", |
| | | "width":45, |
| | | "focus":"p", |
| | | "cols":"1", |
| | | "finish":"close", |
| | | "clickouter":"unclose", |
| | | "display":"modal", |
| | | "container":"view" |
| | | }, |
| | | "tables":[], |
| | | "groups":[], |
| | | "fields":[{ |
| | | "label":"公钥", |
| | | "field":"public", |
| | | "type":"text", |
| | | "initval":"", |
| | | "readonly":"false", |
| | | "required":"true", |
| | | "hidden":"false", |
| | | "readin":"true", |
| | | "fieldlength":50, |
| | | "regular":"", |
| | | "supField":"", |
| | | "blacklist":[], |
| | | "uuid":"1586616164754mshqhn0dqulorb4k2ot" |
| | | }, { |
| | | "label":"私钥", |
| | | "field":"private", |
| | | "type":"text", |
| | | "initval":"", |
| | | "readonly":"false", |
| | | "required":"true", |
| | | "hidden":"false", |
| | | "readin":"true", |
| | | "fieldlength":50, |
| | | "regular":"", |
| | | "supField":"", |
| | | "blacklist":[], |
| | | "uuid":"1586616188792q2m9km3k8lqbtabf8og" |
| | | }] |
| | | }, |
| | | '1586616351568k8rb0fvp3t7g6h7qso0': { |
| | | "type":"Modal", |
| | | "setting":{ |
| | | "title":"修改", |
| | | "width":45, |
| | | "focus":"p", |
| | | "cols":"1", |
| | | "finish":"close", |
| | | "clickouter":"unclose", |
| | | "display":"modal", |
| | | "container":"view" |
| | | }, |
| | | "tables":[], |
| | | "groups":[], |
| | | "fields":[{ |
| | | "label":"公钥", |
| | | "field":"public", |
| | | "type":"text", |
| | | "initval":"", |
| | | "readonly":"false", |
| | | "required":"true", |
| | | "hidden":"false", |
| | | "readin":"true", |
| | | "fieldlength":50, |
| | | "regular":"", |
| | | "supField":"", |
| | | "blacklist":[], |
| | | "uuid":"1586616164754mshqhn0dqulorb4k2ot" |
| | | },{ |
| | | "label":"私钥", |
| | | "field":"private", |
| | | "type":"text", |
| | | "initval":"", |
| | | "readonly":"false", |
| | | "required":"true", |
| | | "hidden":"false", |
| | | "readin":"true", |
| | | "fieldlength":50, |
| | | "regular":"", |
| | | "supField":"", |
| | | "blacklist":[], |
| | | "uuid":"1586616188792q2m9km3k8lqbtabf8og" |
| | | }] |
| | | } |
| | | } |
| | | |
| | | export const tabConfig = { |
| | | '1586577325055l2ng7t75g7i4ek2ng8o': { |
| | | tabName:"密钥管理标签页", |
| | | tabNo:"secret_paramM", |
| | | Remark:"", |
| | | uuid:"1586577325055l2ng7t75g7i4ek2ng8o", |
| | | setting:{ |
| | | "tableName":"sApp", |
| | | "tableType":"checkbox", |
| | | "interType":"inner", |
| | | "innerFunc":"s_get_app_secret_param", |
| | | "dataresource":"select 'a' as p,'apple' as s,'sso' as st,10 as ID union all\nselect 'b' as p,'banana' as s,'local' as st,20 as ID union all\nselect 'c' as p,'cherry' as s,'other' as st,30 as ID union all\nselect 'd' as p,'damson' as s,'other' as st,40 as ID", |
| | | "queryType":"query", |
| | | "primaryKey":"key", |
| | | "order":"key", |
| | | "onload":"true", |
| | | "actionfixed":false,"columnfixed":false |
| | | }, |
| | | search:[], |
| | | action:[ |
| | | { |
| | | "label":"添加", |
| | | "OpenType":"pop", |
| | | "intertype":"inner", |
| | | "innerFunc":"", |
| | | "position":"toolbar", |
| | | "Ot":"notRequired", |
| | | "execSuccess":"grid", |
| | | "execError":"never", |
| | | "icon":"", |
| | | "class":"green", |
| | | "sql":"sApp", |
| | | "sqlType":"insert", |
| | | "uuid":"1586616122586986g400tf610dc3rhcd", |
| | | "verify": { |
| | | "default":"true", |
| | | "invalid":"false", |
| | | "uniques":[ |
| | | { |
| | | "field":"BID,p", |
| | | "errorCode":"E", |
| | | "verifyType":"physical", |
| | | "uuid":"15866162339252q7vs9qvp83bdomkk93", |
| | | "fieldlabel":"BID,公钥" |
| | | } |
| | | ], |
| | | "contrasts":[], |
| | | "accountdate":"false", |
| | | "customverifys":[ |
| | | { |
| | | "sql":"select ID from sApp where id=@BID@", |
| | | "result":"false", |
| | | "errmsg":"页面数据已失效,请刷新后重试", |
| | | "errorCode":"E", |
| | | "uuid":"1586616302289f8ic4pl2mn6so2ns3be", |
| | | "resultName":"不存在" |
| | | } |
| | | ], |
| | | "billcodes":[], |
| | | "voucher":{"enabled":false}, |
| | | "scripts":[] |
| | | } |
| | | }, |
| | | { |
| | | "label":"修改", |
| | | "OpenType":"pop", |
| | | "intertype":"inner", |
| | | "innerFunc":"", |
| | | "position":"toolbar", |
| | | "Ot":"requiredSgl", |
| | | "execSuccess":"grid", |
| | | "execError":"never", |
| | | "icon":"", |
| | | "class":"purple", |
| | | "sql":"sApp", |
| | | "sqlType":"update", |
| | | "uuid":"1586616351568k8rb0fvp3t7g6h7qso0", |
| | | "verify":{ |
| | | "default":"true", |
| | | "invalid":"false", |
| | | "uniques":[{"field":"BID,p","errorCode":"E","verifyType":"physical","uuid":"15866162339252q7vs9qvp83bdomkk93","fieldlabel":"BID,公钥"}], |
| | | "contrasts":[], |
| | | "accountdate":"false", |
| | | "customverifys":[{"sql":"select ID from sApp where id=@BID@","result":"false","errmsg":"页面数据已失效,请刷新后重试","errorCode":"E","uuid":"1586616302289f8ic4pl2mn6so2ns3be","resultName":"不存在"}], |
| | | "billcodes":[], |
| | | "voucher":{"enabled":false}, |
| | | "scripts":[] |
| | | } |
| | | }, |
| | | { |
| | | "label":"删除", |
| | | "OpenType":"prompt", |
| | | "intertype":"inner", |
| | | "innerFunc":"", |
| | | "position":"toolbar", |
| | | "execSuccess":"grid", |
| | | "execError":"never", |
| | | "icon":"", |
| | | "class":"danger", |
| | | "sql":"sApp", |
| | | "Ot":"required", |
| | | "sqlType":"delete", |
| | | "uuid":"158661662660590kra03kb4su0t108rt", |
| | | "verify":{ |
| | | "default":"true", |
| | | "invalid":"true", |
| | | "uniques":[], |
| | | "contrasts":[{"frontfield":"@st","operator":"!=","backfield":"'other'","errmsg":"sso与local为系统默认口令不可删除","errorCode":"E","uuid":"15866167196190he7utt2vbsmqu2gips"}], |
| | | "accountdate":"false", |
| | | "customverifys":[{"sql":"select ID from sApp where id=@BID@","result":"false","errmsg":"页面数据已失效,请刷新后重试","errorCode":"E","uuid":"1586616302289f8ic4pl2mn6so2ns3be","resultName":"不存在"}], |
| | | "billcodes":[], |
| | | "voucher":{"enabled":false}, |
| | | "scripts":[] |
| | | } |
| | | }, |
| | | { |
| | | "label":"恢复默认设置", |
| | | "OpenType":"prompt", |
| | | "intertype":"inner", |
| | | "innerFunc":"", |
| | | "position":"toolbar", |
| | | "execSuccess":"grid", |
| | | "execError":"never", |
| | | "icon":"", |
| | | "class":"primary", |
| | | "sql":"sApp", |
| | | "Ot":"notRequired", |
| | | "sqlType":"revert", |
| | | "uuid":"158661672660590kra03kb4su0t108rt" |
| | | } |
| | | ], |
| | | columns:[ |
| | | {"label":"公钥","field":"public","type":"text","Align":"left","Hide":"false","IsSort":"true","Width":120,"prefix":"","postfix":"","matchVal":"","color":"","fieldlength":50,"blacklist":[],"linkmenu":[],"uuid":"15866156221702kced0rmbsnekd82s6d"}, |
| | | {"label":"私钥","field":"private","type":"text","Align":"left","Hide":"false","IsSort":"true","Width":120,"prefix":"","postfix":"","matchVal":"","color":"","fieldlength":50,"blacklist":[],"linkmenu":[],"uuid":"1586615651169h67un3tmhuc8pf7kehs"}, |
| | | {"label":"类型","field":"keyType","type":"text","Align":"left","Hide":"false","IsSort":"true","Width":120,"prefix":"","postfix":"","matchVal":"","color":"","fieldlength":50,"blacklist":[],"linkmenu":[],"uuid":"15866156745953m73rhs9c0nmu6mmbo6"} |
| | | ], |
| | | gridBtn:{"display":false,"Align":"center","IsSort":"false","uuid":"1586577404115eudahgc9nn0gam1saho","label":"操作","type":"action","style":"button","show":"horizontal","Width":120}, |
| | | } |
| | | } |
| | | |
| | | export const refCodes = [ |
| | | { |
| | | index: 0, |
| | | char: 'a', |
| | | sqlstr: 'b6831c399e269772661', |
| | | md5str: '526a465ab0fa6f6df28ca459d50b2622' |
| | | }, |
| | | { |
| | | index: 1, |
| | | char: 'b', |
| | | sqlstr: '2fec3ad71c777531578f', |
| | | md5str: '5d941f8268e5e5ba47a93fa2b4ed960e' |
| | | }, |
| | | { |
| | | index: 2, |
| | | char: 'd', |
| | | sqlstr: '0195b448797616e091a', |
| | | md5str: 'ed65250fa9757c60f9acc9f3e977fb17' |
| | | }, |
| | | { |
| | | index: 3, |
| | | char: 'g', |
| | | sqlstr: '71b6e533d8dc3614845d', |
| | | md5str: '6609c8e4f10ed61fea96a747cb54d00e' |
| | | }, |
| | | { |
| | | index: 4, |
| | | char: 'k', |
| | | sqlstr: '8894aa86c421e8759df3', |
| | | md5str: '759ecadb8eaf10ec9daeefe6e8928b18' |
| | | }, |
| | | { |
| | | index: 5, |
| | | char: 'p', |
| | | sqlstr: '38902e0fe0fb97a8c47a', |
| | | md5str: 'b7679fa01bd435f407746351a6aecf2b' |
| | | }, |
| | | { |
| | | index: 6, |
| | | char: 'v', |
| | | sqlstr: '5bd57058fd4664205d2a', |
| | | md5str: 'c1761cd95acb804220e0429cd63a9e9a' |
| | | }, |
| | | { |
| | | index: 7, |
| | | char: 'x', |
| | | sqlstr: '8034f5c8564e155c67a6', |
| | | md5str: '8d844d9007aa9ea9e2f2a822e432edbe' |
| | | }, |
| | | { |
| | | index: 8, |
| | | char: 'y', |
| | | sqlstr: '460e2e485922904f345d', |
| | | md5str: '6dfbe93c0570998a740ba410a6ec0f49' |
| | | }, |
| | | { |
| | | index: 9, |
| | | char: '0', |
| | | sqlstr: '65ef66e7dff9f98764da', |
| | | md5str: '3340c8dc496c953865d920d06ff8c4c9' |
| | | } |
| | | ] |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { notification, Switch} from 'antd' |
| | | |
| | | import Api from '@/api' |
| | | import zhCN from '@/locales/zh-CN/main.js' |
| | | import enUS from '@/locales/en-US/main.js' |
| | | import options from '@/store/options.js' |
| | | import { buttonConfig, tabConfig } from './config' |
| | | |
| | | import SubTable from '@/tabviews/zshare/normalTable' |
| | | import SubAction from './actionList' |
| | | |
| | | import './index.scss' |
| | | |
| | | class VerupSubTabViewTable extends Component { |
| | | static propTpyes = { |
| | | menuType: PropTypes.any, // 菜单类型,普通菜单或HS |
| | | Tab: PropTypes.object, // 标签信息 |
| | | BID: PropTypes.string, // 上级数据ID |
| | | BData: PropTypes.any, // 上级数据 |
| | | MenuID: PropTypes.string, // 菜单Id |
| | | SupMenuID: PropTypes.string, // 上级菜单Id |
| | | ContainerId: PropTypes.any, // 三级菜单Container(html) ID |
| | | handleTableId: PropTypes.func, // 控制表格数据切换时,更新在主表中的id |
| | | handleMainTable: PropTypes.func, // 刷新主表 |
| | | refreshtabs:PropTypes.any |
| | | } |
| | | |
| | | state = { |
| | | dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | config: null, // 页面配置信息,包括按钮、搜索、显示列、标签等 |
| | | actions: null, // 按钮集 |
| | | columns: null, // 显示列 |
| | | setting: null, // 页面全局设置:数据源、按钮及显示列固定、主键等 |
| | | data: null, // 列表数据集 |
| | | loading: false, // 列表数据加载中 |
| | | visible: false, // 弹框显示隐藏控制 |
| | | pickup: false, // 子表数据隐藏显示切换 |
| | | } |
| | | |
| | | /** |
| | | * @description 上级菜单id变化时,刷新数据 |
| | | */ |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | | if (this.state.config && this.props.Tab.supMenu && !is(fromJS(this.props.BID), fromJS(nextProps.BID))) { |
| | | this.refs.subTable.resetTable() |
| | | this.loadmaindata(nextProps.BID, 'refresh') |
| | | } else if (this.state.config && nextProps.refreshtabs && nextProps.refreshtabs.includes(this.props.Tab.uuid)) { |
| | | |
| | | this.reloadtable() |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 获取页面配置信息 |
| | | */ |
| | | async loadconfig () { |
| | | const { Tab, BID } = this.props |
| | | |
| | | let config = tabConfig[this.props.MenuID] |
| | | |
| | | let _arrField = [] // 字段集 |
| | | let _columns = [] // 显示列 |
| | | let _hideCol = [] // 隐藏及合并列中字段的uuid集 |
| | | let colMap = new Map() |
| | | |
| | | // 1、筛选字段集,2、过滤隐藏列及合并列中的字段uuid |
| | | config.columns.forEach(col => { |
| | | if (col.field) { |
| | | _arrField.push(col.field) |
| | | |
| | | } |
| | | if (col.type === 'colspan' && col.sublist) { // 筛选隐藏列 |
| | | _hideCol = _hideCol.concat(col.sublist) |
| | | } else if (col.Hide === 'true') { |
| | | _hideCol.push(col.uuid) |
| | | } |
| | | colMap.set(col.uuid, col) |
| | | }) |
| | | |
| | | // 生成显示列,处理合并列中的字段 |
| | | config.columns.forEach(col => { |
| | | if (_hideCol.includes(col.uuid)) return |
| | | |
| | | if (col.type === 'colspan' && col.sublist) { |
| | | let _col = JSON.parse(JSON.stringify(col)) |
| | | let subColumn = [] |
| | | _col.sublist.forEach(sub => { |
| | | if (colMap.has(sub)) { |
| | | subColumn.push(colMap.get(sub)) |
| | | } |
| | | }) |
| | | _col.subColumn = subColumn |
| | | _columns.push(_col) |
| | | } else { |
| | | _columns.push(col) |
| | | } |
| | | }) |
| | | |
| | | this.setState({ |
| | | config: config, |
| | | setting: config.setting, |
| | | actions: config.action.map(item => { |
| | | if (buttonConfig[item.uuid]) { |
| | | item = {...buttonConfig[item.uuid], ...item} |
| | | } |
| | | return item |
| | | }), |
| | | columns: _columns |
| | | }, () => { |
| | | if (config.setting.onload !== 'false' && (!Tab.supMenu || BID)) { // 初始化可加载 |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | this.loadmaindata() |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 子表数据加载 |
| | | */ |
| | | async loadmaindata (bid, type) { |
| | | const { setting } = this.state |
| | | let param = '' |
| | | let _BID = this.props.BID |
| | | |
| | | if (type === 'refresh') { |
| | | _BID = bid |
| | | if (!bid) { // 主表ID不存在时,不查询子表 |
| | | this.setState({ |
| | | data: [], |
| | | loading: false |
| | | }) |
| | | |
| | | return |
| | | } |
| | | } |
| | | |
| | | if (setting.interType !== 'inner' || (setting.interType === 'inner' && setting.innerFunc)) { |
| | | param = this.getCustomParam(_BID) |
| | | } else { |
| | | param = this.getDefaultParam(_BID) |
| | | } |
| | | |
| | | this.handleTableId() |
| | | |
| | | let result = await Api.getLocalConfig(param) |
| | | |
| | | if (result.status) { |
| | | // let _data = result.secret_param |
| | | |
| | | let _data = [ |
| | | {uuid: 'sso_system', public: 'a', private: 'apple', keyType: 'sso'}, |
| | | {uuid: 'local_system', public: 'b', private: 'banana', keyType: 'local'}, |
| | | {uuid: 'other_system1', public: 'c', private: 'cherry', keyType: 'other'}, |
| | | {uuid: 'other_system2', public: 'd', private: 'damson', keyType: 'other'} |
| | | ] |
| | | _data = _data.map((item, index) => { |
| | | item.key = index |
| | | return item |
| | | }) |
| | | // Math.floor(Math.random()*10) |
| | | try { |
| | | |
| | | } catch { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | notification.error({ |
| | | top: 92, |
| | | message: '密钥组数据格式错误,请恢复默认设置后,重新添加!', |
| | | duration: 15 |
| | | }) |
| | | return |
| | | } |
| | | this.setState({ |
| | | data: _data, |
| | | pickup: false, |
| | | loading: false |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | notification.error({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 15 |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 获取用户自定义存储过程传参 |
| | | */ |
| | | getCustomParam = (BID) => { |
| | | const { setting } = this.state |
| | | |
| | | let param = { |
| | | BID: BID |
| | | } |
| | | |
| | | if (setting.interType === 'inner') { |
| | | param.func = setting.innerFunc |
| | | } else { |
| | | if (setting.sysInterface === 'true' && options.cloudServiceApi) { |
| | | param.rduri = options.cloudServiceApi |
| | | } else if (setting.sysInterface !== 'true') { |
| | | param.rduri = setting.interface |
| | | } |
| | | |
| | | param.appkey = window.GLOB.appkey || '' // 调用外部接口增加appkey |
| | | |
| | | if (setting.outerFunc) { |
| | | param.func = setting.outerFunc |
| | | } |
| | | } |
| | | |
| | | return param |
| | | } |
| | | |
| | | /** |
| | | * @description 表格条件改变时重置数据(分页或排序) |
| | | */ |
| | | refreshbytable = (pagination, filters, sorter) => { |
| | | let { data } = this.state |
| | | |
| | | if (!data || data.length === 0 || !sorter.columnKey) return |
| | | |
| | | if (sorter.order === 'asc' || sorter.order === 'ascend') { |
| | | data.sort((a, b) => { |
| | | return a[sorter.columnKey].localeCompare(b[sorter.columnKey]) |
| | | }) |
| | | } else if (sorter.order === 'desc' || sorter.order === 'descend') { |
| | | data.sort((a, b) => { |
| | | return b[sorter.columnKey].localeCompare(a[sorter.columnKey]) |
| | | }) |
| | | } |
| | | |
| | | this.setState({data}) |
| | | } |
| | | |
| | | /** |
| | | * @description 表格刷新 |
| | | */ |
| | | reloadtable = () => { |
| | | this.refs.subTable.resetTable() |
| | | this.setState({ |
| | | loading: true, |
| | | }, () => { |
| | | this.loadmaindata() |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 页面刷新,重新获取配置 |
| | | */ |
| | | reloadview = () => { |
| | | this.setState({ |
| | | config: null, |
| | | actions: null, |
| | | columns: null, |
| | | setting: null, |
| | | data: null, |
| | | loading: false, |
| | | }, () => { |
| | | this.loadconfig() |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 按钮操作完成后(成功或失败),页面刷新,重置页码及选择项 |
| | | */ |
| | | refreshbyaction = (btn, type) => { |
| | | if (btn.execSuccess === 'grid' && type === 'success') { |
| | | this.reloadtable() |
| | | } else if (btn.execError === 'grid' && type === 'error') { |
| | | this.reloadtable() |
| | | } else if (btn.execSuccess === 'view' && type === 'success') { |
| | | this.reloadview() |
| | | } else if (btn.execError === 'view' && type === 'error') { |
| | | this.reloadview() |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 获取表格选择项 |
| | | */ |
| | | gettableselected = () => { |
| | | let data = [] |
| | | this.refs.subTable.state.selectedRowKeys.forEach(item => { |
| | | data.push(this.refs.subTable.props.data[item]) |
| | | }) |
| | | return data |
| | | } |
| | | |
| | | /** |
| | | * @description 表格Id变化 |
| | | */ |
| | | handleTableId = (type = this.props.Tab.uuid, id = '', data = '') => { |
| | | this.props.handleTableId(type, id, data) |
| | | } |
| | | |
| | | /** |
| | | * @description 数据展开合并切换 |
| | | */ |
| | | pickupChange = () => { |
| | | const { pickup } = this.state |
| | | |
| | | this.setState({ |
| | | pickup: !pickup |
| | | }) |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | // 组件加载时,获取菜单数据 |
| | | this.loadconfig() |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { // handleMainTable 函数判断时不相等 |
| | | return !is(fromJS({...this.props, handleMainTable: '', handleTableId: ''}), fromJS({...nextProps, handleMainTable: '', handleTableId: ''})) || !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | /** |
| | | * @description 组件销毁,清除state更新 |
| | | */ |
| | | componentWillUnmount () { |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | } |
| | | |
| | | render() { |
| | | const { setting, actions, columns, pickup } = this.state |
| | | |
| | | return ( |
| | | <div className="subtable" id={'subtable' + this.props.MenuID}> |
| | | <div className="sub-action"> |
| | | <SubAction |
| | | ref="subButton" |
| | | type="sub" |
| | | setting={setting} |
| | | actions={actions} |
| | | Tab={this.props.Tab} |
| | | BID={this.props.BID} |
| | | datalist={this.state.data} |
| | | dict={this.state.dict} |
| | | MenuID={this.props.SupMenuID} |
| | | logcolumns={[]} |
| | | refreshdata={this.refreshbyaction} |
| | | ContainerId={this.props.ContainerId} |
| | | getexceloutparam={this.getexceloutparam} |
| | | gettableselected={this.gettableselected} |
| | | /> |
| | | </div> |
| | | <div className="subtable-box"> |
| | | {this.state.data && this.state.data.length > 0 ? |
| | | <Switch title="收起" className="subtable-pickup" checkedChildren="开" unCheckedChildren="关" defaultChecked={pickup} onChange={this.pickupChange} /> : null |
| | | } |
| | | <SubTable |
| | | ref="subTable" |
| | | tableId={this.props.Tab.uuid} |
| | | pickup={pickup} |
| | | setting={setting} |
| | | columns={columns} |
| | | pagination={false} |
| | | dict={this.state.dict} |
| | | data={this.state.data} |
| | | MenuID={this.props.MenuID} |
| | | loading={this.state.loading} |
| | | refreshdata={this.refreshbytable} |
| | | buttonTrigger={() => {}} |
| | | handleTableId={this.handleTableId} |
| | | /> |
| | | </div> |
| | | </div> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default VerupSubTabViewTable |
New file |
| | |
| | | .subtable { |
| | | position: relative; |
| | | min-height: 200px; |
| | | |
| | | > .top-search { |
| | | padding: 0 0px 20px; |
| | | } |
| | | >.sub-action { |
| | | min-height: 25px; |
| | | .button-list { |
| | | padding: 10px 0px 5px; |
| | | } |
| | | } |
| | | .normal-data-table { |
| | | padding: 0px; |
| | | } |
| | | .box404 { |
| | | padding-top: 30px; |
| | | } |
| | | .ant-modal-mask { |
| | | position: absolute; |
| | | } |
| | | .ant-modal-wrap { |
| | | position: absolute; |
| | | } |
| | | .action-modal .ant-modal { |
| | | top: 40px; |
| | | max-width: 95%; |
| | | .ant-modal-body { |
| | | max-height: calc(100vh - 265px); |
| | | } |
| | | } |
| | | > .ant-spin { |
| | | position: absolute; |
| | | left: calc(50% - 22px); |
| | | top: 100px; |
| | | } |
| | | .subtable-box { |
| | | position: relative; |
| | | .subtable-pickup { |
| | | position: absolute; |
| | | right: 5px; |
| | | top: -22px; |
| | | z-index: 10; |
| | | } |
| | | } |
| | | } |
| | |
| | | import Utils from '@/utils/utils.js' |
| | | import options from '@/store/options.js' |
| | | import asyncLoadComponent from '@/utils/asyncLoadComponent' |
| | | import { verupMainTable, buttonConfig } from './config.js' |
| | | import { verupMainTable, buttonConfig } from './config' |
| | | |
| | | import MainTable from '@/tabviews/zshare/normalTable' |
| | | import TopSearch from './topSearch' |
| | |
| | | import enUS from '@/locales/en-US/main.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import options from '@/store/options.js' |
| | | import { buttonConfig, tabConfig } from '../config.js' |
| | | import { buttonConfig, tabConfig } from '../config' |
| | | |
| | | import SubTable from '@/tabviews/zshare/normalTable' |
| | | import SubAction from '../actionList' |
| | |
| | | } |
| | | } else if (btn.sql) { |
| | | param.ID = primaryId |
| | | param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, '', param, data[0], logcolumns)) // 数据源 |
| | | param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, '', param, data[0], logcolumns, this.props.Tab)) // 数据源 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | } |
| | |
| | | } |
| | | |
| | | param.ID = primaryId || Utils.getguid() |
| | | param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata, param, data[0], logcolumns)) // 数据源 |
| | | param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata, param, data[0], logcolumns, this.props.Tab)) // 数据源 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | } else if (btn.sql) { |
| | | param.ID = primaryId |
| | | param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata, param, data[0], logcolumns)) // 数据源 |
| | | param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata, param, data[0], logcolumns, this.props.Tab)) // 数据源 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | } |
| | |
| | | } |
| | | } else if (btn.sql) { |
| | | param.ID = primaryId |
| | | param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, '', param, cell, logcolumns)) // 数据源 |
| | | param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, '', param, cell, logcolumns, this.props.Tab)) // 数据源 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | } |
| | |
| | | } |
| | | } else if (btn.sql && btn.sqlType === 'insert') { // 系统函数添加时,生成uuid |
| | | param.ID = _formPrimaryId || Utils.getguid() |
| | | param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata, param, cell, logcolumns)) // 数据源 |
| | | param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata, param, cell, logcolumns, this.props.Tab)) // 数据源 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | } else if (btn.sql) { |
| | |
| | | } |
| | | |
| | | param.ID = primaryId |
| | | param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata, param, cell, logcolumns)) // 数据源 |
| | | param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata, param, cell, logcolumns, this.props.Tab)) // 数据源 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | } |
| | |
| | | const { Paragraph } = Typography |
| | | |
| | | export default class MainTable extends Component { |
| | | static defaultProps = { |
| | | pagination: true, |
| | | total: 0 |
| | | } |
| | | |
| | | static propTpyes = { |
| | | tableId: PropTypes.string, // 列表Id |
| | | dict: PropTypes.object, // 字典项 |
| | |
| | | pickup: PropTypes.any, // 数据收起 |
| | | columns: PropTypes.array, // 表格列 |
| | | data: PropTypes.any, // 表格数据 |
| | | total: PropTypes.number, // 总数 |
| | | total: PropTypes.any, // 总数 |
| | | loading: PropTypes.bool, // 表格加载中 |
| | | refreshdata: PropTypes.func, // 表格中排序列、页码的变化时刷新 |
| | | buttonTrigger: PropTypes.func, // 表格中按钮触发操作 |
| | | linkTrigger: PropTypes.func, // 字段透视 |
| | | handleTableId: PropTypes.func // 数据切换 |
| | | handleTableId: PropTypes.func, // 数据切换 |
| | | pagination: PropTypes.any // 数据切换 |
| | | } |
| | | |
| | | state = { |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { setting, pickup } = this.props |
| | | const { setting, pickup, pagination } = this.props |
| | | let { selectedRowKeys } = this.state |
| | | |
| | | // 设置表格选择属性:单选、多选、不可选 |
| | |
| | | _data = _data.filter((item, index) => selectedRowKeys.includes(index)) |
| | | } |
| | | |
| | | let _pagination = false |
| | | if (pagination) { |
| | | _pagination = { |
| | | current: this.state.pageIndex, |
| | | pageSize: this.state.pageSize, |
| | | pageSizeOptions: ['10', '25', '50', '100', '500', '1000'], |
| | | showSizeChanger: true, |
| | | total: this.props.total, |
| | | showTotal: (total, range) => `${range[0]}-${range[1]} ${this.props.dict['main.pagination.of']} ${total} ${this.props.dict['main.pagination.items']}` |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | <div className="normal-data-table"> |
| | | {offset && <Affix offsetTop={offset} className="fix-header"> |
| | |
| | | } |
| | | }} |
| | | onChange={this.changeTable} |
| | | pagination={{ |
| | | current: this.state.pageIndex, |
| | | pageSize: this.state.pageSize, |
| | | pageSizeOptions: ['10', '25', '50', '100', '500', '1000'], |
| | | showSizeChanger: true, |
| | | total: this.props.total, |
| | | showTotal: (total, range) => `${range[0]}-${range[1]} ${this.props.dict['main.pagination.of']} ${total} ${this.props.dict['main.pagination.items']}` |
| | | }} |
| | | pagination={_pagination} |
| | | /> |
| | | <Modal |
| | | className="image-scale-modal" |
| | |
| | | type: 'mutilselect', |
| | | key: 'equalTab', |
| | | label: this.state.dict['header.form.equalTab'], |
| | | tooltip: '如果子标签中含有刷新同级标签的按钮,在此处添加需要刷新的标签。', |
| | | initVal: equalTab, |
| | | required: false, |
| | | options: equalTabs |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'foreignKey', |
| | | label: '外键', |
| | | tooltip: '外键旨在标签页中执行默认函数(添加)时,替换BID字段', |
| | | initVal: card.foreignKey || '', |
| | | required: false |
| | | } |
| | | ] |
| | | }) |
| | |
| | | }, { |
| | | value: 'update', |
| | | text: this.props.dict['header.form.action.update'] |
| | | }, { |
| | | value: 'insertOrUpdate', |
| | | text: this.props.dict['header.form.action.insertOrUpdate'] |
| | | }], |
| | | returnoptions: [{ // 返回后-不刷新、刷新页面、刷新表格 |
| | | value: 'never', |
| | |
| | | type: 'mutilselect', |
| | | key: 'equalTab', |
| | | label: this.state.dict['header.form.equalTab'], |
| | | tooltip: '如果子标签中含有刷新同级标签的按钮,在此处添加需要刷新的标签。', |
| | | initVal: equalTab, |
| | | required: false, |
| | | options: equalTabs |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'foreignKey', |
| | | label: '外键', |
| | | tooltip: '外键旨在标签页中执行默认函数(添加)时,替换BID字段', |
| | | initVal: card.foreignKey || '', |
| | | required: false |
| | | } |
| | | ] |
| | | }) |
| | |
| | | datemonth: ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin', 'blacklist'], |
| | | datetime: ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin', 'blacklist'], |
| | | textarea: ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin', 'blacklist', 'fieldlength', 'maxRows'], |
| | | funcvar: ['label', 'field', 'type', 'blacklist'], |
| | | funcvar: ['label', 'field', 'type', 'blacklist', 'hidden'], |
| | | linkMain: ['label', 'field', 'type', 'readonly', 'required', 'hidden', 'fieldlength', 'blacklist'] |
| | | } |
| | | |
| | |
| | | if (item.hidden) return |
| | | |
| | | if (item.type === 'text') { // 文本搜索 |
| | | let rules = [] |
| | | |
| | | if (item.key === 'foreignKey') { |
| | | rules.push({ |
| | | pattern: /^[a-zA-Z_]*$/ig, |
| | | message: item.label + '字段只允许包含字母及下划线!' |
| | | }) |
| | | } |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={item.label}> |
| | | <Form.Item label={ |
| | | item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <Icon type="question-circle" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal, |
| | | rules: [ |
| | |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | }, |
| | | ...rules |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" disabled={item.readonly} onPressEnter={this.handleSubmit} />)} |
| | | </Form.Item> |
| | |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="标签添加同级标签后,标签中按钮刷新主表时,添加的同级标签会刷新。"> |
| | | item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <Icon type="question-circle" /> |
| | | {item.label} |
| | | </Tooltip> |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal |
| | |
| | | return |
| | | } |
| | | |
| | | let tail = ` |
| | | aaa: |
| | | ` |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | LText: this.props.initsql + values.sql |
| | | LText: this.props.initsql + values.sql + tail |
| | | } |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | |
| | | } |
| | | |
| | | let _usefulfields = ['BID', 'ID', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'UserName', 'FullName'] |
| | | let _declare = ['@UserName nvarchar(50)', '@FullName nvarchar(50)'] |
| | | let _select = ['@UserName=\'\'', '@FullName=\'\''] |
| | | let _declare = ['@UserName nvarchar(50)', '@FullName nvarchar(50)', '@ErrorCode nvarchar(50)', '@retmsg nvarchar(4000)'] |
| | | let _select = ['@UserName=\'\'', '@FullName=\'\'', '@ErrorCode=\'\'', '@retmsg=\'\''] |
| | | let hasBid = false |
| | | let fieldArr = _usefulfields.map(_f => _f.toLowerCase()) |
| | | |
| | |
| | | }) |
| | | } else { |
| | | let _usefulfields = ['BID', 'ID', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'UserName', 'FullName'] |
| | | let _declare = ['@UserName nvarchar(50)', '@FullName nvarchar(50)'] |
| | | let _select = ['@UserName=\'\'', '@FullName=\'\''] |
| | | let _declare = ['@UserName nvarchar(50)', '@FullName nvarchar(50)', '@ErrorCode nvarchar(50)', '@retmsg nvarchar(4000)'] |
| | | let _select = ['@UserName=\'\'', '@FullName=\'\'', '@ErrorCode=\'\'', '@retmsg=\'\''] |
| | | let fieldArr = _usefulfields.map(_f => _f.toLowerCase()) |
| | | |
| | | if (columns && columns.length > 0 && this.props.card.Ot !== 'notRequired') { |
| | |
| | | } |
| | | |
| | | let _sql = `Declare @${btn.sheet} table (${usefulfields.map(item => item.Column + ' ' + item.type).join(',')},jskey nvarchar(50) ) |
| | | Declare @UserName nvarchar(50),@FullName nvarchar(50) |
| | | Declare @UserName nvarchar(50),@FullName nvarchar(50),@ErrorCode nvarchar(50), @retmsg nvarchar(4000) |
| | | Select @ErrorCode='', @retmsg='' |
| | | ` |
| | | |
| | | this.setState({ |
| | |
| | | return |
| | | } |
| | | |
| | | let tail = ` |
| | | aaa: |
| | | ` |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | LText: this.state.verifySql + values.sql |
| | | LText: this.state.verifySql + values.sql + tail |
| | | } |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | |
| | | }) |
| | | |
| | | // 1、替换%符(数据库中解析后sql报错),2、去除收尾多余空格 |
| | | value = value.replace(/%/ig, 'mpercent') |
| | | value = value.replace(/(^\s|\s$)/ig, '') |
| | | value = value.replace(/%/ig, ' mpercent ') |
| | | // value = value.replace(/(^\s|\s$)/ig, '') |
| | | |
| | | // 1、encode编码(中文字符超出base64加密范围),2、base64加密 |
| | | value = window.btoa(window.encodeURIComponent(value)) |
| | |
| | | }) |
| | | } |
| | | } else if (/^int/ig.test(col.type)) { |
| | | if (!val) { |
| | | if (!val && val !== 0) { |
| | | let _error = _position + dict['main.excel.content.emptyerror'] |
| | | errors.push(_error) |
| | | } else { |
| | |
| | | } |
| | | } |
| | | } else if (/^Decimal/ig.test(col.type)) { |
| | | if (!val) { |
| | | if (!val && val !== 0) { |
| | | let _error = _position + dict['main.excel.content.emptyerror'] |
| | | errors.push(_error) |
| | | } else { |
| | |
| | | * @return {String} type 执行类型 |
| | | * @return {String} table 表名 |
| | | */ |
| | | static getSysDefaultSql (btn, setting, formdata, param, data, logcolumns) { |
| | | static getSysDefaultSql (btn, setting, formdata, param, data, logcolumns, tab) { |
| | | let primaryId = param.ID |
| | | let BID = param.BID |
| | | let verify = btn.verify || {} |
| | |
| | | _actionType = btn.sqlType |
| | | } |
| | | |
| | | // 添加、修改、逻辑删除、物理删除 |
| | | if (_actionType === 'insert') { |
| | | let _insertsql = '' |
| | | let _updatesql = '' |
| | | if (_actionType === 'insert' || _actionType === 'insertOrUpdate') { // 添加语句 |
| | | let keys = [] |
| | | let values = [] |
| | | |
| | |
| | | values.push('@fullname') |
| | | } |
| | | if (!keys.includes('bid')) { |
| | | keys.push('bid') |
| | | if (tab && tab.foreignKey && !keys.includes(tab.foreignKey.toLowerCase())) { |
| | | keys.push(tab.foreignKey) |
| | | } else { |
| | | keys.push('bid') |
| | | } |
| | | values.push('@BID@') |
| | | } |
| | | |
| | | keys = keys.join(',') |
| | | values = values.join(',') |
| | | _sql += `insert into ${btn.sql} (${keys}) select ${values};` |
| | | } else if (_actionType === 'update') { |
| | | _insertsql = `insert into ${btn.sql} (${keys}) select ${values};` |
| | | } else if (_actionType === 'insert' || _actionType === 'insertOrUpdate') { // 修改语句 |
| | | let _form = [] |
| | | let _arr = [] |
| | | |
| | |
| | | } |
| | | |
| | | _form = _form.join(',') |
| | | _sql += `update ${btn.sql} set ${_form} where ${primaryKey}=@${primaryKeyName};` |
| | | _updatesql = `update ${btn.sql} set ${_form} where ${primaryKey}=@${primaryKeyName};` |
| | | } |
| | | |
| | | // 添加、修改、逻辑删除、物理删除 |
| | | if (_actionType === 'insert') { |
| | | _sql += _insertsql |
| | | } else if (_actionType === 'update') { |
| | | _sql += _updatesql |
| | | } else if (_actionType === 'LogicDelete') { // 逻辑删除 |
| | | _sql += `update ${btn.sql} set deleted=1,modifydate=getdate(),modifyuserid=@userid@ where ${primaryKey}=@${primaryKeyName};` |
| | | |
| | |
| | | }) |
| | | } |
| | | _sql += `insert into snote (remark,createuserid,CreateUser,CreateStaff) select '删除表:${btn.sql} 数据: ${_msg}${primaryKey}='+@${primaryKeyName},@userid@,@username,@fullname delete ${btn.sql} where ${primaryKey}=@${primaryKeyName};` |
| | | } else if (_actionType === 'insertOrUpdate') { |
| | | _sql += `select @tbid='' |
| | | select @tbid='X' from ${btn.sql} where ${primaryKey}=@ID@ |
| | | if @tbid='' |
| | | ${_insertsql} |
| | | else |
| | | ${_updatesql} |
| | | ` |
| | | } |
| | | |
| | | // 拼接自定义脚本 |