| | |
| | | text: '', |
| | | type: template.type, |
| | | PageParam: {OpenType: 'newtab', Template: template.type}, |
| | | LongParam: '', |
| | | LongParam: template.baseconfig, |
| | | ParentID: this.props.supMenu.MenuID |
| | | } |
| | | }) |
| | |
| | | |
| | | this.setState({ |
| | | tabview: template.type, |
| | | editMenu: {...editMenu, ...{LongParam: template.baseconfig, PageParam: _PageParam, type: template.type}} |
| | | editMenu: {...editMenu, LongParam: template.baseconfig, PageParam: _PageParam, type: template.type} |
| | | }) |
| | | } |
| | | document.getElementById('root').style.overflowY = 'hidden' |
| | |
| | | import ItemTypes from './itemtypes' |
| | | import './index.scss' |
| | | |
| | | const Card = ({ id, icon, text, moveCard, findCard, editCard, closeCard }) => { |
| | | const Card = ({ id, icon, text, menutype, moveCard, findCard, editCard, closeCard }) => { |
| | | const originalIndex = findCard(id).index |
| | | const [{ isDragging }, drag] = useDrag({ |
| | | item: { type: ItemTypes.CARD, id, originalIndex }, |
| | |
| | | {icon && <Icon type={icon} />} |
| | | {text} |
| | | </div> |
| | | <Icon className="edit" type="edit" onClick={edit} /> |
| | | {menutype !== 'iframe' ? <Icon className="edit" type="edit" onClick={edit} /> : null} |
| | | <Icon className="close" type="close" onClick={close} /> |
| | | </div> |
| | | ) |
| | |
| | | type: 'close' |
| | | }) |
| | | } |
| | | |
| | | const [, drop] = useDrop({ accept: ItemTypes.CARD }) |
| | | return ( |
| | | <div ref={drop} className="sidemenu-dragboard"> |
| | |
| | | key={card.id} |
| | | id={`${card.id}`} |
| | | icon={card.PageParam && card.PageParam.Icon} |
| | | menutype={card.type} |
| | | text={card.text} |
| | | moveCard={moveCard} |
| | | editCard={editCard} |
| | |
| | | let Comps = {} |
| | | let service = window.GLOB.service ? (/\/$/.test(window.GLOB.service) ? window.GLOB.service : window.GLOB.service + '/') : '' |
| | | |
| | | if (process.env.NODE_ENV === 'production') { |
| | | service = document.location.origin + '/' + service + 'zh-CN/' |
| | | } else { |
| | | service = 'http://qingqiumarket.cn/' + service + 'zh-CN/' |
| | | } |
| | | |
| | | class Header extends Component { |
| | | static propTpyes = { |
| | | collapse: PropTypes.bool, |
| | |
| | | } else if (view.type === 'TabForm') { |
| | | return (<Comps.TabForm MenuNo={view.MenuNo} MenuID={view.MenuID} key={view.MenuID} param={view.param}/>) |
| | | } else if (view.type === 'iframe') { |
| | | return (<Comps.Iframe key={view.MenuID} title={view.MenuName} url={'http://qingqiumarket.cn/' + service + 'zh-CN/' + view.LinkUrl}/>) |
| | | return (<Comps.Iframe key={view.MenuID} title={view.MenuName} url={service + view.LinkUrl}/>) |
| | | } else { |
| | | return (<NotFount key={view.MenuID} />) |
| | | } |
| | |
| | | 'header.save': 'Save', |
| | | 'header.notsave': 'Do not save', |
| | | 'header.close': 'Close', |
| | | 'header.reset': 'Reset', |
| | | 'header.menu.basemsg': 'Please complete the basic information !', |
| | | 'header.menu.template.change': 'Switch the template', |
| | | 'header.menu.addtitle': 'The new menu', |
| | |
| | | 'header.menu.openType.menu': 'Menu', |
| | | 'header.menu.openType.newWindow': 'A new window', |
| | | 'header.menu.newpage.service': 'Customer Service', |
| | | 'header.menu.func.create': '创建存储过程', |
| | | 'header.form.search.placeholder': 'Please add search criteria', |
| | | 'header.form.modal.placeholder': 'Please add the form', |
| | | 'header.form.action.placeholder': 'Please add buttons', |
| | |
| | | 'header.form.column.action': 'Action', |
| | | 'header.form.name': 'Name', |
| | | 'header.form.field': 'Field', |
| | | 'header.form.field.placeholder': '请输入字段名', |
| | | 'header.form.innerFunc': 'Internal function', |
| | | 'header.form.outerFunc': 'External function', |
| | | 'header.form.callbackFunc': 'Callback function', |
| | |
| | | 'header.save': '保存', |
| | | 'header.notsave': '不保存', |
| | | 'header.close': '关闭', |
| | | 'header.reset': '重置', |
| | | 'header.menu.basemsg': '请完善菜单基本信息!', |
| | | 'header.menu.template.change': '切换模板', |
| | | 'header.menu.addtitle': '新建菜单', |
| | |
| | | 'header.menu.openType.menu': '菜单', |
| | | 'header.menu.openType.newWindow': '新窗口', |
| | | 'header.menu.newpage.service': '客服', |
| | | 'header.menu.func.create': '创建存储过程', |
| | | 'header.form.search.placeholder': '请添加搜索条件', |
| | | 'header.form.modal.placeholder': '请添加表单', |
| | | 'header.form.action.placeholder': '请添加按钮', |
| | |
| | | 'header.form.column.action': '操作', |
| | | 'header.form.name': '名称', |
| | | 'header.form.field': '字段', |
| | | 'header.form.field.placeholder': '请输入字段名', |
| | | 'header.form.innerFunc': '内部函数', |
| | | 'header.form.outerFunc': '外部函数', |
| | | 'header.form.callbackFunc': '回调函数', |
| | |
| | | UNSAFE_componentWillMount () { |
| | | // 组件加载时,获取菜单数据 |
| | | this.loadconfig() |
| | | |
| | | console.log(Utils.getfunc()) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | if (_intertype === 'outer') { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError', 'method'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType'] |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } |
| | | } else { |
| | | if (_intertype === 'outer') { |
| | |
| | | } else if (item.key === 'Ot') { |
| | | if (_opentype === 'innerpage' || _position === 'grid') { |
| | | item.options = this.state.reqOptionSgl |
| | | } else if (['outerpage', 'blank', 'tab', 'pop', 'popview'].includes(_opentype)) { |
| | | } else if (['outerpage', 'blank', 'tab', 'popview'].includes(_opentype)) { |
| | | item.options = this.state.reqOptions |
| | | } else { |
| | | item.options = this.state.reqOptionsMutil |
| | |
| | | if (this.state.interType === 'outer') { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError', 'method'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType'] |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } |
| | | } else { |
| | | if (this.state.interType === 'inner') { |
| | |
| | | item.options = this.state.reqOptionSgl |
| | | item.initVal = 'requiredSgl' |
| | | item.hidden = true |
| | | } else if (['outerpage', 'blank', 'tab', 'pop', 'popview'].includes(value)) { |
| | | } else if (['outerpage', 'blank', 'tab', 'popview'].includes(value)) { |
| | | item.options = this.state.reqOptions |
| | | item.initVal = 'requiredSgl' |
| | | item.hidden = true |
| | |
| | | newid++ |
| | | } |
| | | copycard.id = newid |
| | | copycard.originCard = card |
| | | |
| | | copyElement(copycard) |
| | | } |
| | |
| | | import React, {Component} from 'react' |
| | | import { Row, Col, Icon, Radio, Input } from 'antd' |
| | | import { Row, Col, Icon, Radio, Input, Button } from 'antd' |
| | | import './index.scss' |
| | | |
| | | const { Search } = Input |
| | |
| | | <div className={'ant-card ant-card-bordered ' + (card.selected ? 'selected' : '')} > |
| | | <div className="base" onClick={this.changeSelect}> |
| | | <Icon type="check" /> |
| | | <p title={card.field}>字段: <span>{card.field}</span></p> |
| | | <p title={card.label}>名称: <span>{card.label}</span></p> |
| | | <p title={card.field}>{this.props.dict['header.form.field']}: <span>{card.field}</span></p> |
| | | <p title={card.label}>{this.props.dict['header.form.name']}: <span>{card.label}</span></p> |
| | | </div> |
| | | {type === 'search' ? |
| | | <Radio.Group onChange={this.changeType} value={card.type} disabled={!card.selected}> |
| | |
| | | dataSource: props.data, |
| | | selectCards: props.data.filter(item => item.selected), |
| | | type: props.type, |
| | | searchKey: '' |
| | | searchKey: '', |
| | | loading: false |
| | | } |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | reset = () => { |
| | | this.setState({ |
| | | searchKey: '', |
| | | loading: true |
| | | }, () => { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { dataSource, type } = this.state |
| | | const { dataSource, type, loading } = this.state |
| | | |
| | | return ( |
| | | <div className="common-modal-edit-card"> |
| | | <Row className="search-row"> |
| | | <Col span={8}> |
| | | <Search placeholder="请输入字段名" onSearch={value => {this.setState({searchKey: value})}} enterButton /> |
| | | {!loading ? <Search placeholder={this.props.dict['header.form.field.placeholder']} onSearch={value => {this.setState({searchKey: value})}} enterButton /> : null} |
| | | </Col> |
| | | <Col span={8}> |
| | | <Button onClick={this.reset}> |
| | | {this.props.dict['header.reset']} |
| | | </Button> |
| | | </Col> |
| | | </Row> |
| | | <Row> |
| | |
| | | if (item.field.toLowerCase().indexOf(this.state.searchKey.toLowerCase()) >= 0) { |
| | | return ( |
| | | <Col key={index} span={8}> |
| | | <EditCardCell ref={'cellCard' + index} type={type} card={item} changeCard={this.changeCard} /> |
| | | <EditCardCell ref={'cellCard' + index} type={type} card={item} dict={this.props.dict} changeCard={this.changeCard} /> |
| | | </Col> |
| | | ) |
| | | } else { |
| | |
| | | } |
| | | |
| | | state = { |
| | | operaType: '', // 操作类型,新建或编辑 |
| | | dict: CommonDict, // 字典 |
| | | config: null, // 页面配置 |
| | | visible: false, // 搜索条件、按钮、显示列,模态框显示控制 |
| | |
| | | tables: [], // 可用表名 |
| | | selectedTables: [], // 已选表名 |
| | | originMenu: null, // 原始菜单 |
| | | originActions: null |
| | | originActions: null, |
| | | delActions: [] |
| | | } |
| | | |
| | | /** |
| | |
| | | * 2、设置操作类型、原始菜单信息(每次保存后重置)、已使用表及基本信息表单 |
| | | */ |
| | | UNSAFE_componentWillMount () { |
| | | const { menu, type } = this.props |
| | | const { menu } = this.props |
| | | |
| | | let _LongParam = menu.LongParam |
| | | let _config = '' |
| | | let _type = type |
| | | |
| | | if (_type === 'add' || !_LongParam) { |
| | | _type = 'add' |
| | | if (!_LongParam) { |
| | | _config = JSON.parse(JSON.stringify((Source.baseConfig))) |
| | | } else { |
| | | let _setting = Source.baseConfig.setting |
| | |
| | | _LongParam.setting = _setting |
| | | _config = _LongParam |
| | | } |
| | | |
| | | let _oriActions = [] |
| | | if (_config.type === 'user') { |
| | | _config.action = _config.action.map(item => { |
| | | let uuid = Utils.getuuid() |
| | | |
| | | let _oriActions = _config.action |
| | | if (_config.type === 'user' || _config.type === 'system') { |
| | | _oriActions = [] |
| | | if (item.OpenType === 'pop') { // 含有子配置项的按钮。。。 |
| | | _oriActions.push({ |
| | | prebtn: JSON.parse(JSON.stringify(item)), |
| | | curuuid: uuid, |
| | | Template: 'Modal' |
| | | }) |
| | | } |
| | | |
| | | item.uuid = uuid |
| | | |
| | | return item |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | originActions: _oriActions, |
| | | config: _config, |
| | | operaType: _type, |
| | | originMenu: JSON.parse(JSON.stringify(menu)), |
| | | selectedTables: _config.tables || [], |
| | | menuformlist: [ |
| | |
| | | * 3、添加或编辑列,保存时,如按钮位置设置为表格,则修改操作列显示状态 |
| | | */ |
| | | handleSubmit = () => { |
| | | const { menu } = this.props |
| | | const { card } = this.state |
| | | let _config = JSON.parse(JSON.stringify(this.state.config)) |
| | | |
| | | if (this.state.formtemp !== 'gridbtn') { |
| | |
| | | } |
| | | res.values.dataSourceSql = Utils.formatOptions(sql) |
| | | } |
| | | } |
| | | |
| | | if (res.type === 'action' && card.originCard && res.values.OpenType === 'pop') { |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: card.originCard.uuid |
| | | }).then(result => { |
| | | if (result.status && result.LongParam) { |
| | | let param = { |
| | | func: 'sPC_ButtonParam_AddUpt', |
| | | ParentID: menu.MenuID, |
| | | MenuID: res.values.uuid, |
| | | MenuNo: menu.MenuNo, |
| | | Template: 'Modal', |
| | | MenuName: res.values.label, |
| | | PageParam: JSON.stringify({Template: 'Modal'}), |
| | | LongParam: result.LongParam |
| | | } |
| | | Api.getSystemConfig(param).then(response => { |
| | | if (!response.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: response.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | _config[res.type] = _config[res.type].map(item => { |
| | |
| | | } |
| | | |
| | | creatFunc = () => { |
| | | // let _config = JSON.parse(JSON.stringify(this.state.config)) |
| | | let _config = JSON.parse(JSON.stringify(this.state.config)) |
| | | |
| | | this.formRef.handleConfirm().then(res => { |
| | | let btn = res.values |
| | | let LText = '' |
| | | let DelText = '' |
| | | let isExit = false |
| | | |
| | | if (!btn.innerFunc) { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | } |
| | | |
| | | if (_LongParam) { |
| | | resolve(_LongParam) |
| | | let fields = [] |
| | | if (_LongParam.groups.length > 0) { |
| | | _LongParam.groups.forEach(group => { |
| | | fields = [...fields, ...group.sublist] |
| | | }) |
| | | } else { |
| | | fields = _LongParam.fields |
| | | } |
| | | |
| | | let _param = { |
| | | name: _config.setting.tableName || '', |
| | | fields: fields |
| | | } |
| | | LText = Utils.formatOptions(Utils.getfunc(_param)) |
| | | DelText = Utils.formatOptions(Utils.dropfunc(_param.name)) |
| | | resolve(true) |
| | | } else { |
| | | resolve(false) |
| | | notification.warning({ |
| | |
| | | } |
| | | }) |
| | | } else { |
| | | let _param = { |
| | | name: _config.setting.tableName || '', |
| | | fields: '' |
| | | } |
| | | LText = Utils.formatOptions(Utils.getfunc(_param)) |
| | | DelText = Utils.formatOptions(Utils.dropfunc(_param.name)) |
| | | resolve(true) |
| | | } |
| | | }).then(res => { |
| | | if (!res) return |
| | | LText = Utils.formatOptions(Utils.getfunc()) |
| | | console.log(LText) |
| | | console.log(res) |
| | | if (res === false) return res |
| | | |
| | | return Api.getSystemConfig({ |
| | | func: 'sPC_Get_TVP', |
| | | TVPName: btn.innerFunc |
| | | }) |
| | | }).then(res => { |
| | | console.log(res) |
| | | if (res.status) { |
| | | return true |
| | | } else { |
| | | if (res === false) return res |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | |
| | | }) |
| | | return false |
| | | } |
| | | |
| | | if (res.TVPText && LText === res.TVPText) { |
| | | return 'drop' |
| | | } else { |
| | | if (res.TVPText) { |
| | | isExit = true |
| | | } |
| | | return Api.getSystemConfig({ |
| | | func: 'sPC_TVP_InUp', |
| | | TVPName: btn.innerFunc, |
| | | TVPText: LText, |
| | | TypeName: 'P' |
| | | }) |
| | | } |
| | | }).then(res => { |
| | | console.log(res) |
| | | if (res === false || res === 'drop') return res |
| | | |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | return false |
| | | } else if (isExit) { |
| | | return 'drop' |
| | | } else { |
| | | return 'create' |
| | | } |
| | | }).then(res => { |
| | | console.log(res) |
| | | if (res === false || res === 'create') return res |
| | | |
| | | let _param = { |
| | | func: 'sPC_TableData_InUpDe', |
| | | LText: DelText |
| | | } |
| | | _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) |
| | | return Api.getSystemConfig(_param) |
| | | }).then(res => { |
| | | console.log(res) |
| | | if (res === false || res === 'create') return res |
| | | |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | return false |
| | | } else { |
| | | return 'create' |
| | | } |
| | | }).then(res => { |
| | | console.log(res) |
| | | if (res === false) return res |
| | | |
| | | let _param = { |
| | | func: 'sPC_TableData_InUpDe', |
| | | LText: LText |
| | | } |
| | | _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) |
| | | return Api.getSystemConfig(_param) |
| | | }).then(res => { |
| | | console.log(res) |
| | | if (res === false) return res |
| | | |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | return false |
| | | } else { |
| | | notification.success({ |
| | | top: 92, |
| | | message: '创建成功', |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }).then(res => { |
| | | console.log(res) |
| | | if (res === false) return res |
| | | |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | return false |
| | | } else { |
| | | notification.success({ |
| | | top: 92, |
| | | message: '创建成功', |
| | | duration: 5 |
| | | }) |
| | | return true |
| | | } |
| | | }).then(res => { |
| | | console.log(res) |
| | | if (res === false) return res |
| | | |
| | | let isupdate = false |
| | | _config.action = _config.action.map(item => { |
| | | if (item.uuid === res.values.uuid) { |
| | | isupdate = true |
| | | return res.values |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | _config.action = _config.action.filter(item => !item.origin) |
| | | |
| | | |
| | | if (!isupdate) { // 操作不是修改,添加元素至列表 |
| | | _config.action.push(res.values) |
| | | } |
| | | |
| | | let gridbtn = _config.action.filter(act => act.position === 'grid') |
| | | let _display = false |
| | | |
| | | if (gridbtn.length > 0) { |
| | | _display = true |
| | | } |
| | | |
| | | if (_config.gridBtn) { |
| | | _config.gridBtn.display = _display |
| | | } else { |
| | | _config.gridBtn = { |
| | | display: _display, |
| | | Align: 'center', |
| | | IsSort: 'false', |
| | | uuid: Utils.getuuid(), |
| | | label: this.state.dict['header.form.column.action'], |
| | | type: 'action', |
| | | style: 'button', |
| | | show: 'horizontal', |
| | | Width: 120 |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | config: _config, |
| | | actionloading: true |
| | | }, () => { |
| | | this.setState({ |
| | | actionloading: false |
| | | }) |
| | | }) |
| | | }) |
| | | |
| | | // let isupdate = false |
| | | // _config.action = _config.action.map(item => { |
| | | // if (item.uuid === res.values.uuid) { |
| | | // isupdate = true |
| | | // return res.values |
| | | // } else { |
| | | // return item |
| | | // } |
| | | // }) |
| | | // _config.action = _config.action.filter(item => !item.origin) |
| | | |
| | | |
| | | // if (!isupdate) { // 操作不是修改,添加元素至列表 |
| | | // _config.action.push(res.values) |
| | | // } |
| | | |
| | | // let gridbtn = _config.action.filter(act => act.position === 'grid') |
| | | // let _display = false |
| | | |
| | | // if (gridbtn.length > 0) { |
| | | // _display = true |
| | | // } |
| | | |
| | | // if (_config.gridBtn) { |
| | | // _config.gridBtn.display = _display |
| | | // } else { |
| | | // _config.gridBtn = { |
| | | // display: _display, |
| | | // Align: 'center', |
| | | // IsSort: 'false', |
| | | // uuid: Utils.getuuid(), |
| | | // label: this.state.dict['header.form.column.action'], |
| | | // type: 'action', |
| | | // style: 'button', |
| | | // show: 'horizontal', |
| | | // Width: 120 |
| | | // } |
| | | // } |
| | | |
| | | // this.setState({ |
| | | // config: _config, |
| | | // actionloading: true |
| | | // }, () => { |
| | | // this.setState({ |
| | | // actionloading: false |
| | | // }) |
| | | // }) |
| | | }) |
| | | } |
| | | |
| | |
| | | }) |
| | | _this.setState({ |
| | | config: _config, |
| | | delActions: [..._this.state.delActions, element.card.uuid], |
| | | [element.type + 'loading']: true |
| | | }, () => { |
| | | _this.setState({ |
| | |
| | | */ |
| | | submitConfig = () => { |
| | | const { menu } = this.props |
| | | const { config, originMenu } = this.state |
| | | const { originMenu } = this.state |
| | | |
| | | let config = JSON.parse(JSON.stringify(this.state.config)) |
| | | |
| | | this.menuformRef.handleConfirm().then(res => { |
| | | config.search = config.search.filter(item => !item.origin) |
| | | config.action = config.action.filter(item => !item.origin) |
| | | config.columns = config.columns.filter(item => !item.origin) |
| | | // if (config.search[0] && config.search[0].origin) { |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: '请设置搜索条件', |
| | | // duration: 10 |
| | | // }) |
| | | // return |
| | | // } |
| | | // if (config.action[0] && config.action[0].origin) { |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: '请设置按钮', |
| | | // duration: 10 |
| | | // }) |
| | | // return |
| | | // } |
| | | // if (config.columns[0] && config.columns[0].origin) { |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: '请设置显示列', |
| | | // duration: 10 |
| | | // }) |
| | | // return |
| | | // } |
| | | |
| | | if (config.search[0] && config.search[0].origin) { |
| | | config.search = config.search.filter(item => !item.origin) |
| | | } |
| | | if (config.action[0] && config.action[0].origin) { |
| | | config.action = config.action.filter(item => !item.origin) |
| | | } |
| | | if (config.columns[0] && config.columns[0].origin) { |
| | | config.columns = config.columns.filter(item => !item.origin) |
| | | } |
| | | |
| | | let _LongParam = '' |
| | | let _config = {...config, tables: this.state.selectedTables} |
| | |
| | | btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp) |
| | | |
| | | if (this.state.operaType === 'add') { // 新建菜单 |
| | | let param = { |
| | | func: 'sPC_TrdMenu_Add', |
| | | ParentID: res.parentId, |
| | | MenuID: menu.MenuID, |
| | | MenuNo: res.menuNo, |
| | | Template: menu.PageParam.Template || '', |
| | | MenuName: res.menuName, |
| | | PageParam: JSON.stringify(_pageParam), |
| | | LongParam: _LongParam |
| | | } |
| | | |
| | | if (this.state.closeVisible) { // 显示关闭对话框时,模态框中保存按钮,显示保存中状态 |
| | | this.setState({ |
| | | menucloseloading: true |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: true |
| | | }) |
| | | } |
| | | |
| | | Api.getSystemConfig(param).then(response => { |
| | | if (response.status) { |
| | | this.setState({ |
| | | operaType: 'edit', |
| | | originMenu: { |
| | | ...originMenu, |
| | | LongParam: _config, |
| | | PageParam: _pageParam, |
| | | MenuName: res.menuName, |
| | | MenuNo: res.menuNo, |
| | | ParentID: res.parentId |
| | | } |
| | | }) |
| | | this.submitAction(btnParam) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false, |
| | | menucloseloading: false |
| | | }) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: response.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | let param = { |
| | | func: 'sPC_TrdMenu_AddUpt', |
| | | ParentID: res.parentId, |
| | | MenuID: menu.MenuID, |
| | | MenuNo: res.menuNo, |
| | | Template: menu.PageParam.Template || '', |
| | | MenuName: res.menuName, |
| | | Sort: (this.props.supMenuList.length + 1) * 10, |
| | | PageParam: JSON.stringify(_pageParam), |
| | | LongParam: _LongParam |
| | | } |
| | | |
| | | if (this.state.closeVisible) { // 显示关闭对话框时,模态框中保存按钮,显示保存中状态 |
| | | this.setState({ |
| | | menucloseloading: true |
| | | }) |
| | | } else { // 修改菜单 |
| | | let param = { |
| | | func: 'sPC_TrdMenu_Upt', |
| | | ParentID: res.parentId, |
| | | MenuID: menu.MenuID, |
| | | MenuNo: res.menuNo, |
| | | Template: menu.PageParam.Template || '', |
| | | MenuName: res.menuName, |
| | | PageParam: JSON.stringify(_pageParam), |
| | | LongParam: _LongParam |
| | | } |
| | | |
| | | if (this.state.closeVisible) { // 显示关闭对话框时,模态框中保存按钮,显示保存中状态 |
| | | this.setState({ |
| | | menucloseloading: true |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: true |
| | | }) |
| | | } |
| | | |
| | | Api.getSystemConfig(param).then(response => { |
| | | if (response.status) { |
| | | this.setState({ |
| | | originMenu: { |
| | | ...originMenu, |
| | | LongParam: _config, |
| | | PageParam: _pageParam, |
| | | MenuName: res.menuName, |
| | | MenuNo: res.menuNo, |
| | | ParentID: res.parentId |
| | | } |
| | | }) |
| | | this.submitAction(btnParam) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false, |
| | | menucloseloading: false |
| | | }) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: response.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | menuloading: true |
| | | }) |
| | | } |
| | | |
| | | Api.getSystemConfig(param).then(response => { |
| | | if (response.status) { |
| | | this.setState({ |
| | | config: _config, |
| | | originMenu: { |
| | | ...originMenu, |
| | | LongParam: _config, |
| | | PageParam: _pageParam, |
| | | MenuName: res.menuName, |
| | | MenuNo: res.menuNo, |
| | | ParentID: res.parentId |
| | | }, |
| | | searchloading: true, |
| | | actionloading: true, |
| | | columnsloading: true |
| | | }, () => { |
| | | this.setState({ |
| | | searchloading: false, |
| | | actionloading: false, |
| | | columnsloading: false |
| | | }) |
| | | }) |
| | | |
| | | this.submitAction(btnParam) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false, |
| | | menucloseloading: false |
| | | }) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: response.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | }, () => { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | * @description 保存或修改菜单按钮 |
| | | */ |
| | | submitAction = (param) => { |
| | | Api.getSystemConfig(param).then(response => { |
| | | if (response.status) { |
| | | const { config } = this.state |
| | | new Promise(resolve => { |
| | | // 内部请求 |
| | | Api.getSystemConfig(param).then(response => { |
| | | if (response.status) { |
| | | resolve('true') |
| | | } else { |
| | | resolve(response) |
| | | } |
| | | }) |
| | | }).then(res => { |
| | | console.log(res) |
| | | if (res === 'true' && this.state.delActions.length > 0) { |
| | | let deffers = this.state.delActions.map(item => { |
| | | let param = { |
| | | func: 'sPC_MainMenu_Del', |
| | | MenuID: item |
| | | } |
| | | return new Promise(resolve => { |
| | | Api.getSystemConfig(param).then(res => { |
| | | resolve(res) |
| | | }) |
| | | }) |
| | | }) |
| | | return Promise.all(deffers) |
| | | } else if (res === 'true' && this.state.delActions.length === 0) { |
| | | return 'copy' |
| | | } else if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | return false |
| | | } |
| | | }).then(response => { |
| | | console.log(response) |
| | | if (response === false || response === 'copy') return response |
| | | |
| | | let res = 'copy' |
| | | if (Array.isArray(response)) { |
| | | response.forEach(result => { |
| | | if (!result.status) { |
| | | res = result |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (res === 'copy') return 'copy' |
| | | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | return false |
| | | }).then(response => { |
| | | console.log(response) |
| | | if (response === false) return response |
| | | |
| | | let oriActions = [] |
| | | this.state.originActions.forEach(item => { |
| | | let curBtn = config.action.filter(cell => item.curuuid === cell.uuid)[0] // 查看初始化按钮是否存在 |
| | | if (!curBtn) return |
| | | if (curBtn.OpenType !== item.prebtn.OpenType) return |
| | | |
| | | oriActions.push({ |
| | | prebtn: item.prebtn, |
| | | curBtn: item.curBtn |
| | | }) |
| | | }) |
| | | |
| | | if (oriActions.length === 0) return 'true' |
| | | |
| | | oriActions.forEach(action => { |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: action.prebtn ? action.prebtn.uuid : '' |
| | | }).then(result => { |
| | | if (result.status && result.LongParam) { |
| | | let _LongParam = '' |
| | | |
| | | if (result.LongParam) { |
| | | _LongParam = window.decodeURIComponent(window.atob(result.LongParam)) |
| | | try { |
| | | _LongParam = JSON.parse(_LongParam) |
| | | } catch (e) { |
| | | _LongParam = '' |
| | | } |
| | | } |
| | | |
| | | if (_LongParam) { |
| | | let param = { |
| | | func: 'sPC_ButtonParam_AddUpt', |
| | | ParentID: this.props.menu.MenuID, |
| | | MenuID: action.curBtn.uuid, |
| | | MenuNo: this.props.menu.MenuNo, |
| | | Template: _LongParam.type, |
| | | MenuName: action.curBtn.label, |
| | | PageParam: JSON.stringify({Template: _LongParam.type}), |
| | | LongParam: result.LongParam |
| | | } |
| | | Api.getSystemConfig(param).then(() => {}) |
| | | } |
| | | } |
| | | }) |
| | | }) |
| | | return 'true' |
| | | }).then(response => { |
| | | console.log(response) |
| | | if (response === 'true') { |
| | | notification.success({ |
| | | top: 92, |
| | | message: '保存成功', |
| | |
| | | menuloading: false, |
| | | menucloseloading: false |
| | | }) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: response.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | |
| | | cancelConfig = () => { |
| | | const { menu } = this.props |
| | | const { config, originMenu } = this.state |
| | | let _this = this |
| | | |
| | | if (this.state.operaType === 'add') { |
| | | let _this = this |
| | | let isAdd = false |
| | | |
| | | if ( |
| | | (config.search[0] && config.search[0].origin) || |
| | | (config.action[0] && config.action[0].origin) || |
| | | (config.columns[0] && config.columns[0].origin) |
| | | ) { |
| | | isAdd = true |
| | | } |
| | | |
| | | if (isAdd) { |
| | | confirm({ |
| | | content: '菜单尚未提交,确定放弃保存吗?', |
| | | okText: this.state.dict['header.confirm'], |
| | |
| | | } |
| | | |
| | | this.setState({ |
| | | tableVisible: false, |
| | | [addType + 'loading']: true, |
| | | addType: '', |
| | | config: {...config, [addType]: items} |
| | | }, () => { |
| | | notification.success({ |
| | | top: 92, |
| | | message: '操作成功', |
| | | duration: 5 |
| | | }) |
| | | this.setState({ |
| | | [addType + 'loading']: false |
| | | }) |
| | |
| | | const { menu } = this.props |
| | | const { config, originMenu } = this.state |
| | | |
| | | if (this.state.operaType === 'add') { |
| | | let isAdd = false |
| | | |
| | | if ( |
| | | (config.search[0] && config.search[0].origin) || |
| | | (config.action[0] && config.action[0].origin) || |
| | | (config.columns[0] && config.columns[0].origin) |
| | | ) { |
| | | isAdd = true |
| | | } |
| | | |
| | | if (isAdd) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '菜单尚未保存,请保存菜单配置!', |
| | |
| | | _LongParam = '' |
| | | } |
| | | } |
| | | |
| | | console.log(_LongParam) |
| | | this.props.handleSubConfig(btn, originMenu, _LongParam) |
| | | } else { |
| | | this.setState({ |
| | |
| | | onOk={this.handleSubmit} |
| | | footer={[ |
| | | this.state.formtemp === 'action' ? |
| | | <Button key="delete" className="mk-btn mk-purple" onClick={this.creatFunc} loading={this.state.confirmLoading}>{this.state.dict['header.delete']}</Button> : null, |
| | | <Button key="delete" className="mk-btn mk-purple" onClick={this.creatFunc} loading={this.state.confirmLoading}>{this.state.dict['header.menu.func.create']}</Button> : null, |
| | | <Button key="cancel" onClick={() => { this.setState({ visible: false }) }}>{this.state.dict['header.cancel']}</Button>, |
| | | <Button key="confirm" type="primary" onClick={this.handleSubmit}>{this.state.dict['header.confirm']}</Button> |
| | | ]} |
| | |
| | | visible={this.state.tableVisible} |
| | | width={'65vw'} |
| | | style={{minWidth: '900px', maxWidth: '1200px'}} |
| | | cancelText={this.state.dict['header.close']} |
| | | onOk={this.addFieldSubmit} |
| | | onCancel={() => { // 取消添加 |
| | | this.setState({ |
| | |
| | | destroyOnClose |
| | | > |
| | | {this.state.addType && this.state.fields.length > 0 ? |
| | | <EditCard data={this.state.fields} ref="searchcard" type={this.state.addType} /> : null |
| | | <EditCard data={this.state.fields} ref="searchcard" type={this.state.addType} dict={this.state.dict} /> : null |
| | | } |
| | | {(!this.state.fields || this.state.fields.length === 0) && |
| | | <Empty /> |
| | |
| | | origin: true, |
| | | id: 0, |
| | | uuid: Utils.getuuid(), |
| | | label: 'text', |
| | | label: 'label', |
| | | field: '', |
| | | initval: '', |
| | | type: 'text', |
| | |
| | | origin: true, |
| | | id: 1, |
| | | uuid: Utils.getuuid(), |
| | | label: 'select', |
| | | label: 'label', |
| | | field: '', |
| | | initval: '', |
| | | type: 'select', |
| | |
| | | origin: true, |
| | | id: 2, |
| | | uuid: Utils.getuuid(), |
| | | label: 'date', |
| | | label: 'label', |
| | | field: '', |
| | | initval: '', |
| | | type: 'date', |
| | |
| | | url: '', |
| | | icon: 'delete', |
| | | class: 'red' |
| | | }, { |
| | | origin: true, |
| | | id: 3, |
| | | uuid: Utils.getuuid(), |
| | | label: 'freeze', |
| | | intertype: 'inner', |
| | | innerFunc: '', |
| | | interface: '', |
| | | method: 'POST', |
| | | outerFunc: '', |
| | | sql: '', |
| | | sqlType: '', |
| | | callbackFunc: '', |
| | | Ot: 'requiredOnce', |
| | | position: 'toolbar', |
| | | OpenType: 'exec', |
| | | pageTemplate: '', |
| | | url: '', |
| | | icon: '', |
| | | class: 'default' |
| | | } |
| | | ], |
| | | columns: [ |
| | |
| | | id: 0, |
| | | uuid: Utils.getuuid(), |
| | | Align: 'left', |
| | | label: 'fieldName1', |
| | | label: 'label', |
| | | field: '', |
| | | Hide: 'false', |
| | | IsSort: 'true', |
| | |
| | | id: 1, |
| | | uuid: Utils.getuuid(), |
| | | Align: 'left', |
| | | label: 'fieldName2', |
| | | label: 'label', |
| | | field: '', |
| | | Hide: 'false', |
| | | IsSort: 'true', |
| | |
| | | id: 2, |
| | | uuid: Utils.getuuid(), |
| | | Align: 'left', |
| | | label: 'fieldName3', |
| | | label: 'label', |
| | | field: '', |
| | | Hide: 'false', |
| | | IsSort: 'true', |
| | |
| | | id: 3, |
| | | uuid: Utils.getuuid(), |
| | | Align: 'left', |
| | | label: 'fieldName4', |
| | | label: 'label', |
| | | field: '', |
| | | Hide: 'false', |
| | | IsSort: 'true', |
| | |
| | | * @return {String} name 存储过程名称 |
| | | */ |
| | | static dropfunc (name) { |
| | | return `IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID('${name}') AND type in (N'P', N'PC')) DROP PROCEDURE ${name}` |
| | | return `IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID('${name}') AND type in (N'P', N'PC')) mdrpk PROCEDURE ${name}` |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return {String} |
| | | */ |
| | | static getfunc (param) { |
| | | param = { |
| | | name: 'ls' |
| | | let form = '' |
| | | if (param.fields && param.fields.length > 0) { |
| | | let _fields = [] |
| | | param.fields.forEach(item => { |
| | | if (item.field) { |
| | | _fields.push(item.field) |
| | | } |
| | | }) |
| | | |
| | | let field1 = _fields.join(',') |
| | | let field2 = _fields.join(',@') |
| | | let field3 = _fields.map(cell => { |
| | | return cell + '=@' + cell |
| | | }) |
| | | |
| | | field2 = field2 ? '@' + field2 : '' |
| | | field3 = field3.join(',') |
| | | |
| | | form = ` |
| | | insert into ${param.name} (${field1}) select ${field2},@UserID |
| | | |
| | | update ${param.name} set ${field3},modifydate=getdate(),modifyuserid=@UserID |
| | | ` |
| | | } |
| | | |
| | | let Ltext = `create proc ${param.name} |
| | | ( |
| | | @BID nvarchar(50)='', |
| | |
| | | declare @UserName nvarchar(50),@FullName nvarchar(50) |
| | | |
| | | select @UserName=UserName,@FullName=FullName from SUsers where UID=@UserID |
| | | |
| | | insert into 表名 (表单字段) select 对应入参,创建人 |
| | | |
| | | update 表名 set 表单字段=对应入参,modifydate=getdate(),modifyuserid=@UserID |
| | | |
| | | ${form} |
| | | if 1=2 |
| | | begin |
| | | set @ErrorCode='E' |
| | |
| | | ROLLBACK TRAN |
| | | |
| | | END` |
| | | return Ltext.replace(/\n\s{4}/ig, '\'char(13)\'') |
| | | Ltext = Ltext.replace(/\n\s{4}/ig, 'mchr13k') |
| | | console.log(Ltext) |
| | | return Ltext |
| | | } |
| | | } |