| | |
| | | Type: 'X' |
| | | } |
| | | param.Password = Utils.formatOptions(param.Password) |
| | | param.appkey = window.GLOB.appkey || '' |
| | | |
| | | if (isCloud && options.cloudLoginApi) { |
| | | param.rduri = options.cloudLoginApi |
| | |
| | | 'header.form.database': '数据库', |
| | | 'header.form.database.local': '本地', |
| | | 'header.form.database.sso': '系统', |
| | | 'header.form.field.length': '字段长度', |
| | | 'header.form.linkMain': '关联主表', |
| | | 'header.form.query.delete': '确定删除吗?', |
| | | 'header.form.up': '上移', |
| | |
| | | 'header.form.status.change': '状态切换', |
| | | 'header.form.status.forbidden': '禁用', |
| | | 'header.form.status.open': '启用', |
| | | 'header.form.readin': '数据写入', |
| | | 'header.form.readin.tooltip': '是否将表格或主表中的数据写入表单', |
| | | 'header.modal.form.edit': '表单-编辑', |
| | | 'header.modal.search.edit': '搜索条件-编辑', |
| | | 'header.modal.action.edit': '按钮-编辑', |
| | |
| | | 'header.form.database': '数据库', |
| | | 'header.form.database.local': '本地', |
| | | 'header.form.database.sso': '系统', |
| | | 'header.form.field.length': '字段长度', |
| | | 'header.form.linkMain': '关联主表', |
| | | 'header.form.query.delete': '确定删除吗?', |
| | | 'header.form.up': '上移', |
| | |
| | | 'header.form.status.change': '状态切换', |
| | | 'header.form.status.forbidden': '禁用', |
| | | 'header.form.status.open': '启用', |
| | | 'header.form.readin': '数据写入', |
| | | 'header.form.readin.tooltip': '是否将表格中的数据写入表单', |
| | | 'header.modal.form.edit': '表单-编辑', |
| | | 'header.modal.search.edit': '搜索条件-编辑', |
| | | 'header.modal.action.edit': '按钮-编辑', |
| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { BackTop, notification, Spin, Tabs, Icon, Switch, Modal, Button} from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | 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 asyncComponent from '@/utils/asyncLoadComponent' |
| | | import {refreshTabView, modifyTabview} from '@/store/action' |
| | | |
| | | import MainTable from './mainTable' |
| | | import MainAction from '@/tabviews/tableshare/actionList' |
| | | import MainSearch from '@/tabviews/tableshare/topSearch' |
| | | import SubTable from '@/tabviews/subtable' |
| | | import NotFount from '@/components/404' |
| | | import asyncComponent from '@/utils/asyncLoadComponent' |
| | | import {refreshTabView, modifyTabview} from '@/store/action' |
| | | import zhCN from '@/locales/zh-CN/main.js' |
| | | import enUS from '@/locales/en-US/main.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import './index.scss' |
| | | |
| | | const SubTabTable = asyncComponent(() => import('@/tabviews/subtabtable')) |
| | |
| | | |
| | | state = { |
| | | dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | ContainerId: Utils.getuuid(), // 菜单外层html Id |
| | | loadingview: true, // 页面加载中 |
| | | viewlost: false, // 页面丢失:1、未获取到配置-页面丢失;2、页面未启用 |
| | | lostmsg: '', // 页面丢失时的提示信息 |
| | |
| | | searchlist: null, // 搜索条件 |
| | | actions: null, // 按钮集 |
| | | columns: null, // 显示列 |
| | | logcolumns: null, // 日志中显示的列信息 |
| | | logcolumns: null, // 日志中显示的列信息 (增加至全部列,除去合并列) |
| | | arr_field: '', // 使用 sPC_Get_TableData 时的查询字段集 |
| | | setting: null, // 页面全局设置:数据源、按钮及显示列固定、主键等 |
| | | data: null, // 列表数据集 |
| | |
| | | orderColumn: '', // 排序字段 |
| | | orderType: 'asc', // 排序方式 |
| | | search: '', // 搜索条件数组,使用时需分场景处理 |
| | | configMap: {}, // 页面配置信息:下拉、按钮等 |
| | | BIDs: {}, // 上级表id |
| | | setsingle: false, // 主表单选多选切换 |
| | | pickup: false, // 主表数据隐藏显示切换 |
| | |
| | | if (col.field) { |
| | | _arrField.push(col.field) |
| | | |
| | | // 筛选出日志中的显示列,取前四个 |
| | | if (col.Hide !== 'true' && _logcolumns.length < 4) { |
| | | _logcolumns.push(col) |
| | | } |
| | | _logcolumns.push(col) |
| | | } |
| | | if (col.type === 'colspan' && col.sublist) { // 筛选隐藏列 |
| | | _hideCol = _hideCol.concat(col.sublist) |
| | |
| | | orderColumn: '', |
| | | orderType: 'asc', |
| | | search: '', |
| | | configMap: {}, |
| | | BIDs: {}, |
| | | setsingle: false, |
| | | pickup: false, |
| | |
| | | const { setting, searchlist, actions, columns, loadingview, viewlost, setsingle, pickup, isLinkMain, config } = this.state |
| | | |
| | | return ( |
| | | <div className={'commontable ' + (isLinkMain ? 'pick-control' : '')} id={'commontable' + this.props.MenuID}> |
| | | <div className={'commontable ' + (isLinkMain ? 'pick-control' : '')} id={this.state.ContainerId}> |
| | | {loadingview && <Spin size="large" />} |
| | | {searchlist && searchlist.length > 0 ? |
| | | <MainSearch |
| | |
| | | type="main" |
| | | setting={setting} |
| | | actions={actions} |
| | | logcolumns={this.state.logcolumns} |
| | | dict={this.state.dict} |
| | | MenuID={this.props.MenuID} |
| | | logcolumns={this.state.logcolumns} |
| | | ContainerId={this.state.ContainerId} |
| | | refreshdata={this.refreshbyaction} |
| | | triggerPopview={this.triggerPopview} |
| | | gettableselected={this.gettableselected} |
| | |
| | | Tab={_tab} |
| | | MenuID={_tab.linkTab} |
| | | SupMenuID={this.props.MenuID} |
| | | ContainerId={this.state.ContainerId} |
| | | BID={this.state.BIDs[_tab.supMenu] || ''} |
| | | BData={this.state.BIDs[_tab.supMenu + 'data'] || ''} |
| | | handleTableId={this.handleTableId} |
| | |
| | | ]} |
| | | destroyOnClose |
| | | > |
| | | {<SubTabTable SupMenuID={this.props.MenuID} MenuID={this.state.popAction.linkTab} BID={''} ID={this.state.popData ? this.state.popData[setting.primaryKey] : ''} refreshSupView={this.reloadtable} />} |
| | | {<SubTabTable |
| | | BID={''} |
| | | SupMenuID={this.props.MenuID} |
| | | MenuID={this.state.popAction.linkTab} |
| | | BData={this.state.BIDs['mainTabledata'] || ''} |
| | | ContainerId={this.state.ContainerId} |
| | | ID={this.state.popData ? this.state.popData[setting.primaryKey] : ''} |
| | | refreshSupView={this.reloadtable} |
| | | />} |
| | | </Modal> |
| | | <BackTop> |
| | | <div className="ant-back-top"> |
| | |
| | | |
| | | let _this = this |
| | | let data = this.props.gettableselected() || [] |
| | | |
| | | if (record) { // 表格中触发按钮 |
| | | data = [record] |
| | | } |
| | | |
| | | if (item.Ot !== 'notRequired' && data.length === 0) { |
| | | // 需要选择行时,校验数据 |
| | |
| | | state = { |
| | | datatype: null, |
| | | readtype: null, |
| | | formlist: [] |
| | | groups: null, |
| | | formlist: [], |
| | | record: {} |
| | | } |
| | | |
| | | componentDidMount () { |
| | |
| | | }) |
| | | } |
| | | |
| | | resetform = (formlist, supfields, index, fieldsvalue) => { |
| | | resetform = (groups, supfields, index, fieldsvalue) => { |
| | | index++ |
| | | let subfields = [] |
| | | |
| | | supfields.forEach(supfield => { |
| | | formlist = formlist.map(item => { |
| | | if (item.type === 'link' && item.linkField === supfield.field) { |
| | | item.options = item.oriOptions.filter(option => option.parentId === supfield.initval) |
| | | item.initval = item.options[0] ? item.options[0].Value : '' |
| | | groups = groups.map(group => { |
| | | group.sublist = group.sublist.map(item => { |
| | | if (item.type === 'link' && item.linkField === supfield.field) { |
| | | item.options = item.oriOptions.filter(option => option.parentId === supfield.initval) |
| | | item.initval = item.options[0] ? item.options[0].Value : '' |
| | | |
| | | fieldsvalue[item.field] = item.initval |
| | | |
| | | subfields.push(item) |
| | | } |
| | | return item |
| | | }) |
| | | return group |
| | | }) |
| | | }) |
| | | |
| | | if (subfields.length === 0 || index > 6) { |
| | | return {groups: groups, fieldsvalue: fieldsvalue} |
| | | } else { |
| | | return this.resetform(groups, subfields, index, fieldsvalue) |
| | | } |
| | | } |
| | | |
| | | selectChange = (_field, value, option) => { |
| | | const { record } = this.state |
| | | let groups = JSON.parse(JSON.stringify(this.state.groups)) |
| | | |
| | | let subfields = [] |
| | | let fieldsvalue = {} |
| | | let _record = {} |
| | | groups = groups.map(group => { |
| | | group.sublist = group.sublist.map(item => { |
| | | if (item.type === 'link' && item.linkField === _field.field) { |
| | | item.options = item.oriOptions.filter(option => option.parentId === value) |
| | | item.initval = item.options[0] ? item.options[0].Value : '' |
| | | |
| | | fieldsvalue[item.field] = item.initval |
| | | |
| | | subfields.push(item) |
| | | } |
| | | return item |
| | | }) |
| | | }) |
| | | |
| | | if (subfields.length === 0 || index > 6) { |
| | | this.props.form.setFieldsValue(fieldsvalue) |
| | | return formlist |
| | | } else { |
| | | return this.resetform(formlist, subfields, index, fieldsvalue) |
| | | } |
| | | } |
| | | |
| | | selectChange = (_field, value, option) => { |
| | | let formlist = JSON.parse(JSON.stringify(this.state.formlist)) |
| | | |
| | | let subfields = [] |
| | | let fieldsvalue = {} |
| | | formlist = formlist.map(item => { |
| | | if (item.type === 'link' && item.linkField === _field.field) { |
| | | item.options = item.oriOptions.filter(option => option.parentId === value) |
| | | item.initval = item.options[0] ? item.options[0].Value : '' |
| | | |
| | | fieldsvalue[item.field] = item.initval |
| | | |
| | | subfields.push(item) |
| | | } |
| | | return item |
| | | return group |
| | | }) |
| | | |
| | | // 表单切换时,更新关联字段 |
| | | if (_field.type === 'select' && _field.linkSubField && _field.linkSubField.length > 0 && option.props.data) { |
| | | let _data = option.props.data |
| | | let fieldVal = {} |
| | | _field.linkSubField.forEach(subfield => { |
| | | fieldVal[subfield] = _data[subfield] |
| | | if (this.props.form.getFieldValue(subfield) !== undefined) { |
| | | fieldsvalue[subfield] = _data[subfield] |
| | | } else { |
| | | _record[subfield] = _data[subfield] |
| | | } |
| | | }) |
| | | this.props.form.setFieldsValue(fieldVal) |
| | | } |
| | | |
| | | if (subfields.length === 0) return |
| | | if (subfields.length === 0) { |
| | | if (Object.keys(fieldsvalue).length > 0) { |
| | | this.props.form.setFieldsValue(fieldsvalue) |
| | | } |
| | | if (Object.keys(_record).length > 0) { |
| | | this.setState({ |
| | | record: {...record, ..._record} |
| | | }) |
| | | } |
| | | } else { |
| | | let result = this.resetform(groups, subfields, 0, fieldsvalue) |
| | | |
| | | formlist = this.resetform(formlist, subfields, 0, fieldsvalue) |
| | | if (Object.keys(result.fieldsvalue).length > 0) { |
| | | this.props.form.setFieldsValue(fieldsvalue) |
| | | } |
| | | |
| | | this.setState({ |
| | | formlist: formlist |
| | | }) |
| | | let _param = { |
| | | groups: result.groups |
| | | } |
| | | |
| | | if (Object.keys(_record).length > 0) { |
| | | _param.record = {...record, ..._record} |
| | | } |
| | | |
| | | this.setState(_param) |
| | | } |
| | | } |
| | | |
| | | getFields(formlist) { |
| | |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | | const { record } = this.state |
| | | // 表单提交时检查输入值是否正确 |
| | | return new Promise((resolve, reject) => { |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | |
| | | value: '' |
| | | }) |
| | | } else if (item.hidden === 'true') { |
| | | let _val = item.initval |
| | | if (record.hasOwnProperty(item.field)) { |
| | | _val = record[item.field] |
| | | } |
| | | search.push({ |
| | | type: this.state.datatype[item.field], |
| | | readonly: this.state.readtype[item.field], |
| | | key: item.field, |
| | | value: item.initval |
| | | value: _val |
| | | }) |
| | | } |
| | | }) |
| | |
| | | key: key, |
| | | value: vals.join(',') |
| | | }) |
| | | } else if (this.state.datatype[key] === 'funcvar') { |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | key: key, |
| | | value: values[key] |
| | | }) |
| | | } else { |
| | | } else if (this.state.datatype[key] === 'text') { |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | |
| | | value: values[key].replace(/(^\s*|\s*$)/ig, '') |
| | | // value: values[key].replace(/[\x00-\xff]+/ig, '') |
| | | }) |
| | | } else { |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | key: key, |
| | | value: values[key] |
| | | }) |
| | | } |
| | | }) |
| | | resolve(search) |
| | |
| | | |
| | | state = { |
| | | dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | ContainerId: Utils.getuuid(), // 菜单外层html Id |
| | | loadingview: true, // 页面加载中 |
| | | viewlost: false, // 页面丢失:1、未获取到配置-页面丢失;2、页面未启用 |
| | | lostmsg: '', // 页面丢失时的提示信息 |
| | |
| | | arr_field: _arrField, |
| | | data: _data, |
| | | BIDs: { |
| | | mainTable: (!_isCustomData && _data && _data[0] && _data[0][config.setting.primaryKey]) || '' |
| | | mainTable: (!_isCustomData && _data && _data[0] && _data[0][config.setting.primaryKey]) || '', |
| | | mainTabledata: (!_isCustomData && _data && _data[0]) || '' |
| | | } |
| | | }, () => { |
| | | this.improveSelectOption(config.groups) |
| | |
| | | this.setState({ |
| | | data: result.data, |
| | | BIDs: { |
| | | mainTable: (result.data[0] && result.data[0][setting.primaryKey]) || '' |
| | | mainTable: (result.data[0] && result.data[0][setting.primaryKey]) || '', |
| | | mainTabledata: result.data[0] || '' |
| | | } |
| | | }) |
| | | } else { |
| | |
| | | /** |
| | | * @description 表格Id变化 |
| | | */ |
| | | handleTableId = (type, id) => { |
| | | handleTableId = (type, id, data) => { |
| | | const { BIDs } = this.state |
| | | |
| | | this.setState({ |
| | | BIDs: { |
| | | ...BIDs, |
| | | [type]: id |
| | | [type]: id, |
| | | [type + 'data']: data |
| | | } |
| | | }) |
| | | } |
| | |
| | | const { setting, actions, loadingview, viewlost, isLinkMain, config, groups, data } = this.state |
| | | |
| | | return ( |
| | | <div className={'formtab ' + (isLinkMain ? 'pick-control' : '')} id={'formtab' + this.props.MenuID}> |
| | | <div className={'formtab ' + (isLinkMain ? 'pick-control' : '')} id={this.state.ContainerId}> |
| | | {loadingview && <Spin size="large" />} |
| | | {groups && (groups.length > 1 || groups[0].sublist.length > 0) ? |
| | | <FormGroup |
| | |
| | | return ( |
| | | <Tabs defaultActiveKey="0" key={group}> |
| | | {config[group].map((_tab, index) => { |
| | | // return !_tab.supMenu || (_tab.supMenu && this.state.BIDs[_tab.supMenu]) ? |
| | | return ( |
| | | <TabPane tab={ |
| | | <span> |
| | |
| | | Tab={_tab} |
| | | MenuID={_tab.linkTab} |
| | | SupMenuID={this.props.MenuID} |
| | | ContainerId={this.state.ContainerId} |
| | | BID={this.state.BIDs[_tab.supMenu] || ''} |
| | | BData={this.state.BIDs[_tab.supMenu + 'data'] || ''} |
| | | handleTableId={this.handleTableId} |
| | | handleMainTable={this.handleMainTable} |
| | | /> : null} |
| | |
| | | .formtab { |
| | | position: relative; |
| | | min-height: calc(100vh - 94px); |
| | | padding-top: 16px; |
| | | padding-bottom: 80px; |
| | | .box404 { |
| | | padding-top: 30px; |
| | | } |
| | | .ant-collapse { |
| | | border-radius: 0; |
| | | border: 0; |
| | | margin-top: 30px; |
| | | .ant-collapse-header { |
| | | cursor: default; |
| | | border-radius: 0!important; |
| | | background: #1890ff; |
| | | color: #ffffff; |
| | | padding-left: 30px; |
| | | padding-right: 20px; |
| | | .anticon { |
| | | font-size: 16px; |
| | | } |
| | | .ant-collapse-extra { |
| | | .anticon-edit { |
| | | position: absolute; |
| | | left: 5px; |
| | | top: 2px; |
| | | } |
| | | } |
| | | } |
| | | .ant-collapse-item:last-child { |
| | | >.ant-form.ant-form-horizontal { |
| | | .ant-collapse { |
| | | border-radius: 0; |
| | | .ant-collapse-content { |
| | | border-radius: 0; |
| | | } |
| | | } |
| | | .ant-collapse-content-box { |
| | | padding: 16px 30px; |
| | | > .ant-row { |
| | | min-height: 90px; |
| | | padding-bottom: 30px; |
| | | .page-card { |
| | | position: relative; |
| | | background: #ffffff; |
| | | border-radius: 2px; |
| | | padding-top: 15px; |
| | | .ant-form-item { |
| | | cursor: move; |
| | | display: flex; |
| | | margin-bottom: 0px; |
| | | .ant-form-item-label { |
| | | label { |
| | | width: 100%; |
| | | cursor: move; |
| | | overflow: hidden; |
| | | display: inline-block; |
| | | text-overflow: ellipsis; |
| | | white-space: nowrap; |
| | | } |
| | | } |
| | | .ant-form-item-label.ant-col-cuslabel { |
| | | width: 11%; |
| | | } |
| | | .ant-form-item-control-wrapper.ant-col-cuswrap { |
| | | width: 89%; |
| | | } |
| | | .ant-form-item-control-wrapper { |
| | | .ant-input-number { |
| | | width: 100%; |
| | | margin-top: 4px; |
| | | } |
| | | .ant-select { |
| | | width: 100%; |
| | | margin-top: 4px; |
| | | } |
| | | .ant-calendar-picker { |
| | | margin-top: 4px; |
| | | } |
| | | .ant-btn { |
| | | margin-top: 4px; |
| | | } |
| | | .input-mask { |
| | | position: absolute; |
| | | top: 0; |
| | | left: 0; |
| | | right: 0; |
| | | bottom: 0; |
| | | opacity: 0; |
| | | z-index: 2; |
| | | } |
| | | .data-range .ant-calendar-picker-input { |
| | | padding: 4px 20px 4px 5px; |
| | | font-size: 13px; |
| | | } |
| | | } |
| | | } |
| | | .edit { |
| | | border: 0; |
| | | .ant-collapse-header { |
| | | cursor: default; |
| | | border-radius: 0!important; |
| | | background: #1890ff; |
| | | color: #ffffff; |
| | | padding-left: 30px; |
| | | padding-right: 20px; |
| | | .anticon { |
| | | font-size: 16px; |
| | | } |
| | | .ant-collapse-extra { |
| | | .anticon-edit { |
| | | position: absolute; |
| | | left: 15px; |
| | | top: 5px; |
| | | color: #1890ff; |
| | | cursor: pointer; |
| | | display: none; |
| | | } |
| | | .edit.close { |
| | | left: 40px; |
| | | color: #ff4d4f; |
| | | left: 5px; |
| | | top: 2px; |
| | | } |
| | | } |
| | | .page-card:hover { |
| | | .edit { |
| | | display: inline-block; |
| | | } |
| | | } |
| | | .ant-collapse-item:last-child { |
| | | border-radius: 0; |
| | | .ant-collapse-content { |
| | | border-radius: 0; |
| | | } |
| | | .ant-calendar-picker { |
| | | min-width: 100px!important; |
| | | width: 100%; |
| | | } |
| | | .ant-collapse-content-box { |
| | | padding: 16px 30px; |
| | | > .ant-row { |
| | | // .page-card { |
| | | // position: relative; |
| | | // background: #ffffff; |
| | | // border-radius: 2px; |
| | | // padding-top: 15px; |
| | | // .ant-form-item { |
| | | // cursor: move; |
| | | // display: flex; |
| | | // margin-bottom: 0px; |
| | | // .ant-form-item-label { |
| | | // label { |
| | | // width: 100%; |
| | | // cursor: move; |
| | | // overflow: hidden; |
| | | // display: inline-block; |
| | | // text-overflow: ellipsis; |
| | | // white-space: nowrap; |
| | | // } |
| | | // } |
| | | // .ant-form-item-label.ant-col-cuslabel { |
| | | // width: 11%; |
| | | // } |
| | | // .ant-form-item-control-wrapper.ant-col-cuswrap { |
| | | // width: 89%; |
| | | // } |
| | | // .ant-form-item-control-wrapper { |
| | | // .ant-input-number { |
| | | // width: 100%; |
| | | // margin-top: 4px; |
| | | // } |
| | | // .ant-select { |
| | | // width: 100%; |
| | | // margin-top: 4px; |
| | | // } |
| | | // .ant-calendar-picker { |
| | | // margin-top: 4px; |
| | | // } |
| | | // .ant-btn { |
| | | // margin-top: 4px; |
| | | // } |
| | | // .data-range .ant-calendar-picker-input { |
| | | // padding: 4px 20px 4px 5px; |
| | | // font-size: 13px; |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | .ant-calendar-picker { |
| | | min-width: 100px!important; |
| | | width: 100%; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | .ant-modal-mask { |
| | | position: absolute; |
| | | } |
| | |
| | | BData: PropTypes.any, // 上级数据 |
| | | MenuID: PropTypes.string, // 菜单Id |
| | | SupMenuID: PropTypes.string, // 上级菜单Id |
| | | ContainerId: PropTypes.any, // 三级菜单Container(html) ID |
| | | handleTableId: PropTypes.func, // 控制表格数据切换时,更新在主表中的id |
| | | handleMainTable: PropTypes.func // 控制表格数据切换时,更新在主表中的id |
| | | } |
| | |
| | | searchlist: null, // 搜索条件 |
| | | actions: null, // 按钮集 |
| | | columns: null, // 显示列 |
| | | logcolumns: null, // 日志中显示的列信息 |
| | | logcolumns: null, // 日志中显示的列信息 (增加至全部列,除去合并列) |
| | | arr_field: '', // 使用 sPC_Get_TableData 时的查询字段集 |
| | | setting: null, // 页面全局设置:数据源、按钮及显示列固定、主键等 |
| | | data: null, // 列表数据集 |
| | |
| | | if (col.field) { |
| | | _arrField.push(col.field) |
| | | |
| | | // 筛选出日志中的显示列,取前四个 |
| | | if (col.Hide !== 'true' && _logcolumns.length < 4) { |
| | | _logcolumns.push(col) |
| | | } |
| | | _logcolumns.push(col) |
| | | } |
| | | if (col.type === 'colspan' && col.sublist) { // 筛选隐藏列 |
| | | _hideCol = _hideCol.concat(col.sublist) |
| | |
| | | dict={this.state.dict} |
| | | MenuID={this.props.SupMenuID} |
| | | logcolumns={this.state.logcolumns} |
| | | ContainerId={this.props.ContainerId} |
| | | refreshdata={this.refreshbyaction} |
| | | triggerPopview={this.triggerPopview} |
| | | gettableselected={this.gettableselected} |
| | |
| | | ]} |
| | | destroyOnClose |
| | | > |
| | | {<SubTabTable SupMenuID={this.props.MenuID} MenuID={this.state.popAction.linkTab} BID={this.props.BID} ID={this.state.popData ? this.state.popData[setting.primaryKey] : ''} refreshSupView={this.reloadtable} />} |
| | | {<SubTabTable |
| | | BID={this.props.BID} |
| | | BData={this.props.BData} |
| | | SupMenuID={this.props.MenuID} |
| | | ContainerId={this.props.ContainerId} |
| | | MenuID={this.state.popAction.linkTab} |
| | | ID={this.state.popData ? this.state.popData[setting.primaryKey] : ''} |
| | | refreshSupView={this.reloadtable} |
| | | />} |
| | | </Modal> |
| | | {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} |
| | | </div> |
| | |
| | | static propTpyes = { |
| | | ID: PropTypes.string, // 上级数据ID |
| | | BID: PropTypes.string, // 上上级数据ID |
| | | BData: PropTypes.any, // 上上级数据 |
| | | MenuID: PropTypes.string, // 菜单Id |
| | | SupMenuID: PropTypes.string, // 上级菜单Id |
| | | ContainerId: PropTypes.any, // 三级菜单Container(html) ID |
| | | refreshSupView: PropTypes.any // 刷新上级菜单 |
| | | } |
| | | |
| | |
| | | searchlist: null, // 搜索条件 |
| | | actions: null, // 按钮集 |
| | | columns: null, // 显示列 |
| | | logcolumns: null, // 日志中显示的列信息 |
| | | logcolumns: null, // 日志中显示的列信息 (增加至全部列,除去合并列) |
| | | arr_field: '', // 使用 sPC_Get_TableData 时的查询字段集 |
| | | setting: null, // 页面全局设置:数据源、按钮及显示列固定、主键等 |
| | | data: null, // 列表数据集 |
| | |
| | | if (col.field) { |
| | | _arrField.push(col.field) |
| | | |
| | | // 筛选出日志中的显示列,取前四个 |
| | | if (col.Hide !== 'true' && _logcolumns.length < 4) { |
| | | _logcolumns.push(col) |
| | | } |
| | | _logcolumns.push(col) |
| | | } |
| | | if (col.type === 'colspan' && col.sublist) { // 筛选隐藏列 |
| | | _hideCol = _hideCol.concat(col.sublist) |
| | |
| | | setting={setting} |
| | | actions={actions} |
| | | BID={this.props.BID} |
| | | BData={this.props.BData} |
| | | dict={this.state.dict} |
| | | MenuID={this.props.SupMenuID} |
| | | ContainerId={this.props.ContainerId} |
| | | refreshdata={this.refreshbyaction} |
| | | gettableselected={this.gettableselected} |
| | | /> |
| | |
| | | logcolumns: PropTypes.array, // 日志中显示列 |
| | | dict: PropTypes.object, // 字典项 |
| | | setting: PropTypes.any, // 页面通用设置 |
| | | ContainerId: PropTypes.any, // tab页面ID,用于弹窗控制 |
| | | triggerPopview: PropTypes.func // 弹窗标签页触发 |
| | | } |
| | | |
| | |
| | | _resolve() |
| | | }) |
| | | } else if (btn.Ot === 'required' || (btn.Ot === 'requiredOnce' && btn.OpenType === 'pop')) { |
| | | let _params = data.map(cell => { |
| | | let _params = data.map((cell, index) => { |
| | | let param = { |
| | | func: 'sPC_TableData_InUpDe', |
| | | BID: this.props.BID |
| | |
| | | param.func = btn.innerFunc |
| | | |
| | | formdata.forEach(_data => { |
| | | param[_data.key] = _data.value |
| | | if (index !== 0 && _data.readin && cell.hasOwnProperty(_data.key)) { |
| | | param[_data.key] = cell[_data.key] |
| | | } else { |
| | | param[_data.key] = _data.value |
| | | } |
| | | }) |
| | | |
| | | if (setting.primaryKey) { |
| | |
| | | _params.push(param) |
| | | } else if (btn.Ot === 'required') { |
| | | // 选择多行,循环调用 |
| | | |
| | | let _formparam = {} |
| | | if (btn.OpenType === 'pop' && formdata) { // 表单 |
| | | formdata.forEach(_data => { |
| | | _formparam[_data.key] = _data.value |
| | | }) |
| | | } |
| | | |
| | | _params = data.map(cell => { |
| | | _params = data.map((cell, index) => { |
| | | let _cell = { |
| | | BID: this.props.BID, |
| | | } |
| | | |
| | | let _formparam = {} |
| | | if (btn.OpenType === 'pop' && formdata) { // 表单 |
| | | formdata.forEach(_data => { |
| | | if (index !== 0 && _data.readin && cell.hasOwnProperty(_data.key)) { |
| | | _formparam[_data.key] = cell[_data.key] |
| | | } else { |
| | | _formparam[_data.key] = _data.value |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (setting.primaryKey) { |
| | | _cell[setting.primaryKey] = cell[setting.primaryKey] |
| | | } |
| | |
| | | } |
| | | |
| | | modelconfirm = () => { |
| | | const { BData } = this.props |
| | | const { execAction, tabledata } = this.state |
| | | let _this = this |
| | | let _fields = [] |
| | |
| | | } |
| | | |
| | | let result = _fields.map(item => { |
| | | let _readin = item.readin !== 'false' |
| | | let _initval = item.initval |
| | | |
| | | if (item.type === 'linkMain' || item.type === 'funcvar') { |
| | | _readin = false |
| | | } |
| | | |
| | | if (item.type === 'linkMain' && BData && BData.hasOwnProperty(item.field)) { |
| | | _initval = BData[item.field] |
| | | } else if (_readin && tabledata[0] && tabledata[0].hasOwnProperty(item.field)) { |
| | | _initval = tabledata[0][item.field] |
| | | } |
| | | |
| | | let _fieldlen = item.fieldlength || 50 |
| | | if (item.type === 'textarea' || item.type === 'fileupload') { |
| | | _fieldlen = item.fieldlength || 512 |
| | | } else if (item.type === 'number') { |
| | | _fieldlen = (item.decimal || item.decimal === 0) ? item.decimal : 18 |
| | | } |
| | | |
| | | return { |
| | | key: item.field, |
| | | readonly: item.readonly === 'true', |
| | | readin: _readin, |
| | | fieldlen: _fieldlen, |
| | | type: item.type, |
| | | value: item.initval |
| | | value: _initval |
| | | } |
| | | }) |
| | | |
| | |
| | | title = execAction.setting.title |
| | | width = execAction.setting.width + 'vw' |
| | | |
| | | if (execAction.setting.container === 'tab') { |
| | | if (execAction.setting.container === 'tab' && this.props.ContainerId) { |
| | | width = execAction.setting.width + '%' |
| | | container = () => document.getElementById('commontable' + this.props.MenuID) |
| | | container = () => document.getElementById(this.props.ContainerId) |
| | | } |
| | | |
| | | if (execAction.setting.clickouter === 'close') { |
| | |
| | | state = { |
| | | datatype: null, |
| | | readtype: null, |
| | | formlist: [] |
| | | readin: null, |
| | | fieldlen: null, |
| | | formlist: [], |
| | | record: {} |
| | | } |
| | | |
| | | componentDidMount () { |
| | |
| | | |
| | | let datatype = {} |
| | | let readtype = {} |
| | | let readin = {} |
| | | let fieldlen = {} |
| | | let formlist = [] |
| | | if (action.groups.length > 0) { |
| | | action.groups.forEach(group => { |
| | |
| | | }) |
| | | } |
| | | |
| | | group.sublist.forEach(item => { |
| | | datatype[item.field] = item.type |
| | | readtype[item.field] = item.readonly === 'true' |
| | | formlist.push(item) |
| | | }) |
| | | formlist.push(...group.sublist) |
| | | }) |
| | | } else { |
| | | formlist = action.fields.map(item => { |
| | | datatype[item.field] = item.type |
| | | readtype[item.field] = item.readonly === 'true' |
| | | |
| | | return item |
| | | }) |
| | | formlist = action.fields |
| | | } |
| | | |
| | | let _inputfields = formlist.filter(item => item.type === 'text' || item.type === 'number') // 用于过滤下拉菜单关联表单 |
| | | |
| | | formlist = formlist.map(item => { |
| | | let _readin = item.readin !== 'false' |
| | | if (item.type === 'linkMain' || item.type === 'funcvar') { |
| | | _readin = false |
| | | } |
| | | |
| | | let _fieldlen = item.fieldlength || 50 |
| | | if (item.type === 'textarea' || item.type === 'fileupload') { |
| | | _fieldlen = item.fieldlength || 512 |
| | | } else if (item.type === 'number') { |
| | | _fieldlen = (item.decimal || item.decimal === 0) ? item.decimal : 18 |
| | | } |
| | | |
| | | datatype[item.field] = item.type |
| | | readtype[item.field] = item.readonly === 'true' |
| | | readin[item.field] = _readin |
| | | fieldlen[item.field] = _fieldlen |
| | | |
| | | if (item.type === 'select' || item.type === 'link' || item.type === 'multiselect') { |
| | | if (item.setAll === 'true') { |
| | | item.options.unshift({ |
| | |
| | | item.linkSubField = item.linkSubField.filter(_item => _fields.includes(_item)) |
| | | } |
| | | } |
| | | |
| | | |
| | | if (item.type === 'linkMain' && BData && BData.hasOwnProperty(item.field)) { |
| | | item.initval = BData[item.field] |
| | | } else if (!/^date/.test(item.type) && this.props.data && this.props.data.hasOwnProperty(item.field)) { |
| | | } else if (_readin && !/^date/.test(item.type) && this.props.data && this.props.data.hasOwnProperty(item.field)) { |
| | | item.initval = this.props.data[item.field] |
| | | } |
| | | |
| | |
| | | }) |
| | | |
| | | let error = false |
| | | |
| | | |
| | | formlist = formlist.map(item => { |
| | | if (item.type === 'link') { |
| | | let supItem = formlist.filter(form => form.field === item.linkField)[0] |
| | |
| | | duration: 10 |
| | | }) |
| | | } |
| | | |
| | | |
| | | this.setState({ |
| | | readtype: readtype, |
| | | datatype: datatype, |
| | | readin: readin, |
| | | fieldlen: fieldlen, |
| | | formlist: formlist |
| | | }, () => { |
| | | if (action.setting && action.setting.focus) { |
| | |
| | | }) |
| | | |
| | | if (subfields.length === 0 || index > 6) { |
| | | this.props.form.setFieldsValue(fieldsvalue) |
| | | return formlist |
| | | return {formlist: formlist, fieldsvalue: fieldsvalue} |
| | | } else { |
| | | return this.resetform(formlist, subfields, index, fieldsvalue) |
| | | } |
| | | } |
| | | |
| | | selectChange = (_field, value, option) => { |
| | | const { record } = this.state |
| | | let formlist = JSON.parse(JSON.stringify(this.state.formlist)) |
| | | |
| | | let subfields = [] |
| | | let fieldsvalue = {} |
| | | let _record = {} |
| | | formlist = formlist.map(item => { |
| | | if (item.type === 'link' && item.linkField === _field.field) { |
| | | item.options = item.oriOptions.filter(option => option.parentId === value) |
| | |
| | | // 表单切换时,更新关联字段 |
| | | if (_field.type === 'select' && _field.linkSubField && _field.linkSubField.length > 0 && option.props.data) { |
| | | let _data = option.props.data |
| | | let fieldVal = {} |
| | | _field.linkSubField.forEach(subfield => { |
| | | fieldVal[subfield] = _data[subfield] |
| | | if (this.props.form.getFieldValue(subfield) !== undefined) { |
| | | fieldsvalue[subfield] = _data[subfield] |
| | | } else { |
| | | _record[subfield] = _data[subfield] |
| | | } |
| | | }) |
| | | this.props.form.setFieldsValue(fieldVal) |
| | | } |
| | | |
| | | if (subfields.length === 0) return |
| | | if (subfields.length === 0) { |
| | | if (Object.keys(fieldsvalue).length > 0) { |
| | | this.props.form.setFieldsValue(fieldsvalue) |
| | | } |
| | | if (Object.keys(_record).length > 0) { |
| | | this.setState({ |
| | | record: {...record, ..._record} |
| | | }) |
| | | } |
| | | } else { |
| | | let result = this.resetform(formlist, subfields, 0, fieldsvalue) |
| | | |
| | | formlist = this.resetform(formlist, subfields, 0, fieldsvalue) |
| | | if (Object.keys(result.fieldsvalue).length > 0) { |
| | | this.props.form.setFieldsValue(fieldsvalue) |
| | | } |
| | | |
| | | this.setState({ |
| | | formlist: formlist |
| | | }) |
| | | let _param = { |
| | | formlist: result.formlist |
| | | } |
| | | |
| | | if (Object.keys(_record).length > 0) { |
| | | _param.record = {...record, ..._record} |
| | | } |
| | | |
| | | this.setState(_param) |
| | | } |
| | | } |
| | | |
| | | getFields() { |
| | |
| | | ) |
| | | } else if (item.type === 'date') { // 时间搜索 |
| | | let _initval = this.props.data ? this.props.data[item.field] : '' |
| | | if (_initval) { |
| | | if (_initval && this.state.readin[item.field]) { |
| | | _initval = moment(_initval, 'YYYY-MM-DD') |
| | | } else { |
| | | _initval = item.initval ? moment().subtract(item.initval, 'days') : null |
| | |
| | | ) |
| | | } else if (item.type === 'datemonth') { |
| | | let _initval = this.props.data ? this.props.data[item.field] : '' |
| | | if (_initval) { |
| | | if (_initval && this.state.readin[item.field]) { |
| | | _initval = moment(_initval, 'YYYY-MM') |
| | | } else { |
| | | _initval = item.initval ? moment().subtract(item.initval, 'month') : null |
| | |
| | | ) |
| | | } else if (item.type === 'datetime') { |
| | | let _initval = this.props.data ? this.props.data[item.field] : '' |
| | | if (_initval) { |
| | | if (_initval && this.state.readin[item.field]) { |
| | | _initval = moment(_initval, 'YYYY-MM-DD HH:mm:ss') |
| | | } else { |
| | | _initval = item.initval ? moment().subtract(item.initval, 'days') : null |
| | |
| | | ) |
| | | } else if (item.type === 'fileupload') { |
| | | let filelist = this.props.data ? this.props.data[item.field] : item.initval |
| | | if (filelist) { |
| | | if (filelist && this.state.readin[item.field]) { |
| | | try { |
| | | filelist = filelist.split(',').map((url, index) => { |
| | | return { |
| | |
| | | } catch { |
| | | filelist = [] |
| | | } |
| | | } else { |
| | | filelist = [] |
| | | } |
| | | |
| | | fields.push( |
| | |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | | const { record } = this.state |
| | | // 表单提交时检查输入值是否正确 |
| | | return new Promise((resolve, reject) => { |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | |
| | | search.push({ |
| | | type: 'funcvar', |
| | | readonly: 'true', |
| | | readin: false, |
| | | fieldlen: this.state.fieldlen[item.field], |
| | | key: item.field, |
| | | value: '' |
| | | }) |
| | | } else if (item.hidden === 'true') { |
| | | let _val = item.initval |
| | | if (record.hasOwnProperty(item.field)) { |
| | | _val = record[item.field] |
| | | } |
| | | search.push({ |
| | | type: this.state.datatype[item.field], |
| | | readonly: this.state.readtype[item.field], |
| | | readin: this.state.readin[item.field], |
| | | fieldlen: this.state.fieldlen[item.field], |
| | | key: item.field, |
| | | value: item.initval |
| | | value: _val |
| | | }) |
| | | } |
| | | }) |
| | |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | readin: this.state.readin[key], |
| | | fieldlen: this.state.fieldlen[key], |
| | | key: key, |
| | | value: _value |
| | | }) |
| | |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | readin: this.state.readin[key], |
| | | fieldlen: this.state.fieldlen[key], |
| | | key: key, |
| | | value: _value |
| | | }) |
| | |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | readin: this.state.readin[key], |
| | | fieldlen: this.state.fieldlen[key], |
| | | key: key, |
| | | value: _value |
| | | }) |
| | |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | readin: this.state.readin[key], |
| | | fieldlen: this.state.fieldlen[key], |
| | | key: key, |
| | | value: values[key] |
| | | }) |
| | |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | readin: this.state.readin[key], |
| | | fieldlen: this.state.fieldlen[key], |
| | | key: key, |
| | | value: values[key] ? values[key].join(',') : '' |
| | | }) |
| | |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | readin: this.state.readin[key], |
| | | fieldlen: this.state.fieldlen[key], |
| | | key: key, |
| | | value: vals.join(',') |
| | | }) |
| | |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | readin: this.state.readin[key], |
| | | fieldlen: this.state.fieldlen[key], |
| | | key: key, |
| | | value: values[key].replace(/(^\s*|\s*$) | \t* | \v*/ig, '') |
| | | }) |
| | |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | readin: this.state.readin[key], |
| | | fieldlen: this.state.fieldlen[key], |
| | | key: key, |
| | | value: values[key] |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | resolve(search) |
| | | } else { |
| | | reject(err) |
| | |
| | | const { MonthPicker } = DatePicker |
| | | const { TextArea } = Input |
| | | |
| | | const Card = ({ id, type, cols, card, moveCard, findCard, editCard, delCard, copyCard, profileCard, hasDrop }) => { |
| | | const Card = ({ id, type, cols, card, moveCard, findCard, editCard, delCard, profileCard, hasDrop }) => { |
| | | const originalIndex = findCard(id).index |
| | | const [{ isDragging }, drag] = useDrag({ |
| | | item: { type: ItemTypes[type], id, originalIndex }, |
| | |
| | | |
| | | const del = () => { |
| | | delCard(id) |
| | | } |
| | | |
| | | const copy = () => { |
| | | copyCard(id) |
| | | } |
| | | |
| | | const profile = () => { |
| | |
| | | </div> |
| | | <Icon className="edit" title="编辑" type="edit" onClick={edit} /> |
| | | <Icon className="edit close" title="删除" type="close" onClick={del} /> |
| | | {type === 'action' ? <Icon className="edit copy" title="复制" type="copy" onClick={copy} /> : null} |
| | | {type === 'action' && ['pop', 'prompt', 'exec'].includes(card.OpenType) && card.intertype === 'inner' && !card.innerFunc ? |
| | | <Icon className="edit profile" title="校验规则" type="profile" onClick={profile} /> : null |
| | | } |
| | |
| | | import ItemTypes from './itemtypes' |
| | | import './index.scss' |
| | | |
| | | const Container = ({list, type, groupId, setting, placeholder, handleList, handleMenu, deleteMenu, copyElement, profileMenu }) => { |
| | | const Container = ({list, type, groupId, setting, placeholder, handleList, handleMenu, deleteMenu, profileMenu }) => { |
| | | let target = null |
| | | const [cards, setCards] = useState(list) |
| | | const moveCard = (id, atIndex) => { |
| | |
| | | const delCard = id => { |
| | | const { card } = findCard(id) |
| | | deleteMenu({card: card, type: type}) |
| | | } |
| | | |
| | | const copyCard = id => { |
| | | const { card } = findCard(id) |
| | | let copycard = JSON.parse(JSON.stringify(card)) |
| | | copycard.uuid = Utils.getuuid() |
| | | copycard.origin = false |
| | | copycard.label = copycard.label + '(copy)' |
| | | copycard.focus = true |
| | | |
| | | copyElement(copycard) |
| | | } |
| | | |
| | | const hasDrop = (item) => { |
| | |
| | | moveCard={moveCard} |
| | | editCard={editCard} |
| | | delCard={delCard} |
| | | copyCard={copyCard} |
| | | profileCard={profileCard} |
| | | findCard={findCard} |
| | | hasDrop={hasDrop} |
| | |
| | | _config.isAdd = true |
| | | } else { |
| | | _config = config |
| | | _config.action = Source.baseConfig.action |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | this.setState({config: {...config, [card.groupId]: list}}) |
| | | } else if (type === 'action') { |
| | | if (list.length > config.action.length) { |
| | | list = list.filter(item => !item.origin) |
| | | |
| | | this.handleAction(card) |
| | | } |
| | |
| | | }) |
| | | } |
| | | |
| | | handleAction = (card, type) => { |
| | | handleAction = (card) => { |
| | | let ableField = this.props.permFuncField.join(', ') |
| | | let functip = <div> |
| | | <p style={{marginBottom: '5px'}}>{this.state.dict['header.modal.func.innerface'].replace('@ableField', ableField)}</p> |
| | |
| | | </div> |
| | | |
| | | this.setState({ |
| | | modaltype: type === 'copy' ? 'actionCopy' : 'actionEdit', |
| | | modaltype: 'actionEdit', |
| | | card: card, |
| | | formlist: getActionForm(card, functip, this.state.config, this.props.permFuncField) |
| | | }) |
| | |
| | | modaltype: '' |
| | | }) |
| | | }) |
| | | } else if (modaltype === 'actionEdit' || modaltype === 'actionCopy') { |
| | | } else if (modaltype === 'actionEdit') { |
| | | this.actionFormRef.handleConfirm().then(res => { |
| | | let _action = config.action.map(item => { |
| | | if (item.uuid === res.uuid) { |
| | |
| | | return item |
| | | } |
| | | }) |
| | | _action = _action.filter(item => !item.origin) |
| | | |
| | | if (modaltype === 'actionCopy') { |
| | | _action.push(res) |
| | | } |
| | | |
| | | this.setState({ |
| | | config: {...config, action: _action}, |
| | |
| | | return item |
| | | } |
| | | }) |
| | | _config.action = _config.action.filter(item => !item.origin) |
| | | |
| | | |
| | | if (!isupdate) { // 操作不是修改,添加元素至列表 |
| | | _config.action.push(btn) |
| | |
| | | if (config.groups[0] && config.groups[0].sublist[0] && config.groups[0].sublist[0].origin) { |
| | | config.groups[0].sublist = config.groups[0].sublist.filter(item => !item.origin) |
| | | } |
| | | if (config.action[0] && config.action[0].origin) { |
| | | config.action = config.action.filter(item => !item.origin) |
| | | } |
| | | if (config.tabs[0] && config.tabs[0].origin) { |
| | | config.tabs = config.tabs.filter(item => !item.origin) |
| | | } |
| | |
| | | if (_config.tabgroups.length > 1) { |
| | | _config.tabgroups.forEach(group => { |
| | | if (_config[group].length === 0) { |
| | | _config.enabled = false |
| | | } |
| | | }) |
| | | } |
| | | |
| | | // 存在多余的空表单组 |
| | | if (_config.groups.length > 1) { |
| | | _config.groups.forEach(group => { |
| | | if (group.sublist.length === 0) { |
| | | _config.enabled = false |
| | | } |
| | | }) |
| | |
| | | /** |
| | | * @description 设置可配置标签 |
| | | */ |
| | | setSubConfig = (btn, type) => { |
| | | setSubConfig = (btn) => { |
| | | const {menu, btnTab} = this.props |
| | | const { config, originMenu } = this.state |
| | | |
| | |
| | | list={this.state.config.action} |
| | | handleList={this.handleList} |
| | | handleMenu={this.handleAction} |
| | | copyElement={(val) => this.handleAction(val, 'copy')} |
| | | deleteMenu={this.deleteElement} |
| | | profileMenu={this.profileAction} |
| | | placeholder={this.state.dict['header.form.action.placeholder']} |
| | |
| | | </Modal> |
| | | {/* 编辑按钮:复制、编辑 */} |
| | | <Modal |
| | | title={modaltype === 'actionEdit' ? this.state.dict['header.modal.action.edit'] : this.state.dict['header.modal.action.copy']} |
| | | visible={modaltype === 'actionEdit' || modaltype === 'actionCopy'} |
| | | title={this.state.dict['header.modal.action.edit']} |
| | | visible={modaltype === 'actionEdit'} |
| | | width={700} |
| | | onCancel={this.editModalCancel} |
| | | footer={[ |
| | | modaltype === 'actionEdit' ? <Button key="delete" className="mk-btn mk-purple" onClick={this.creatFunc} loading={this.state.funcLoading}>{this.state.dict['header.menu.func.create']}</Button> : null, |
| | | <Button key="delete" className="mk-btn mk-purple" onClick={this.creatFunc} loading={this.state.funcLoading}>{this.state.dict['header.menu.func.create']}</Button>, |
| | | <Button key="cancel" onClick={this.editModalCancel}>{this.state.dict['header.cancel']}</Button>, |
| | | <Button key="confirm" type="primary" onClick={this.handleSubmit}>{this.state.dict['header.confirm']}</Button> |
| | | ]} |
| | |
| | | display: none; |
| | | } |
| | | .edit.close { |
| | | left: 40px; |
| | | left: 20px; |
| | | color: #ff4d4f; |
| | | } |
| | | .edit.copy { |
| | | left: 20px; |
| | | color: #26C281; |
| | | } |
| | | .edit.profile { |
| | | left: 60px; |
| | | left: 40px; |
| | | color: purple; |
| | | } |
| | | button { |
| | |
| | | import { formRule } from '@/utils/option.js' |
| | | import './index.scss' |
| | | |
| | | const { TextArea } = Input |
| | | // const { TextArea } = Input |
| | | |
| | | class SettingForm extends Component { |
| | | static propTpyes = { |
| | |
| | | } |
| | | |
| | | state = { |
| | | interType: null, |
| | | interType: (this.props.config.setting && this.props.config.setting.interType) || 'inner', |
| | | columns: null, |
| | | currentTabs: null, |
| | | selectTabs: [] |
| | | selectTabs: [], |
| | | interReadonly: false |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | |
| | | let _select = [] |
| | | let _tabMap = new Map() |
| | | let _columns = [] |
| | | let _interType = 'inner' |
| | | let _setting = config.setting |
| | | |
| | | |
| | | try { |
| | | _columns = menu.LongParam.columns.filter(item => item.field && item.type !== 'colspan') |
| | | if (menu && menu.LongParam) { |
| | | _columns = menu.LongParam.columns.filter(item => item.field && item.type !== 'colspan') |
| | | } |
| | | config.groups.forEach(group => { |
| | | if (group.isDefault) { |
| | | let list = group.sublist.filter(item => !item.origin) |
| | | _columns = [..._columns, ...list] |
| | | } else { |
| | | _columns = [..._columns, ...group.sublist] |
| | | } |
| | | let list = group.sublist.filter(item => item.field) |
| | | _columns = [..._columns, ...list] |
| | | }) |
| | | |
| | | let _colMap = new Map() |
| | |
| | | return true |
| | | } |
| | | }) |
| | | _interType = menu.LongParam.setting.interType |
| | | } catch { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | currentTabs: _tabs, |
| | | selectTabs: _select, |
| | | columns: _columns, |
| | | interType: _interType, |
| | | setting: _setting |
| | | setting: _setting, |
| | | interReadonly: _setting.sysInterface === 'true' |
| | | }) |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | onSysChange = (e) => { |
| | | if (e.target.value === 'true') { |
| | | this.props.form.setFieldsValue({ |
| | | interface: window.GLOB.mainSystemApi || window.GLOB.subSystemApi |
| | | }) |
| | | this.setState({ |
| | | interReadonly: true |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | interReadonly: false |
| | | }) |
| | | } |
| | | } |
| | | |
| | | onChange = (e) => { |
| | | this.setState({ |
| | | interType: e.target.value |
| | | }, () => { |
| | | if (e.target.value === 'inner') return |
| | | |
| | | let _type = this.props.form.getFieldValue('sysInterface') |
| | | if (_type === 'true') { |
| | | this.props.form.setFieldsValue({ |
| | | interface: window.GLOB.mainSystemApi || window.GLOB.subSystemApi |
| | | }) |
| | | this.setState({ |
| | | interReadonly: true |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | interReadonly: false |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { dict, menu, usefulFields } = this.props |
| | | const { dict, usefulFields } = this.props |
| | | const { getFieldDecorator } = this.props.form |
| | | const { interType, columns, selectTabs, setting } = this.state |
| | | |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | {interType === 'outer' ? <Col span={12}> |
| | | <Form.Item label={dict['header.form.sysInterface']}> |
| | | {getFieldDecorator('sysInterface', { |
| | | initialValue: setting.sysInterface || 'false' |
| | | })( |
| | | <Radio.Group onChange={this.onSysChange}> |
| | | <Radio value="true">{dict['header.form.true']}</Radio> |
| | | <Radio value="false">{dict['header.form.false']}</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType === 'outer' ? <Col span={12}> |
| | | <Form.Item label={dict['header.form.interface']}> |
| | | {getFieldDecorator('interface', { |
| | | initialValue: setting.interface || '', |
| | | initialValue: setting.sysInterface === 'true' ? (window.GLOB.mainSystemApi || window.GLOB.subSystemApi) : (setting.interface || ''), |
| | | rules: [ |
| | | { |
| | | required: true, |
| | |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | | })(<Input placeholder="" autoComplete="off" disabled={this.state.interReadonly} />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType !== 'outer' ? <Col span={12}> |
| | |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType !== 'outer' ? <Col span={24}> |
| | | {/* {interType !== 'outer' ? <Col span={24}> |
| | | <Form.Item help={'数据ID:' + menu.MenuID} label={ |
| | | <Tooltip placement="topLeft" title="使用系统函数时,需填写数据源,自定义函数时,可忽略。"> |
| | | <Icon type="question-circle" /> |
| | |
| | | initialValue: setting.dataresource |
| | | })(<TextArea rows={4} />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | </Col> : null} */} |
| | | {interType === 'outer' ? <Col span={12}> |
| | | <Form.Item label={dict['header.form.outerFunc']}> |
| | | {getFieldDecorator('outerFunc', { |
| | |
| | | primaryKey: '', |
| | | dataresource: '', |
| | | interType: 'inner', |
| | | sysInterface: 'false', |
| | | innerFunc: '', |
| | | interface: '', |
| | | outerFunc: '', |
| | |
| | | ], |
| | | action: [ |
| | | { |
| | | origin: true, |
| | | btnType: 'confirm', |
| | | uuid: Utils.getuuid(), |
| | | label: 'add', |
| | | label: '确定', |
| | | intertype: 'inner', |
| | | innerFunc: '', |
| | | interface: '', |
| | |
| | | sqlType: '', |
| | | callbackFunc: '', |
| | | Ot: 'notRequired', |
| | | position: 'toolbar', |
| | | execSuccess: 'grid', |
| | | execError: 'never', |
| | | errorTime: 15, |
| | | OpenType: 'pop', |
| | | pageTemplate: '', |
| | | url: '', |
| | | icon: 'plus', |
| | | class: 'green', |
| | | verify: null |
| | | }, { |
| | | origin: true, |
| | | btnType: 'cancel', |
| | | uuid: Utils.getuuid(), |
| | | label: 'update', |
| | | intertype: 'inner', |
| | | innerFunc: '', |
| | | interface: '', |
| | | method: 'POST', |
| | | outerFunc: '', |
| | | sql: '', |
| | | sqlType: '', |
| | | callbackFunc: '', |
| | | Ot: 'requiredSgl', |
| | | position: 'grid', |
| | | label: '返回', |
| | | execSuccess: 'grid', |
| | | execError: 'never', |
| | | errorTime: 15, |
| | | OpenType: 'pop', |
| | | pageTemplate: '', |
| | | url: '', |
| | | icon: 'form', |
| | | class: 'purple', |
| | | verify: null |
| | | icon: 'rollback', |
| | | class: 'purple' |
| | | } |
| | | ], |
| | | tabs: [ |
| | |
| | | {card.type === 'funcvar' && |
| | | <Input style={{marginTop: '4px'}} defaultValue={card.linkfield} /> |
| | | } |
| | | {card.type === 'linkMain' && |
| | | <Input style={{marginTop: '4px'}} /> |
| | | } |
| | | <div className="input-mask"></div> |
| | | </div> |
| | | </div>} |
| | |
| | | </div> |
| | | <Select |
| | | showSearch |
| | | showArrow={false} |
| | | className="tables" |
| | | style={{ width: '100%' }} |
| | | optionFilterProp="children" |
| | | value={this.state.dict['header.menu.table.placeholder']} |
| | | onChange={this.onTableChange} |
| | | showArrow={false} |
| | | getPopupContainer={() => document.getElementById('modal-basedata')} |
| | | filterOption={(input, option) => { |
| | | return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 |
| | |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | let _type = this.props.formlist.filter(form => form.key === 'type')[0].initVal |
| | | let _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width'] |
| | | let _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'fieldlength'] |
| | | |
| | | if (_type === 'text') { |
| | | _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color'] |
| | | _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color', 'fieldlength'] |
| | | } else if (_type === 'number') { |
| | | _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'match', 'matchVal', 'color'] |
| | | } else if (_type === 'textarea') { |
| | | _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color'] |
| | | _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color', 'fieldlength'] |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | |
| | | typeChange = (key, value) => { |
| | | if (key === 'type') { |
| | | let _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width'] |
| | | let _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'fieldlength'] |
| | | |
| | | if (value === 'text') { |
| | | _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color'] |
| | | _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color', 'fieldlength'] |
| | | } else if (value === 'number') { |
| | | _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'match', 'matchVal', 'color'] |
| | | } else if (value === 'textarea') { |
| | | _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color'] |
| | | _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color', 'fieldlength'] |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | item.type = 'number' |
| | | item.initVal = '' |
| | | item.hidden = true |
| | | } else if (item.key === 'fieldlength') { |
| | | if (value === 'text') { |
| | | item.initVal = 50 |
| | | } else { |
| | | item.initVal = 512 |
| | | } |
| | | item.hidden = true |
| | | } |
| | | return item |
| | | }) |
| | |
| | | formlist: this.props.formlist.map(item => { |
| | | if (item.key === 'matchVal' && value === 'number') { |
| | | item.hidden = false |
| | | } else if (item.key === 'fieldlength' && value !== 'number') { |
| | | item.hidden = false |
| | | } |
| | | return item |
| | | }) |
| | |
| | | import React from 'react' |
| | | import { useDrag, useDrop } from 'react-dnd' |
| | | import { Icon, Button, Select, DatePicker, Input } from 'antd' |
| | | import { Icon, Button, Select, DatePicker, Input, Typography } from 'antd' |
| | | import moment from 'moment' |
| | | import ItemTypes from './itemtypes' |
| | | import './index.scss' |
| | | |
| | | const { MonthPicker, WeekPicker, RangePicker } = DatePicker |
| | | const { Paragraph } = Typography |
| | | |
| | | const Card = ({ id, type, card, moveCard, findCard, editCard, delCard, copyCard, profileCard, hasDrop, showfield }) => { |
| | | const originalIndex = findCard(id).index |
| | |
| | | </div> |
| | | {showfield ? |
| | | <div className="ant-table-column-fields"> |
| | | <span className="ant-table-column-title">{card.type === 'colspan' ? card.subfield : card.field}</span> |
| | | {/* <span className="ant-table-column-title">{card.type === 'colspan' ? card.subfield : card.field}</span> */} |
| | | <span className="ant-table-column-title"> |
| | | {card.type === 'colspan' ? |
| | | <Paragraph copyable>{card.subfield}</Paragraph> : |
| | | <Paragraph copyable>{card.field}</Paragraph> |
| | | } |
| | | </span> |
| | | </div> : null |
| | | } |
| | | </span> : null |
| | |
| | | text: '绿色(背景)' |
| | | }], |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'fieldlength', |
| | | label: Formdict['header.form.field.length'], |
| | | initVal: card.fieldlength || (card.type === 'text' ? 50 : 512), |
| | | required: false |
| | | } |
| | | ] |
| | | } |
| | |
| | | */ |
| | | export function getModalForm (card, inputfields, subtable = false) { |
| | | let _openType = [] |
| | | let _fieldlength = 50 |
| | | |
| | | if (subtable) { |
| | | _openType.push({ |
| | | value: 'linkMain', |
| | | text: Formdict['header.form.linkMain'] |
| | | }) |
| | | } |
| | | |
| | | if (card.type === 'textarea' || card.type === 'fileupload') { |
| | | _fieldlength = 512 |
| | | } |
| | | |
| | | return [ |
| | |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'fieldlength', |
| | | label: Formdict['header.form.field.length'], |
| | | initVal: card.fieldlength || _fieldlength, |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'readin', |
| | | label: Formdict['header.form.readin'], |
| | | tooltip: Formdict['header.form.readin.tooltip'], |
| | | initVal: card.readin || 'true', |
| | | options: [{ |
| | | value: 'true', |
| | | text: Formdict['header.form.true'] |
| | | }, { |
| | | value: 'false', |
| | | text: Formdict['header.form.false'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | | key: 'linkSubField', |
| | | label: Formdict['header.form.linkForm'], |
| | |
| | | render: (text, record) => |
| | | (<div> |
| | | <span className="operation-btn" title={this.props.dict['header.edit']} onClick={() => this.handleEdit(record, 'unique')} style={{color: '#1890ff'}}><Icon type="edit" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'unique', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'unique', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'unique')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> |
| | | <Popconfirm |
| | | title={this.props.dict['header.form.query.delete']} |
| | | okText={this.props.dict['header.confirm']} |
| | |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | | </Popconfirm> |
| | | <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'unique', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'unique', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'unique')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> |
| | | </div>) |
| | | } |
| | | ], |
| | |
| | | render: (text, record) => |
| | | (<div> |
| | | <span className="operation-btn" title={this.props.dict['header.edit']} onClick={() => this.handleEdit(record, 'contrast')} style={{color: '#1890ff'}}><Icon type="edit" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'contrast', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'contrast', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'contrast')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> |
| | | <Popconfirm |
| | | title={this.props.dict['header.form.query.delete']} |
| | | okText={this.props.dict['header.confirm']} |
| | |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | | </Popconfirm> |
| | | <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'contrast', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'contrast', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'contrast')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> |
| | | </div>) |
| | | } |
| | | ], |
| | |
| | | render: (text, record) => |
| | | (<div> |
| | | <span className="operation-btn" title={this.props.dict['header.edit']} onClick={() => this.handleEdit(record, 'customverify')} style={{color: '#1890ff'}}><Icon type="edit" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'customverify', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'customverify', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'customverify')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> |
| | | <Popconfirm |
| | | title={this.props.dict['header.form.query.delete']} |
| | | okText={this.props.dict['header.confirm']} |
| | |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | | </Popconfirm> |
| | | <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'customverify', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'customverify', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'customverify')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> |
| | | </div>) |
| | | } |
| | | ], |
| | |
| | | render: (text, record) => |
| | | (<div> |
| | | <span className="operation-btn" title={this.props.dict['header.edit']} onClick={() => this.handleEdit(record, 'scripts')} style={{color: '#1890ff'}}><Icon type="edit" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'scripts', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'scripts', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'scripts')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> |
| | | <Popconfirm |
| | | title={this.props.dict['header.form.query.delete']} |
| | | okText={this.props.dict['header.confirm']} |
| | |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | | </Popconfirm> |
| | | <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'scripts', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'scripts', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'scripts')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> |
| | | </div>) |
| | | } |
| | | ], |
| | |
| | | render: (text, record) => |
| | | (<div> |
| | | <span className="operation-btn" title={this.props.dict['header.edit']} onClick={() => this.handleEdit(record, 'ordercode')} style={{color: '#1890ff'}}><Icon type="edit" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'ordercode', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'ordercode', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'ordercode')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> |
| | | <Popconfirm |
| | | title={this.props.dict['header.form.query.delete']} |
| | | okText={this.props.dict['header.confirm']} |
| | |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | | </Popconfirm> |
| | | <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'ordercode', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'ordercode', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'ordercode')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> |
| | | </div>) |
| | | } |
| | | ] |
| | |
| | | _fields = _LongParam.fields |
| | | } |
| | | |
| | | let _usefulfields = [] |
| | | let _usefulfields = ['BID', 'ID', 'LoginUID', 'SessionUid', 'UserID', 'Appkey'] |
| | | _fields.forEach(_f => { |
| | | if (_f.field) { |
| | | _usefulfields.push(_f.field) |
| | | } |
| | | }) |
| | | |
| | | if (columns && columns.length > 0) { |
| | | if (columns && columns.length > 0 && this.props.card.Ot !== 'notRequired') { |
| | | columns.forEach(_f => { |
| | | if (_f.field) { |
| | | _usefulfields.push(_f.field) |
| | |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | } else { |
| | | let _usefulfields = ['BID', 'ID', 'LoginUID', 'SessionUid', 'UserID', 'Appkey'] |
| | | |
| | | if (columns && columns.length > 0 && this.props.card.Ot !== 'notRequired') { |
| | | columns.forEach(_f => { |
| | | if (_f.field) { |
| | | _usefulfields.push(_f.field) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | _usefulfields = Array.from(new Set(_usefulfields)) |
| | | _usefulfields = _usefulfields.join(', ') |
| | | |
| | | |
| | | this.setState({ |
| | | usefulfields: _usefulfields |
| | | }) |
| | | } |
| | | } |
| | |
| | | } else if (type === 'contrast') { |
| | | this.contrastForm.edit(record) |
| | | } |
| | | |
| | | let node = document.getElementById('verify-card-box-tab').parentNode |
| | | |
| | | if (node && node.scrollTop) { |
| | | node.scrollTop = 0 |
| | | } |
| | | } |
| | | |
| | | handleStatus = (record, type) => { |
| | |
| | | } |
| | | |
| | | return ( |
| | | <Tabs defaultActiveKey="1" className="verify-card-box" onChange={this.tabchange}> |
| | | <TabPane tab="基础验证" key="1"> |
| | | <Form {...formItemLayout}> |
| | | <Row gutter={24}> |
| | | <Col span={12}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="bottomLeft" title={'默认sql执行顺序为自定义脚本之前'}> |
| | | <Icon type="question-circle" style={{color: '#c49f47', marginRight: '5px'}} /> |
| | | 默认sql |
| | | </Tooltip> |
| | | }> |
| | | <Radio.Group value={verify.default} onChange={(e) => {this.onOptionChange(e, 'default')}}> |
| | | <Radio value="true">执行</Radio> |
| | | <Radio value="false">不执行</Radio> |
| | | </Radio.Group> |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={12}> |
| | | <Form.Item label={'账期验证'}> |
| | | <Radio.Group value={verify.accountdate} onChange={(e) => {this.onOptionChange(e, 'accountdate')}}> |
| | | <Radio value="true">开启</Radio> |
| | | <Radio value="false">不开启</Radio> |
| | | </Radio.Group> |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={12}> |
| | | <Form.Item label={'失效验证'}> |
| | | <Radio.Group value={verify.invalid} onChange={(e) => {this.onOptionChange(e, 'invalid')}}> |
| | | <Radio value="true">开启</Radio> |
| | | <Radio value="false">不开启</Radio> |
| | | </Radio.Group> |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | </Form> |
| | | </TabPane> |
| | | <TabPane tab="比较验证" key="2x"> |
| | | <ContrastForm |
| | | dict={this.props.dict} |
| | | contrastChange={this.contrastChange} |
| | | wrappedComponentRef={(inst) => this.contrastForm = inst} |
| | | /> |
| | | <Table |
| | | bordered |
| | | rowKey="uuid" |
| | | className="custom-table" |
| | | dataSource={verify.contrasts} |
| | | columns={contrastColumns} |
| | | pagination={false} |
| | | /> |
| | | </TabPane> |
| | | <TabPane tab="唯一性验证" key="2"> |
| | | <UniqueForm |
| | | fields={fields} |
| | | dict={this.props.dict} |
| | | uniqueChange={this.uniqueChange} |
| | | wrappedComponentRef={(inst) => this.uniqueForm = inst} |
| | | /> |
| | | <Table |
| | | bordered |
| | | rowKey="uuid" |
| | | className="custom-table" |
| | | dataSource={verify.uniques} |
| | | columns={uniqueColumns} |
| | | pagination={false} |
| | | /> |
| | | </TabPane> |
| | | <TabPane tab="自定义验证" key="3"> |
| | | <CustomForm |
| | | dict={this.props.dict} |
| | | usefulfields={this.state.usefulfields} |
| | | customChange={this.customChange} |
| | | wrappedComponentRef={(inst) => this.customForm = inst} |
| | | /> |
| | | <Table |
| | | bordered |
| | | rowKey="uuid" |
| | | className="custom-table" |
| | | dataSource={verify.customverifys} |
| | | columns={customColumns} |
| | | pagination={false} |
| | | /> |
| | | </TabPane> |
| | | <TabPane tab="单号生成" key="4"> |
| | | <BillcodeForm |
| | | floor={this.props.floor} |
| | | fields={fields} |
| | | billcodes={verify.billcodes} |
| | | columns={this.props.columns} |
| | | dict={this.props.dict} |
| | | modular={orderModular} |
| | | modularDetail={orderModularDetail} |
| | | orderChange={this.orderChange} |
| | | wrappedComponentRef={(inst) => this.orderForm = inst} |
| | | /> |
| | | <Table |
| | | bordered |
| | | rowKey="uuid" |
| | | className="custom-table" |
| | | dataSource={verify.billcodes} |
| | | columns={orderColumns} |
| | | pagination={false} |
| | | /> |
| | | </TabPane> |
| | | <TabPane tab="创建凭证" key="5"> |
| | | <VoucherForm |
| | | dict={this.props.dict} |
| | | voucher={voucher} |
| | | columns={this.props.columns} |
| | | voucherobj={verify.voucher} |
| | | voucherDetail={voucherDetail} |
| | | voucherChange={this.voucherChange} |
| | | wrappedComponentRef={(inst) => this.voucherForm = inst} |
| | | /> |
| | | </TabPane> |
| | | <TabPane tab="自定义脚本" key="6"> |
| | | <CustomScript |
| | | usefulfields={this.state.usefulfields} |
| | | dict={this.props.dict} |
| | | scriptsChange={this.scriptsChange} |
| | | wrappedComponentRef={(inst) => this.scriptsForm = inst} |
| | | /> |
| | | <Table |
| | | bordered |
| | | rowKey="uuid" |
| | | className="custom-table" |
| | | dataSource={verify.scripts} |
| | | columns={scriptsColumns} |
| | | pagination={false} |
| | | /> |
| | | </TabPane> |
| | | <TabPane tab="信息提示" key="7"> |
| | | <Form {...formItemLayout}> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <span className="errorval"> S </span> |
| | | <Button onClick={() => {this.showError('S')}} type="primary" size="small"> |
| | | 查看 |
| | | </Button> |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={'停留时间'}> |
| | | <InputNumber defaultValue={2} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'stime')}} /> |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <span className="errorval"> -1 </span> |
| | | 不提示 |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <span className="errorval"> N </span> |
| | | <Button onClick={() => {this.showError('N')}} type="primary" size="small"> |
| | | 查看 |
| | | </Button> |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={'停留时间'}> |
| | | <InputNumber defaultValue={15} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ntime')}} /> |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <span className="errorval"> F </span> |
| | | <Button onClick={() => {this.showError('F')}} type="primary" size="small"> |
| | | 查看 |
| | | </Button> |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={'停留时间'}> |
| | | <InputNumber defaultValue={15} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ftime')}} /> |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <span className="errorval"> E </span> |
| | | <Button onClick={() => {this.showError('E')}} type="primary" size="small"> |
| | | 查看 |
| | | </Button> |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <span className="errorval"> NM </span> |
| | | <Button onClick={() => {this.showError('NM')}} type="primary" size="small"> |
| | | 查看 |
| | | </Button> |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | </Form> |
| | | </TabPane> |
| | | </Tabs> |
| | | <div id="verify-card-box-tab"> |
| | | <Tabs defaultActiveKey="1" className="verify-card-box" onChange={this.tabchange}> |
| | | <TabPane tab="基础验证" key="1"> |
| | | <Form {...formItemLayout}> |
| | | <Row gutter={24}> |
| | | <Col span={12}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="bottomLeft" title={'默认sql执行顺序为自定义脚本之前'}> |
| | | <Icon type="question-circle" style={{color: '#c49f47', marginRight: '5px'}} /> |
| | | 默认sql |
| | | </Tooltip> |
| | | }> |
| | | <Radio.Group value={verify.default} onChange={(e) => {this.onOptionChange(e, 'default')}}> |
| | | <Radio value="true">执行</Radio> |
| | | <Radio value="false">不执行</Radio> |
| | | </Radio.Group> |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={12}> |
| | | <Form.Item label={'账期验证'}> |
| | | <Radio.Group value={verify.accountdate} onChange={(e) => {this.onOptionChange(e, 'accountdate')}}> |
| | | <Radio value="true">开启</Radio> |
| | | <Radio value="false">不开启</Radio> |
| | | </Radio.Group> |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={12}> |
| | | <Form.Item label={'失效验证'}> |
| | | <Radio.Group value={verify.invalid} onChange={(e) => {this.onOptionChange(e, 'invalid')}}> |
| | | <Radio value="true">开启</Radio> |
| | | <Radio value="false">不开启</Radio> |
| | | </Radio.Group> |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | </Form> |
| | | </TabPane> |
| | | <TabPane tab="比较验证" key="2x"> |
| | | <ContrastForm |
| | | dict={this.props.dict} |
| | | contrastChange={this.contrastChange} |
| | | wrappedComponentRef={(inst) => this.contrastForm = inst} |
| | | /> |
| | | <Table |
| | | bordered |
| | | rowKey="uuid" |
| | | className="custom-table" |
| | | dataSource={verify.contrasts} |
| | | columns={contrastColumns} |
| | | pagination={false} |
| | | /> |
| | | </TabPane> |
| | | <TabPane tab="唯一性验证" key="2"> |
| | | <UniqueForm |
| | | fields={fields} |
| | | dict={this.props.dict} |
| | | uniqueChange={this.uniqueChange} |
| | | wrappedComponentRef={(inst) => this.uniqueForm = inst} |
| | | /> |
| | | <Table |
| | | bordered |
| | | rowKey="uuid" |
| | | className="custom-table" |
| | | dataSource={verify.uniques} |
| | | columns={uniqueColumns} |
| | | pagination={false} |
| | | /> |
| | | </TabPane> |
| | | <TabPane tab="自定义验证" key="3"> |
| | | <CustomForm |
| | | dict={this.props.dict} |
| | | usefulfields={this.state.usefulfields} |
| | | customChange={this.customChange} |
| | | wrappedComponentRef={(inst) => this.customForm = inst} |
| | | /> |
| | | <Table |
| | | bordered |
| | | rowKey="uuid" |
| | | className="custom-table" |
| | | dataSource={verify.customverifys} |
| | | columns={customColumns} |
| | | pagination={false} |
| | | /> |
| | | </TabPane> |
| | | <TabPane tab="单号生成" key="4"> |
| | | <BillcodeForm |
| | | floor={this.props.floor} |
| | | fields={fields} |
| | | billcodes={verify.billcodes} |
| | | columns={this.props.columns} |
| | | dict={this.props.dict} |
| | | modular={orderModular} |
| | | modularDetail={orderModularDetail} |
| | | orderChange={this.orderChange} |
| | | wrappedComponentRef={(inst) => this.orderForm = inst} |
| | | /> |
| | | <Table |
| | | bordered |
| | | rowKey="uuid" |
| | | className="custom-table" |
| | | dataSource={verify.billcodes} |
| | | columns={orderColumns} |
| | | pagination={false} |
| | | /> |
| | | </TabPane> |
| | | <TabPane tab="创建凭证" key="5"> |
| | | <VoucherForm |
| | | dict={this.props.dict} |
| | | voucher={voucher} |
| | | columns={this.props.columns} |
| | | voucherobj={verify.voucher} |
| | | voucherDetail={voucherDetail} |
| | | voucherChange={this.voucherChange} |
| | | wrappedComponentRef={(inst) => this.voucherForm = inst} |
| | | /> |
| | | </TabPane> |
| | | <TabPane tab="自定义脚本" key="6"> |
| | | <CustomScript |
| | | usefulfields={this.state.usefulfields} |
| | | dict={this.props.dict} |
| | | scriptsChange={this.scriptsChange} |
| | | wrappedComponentRef={(inst) => this.scriptsForm = inst} |
| | | /> |
| | | <Table |
| | | bordered |
| | | rowKey="uuid" |
| | | className="custom-table" |
| | | dataSource={verify.scripts} |
| | | columns={scriptsColumns} |
| | | pagination={false} |
| | | /> |
| | | </TabPane> |
| | | <TabPane tab="信息提示" key="7"> |
| | | <Form {...formItemLayout}> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <span className="errorval"> S </span> |
| | | <Button onClick={() => {this.showError('S')}} type="primary" size="small"> |
| | | 查看 |
| | | </Button> |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={'停留时间'}> |
| | | <InputNumber defaultValue={2} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'stime')}} /> |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <span className="errorval"> -1 </span> |
| | | 不提示 |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <span className="errorval"> N </span> |
| | | <Button onClick={() => {this.showError('N')}} type="primary" size="small"> |
| | | 查看 |
| | | </Button> |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={'停留时间'}> |
| | | <InputNumber defaultValue={15} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ntime')}} /> |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <span className="errorval"> F </span> |
| | | <Button onClick={() => {this.showError('F')}} type="primary" size="small"> |
| | | 查看 |
| | | </Button> |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={'停留时间'}> |
| | | <InputNumber defaultValue={15} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ftime')}} /> |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <span className="errorval"> E </span> |
| | | <Button onClick={() => {this.showError('E')}} type="primary" size="small"> |
| | | 查看 |
| | | </Button> |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | <Row gutter={24}> |
| | | <Col offset={6} span={6}> |
| | | <Form.Item label={'提示编码'}> |
| | | <span className="errorval"> NM </span> |
| | | <Button onClick={() => {this.showError('NM')}} type="primary" size="small"> |
| | | 查看 |
| | | </Button> |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | </Form> |
| | | </TabPane> |
| | | </Tabs> |
| | | </div> |
| | | ) |
| | | } |
| | | } |
| | |
| | | .ant-tabs-content { |
| | | min-height: 40vh; |
| | | } |
| | | table tr td { |
| | | word-wrap: break-word; |
| | | word-break: break-word; |
| | | } |
| | | .verify-form { |
| | | .ant-input-number { |
| | | width: 100%; |
| | |
| | | editItem: null // 编辑元素 |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | let fields = JSON.parse(JSON.stringify(this.props.fields)) |
| | | if (fields && fields.filter(_field => _field.field === 'BID').length === 0) { |
| | | fields.unshift({ |
| | | field: 'BID', |
| | | label: 'BID', |
| | | uuid: 'BID' |
| | | }) |
| | | } |
| | | |
| | | this.setState({fields: fields}) |
| | | } |
| | | |
| | | edit = (record) => { |
| | | this.setState({ |
| | | editItem: record |
| | |
| | | |
| | | |
| | | handleConfirm = () => { |
| | | const { fields } = this.props |
| | | const { fields } = this.state |
| | | // 表单提交时检查输入值是否正确 |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (!err) { |
| | |
| | | |
| | | render() { |
| | | const { getFieldDecorator } = this.props.form |
| | | const { fields } = this.props |
| | | const { fields } = this.state |
| | | |
| | | const formItemLayout = { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Select, Icon, Radio, notification, InputNumber } from 'antd' |
| | | import { Form, Row, Col, Input, Select, Icon, Radio, notification, InputNumber, Tooltip } from 'antd' |
| | | import { formRule } from '@/utils/option.js' |
| | | import { dateOptions } from '@/utils/option.js' |
| | | import EditTable from '../editable' |
| | |
| | | |
| | | let type = formlist.filter(cell => cell.key === 'type')[0].initVal |
| | | let resourceType = formlist.filter(cell => cell.key === 'resourceType')[0].initVal |
| | | let _options = ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden'] // 默认显示项 |
| | | let _options = ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin'] // 默认显示项 |
| | | |
| | | if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '0') { // 选择类型、自定义资源 |
| | | _options = [..._options, 'resourceType', 'options'] |
| | | } else if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '1') { // 选择类型、数据源 |
| | | _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'database'] |
| | | } else if (type === 'number') { |
| | | _options = ['label', 'field', 'initval', 'type', 'readonly', 'hidden', 'decimal', 'min', 'max'] |
| | | _options = ['label', 'field', 'initval', 'type', 'readonly', 'hidden', 'decimal', 'min', 'max', 'readin'] |
| | | } else if (type === 'fileupload') { |
| | | _options = ['label', 'field', 'type', 'readonly', 'required'] |
| | | _options = ['label', 'field', 'type', 'readonly', 'required', 'readin', 'fieldlength'] |
| | | } else if (type === 'text' || type === 'textarea') { |
| | | _options = [..._options, 'fieldlength'] |
| | | } |
| | | |
| | | if (type === 'select') { |
| | | _options = [..._options, 'setAll'] |
| | | if (resourceType === '1') { |
| | | _options.push('linkSubField') |
| | | } |
| | | _options = [..._options, 'setAll', 'linkSubField'] |
| | | } else if (type === 'multiselect') { |
| | | _options = [..._options, 'fieldlength'] |
| | | } else if (type === 'link') { // 关联类型、增加关联字段 |
| | | _options = [..._options, 'setAll', 'linkField'] |
| | | } else if (type === 'funcvar') { // 设置为函数变量时,不需要其他信息 |
| | | _options = ['label', 'field', 'type'] |
| | | } else if (type === 'linkMain') { |
| | | _options = ['label', 'field', 'type', 'readonly', 'required', 'hidden'] |
| | | _options = ['label', 'field', 'type', 'readonly', 'required', 'hidden', 'fieldlength'] |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | form.type = 'select' |
| | | } else if (type === 'number' && form.key === 'initval') { |
| | | form.type = 'number' |
| | | form.initVal = form.initVal || 0 |
| | | form.required = true |
| | | } |
| | | form.show = _options.includes(form.key) |
| | |
| | | |
| | | openTypeChange = (key, value) => { |
| | | if (key === 'type') { |
| | | let _options = ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden'] |
| | | let _options = ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin'] |
| | | |
| | | if ((value === 'multiselect' || value === 'select' || value === 'link') && this.state.resourceType === '0') { // 选择类型、自定义资源 |
| | | _options = [..._options, 'resourceType', 'options'] |
| | | } else if ((value === 'multiselect' || value === 'select' || value === 'link') && this.state.resourceType === '1') { // 选择类型、数据源 |
| | | _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'database'] |
| | | } else if (value === 'number') { |
| | | _options = ['label', 'field', 'initval', 'type', 'readonly', 'hidden', 'decimal', 'min', 'max'] |
| | | _options = ['label', 'field', 'initval', 'type', 'readonly', 'hidden', 'decimal', 'min', 'max', 'readin'] |
| | | } else if (value === 'fileupload') { |
| | | _options = ['label', 'field', 'type', 'readonly', 'required'] |
| | | _options = ['label', 'field', 'type', 'readonly', 'required', 'readin', 'fieldlength'] |
| | | } else if (value === 'text' || value === 'textarea') { |
| | | _options = [..._options, 'fieldlength'] |
| | | } |
| | | |
| | | if (value === 'select') { |
| | | _options = [..._options, 'setAll'] |
| | | if (this.state.resourceType === '1') { |
| | | _options.push('linkSubField') |
| | | } |
| | | _options = [..._options, 'setAll', 'linkSubField'] |
| | | } else if (value === 'multiselect') { |
| | | _options = [..._options, 'fieldlength'] |
| | | } else if (value === 'link') { |
| | | _options = [..._options, 'setAll', 'linkField'] |
| | | } else if (value === 'funcvar') { |
| | | _options = ['label', 'field', 'type'] |
| | | } else if (value === 'linkMain') { |
| | | _options = ['label', 'field', 'type', 'readonly', 'required', 'hidden'] |
| | | _options = ['label', 'field', 'type', 'readonly', 'required', 'hidden', 'fieldlength'] |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | form.show = _options.includes(form.key) |
| | | if (form.key === 'initval') { |
| | | form.required = false |
| | | form.initVal = '' |
| | | if (dateOptions.hasOwnProperty(value)) { |
| | | form.options = dateOptions[value] |
| | | form.type = 'select' |
| | | } else if (value === 'number') { |
| | | form.type = 'number' |
| | | form.required = true |
| | | form.initVal = 0 |
| | | } else { |
| | | form.type = 'text' |
| | | } |
| | | form.initVal = '' |
| | | form.show = false |
| | | } else if (form.key === 'fieldlength') { |
| | | form.initVal = 50 |
| | | if (value === 'textarea' || value === 'fileupload') { |
| | | form.initVal = 512 |
| | | } |
| | | form.show = false |
| | | } else if (form.key === 'resourceType') { |
| | | form.initVal = this.state.resourceType |
| | | } |
| | | return form |
| | | }) |
| | |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(form => { |
| | | if (form.key === 'initval' && value !== 'fileupload' && value !== 'funcvar' && value !== 'linkMain') { |
| | | form.show = true |
| | | } else if (form.key === 'fieldlength' && (value === 'fileupload' || value === 'multiselect' || value === 'text' || value === 'textarea' || value === 'linkMain')) { |
| | | form.show = true |
| | | } |
| | | return form |
| | |
| | | } |
| | | } |
| | | |
| | | multiselectChange = (key, value, options) => { |
| | | if (key === 'linkSubField') { |
| | | |
| | | } |
| | | console.log(key) |
| | | console.log(value) |
| | | console.log(options) |
| | | } |
| | | |
| | | onChange = (e, key) => { |
| | | const { openType } = this.state |
| | | let value = e.target.value |
| | | if (key === 'resourceType') { |
| | | let _options = ['label', 'field', 'initval', 'type', 'resourceType', 'readonly', 'required', 'hidden'] |
| | | let _options = ['label', 'field', 'initval', 'type', 'resourceType', 'readonly', 'required', 'hidden', 'readin'] |
| | | if (value === '0') { |
| | | _options = [..._options, 'options'] |
| | | } else if (value === '1') { |
| | |
| | | } |
| | | |
| | | if (openType === 'select') { |
| | | _options = [..._options, 'setAll'] |
| | | if (value === '1') { |
| | | _options.push('linkSubField') |
| | | } |
| | | _options = [..._options, 'setAll', 'linkSubField'] |
| | | } else if (openType === 'link') { |
| | | _options = [..._options, 'setAll', 'linkField'] |
| | | } else if (openType === 'multiselect') { |
| | | _options = [..._options, 'fieldlength'] |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.key === 'fieldlength') { |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={item.label}> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal, |
| | | rules: [ |
| | | { |
| | | required: !!item.required, |
| | | message: this.props.dict['form.required.input'] + item.label + '!' |
| | | } |
| | | ] |
| | | })(<InputNumber min={1} precision={0} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else { |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | |
| | | showSearch |
| | | mode="multiple" |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | onChange={(value) => this.multiselectChange(item.key, value, item.options)} |
| | | > |
| | | {item.options.map(option => |
| | | <Select.Option id={option.uuid} key={option.uuid} value={option.field}>{option.label}</Select.Option> |
| | |
| | | } else if (item.type === 'radio') { |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={item.label}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}> |
| | | <Icon type="question-circle" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal, |
| | | rules: [ |
| | |
| | | width: 100%; |
| | | } |
| | | } |
| | | .ant-form-item-label .anticon-question-circle { |
| | | color: #c49f47; |
| | | margin-right: 3px; |
| | | } |
| | | .ant-input-number { |
| | | width: 100%; |
| | | } |
| | |
| | | }, { |
| | | value: 'delete', |
| | | text: 'delete' |
| | | }, { |
| | | value: 'rollback', |
| | | text: 'rollback' |
| | | }, { |
| | | value: 'download', |
| | | text: 'download' |
| | | }, { |
| | | value: 'upload', |
| | | text: 'upload' |
| | | }, { |
| | | value: 'step-backward', |
| | | text: 'step-backward' |
| | | }, { |
| | | value: 'step-forward', |
| | | text: 'step-forward' |
| | | }] |
| | | |
| | | export const btnClasses = [{ |
| | |
| | | let verify = btn.verify || {} |
| | | let _formFieldValue = {} |
| | | // 需要声明的变量集 |
| | | let _vars = ['tbid', 'ErrorCode', 'retmsg', 'BillCode', 'BVoucher', 'FIBVoucherDate', 'FiYear', 'UserName', 'FullName', 'ID', 'BID'] |
| | | let _vars = ['tbid', 'ErrorCode', 'retmsg', 'BillCode', 'BVoucher', 'FIBVoucherDate', 'FiYear', 'UserName', 'FullName', 'ID', 'BID', 'LoginUID', 'SessionUid', 'UserID', 'Appkey'] |
| | | |
| | | // 主键字段 |
| | | let primaryKey = setting.primaryKey || 'id' |
| | |
| | | let _sql = `Declare @tbid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@BillCode nvarchar(50),@BVoucher nvarchar(50),@FIBVoucherDate nvarchar(50), @FiYear nvarchar(50), @UserName nvarchar(50),@FullName nvarchar(50) |
| | | ` |
| | | |
| | | let _initvars = ['ID', 'BID', 'LoginUID', 'SessionUid', 'UserID', 'Appkey'] // 已赋值字段集 |
| | | let _initfields = [] |
| | | let _declarefields = [] |
| | | |
| | | // 获取字段键值对 |
| | | if (formdata) { |
| | | formdata.forEach(form => { |
| | | _formFieldValue[form.key] = form.value |
| | | |
| | | if (!_initvars.includes(form.key)) { |
| | | _initvars.push(form.key) |
| | | _initfields.push(`@${form.key}='${form.value}'`) |
| | | } |
| | | |
| | | if (!_vars.includes(form.key)) { |
| | | _vars.push(form.key) |
| | | |
| | | let _type = `nvarchar(${form.fieldlen})` |
| | | |
| | | if (form.type.match(/date/ig)) { |
| | | _type = 'datetime' |
| | | } else if (form.type === 'number') { |
| | | _type = `decimal(18,${form.fieldlen})` |
| | | } |
| | | |
| | | _declarefields.push(`@${form.key} ${_type}`) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | // 添加数据中字段,表单值优先 |
| | | if (data) { |
| | | // 添加数据中字段,表单值优先(按钮不选行时跳过) |
| | | if (data && btn.Ot !== 'notRequired') { |
| | | _formFieldValue = {...data, ..._formFieldValue} |
| | | |
| | | if (logcolumns && logcolumns.length > 0) { |
| | | logcolumns.forEach(col => { |
| | | if (!_initvars.includes(col.field)) { |
| | | _initvars.push(col.field) |
| | | |
| | | let _val = data.hasOwnProperty(col.field) ? data[col.field] : '' |
| | | _initfields.push(`@${col.field}='${_val}'`) |
| | | } |
| | | |
| | | if (!_vars.includes(col.field)) { |
| | | _vars.push(col.field) |
| | | |
| | | let _type = `nvarchar(${col.fieldlength || 50})` |
| | | |
| | | if (col.type === 'number') { |
| | | let _length = (col.decimal || col.decimal === 0) ? col.decimal : 18 |
| | | _type = `decimal(18,${_length})` |
| | | } else if (col.type === 'picture' || col.type === 'textarea') { |
| | | _type = `nvarchar(${col.fieldlength || 512})` |
| | | } |
| | | |
| | | _declarefields.push(`@${col.field} ${_type}`) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | // 变量声明 |
| | | _declarefields = _declarefields.join(',') |
| | | if (_declarefields) { |
| | | _sql += `,${_declarefields} |
| | | ` |
| | | } |
| | | |
| | | // 变量赋值 |
| | | _initfields = _initfields.join(',') |
| | | if (_initfields) { |
| | | _sql += `select ${_initfields} |
| | | ` |
| | | } |
| | | |
| | | // 添加时主键为空 |
| | | if (btn.sqlType === 'insert') { |
| | | primaryId = '' |
| | | } |
| | | |
| | | // 声明表单及列表数据字段,初始化赋值 |
| | | let keys = Object.keys(_formFieldValue) |
| | | let _initfields = [] |
| | | let _initvars = ['ID', 'BID'] |
| | | let _formfields = [] |
| | | keys.forEach(key => { |
| | | if (!_initvars.includes(key)) { |
| | | _initvars.push(key) |
| | | _initfields.push(`@${key}='${_formFieldValue[key]}'`) |
| | | } |
| | | |
| | | if (!_vars.includes(key)) { |
| | | _vars.push(key) |
| | | _formfields.push(`@${key} nvarchar(50)`) |
| | | } |
| | | }) |
| | | |
| | | _formfields = _formfields.join(',') |
| | | if (_formfields) { |
| | | _sql += `,${_formfields} |
| | | ` |
| | | } |
| | | |
| | | _initfields = _initfields.join(',') |
| | | if (_initfields) { |
| | | _sql += `select ${_initfields} |
| | | ` |
| | | } |
| | | |
| | | // 去除禁用的验证 |
| | |
| | | } |
| | | |
| | | // 初始化凭证字段 |
| | | _sql += `select @BVoucher='',@FIBVoucherDate='',@FiYear='' |
| | | _sql += `select @BVoucher='',@FIBVoucherDate='',@FiYear='',@ErrorCode='',@retmsg='' |
| | | ` |
| | | |
| | | // 启用账期验证 |
| | |
| | | } else if ((btn.OpenType === 'prompt' || btn.OpenType === 'exec') && btn.sqlType === 'delete' && verify.default !== 'false') { // 物理删除 |
| | | let _msg = '' |
| | | if (data && logcolumns && logcolumns.length > 0) { |
| | | let _index = 0 |
| | | logcolumns.forEach(col => { |
| | | _msg += col.label + '=' + data[col.field] + ',' |
| | | if (col.Hide !== 'true' && _index < 4) { |
| | | _msg += col.label + '=' + data[col.field] + ',' |
| | | _index++ |
| | | } |
| | | }) |
| | | } |
| | | _sql += _user |