| | |
| | | columnChange = (values) => { |
| | | const { columns } = this.state |
| | | |
| | | let fields = columns.map(item => item.field) |
| | | if (fields.includes(values.field)) { |
| | | let fields = columns.map(item => item.field.toLowerCase()) |
| | | if (fields.includes(values.field.toLowerCase())) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '字段已存在!', |
| | |
| | | import SettingForm from '@/templates/modalconfig/settingform' |
| | | import GroupForm from '@/templates/modalconfig/groupform' |
| | | import EditCard from '@/templates/modalconfig/editcard' |
| | | import EditComponent from '@/templates/zshare/editcomponent' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import { SearchItems } from '@/templates/modalconfig/source' |
| | | import './index.scss' |
| | | |
| | | const { Panel } = Collapse |
| | | const { confirm } = Modal |
| | | const CommonDict = localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS |
| | | const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent')) |
| | | |
| | | class ComModalConfig extends Component { |
| | | static propTpyes = { |
| | |
| | | if (_config.groups.length > 0) { |
| | | _config.groups.forEach(group => { |
| | | group.sublist = group.sublist.map(item => { |
| | | if (item.uuid !== res.uuid && item.field === res.field) { |
| | | if (item.uuid !== res.uuid && item.field.toLowerCase() === res.field.toLowerCase()) { |
| | | fieldrepet = true |
| | | } else if (item.uuid !== res.uuid && item.label === res.label) { |
| | | labelrepet = true |
| | |
| | | }) |
| | | } else { |
| | | _config.fields = _config.fields.map(item => { |
| | | if (item.uuid !== res.uuid && item.field === res.field) { |
| | | if (item.uuid !== res.uuid && item.field.toLowerCase() === res.field.toLowerCase()) { |
| | | fieldrepet = true |
| | | } else if (item.uuid !== res.uuid && item.label === res.label) { |
| | | labelrepet = true |
| | |
| | | updateConfig = (res) => { |
| | | if (res.type === 'paste') { |
| | | this.setState({ |
| | | config: res.content |
| | | config: res.config |
| | | }) |
| | | } |
| | | } |
| | |
| | | <div className="setting"> |
| | | <Card title={this.state.dict['header.menu.form.configurable']} bordered={false} extra={ |
| | | <div> |
| | | <EditComponent dict={this.state.dict} type="form" config={this.state.config} refresh={this.updateConfig}/> |
| | | <EditComponent dict={this.state.dict} options={['form']} config={this.state.config} refresh={this.updateConfig}/> |
| | | <Button type="primary" onClick={this.submitConfig}>{this.state.dict['model.confirm']}</Button> |
| | | <Button onClick={this.cancelConfig}>{this.state.dict['model.cancel']}</Button> |
| | | </div> |
| | |
| | | initialValue: element.content |
| | | })(element.eleType !== 'textarea' ? |
| | | <Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} /> : |
| | | <TextArea autosize={{ minRows: 2, maxRows: 3 }} onPressEnter={this.handleSubmit} /> |
| | | <TextArea autoSize={{ minRows: 2, maxRows: 3 }} onPressEnter={this.handleSubmit} /> |
| | | )} |
| | | {element.eleType === 'link' ? <div className="link-url"> |
| | | <p>链接地址:</p> |
| | |
| | | * @description 获取页面配置信息 |
| | | */ |
| | | async loadconfig () { |
| | | const { permAction, permMenus, param } = this.props |
| | | const { permAction, permMenus, param, MenuName } = this.props |
| | | |
| | | let _param = { |
| | | func: 'sPC_Get_LongParam', |
| | |
| | | let _operations = [] // 操作列按钮(存在时) |
| | | |
| | | config.action.forEach(item => { |
| | | item.logLabel = MenuName + '-' + item.label // 用于sPC_TableData_InUpDe记录操作按钮 |
| | | if (item.execMode) { |
| | | item.OpenType = 'funcbutton' |
| | | } |
| | |
| | | setting={setting} |
| | | actions={actions} |
| | | columns={columns} |
| | | MenuName={MenuName} |
| | | dict={this.state.dict} |
| | | MenuID={this.props.MenuID} |
| | | selectedData={selectedData} |
| | |
| | | pickup={pickup} |
| | | setting={setting} |
| | | columns={columns} |
| | | MenuName={MenuName} |
| | | pageSize={pageSize} |
| | | dict={this.state.dict} |
| | | data={this.state.data} |
| | |
| | | plot={item} |
| | | config={config} |
| | | columns={columns} |
| | | MenuName={MenuName} |
| | | tableId="mainTable" |
| | | data={this.state.data} |
| | | MenuID={this.props.MenuID} |
| | |
| | | BID={BID} |
| | | plot={item} |
| | | config={config} |
| | | MenuName={MenuName} |
| | | data={this.state.data} |
| | | getexceloutparam={this.getexceloutparam} |
| | | loading={this.state.loading} |
| | |
| | | |
| | | class CardBoxComponent extends Component { |
| | | static propTpyes = { |
| | | BID: PropTypes.any, // 上级ID |
| | | cards: PropTypes.object, // 卡片行配置信息 |
| | | card: PropTypes.object, // 卡片配置信息 |
| | | data: PropTypes.object, |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { card, data, BID, cards } = this.props |
| | | const { card, data, cards } = this.props |
| | | |
| | | return ( |
| | | <div className="card-item-box" style={card.style}> |
| | | <CardCellComponent BID={BID} data={data} cards={cards} cardCell={card} elements={card.elements} updateStatus={this.props.updateStatus}/> |
| | | <CardCellComponent data={data} cards={cards} cardCell={card} elements={card.elements} updateStatus={this.props.updateStatus}/> |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | |
| | | class CardCellComponent extends Component { |
| | | static propTpyes = { |
| | | BID: PropTypes.any, // 上级ID |
| | | seq: PropTypes.any, // 序号 |
| | | cards: PropTypes.object, // 菜单配置信息 |
| | | cardCell: PropTypes.object, |
| | |
| | | con = '&' |
| | | } |
| | | |
| | | if (cards.subtype === 'propcard') { |
| | | if (cards.subtype === 'propcard' && cardCell) { |
| | | Id = cardCell.setting.primaryId || '' |
| | | } else { |
| | | Id = data[cards.setting.primaryKey] || '' |
| | |
| | | } |
| | | |
| | | getContent = (card) => { |
| | | const { data, BID, cards, seq } = this.props |
| | | const { data, cards, seq } = this.props |
| | | |
| | | if (card.eleType === 'sequence') { |
| | | return ( |
| | |
| | | <Col key={card.uuid} span={card.width}> |
| | | <div style={card.style}> |
| | | <NormalButton |
| | | BID={BID} |
| | | BID={data.$$BID} |
| | | btn={card} |
| | | show={card.show} |
| | | style={card.btnstyle} |
| | |
| | | <Col key={card.uuid} span={card.width}> |
| | | <div style={card.style}> |
| | | <ExcelInButton |
| | | BID={BID} |
| | | BID={data.$$BID} |
| | | btn={card} |
| | | show={card.show} |
| | | style={card.btnstyle} |
| | |
| | | <Col key={card.uuid} span={card.width}> |
| | | <div style={card.style}> |
| | | <ExcelOutButton |
| | | BID={BID} |
| | | BID={data.$$BID} |
| | | btn={card} |
| | | show={card.show} |
| | | style={card.btnstyle} |
| | |
| | | <Col key={card.uuid} span={card.width}> |
| | | <div style={card.style}> |
| | | <PopupButton |
| | | BID={BID} |
| | | BID={data.$$BID} |
| | | btn={card} |
| | | show={card.show} |
| | | style={card.btnstyle} |
| | |
| | | <Col key={card.uuid} span={card.width}> |
| | | <div style={card.style}> |
| | | <ChangeUserButton |
| | | BID={BID} |
| | | BID={data.$$BID} |
| | | btn={card} |
| | | show={card.show} |
| | | style={card.btnstyle} |
| | |
| | | <Col key={card.uuid} span={card.width}> |
| | | <div style={card.style}> |
| | | <PrintButton |
| | | BID={BID} |
| | | BID={data.$$BID} |
| | | btn={card} |
| | | show={card.show} |
| | | style={card.btnstyle} |
| | |
| | | } |
| | | |
| | | state = { |
| | | BID: '', // 上级ID |
| | | config: null, // 图表配置信息 |
| | | pageIndex: 1, |
| | | pageIndex: 1, // 页码 |
| | | activeKey: '', // 选中卡 |
| | | loading: false, // 数据加载状态 |
| | | sync: false, // 是否统一请求数据 |
| | |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { data, initdata } = this.props |
| | | const { data, initdata, BID } = this.props |
| | | let _config = fromJS(this.props.config).toJS() |
| | | let _card = _config.subcards[0] |
| | | let _cols = new Map() |
| | |
| | | } else if (_config.setting.sync === 'true' && initdata) { |
| | | _data = initdata || [] |
| | | _sync = false |
| | | } |
| | | |
| | | if (_data) { |
| | | _data = _data.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[_config.setting.primaryKey] || '' |
| | | item.$$BID = BID || '' |
| | | return item |
| | | }) |
| | | } |
| | | |
| | | _config.columns.forEach(item => { |
| | |
| | | this.setState({ |
| | | sync: _sync, |
| | | data: _data, |
| | | BID: BID || '', |
| | | config: _config, |
| | | card: _card, |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('syncRefreshComponentId', this.reload) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | const { sync, config } = this.state |
| | | const { sync, config, BID } = this.state |
| | | |
| | | if (sync && !is(fromJS(this.props.data), fromJS(nextProps.data))) { |
| | | let _data = [] |
| | | if (nextProps.data && nextProps.data[config.dataName]) { |
| | | _data = nextProps.data[config.dataName] || [] |
| | | } |
| | | |
| | | _data = _data.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$$BID = BID || '' |
| | | return item |
| | | }) |
| | | |
| | | this.setState({sync: false, data: _data}) |
| | | } else if (!is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { |
| | |
| | | return |
| | | } |
| | | MKEmitter.removeListener('syncRefreshComponentId', this.reload) |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | } |
| | | |
| | | reload = (syncId) => { |
| | |
| | | }) |
| | | } |
| | | |
| | | resetParentParam = (MenuID, id) => { |
| | | const { config } = this.state |
| | | |
| | | if (!config.setting.supModule || config.setting.supModule !== MenuID) return |
| | | if (id !== this.state.BID) { |
| | | this.setState({ BID: id }, () => { |
| | | this.loadData() |
| | | }) |
| | | } |
| | | } |
| | | |
| | | async loadData () { |
| | | const { mainSearch, BID, menuType } = this.props |
| | | const { config, arr_field, pageIndex } = this.state |
| | | const { mainSearch, menuType } = this.props |
| | | const { config, arr_field, pageIndex, BID } = this.state |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | this.setState({ |
| | | activeKey: '', |
| | | pageIndex: 1, |
| | | data: [], |
| | | total: 0, |
| | | loading: false |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let searches = [] |
| | | if (mainSearch && mainSearch.length > 0) { // 主表搜索条件 |
| | |
| | | if (result.status) { |
| | | this.setState({ |
| | | activeKey: '', |
| | | data: result.data, |
| | | data: result.data.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$$BID = BID || '' |
| | | return item |
| | | }), |
| | | total: result.total, |
| | | loading: false |
| | | }) |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { BID } = this.props |
| | | const { config, loading, data, pageIndex, total, card, activeKey } = this.state |
| | | |
| | | let _total = config.setting.pageSize * pageIndex |
| | |
| | | {data && data.length > 0 ? <div className="card-row-list"> |
| | | {data.map((item, index) => ( |
| | | <Col className={activeKey === index ? 'active' : ''} key={index} span={card.setting.width || 6} onClick={() => {this.changeCard(index, item)}}> |
| | | <CardItem BID={BID} card={card} cards={config} data={item} updateStatus={this.updateStatus}/> |
| | | <CardItem card={card} cards={config} data={item} updateStatus={this.updateStatus}/> |
| | | </Col> |
| | | ))} |
| | | </div> : null} |
| | |
| | | } |
| | | |
| | | state = { |
| | | BID: '', // 上级ID |
| | | config: null, // 图表配置信息 |
| | | loading: false, // 数据加载状态 |
| | | activeKey: '', // 选中数据 |
| | |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { data, initdata } = this.props |
| | | const { data, initdata, BID } = this.props |
| | | let _config = fromJS(this.props.config).toJS() |
| | | let _cols = new Map() |
| | | |
| | |
| | | _data = {} |
| | | } |
| | | |
| | | if (_data) { |
| | | _data.$$BID = BID || '' |
| | | } |
| | | |
| | | _config.columns.forEach(item => { |
| | | _cols.set(item.field, item) |
| | | }) |
| | |
| | | this.setState({ |
| | | sync: _sync, |
| | | data: _data, |
| | | BID: BID || '', |
| | | config: _config, |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | }, () => { |
| | |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('syncRefreshComponentId', this.reload) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | return |
| | | } |
| | | MKEmitter.removeListener('syncRefreshComponentId', this.reload) |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | } |
| | | |
| | | /** |
| | | * @description 图表数据更新,刷新内容 |
| | | */ |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | const { sync, config } = this.state |
| | | const { sync, config, BID } = this.state |
| | | |
| | | if (sync && !is(fromJS(this.props.data), fromJS(nextProps.data))) { |
| | | let _data = {} |
| | |
| | | _data = nextProps.data[config.dataName] |
| | | if (_data && Array.isArray(_data)) { |
| | | _data = _data[0] |
| | | } else { |
| | | _data = {} |
| | | } |
| | | } |
| | | if (_data) { |
| | | _data.$$BID = BID || '' |
| | | } |
| | | |
| | | this.setState({sync: false, data: _data}) |
| | |
| | | } |
| | | } |
| | | |
| | | resetParentParam = (MenuID, id) => { |
| | | const { config } = this.state |
| | | |
| | | if (config.wrap.datatype === 'static' || !config.setting.supModule || config.setting.supModule !== MenuID) return |
| | | if (id !== this.state.BID) { |
| | | this.setState({ BID: id }, () => { |
| | | this.loadData() |
| | | }) |
| | | } |
| | | } |
| | | |
| | | reload = (syncId) => { |
| | | const { config } = this.state |
| | | |
| | |
| | | } |
| | | |
| | | async loadData () { |
| | | const { mainSearch, BID, menuType } = this.props |
| | | const { config, arr_field } = this.state |
| | | const { mainSearch, menuType } = this.props |
| | | const { config, arr_field, BID } = this.state |
| | | |
| | | if (config.wrap.datatype === 'static') { |
| | | this.setState({ |
| | | data: {$$BID: BID || ''}, |
| | | loading: false |
| | | }) |
| | | return |
| | | } else if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | this.setState({ |
| | | data: {$$BID: BID || ''}, |
| | | loading: false |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let searches = [] |
| | | if (mainSearch && mainSearch.length > 0) { // 主表搜索条件 |
| | |
| | | }) |
| | | } |
| | | |
| | | if (config.wrap.datatype === 'static') { |
| | | this.setState({ |
| | | loading: false, |
| | | data: {} |
| | | }) |
| | | return |
| | | } else { |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | } |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | |
| | | let _orderBy = config.setting.order || '' |
| | | let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, 1, 1, BID, menuType) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | let _data = result.data && result.data[0] ? result.data[0] : {} |
| | | _data.$$BID = BID || '' |
| | | |
| | | this.setState({ |
| | | activeKey: '', |
| | | data: result.data && result.data[0] ? result.data[0] : {}, |
| | | data: _data, |
| | | loading: false |
| | | }) |
| | | } else { |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { BID } = this.props |
| | | const { config, loading, data, activeKey } = this.state |
| | | |
| | | return ( |
| | |
| | | <div className="card-row-list"> |
| | | {config.subcards.map((item, index) => ( |
| | | <Col className={activeKey === index ? 'active' : ''} key={index} span={item.setting.width || 6} onClick={() => {this.changeCard(index, item)}}> |
| | | <CardItem BID={BID} card={item} cards={config} data={data} updateStatus={this.updateStatus}/> |
| | | <CardItem card={item} cards={config} data={data} updateStatus={this.updateStatus}/> |
| | | </Col> |
| | | ))} |
| | | </div> |
| | |
| | | } |
| | | |
| | | state = { |
| | | BID: '', // 上级ID |
| | | config: null, // 图表配置信息 |
| | | loading: false, // 数据加载状态 |
| | | preIndex: 0, // 开始索引 |
| | |
| | | * 1、 initdata 为打印时使用的数据集 |
| | | */ |
| | | UNSAFE_componentWillMount () { |
| | | const { data, initdata } = this.props |
| | | const { data, initdata, BID } = this.props |
| | | let _config = fromJS(this.props.config).toJS() |
| | | let _cols = new Map() |
| | | |
| | |
| | | } else if (_config.setting.sync === 'true' && initdata) { |
| | | _data = initdata || [] |
| | | _sync = false |
| | | } |
| | | |
| | | if (_data) { |
| | | _data = _data.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[_config.setting.primaryKey] || '' |
| | | item.$$BID = BID || '' |
| | | return item |
| | | }) |
| | | } |
| | | |
| | | let showHeader = false |
| | |
| | | showHeader: showHeader, |
| | | title: _config.wrap.title, |
| | | sync: _sync, |
| | | BID: BID || '', |
| | | data: _data, |
| | | config: _config, |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('syncRefreshComponentId', this.reload) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | return |
| | | } |
| | | MKEmitter.removeListener('syncRefreshComponentId', this.reload) |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | } |
| | | |
| | | /** |
| | | * @description 图表数据更新,刷新内容 |
| | | */ |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | const { sync, config } = this.state |
| | | const { sync, config, BID } = this.state |
| | | |
| | | if (sync && !is(fromJS(this.props.data), fromJS(nextProps.data))) { |
| | | let _data = [] |
| | | if (nextProps.data && nextProps.data[config.dataName]) { |
| | | _data = nextProps.data[config.dataName] || [] |
| | | } |
| | | |
| | | _data = _data.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$$BID = BID || '' |
| | | return item |
| | | }) |
| | | |
| | | this.setState({sync: false, data: _data}) |
| | | } else if (!is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { |
| | |
| | | this.loadData() |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | |
| | | resetParentParam = (MenuID, id) => { |
| | | const { config } = this.state |
| | | |
| | | if (!config.setting.supModule || config.setting.supModule !== MenuID) return |
| | | if (id !== this.state.BID) { |
| | | this.setState({ BID: id }, () => { |
| | | this.loadData() |
| | | }) |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | async loadData () { |
| | | const { mainSearch, BID, menuType } = this.props |
| | | const { config, arr_field, pageIndex } = this.state |
| | | const { mainSearch, menuType } = this.props |
| | | const { config, arr_field, pageIndex, BID } = this.state |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | this.setState({ |
| | | data: [], |
| | | total: 0, |
| | | preIndex: 0 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let searches = [] |
| | | if (mainSearch && mainSearch.length > 0) { // 主表搜索条件 |
| | |
| | | } |
| | | |
| | | this.setState({ |
| | | data: result.data, |
| | | data: result.data.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$$BID = BID || '' |
| | | return item |
| | | }), |
| | | total: result.total, |
| | | preIndex: _preIndex, |
| | | loading: false |
| | |
| | | } |
| | | |
| | | getLines = (data, seq) => { |
| | | const { BID } = this.props |
| | | const { config } = this.state |
| | | |
| | | let line = [] |
| | |
| | | line.push( |
| | | <Col key={index} span={24}> |
| | | <div className="card-item-box" style={item.style}> |
| | | <CardCellComponent BID={BID} seq={seq} data={data} cards={config} cardCell={item} elements={item.elements} updateStatus={this.updateStatus}/> |
| | | <CardCellComponent seq={seq} data={data} cards={config} cardCell={item} elements={item.elements} updateStatus={this.updateStatus}/> |
| | | </div> |
| | | </Col> |
| | | ) |
| | |
| | | |
| | | import asyncComponent from './asyncButtonComponent' |
| | | import { chartColors } from '@/utils/option.js' |
| | | // import searchLine from '../../share/searchLine' |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import UtilsDM from '@/utils/utils-datamanage.js' |
| | | import { modifyTabview } from '@/store/action' |
| | | // import searchLine from '../../share/searchLine' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import './index.scss' |
| | | |
| | | const ExcelOutButton = asyncComponent(() => import('@/tabviews/zshare/actionList/exceloutbutton')) |
| | |
| | | } |
| | | |
| | | state = { |
| | | BID: '', // 主表ID |
| | | config: null, // 图表配置信息 |
| | | empty: true, // 图表数据为空 |
| | | loading: false, // 数据加载状态 |
| | |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { config, data, initdata } = this.props |
| | | const { config, data, initdata, BID } = this.props |
| | | let _config = fromJS(config).toJS() |
| | | |
| | | let _data = null |
| | | let _sync = config.setting.sync === 'true' |
| | | |
| | |
| | | this.setState({ |
| | | config: _config, |
| | | data: _data, |
| | | BID: BID || '', |
| | | vFields: vFields, |
| | | vstFields: vstFields, |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | |
| | | return !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | handleData = () => { |
| | | const { data, plot } = this.state |
| | | componentDidMount () { |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | } |
| | | |
| | | if (plot.datatype === 'statistics') { |
| | | let result = this.getStaticMsg(data) |
| | | |
| | | this.setState({ |
| | | chartData: result.data, |
| | | chartFields: result.chartFields, |
| | | selectFields: result.selectFields |
| | | }, () => { |
| | | let _element = document.getElementById(this.state.chartId) |
| | | if (_element) { |
| | | _element.innerHTML = '' |
| | | } |
| | | this.viewrender() |
| | | /** |
| | | * @description 组件销毁,清除state更新,清除快捷键设置 |
| | | */ |
| | | componentWillUnmount () { |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | } |
| | | |
| | | resetParentParam = (MenuID, id) => { |
| | | const { config } = this.state |
| | | |
| | | if (!config.setting.supModule || config.setting.supModule !== MenuID) return |
| | | if (id !== this.state.BID) { |
| | | this.setState({ BID: id }, () => { |
| | | this.loadData() |
| | | }) |
| | | } else { |
| | | let _element = document.getElementById(this.state.chartId) |
| | | if (_element) { |
| | | _element.innerHTML = '' |
| | | } |
| | | this.viewrender() |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 数据加载 |
| | | */ |
| | | async loadData () { |
| | | const { mainSearch, BID, menuType } = this.props |
| | | const { config, arr_field, search } = this.state |
| | | const { mainSearch, menuType } = this.props |
| | | const { config, arr_field, BID, search } = this.state |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | this.setState({ |
| | | data: [] |
| | | }, () => { |
| | | this.handleData() |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let searches = fromJS(search).toJS() |
| | | if (mainSearch && mainSearch.length > 0) { // 主表搜索条件 |
| | |
| | | message: result.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 数据预处理,统计数据需要重置 |
| | | */ |
| | | handleData = () => { |
| | | const { data, plot } = this.state |
| | | |
| | | if (plot.datatype === 'statistics') { |
| | | let result = this.getStaticMsg(data) |
| | | |
| | | this.setState({ |
| | | chartData: result.data, |
| | | chartFields: result.chartFields, |
| | | selectFields: result.selectFields |
| | | }, () => { |
| | | let _element = document.getElementById(this.state.chartId) |
| | | if (_element) { |
| | | _element.innerHTML = '' |
| | | } |
| | | this.viewrender() |
| | | }) |
| | | } else { |
| | | let _element = document.getElementById(this.state.chartId) |
| | | if (_element) { |
| | | _element.innerHTML = '' |
| | | } |
| | | this.viewrender() |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { BID } = this.props |
| | | const { showHeader, config, loading, title, plot, empty, chartFields, selectFields } = this.state |
| | | const { showHeader, config, loading, title, plot, empty, chartFields, selectFields, BID } = this.state |
| | | |
| | | return ( |
| | | <div className="custom-line-chart-plot-box" style={config.style}> |
| | |
| | | import { modifyTabview } from '@/store/action' |
| | | import { chartColors } from '@/utils/option.js' |
| | | import UtilsDM from '@/utils/utils-datamanage.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import './index.scss' |
| | | |
| | | class PieChart extends Component { |
| | |
| | | _config.style = {minHeight: (config.plot.height || 400)} |
| | | } |
| | | |
| | | let _BID = BID || '' |
| | | if (config.setting.supModule && config.setting.supModule[0] !== 'empty') { |
| | | _BID = '' |
| | | } |
| | | sessionStorage.setItem(config.uuid, 'bid') |
| | | |
| | | this.setState({ |
| | | config: _config, |
| | | data: _data, |
| | | BID: _BID, |
| | | BID: BID || '', |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | plot: _config.plot, |
| | | sync: _sync, |
| | |
| | | this.handleData() |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 组件销毁 |
| | | */ |
| | | componentWillUnmount () { |
| | | const { config } = this.state |
| | | sessionStorage.removeItem(config.uuid) |
| | | } |
| | | |
| | | /** |
| | |
| | | return !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | } |
| | | |
| | | /** |
| | | * @description 组件销毁,清除state更新,清除快捷键设置 |
| | | */ |
| | | componentWillUnmount () { |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | } |
| | | |
| | | resetParentParam = (MenuID, id) => { |
| | | const { config } = this.state |
| | | |
| | | if (!config.setting.supModule || config.setting.supModule !== MenuID) return |
| | | if (id !== this.state.BID) { |
| | | this.setState({ BID: id }, () => { |
| | | this.loadData() |
| | | }) |
| | | } |
| | | } |
| | | |
| | | handleData = () => { |
| | | let _element = document.getElementById(this.state.chartId) |
| | | if (_element) { |
| | |
| | | const { mainSearch, menuType } = this.props |
| | | const { config, arr_field, search, BID } = this.state |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | this.setState({ |
| | | data: [] |
| | | }, () => { |
| | | this.handleData() |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let searches = fromJS(search).toJS() |
| | | if (mainSearch && mainSearch.length > 0) { // 主表搜索条件 |
| | | let keys = searches.map(item => item.key) |
| | |
| | | import md5 from 'md5' |
| | | import { connect } from 'react-redux' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Table, Typography, Icon, Col } from 'antd' |
| | | import { Table, Typography, Icon, Col, Switch } from 'antd' |
| | | |
| | | import { modifyTabview } from '@/store/action' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import zhCN from '@/locales/zh-CN/main.js' |
| | | import enUS from '@/locales/en-US/main.js' |
| | | import '@/assets/css/table.scss' |
| | | import './index.scss' |
| | | |
| | | const { Paragraph } = Typography |
| | | const CardCellComponent = asyncComponent(() => import('@/tabviews/custom/components/card/cardcellList')) |
| | | |
| | | class BodyRow extends React.Component { |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | } |
| | | |
| | | render() { |
| | | let { col, record, className, style, triggerLink, ...resProps } = this.props |
| | | let { col, config, record, className, style, triggerLink, updateStatus, ...resProps } = this.props |
| | | |
| | | if (!col) return (<td {...resProps} className={className} style={style}/>) |
| | | |
| | |
| | | {content && _href ? <a href={_href} target="_blank" rel="noopener noreferrer">{content}</a> : null } |
| | | </div> |
| | | ) |
| | | } else if (col.type === 'custom' || col.type === 'action') { |
| | | resProps.children = ( |
| | | <CardCellComponent data={record} cards={config} elements={col.elements} updateStatus={this.props.updateStatus}/> |
| | | ) |
| | | } |
| | | |
| | | if (resProps.rowSpan === 0) return null |
| | |
| | | |
| | | class NormalTable extends Component { |
| | | static propTpyes = { |
| | | tableId: PropTypes.string, // 列表Id |
| | | statFValue: PropTypes.any, // 合计字段数据 |
| | | pageSize: PropTypes.any, // 每页数据 |
| | | MenuName: PropTypes.any, // 菜单名称 |
| | | dict: PropTypes.object, // 字典项 |
| | | MenuID: PropTypes.string, // 菜单Id |
| | | setting: PropTypes.object, // 表格全局设置:tableType(表格是否可选、单选、多选)、columnfixed(列固定)、actionfixed(按钮固定) |
| | | pickup: PropTypes.any, // 数据收起 |
| | | columns: PropTypes.array, // 表格列 |
| | | lineMarks: PropTypes.array, // 行标记 |
| | | fields: PropTypes.array, // 组件字段集 |
| | | BID: PropTypes.any, // 主表Id |
| | | ContainerId: PropTypes.any, // 标签页外层Id |
| | | BData: PropTypes.any, // 主表数据 |
| | | data: PropTypes.any, // 表格数据 |
| | | total: PropTypes.any, // 总数 |
| | | loading: PropTypes.bool, // 表格加载中 |
| | | refreshdata: PropTypes.func, // 表格中排序列、页码的变化时刷新 |
| | | handleTableId: PropTypes.func, // 数据切换 |
| | | chgSelectData: PropTypes.func, // 数据切换 |
| | | refreshbyaction: PropTypes.func, // 按钮执行完成后刷新 |
| | | } |
| | | |
| | | state = { |
| | | dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | selectedRowKeys: [], // 表格中选中行 |
| | | pageIndex: 1, // 初始页面索引 |
| | | pageSize: 10, // 每页数据条数 |
| | | columns: null, // 显示列 |
| | | imgShow: false, // 图片放大模态框 |
| | | imgSrc: '', // 图片路径 |
| | | activeIndex: null, // 标记当前选中行 |
| | | rowspans: null // 行合并字段信息 |
| | | rowspans: null, // 行合并字段信息 |
| | | pickup: false |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { menuType, memberLevel, pageSize } = this.props |
| | | const { menuType, memberLevel, setting, fields } = this.props |
| | | let columns = fromJS(this.props.columns).toJS() |
| | | let _columns = [] |
| | | let radio = 5 // 虚化比例 |
| | |
| | | width: col.Width || 120, |
| | | onCell: record => ({ |
| | | record, |
| | | col: item, |
| | | triggerLink: this.triggerLink |
| | | col, |
| | | config: col.type === 'custom' ? {setting, columns: fields} : null, |
| | | triggerLink: this.triggerLink, |
| | | updateStatus: this.updateStatus |
| | | }) |
| | | }) |
| | | }) |
| | |
| | | onCell: record => ({ |
| | | record, |
| | | col: item, |
| | | triggerLink: this.triggerLink |
| | | config: item.type === 'custom' || item.type === 'action' ? {setting, columns: fields} : null, |
| | | triggerLink: this.triggerLink, |
| | | updateStatus: this.updateStatus |
| | | }) |
| | | } |
| | | } |
| | |
| | | |
| | | this.setState({ |
| | | columns: _columns, |
| | | pageSize: pageSize ? pageSize : 10, |
| | | rowspans |
| | | }) |
| | | } |
| | |
| | | |
| | | // 字段透视 |
| | | triggerLink = (item, record) => { |
| | | const { tabviews, MenuID, setting } = this.props |
| | | const { tabviews, MenuID } = this.props |
| | | |
| | | if (item.linkThdMenu) { |
| | | let tabmenu = item.linkThdMenu |
| | |
| | | tabmenu.param = { |
| | | searchkey: item.field, |
| | | searchval: record[item.field] || '', |
| | | BID: record[setting.primaryKey] |
| | | BID: record.$$uuid |
| | | } |
| | | |
| | | tabmenu.selected = true |
| | |
| | | let dataparam = { |
| | | searchkey: item.field, |
| | | searchval: record[item.field] || '', |
| | | BID: record[setting.primaryKey] |
| | | BID: record.$$uuid |
| | | } |
| | | _param.UserID = sessionStorage.getItem('UserID') |
| | | _param.LoginUID = sessionStorage.getItem('LoginUID') |
| | |
| | | * @description 点击整行,触发切换, 判断是否可选,单选或多选,进行对应操作 |
| | | */ |
| | | changeRow = (record, index) => { |
| | | const { setting, pickup } = this.props |
| | | const { setting } = this.props |
| | | |
| | | if (!setting.tableType || pickup) return |
| | | if (!setting.tableType || this.state.pickup) return |
| | | |
| | | let newkeys = fromJS(this.state.selectedRowKeys).toJS() |
| | | |
| | |
| | | pageIndex: pagination.current, |
| | | pageSize: pagination.pageSize, |
| | | selectedRowKeys: [], |
| | | activeIndex: null |
| | | activeIndex: null, |
| | | pickup: false |
| | | }) |
| | | this.props.refreshdata(pagination, filters, sorter) |
| | | } |
| | | |
| | | changedata = (index) => { |
| | | const { data, setting } = this.props |
| | | const { MenuID, data, setting } = this.props |
| | | |
| | | let _id = '' |
| | | let _data = '' |
| | |
| | | _data = data[index] || '' |
| | | } |
| | | |
| | | this.props.handleTableId(this.props.tableId, _id, _data) |
| | | MKEmitter.emit('resetSelectLine', MenuID, _id, _data) |
| | | } |
| | | |
| | | resetTable = (id, repage) => { |
| | | const { MenuID, tableId } = this.props |
| | | const { MenuID } = this.props |
| | | |
| | | if (id !== (MenuID + tableId)) return |
| | | if (id !== MenuID) return |
| | | |
| | | if (repage === 'false') { |
| | | this.setState({ |
| | | selectedRowKeys: [], |
| | | activeIndex: null |
| | | activeIndex: null, |
| | | pickup: false |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | pageIndex: 1, |
| | | selectedRowKeys: [], |
| | | activeIndex: null |
| | | activeIndex: null, |
| | | pickup: false |
| | | }) |
| | | } |
| | | } |
| | |
| | | return data |
| | | } |
| | | |
| | | pickupChange = () => { |
| | | this.setState({ |
| | | pickup: !this.state.pickup |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { setting, pickup, statFValue, lineMarks } = this.props |
| | | const { selectedRowKeys, activeIndex } = this.state |
| | | const { setting, statFValue, lineMarks, data } = this.props |
| | | const { selectedRowKeys, activeIndex, pickup } = this.state |
| | | |
| | | // 设置表格选择属性:单选、多选、不可选 |
| | | let rowSelection = null |
| | |
| | | } |
| | | |
| | | // 数据收起时,过滤已选数据 |
| | | let _data = this.props.data ? this.props.data : [] |
| | | let _data = data || [] |
| | | |
| | | if (pickup) { |
| | | _data = _data.filter((item, index) => selectedRowKeys.includes(index)) |
| | |
| | | pageSizeOptions: ['10', '25', '50', '100', '500', '1000'], |
| | | showSizeChanger: true, |
| | | total: this.props.total || 0, |
| | | showTotal: (total, range) => `${range[0]}-${range[1]} ${this.props.dict['main.pagination.of']} ${total} ${this.props.dict['main.pagination.items']}` |
| | | showTotal: (total, range) => `${range[0]}-${range[1]} ${this.state.dict['main.pagination.of']} ${total} ${this.state.dict['main.pagination.items']}` |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | return ( |
| | | <div className="normal-custom-table"> |
| | | {(setting.tableType === 'radio' || setting.tableType === 'checkbox') && data && data.length > 0 ? |
| | | <Switch title="收起" className="main-pickup" checkedChildren="开" unCheckedChildren="关" defaultChecked={pickup} onChange={this.pickupChange} /> : null |
| | | } |
| | | <Table |
| | | size="middle" |
| | | components={components} |
| | |
| | | overflow-x: auto!important; |
| | | table { |
| | | .ant-table-tbody > tr > td { |
| | | vertical-align: top; |
| | | // vertical-align: top; |
| | | |
| | | .card-cell-list { |
| | | color: rgba(0, 0, 0, 0.85); |
| | | } |
| | | .ant-mk-picture { |
| | | position: relative; |
| | | background-position: center center; |
| | | background-size: cover; |
| | | margin: 2px; |
| | | margin: 2px; |
| | | } |
| | | .action-col { |
| | | .ant-btn > .anticon + span { |
| | |
| | | |
| | | class TabTransfer extends Component { |
| | | static propTpyes = { |
| | | BID: PropTypes.any, // 父级Id |
| | | bids: PropTypes.any, // 父级Id集 |
| | | config: PropTypes.object, // 组件配置信息 |
| | | mainSearch: PropTypes.any, // 全局搜索条件 |
| | | menuType: PropTypes.any, // 菜单类型 |
| | |
| | | } |
| | | |
| | | getComponents = () => { |
| | | const { menuType, BID, config } = this.props |
| | | const { menuType, bids, config } = this.props |
| | | const { mainSearch, data } = this.state |
| | | |
| | | if (!config || !config.components || config.components.length === 0) return (<Empty description={false} />) |
| | | |
| | | return config.components.map(item => { |
| | | let BID = '' |
| | | if (item.setting && item.setting.supModule) { |
| | | BID = bids[item.setting.supModule] || '' |
| | | } |
| | | |
| | | if (item.type === 'bar' || item.type === 'line') { |
| | | return ( |
| | | <Col span={item.width} key={item.uuid}> |
| | |
| | | } else if (item.type === 'tabs') { |
| | | return ( |
| | | <Col span={item.width} key={item.uuid}> |
| | | <AntvTabs config={item} BID={BID} mainSearch={mainSearch} menuType={menuType} /> |
| | | <AntvTabs config={item} bids={bids} mainSearch={mainSearch} menuType={menuType} /> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'card' && item.subtype === 'datacard') { |
| | |
| | | import PropTypes from 'prop-types' |
| | | import {connect} from 'react-redux' |
| | | import { is, fromJS } from 'immutable' |
| | | import { notification, Switch } from 'antd' |
| | | import { notification } from 'antd' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | |
| | | |
| | | class NormalTable extends Component { |
| | | static propTpyes = { |
| | | param: PropTypes.any, // 其他页面传递的搜索条件等参数 |
| | | MenuID: PropTypes.string, // 菜单Id |
| | | MenuNo: PropTypes.string, // 菜单参数 |
| | | MenuName: PropTypes.string // 菜单名称 |
| | | BID: PropTypes.any, // 父级Id |
| | | data: PropTypes.array, // 统一查询数据 |
| | | config: PropTypes.object, // 组件配置信息 |
| | | mainSearch: PropTypes.any, // 外层搜索条件 |
| | | menuType: PropTypes.any, // 菜单类型 |
| | | } |
| | | |
| | | state = { |
| | | dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | BID: null, // 页面跳转时携带ID |
| | | BID: '', // 上级ID |
| | | BData: '', // 上级组件行数据 |
| | | config: {}, // 页面配置信息,包括按钮、搜索、显示列、标签等 |
| | | searchlist: null, // 搜索条件 |
| | | actions: null, // 按钮集 |
| | | columns: null, // 显示列 |
| | | arr_field: '', // 使用 sPC_Get_TableData 时的查询字段集 |
| | | setting: null, // 页面全局设置:数据源、按钮及显示列固定、主键等 |
| | | data: null, // 列表数据集 |
| | | data: [], // 列表数据集 |
| | | selectedData: [], // 已选表格数据 |
| | | total: 0, // 总数 |
| | | loading: false, // 列表数据加载中 |
| | |
| | | pageSize: 10, // 每页数据条数 |
| | | orderBy: '', // 排序 |
| | | search: '', // 搜索条件数组,使用时需分场景处理 |
| | | BIDs: {}, // 上级表id |
| | | pickup: false, // 主表数据隐藏显示切换 |
| | | statFields: [], // 合计字段 |
| | | statFValue: [] // 合计值 |
| | | } |
| | |
| | | * 1、 initdata 为打印时使用的数据集 |
| | | */ |
| | | UNSAFE_componentWillMount () { |
| | | const { data, initdata } = this.props |
| | | const { data, initdata, BID } = this.props |
| | | let _config = fromJS(this.props.config).toJS() |
| | | let _cols = new Map() |
| | | |
| | | let _data = null |
| | | let _sync = _config.setting.sync === 'true' |
| | | |
| | |
| | | } else if (_config.setting.sync === 'true' && initdata) { |
| | | _data = initdata || [] |
| | | _sync = false |
| | | } |
| | | |
| | | if (_data) { |
| | | _data = _data.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[_config.setting.primaryKey] || '' |
| | | item.$$BID = BID || '' |
| | | return item |
| | | }) |
| | | } |
| | | |
| | | _config.columns.forEach(item => { |
| | |
| | | }) |
| | | |
| | | this.setState({ |
| | | BID: BID || '', |
| | | title: _config.wrap.title, |
| | | sync: _sync, |
| | | data: _data, |
| | |
| | | |
| | | /** |
| | | * @description 主表数据加载 |
| | | */ |
| | | async loadmaindata () { |
| | | const { setting, arr_field, BIDs, search, orderBy, BID, pageIndex, pageSize } = this.state |
| | | * @param { Boolean } reset 表格是否重置 |
| | | * @param { String } repage 表格是否重置页码 |
| | | */ |
| | | async loadmaindata (reset, repage) { |
| | | const { setting, config, arr_field, search, orderBy, BID, pageIndex, pageSize } = this.state |
| | | let requireFields = search.filter(item => item.required && (!item.value || item.value.length === 0)) |
| | | |
| | | this.setState({ |
| | | selectedData: [], |
| | | BIDs: { |
| | | ...BIDs, |
| | | mainTable: '', |
| | | mainTabledata: '' |
| | | } |
| | | }) |
| | | |
| | | if (setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | this.setState({ |
| | | data: [], |
| | | selectedData: [], |
| | | total: 0 |
| | | }) |
| | | MKEmitter.emit('resetSelectLine', config.uuid, '', '') // 广播数据切换 |
| | | reset && MKEmitter.emit('resetTable', config.uuid, repage) // 列表重置 |
| | | return |
| | | } |
| | | if (requireFields.length > 0) { |
| | | let labels = requireFields.map(item => item.label) |
| | | labels = Array.from(new Set(labels)) |
| | |
| | | let param = UtilsDM.getQueryDataParams(setting, arr_field, search, _orderBy, pageIndex, pageSize, BID, this.props.menuType) |
| | | |
| | | if (param.func === 'sPC_Get_TableData') { |
| | | param.menuname = this.props.MenuName || '' |
| | | param.menuname = config.name || '' |
| | | } |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | MKEmitter.emit('resetSelectLine', config.uuid, '', '') // 广播数据切换 |
| | | reset && MKEmitter.emit('resetTable', config.uuid, repage) // 列表重置 |
| | | |
| | | this.setState({ |
| | | data: result.data.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[setting.primaryKey] || '' |
| | | item.$$BID = BID || '' |
| | | return item |
| | | }), |
| | | selectedData: [], |
| | | total: result.total, |
| | | loading: false, |
| | | pickup: false |
| | | loading: false |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | |
| | | * @description 获取单行数据 |
| | | */ |
| | | async loadmainLinedata (id) { |
| | | const { setting, arr_field, search, orderBy, BID, pageIndex, pageSize } = this.state |
| | | const { setting, config, arr_field, search, orderBy, BID, pageIndex, pageSize } = this.state |
| | | |
| | | this.setState({ |
| | | loading: true |
| | |
| | | let param = UtilsDM.getQueryDataParams(setting, arr_field, search, _orderBy, pageIndex, pageSize, BID, this.props.menuType, id) |
| | | |
| | | if (param.func === 'sPC_Get_TableData') { |
| | | param.menuname = this.props.MenuName || '' |
| | | param.menuname = config.name || '' |
| | | } |
| | | |
| | | let result = await Api.genericInterface(param) |
| | |
| | | data = data.map(item => { |
| | | if (item[setting.primaryKey] === _data[setting.primaryKey]) { |
| | | _data.key = item.key |
| | | _data.$$uuid = _data[setting.primaryKey] || '' |
| | | _data.$$BID = BID || '' |
| | | return _data |
| | | } else { |
| | | return item |
| | |
| | | * @description 获取合计字段值 |
| | | */ |
| | | getStatFieldsValue = () => { |
| | | const { setting, search, BID, orderBy, statFields } = this.state |
| | | const { setting, config, search, BID, orderBy, statFields } = this.state |
| | | |
| | | if (setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | this.setState({ |
| | | statFValue: [] |
| | | }) |
| | | return |
| | | } |
| | | |
| | | if (statFields.length === 0 || setting.interType !== 'system' || !setting.dataresource) return |
| | | |
| | |
| | | let param = UtilsDM.getStatQueryDataParams(setting, statFields, search, _orderBy, BID, this.props.menuType) |
| | | |
| | | if (param.func === 'sPC_Get_TableData') { |
| | | param.menuname = this.props.MenuName || '' |
| | | param.menuname = config.name || '' |
| | | } |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | |
| | | this.getStatFieldsValue() |
| | | }) |
| | | } else { |
| | | MKEmitter.emit('resetTable', this.props.MenuID + 'mainTable') // 列表重置 |
| | | this.setState({ |
| | | pageIndex: 1, |
| | | search: searches |
| | | }, () => { |
| | | this.loadmaindata() |
| | | this.loadmaindata(true, 'true') |
| | | this.getStatFieldsValue() |
| | | }) |
| | | } |
| | |
| | | */ |
| | | reloadtable = (btn) => { |
| | | if (!btn || btn.resetPageIndex !== 'false') { |
| | | MKEmitter.emit('resetTable', this.props.MenuID + 'mainTable') // 列表重置 |
| | | this.setState({ |
| | | pageIndex: 1 |
| | | }, () => { |
| | | this.loadmaindata() |
| | | this.loadmaindata(true, 'true') |
| | | this.getStatFieldsValue() |
| | | }) |
| | | } else { |
| | | MKEmitter.emit('resetTable', this.props.MenuID + 'mainTable', 'false') // 列表重置 |
| | | this.loadmaindata() |
| | | this.loadmaindata(true, 'false') |
| | | this.getStatFieldsValue() |
| | | } |
| | | } |
| | |
| | | * @description 导出Excel时,获取页面搜索排序等参数 |
| | | */ |
| | | getexceloutparam = () => { |
| | | const { MenuName } = this.props |
| | | const { arr_field, orderBy, search, setting} = this.state |
| | | const { arr_field, config, orderBy, search, setting} = this.state |
| | | |
| | | return { |
| | | arr_field: arr_field, |
| | | orderBy: orderBy || setting.order, |
| | | search: search, |
| | | menuName: MenuName |
| | | menuName: config.name |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 表格选择项切换 |
| | | */ |
| | | changeSelectedData = (selectedData) => { |
| | | this.setState({selectedData}) |
| | | } |
| | | |
| | | /** |
| | | * @description 表格Id变化 |
| | | */ |
| | | handleTableId = (type, id, data) => { |
| | | const { BIDs } = this.state |
| | | |
| | | this.setState({ |
| | | BIDs: { |
| | | ...BIDs, |
| | | [type]: id, |
| | | [type + 'data']: data |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 数据展开合并切换 |
| | | */ |
| | | pickupChange = () => { |
| | | const { pickup } = this.state |
| | | this.setState({ |
| | | pickup: !pickup |
| | | }) |
| | | } |
| | | |
| | | reloadData = (menuId, id, btn) => { |
| | | const { MenuID } = this.props |
| | | const { config } = this.state |
| | | |
| | | if (MenuID !== menuId) return |
| | | if (config.uuid !== menuId) return |
| | | if (id === 'empty') return |
| | | |
| | | if (id === 'formtab') { // 表单标签页刷新 |
| | |
| | | } |
| | | } |
| | | |
| | | resetParentParam = (MenuID, id, data) => { |
| | | const { setting } = this.state |
| | | |
| | | if (!setting.supModule || setting.supModule !== MenuID) return |
| | | if (id !== this.state.BID) { |
| | | this.setState({ |
| | | pageIndex: 1, |
| | | BID: id, |
| | | BData: data |
| | | }, () => { |
| | | this.loadmaindata(true, 'true') |
| | | this.getStatFieldsValue() |
| | | }) |
| | | } |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | | const { sync, config } = this.state |
| | | const { sync, config, BID } = this.state |
| | | |
| | | if (sync && !is(fromJS(this.props.data), fromJS(nextProps.data))) { |
| | | let _data = [] |
| | | if (nextProps.data && nextProps.data[config.dataName]) { |
| | | _data = nextProps.data[config.dataName] || [] |
| | | } |
| | | _data = _data.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$$BID = BID || '' |
| | | return item |
| | | }) |
| | | |
| | | this.setState({sync: false, data: _data}) |
| | | } else if (!is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { |
| | |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | } |
| | | |
| | | /** |
| | |
| | | return |
| | | } |
| | | MKEmitter.removeListener('reloadData', this.reloadData) |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | } |
| | | |
| | | render() { |
| | | const { MenuName } = this.props |
| | | const { BID, setting, searchlist, pageSize, actions, config, columns, pickup, selectedData } = this.state |
| | | const { BID, setting, searchlist, actions, config, columns, selectedData } = this.state |
| | | |
| | | return ( |
| | | <div className="custom-normal-table"> |
| | |
| | | BID={BID} |
| | | setting={setting} |
| | | actions={actions} |
| | | columns={config.columns} |
| | | MenuName={MenuName} |
| | | dict={this.state.dict} |
| | | MenuID={this.props.MenuID} |
| | | BData={this.state.BData} |
| | | columns={config.columns} |
| | | selectedData={selectedData} |
| | | refreshdata={this.refreshbyaction} |
| | | getexceloutparam={this.getexceloutparam} |
| | | /> |
| | | </div> |
| | | <div className="main-table-box"> |
| | | {(setting.tableType === 'radio' || setting.tableType === 'checkbox') && this.state.data && this.state.data.length > 0 ? |
| | | <Switch title="收起" className="main-pickup" checkedChildren="开" unCheckedChildren="关" defaultChecked={pickup} onChange={this.pickupChange} /> : null |
| | | } |
| | | <MainTable |
| | | tableId="mainTable" |
| | | BID={BID} |
| | | pickup={pickup} |
| | | setting={setting} |
| | | columns={columns} |
| | | MenuName={MenuName} |
| | | pageSize={pageSize} |
| | | dict={this.state.dict} |
| | | MenuID={config.uuid} |
| | | data={this.state.data} |
| | | fields={config.columns} |
| | | total={this.state.total} |
| | | MenuID={this.props.MenuID} |
| | | lineMarks={config.lineMarks} |
| | | loading={this.state.loading} |
| | | refreshdata={this.refreshbytable} |
| | | statFValue={this.state.statFValue} |
| | | handleTableId={this.handleTableId} |
| | | refreshbyaction={this.refreshbyaction} |
| | | chgSelectData={this.changeSelectedData} |
| | | chgSelectData={(selects) => this.setState({selectedData: selects})} |
| | | /> |
| | | </div> |
| | | </div> |
| | |
| | | import { Tabs, Icon } from 'antd' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | |
| | | import MKEmitter from '@/utils/events.js' |
| | | import './index.scss' |
| | | |
| | | const TabTransfer = asyncComponent(() => import('../../share/tabtransfer')) |
| | |
| | | |
| | | class antvBarLineChart extends Component { |
| | | static propTpyes = { |
| | | BID: PropTypes.any, // 父级Id |
| | | bids: PropTypes.any, // 父级Id集 |
| | | config: PropTypes.object, // 组件配置信息 |
| | | mainSearch: PropTypes.any, // 外层搜索条件 |
| | | menuType: PropTypes.any, // 菜单类型 |
| | |
| | | |
| | | state = { |
| | | tabs: null, |
| | | parentIds: [] |
| | | parentIds: [], |
| | | bids: {} |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { config } = this.props |
| | | const { config, bids } = this.props |
| | | this.setState({ |
| | | tabs: config, |
| | | parentIds: config.parentIds || [] |
| | | parentIds: config.parentIds || [], |
| | | bids: bids ? bids : {} |
| | | }) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.state), fromJS(nextState)) |
| | | return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | componentDidMount () {} |
| | | componentDidMount () { |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | } |
| | | |
| | | /** |
| | | * @description 组件销毁,清除state更新,清除快捷键设置 |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | } |
| | | |
| | | resetParentParam = (MenuID, id) => { |
| | | const { parentIds, bids } = this.state |
| | | |
| | | if (!parentIds.includes(MenuID)) return |
| | | |
| | | this.setState({ |
| | | bids: {...bids, [MenuID]: id} |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { BID, mainSearch } = this.props |
| | | const { tabs } = this.state |
| | | const { mainSearch } = this.props |
| | | const { tabs, bids } = this.state |
| | | |
| | | return ( |
| | | <div className="menu-antv-tabs-wrap" style={tabs.style}> |
| | | <Tabs defaultActiveKey="1" tabPosition={tabs.setting.position} type={tabs.setting.tabStyle}> |
| | | {tabs.subtabs.map(tab => ( |
| | | <TabPane tab={<span>{tab.icon ? <Icon type={tab.icon} /> : null}{tab.label}</span>} key={tab.uuid}> |
| | | <TabTransfer config={tab} BID={BID} mainSearch={mainSearch}/> |
| | | <TabTransfer config={tab} bids={bids} mainSearch={mainSearch}/> |
| | | </TabPane> |
| | | ))} |
| | | </Tabs> |
| | |
| | | tab.components.forEach(comp => { |
| | | if (comp.type === 'tabs' && comp.parentIds) { |
| | | supIds.push(...comp.parentIds) |
| | | } else if (comp.setting.supModule && comp.setting.supModule[0] !== 'empty') { |
| | | supIds.push(...comp.setting.supModule.slice(-1)) |
| | | } else if (comp.setting.supModule) { |
| | | supIds.push(comp.setting.supModule) |
| | | } |
| | | }) |
| | | }) |
| | |
| | | return col |
| | | }) |
| | | } |
| | | |
| | | if (item.setting && item.setting.supModule) { |
| | | let pid = item.setting.supModule.slice(-1)[0] |
| | | if (pid && pid !== 'empty') { |
| | | item.setting.supModule = pid |
| | | } else { |
| | | item.setting.supModule = '' |
| | | } |
| | | } |
| | | |
| | | // 权限过滤 |
| | | if (this.props.menuType !== 'HS') { |
| | | if (item.action && item.action.length > 0) { |
| | | item.action = item.action.filter(cell => permAction[cell.uuid]) |
| | | item.action = item.action.filter(cell => { |
| | | cell.logLabel = item.name + '-' + cell.label |
| | | return permAction[cell.uuid] |
| | | }) |
| | | } |
| | | if (item.type === 'card') { |
| | | item.subcards.forEach(card => { |
| | | card.elements = card.elements.filter(cell => cell.eleType !== 'button' || permAction[cell.uuid]) |
| | | card.backElements = card.backElements.filter(cell => cell.eleType !== 'button' || permAction[cell.uuid]) |
| | | card.elements = card.elements.filter(cell => { |
| | | if (cell.eleType === 'button') { |
| | | cell.logLabel = item.name + '-' + cell.label |
| | | } |
| | | return cell.eleType !== 'button' || permAction[cell.uuid] |
| | | }) |
| | | card.backElements = card.backElements.filter(cell => { |
| | | if (cell.eleType === 'button') { |
| | | cell.logLabel = item.name + '-' + cell.label |
| | | } |
| | | return cell.eleType !== 'button' || permAction[cell.uuid] |
| | | }) |
| | | }) |
| | | } else if (item.type === 'table' && item.subtype === 'tablecard') { |
| | | item.subcards.forEach(card => { |
| | | card.elements = card.elements.filter(cell => cell.eleType !== 'button' || permAction[cell.uuid]) |
| | | card.elements = card.elements.filter(cell => { |
| | | if (cell.eleType === 'button') { |
| | | cell.logLabel = item.name + '-' + cell.label |
| | | } |
| | | return cell.eleType !== 'button' || permAction[cell.uuid] |
| | | }) |
| | | }) |
| | | } else if (item.type === 'table' && item.subtype === 'normaltable') { |
| | | item.cols.forEach(col => { |
| | | if (col.type !== 'action') return |
| | | col.elements = col.elements.filter(cell => permAction[cell.uuid]) |
| | | col.elements = col.elements.filter(cell => { |
| | | cell.logLabel = item.name + '-' + cell.label |
| | | return permAction[cell.uuid] |
| | | }) |
| | | }) |
| | | } |
| | | } else { |
| | | if (item.action && item.action.length > 0) { |
| | | item.action = item.action.map(cell => { |
| | | cell.logLabel = item.name + '-' + cell.label |
| | | return cell |
| | | }) |
| | | } |
| | | } |
| | | return true |
| | | }) |
| | |
| | | if (!config || !config.components) return |
| | | |
| | | return config.components.map(item => { |
| | | let _bid = BID |
| | | if (item.setting && item.setting.supModule) { |
| | | _bid = '' |
| | | } |
| | | |
| | | if (item.type === 'bar' || item.type === 'line') { |
| | | return ( |
| | | <Col span={item.width} key={item.uuid}> |
| | | <AntvBarAndLine config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} /> |
| | | <AntvBarAndLine config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} /> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'pie') { |
| | | return ( |
| | | <Col span={item.width} key={item.uuid}> |
| | | <AntvPie config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} /> |
| | | <AntvPie config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} /> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'search') { |
| | | return ( |
| | | <Col span={item.width} key={item.uuid}> |
| | | <MainSearch config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} refreshdata={this.resetSearch} /> |
| | | <MainSearch config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} refreshdata={this.resetSearch} /> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'tabs') { |
| | |
| | | } else if (item.type === 'card' && item.subtype === 'datacard') { |
| | | return ( |
| | | <Col span={item.width} key={item.uuid}> |
| | | <DataCard config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} /> |
| | | <DataCard config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} /> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'card' && item.subtype === 'propcard') { |
| | | return ( |
| | | <Col span={item.width} key={item.uuid}> |
| | | <PropCard config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} /> |
| | | <PropCard config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} /> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'table' && item.subtype === 'tablecard') { |
| | | return ( |
| | | <Col span={item.width} key={item.uuid}> |
| | | <TableCard config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} /> |
| | | <TableCard config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} /> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'table' && item.subtype === 'normaltable') { |
| | | return ( |
| | | <Col span={item.width} key={item.uuid}> |
| | | <NormalTable config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} /> |
| | | <NormalTable config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} /> |
| | | </Col> |
| | | ) |
| | | } else { |
| | |
| | | message: formRule.textarea.message |
| | | } |
| | | ] |
| | | })(<TextArea autosize={{ minRows: 2, maxRows: item.maxRows || 6 }} disabled={item.readonly === 'true'} />)} |
| | | })(<TextArea autoSize={{ minRows: 2, maxRows: item.maxRows || 6 }} disabled={item.readonly === 'true'} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | |
| | | let _operations = [] // 操作列按钮(存在时) |
| | | |
| | | config.action.forEach(item => { |
| | | item.logLabel = Tab.label + '-' + item.label // 用于sPC_TableData_InUpDe记录操作按钮 |
| | | if (item.execMode) { |
| | | item.OpenType = 'funcbutton' |
| | | } |
| | |
| | | BData={this.props.BData} |
| | | MenuID={this.props.MenuID} |
| | | selectedData={selectedData} |
| | | MenuName={this.props.Tab.label} |
| | | refreshdata={this.refreshbyaction} |
| | | ContainerId={this.props.ContainerId} |
| | | getexceloutparam={this.getexceloutparam} |
| | |
| | | total={this.state.total} |
| | | MenuID={this.props.MenuID} |
| | | loading={this.state.loading} |
| | | MenuName={this.props.Tab.label} |
| | | refreshdata={this.refreshbytable} |
| | | statFValue={this.state.statFValue} |
| | | handleTableId={this.handleTableId} |
| | |
| | | MenuID={this.props.MenuID} |
| | | loading={this.state.loading} |
| | | tableId={this.props.Tab.uuid} |
| | | MenuName={this.props.Tab.label} |
| | | refreshdata={this.refreshbyaction} |
| | | handleTableId={this.handleTableId} |
| | | getexceloutparam={this.getexceloutparam} |
| | |
| | | BID={this.props.BID} |
| | | Tab={this.props.Tab} |
| | | data={this.state.data} |
| | | MenuName={this.props.Tab.label} |
| | | getexceloutparam={this.getexceloutparam} |
| | | loading={this.state.loading} |
| | | /> |
| | |
| | | * @description 获取页面配置信息 |
| | | */ |
| | | async loadconfig () { |
| | | const { permAction, type } = this.props |
| | | const { permAction, type, Tab } = this.props |
| | | |
| | | let param = { |
| | | func: 'sPC_Get_LongParam', |
| | |
| | | let _operations = [] // 操作列按钮(存在时) |
| | | |
| | | config.action.forEach(item => { |
| | | item.logLabel = Tab.label + '-' + item.label // 用于sPC_TableData_InUpDe记录操作按钮 |
| | | if (item.execMode) { |
| | | item.OpenType = 'funcbutton' |
| | | } |
| | |
| | | BData={this.props.BData} |
| | | selectedData={selectedData} |
| | | MenuID={this.props.SupMenuID} |
| | | MenuName={this.props.Tab.label} |
| | | refreshdata={this.refreshbyaction} |
| | | getexceloutparam={this.getexceloutparam} |
| | | /> |
| | |
| | | total={this.state.total} |
| | | MenuID={this.props.MenuID} |
| | | loading={this.state.loading} |
| | | MenuName={this.props.Tab.label} |
| | | refreshdata={this.refreshbytable} |
| | | statFValue={this.state.statFValue} |
| | | refreshbyaction={this.refreshbyaction} |
| | |
| | | data={this.state.data} |
| | | BData={this.props.BData} |
| | | loading={this.state.loading} |
| | | MenuName={this.props.Tab.label} |
| | | refreshdata={this.refreshbyaction} |
| | | handleTableId={() => {}} |
| | | /> |
| | |
| | | config={config} |
| | | data={this.state.data} |
| | | loading={this.state.loading} |
| | | MenuName={this.props.Tab.label} |
| | | /> |
| | | </Col> |
| | | ) |
| | |
| | | <Form.Item label="备注"> |
| | | {getFieldDecorator('Remark', { |
| | | initialValue: this.props.tab.Remark || '' |
| | | })(<TextArea autosize={{ minRows: 2, maxRows: 6 }} />)} |
| | | })(<TextArea autoSize={{ minRows: 2, maxRows: 6 }} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | |
| | | static propTpyes = { |
| | | show: PropTypes.any, // 显示样式 |
| | | BID: PropTypes.string, // 主表ID |
| | | MenuName: PropTypes.any, // 菜单名称 |
| | | selectedData: PropTypes.any, // 子表中选择数据 |
| | | Tab: PropTypes.any, // 如果当前元素为标签时,tab为标签信息 |
| | | btn: PropTypes.object, // 按钮 |
| | |
| | | * @description Excel 导入 |
| | | */ |
| | | getexceldata = (data, errors, sheetName) => { |
| | | const { btn, MenuName } = this.props |
| | | const { btn } = this.props |
| | | |
| | | if (errors) { |
| | | if (errors === 'notexit') { |
| | |
| | | param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) |
| | | } |
| | | |
| | | param.menuname = `${MenuName ? MenuName + '-' : ''}${btn.label}` |
| | | param.menuname = btn.logLabel |
| | | |
| | | Api.genericInterface(param).then((res) => { |
| | | if (res.status) { |
| | |
| | | static propTpyes = { |
| | | BID: PropTypes.string, // 主表ID |
| | | show: PropTypes.any, // 显示样式 |
| | | MenuName: PropTypes.any, // 菜单名称 |
| | | Tab: PropTypes.any, // 如果当前元素为标签时,tab为标签信息 |
| | | btn: PropTypes.object, // 按钮 |
| | | setting: PropTypes.any, // 页面通用设置 |
| | |
| | | * @description 执行自定义脚本 |
| | | */ |
| | | execCustomScript = () => { |
| | | const { btn, MenuName } = this.props |
| | | const { btn } = this.props |
| | | const { search } = this.state |
| | | let script = btn.verify.script |
| | | |
| | |
| | | |
| | | let param = { |
| | | func: 'sPC_TableData_InUpDe', |
| | | menuname: `${MenuName ? MenuName + '-' : ''}${btn.label}` |
| | | menuname: btn.logLabel |
| | | } |
| | | |
| | | if (this.props.BID) { |
| | |
| | | * @description 获取默认存储过程请求参数 |
| | | */ |
| | | getExcelDefaultParam = (arr_field, orderBy, search, pagination = false, pageIndex = 1, pageSize = 100) => { |
| | | const { setting, MenuName, btn } = this.props |
| | | const { setting, btn } = this.props |
| | | |
| | | let _search = Utils.joinMainSearchkey(search) |
| | | |
| | |
| | | arr_field: arr_field, |
| | | custom_script: setting.customScript, |
| | | default_sql: setting.default || 'true', |
| | | menuname: `${MenuName ? MenuName + '-' : ''}${btn.label}` |
| | | menuname: btn.logLabel |
| | | } |
| | | |
| | | // 数据管理权限 |
| | |
| | | static propTpyes = { |
| | | BID: PropTypes.any, // 主表ID |
| | | BData: PropTypes.any, // 主表数据 |
| | | MenuName: PropTypes.any, // 菜单名称 |
| | | selectedData: PropTypes.any, // 子表中选择数据 |
| | | Tab: PropTypes.any, // 如果当前元素为标签时,tab为标签信息 |
| | | MenuID: PropTypes.string, // 菜单ID |
| | |
| | | } |
| | | |
| | | getButtonList = (actions) => { |
| | | const { BID, BData, MenuID, Tab, columns, setting, ContainerId, selectedData, getexceloutparam, MenuName } = this.props |
| | | const { BID, BData, MenuID, Tab, columns, setting, ContainerId, selectedData, getexceloutparam } = this.props |
| | | |
| | | return actions.map(item => { |
| | | if (['exec', 'prompt', 'pop'].includes(item.OpenType)) { |
| | |
| | | BData={BData} |
| | | setting={setting} |
| | | columns={columns} |
| | | MenuName={MenuName} |
| | | ContainerId={ContainerId} |
| | | selectedData={selectedData} |
| | | updateStatus={this.updateStatus} |
| | |
| | | Tab={Tab} |
| | | btn={item} |
| | | setting={setting} |
| | | MenuName={MenuName} |
| | | selectedData={selectedData} |
| | | updateStatus={this.updateStatus} |
| | | /> |
| | |
| | | Tab={Tab} |
| | | btn={item} |
| | | setting={setting} |
| | | MenuName={MenuName} |
| | | getexceloutparam={getexceloutparam} |
| | | updateStatus={this.updateStatus} |
| | | /> |
| | |
| | | const { setting, MenuID, actions } = this.props |
| | | let fixed = setting.actionfixed && setting.tabType === 'main' // 按钮是否固定在头部 |
| | | |
| | | if (fixed) { |
| | | if (fixed && MenuID) { |
| | | return ( |
| | | <Affix offsetTop={48}> |
| | | <div className="button-list toolbar-button" id={fixed ? MenuID + 'mainaction' : ''}> |
| | |
| | | show: PropTypes.any, // 按钮显示样式控制 |
| | | BID: PropTypes.string, // 主表ID |
| | | BData: PropTypes.any, // 主表数据 |
| | | MenuName: PropTypes.any, // 菜单名称 |
| | | style: PropTypes.any, // 按钮样式 |
| | | selectedData: PropTypes.any, // 子表中选择数据 |
| | | Tab: PropTypes.any, // 如果当前元素为标签时,tab为标签信息 |
| | |
| | | * @description 按钮提交执行 |
| | | */ |
| | | execSubmit = (data, _resolve, formdata) => { |
| | | const { setting, columns, btn, MenuName } = this.props |
| | | const { setting, columns, btn } = this.props |
| | | if (btn.intertype === 'inner' || btn.intertype === 'system') { |
| | | // 执行方式为多行拼接,且打开方式为表单时,会转为循环发送请求 |
| | | // 打开方式为模态框,使用内部函数添加(有批量添加场景,已去除) |
| | |
| | | } |
| | | |
| | | if (param.func === 'sPC_TableData_InUpDe') { |
| | | param.menuname = `${MenuName ? MenuName + '-' : ''}${btn.label}` |
| | | param.menuname = btn.logLabel |
| | | } |
| | | |
| | | Api.genericInterface(param).then((res) => { |
| | |
| | | } |
| | | |
| | | if (param.func === 'sPC_TableData_InUpDe') { |
| | | param.menuname = `${MenuName ? MenuName + '-' : ''}${btn.label}` |
| | | param.menuname = btn.logLabel |
| | | } |
| | | |
| | | return param |
| | |
| | | type: PropTypes.any, // 卡片类型,添加按钮为 insert |
| | | BID: PropTypes.any, // 主表ID |
| | | BData: PropTypes.any, // 主表数据 |
| | | MenuName: PropTypes.any, // 菜单名称 |
| | | Tab: PropTypes.any, // 如果当前元素为标签时,tab为标签信息 |
| | | MenuID: PropTypes.string, // 菜单ID |
| | | setting: PropTypes.object, // 页面设定 |
| | |
| | | * @description 获取按钮元素 |
| | | */ |
| | | getActionList = (actions, show) => { |
| | | const { BID, BData, Tab, setting, columns, ContainerId, data, MenuID, MenuName } = this.props |
| | | const { BID, BData, Tab, setting, columns, ContainerId, data, MenuID } = this.props |
| | | |
| | | return actions.map(item => { |
| | | if (['exec', 'prompt', 'pop'].includes(item.OpenType)) { |
| | |
| | | BData={BData} |
| | | setting={setting} |
| | | columns={columns} |
| | | MenuName={MenuName} |
| | | selectedData={[data]} |
| | | ContainerId={ContainerId} |
| | | updateStatus={this.props.refreshdata} |
| | |
| | | show={'plus' + plusSize} |
| | | BData={this.props.BData} |
| | | setting={this.props.setting} |
| | | MenuName={this.props.MenuName} |
| | | columns={this.props.columns} |
| | | selectedData={[]} |
| | | ContainerId={this.props.ContainerId} |
| | |
| | | BData: PropTypes.any, // 主表数据 |
| | | Tab: PropTypes.any, // 如果当前元素为标签时,tab为标签信息 |
| | | MenuID: PropTypes.string, // 菜单ID |
| | | MenuName: PropTypes.any, // 菜单名称 |
| | | config: PropTypes.object, // 页面配置信息 |
| | | columns: PropTypes.array, // 显示列 |
| | | ContainerId: PropTypes.any, // tab页面ID,用于弹窗控制 |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { plot, data, loading, BID, BData, Tab, MenuID, config, columns, ContainerId, MenuName } = this.props |
| | | const { plot, data, loading, BID, BData, Tab, MenuID, config, columns, ContainerId } = this.props |
| | | const { card, colMap, selectKey, actionList } = this.state |
| | | |
| | | return ( |
| | |
| | | Tab={Tab} |
| | | btn={action} |
| | | show="icon" |
| | | MenuName={MenuName} |
| | | setting={config.setting} |
| | | updateStatus={this.updateStatus} |
| | | /> |
| | |
| | | Tab={Tab} |
| | | btn={action} |
| | | show="icon" |
| | | MenuName={MenuName} |
| | | setting={config.setting} |
| | | getexceloutparam={this.props.getexceloutparam} |
| | | updateStatus={this.updateStatus} |
| | |
| | | MenuID={MenuID} |
| | | colMap={colMap} |
| | | columns={columns} |
| | | MenuName={MenuName} |
| | | selectKey={selectKey} |
| | | setting={config.setting} |
| | | ContainerId={ContainerId} |
| | |
| | | data={{key: 'insert'}} |
| | | BData={BData} |
| | | MenuID={MenuID} |
| | | MenuName={MenuName} |
| | | setting={config.setting} |
| | | ContainerId={ContainerId} |
| | | switchCard={() => {}} |
| | |
| | | static propTpyes = { |
| | | BID: PropTypes.any, // 父级Id |
| | | Tab: PropTypes.any, // 标签信息 |
| | | MenuName: PropTypes.any, // 菜单名称 |
| | | plot: PropTypes.object, // 图标设置信息 |
| | | data: PropTypes.array, // 图表传入数据 |
| | | loading: PropTypes.bool, // 数据加载中 |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { plot, loading, config, BID, Tab, MenuName } = this.props |
| | | const { plot, loading, config, BID, Tab } = this.props |
| | | const { empty, chartFields, selectFields, actions } = this.state |
| | | |
| | | return ( |
| | |
| | | Tab={Tab} |
| | | btn={item} |
| | | show="icon" |
| | | MenuName={MenuName} |
| | | setting={config.setting} |
| | | getexceloutparam={this.props.getexceloutparam} |
| | | updateStatus={() => {}} |
| | |
| | | Tab={Tab} |
| | | btn={item} |
| | | show="icon" |
| | | MenuName={MenuName} |
| | | setting={config.setting} |
| | | updateStatus={() => {}} |
| | | /> |
| | |
| | | message: formRule.input.formMessage.replace('@max', _max) |
| | | } |
| | | ] |
| | | })(<TextArea autosize={{ minRows: 2, maxRows: item.maxRows || 6 }} disabled={item.readonly === 'true'} />)} |
| | | })(<TextArea autoSize={{ minRows: 2, maxRows: item.maxRows || 6 }} disabled={item.readonly === 'true'} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | |
| | | tableId: PropTypes.string, // 列表Id |
| | | statFValue: PropTypes.any, // 合计字段数据 |
| | | pageSize: PropTypes.any, // 每页数据 |
| | | MenuName: PropTypes.any, // 菜单名称 |
| | | dict: PropTypes.object, // 字典项 |
| | | MenuID: PropTypes.string, // 菜单Id |
| | | setting: PropTypes.object, // 表格全局设置:tableType(表格是否可选、单选、多选)、columnfixed(列固定)、actionfixed(按钮固定) |
| | |
| | | selectedData={[record]} |
| | | BData={this.props.BData} |
| | | setting={this.props.setting} |
| | | MenuName={this.props.MenuName} |
| | | columns={this.props.fields || this.props.columns} |
| | | ContainerId={this.props.ContainerId} |
| | | updateStatus={this.updateStatus} |
| | |
| | | import SearchComponent from '@/templates/sharecomponent/searchcomponent' |
| | | |
| | | import MenuForm from '@/templates/comtableconfig/menuform' |
| | | import EditComponent from '@/templates/zshare/editcomponent' |
| | | import SourceElement from '@/templates/zshare/dragsource' |
| | | import Source from './source' |
| | | import './index.scss' |
| | |
| | | const { Panel } = Collapse |
| | | const { confirm } = Modal |
| | | |
| | | const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent')) |
| | | const SettingComponent = asyncComponent(() => import('@/templates/sharecomponent/settingcalcomponent')) |
| | | const TabComponent = asyncComponent(() => import('./tabcomponent')) |
| | | const CalComponent = asyncComponent(() => import('./calcomponent')) |
| | |
| | | config: res.config |
| | | }) |
| | | } else if (res.type === 'paste') { |
| | | let config = fromJS(this.state.config).toJS() |
| | | if (res.content.copyType === 'search') { |
| | | config.search.push(res.content) |
| | | } |
| | | |
| | | this.setState({config}) |
| | | this.setState({config: res.config}) |
| | | } |
| | | } |
| | | |
| | |
| | | </div> |
| | | } bordered={false} extra={ |
| | | <div> |
| | | <EditComponent dict={this.state.dict} type="calendar" config={this.state.config} refresh={this.updateConfig}/> |
| | | <EditComponent dict={this.state.dict} options={['search']} config={this.state.config} refresh={this.updateConfig}/> |
| | | <Switch className="big" checkedChildren="启" unCheckedChildren="停" checked={this.state.config.enabled} onChange={this.onEnabledChange} /> |
| | | <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{this.state.dict['model.save']}</Button> |
| | | <Button onClick={this.cancelConfig}>{this.state.dict['model.back']}</Button> |
| | |
| | | * @description 编辑功能完成更新,包括解冻按钮、粘贴、替换等 |
| | | */ |
| | | editConfig = (res) => { |
| | | |
| | | |
| | | if (res.type === 'thaw') { |
| | | this.setState({ |
| | | thawButtons: res.thawButtons, |
| | | config: res.config |
| | | }) |
| | | } else if (res.type === 'paste') { |
| | | let config = fromJS(this.state.config).toJS() |
| | | if (res.content.copyType === 'search') { |
| | | config.search.push(res.content) |
| | | } else if (res.content.copyType === 'action') { |
| | | config.action.push(res.content) |
| | | } else if (res.content.copyType === 'columns' && res.content.columns && res.content.columns.length > 0) { |
| | | config.columns = config.columns.filter(col => !col.origin) |
| | | config.columns = [...config.columns, ...res.content.columns] |
| | | } |
| | | this.setState({config}) |
| | | this.setState({config: res.config}) |
| | | } |
| | | } |
| | | |
| | |
| | | </div> |
| | | } bordered={false} extra={ |
| | | <div> |
| | | <EditComponent dict={this.state.dict} type="maintable" config={this.state.config} MenuID={this.props.menu.MenuID} thawButtons={this.state.thawButtons} refresh={this.editConfig}/> |
| | | <EditComponent dict={this.state.dict} options={['search', 'action', 'columns']} config={this.state.config} MenuID={this.props.menu.MenuID} thawButtons={this.state.thawButtons} refresh={this.editConfig}/> |
| | | <Switch className="big" checkedChildren={this.state.dict['model.enable']} unCheckedChildren={this.state.dict['model.disable']} checked={this.state.config.enabled} onChange={this.onEnabledChange} /> |
| | | <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{this.state.dict['model.save']}</Button> |
| | | <Button onClick={this.cancelConfig}>{this.state.dict['model.back']}</Button> |
| | |
| | | <DatePicker showTime value={card.initval ? moment().subtract(card.initval, 'days') : null} /> : null |
| | | } |
| | | {card.type === 'textarea' ? |
| | | <TextArea value={card.initval} autosize={{ minRows: 2, maxRows: 6 }} /> : null |
| | | <TextArea value={card.initval} autoSize={{ minRows: 2, maxRows: 6 }} /> : null |
| | | } |
| | | {card.type === 'funcvar' && |
| | | <Input style={{marginTop: '4px'}} value={card.linkfield} /> |
| | |
| | | } else if (card.type === 'datetime') { |
| | | formItem = (<DatePicker showTime value={card.initval ? moment().subtract(card.initval, 'days') : null} />) |
| | | } else if (card.type === 'textarea') { |
| | | formItem = (<TextArea value={card.initval} autosize={{ minRows: 2, maxRows: 6 }} />) |
| | | formItem = (<TextArea value={card.initval} autoSize={{ minRows: 2, maxRows: 6 }} />) |
| | | } else if (card.type === 'fileupload') { |
| | | formItem = (<Button style={{marginTop: '3px'}}><Icon type="upload" /> 点击上传 </Button>) |
| | | } else if (card.type === 'funcvar') { |
| | |
| | | import GroupForm from './groupform' |
| | | import MenuForm from './menuform' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import EditComponent from '@/templates/zshare/editcomponent' |
| | | import { BaseConfig, SearchItems } from './source' |
| | | import './index.scss' |
| | | |
| | | const { Panel } = Collapse |
| | | const { confirm } = Modal |
| | | const CommonDict = localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS |
| | | const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent')) |
| | | const TableComponent = asyncComponent(() => import('@/templates/sharecomponent/tablecomponent')) |
| | | const FieldsComponent = asyncComponent(() => import('@/templates/sharecomponent/fieldscomponent')) |
| | | |
| | |
| | | if (_config.groups.length > 0) { |
| | | _config.groups.forEach(group => { |
| | | group.sublist = group.sublist.map(item => { |
| | | if (item.uuid !== res.uuid && item.field === res.field) { |
| | | if (item.uuid !== res.uuid && item.field.toLowerCase() === res.field.toLowerCase()) { |
| | | fieldrepet = true |
| | | } else if (item.uuid !== res.uuid && item.label === res.label) { |
| | | labelrepet = true |
| | |
| | | }) |
| | | } else { |
| | | _config.fields = _config.fields.map(item => { |
| | | if (item.uuid !== res.uuid && item.field === res.field) { |
| | | if (item.uuid !== res.uuid && item.field.toLowerCase() === res.field.toLowerCase()) { |
| | | fieldrepet = true |
| | | } else if (item.uuid !== res.uuid && item.label === res.label) { |
| | | labelrepet = true |
| | |
| | | updateEditConfig = (res) => { |
| | | if (res.type === 'paste') { |
| | | this.setState({ |
| | | config: res.content |
| | | config: res.config |
| | | }) |
| | | this.handleForm(res.newform) |
| | | } |
| | |
| | | <div className="setting"> |
| | | <Card title={dict['header.menu.form.configurable']} bordered={false} extra={ |
| | | <div> |
| | | <EditComponent dict={dict} type="form" config={this.state.config} refresh={this.updateEditConfig}/> |
| | | <EditComponent dict={dict} options={['form']} config={this.state.config} refresh={this.updateEditConfig}/> |
| | | <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{dict['model.save']}</Button> |
| | | <Button onClick={this.cancelConfig}>{dict['model.back']}</Button> |
| | | </div> |
| | |
| | | let columns = new Map() |
| | | tableFields.forEach(table => { |
| | | table.columns.forEach(column => { |
| | | columns.set(column.field, column) |
| | | columns.set(column.field.toLowerCase(), column) |
| | | }) |
| | | }) |
| | | |
| | | if (type === 'search') { |
| | | // 添加搜索条件,字段集中存在搜索条件字段,使用搜索条件对象替换字段集,设置数据类型 |
| | | config.search.forEach(item => { |
| | | if (columns.has(item.field)) { |
| | | let _datatype = columns.get(item.field).datatype |
| | | columns.set(item.field, {...item, selected: true, datatype: _datatype}) |
| | | if (columns.has(item.field.toLowerCase())) { |
| | | let _datatype = columns.get(item.field.toLowerCase()).datatype |
| | | columns.set(item.field.toLowerCase(), {...item, selected: true, datatype: _datatype}) |
| | | } |
| | | }) |
| | | } else if (type === 'columns') { |
| | | // 添加显示列,字段集中存在显示列字段,使用显示列对象替换字段集,设置数据类型 |
| | | config.columns.forEach(item => { |
| | | if (columns.has(item.field)) { |
| | | let _datatype = columns.get(item.field).datatype |
| | | columns.set(item.field, {...item, selected: true, datatype: _datatype}) |
| | | if (columns.has(item.field.toLowerCase())) { |
| | | let _datatype = columns.get(item.field.toLowerCase()).datatype |
| | | columns.set(item.field.toLowerCase(), {...item, selected: true, datatype: _datatype}) |
| | | } |
| | | }) |
| | | } else if (type === 'fields') { |
| | | config.columns.forEach(item => { |
| | | if (columns.has(item.field)) { |
| | | let _datatype = columns.get(item.field).datatype |
| | | columns.set(item.field, {...item, selected: true, datatype: _datatype}) |
| | | if (columns.has(item.field.toLowerCase())) { |
| | | let _datatype = columns.get(item.field.toLowerCase()).datatype |
| | | columns.set(item.field.toLowerCase(), {...item, selected: true, datatype: _datatype}) |
| | | } |
| | | }) |
| | | } else if (type === 'form') { |
| | | if (config.groups.length > 1) { |
| | | config.groups.forEach(group => { |
| | | group.sublist.forEach(item => { |
| | | if (columns.has(item.field)) { |
| | | let _datatype = columns.get(item.field).datatype |
| | | columns.set(item.field, {...item, selected: true, datatype: _datatype}) |
| | | if (columns.has(item.field.toLowerCase())) { |
| | | let _datatype = columns.get(item.field.toLowerCase()).datatype |
| | | columns.set(item.field.toLowerCase(), {...item, selected: true, datatype: _datatype}) |
| | | } |
| | | }) |
| | | }) |
| | | } else { |
| | | config.fields.forEach(item => { |
| | | if (columns.has(item.field)) { |
| | | let _datatype = columns.get(item.field).datatype |
| | | columns.set(item.field, {...item, selected: true, datatype: _datatype}) |
| | | if (columns.has(item.field.toLowerCase())) { |
| | | let _datatype = columns.get(item.field.toLowerCase()).datatype |
| | | columns.set(item.field.toLowerCase(), {...item, selected: true, datatype: _datatype}) |
| | | } |
| | | }) |
| | | } |
| | |
| | | let cards = this.refs.searchcard.state.selectCards |
| | | let columnsMap = new Map() |
| | | cards.forEach(card => { |
| | | columnsMap.set(card.field, card) |
| | | columnsMap.set(card.field.toLowerCase(), card) |
| | | }) |
| | | |
| | | let items = [] |
| | | if (type === 'search') { |
| | | config.search.forEach(item => { |
| | | if (columnsMap.has(item.field)) { |
| | | let cell = columnsMap.get(item.field) |
| | | if (columnsMap.has(item.field.toLowerCase())) { |
| | | let cell = columnsMap.get(item.field.toLowerCase()) |
| | | |
| | | if (cell.selected && cell.type === item.type) { // 数据未修改 |
| | | items.push(item) |
| | |
| | | item.initval = '' |
| | | items.push(item) |
| | | } |
| | | columnsMap.delete(item.field) |
| | | columnsMap.delete(item.field.toLowerCase()) |
| | | } else if (!item.origin) { |
| | | items.push(item) |
| | | } |
| | |
| | | config.search = items |
| | | } else if (type === 'columns') { |
| | | config.columns.forEach(item => { |
| | | if (columnsMap.has(item.field)) { |
| | | let cell = columnsMap.get(item.field) |
| | | if (columnsMap.has(item.field.toLowerCase())) { |
| | | let cell = columnsMap.get(item.field.toLowerCase()) |
| | | |
| | | if (cell.selected) { |
| | | items.push(item) |
| | | } |
| | | columnsMap.delete(item.field) |
| | | columnsMap.delete(item.field.toLowerCase()) |
| | | } else if (!item.origin) { |
| | | items.push(item) |
| | | } |
| | |
| | | config.columns = items |
| | | } else if (type === 'fields') { |
| | | config.columns.forEach(item => { |
| | | if (columnsMap.has(item.field)) { |
| | | let cell = columnsMap.get(item.field) |
| | | if (columnsMap.has(item.field.toLowerCase())) { |
| | | let cell = columnsMap.get(item.field.toLowerCase()) |
| | | |
| | | if (cell.selected) { |
| | | items.push(item) |
| | | } |
| | | columnsMap.delete(item.field) |
| | | columnsMap.delete(item.field.toLowerCase()) |
| | | } else { |
| | | items.push(item) |
| | | } |
| | |
| | | if (config.groups.length > 1) { |
| | | config.groups.forEach(group => { |
| | | group.sublist.forEach(item => { |
| | | if (columnsMap.has(item.field)) { |
| | | let cell = columnsMap.get(item.field) |
| | | if (columnsMap.has(item.field.toLowerCase())) { |
| | | let cell = columnsMap.get(item.field.toLowerCase()) |
| | | |
| | | if (cell.selected && cell.type === item.type) { // 数据选择状态及类型未修改时,直接添加 |
| | | items.push(item) |
| | |
| | | item.initval = '' |
| | | items.push(item) |
| | | } |
| | | columnsMap.delete(item.field) |
| | | columnsMap.delete(item.field.toLowerCase()) |
| | | } else if (!item.origin) { // 过滤示例项 |
| | | items.push(item) |
| | | } |
| | |
| | | config.groups[config.groups.length - 1].sublist = [...config.groups.slice(-1)[0].sublist, ..._additems] |
| | | } else { |
| | | config.fields.forEach(item => { |
| | | if (columnsMap.has(item.field)) { |
| | | let cell = columnsMap.get(item.field) |
| | | if (columnsMap.has(item.field.toLowerCase())) { |
| | | let cell = columnsMap.get(item.field.toLowerCase()) |
| | | |
| | | if (cell.selected && cell.type === item.type) { // 数据选择状态及类型未修改时,直接添加 |
| | | items.push(item) |
| | |
| | | item.initval = '' |
| | | items.push(item) |
| | | } |
| | | columnsMap.delete(item.field) |
| | | columnsMap.delete(item.field.toLowerCase()) |
| | | } else if (!item.origin) { // 过滤示例项 |
| | | items.push(item) |
| | | } |
| | |
| | | } |
| | | |
| | | return { |
| | | field: item.FieldName, |
| | | field: item.FieldName || '', |
| | | label: item.FieldDec, |
| | | type: _type, |
| | | datatype: _type, |
| | |
| | | import ColumnComponent from '@/templates/sharecomponent/columncomponent' |
| | | |
| | | import MenuForm from './menuform' |
| | | import EditComponent from '@/templates/zshare/editcomponent' |
| | | import SourceElement from '@/templates/zshare/dragsource' |
| | | import Source from './source' |
| | | import './index.scss' |
| | |
| | | const { Panel } = Collapse |
| | | const { confirm } = Modal |
| | | |
| | | const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent')) |
| | | const SettingComponent = asyncComponent(() => import('@/templates/sharecomponent/settingcomponent')) |
| | | const TableComponent = asyncComponent(() => import('@/templates/sharecomponent/tablecomponent')) |
| | | const FieldsComponent = asyncComponent(() => import('@/templates/sharecomponent/fieldscomponent')) |
| | |
| | | config: res.config |
| | | }) |
| | | } else if (res.type === 'paste') { |
| | | let config = fromJS(this.state.config).toJS() |
| | | if (res.content.copyType === 'search') { |
| | | config.search.push(res.content) |
| | | } else if (res.content.copyType === 'action') { |
| | | config.action.push(res.content) |
| | | } else if (res.content.copyType === 'columns' && res.content.columns && res.content.columns.length > 0) { |
| | | config.columns = config.columns.filter(col => !col.origin) |
| | | config.columns = [...config.columns, ...res.content.columns] |
| | | } |
| | | |
| | | this.setState({config}) |
| | | this.setState({config: res.config}) |
| | | } |
| | | } |
| | | |
| | |
| | | </div> |
| | | } bordered={false} extra={ |
| | | <div> |
| | | <EditComponent dict={this.state.dict} type="subtable" config={this.state.config} thawButtons={this.state.thawButtons} refresh={this.updateConfig}/> |
| | | <Switch className="big" checkedChildren="启" unCheckedChildren="停" checked={this.state.config.enabled} onChange={this.onEnabledChange} /> |
| | | <EditComponent dict={this.state.dict} options={['search', 'action', 'columns']} config={config} MenuID={config.uuid} thawButtons={this.state.thawButtons} refresh={this.updateConfig}/> |
| | | <Switch className="big" checkedChildren="启" unCheckedChildren="停" checked={config.enabled} onChange={this.onEnabledChange} /> |
| | | <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{this.state.dict['model.save']}</Button> |
| | | <Button onClick={this.cancelConfig}>{this.state.dict['model.back']}</Button> |
| | | </div> |
| | |
| | | |
| | | class editComponent extends Component { |
| | | static propTpyes = { |
| | | type: PropTypes.string, |
| | | options: PropTypes.array, |
| | | MenuID: PropTypes.any, |
| | | config: PropTypes.object, |
| | | thawButtons: PropTypes.any, |
| | |
| | | * @description 解冻按钮 |
| | | */ |
| | | handleThaw = () => { |
| | | const { config } = this.props |
| | | const { MenuID } = this.props |
| | | |
| | | this.setState({ |
| | | thawVisible: true |
| | | }) |
| | | |
| | | let uuid = config.uuid |
| | | |
| | | if (this.props.type === 'maintable') { |
| | | uuid = this.props.MenuID |
| | | } |
| | | |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_Get_FrozenMenu', |
| | | ParentID: uuid, |
| | | ParentID: MenuID, |
| | | TYPE: 40 |
| | | }).then(res => { |
| | | if (res.status) { |
| | |
| | | thawBtnSubmit = () => { |
| | | const { thawButtons } = this.props |
| | | const { thawbtnlist, dict } = this.state |
| | | let config = JSON.parse(JSON.stringify(this.props.config)) |
| | | let config = fromJS(this.props.config).toJS() |
| | | |
| | | // 三级菜单解除冻结 |
| | | if (this.refs.trawmenu.state.targetKeys.length === 0) { |
| | |
| | | } |
| | | |
| | | pasteSubmit = () => { |
| | | const { config, type } = this.props |
| | | const { options } = this.props |
| | | let _config = fromJS(this.props.config).toJS() |
| | | |
| | | this.pasteFormRef.handleConfirm().then(res => { |
| | | if (['maintable', 'subtable'].includes(type) && res.copyType === 'action') { |
| | | if (res.copyType === 'action' && options.includes('action')) { |
| | | res.uuid = Utils.getuuid() |
| | | |
| | | |
| | | _config.action = _config.action.filter(item => !item.origin) |
| | | _config.action.push(res) |
| | | |
| | | this.setState({ |
| | | pasteVisible: false |
| | | }, () => { |
| | | this.props.refresh({ |
| | | type: 'paste', |
| | | content: res |
| | | config: _config |
| | | }) |
| | | }) |
| | | } else if (['maintable', 'subtable', 'calendar'].includes(type) && (res.copyType === 'search' || res.copyType === 'form')) { |
| | | } else if (options.includes('search') && (res.copyType === 'search' || res.copyType === 'form')) { |
| | | res.uuid = Utils.getuuid() |
| | | _config.search = _config.search.filter(item => !item.origin) |
| | | let keys = _config.search.map(item => item.field.toLowerCase()) |
| | | |
| | | // search: text select multiselect link date dateweek datemonth daterange group |
| | | // form: text number select multiselect link switch checkbox radio checkcard |
| | |
| | | } |
| | | res.copyType = 'search' |
| | | |
| | | _config.search.push(res) |
| | | |
| | | if (res.field && keys.includes(res.field.toLowerCase())) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '搜索字段已存在!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | this.setState({ |
| | | pasteVisible: false |
| | | }, () => { |
| | | this.props.refresh({ |
| | | type: 'paste', |
| | | content: res |
| | | config: _config |
| | | }) |
| | | }) |
| | | } else if (['maintable', 'subtable'].includes(type) && res.copyType === 'columns') { |
| | | let _columns = config.columns.filter(col => !col.origin) |
| | | if (_columns.length > 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '显示列已存在!', |
| | | duration: 5 |
| | | } else if (options.includes('columns') && res.copyType === 'columns') { |
| | | _config.columns = _config.columns.filter(col => !col.origin) |
| | | let keys = _config.columns.map(item => item.field ? item.field.toLowerCase() : '') |
| | | |
| | | if (_config.columns.length === 0) { |
| | | _config.columns = res.columns |
| | | } else { |
| | | res.columns.forEach(col => { |
| | | if (!col.field) return |
| | | let _key = col.field.toLowerCase() |
| | | if (!keys.includes(_key)) { |
| | | keys.push(_key) |
| | | _config.columns.push(col) |
| | | } |
| | | }) |
| | | return |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | }, () => { |
| | | this.props.refresh({ |
| | | type: 'paste', |
| | | content: res |
| | | config: _config |
| | | }) |
| | | }) |
| | | } else if (['form'].includes(type) && (res.copyType === 'form' || res.copyType === 'search')) { |
| | | let _config = fromJS(config).toJS() |
| | | } else if (options.includes('form') && (res.copyType === 'form' || res.copyType === 'search')) { |
| | | let fields = [] |
| | | let labels = [] |
| | | |
| | | res.uuid = Utils.getuuid() |
| | | |
| | | // search: text select multiselect link date dateweek datemonth daterange group |
| | |
| | | if (_config.groups.length > 0) { |
| | | _config.groups.forEach(group => { |
| | | group.sublist.forEach(item => { |
| | | fields.push(item.field) |
| | | fields.push(item.field.toLowerCase()) |
| | | labels.push(item.label) |
| | | }) |
| | | if (group.default) { |
| | |
| | | }) |
| | | } else { |
| | | _config.fields.forEach(item => { |
| | | fields.push(item.field) |
| | | fields.push(item.field.toLowerCase()) |
| | | labels.push(item.label) |
| | | }) |
| | | _config.fields.push(res) |
| | | } |
| | | |
| | | if (fields.includes(res.field)) { |
| | | if (fields.includes(res.field.toLowerCase())) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '字段已存在!', |
| | |
| | | }, () => { |
| | | this.props.refresh({ |
| | | type: 'paste', |
| | | content: _config, |
| | | config: _config, |
| | | newform: res |
| | | }) |
| | | }) |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { type } = this.props |
| | | const { MenuID } = this.props |
| | | const { dict } = this.state |
| | | const menu = ( |
| | | <Menu onClick={this.handleMenuClick}> |
| | | {['maintable', 'subtable'].includes(type) ? <Menu.Item key="thaw"><Icon type="unlock" />{dict['header.form.thawbutton']}</Menu.Item> : null} |
| | | {['maintable', 'subtable', 'form', 'calendar'].includes(type) ? <Menu.Item key="paste"><Icon type="snippets" />{dict['header.form.paste']}</Menu.Item> : null} |
| | | {MenuID ? <Menu.Item key="thaw"><Icon type="unlock" />{dict['header.form.thawbutton']}</Menu.Item> : null} |
| | | <Menu.Item key="paste"><Icon type="snippets" />{dict['header.form.paste']}</Menu.Item> |
| | | {/* <Menu.Item key="replace"><Icon type="retweet" />替换</Menu.Item> */} |
| | | </Menu> |
| | | ) |
| | |
| | | message: this.props.dict['form.required.input'] + '配置信息!' |
| | | } |
| | | ] |
| | | })(<TextArea autosize={{ minRows: 4, maxRows: 8 }} />)} |
| | | })(<TextArea autoSize={{ minRows: 6, maxRows: 6 }} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | |
| | | _verify.contrasts = _verify.contrasts || [] |
| | | _verify.accountdate = _verify.accountdate || 'false' |
| | | _verify.accountfield = _verify.accountfield || '' |
| | | _verify.voucherdate = _verify.voucherdate || '' |
| | | _verify.customverifys = _verify.customverifys || [] |
| | | _verify.billcodes = _verify.billcodes || [] |
| | | _verify.voucher = _verify.voucher || {enabled: false} |
| | |
| | | end |
| | | ` |
| | | } else if (card.sqlType === 'LogicDelete' || card.sqlType === 'custom') { |
| | | _defaultsql = `update ${card.sql} set deleted=1,modifydate=getdate(),modifyuserid=@userid@ where ${config.setting.primaryKey}${card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID from dbo.SplitComma(@ID@))'};` |
| | | let _voucher = '' |
| | | if (_verify.voucher && _verify.voucher.enabled) { |
| | | _voucher = ',BVoucher=@BVoucher,FIBVoucherDate=@FIBVoucherDate,FiYear=@FiYear' |
| | | } |
| | | _defaultsql = `update ${card.sql} set deleted=1,modifydate=getdate(),modifyuserid=@userid@${_voucher} where ${config.setting.primaryKey}${card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID from dbo.SplitComma(@ID@))'};` |
| | | } else if (card.sqlType === 'delete') { |
| | | let _msg = '' |
| | | if (columns && columns.length > 0 && card.Ot !== 'notRequired' && card.Ot !== 'requiredOnce') { |
| | |
| | | |
| | | this.setState({ |
| | | verify: {...verify, accountfield: val} |
| | | }) |
| | | } |
| | | |
| | | changeAccDate = (val) => { |
| | | const { verify } = this.state |
| | | |
| | | this.setState({ |
| | | verify: {...verify, voucherdate: val} |
| | | }) |
| | | } |
| | | |
| | |
| | | </Select> |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {verify.accountdate === 'true' ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="bottomLeft" title={'验证日期为空时,默认为当天。'}> |
| | | <Icon type="question-circle" style={{color: '#c49f47', marginRight: '5px'}} /> |
| | | 验证日期 |
| | | </Tooltip> |
| | | }> |
| | | <Select allowClear defaultValue={verify.voucherdate || ''} onChange={this.changeAccDate}> |
| | | {unionFields.map(option => |
| | | <Select.Option key={option.uuid} value={option.field}> |
| | | {option.label} |
| | | </Select.Option> |
| | | )} |
| | | </Select> |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={8}> |
| | | <Form.Item label={'失效验证'}> |
| | | <Radio.Group value={verify.invalid} onChange={(e) => {this.onOptionChange(e, 'invalid')}}> |
| | |
| | | let primaryId = param.ID |
| | | let BID = param.BID |
| | | let verify = btn.verify || {} |
| | | let _formFieldValue = {} |
| | | let datavars = {} // 声明的变量,表单及显示列 |
| | | let _actionType = null |
| | | let appkey = window.GLOB.appkey || '' |
| | | let sessionUid = localStorage.getItem('SessionUid') || '' |
| | |
| | | form.value = form.value.replace(/^(\s*)@bid@(\s*)$/ig, BID) |
| | | } |
| | | |
| | | _formFieldValue[form.key] = form.value |
| | | let _key = form.key.toLowerCase() |
| | | datavars[_key] = form.value |
| | | |
| | | if (!_initvars.includes(_key)) { |
| | | _initvars.push(_key) |
| | |
| | | } |
| | | }) |
| | | |
| | | if (data) { |
| | | Object.keys(data).forEach(key => { |
| | | data[key.toLowerCase()] = data[key] |
| | | }) |
| | | } |
| | | |
| | | // 添加数据中字段,表单值优先(按钮不选行或多行拼接时跳过) |
| | | if (data && btn.Ot !== 'notRequired' && btn.Ot !== 'requiredOnce') { |
| | | _formFieldValue = {...data, ..._formFieldValue} |
| | | datavars = {...data, ...datavars} |
| | | |
| | | const setField = (col) => { |
| | | if (!col.field) return |
| | | let _key = col.field.toLowerCase() |
| | | |
| | | if (!_initvars.includes(_key)) { |
| | | let _val = data.hasOwnProperty(col.field) ? data[col.field] : '' |
| | | let _val = datavars.hasOwnProperty(_key) ? datavars[_key] : '' |
| | | |
| | | _initvars.push(_key) |
| | | _initColfields.push(`@${_key}='${_val}'`) |
| | |
| | | |
| | | // 启用账期验证 |
| | | if (verify.accountdate === 'true') { |
| | | let orgcode = `''` |
| | | let date = `''` |
| | | if (verify.accountfield && _initvars.includes(verify.accountfield.toLowerCase())) { |
| | | orgcode = '@' + verify.accountfield |
| | | } |
| | | if (verify.voucherdate && _initvars.includes(verify.voucherdate.toLowerCase())) { |
| | | date = '@' + verify.voucherdate |
| | | } |
| | | |
| | | _sql += ` |
| | | /* 账期验证 */ |
| | | exec s_FIBVoucherDateCheck @OrgCode=${verify.accountfield ? '@' + verify.accountfield : '\'\''}, @ErrorCode=@ErrorCode OUTPUT,@retmsg=@retmsg OUTPUT |
| | | exec s_FIBVoucherDateCheck @OrgCode=${orgcode},@FIBVoucherDate=${date},@ErrorCode=@ErrorCode OUTPUT,@retmsg=@retmsg OUTPUT |
| | | if @ErrorCode!='' |
| | | GOTO aaa |
| | | ` |
| | |
| | | let keys = formdata.map(item => item.key.toLowerCase()) // 表单字段 |
| | | |
| | | verify.billcodes.forEach(item => { |
| | | if (!keys.includes(item.field.toLowerCase())) return // 表单中不含单号生成字段 |
| | | let _key = item.field.toLowerCase() |
| | | let _linkKey = item.linkField ? item.linkField.toLowerCase() : '' |
| | | |
| | | if (!keys.includes(_key)) return // 表单中不含单号生成字段 |
| | | |
| | | let _ModularDetailCode = '' |
| | | let _lpline = '' |
| | | if (item.TypeCharOne === 'Lp') { |
| | | if (item.linkField === 'BID' && BID) { // 替换bid |
| | | if (_linkKey === 'bid' && BID) { // 替换bid |
| | | _lpline = `set @ModularDetailCode= 'Lp'+ right('${item.mark || btn.uuid}'+@BID@,48)` |
| | | } else { |
| | | _lpline = `set @ModularDetailCode= 'Lp'+ right('${item.mark || btn.uuid}'+@${item.linkField},48)` |
| | | _lpline = `set @ModularDetailCode= 'Lp'+ right('${item.mark || btn.uuid}'+@${_linkKey},48)` |
| | | } |
| | | _ModularDetailCode = '@ModularDetailCode' |
| | | } else if (item.TypeCharOne === 'BN') { |
| | | let _val = '' |
| | | if (item.linkField === 'BID' && BID) { // 替换bid |
| | | if (_linkKey === 'bid' && BID) { // 替换bid |
| | | _val = BID |
| | | } else if (data && data.hasOwnProperty(item.linkField)) { |
| | | _val = data[item.linkField] |
| | | } else if (data && data.hasOwnProperty(_linkKey)) { |
| | | _val = data[_linkKey] |
| | | } |
| | | _ModularDetailCode = `'${item.TypeCharOne + _val}'` |
| | | } else { |
| | |
| | | } |
| | | |
| | | let _declare = '' |
| | | let _key = item.field.toLowerCase() |
| | | |
| | | if (!_vars.includes(_key)) { |
| | | _declare = `Declare @${_key} nvarchar(50)` |
| | |
| | | |
| | | // 唯一性验证,必须存在表单(表单存在时,主键均为单值),必须填写数据源,多行拼接时不可用 |
| | | if (formdata && verify.uniques && verify.uniques.length > 0 && btn.Ot !== 'requiredOnce') { |
| | | let hasBid = false // 检验表单及列字段中是否有bid |
| | | let _keys_ = Object.keys(_formFieldValue).map(key => key.toLowerCase()) |
| | | if (_keys_.includes('bid')) { |
| | | hasBid = true |
| | | } |
| | | |
| | | verify.uniques.forEach(item => { |
| | | let _fieldValue = [] // 表单键值对field=value |
| | | let _value = [] // 表单值,用于错误提示 |
| | |
| | | let arr = [] // 验证主键 |
| | | |
| | | item.field.split(',').forEach((_field, index) => { |
| | | let _fval = `'${_formFieldValue[_field]}'` |
| | | let _key = _field.toLowerCase() |
| | | let _val = datavars[_key] !== undefined ? datavars[_key] : '' |
| | | let _fval = `'${_val}'` |
| | | |
| | | if (_field.toLowerCase() === 'bid' && !hasBid) { // 表单中没有bid则使用系统bid变量 |
| | | if (_key === 'bid' && !datavars.bid) { // 表单中没有bid则使用系统bid变量 |
| | | _fval = '@BID@' |
| | | } |
| | | if (_field.toLowerCase() === 'bid' && tab && tab.foreignKey) { |
| | | if (_key === 'bid' && tab && tab.foreignKey) { |
| | | arr.push(tab.foreignKey.toLowerCase()) |
| | | _fieldValue.push(`${tab.foreignKey}=${_fval}`) |
| | | } else { |
| | | arr.push(_field.toLowerCase()) |
| | | _fieldValue.push(`${_field}=${_fval}`) |
| | | arr.push(_key) |
| | | _fieldValue.push(`${_key}=${_fval}`) |
| | | } |
| | | |
| | | _value.push(`${_labels[index] || ''}:${_formFieldValue[_field] || ''}`) |
| | | _value.push(`${_labels[index] || ''}:${_val || ''}`) |
| | | }) |
| | | |
| | | let _verifyType = '' |
| | |
| | | _sql += ` |
| | | /* 创建凭证 */ |
| | | exec s_BVoucher_Create |
| | | @Bill ='${data[_voucher.linkField]}', |
| | | @Bill ='${data[_voucher.linkField.toLowerCase()]}', |
| | | @BVoucherType ='${_voucher.BVoucherType}', |
| | | @VoucherTypeOne ='${_voucher.VoucherTypeOne}', |
| | | @VoucherTypeTwo ='${_voucher.VoucherTypeTwo}', |
| | |
| | | |
| | | formdata.forEach(item => { |
| | | if (item.writein === false) return |
| | | let _key = item.key.toLowerCase() |
| | | |
| | | keys.push(item.key.toLowerCase()) |
| | | values.push('@' + item.key) |
| | | keys.push(_key) |
| | | values.push('@' + _key) |
| | | }) |
| | | |
| | | if (!keys.includes(primaryKey.toLowerCase())) { |
| | |
| | | } |
| | | if (!keys.includes('bid')) { |
| | | if (tab && tab.foreignKey && !keys.includes(tab.foreignKey.toLowerCase())) { |
| | | keys.push(tab.foreignKey) |
| | | keys.push(tab.foreignKey.toLowerCase()) |
| | | } else { |
| | | keys.push('bid') |
| | | } |
| | | values.push('@BID@') |
| | | } else if (tab && tab.foreignKey && !keys.includes(tab.foreignKey.toLowerCase())) { |
| | | keys.push(tab.foreignKey) |
| | | keys.push(tab.foreignKey.toLowerCase()) |
| | | values.push('@BID@') |
| | | } |
| | | |
| | |
| | | |
| | | formdata.forEach(item => { |
| | | if (item.writein === false) return |
| | | let _key = item.key.toLowerCase() |
| | | |
| | | _arr.push(item.key.toLowerCase()) |
| | | _form.push(item.key + '=@' + item.key) |
| | | _arr.push(_key) |
| | | _form.push(_key + '=@' + _key) |
| | | }) |
| | | |
| | | if (_actionType === 'audit') { |
| | |
| | | message: formRule.input.formMessage.replace('@max', 1024) |
| | | } |
| | | ] |
| | | })(<TextArea autosize={{ minRows: 2, maxRows: 6 }} onChange={this.handleSubmit} />)} |
| | | })(<TextArea autoSize={{ minRows: 2, maxRows: 6 }} onChange={this.handleSubmit} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |