| | |
| | | |
| | | const MkIcon = asyncComponent(() => import('@/components/mk-icon')) |
| | | const TableComponent = asyncComponent(() => import('./tablecomponent')) |
| | | const NormalCopy = asyncComponent(() => import('@/menu/normalCopy')) |
| | | const ModalForm = asyncComponent(() => import('@/templates/zshare/modalform')) |
| | | const PasteForms = asyncComponent(() => import('@/menu/components/share/pasteforms')) |
| | | const FormFork = asyncComponent(() => import('@/menu/modalconfig/formfork')) |
| | |
| | | * @description 表单删除并刷新 |
| | | */ |
| | | closeForm = (card) => { |
| | | let _this = this |
| | | let that = this |
| | | |
| | | confirm({ |
| | | content: `确定删除${card.label ? `<<${card.label}>>` : ''}吗?`, |
| | | onOk() { |
| | | let _config = fromJS(_this.state.config).toJS() |
| | | let _config = fromJS(that.state.config).toJS() |
| | | _config.fields = _config.fields.filter(item => !(item.uuid === card.uuid)) |
| | | |
| | | _this.setState({ |
| | | that.setState({ |
| | | config: _config, |
| | | }) |
| | | }, |
| | |
| | | }) |
| | | } |
| | | |
| | | submitConfig = () => { |
| | | submitConfig = (type) => { |
| | | const { config } = this.state |
| | | |
| | | this.setState({originConfig: fromJS(config).toJS(), saving: true}) |
| | | this.props.handleSave(config) |
| | | if (type === 'cache') { |
| | | this.setState({originConfig: fromJS(config).toJS()}) |
| | | this.props.handleSave(config) |
| | | |
| | | setTimeout(() => { |
| | | MKEmitter.emit('triggerMenuSave') |
| | | }, 100) |
| | | message.success(<span>表单配置已保存至本地(<span style={{color: 'red'}}>尚未提交至云端</span>)。</span>) |
| | | } else { |
| | | this.setState({originConfig: fromJS(config).toJS(), saving: true}) |
| | | this.props.handleSave(config) |
| | | setTimeout(() => { |
| | | MKEmitter.emit('triggerMenuSave') |
| | | }, 100) |
| | | } |
| | | } |
| | | |
| | | clearConfig = () => { |
| | | const _this = this |
| | | const that = this |
| | | let _config = {...this.state.config, fields: []} |
| | | |
| | | confirm({ |
| | | content: '确定清空表单吗?', |
| | | onOk() { |
| | | _this.setState({ config: _config }) |
| | | that.setState({ config: _config }) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | const { config, originConfig } = this.state |
| | | |
| | | if (!is(fromJS(config), fromJS(originConfig))) { |
| | | let _this = this |
| | | let that = this |
| | | confirm({ |
| | | content: '配置信息未保存,确定返回吗?', |
| | | onOk() { |
| | | _this.props.handleBack() |
| | | that.props.handleBack() |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | |
| | | changecols = (type) => { |
| | | let config = fromJS(this.state.config).toJS() |
| | | let _this = this |
| | | let that = this |
| | | |
| | | config.fields = config.fields.map(item => { |
| | | item.labelwidth = 33.3 |
| | |
| | | confirm({ |
| | | content: `确定切换为${type}列吗?`, |
| | | onOk() { |
| | | _this.setState({config}) |
| | | that.setState({config}) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | <Collapse accordion defaultActiveKey="1" bordered={false}> |
| | | <Panel header="基本信息" key="0"> |
| | | <TableComponent /> |
| | | <NormalCopy /> |
| | | </Panel> |
| | | <Panel header="表单" key="1"> |
| | | <div className="search-element"> |
| | |
| | | <div className="setting"> |
| | | <Card title="表单配置" bordered={false} extra={ |
| | | <div> |
| | | <Button className="mk-border-green" onClick={() => this.submitConfig('cache')}>存草稿</Button> |
| | | <PasteForms type="toolbar" config={config} update={this.pasteFields}/> |
| | | <Button type="primary" id="save-modal-config" loading={saving} onClick={this.submitConfig}>保存</Button> |
| | | <Button onClick={this.cancelConfig}>返回</Button> |
| | | <Button type="primary" id="save-modal-config" loading={saving} onClick={() => this.submitConfig()}>保存</Button> |
| | | <Button disabled={saving} onClick={this.cancelConfig}>返回</Button> |
| | | </div> |
| | | } style={{ width: '100%' }}> |
| | | <SettingOutlined onClick={this.changeSetting} /> |
| | |
| | | </div> |
| | | </div> |
| | | <div className="ant-modal-footer"> |
| | | <div> |
| | | {btn.extBtn === 'true' ? <div> |
| | | <button type="button" className="ant-btn"> |
| | | <span>取消</span> |
| | | </button> |
| | | <button type="button" className={'ant-btn extend-btn ' + (btn.extStyle || '')}> |
| | | <span>{btn.extLabel}</span> |
| | | </button> |
| | | <button type="button" className={'ant-btn confirm-btn ' + (btn.confStyle || '')}> |
| | | <span>{btn.confLabel || '确定'}</span> |
| | | </button> |
| | | </div> : <div> |
| | | <button type="button" className="ant-btn"> |
| | | <span>取消</span> |
| | | </button> |
| | | <button type="button" className="ant-btn ant-btn-primary"> |
| | | <span>确定</span> |
| | | </button> |
| | | </div> |
| | | </div>} |
| | | <div className="action-mask"></div> |
| | | </div> |
| | | </div> |