| | |
| | | this.loadmenu() |
| | | this.props.resetEditState(true) |
| | | } else { |
| | | this.setState({ |
| | | loginLoading: false |
| | | }) |
| | | notification.error({ |
| | | top: 92, |
| | | message: res.message, |
| | |
| | | }) |
| | | } |
| | | |
| | | handleSubmit = e => { |
| | | // 登录参数检验 |
| | | handleSubmit = (e, key) => { |
| | | e.preventDefault() |
| | | this.props.handleSubmit() |
| | | if (e.target.value) { |
| | | if (!this.props.form.getFieldValue(key)) { |
| | | const input = document.getElementById(key) |
| | | if (input) { |
| | | input.focus() |
| | | } |
| | | return |
| | | } |
| | | this.props.handleSubmit() |
| | | } else { |
| | | this.handleConfirm() |
| | | } |
| | | } |
| | | |
| | | componentDidMount () { |
| | |
| | | prefix={<Icon type="user" style={{ color: 'rgba(0,0,0,.25)' }} />} |
| | | placeholder={this.state.dict['login.username']} |
| | | autoComplete="off" |
| | | onPressEnter={this.handleSubmit} |
| | | onPressEnter={(e) => {this.handleSubmit(e, 'password')}} |
| | | /> |
| | | )} |
| | | </Form.Item> |
| | |
| | | message: this.state.dict['login.password.empty'], |
| | | } |
| | | ] |
| | | })(<Input.Password onPressEnter={this.handleSubmit} placeholder={this.state.dict['login.password']} prefix={<Icon type="lock" style={{ color: 'rgba(0,0,0,.25)' }} />} />)} |
| | | })(<Input.Password onPressEnter={(e) => {this.handleSubmit(e, 'username')}} placeholder={this.state.dict['login.password']} prefix={<Icon type="lock" style={{ color: 'rgba(0,0,0,.25)' }} />} />)} |
| | | </Form.Item> |
| | | </Form> |
| | | ) |
| | |
| | | } |
| | | |
| | | handleSubConfig = (item, originMenu, config, type) => { |
| | | if (type === 'button') { // 三级菜单页面,按钮配置 |
| | | if (item.OpenType === 'pop') { |
| | | this.setState({ |
| | | tabview: '' |
| | | }, () => { |
| | | if (type === 'button') { // 三级菜单页面,按钮配置 |
| | | if (item.OpenType === 'pop') { |
| | | let pageParam = '' |
| | | if (config && config.type === 'Modal') { |
| | | pageParam = config |
| | | } |
| | | |
| | | this.setState({ |
| | | editMenu: originMenu, |
| | | editTab: '', |
| | | editAction: item, |
| | | btnParam: pageParam, |
| | | tabview: 'Modal' |
| | | }) |
| | | } |
| | | } else if (type === 'tab') { // 三级菜单页面,标签配置 |
| | | if (item.type === 'SubTable' || item.tabType === 'SubTable') { |
| | | this.setState({ |
| | | editMenu: originMenu, |
| | | editTab: config, |
| | | editAction: '', |
| | | tabview: 'SubTable' |
| | | }) |
| | | } |
| | | } else if (type === 'tabButton') { // 三级菜单下,标签下,按钮配置 |
| | | console.log(item) |
| | | let pageParam = '' |
| | | if (config && config.type === 'Modal') { |
| | | if (item.OpenType === 'popview') { |
| | | if (config && config.Template === 'SubTable') { |
| | | pageParam = config |
| | | } else { |
| | | pageParam = { |
| | | ...item, |
| | | uuid: item.linkTab, |
| | | create: true |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | editMenu: originMenu, |
| | | editTab: pageParam, |
| | | editAction: item, |
| | | tabview: 'SubTable' |
| | | }) |
| | | } else { |
| | | if (config && config.type === 'Modal') { |
| | | pageParam = config |
| | | } |
| | | this.setState({ |
| | | editTab: originMenu, |
| | | editAction: item, |
| | | btnParam: pageParam, |
| | | tabview: 'Modal' |
| | | }) |
| | | } |
| | | } else if (type === 'tabview') { // 三级菜单下,打开新标签页或当前页跳转,类型的按钮配置 |
| | | let pageParam = '' |
| | | if (config && config.type === 'FormTab') { |
| | | pageParam = config |
| | | } |
| | | |
| | | this.setState({ |
| | | editMenu: originMenu, |
| | | editTab: '', |
| | | editAction: item, |
| | | btnParam: pageParam, |
| | | tabview: 'Modal' |
| | | tabview: 'FormTab' |
| | | }) |
| | | } |
| | | } else if (type === 'tab') { // 三级菜单页面,标签配置 |
| | | if (item.type === 'SubTable' || item.tabType === 'SubTable') { |
| | | this.setState({ |
| | | editMenu: originMenu, |
| | | editTab: config, |
| | | editAction: '', |
| | | tabview: 'SubTable' |
| | | }) |
| | | } |
| | | } else if (type === 'tabButton') { // 三级菜单下,标签下,按钮配置 |
| | | let pageParam = '' |
| | | if (config && config.type === 'Modal') { |
| | | pageParam = config |
| | | } |
| | | |
| | | this.setState({ |
| | | editTab: originMenu, |
| | | editAction: item, |
| | | btnParam: pageParam, |
| | | tabview: 'Modal' |
| | | }) |
| | | } else if (type === 'tabview') { // 三级菜单下,打开新标签页或当前页跳转,类型的按钮配置 |
| | | let pageParam = '' |
| | | if (config && config.type === 'FormTab') { |
| | | pageParam = config |
| | | } |
| | | |
| | | this.setState({ |
| | | editMenu: originMenu, |
| | | editAction: item, |
| | | btnParam: pageParam, |
| | | tabview: 'FormTab' |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | |
| | | 'header.form.readonly': '是否只读', |
| | | 'header.form.field.required': '是否必填', |
| | | 'header.form.field.ishidden': '是否隐藏', |
| | | 'header.form.queryType': '查询类型', |
| | | 'header.form.query': '查询', |
| | | 'header.form.statistics': '统计', |
| | | 'header.modal.form.edit': '表单-编辑', |
| | | 'header.modal.search.edit': '搜索条件-编辑', |
| | | 'header.modal.action.edit': '按钮-编辑', |
| | |
| | | 'header.form.readonly': '是否只读', |
| | | 'header.form.field.required': '是否必填', |
| | | 'header.form.field.ishidden': '是否隐藏', |
| | | 'header.form.queryType': '查询类型', |
| | | 'header.form.query': '查询', |
| | | 'header.form.statistics': '统计', |
| | | 'header.modal.form.edit': '表单-编辑', |
| | | 'header.modal.search.edit': '搜索条件-编辑', |
| | | 'header.modal.action.edit': '按钮-编辑', |
| | |
| | | columns: _columns, |
| | | isLinkMain: _isLinkMain, |
| | | arr_field: _arrField.join(','), |
| | | search: Utils.initMainSearch(config.search), // 搜索条件初始化(含有时间格式,需要转化) |
| | | loading: true |
| | | search: Utils.initMainSearch(config.search) // 搜索条件初始化(含有时间格式,需要转化) |
| | | }, () => { |
| | | this.improveSearch() |
| | | |
| | | if (config.setting.onload !== 'false') { // 初始化可加载 |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | this.loadmaindata() |
| | | } |
| | | }) |
| | |
| | | |
| | | if (/\s/.test(_dataresource)) { |
| | | _dataresource = '(' + _dataresource + ') tb' |
| | | } |
| | | |
| | | if (setting.queryType === 'statistics') { // 统计数据源,内容替换 |
| | | let fieldmap = new Map() |
| | | search.forEach(item => { |
| | | let _field = item.key |
| | | |
| | | if (fieldmap.has(_field)) { |
| | | _field = _field + '1' |
| | | } |
| | | |
| | | fieldmap.set(item.key, true) |
| | | |
| | | let reg = new RegExp('@' + _field, 'ig') |
| | | _dataresource = _dataresource.replace(reg, `'${item.value}'`) |
| | | }) |
| | | } |
| | | |
| | | let LText = `select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows` |
| | |
| | | * @description 触发按钮弹窗(标签页) |
| | | */ |
| | | triggerPopview = (btn, data) => { |
| | | console.log(btn) |
| | | if (btn.OpenType === 'popview') { |
| | | this.setState({ |
| | | popAction: btn, |
| | |
| | | * @description 获取页面配置信息 |
| | | */ |
| | | async loadconfig () { |
| | | const { permAction } = this.props |
| | | const { permAction, Tab, BID } = this.props |
| | | |
| | | let param = { |
| | | func: 'sPC_Get_LongParam', |
| | |
| | | actions: _actions, |
| | | columns: _columns, |
| | | arr_field: _arrField.join(','), |
| | | search: Utils.initMainSearch(config.search), // 搜索条件初始化(含有时间格式,需要转化) |
| | | loading: true |
| | | search: Utils.initMainSearch(config.search) // 搜索条件初始化(含有时间格式,需要转化) |
| | | }, () => { |
| | | this.improveSearch() |
| | | this.loadmaindata() |
| | | |
| | | if (config.setting.onload !== 'false' && (!Tab.supMenu || BID)) { // 初始化可加载 |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | this.loadmaindata() |
| | | } |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | |
| | | |
| | | if (/\s/.test(_dataresource)) { |
| | | _dataresource = '(' + _dataresource + ') tb' |
| | | } |
| | | |
| | | if (setting.queryType === 'statistics') { // 统计数据源,内容替换 |
| | | let fieldmap = new Map() |
| | | search.forEach(item => { |
| | | let _field = item.key |
| | | |
| | | if (fieldmap.has(_field)) { |
| | | _field = _field + '1' |
| | | } |
| | | |
| | | fieldmap.set(item.key, true) |
| | | |
| | | let reg = new RegExp('@' + _field, 'ig') |
| | | _dataresource = _dataresource.replace(reg, `'${item.value}'`) |
| | | }) |
| | | } |
| | | |
| | | let LText = `select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows` |
| | |
| | | type="sub" |
| | | setting={setting} |
| | | actions={actions} |
| | | Tab={this.props.Tab} |
| | | BID={this.props.BID} |
| | | dict={this.state.dict} |
| | | MenuID={this.props.SupMenuID} |
| | |
| | | _dataresource = '(' + _dataresource + ') tb' |
| | | } |
| | | |
| | | if (setting.queryType === 'statistics') { // 统计数据源,内容替换 |
| | | let fieldmap = new Map() |
| | | search.forEach(item => { |
| | | let _field = item.key |
| | | |
| | | if (fieldmap.has(_field)) { |
| | | _field = _field + '1' |
| | | } |
| | | |
| | | fieldmap.set(item.key, true) |
| | | |
| | | let reg = new RegExp('@' + _field, 'ig') |
| | | _dataresource = _dataresource.replace(reg, `'${item.value}'`) |
| | | }) |
| | | } |
| | | |
| | | let LText = `select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows` |
| | | let DateCount = `select count(1) as total from ${_dataresource} ${_search}` |
| | | |
| | |
| | | class MainAction extends Component { |
| | | static propTpyes = { |
| | | BID: PropTypes.string, |
| | | Tab: PropTypes.any, |
| | | type: PropTypes.string, |
| | | MenuID: PropTypes.string, |
| | | actions: PropTypes.array, // 搜索条件列表 |
| | |
| | | * @description 触发按钮操作 |
| | | */ |
| | | actionTrigger = (item, record) => { |
| | | const { setting } = this.props |
| | | const { setting, type, Tab, BID } = this.props |
| | | |
| | | if (type === 'sub' && Tab && Tab.supMenu && !BID) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '需要上级主键值!', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let _this = this |
| | | let data = this.props.gettableselected() || [] |
| | |
| | | })(<TextArea rows={4} />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType !== 'outer' ? <Col span={12}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="查询时,搜索条件以where条件拼接进入sql,统计时,将数据源中以“@+搜索字段”的内容,以搜索条件中的值进行替换后,提交查询,注:查询类型仅在使用系统函数时有效。"> |
| | | <Icon type="question-circle" /> |
| | | {dict['header.form.queryType']} |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('queryType', { |
| | | initialValue: data.queryType || 'query' |
| | | })( |
| | | <Radio.Group> |
| | | <Radio value="query">{dict['header.form.query']}</Radio> |
| | | <Radio value="statistics">{dict['header.form.statistics']}</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={12}> |
| | | <Form.Item label="固定按钮"> |
| | | {getFieldDecorator('actionfixed', { |
| | | initialValue: data.actionfixed ? 'true' : 'false' |
| | | })( |
| | | <Select> |
| | | <Select.Option value="true">是</Select.Option> |
| | | <Select.Option value="false">否</Select.Option> |
| | | </Select> |
| | | <Radio.Group> |
| | | <Radio value="true">{dict['header.form.true']}</Radio> |
| | | <Radio value="false">{dict['header.form.false']}</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={12}> |
| | | <Form.Item label="固定列"> |
| | | <Form.Item label="固定表头"> |
| | | {getFieldDecorator('columnfixed', { |
| | | initialValue: data.columnfixed ? 'true' : 'false' |
| | | })( |
| | | <Select> |
| | | <Select.Option value="true">是</Select.Option> |
| | | <Select.Option value="false">否</Select.Option> |
| | | </Select> |
| | | <Radio.Group> |
| | | <Radio value="true">{dict['header.form.true']}</Radio> |
| | | <Radio value="false">{dict['header.form.false']}</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | |
| | | */ |
| | | UNSAFE_componentWillMount () { |
| | | const { menu, editAction, config } = this.props |
| | | console.log(menu) |
| | | |
| | | let _config = '' |
| | | let _originMenu = '' |
| | | |
| | |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Select, Icon, Radio, notification, Tooltip, InputNumber } from 'antd' |
| | | import { btnIcons, btnClasses, formRule } from '@/utils/option.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import './index.scss' |
| | | |
| | | const { TextArea } = Input |
| | |
| | | if (values.OpenType === 'excelIn' || values.OpenType === 'excelOut') { |
| | | values.position = 'toolbar' |
| | | values.Ot = 'notRequired' |
| | | } else if (values.OpenType === 'popview' && !values.linkTab) { // 没有关联标签(新建时),创建新标签Id |
| | | values.linkTab = Utils.getuuid() |
| | | } |
| | | |
| | | if (values.innerFunc === '' && values.sql === '') { |
| | |
| | | creatFunc = () => { |
| | | let _config = JSON.parse(JSON.stringify(this.state.config)) |
| | | |
| | | this.formRef.handleConfirm().then(res => { |
| | | let btn = res // 按钮信息 |
| | | this.actionFormRef.handleConfirm().then(res => { |
| | | let btn = res // 按钮信息 |
| | | let newLText = '' // 创建存储过程sql |
| | | let DelText = '' // 删除存储过程sql |
| | | let isExit = false // 存储过程是否存在 |
| | |
| | | }) |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: btn.uuid |
| | | MenuID: btn.OpenType === 'popview' ? btn.linkTab : btn.uuid |
| | | }).then(res => { |
| | | if (res.status) { |
| | | this.setState({ |
| | |
| | | _LongParam = '' |
| | | } |
| | | } |
| | | |
| | | this.props.handleSubConfig(btn, config, _LongParam, 'tabButton') |
| | | } else { |
| | | this.setState({ |
| | |
| | | })(<TextArea rows={4} />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType !== 'outer' ? <Col span={12}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="查询时,搜索条件以where条件拼接进入sql,统计时,将数据源中以“@+搜索字段”的内容,以搜索条件中的值进行替换后,提交查询,注:查询类型仅在使用系统函数时有效。"> |
| | | <Icon type="question-circle" /> |
| | | {dict['header.form.queryType']} |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('queryType', { |
| | | initialValue: data.queryType || 'query' |
| | | })( |
| | | <Radio.Group> |
| | | <Radio value="query">{dict['header.form.query']}</Radio> |
| | | <Radio value="statistics">{dict['header.form.statistics']}</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={12}> |
| | | <Form.Item label="主键"> |
| | | {getFieldDecorator('primaryKey', { |
| | |
| | | })(<Input placeholder="ID asc, UID desc" autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={12}> |
| | | <Form.Item label="初始化"> |
| | | {getFieldDecorator('onload', { |
| | | initialValue: data.onload || 'true' |
| | | })( |
| | | <Select> |
| | | <Select.Option value="true">加载数据</Select.Option> |
| | | <Select.Option value="false">不加载数据</Select.Option> |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | </Form> |
| | | ) |