| | |
| | | height: 200px; |
| | | } |
| | | } |
| | | .mk-color-move { |
| | | .color-sketch-block { |
| | | position: relative; |
| | | top: 7px; |
| | | } |
| | | } |
| | | |
| | |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Popover, Checkbox } from 'antd' |
| | | import { PlusOutlined, PlusSquareOutlined, EditOutlined, FontColorsOutlined, DeleteOutlined, SettingOutlined, ToolOutlined } from '@ant-design/icons' |
| | | import { PlusOutlined, PlusSquareOutlined, EditOutlined, FontColorsOutlined, DeleteOutlined, SettingOutlined, ToolOutlined, ClockCircleOutlined } from '@ant-design/icons' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import asyncIconComponent from '@/utils/asyncIconComponent' |
| | |
| | | updateComponent = (card) => { |
| | | card.width = card.wrap.width |
| | | card.name = card.wrap.name |
| | | card.btnlog = [] |
| | | |
| | | if (window.GLOB.styling && card.errors) { // 样式修改时不做筛查 |
| | | this.setState({ |
| | |
| | | <CopyComponent type="balcony" card={card}/> |
| | | <PasteComponent options={['action', 'customCardElement']} updateConfig={this.pasteComponent} /> |
| | | <FontColorsOutlined className="style" title="调整样式" onClick={this.changeStyle} /> |
| | | <ClockComponent config={card} updateConfig={this.updateComponent}/> |
| | | {card.wrap.datatype === 'dynamic' ? <ClockComponent config={card} updateConfig={this.updateComponent}/> : <ClockCircleOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}}/>} |
| | | <UserComponent config={card}/> |
| | | <DeleteOutlined className="close" title="删除组件" onClick={() => this.props.deletecomponent(card.uuid)} /> |
| | | {card.wrap.datatype !== 'static' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : null} |
| | | {card.wrap.datatype === 'static' ? <SettingOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}}/> : null} |
| | | {card.wrap.datatype === 'dynamic' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : <SettingOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}}/>} |
| | | </div> |
| | | } trigger="hover"> |
| | | <ToolOutlined /> |
| | |
| | | if (card.OpenType === 'popview' || card.verify || card.modal) { |
| | | card.$parentId = cardCell.uuid |
| | | card.$side = side || '' |
| | | |
| | | // MKEmitter.emit('logButton', cards.uuid, card) |
| | | } |
| | | |
| | | _this.setState({ |
| | |
| | | const NormalForm = asyncIconComponent(() => import('@/components/normalform')) |
| | | const CardComponent = asyncComponent(() => import('../cardcomponent')) |
| | | const MobPagination = asyncIconComponent(() => import('@/menu/components/share/mobPagination')) |
| | | // const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent')) |
| | | const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) |
| | | const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) |
| | | const PasteComponent = asyncIconComponent(() => import('@/components/paste')) |
| | |
| | | scripts: [], |
| | | action: [], |
| | | search: [], |
| | | btnlog: [], |
| | | subcards: [{ |
| | | uuid: Utils.getuuid(), |
| | | setting: { width: appType === 'mob' ? 24 : 6, type: 'simple'}, |
| | |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('submitModal', this.handleSave) |
| | | // MKEmitter.addListener('logButton', this.logButton) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | return |
| | | } |
| | | MKEmitter.removeListener('submitModal', this.handleSave) |
| | | // MKEmitter.removeListener('logButton', this.logButton) |
| | | } |
| | | |
| | | // logButton = (id, item) => { |
| | | // const { card } = this.state |
| | | |
| | | // if (id !== card.uuid) return |
| | | |
| | | // let btnlog = card.btnlog || [] |
| | | // btnlog.push(item) |
| | | |
| | | // this.updateComponent({...card, btnlog}) |
| | | // } |
| | | |
| | | /** |
| | | * @description 卡片行外层信息更新(数据源,样式等) |
| | | */ |
| | |
| | | |
| | | card.width = card.wrap.width |
| | | card.name = card.wrap.name |
| | | card.btnlog = [] |
| | | |
| | | if (window.GLOB.styling && card.errors) { // 样式修改时不做筛查 |
| | | this.setState({ |
| | |
| | | onOk() { |
| | | card.subcards = card.subcards.filter(item => item.uuid !== cell.uuid) |
| | | |
| | | // if (card.btnlog) { |
| | | // card.btnlog = card.btnlog.filter(c => c.$parentId !== cell.uuid) |
| | | // } |
| | | |
| | | _this.updateComponent(card) |
| | | |
| | | if (appType === 'mob') return |
| | |
| | | |
| | | this.updateComponent(card) |
| | | } |
| | | |
| | | // handleLog = (type, logs, item) => { |
| | | // let card = fromJS(this.state.card).toJS() |
| | | |
| | | // if (type === 'revert') { |
| | | // let done = false |
| | | // if (item.$parentId) { |
| | | // card.subcards.forEach(col => { |
| | | // if (item.$parentId === col.uuid) { |
| | | // if (item.$side !== 'back') { |
| | | // col.elements = col.elements ? [...col.elements, item] : [item] |
| | | // } else { |
| | | // col.backElements = col.backElements ? [...col.backElements, item] : [item] |
| | | // } |
| | | // done = true |
| | | // } |
| | | // }) |
| | | // } |
| | | |
| | | // if (!done) { |
| | | // card.action = card.action ? [...card.action, item] : [item] |
| | | // } |
| | | |
| | | // card.btnlog = logs |
| | | |
| | | // this.updateComponent(card) |
| | | // notification.success({ |
| | | // top: 92, |
| | | // message: '恢复成功!', |
| | | // duration: 2 |
| | | // }) |
| | | // } else { |
| | | // card.btnlog = logs |
| | | // this.updateComponent(card) |
| | | // notification.success({ |
| | | // top: 92, |
| | | // message: '清除成功!', |
| | | // duration: 2 |
| | | // }) |
| | | // } |
| | | // } |
| | | |
| | | addCard = (copy) => { |
| | | let card = fromJS(this.state.card).toJS() |
| | |
| | | <CopyComponent type="datacard" card={card}/> |
| | | <PasteComponent options={['action', 'search', 'form', 'cardcell']} updateConfig={this.pasteComponent} /> |
| | | <FontColorsOutlined className="style" title="调整样式" onClick={this.changeStyle}/> |
| | | {/* <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog} /> */} |
| | | <ClockComponent config={card} updateConfig={this.updateComponent}/> |
| | | <UserComponent config={card}/> |
| | | <DeleteOutlined className="close" title="删除组件" onClick={() => this.props.deletecomponent(card.uuid)} /> |
| | |
| | | let MenuType = '' |
| | | let menu = fromJS(window.GLOB.customMenu).toJS() |
| | | let laypage = setting && setting.laypage !== 'false' |
| | | let interfaces = (menu.interfaces || []).map(item => { |
| | | return { |
| | | value: item.uuid, |
| | | label: item.name |
| | | } |
| | | }) |
| | | |
| | | if (menu.parentId === 'BillPrintTemp') { |
| | | MenuType = 'billPrint' |
| | |
| | | options: [ |
| | | {value: 'dynamic', label: '动态', priKeyType: 'static'}, |
| | | {value: 'static', label: '静态', priKeyType: 'static'}, |
| | | {value: 'public', label: '公共数据源', priKeyType: 'static'}, |
| | | ], |
| | | linkFields: ['priKeyType'], |
| | | controlFields: [ |
| | | {field: 'goback', values: ['dynamic']}, |
| | | {field: 'empty', values: ['dynamic']}, |
| | | {field: 'empty', values: ['dynamic', 'public']}, |
| | | {field: 'jump', values: ['dynamic']}, |
| | | {field: 'supModule', values: ['static']}, |
| | | {field: 'publicId', values: ['public']}, |
| | | ], |
| | | forbid: subtype !== 'propcard' |
| | | }, |
| | | { |
| | | type: 'select', |
| | | field: 'publicId', |
| | | label: '数据源', |
| | | initval: wrap.publicId || '', |
| | | required: true, |
| | | options: interfaces, |
| | | forbid: subtype !== 'propcard' |
| | | }, |
| | | { |
| | |
| | | {ParentID: 'dynamic', value: 'static', label: '静态值'}, |
| | | {ParentID: 'dynamic', value: 'dynamic', label: '动态值'}, |
| | | {ParentID: 'dynamic', value: 'joint', label: '拼接值'}, |
| | | {ParentID: 'public', value: 'static', label: '静态值'}, |
| | | {ParentID: 'public', value: 'dynamic', label: '动态值'}, |
| | | {ParentID: 'public', value: 'joint', label: '拼接值'}, |
| | | ], |
| | | forbid: subtype !== 'propcard' |
| | | }, |
| | |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Popover, Modal } from 'antd' |
| | | import { PlusOutlined, SettingOutlined, EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined } from '@ant-design/icons' |
| | | import { PlusOutlined, SettingOutlined, EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined, ClockCircleOutlined } from '@ant-design/icons' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import asyncIconComponent from '@/utils/asyncIconComponent' |
| | |
| | | const CardComponent = asyncComponent(() => import('../cardcomponent')) |
| | | const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) |
| | | const PasteComponent = asyncIconComponent(() => import('@/components/paste')) |
| | | // const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent')) |
| | | const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) |
| | | const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) |
| | | const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) |
| | |
| | | elements: [], |
| | | backElements: [] |
| | | }], |
| | | btnlog: [], |
| | | } |
| | | |
| | | if (card.config) { |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | // MKEmitter.addListener('logButton', this.logButton) |
| | | MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) |
| | | } |
| | | |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | // MKEmitter.removeListener('logButton', this.logButton) |
| | | MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | // 按钮历史记录 |
| | | // logButton = (id, item) => { |
| | | // const { card } = this.state |
| | | |
| | | // if (id !== card.uuid) return |
| | | |
| | | // let btnlog = card.btnlog || [] |
| | | // btnlog.push(item) |
| | | |
| | | // this.updateComponent({...card, btnlog}) |
| | | // } |
| | | |
| | | /** |
| | | * @description 卡片行外层信息更新(数据源,样式等) |
| | | */ |
| | |
| | | |
| | | card.width = card.wrap.width |
| | | card.name = card.wrap.name |
| | | card.btnlog = [] |
| | | |
| | | if (window.GLOB.styling && card.errors) { // 样式修改时不做筛查 |
| | | this.setState({ |
| | |
| | | } |
| | | }) |
| | | } else { |
| | | // if (card.wrap.datatype === 'dynamic') { |
| | | |
| | | // } |
| | | // let supModule = card.setting.supModule ? card.setting.supModule[card.setting.supModule.length - 1] || '' : '' |
| | | // if (supModule === 'empty') { |
| | | // supModule = '' |
| | |
| | | onOk() { |
| | | card.subcards = card.subcards.filter(item => item.uuid !== cell.uuid) |
| | | |
| | | // if (card.btnlog) { |
| | | // card.btnlog = card.btnlog.filter(c => c.$parentId !== cell.uuid) |
| | | // } |
| | | |
| | | _this.updateComponent(card) |
| | | |
| | | if (appType === 'mob') return |
| | |
| | | |
| | | this.updateComponent(card) |
| | | } |
| | | |
| | | // handleLog = (type, logs, item) => { |
| | | // let card = fromJS(this.state.card).toJS() |
| | | |
| | | // if (type === 'revert') { |
| | | // let done = false |
| | | // if (item.$parentId) { |
| | | // card.subcards.forEach(col => { |
| | | // if (item.$parentId === col.uuid) { |
| | | // if (item.$side !== 'back') { |
| | | // col.elements = col.elements ? [...col.elements, item] : [item] |
| | | // } else { |
| | | // col.backElements = col.backElements ? [...col.backElements, item] : [item] |
| | | // } |
| | | // done = true |
| | | // } |
| | | // }) |
| | | // } |
| | | |
| | | // card.btnlog = logs |
| | | |
| | | // this.setState({ card: {...card, subcards: []} }, () => { |
| | | // this.updateComponent(card) |
| | | // }) |
| | | // if (!done) { |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: '附属卡片已删除!', |
| | | // duration: 2 |
| | | // }) |
| | | // } else { |
| | | // notification.success({ |
| | | // top: 92, |
| | | // message: '恢复成功!', |
| | | // duration: 2 |
| | | // }) |
| | | // } |
| | | // } else { |
| | | // card.btnlog = logs |
| | | // this.updateComponent(card) |
| | | // notification.success({ |
| | | // top: 92, |
| | | // message: '清除成功!', |
| | | // duration: 2 |
| | | // }) |
| | | // } |
| | | // } |
| | | |
| | | move = (item, direction) => { |
| | | let card = fromJS(this.state.card).toJS() |
| | |
| | | <CopyComponent type="propcard" card={card}/> |
| | | <PasteComponent options={['cardcell']} updateConfig={this.pasteComponent} /> |
| | | <FontColorsOutlined className="style" title="调整样式" onClick={this.changeStyle}/> |
| | | {/* <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog} /> */} |
| | | <ClockComponent config={card} updateConfig={this.updateComponent}/> |
| | | {card.wrap.datatype === 'dynamic' ? <ClockComponent config={card} updateConfig={this.updateComponent}/> : <ClockCircleOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}}/>} |
| | | <UserComponent config={card}/> |
| | | <DeleteOutlined className="close" title="删除组件" onClick={() => this.props.deletecomponent(card.uuid)} /> |
| | | {card.wrap.datatype !== 'static' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : null} |
| | | {card.wrap.datatype === 'static' ? <SettingOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}}/> : null} |
| | | {card.wrap.datatype === 'dynamic' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : <SettingOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}}/>} |
| | | </div> |
| | | } trigger="hover"> |
| | | <ToolOutlined /> |
| | |
| | | const MobPagination = asyncIconComponent(() => import('@/menu/components/share/mobPagination')) |
| | | const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) |
| | | const PasteComponent = asyncIconComponent(() => import('@/components/paste')) |
| | | // const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent')) |
| | | const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) |
| | | const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) |
| | | const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) |
| | |
| | | elements: [] |
| | | }], |
| | | action: [], |
| | | btnlog: [], |
| | | } |
| | | |
| | | if (card.config) { |
| | |
| | | } |
| | | } |
| | | |
| | | // logButton = (id, item) => { |
| | | // const { card } = this.state |
| | | |
| | | // if (id !== card.uuid) return |
| | | |
| | | // let btnlog = card.btnlog || [] |
| | | // btnlog.push(item) |
| | | |
| | | // this.updateComponent({...card, btnlog}) |
| | | // } |
| | | |
| | | /** |
| | | * @description 卡片行外层信息更新(数据源,样式等) |
| | | */ |
| | | updateComponent = (card) => { |
| | | card.width = card.wrap.width |
| | | card.name = card.wrap.name |
| | | card.btnlog = [] |
| | | |
| | | if (window.GLOB.styling && card.errors) { // 样式修改时不做筛查 |
| | | this.setState({ |
| | |
| | | if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { |
| | | if (!cell.modal || cell.modal.fields.length === 0) { |
| | | card.errors.push({ level: 1, detail: `按钮“${cell.label}”中表单尚未添加`}) |
| | | // } else { |
| | | // cell.modal.fields.forEach(m => { |
| | | // if (m.type === 'linkMain' && !supModule) { |
| | | // card.errors.push({ level: 1, detail: `按钮“${cell.label}”中关联主表表单“${m.label}”无效`}) |
| | | // } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { |
| | | // card.errors.push({ level: 1, detail: `按钮“${cell.label}”中表单“${m.label}”大小写与字段集不一致`}) |
| | | // } |
| | | // }) |
| | | } |
| | | } |
| | | if (linkbtn && linkbtn === cell.uuid) { |
| | |
| | | content: '确定删除卡片吗?', |
| | | onOk() { |
| | | card.subcards = card.subcards.filter(item => item.uuid !== cell.uuid) |
| | | |
| | | // if (card.btnlog) { |
| | | // card.btnlog = card.btnlog.filter(c => c.$parentId !== cell.uuid) |
| | | // } |
| | | |
| | | _this.updateComponent(card) |
| | | |
| | |
| | | // 注册事件-添加搜索 |
| | | MKEmitter.emit('addSearch', card.uuid, newcard) |
| | | } |
| | | |
| | | // handleLog = (type, logs, item) => { |
| | | // let card = fromJS(this.state.card).toJS() |
| | | |
| | | // if (type === 'revert') { |
| | | // let done = false |
| | | // if (item.$parentId) { |
| | | // card.subcards.forEach(col => { |
| | | // if (item.$parentId === col.uuid) { |
| | | // if (item.$side !== 'back') { |
| | | // col.elements = col.elements ? [...col.elements, item] : [item] |
| | | // } else { |
| | | // col.backElements = col.backElements ? [...col.backElements, item] : [item] |
| | | // } |
| | | // done = true |
| | | // } |
| | | // }) |
| | | // } |
| | | |
| | | // card.btnlog = logs |
| | | |
| | | // this.updateComponent(card) |
| | | // if (!done) { |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: '附属卡片已删除!', |
| | | // duration: 2 |
| | | // }) |
| | | // } else { |
| | | // notification.success({ |
| | | // top: 92, |
| | | // message: '恢复成功!', |
| | | // duration: 2 |
| | | // }) |
| | | // } |
| | | // } else { |
| | | // card.btnlog = logs |
| | | // this.updateComponent(card) |
| | | // notification.success({ |
| | | // top: 92, |
| | | // message: '清除成功!', |
| | | // duration: 2 |
| | | // }) |
| | | // } |
| | | // } |
| | | |
| | | move = (item, direction) => { |
| | | let card = fromJS(this.state.card).toJS() |
| | |
| | | <CopyComponent type="tablecard" card={card}/> |
| | | <PasteComponent options={['cardcell', 'search', 'form']} updateConfig={this.pasteComponent} /> |
| | | <FontColorsOutlined className="style" title="调整样式" onClick={this.changeStyle}/> |
| | | {/* <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog} /> */} |
| | | <ClockComponent config={card} updateConfig={this.updateComponent}/> |
| | | <UserComponent config={card}/> |
| | | <DeleteOutlined className="close" title="删除组件" onClick={() => this.props.deletecomponent(card.uuid)} /> |
| | |
| | | const SettingComponent = asyncIconComponent(() => import('@/menu/datasource')) |
| | | const NormalForm = asyncIconComponent(() => import('@/components/normalform')) |
| | | const CardSimpleComponent = asyncComponent(() => import('@/menu/components/card/cardsimplecomponent')) |
| | | // const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent')) |
| | | const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) |
| | | const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) |
| | | const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) |
| | |
| | | style: { borderWidth: '1px', borderColor: '#e8e8e8', marginTop: '8px', marginBottom: '8px', height: '300px' }, |
| | | columns: [], |
| | | scripts: [], |
| | | btnlog: [], |
| | | subcards: [{ |
| | | uuid: Utils.getuuid(), |
| | | setting: {}, |
| | |
| | | } |
| | | } |
| | | |
| | | // logButton = (id, item) => { |
| | | // const { card } = this.state |
| | | |
| | | // if (id !== card.uuid) return |
| | | |
| | | // let btnlog = card.btnlog || [] |
| | | // btnlog.push(item) |
| | | |
| | | // this.updateComponent({...card, btnlog}) |
| | | // } |
| | | |
| | | /** |
| | | * @description 卡片行外层信息更新(数据源,样式等) |
| | | */ |
| | | updateComponent = (card) => { |
| | | card.width = card.wrap.width |
| | | card.name = card.wrap.name |
| | | card.btnlog = [] |
| | | |
| | | if (window.GLOB.styling && card.errors) { // 样式修改时不做筛查 |
| | | this.setState({ |
| | |
| | | onOk() { |
| | | card.subcards = card.subcards.filter(item => item.uuid !== cell.uuid) |
| | | |
| | | // if (card.btnlog) { |
| | | // card.btnlog = card.btnlog.filter(c => c.$parentId !== cell.uuid) |
| | | // } |
| | | |
| | | _this.updateComponent(card) |
| | | |
| | | if (appType === 'mob') return |
| | |
| | | this.updateComponent(_card) |
| | | } |
| | | |
| | | // handleLog = (type, logs, item) => { |
| | | // let card = fromJS(this.state.card).toJS() |
| | | |
| | | // if (type === 'revert') { |
| | | // card.subcards.forEach(col => { |
| | | // col.elements = [...col.elements, item] |
| | | // if (item.$parentId === col.uuid) { |
| | | // col.elements = [...col.elements, item] |
| | | // } |
| | | // }) |
| | | |
| | | // card.btnlog = logs |
| | | |
| | | // this.updateComponent(card) |
| | | // notification.success({ |
| | | // top: 92, |
| | | // message: '恢复成功!', |
| | | // duration: 2 |
| | | // }) |
| | | // } else { |
| | | // card.btnlog = logs |
| | | // this.updateComponent(card) |
| | | // notification.success({ |
| | | // top: 92, |
| | | // message: '清除成功!', |
| | | // duration: 2 |
| | | // }) |
| | | // } |
| | | // } |
| | | |
| | | getWrapForms = () => { |
| | | const { card } = this.state |
| | | |
| | |
| | | </NormalForm> |
| | | <CopyComponent type="datacard" card={card}/> |
| | | <FontColorsOutlined className="style" title="调整样式" onClick={this.changeStyle}/> |
| | | {/* <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog}/> */} |
| | | <ClockComponent config={card} updateConfig={this.updateComponent}/> |
| | | <UserComponent config={card}/> |
| | | <DeleteOutlined className="close" title="删除组件" onClick={() => this.props.deletecomponent(card.uuid)}/> |
| | |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Popover, Modal, Carousel } from 'antd' |
| | | import { PlusOutlined, SettingOutlined, EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined } from '@ant-design/icons' |
| | | import { PlusOutlined, SettingOutlined, EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined, ClockCircleOutlined } from '@ant-design/icons' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import asyncIconComponent from '@/utils/asyncIconComponent' |
| | |
| | | const CardSimpleComponent = asyncComponent(() => import('@/menu/components/card/cardsimplecomponent')) |
| | | const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) |
| | | const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent')) |
| | | // const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent')) |
| | | const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) |
| | | const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) |
| | | |
| | |
| | | setting: {}, |
| | | style: {}, |
| | | elements: [], |
| | | }], |
| | | btnlog: [], |
| | | }] |
| | | } |
| | | |
| | | if (card.config) { |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | // MKEmitter.addListener('logButton', this.logButton) |
| | | MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) |
| | | } |
| | | |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | // MKEmitter.removeListener('logButton', this.logButton) |
| | | MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | // logButton = (id, item) => { |
| | | // const { card } = this.state |
| | | |
| | | // if (id !== card.uuid) return |
| | | |
| | | // let btnlog = card.btnlog || [] |
| | | // btnlog.push(item) |
| | | |
| | | // this.updateComponent({...card, btnlog}) |
| | | // } |
| | | |
| | | /** |
| | | * @description 卡片行外层信息更新(数据源,样式等) |
| | | */ |
| | | updateComponent = (card) => { |
| | | card.width = card.wrap.width |
| | | card.name = card.wrap.name |
| | | card.btnlog = [] |
| | | |
| | | if (window.GLOB.styling && card.errors) { // 样式修改时不做筛查 |
| | | this.setState({ |
| | |
| | | onOk() { |
| | | card.subcards = card.subcards.filter(item => item.uuid !== cell.uuid) |
| | | |
| | | // if (card.btnlog) { |
| | | // card.btnlog = card.btnlog.filter(c => c.$parentId !== cell.uuid) |
| | | // } |
| | | |
| | | _this.updateComponent(card) |
| | | |
| | | if (appType === 'mob') return |
| | |
| | | this.updateComponent(card) |
| | | } |
| | | |
| | | // handleLog = (type, logs, item) => { |
| | | // let card = fromJS(this.state.card).toJS() |
| | | |
| | | // if (type === 'revert') { |
| | | // let done = false |
| | | // if (item.$parentId) { |
| | | // card.subcards.forEach(col => { |
| | | // if (item.$parentId === col.uuid) { |
| | | // col.elements = [...col.elements, item] |
| | | // done = true |
| | | // } |
| | | // }) |
| | | // } |
| | | |
| | | // card.btnlog = logs |
| | | |
| | | // this.setState({ card: {...card, subcards: []} }, () => { |
| | | // this.updateComponent(card) |
| | | // }) |
| | | // if (!done) { |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: '附属卡片已删除!', |
| | | // duration: 2 |
| | | // }) |
| | | // } else { |
| | | // notification.success({ |
| | | // top: 92, |
| | | // message: '恢复成功!', |
| | | // duration: 2 |
| | | // }) |
| | | // } |
| | | // } else { |
| | | // card.btnlog = logs |
| | | // this.updateComponent(card) |
| | | // notification.success({ |
| | | // top: 92, |
| | | // message: '清除成功!', |
| | | // duration: 2 |
| | | // }) |
| | | // } |
| | | // } |
| | | |
| | | move = (item, direction) => { |
| | | let card = fromJS(this.state.card).toJS() |
| | | |
| | |
| | | <CopyComponent type="propcard" card={card}/> |
| | | <PasteComponent config={card} options={['cardcell']} updateConfig={this.updateComponent} /> |
| | | <FontColorsOutlined className="style" title="调整样式" onClick={this.changeStyle}/> |
| | | {/* <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog} /> */} |
| | | <ClockComponent config={card} updateConfig={this.updateComponent}/> |
| | | {card.wrap.datatype === 'dynamic' ? <ClockComponent config={card} updateConfig={this.updateComponent}/> : <ClockCircleOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}}/>} |
| | | <UserComponent config={card}/> |
| | | <DeleteOutlined className="close" title="删除组件" onClick={() => this.props.deletecomponent(card.uuid)} /> |
| | | {card.wrap.datatype !== 'static' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : null} |
| | | {card.wrap.datatype === 'static' ? <SettingOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}}/> : null} |
| | | {card.wrap.datatype === 'dynamic' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : <SettingOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}}/>} |
| | | </div> |
| | | } trigger="hover"> |
| | | <ToolOutlined/> |
| | |
| | | |
| | | const SettingComponent = asyncIconComponent(() => import('@/menu/datasource')) |
| | | const ChartCompileForm = asyncIconComponent(() => import('./chartcompile')) |
| | | // const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent')) |
| | | const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) |
| | | const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent')) |
| | | const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) |
| | |
| | | search: [], |
| | | action: [], |
| | | plot: _plot, |
| | | btnlog: [], |
| | | } |
| | | |
| | | if (card.config) { |
| | |
| | | |
| | | card.width = card.plot.width |
| | | card.name = card.plot.name |
| | | card.btnlog = [] |
| | | card.errors = [] |
| | | |
| | | let columns = card.columns.map(c => c.field) |
| | |
| | | this.updateComponent(_card) |
| | | } |
| | | |
| | | // handleLog = (type, logs, item) => { |
| | | // let card = fromJS(this.state.card).toJS() |
| | | |
| | | // if (type === 'revert') { |
| | | // card.action = card.action ? [...card.action, item] : [item] |
| | | // card.btnlog = logs |
| | | |
| | | // this.updateComponent(card) |
| | | // notification.success({ |
| | | // top: 92, |
| | | // message: '恢复成功!', |
| | | // duration: 2 |
| | | // }) |
| | | // } else { |
| | | // card.btnlog = logs |
| | | // this.updateComponent(card) |
| | | // notification.success({ |
| | | // top: 92, |
| | | // message: '清除成功!', |
| | | // duration: 2 |
| | | // }) |
| | | // } |
| | | // } |
| | | |
| | | clickComponent = (e) => { |
| | | if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { |
| | | e.stopPropagation() |
| | |
| | | <CopyComponent type="line" card={card}/> |
| | | <PasteComponent config={card} options={['action', 'search']} updateConfig={this.updateComponent} /> |
| | | <FontColorsOutlined className="style" title="调整样式" onClick={this.changeStyle}/> |
| | | {/* <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog} /> */} |
| | | <ClockComponent config={card} updateConfig={this.updateComponent}/> |
| | | <UserComponent config={card}/> |
| | | <DeleteOutlined className="close" title="delete" onClick={() => this.props.deletecomponent(card.uuid)} /> |
| | |
| | | search: [], |
| | | action: [], |
| | | plot: _plot, |
| | | btnlog: [], |
| | | } |
| | | |
| | | if (card.config) { |
| | |
| | | |
| | | const SettingComponent = asyncIconComponent(() => import('@/menu/datasource')) |
| | | const ChartCompileForm = asyncIconComponent(() => import('./chartcompile')) |
| | | // const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent')) |
| | | const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) |
| | | const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent')) |
| | | const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) |
| | |
| | | search: [], |
| | | action: [], |
| | | plot: _plot, |
| | | btnlog: [], |
| | | } |
| | | |
| | | if (card.config) { |
| | |
| | | this.updateComponent(_card) |
| | | } |
| | | |
| | | // handleLog = (type, logs, item) => { |
| | | // let card = fromJS(this.state.card).toJS() |
| | | |
| | | // if (type === 'revert') { |
| | | // card.action = card.action ? [...card.action, item] : [item] |
| | | // card.btnlog = logs |
| | | |
| | | // this.updateComponent(card) |
| | | // notification.success({ |
| | | // top: 92, |
| | | // message: '恢复成功!', |
| | | // duration: 2 |
| | | // }) |
| | | // } else { |
| | | // card.btnlog = logs |
| | | // this.updateComponent(card) |
| | | // notification.success({ |
| | | // top: 92, |
| | | // message: '清除成功!', |
| | | // duration: 2 |
| | | // }) |
| | | // } |
| | | // } |
| | | |
| | | clickComponent = (e) => { |
| | | if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { |
| | | e.stopPropagation() |
| | |
| | | <CopyComponent type="line" card={card}/> |
| | | <PasteComponent config={card} options={['action', 'search']} updateConfig={this.updateComponent}/> |
| | | <FontColorsOutlined className="style" title="调整样式" onClick={this.changeStyle}/> |
| | | {/* <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog}/> */} |
| | | <ClockComponent config={card} updateConfig={this.updateComponent}/> |
| | | <UserComponent config={card}/> |
| | | <DeleteOutlined className="close" title="delete" onClick={() => this.props.deletecomponent(card.uuid)}/> |
| | |
| | | search: [], |
| | | action: [], |
| | | plot: _plot, |
| | | btnlog: [], |
| | | } |
| | | |
| | | if (card.config) { |
| | |
| | | |
| | | _actionlist = _actionlist.filter(item => item.uuid !== card.uuid) |
| | | |
| | | let btnlog = config.btnlog || [] |
| | | if (card.OpenType === 'popview' || card.verify || card.modal) { |
| | | btnlog.push(card) |
| | | } |
| | | |
| | | _this.setState({ |
| | | actionlist: _actionlist |
| | | }, () => { |
| | | _this.props.updateaction({...config, action: _actionlist, btnlog}) |
| | | _this.props.updateaction({...config, action: _actionlist}) |
| | | }) |
| | | |
| | | if (card.origin || appType === 'mob') return |
| | |
| | | |
| | | class PopSource extends Component { |
| | | static propTpyes = { |
| | | btnlog: PropTypes.array, |
| | | keyword: PropTypes.string, |
| | | handlelog: PropTypes.func |
| | | keyword: PropTypes.string |
| | | } |
| | | |
| | | state = { |
| | |
| | | |
| | | class UserComponent extends Component { |
| | | static propTpyes = { |
| | | btnlog: PropTypes.array |
| | | config: PropTypes.object |
| | | } |
| | | |
| | | state = { |
| | |
| | | { origin: true, uuid: Utils.getuuid(), Align: 'left', label: 'label3', field: '', Hide: 'false', IsSort: 'true', type: 'text', Width: 120 }, |
| | | ], |
| | | scripts: [], |
| | | btnlog: [], |
| | | isNew: true |
| | | } |
| | | |
| | |
| | | this.updateComponent(card) |
| | | } |
| | | |
| | | // handleLog = (type, logs, item) => { |
| | | // let card = fromJS(this.state.card).toJS() |
| | | |
| | | // if (type === 'revert') { |
| | | // let done = false |
| | | // if (item.$parentId) { |
| | | // card.cols.forEach(col => { |
| | | // if (col.type !== 'action') return |
| | | // if (item.$parentId === col.uuid) { |
| | | // col.elements = col.elements ? [...col.elements, item] : [item] |
| | | // done = true |
| | | // } |
| | | // }) |
| | | // } |
| | | |
| | | // if (!done) { |
| | | // card.action = card.action ? [...card.action, item] : [item] |
| | | // } |
| | | |
| | | // card.btnlog = logs |
| | | |
| | | // this.updateComponent(card) |
| | | // notification.success({ |
| | | // top: 92, |
| | | // message: '恢复成功!', |
| | | // duration: 2 |
| | | // }) |
| | | // } else { |
| | | // card.btnlog = logs |
| | | // this.updateComponent(card) |
| | | // notification.success({ |
| | | // top: 92, |
| | | // message: '清除成功!', |
| | | // duration: 2 |
| | | // }) |
| | | // } |
| | | // } |
| | | |
| | | getWrapForms = () => { |
| | | const { wrap, action, columns, cols } = this.state.card |
| | | |
| | |
| | | <CopyComponent type="normaltable" card={card}/> |
| | | <PasteComponent config={card} options={options} updateConfig={this.updateComponent} /> |
| | | <FontColorsOutlined className="style" title="调整样式" onClick={this.changeStyle}/> |
| | | {/* <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog} /> */} |
| | | <UserComponent config={card}/> |
| | | <DeleteOutlined className="close" title="删除组件" onClick={() => this.props.deletecomponent(card.uuid)} /> |
| | | <SettingComponent config={card} updateConfig={this.updateComponent} /> |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | this.getsysScript() |
| | | } |
| | | |
| | | getsysScript = () => { |
| | | if (sessionStorage.getItem('mk_sys_scripts')) { |
| | | this.setState({ |
| | | systemScripts: JSON.parse(sessionStorage.getItem('mk_sys_scripts')) |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let _scriptSql = `Select distinct func+Remark as funcname,longparam, s.Sort from s_custom_script s inner join (select OpenID from sapp where ID=@Appkey@) p on s.openid = case when s.appkey='' then s.openid else p.OpenID end order by s.Sort` |
| | | |
| | | _scriptSql = Utils.formatOptions(_scriptSql) |
| | |
| | | |
| | | Api.getSystemConfig(_sParam).then(res => { |
| | | if (res.status) { |
| | | let _scripts = res.data.map(item => { |
| | | return { |
| | | name: item.funcname, |
| | | value: window.decodeURIComponent(window.atob(item.longparam)) |
| | | } |
| | | }) |
| | | |
| | | sessionStorage.setItem('mk_sys_scripts', JSON.stringify(_scripts)) |
| | | |
| | | this.setState({ |
| | | systemScripts: res.data.map(item => { |
| | | return { |
| | | name: item.funcname, |
| | | value: window.decodeURIComponent(window.atob(item.longparam)) |
| | | } |
| | | }) |
| | | systemScripts: _scripts |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | |
| | | { origin: true, uuid: Utils.getuuid(), Align: 'left', label: 'label3', field: '', Hide: 'false', IsSort: 'true', type: 'text', Width: 120 }, |
| | | ], |
| | | scripts: [], |
| | | btnlog: [], |
| | | submit: {intertype: 'system', default: 'true', innerFunc: '', execSuccess: 'grid', execError: 'never', scripts: [], uniques: []}, |
| | | isNew: true |
| | | } |
| | |
| | | const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) |
| | | const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent')) |
| | | const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) |
| | | // const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent')) |
| | | const ColumnComponent = asyncComponent(() => import('./columns')) |
| | | |
| | | class TableCardEditComponent extends Component { |
| | |
| | | { origin: true, uuid: Utils.getuuid(), Align: 'left', label: 'label3', field: '', Hide: 'false', IsSort: 'true', type: 'text', Width: 120 }, |
| | | ], |
| | | scripts: [], |
| | | btnlog: [], |
| | | isNew: true |
| | | } |
| | | |
| | |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('submitModal', this.handleSave) |
| | | // MKEmitter.addListener('logButton', this.logButton) |
| | | MKEmitter.addListener('completeSave', this.completeSave) |
| | | } |
| | | |
| | |
| | | return |
| | | } |
| | | MKEmitter.removeListener('submitModal', this.handleSave) |
| | | // MKEmitter.removeListener('logButton', this.logButton) |
| | | MKEmitter.removeListener('completeSave', this.completeSave) |
| | | } |
| | | |
| | |
| | | this.props.updateConfig(_card) |
| | | } |
| | | |
| | | // logButton = (id, item) => { |
| | | // const { card } = this.state |
| | | |
| | | // if (id !== card.uuid) return |
| | | |
| | | // let btnlog = card.btnlog || [] |
| | | // btnlog.push(item) |
| | | |
| | | // this.updateComponent({...card, btnlog}) |
| | | // } |
| | | |
| | | changeStyle = () => { |
| | | const { card } = this.state |
| | | |
| | |
| | | this.updateComponent(card) |
| | | } |
| | | |
| | | // handleLog = (type, logs, item) => { |
| | | // let card = fromJS(this.state.card).toJS() |
| | | |
| | | // if (type === 'revert') { |
| | | // let done = false |
| | | // if (item.$parentId) { |
| | | // card.cols.forEach(col => { |
| | | // if (col.type !== 'action') return |
| | | // if (item.$parentId === col.uuid) { |
| | | // col.elements = col.elements ? [...col.elements, item] : [item] |
| | | // done = true |
| | | // } |
| | | // }) |
| | | // } |
| | | |
| | | // if (!done) { |
| | | // card.action = card.action ? [...card.action, item] : [item] |
| | | // } |
| | | |
| | | // card.btnlog = logs |
| | | |
| | | // this.updateComponent(card) |
| | | // notification.success({ |
| | | // top: 92, |
| | | // message: '恢复成功!', |
| | | // duration: 2 |
| | | // }) |
| | | // } else { |
| | | // card.btnlog = logs |
| | | // this.updateComponent(card) |
| | | // notification.success({ |
| | | // top: 92, |
| | | // message: '清除成功!', |
| | | // duration: 2 |
| | | // }) |
| | | // } |
| | | // } |
| | | |
| | | getWrapForms = () => { |
| | | const { wrap, action, columns, cols } = this.state.card |
| | | |
| | |
| | | <CopyComponent type="normaltable" card={card}/> |
| | | <PasteComponent config={card} options={options} updateConfig={this.updateComponent} /> |
| | | <FontColorsOutlined className="style" title="调整样式" onClick={this.changeStyle}/> |
| | | {/* <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog} /> */} |
| | | <ClockComponent config={card} updateConfig={this.updateComponent}/> |
| | | <UserComponent config={card}/> |
| | | <DeleteOutlined className="close" title="删除组件" onClick={() => this.props.deletecomponent(card.uuid)} /> |
| | |
| | | const { config } = this.props |
| | | const { appType } = this.state |
| | | |
| | | if (config.type === 'interface') { // 公共数据源不使用搜索 |
| | | this.setState({visible: true}) |
| | | return |
| | | } |
| | | |
| | | let search = [] |
| | | let menu = fromJS(window.GLOB.customMenu).toJS() |
| | | |
| | |
| | | } |
| | | |
| | | getsysScript = () => { |
| | | if (sessionStorage.getItem('mk_sys_scripts')) { |
| | | this.setState({ |
| | | systemScripts: JSON.parse(sessionStorage.getItem('mk_sys_scripts')) |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let _scriptSql = `Select distinct func+Remark as funcname,longparam, s.Sort from s_custom_script s inner join (select OpenID from sapp where ID=@Appkey@) p on s.openid = case when s.appkey='' then s.openid else p.OpenID end order by s.Sort` |
| | | |
| | | _scriptSql = Utils.formatOptions(_scriptSql) |
| | |
| | | |
| | | Api.getSystemConfig(_sParam).then(res => { |
| | | if (res.status) { |
| | | let _scripts = [] |
| | | |
| | | res.data.forEach(item => { |
| | | let _item = { |
| | | let _scripts = res.data.map(item => { |
| | | return { |
| | | name: item.funcname, |
| | | value: window.decodeURIComponent(window.atob(item.longparam)) |
| | | } |
| | | |
| | | _scripts.push(_item) |
| | | }) |
| | | |
| | | sessionStorage.setItem('mk_sys_scripts', JSON.stringify(_scripts)) |
| | | |
| | | this.setState({ |
| | | systemScripts: _scripts |
| | | }) |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { fromJS } from 'immutable' |
| | | import { Form, Row, Col, Input, Radio, Tooltip, notification, Select, InputNumber, Cascader } from 'antd' |
| | | import { QuestionCircleOutlined } from '@ant-design/icons' |
| | | |
| | |
| | | } |
| | | |
| | | state = { |
| | | interType: this.props.setting.interType || 'system', |
| | | laypage: this.props.setting.laypage || 'true', |
| | | setting: null, |
| | | modules: [], |
| | | usefulFields: [], |
| | | useMSearch: this.props.setting.useMSearch || 'false', |
| | | sysInterface: this.props.setting.sysInterface || 'false', |
| | | supModule: this.props.setting.supModule || [], |
| | | innerRules: [], |
| | | innertip: '', |
| | | appType: sessionStorage.getItem('appType') |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { config } = this.props |
| | | const { config, setting } = this.props |
| | | |
| | | let modules = MenuUtils.getSupModules(window.GLOB.customMenu.components, config.uuid) || [] |
| | | |
| | |
| | | }) |
| | | |
| | | let usefulFields = sessionStorage.getItem('permFuncField') |
| | | let innerRules = [] |
| | | let innertip = '' |
| | | if (usefulFields) { |
| | | try { |
| | | usefulFields = JSON.parse(usefulFields) |
| | | |
| | | if (usefulFields.length > 0) { |
| | | innertip = '开头可用字符:' + usefulFields.join(', ') |
| | | let str = '^(' + usefulFields.join('|') + ')' |
| | | let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g') |
| | | |
| | | innerRules.push({ |
| | | pattern: _patten, |
| | | message: formRule.func.innerMessage |
| | | }) |
| | | } |
| | | } catch (e) { |
| | | usefulFields = [] |
| | | innerRules = [] |
| | | } |
| | | } else { |
| | | usefulFields = [] |
| | | } |
| | | |
| | | this.setState({modules, usefulFields}) |
| | | let _setting = fromJS(setting).toJS() |
| | | _setting.interType = setting.interType || 'system' |
| | | _setting.laypage = setting.laypage || 'true' |
| | | _setting.useMSearch = setting.useMSearch || 'false' |
| | | _setting.sysInterface = setting.sysInterface || 'false' |
| | | _setting.supModule = setting.supModule || [] |
| | | _setting.execute = setting.execute || 'true' |
| | | |
| | | this.setState({modules, innerRules, innertip, setting: _setting}) |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | |
| | | } |
| | | |
| | | // 数据源前端验证 |
| | | if (values.interType === 'system' && values.execute !== 'false' && !values.dataresource) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请填写内部函数或数据源!', |
| | | duration: 5 |
| | | }) |
| | | reject() |
| | | return |
| | | } else if (values.interType === 'system' && values.execute !== 'false' && values.dataresource) { |
| | | if (values.interType === 'system' && values.execute !== 'false' && values.dataresource) { |
| | | let _quot = values.dataresource.match(/'{1}/g) |
| | | let _lparen = values.dataresource.match(/\({1}/g) |
| | | let _rparen = values.dataresource.match(/\){1}/g) |
| | |
| | | }) |
| | | } |
| | | |
| | | onRadioChange = (e, key) => { |
| | | let value = e.target.value |
| | | onOptionChange = (value, key) => { |
| | | let setting = fromJS(this.state.setting).toJS() |
| | | setting[key] = value |
| | | |
| | | if (key === 'interType') { |
| | | this.setState({ |
| | | interType: value |
| | | }) |
| | | } |
| | | } |
| | | |
| | | onSysInter = (e) => { |
| | | let value = e.target.value |
| | | |
| | | this.setState({ |
| | | sysInterface: value |
| | | }) |
| | | if (value === 'true') { |
| | | this.setState({setting}) |
| | | |
| | | if (key === 'sysInterface' && value === 'true') { |
| | | this.props.form.setFieldsValue({interface: window.GLOB.mainSystemApi}) |
| | | } |
| | | } |
| | | |
| | | changeSupModule = (val) => { |
| | | this.setState({supModule: val}) |
| | | } |
| | | |
| | | render() { |
| | | const { setting, columns, config } = this.props |
| | | const { columns, config } = this.props |
| | | const { getFieldDecorator } = this.props.form |
| | | const { interType, modules, useMSearch, laypage, supModule, usefulFields, appType, sysInterface } = this.state |
| | | const { setting, modules, innerRules, appType, innertip } = this.state |
| | | |
| | | const formItemLayout = { |
| | | labelCol: { |
| | |
| | | } |
| | | } |
| | | |
| | | let tooltip = null |
| | | let rules = [] |
| | | |
| | | if (usefulFields.length > 0) { |
| | | tooltip = '开头可用字符:' + usefulFields.join(', ') |
| | | let str = '^(' + usefulFields.join('|') + ')' |
| | | let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g') |
| | | |
| | | rules.push({ |
| | | pattern: _patten, |
| | | message: formRule.func.innerMessage |
| | | }) |
| | | } |
| | | |
| | | return ( |
| | | <div className="model-datasource-setting-form-box"> |
| | | <Form {...formItemLayout} className="model-setting-form"> |
| | | <Row gutter={24}> |
| | | {config.type === 'interface' ? <Col span={8}> |
| | | <Form.Item label="数据源名称"> |
| | | {getFieldDecorator('name', { |
| | | initialValue: setting.name, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.input'] + '数据源名称!' |
| | | } |
| | | ] |
| | | })(<Input placeholder={''} autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={8}> |
| | | <Form.Item label="表名"> |
| | | {getFieldDecorator('tableName', { |
| | |
| | | <Col span={8}> |
| | | <Form.Item label="接口类型"> |
| | | {getFieldDecorator('interType', { |
| | | initialValue: interType, |
| | | initialValue: setting.interType, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | |
| | | }, |
| | | ] |
| | | })( |
| | | <Radio.Group onChange={(e) => {this.onRadioChange(e, 'interType')}}> |
| | | <Radio.Group onChange={(e) => {this.onOptionChange(e.target.value, 'interType')}}> |
| | | <Radio value="system">系统</Radio> |
| | | <Radio value="inner">内部</Radio> |
| | | <Radio value="outer">外部</Radio> |
| | | </Radio.Group>)} |
| | | </Form.Item> |
| | | </Col> |
| | | {interType === 'outer' ? <Col span={8}> |
| | | {setting.interType === 'outer' ? <Col span={8}> |
| | | <Form.Item label="系统接口"> |
| | | {getFieldDecorator('sysInterface', { |
| | | initialValue: sysInterface, |
| | | initialValue: setting.sysInterface, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | |
| | | } |
| | | ] |
| | | })( |
| | | <Radio.Group onChange={this.onSysInter}> |
| | | <Radio.Group onChange={(e) => {this.onOptionChange(e.target.value, 'sysInterface')}}> |
| | | <Radio value="true">是</Radio> |
| | | <Radio value="false">否</Radio> |
| | | </Radio.Group>)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType === 'inner' ? <Col span={8}> |
| | | <Form.Item label={tooltip ? |
| | | <Tooltip placement="topLeft" title={tooltip}> |
| | | {setting.interType === 'inner' ? <Col span={8}> |
| | | <Form.Item label={innertip ? |
| | | <Tooltip placement="topLeft" title={innertip}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 内部函数 |
| | | </Tooltip> : '内部函数' |
| | |
| | | required: true, |
| | | message: this.props.dict['form.required.input'] + '内部函数!' |
| | | }, |
| | | ...rules |
| | | ...innerRules |
| | | ] |
| | | })(<Input placeholder={''} autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType === 'outer' ? <Col className="outer-interface" span={24}> |
| | | {setting.interType === 'outer' ? <Col className="outer-interface" span={24}> |
| | | <Form.Item label="接口地址"> |
| | | {getFieldDecorator('interface', { |
| | | initialValue: setting.interface || (sysInterface === 'true' ? window.GLOB.mainSystemApi : ''), |
| | | initialValue: setting.interface || (setting.sysInterface === 'true' ? window.GLOB.mainSystemApi : ''), |
| | | rules: [ |
| | | { |
| | | required: sysInterface !== 'true' ? true : false, |
| | | required: setting.sysInterface !== 'true' ? true : false, |
| | | message: this.props.dict['form.required.input'] + '接口地址!' |
| | | } |
| | | ] |
| | | })(<TextArea rows={2} readOnly={sysInterface === 'true'}/>)} |
| | | })(<TextArea rows={2} readOnly={setting.sysInterface === 'true'}/>)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType === 'outer' && sysInterface !== 'true' ? <Col className="outer-interface" span={24}> |
| | | {setting.interType === 'outer' && setting.sysInterface !== 'true' ? <Col className="outer-interface" span={24}> |
| | | <Form.Item label={<Tooltip placement="topLeft" title="正式系统接口地址,为空时使用接口地址"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 正式地址 |
| | |
| | | })(<TextArea rows={2}/>)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType === 'outer' ? <Col span={8}> |
| | | {setting.interType === 'outer' ? <Col span={8}> |
| | | <Form.Item label="外部函数"> |
| | | {getFieldDecorator('outerFunc', { |
| | | initialValue: setting.outerFunc || '', |
| | | rules: [ |
| | | |
| | | ] |
| | | initialValue: setting.outerFunc || '' |
| | | })(<Input placeholder={''} autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType === 'system' ? <Col span={24} className="data-source" style={{paddingLeft: '7px'}}> |
| | | {setting.interType === 'system' ? <Col span={24} className="data-source" style={{paddingLeft: '7px'}}> |
| | | <Form.Item labelCol={{xs: { span: 24 }, sm: { span: 2 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 22 }} } label={ |
| | | <Tooltip placement="topLeft" title={`使用系统函数时,需填写数据源。注:数据权限替换符 $@ -> /* 或 ''、 @$ -> */ 或 '';查询替换符 $select@ -> /* 或 ''、 @select$ -> */ 或 '';统计替换符 $sum@ -> /* 或 ''、 @sum$ -> */ 或 ''。`}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('dataresource', { |
| | | initialValue: setting.dataresource || '' |
| | | initialValue: setting.dataresource || '', |
| | | rules: [ |
| | | { |
| | | required: setting.execute !== 'false' ? true : false, |
| | | message: this.props.dict['form.required.input'] + '数据源!' |
| | | } |
| | | ] |
| | | })(<CodeMirror />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType === 'system' ? <Col span={8}> |
| | | {setting.interType === 'system' ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title={'查询时,搜索条件以where条件拼接进入sql,统计时,将数据源中以“@+搜索字段+@”的内容,以搜索条件中的值进行替换后,提交查询,注:查询类型仅在使用系统函数时有效。'}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | |
| | | })(<Input placeholder={'ID asc, UID desc'} autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType === 'system' ? <Col span={8}> |
| | | {setting.interType === 'system' ? <Col span={8}> |
| | | <Form.Item label="默认sql"> |
| | | {getFieldDecorator('execute', { |
| | | initialValue: setting.execute || 'true' |
| | | initialValue: setting.execute |
| | | })( |
| | | <Radio.Group> |
| | | <Radio.Group onChange={(e) => {this.onOptionChange(e.target.value, 'execute')}}> |
| | | <Radio value="true">执行</Radio> |
| | | <Radio value="false">不执行</Radio> |
| | | </Radio.Group>)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {!['navbar', 'balcony', 'menubar'].includes(config.type) && (!config.wrap || config.wrap.supType !== 'multi') ? <Col span={8}> |
| | | {!['navbar', 'balcony', 'menubar', 'interface'].includes(config.type) && (!config.wrap || config.wrap.supType !== 'multi') ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title={'该组件如果受其他组件控制,请选项相应的组件,没有时选“无”。'}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('supModule', { |
| | | initialValue: supModule, |
| | | initialValue: setting.supModule, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | |
| | | } |
| | | ] |
| | | })( |
| | | <Cascader options={modules} onChange={this.changeSupModule} expandTrigger="hover" placeholder="" /> |
| | | <Cascader options={modules} onChange={(val) => {this.onOptionChange(val, 'supModule')}} expandTrigger="hover" placeholder="" /> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | |
| | | {getFieldDecorator('laypage', { |
| | | initialValue: setting.laypage || 'true' |
| | | })( |
| | | <Radio.Group onChange={(e) => this.setState({laypage: e.target.value})}> |
| | | <Radio.Group onChange={(e) => {this.onOptionChange(e.target.value, 'laypage')}}> |
| | | <Radio value="true">是</Radio> |
| | | <Radio value="false">否</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {config.pageable && laypage !== 'false' ? <Col span={8}> |
| | | {config.pageable && setting.laypage !== 'false' ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="选择分页时有效。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {/* 1、不分页且不存在上级模块 */} |
| | | {!['navbar'].includes(config.type) && !['editable'].includes(config.subtype) && (!config.pageable || (config.pageable && laypage === 'false')) && (!supModule || supModule.length === 0 || supModule[0] === 'empty') ? <Col span={8}> |
| | | {!['navbar', 'interface'].includes(config.type) && !['editable'].includes(config.subtype) && (!config.pageable || (config.pageable && setting.laypage === 'false')) && (setting.supModule.length === 0 || setting.supModule[0] === 'empty') ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title={'初始化加载时,是否与其他组件一同加载数据,注:仅在使用系统函数,且初始化加载数据时有效,分页请求时无效。'}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {!['navbar', 'balcony', 'menubar'].includes(config.type) ? <Col span={8}> |
| | | {!['navbar', 'balcony', 'menubar', 'interface'].includes(config.type) ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title={'优先使用同级的搜索条件组件,同级搜索不存在时,依次向上选取,与当前组件的搜索条件一同用作数据过滤(当前组件的搜索条件优先)。'}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | |
| | | {getFieldDecorator('useMSearch', { |
| | | initialValue: setting.useMSearch || 'true' |
| | | })( |
| | | <Radio.Group onChange={(e) => this.setState({useMSearch: e.target.value})}> |
| | | <Radio.Group onChange={(e) => {this.onOptionChange(e.target.value, 'useMSearch')}}> |
| | | <Radio value="true">使用</Radio> |
| | | <Radio value="false">不使用</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {!['navbar', 'balcony', 'menubar'].includes(config.type) && useMSearch === 'true' && appType !== 'mob' ? <Col span={8}> |
| | | {!['navbar', 'balcony', 'menubar', 'interface'].includes(config.type) && setting.useMSearch === 'true' && appType !== 'mob' ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title={'外层搜索条件改变时,是否刷新当前组件数据。'}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | |
| | | </Radio.Group>)} |
| | | </Form.Item> |
| | | </Col> |
| | | {!['navbar', 'balcony', 'menubar'].includes(config.type) ? <Col span={8}> |
| | | {!['navbar', 'balcony', 'menubar', 'interface'].includes(config.type) ? <Col span={8}> |
| | | <Form.Item label="初始化数据"> |
| | | {getFieldDecorator('onload', { |
| | | initialValue: setting.onload || 'true' |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {config.type === 'interface' ? <Col span={8}> |
| | | <Form.Item label="定时器"> |
| | | {getFieldDecorator('timer', { |
| | | initialValue: setting.timer || '' |
| | | })( |
| | | <Select onChange={(value) => {this.onOptionChange(value, 'timer')}}> |
| | | <Select.Option value=""> 无 </Select.Option> |
| | | <Select.Option value="2s"> 2秒 </Select.Option> |
| | | <Select.Option value="5s"> 5秒 </Select.Option> |
| | | <Select.Option value="15s"> 15秒 </Select.Option> |
| | | <Select.Option value="30s"> 30秒 </Select.Option> |
| | | <Select.Option value="1min"> 1分钟 </Select.Option> |
| | | <Select.Option value="5min"> 5分钟 </Select.Option> |
| | | <Select.Option value="10min"> 10分钟 </Select.Option> |
| | | <Select.Option value="15min"> 15分钟 </Select.Option> |
| | | <Select.Option value="30min"> 30分钟 </Select.Option> |
| | | <Select.Option value="1hour"> 1小时 </Select.Option> |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {config.type === 'interface' && setting.timer ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="定时器执行次数。注:0表示没有限制。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 执行次数 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('timerRepeats', { |
| | | initialValue: setting.timerRepeats || 0 |
| | | })(<InputNumber min={0} max={500} precision={0} />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | </Row> |
| | | </Form> |
| | | </div> |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Modal, Button, Popconfirm, message } from 'antd' |
| | | import { StopTwoTone, ApiOutlined, CopyOutlined, EditOutlined, CheckCircleTwoTone, DeleteOutlined } from '@ant-design/icons' |
| | | import { Modal, Button, Popconfirm, message, notification } from 'antd' |
| | | import { StopTwoTone, DatabaseOutlined, CopyOutlined, CheckCircleTwoTone, DeleteOutlined, PlusOutlined, SwapOutlined } from '@ant-design/icons' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import './index.scss' |
| | | |
| | | const SettingForm = asyncComponent(() => import('./settingform')) |
| | | const DataSource = asyncComponent(() => import('@/menu/datasource')) |
| | | const EditTable = asyncComponent(() => import('@/templates/zshare/editTable')) |
| | | |
| | | class InterfaceController extends Component { |
| | |
| | | |
| | | state = { |
| | | visible: false, |
| | | setvisible: false, |
| | | interfaces: [], |
| | | card: null, |
| | | columns: [ |
| | | { |
| | | title: '接口名称', |
| | | title: '名称', |
| | | dataIndex: 'name', |
| | | width: '50%' |
| | | }, |
| | |
| | | dataIndex: 'operation', |
| | | render: (text, record) => |
| | | (<div style={{textAlign: 'center'}}> |
| | | <span onClick={() => this.handleEdit(record)} style={{color: '#1890ff', cursor: 'pointer', fontSize: '16px', marginRight: '15px'}}><EditOutlined /></span> |
| | | <span onClick={() => {this.copy(record)}} style={{color: '#26C281', cursor: 'pointer', fontSize: '16px', marginRight: '15px'}}><CopyOutlined /></span> |
| | | <DataSource config={record} updateConfig={this.update}/> |
| | | <span onClick={() => this.handleStatus(record)} style={{color: '#8E44AD', cursor: 'pointer', fontSize: '16px', marginRight: '15px'}}><SwapOutlined /></span> |
| | | <span onClick={() => this.copy(record)} style={{color: '#26C281', cursor: 'pointer', fontSize: '16px', marginRight: '15px'}}><CopyOutlined /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title="确定删除?" |
| | |
| | | }) |
| | | } |
| | | |
| | | handleEdit = (record) => { |
| | | this.setState({card: record, setvisible: true}) |
| | | handleStatus = (record) => { |
| | | const { config } = this.props |
| | | |
| | | if (record.status === 'false') { |
| | | if (record.setting.interType === 'system' && record.setting.execute !== 'false' && !record.setting.dataresource) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '未设置数据源,不可启用!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (!record.setting.primaryKey) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '未设置主键,不可启用!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (record.columns.length === 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '未添加字段集,不可启用!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | } |
| | | |
| | | record = fromJS(record).toJS() |
| | | record.status = record.status === 'false' ? 'true' : 'false' |
| | | |
| | | let interfaces = this.state.interfaces.map(item => { |
| | | if (item.uuid !== record.uuid) { |
| | | return item |
| | | } |
| | | return record |
| | | }) |
| | | |
| | | this.setState({ interfaces }) |
| | | this.props.updateConfig({...config, interfaces}) |
| | | } |
| | | |
| | | deleteScript = (record) => { |
| | |
| | | this.props.updateConfig({...config, interfaces}) |
| | | } |
| | | |
| | | settingSave = () => { |
| | | update = (record) => { |
| | | const { config } = this.props |
| | | const { card } = this.state |
| | | let interfaces = fromJS(this.state.interfaces).toJS() |
| | | |
| | | this.settingRef.handleConfirm().then(res => { |
| | | interfaces = interfaces.map(item => { |
| | | if (item.uuid === card.uuid) { |
| | | res.uuid = item.uuid |
| | | if (record.setting.primaryKey && record.columns.length > 0) { |
| | | record.status = 'true' |
| | | } else if (record.columns.length === 0) { |
| | | record.status = 'false' |
| | | } |
| | | record.name = record.setting.name |
| | | |
| | | if (res.procMode !== 'inner' && res.preScripts && res.preScripts.filter(item => item.status !== 'false').length === 0) { |
| | | message.warning('未设置前置脚本,不可启用!') |
| | | res.status = 'false' |
| | | } else if (res.callbackType === 'script' && res.cbScripts && res.cbScripts.filter(item => item.status !== 'false').length === 0) { |
| | | message.warning('未设置回调脚本,不可启用!') |
| | | res.status = 'false' |
| | | } |
| | | |
| | | return res |
| | | } |
| | | let interfaces = this.state.interfaces.map(item => { |
| | | if (item.uuid !== record.uuid) { |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | card: null, |
| | | setvisible: false, |
| | | interfaces |
| | | }) |
| | | |
| | | this.props.updateConfig({...config, interfaces}) |
| | | } |
| | | return record |
| | | }) |
| | | |
| | | this.setState({ interfaces }) |
| | | this.props.updateConfig({...config, interfaces}) |
| | | } |
| | | |
| | | addInterface = () => { |
| | |
| | | |
| | | interfaces.push({ |
| | | uuid: Utils.getuuid(), |
| | | name: 'interface ' + (interfaces.length + 1), |
| | | procMode: 'script', |
| | | callbackType: 'script', |
| | | preScripts: [], |
| | | cbScripts: [] |
| | | name: '数据源' + (interfaces.length + 1), |
| | | status: 'false', |
| | | format: 'array', |
| | | type: 'interface', |
| | | pageable: false, |
| | | setting: { interType: 'system', name: '数据源' + (interfaces.length + 1), status: 'false' }, |
| | | columns: [], |
| | | scripts: [], |
| | | }) |
| | | |
| | | this.setState({ |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { visible, setvisible, columns, interfaces, card } = this.state |
| | | const { visible, columns, interfaces } = this.state |
| | | |
| | | return ( |
| | | <div className="mk-sys-interface" style={{display: 'inline-block'}}> |
| | | <Button className="mk-border-green" onClick={this.trigger}><ApiOutlined /> 接口管理</Button> |
| | | <Button className="mk-border-green" onClick={this.trigger}><DatabaseOutlined /> 公共数据源</Button> |
| | | <Modal |
| | | title="接口管理" |
| | | title="公共数据源" |
| | | wrapClassName="interface-controller-modal" |
| | | visible={visible} |
| | | width={800} |
| | |
| | | ]} |
| | | destroyOnClose |
| | | > |
| | | <Button key="add-interface" className="mk-border-green" onClick={this.addInterface}> 添加 </Button> |
| | | <PlusOutlined key="add-interface" onClick={this.addInterface}/> |
| | | {/* <div style={{fontSize: '12px', position: 'relative', top: '20px'}}>注:接口执行完成后,会触发默认不加载的组件刷新数据。</div> */} |
| | | <EditTable key="manage-interface" actions={['move', 'copy']} type="interface" data={interfaces} columns={columns} onChange={this.changeScripts}/> |
| | | </Modal> |
| | | <Modal |
| | | title={card ? card.name : '接口'} |
| | | wrapClassName="interface-edit-modal" |
| | | visible={setvisible} |
| | | width={900} |
| | | maskClosable={false} |
| | | onOk={this.settingSave} |
| | | onCancel={() => { this.setState({ setvisible: false })}} |
| | | destroyOnClose |
| | | > |
| | | <SettingForm config={card} wrappedComponentRef={(inst) => this.settingRef = inst}/> |
| | | <EditTable key="manage-interface" actions={['copy']} type="interface" data={interfaces} columns={columns} onChange={this.changeScripts}/> |
| | | </Modal> |
| | | </div> |
| | | ) |
| | |
| | | .interface-controller-modal { |
| | | >.ant-modal >.ant-modal-content >.ant-modal-body { |
| | | .ant-modal-body { |
| | | min-height: 400px; |
| | | >.mk-border-green { |
| | | >.anticon-plus { |
| | | float: right; |
| | | position: relative; |
| | | z-index: 1; |
| | | margin-bottom: 10px; |
| | | margin: 0px 10px 10px; |
| | | font-size: 20px; |
| | | color: #26C281; |
| | | } |
| | | .model-datasource { |
| | | position: relative; |
| | | top: 0; |
| | | color: #1890ff; |
| | | display: inline-block; |
| | | > .anticon-setting { |
| | | font-size: 16px; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | .interface-edit-modal { |
| | | .ant-modal { |
| | | top: 70px; |
| | | } |
| | | .ant-modal-body { |
| | | min-height: 300px; |
| | | padding-top: 5px; |
| | | } |
| | | } |
| | |
| | | BID = BData.$BID || '' |
| | | } |
| | | |
| | | if (_config.wrap.datatype !== 'static') { |
| | | if (_config.wrap.datatype === 'dynamic') { |
| | | _sync = _config.setting.sync === 'true' |
| | | |
| | | if (_sync && data) { |
| | |
| | | config: _config, |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | }, () => { |
| | | if (_config.wrap.datatype !== 'static' && _config.setting && _config.setting.sync !== 'true') { |
| | | if (_config.wrap.datatype === 'dynamic' && _config.setting && _config.setting.sync !== 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, _config.setting.delay || 0) |
| | |
| | | MKEmitter.addListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | if (config.timer) { |
| | | if (config.timer && config.wrap.datatype === 'dynamic') { |
| | | this.timer = new TimerTask() |
| | | this.timer.init(config.uuid, config.timer, config.timerRepeats, () => {this.loadData(true)}) |
| | | } |
| | |
| | | BID = BData.$BID || '' |
| | | } |
| | | |
| | | if (_config.wrap.datatype !== 'static') { |
| | | if (_config.wrap.datatype === 'dynamic') { |
| | | _sync = _config.setting.sync === 'true' |
| | | |
| | | if (_sync && data) { |
| | |
| | | config: _config, |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | }, () => { |
| | | if (_config.wrap.datatype !== 'static' && _config.setting.sync !== 'true' && _config.setting.onload === 'true') { |
| | | if (_config.wrap.datatype === 'dynamic' && _config.setting.sync !== 'true' && _config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, _config.setting.delay || 0) |
| | |
| | | MKEmitter.addListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | if (config.timer) { |
| | | if (config.timer && config.wrap.datatype === 'dynamic') { |
| | | this.timer = new TimerTask() |
| | | this.timer.init(config.uuid, config.timer, config.timerRepeats, () => {this.loadData(true)}) |
| | | } |
| | |
| | | BID = BData.$BID || '' |
| | | } |
| | | |
| | | if (_config.setting && _config.wrap.datatype !== 'static') { |
| | | if (_config.setting && _config.wrap.datatype === 'dynamic') { |
| | | _sync = _config.setting.sync === 'true' |
| | | |
| | | if (_sync && data) { |
| | |
| | | config: _config, |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | }, () => { |
| | | if (_config.wrap.datatype !== 'static' && _config.setting && _config.setting.sync !== 'true' && _config.setting.onload === 'true') { |
| | | if (_config.wrap.datatype === 'dynamic' && _config.setting && _config.setting.sync !== 'true' && _config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, _config.setting.delay || 0) |
| | |
| | | MKEmitter.addListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | if (config.timer) { |
| | | if (config.timer && config.wrap.datatype === 'dynamic') { |
| | | this.timer = new TimerTask() |
| | | this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { |
| | | this.loadData('timer') |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | this.getsysScript() |
| | | } |
| | | |
| | | getsysScript = () => { |
| | | if (sessionStorage.getItem('mk_sys_scripts')) { |
| | | this.setState({ |
| | | systemScripts: JSON.parse(sessionStorage.getItem('mk_sys_scripts')) |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let _scriptSql = `Select distinct func+Remark as funcname,longparam, s.Sort from s_custom_script s inner join (select OpenID from sapp where ID=@Appkey@) p on s.openid = case when s.appkey='' then s.openid else p.OpenID end order by s.Sort` |
| | | |
| | | _scriptSql = Utils.formatOptions(_scriptSql) |
| | |
| | | |
| | | _sParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | _sParam.secretkey = Utils.encrypt(_sParam.LText, _sParam.timestamp) |
| | | |
| | | _sParam.open_key = Utils.encryptOpenKey(_sParam.secretkey, _sParam.timestamp) // 云端数据验证 |
| | | |
| | | Api.getSystemConfig(_sParam).then(res => { |
| | | if (res.status) { |
| | | let _scripts = res.data.map(item => { |
| | | return { |
| | | name: item.funcname, |
| | | value: window.decodeURIComponent(window.atob(item.longparam)) |
| | | } |
| | | }) |
| | | |
| | | sessionStorage.setItem('mk_sys_scripts', JSON.stringify(_scripts)) |
| | | |
| | | this.setState({ |
| | | systemScripts: res.data.map(item => { |
| | | return { |
| | | name: item.funcname, |
| | | value: window.decodeURIComponent(window.atob(item.longparam)) |
| | | } |
| | | }) |
| | | systemScripts: _scripts |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | this.getsysScript() |
| | | } |
| | | |
| | | getsysScript = () => { |
| | | if (sessionStorage.getItem('mk_sys_scripts')) { |
| | | this.setState({ |
| | | systemScripts: JSON.parse(sessionStorage.getItem('mk_sys_scripts')) |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let _scriptSql = `Select distinct func+Remark as funcname,longparam, s.Sort from s_custom_script s inner join (select OpenID from sapp where ID=@Appkey@) p on s.openid = case when s.appkey='' then s.openid else p.OpenID end order by s.Sort` |
| | | |
| | | _scriptSql = Utils.formatOptions(_scriptSql) |
| | |
| | | |
| | | _sParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | _sParam.secretkey = Utils.encrypt(_sParam.LText, _sParam.timestamp) |
| | | |
| | | _sParam.open_key = Utils.encryptOpenKey(_sParam.secretkey, _sParam.timestamp) // 云端数据验证 |
| | | |
| | | Api.getSystemConfig(_sParam).then(res => { |
| | | if (res.status) { |
| | | let _scripts = res.data.map(item => { |
| | | return { |
| | | name: item.funcname, |
| | | value: window.decodeURIComponent(window.atob(item.longparam)) |
| | | } |
| | | }) |
| | | |
| | | sessionStorage.setItem('mk_sys_scripts', JSON.stringify(_scripts)) |
| | | |
| | | this.setState({ |
| | | systemScripts: res.data.map(item => { |
| | | return { |
| | | name: item.funcname, |
| | | value: window.decodeURIComponent(window.atob(item.longparam)) |
| | | } |
| | | }) |
| | | systemScripts: _scripts |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | |
| | | |
| | | state = { |
| | | interType: 'system', |
| | | procMode: 'script', |
| | | requestMode: 'system', |
| | | sysInterface: 'false', |
| | | controlField: '', |
| | | tableType: '', |
| | |
| | | |
| | | this.setState({ |
| | | interType: setting.interType || 'system', |
| | | procMode: setting.procMode || 'script', |
| | | requestMode: setting.requestMode || 'system', |
| | | controlField: setting.controlField || '', |
| | | sysInterface: setting.sysInterface || 'false', |
| | | tableType: setting.tableType, |
| | |
| | | this.setState({ |
| | | interType: value |
| | | }) |
| | | } else if (key === 'procMode') { |
| | | this.setState({ |
| | | procMode: value |
| | | }) |
| | | } else if (key === 'requestMode') { |
| | | this.setState({ |
| | | requestMode: value |
| | | }) |
| | | } else if (key === 'sysInterface') { |
| | | this.setState({ |
| | | sysInterface: value |
| | |
| | | render() { |
| | | const { setting, dict, menu, config, columns } = this.props |
| | | const { getFieldDecorator } = this.props.form |
| | | const { interType, funcRules, funcTooltip, procMode, requestMode, tableType, controlField, sysInterface } = this.state |
| | | const { interType, funcRules, funcTooltip, tableType, controlField, sysInterface } = this.state |
| | | |
| | | const formItemLayout = { |
| | | labelCol: { |
| | |
| | | <Radio value="system">系统</Radio> |
| | | <Radio value="inner">内部</Radio> |
| | | <Radio value="outer">外部</Radio> |
| | | <Radio value="custom">自定义</Radio> |
| | | </Radio.Group>)} |
| | | </Form.Item> |
| | | </Col> |
| | |
| | | </Radio.Group>)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType === 'custom' ? <Col span={8}> |
| | | <Form.Item label="参数处理"> |
| | | {getFieldDecorator('procMode', { |
| | | initialValue: procMode, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: dict['form.required.select'] + '参数处理方式!' |
| | | }, |
| | | ] |
| | | })( |
| | | <Radio.Group onChange={(e) => {this.onRadioChange(e, 'procMode')}}> |
| | | <Radio value="script">前置脚本</Radio> |
| | | <Radio value="inner">前置函数</Radio> |
| | | </Radio.Group>)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType === 'custom' && procMode === 'inner' ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title={funcTooltip}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 前置函数 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('prevFunc', { |
| | | initialValue: setting.prevFunc || '', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: dict['form.required.input'] + '前置函数!' |
| | | }, |
| | | { |
| | | max: formRule.func.max, |
| | | message: formRule.func.maxMessage |
| | | }, |
| | | ...funcRules |
| | | ] |
| | | })(<Input placeholder={''} autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType === 'outer' || interType === 'custom' ? <Col className="mk-through-line3" span={24}> |
| | | {interType === 'outer' ? <Col className="mk-through-line3" span={24}> |
| | | <Form.Item label="接口地址"> |
| | | {getFieldDecorator('interface', { |
| | | initialValue: setting.interface || (interType === 'outer' && sysInterface === 'true' ? window.GLOB.mainSystemApi : ''), |
| | |
| | | })(<TextArea rows={2} readOnly={interType === 'outer' && sysInterface === 'true'}/>)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {(interType === 'outer' && sysInterface !== 'true') || interType === 'custom' ? <Col className="mk-through-line3" span={24}> |
| | | {interType === 'outer' && sysInterface !== 'true' ? <Col className="mk-through-line3" span={24}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="正式系统所使用的的接口地址。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | |
| | | })(<TextArea rows={2} />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType === 'custom' ? <Col span={8}> |
| | | <Form.Item label="请求方式"> |
| | | {getFieldDecorator('method', { |
| | | initialValue: setting.method || 'post', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: dict['form.required.select'] + '请求方式!' |
| | | }, |
| | | ] |
| | | })( |
| | | <Radio.Group> |
| | | <Radio value="get">GET</Radio> |
| | | <Radio value="post">POST</Radio> |
| | | </Radio.Group>)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType === 'custom' ? <Col span={8}> |
| | | <Form.Item label="数据请求"> |
| | | {getFieldDecorator('requestMode', { |
| | | initialValue: requestMode, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: dict['form.required.select'] + '数据请求方式!' |
| | | }, |
| | | ] |
| | | })( |
| | | <Radio.Group onChange={(e) => {this.onRadioChange(e, 'requestMode')}}> |
| | | <Radio value="system">系统函数</Radio> |
| | | <Radio value="inner">内部函数</Radio> |
| | | </Radio.Group>)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType === 'inner' || (interType === 'custom' && requestMode === 'inner') ? <Col span={8}> |
| | | {interType === 'inner' ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title={funcTooltip}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | |
| | | })(<Input placeholder={''} autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType === 'system' || (interType === 'custom' && requestMode === 'system') ? <Col span={24} className="mk-through-line3"> |
| | | {interType === 'system' ? <Col span={24} className="mk-through-line3"> |
| | | <Form.Item help={'数据ID:' + menu.MenuID} labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } label={ |
| | | <Tooltip placement="topLeft" title={`使用系统函数时,需填写数据源。注:数据权限替换符 $@ -> /* 或 ''、 @$ -> */ 或 '';查询替换符 $select@ -> /* 或 ''、 @select$ -> */ 或 '';统计替换符 $sum@ -> /* 或 ''、 @sum$ -> */ 或 ''。`}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | |
| | | })(<CodeMirror />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType === 'system' || (interType === 'custom' && requestMode === 'system') ? <Col span={8}> |
| | | {interType === 'system' ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title={'查询时,搜索条件以where条件拼接进入sql,统计时,将数据源中以“@+搜索字段+@”的内容,以搜索条件中的值进行替换后,提交查询,注:查询类型仅在使用系统函数时有效。'}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | |
| | | </Radio.Group>)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType === 'system' || (interType === 'custom' && requestMode === 'system') ? <Col span={8}> |
| | | {interType === 'system' ? <Col span={8}> |
| | | <Form.Item label="默认sql"> |
| | | {getFieldDecorator('default', { |
| | | initialValue: setting.default || 'true' |
| | |
| | | })(<Input placeholder={'ID asc, UID desc'} autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> |
| | | {interType === 'custom' ? <Col span={8}> |
| | | <Form.Item label="回调方式"> |
| | | {getFieldDecorator('callbackType', { |
| | | initialValue: setting.callbackType || 'script' |
| | | })( |
| | | <Radio.Group onChange={(e) => {this.onRadioChange(e, 'callbackType')}}> |
| | | <Radio value="default">默认脚本</Radio> |
| | | <Radio value="script">自定义脚本</Radio> |
| | | </Radio.Group>)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType === 'custom' ? <Col span={8}> |
| | | <Form.Item label="回调表名"> |
| | | {getFieldDecorator('cbTable', { |
| | | initialValue: setting.cbTable || '', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: dict['form.required.input'] + '回调表名!' |
| | | }, |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | })(<Input placeholder={''} autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType === 'custom' ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title={'同步执行:外部接口调用成功后再请求数据;异步执行:外部接口调用与请求数据同时进行。'}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 执行方式 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('execType', { |
| | | initialValue: setting.execType || 'sync' |
| | | })( |
| | | <Radio.Group> |
| | | <Radio value="sync">同步</Radio> |
| | | <Radio value="async">异步</Radio> |
| | | </Radio.Group>)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType === 'custom' ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title={'如果自定义接口不支持跨域请求,会通过当前系统转发。'}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 跨域请求 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('cross', { |
| | | initialValue: setting.cross || 'true' |
| | | })( |
| | | <Radio.Group> |
| | | <Radio value="true">支持</Radio> |
| | | <Radio value="false">不支持</Radio> |
| | | </Radio.Group>)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType === 'custom' ? <Col span={8}> |
| | | <Form.Item label="执行次数"> |
| | | {getFieldDecorator('execTime', { |
| | | initialValue: setting.execTime || 'once' |
| | | })( |
| | | <Radio.Group> |
| | | <Radio value="always">始终</Radio> |
| | | <Radio value="once">一次</Radio> |
| | | </Radio.Group>)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={8}> |
| | | <Form.Item label="是否分页"> |
| | | {getFieldDecorator('laypage', { |
| | |
| | | </Radio.Group>)} |
| | | </Form.Item> |
| | | </Col> |
| | | {/* <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="在搜索条件存在时,是否显示搜索和重置按钮。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 搜索按钮 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('show', { |
| | | initialValue: setting.show || 'true' |
| | | })( |
| | | <Radio.Group> |
| | | <Radio value="true">显示</Radio> |
| | | <Radio value="false">隐藏</Radio> |
| | | </Radio.Group>)} |
| | | </Form.Item> |
| | | </Col> */} |
| | | {tableType !== '' ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="当按钮执行完成并返回主键值时,默认选中主键值对应行。注:在启用无人值守功能时无效。"> |
| | |
| | | })(<InputNumber min={1} max={500} precision={0} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | {/* <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="高级搜索弹窗的宽度,注:当宽度值小于100时表示占窗口的百分比,大于100时表示宽度的绝对值。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 高级搜索 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('advanceWidth', { |
| | | initialValue: setting.advanceWidth || 1000 |
| | | })(<InputNumber min={10} max={3000} precision={0}/>)} |
| | | </Form.Item> |
| | | </Col> */} |
| | | <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="双击表格中行,触发的按钮。"> |
| | |
| | | const { Paragraph } = Typography |
| | | const CodeMirror = asyncComponent(() => import('@/templates/zshare/codemirror')) |
| | | const CustomScript = asyncComponent(() => import('@/templates/zshare/customscript')) |
| | | const SimpleScript = asyncComponent(() => import('./simplescript')) |
| | | |
| | | class SettingForm extends Component { |
| | | static propTpyes = { |
| | |
| | | |
| | | let _setting = fromJS(config.setting).toJS() |
| | | let _scripts = _setting.scripts || [] |
| | | let _preScripts = _setting.preScripts || [] |
| | | let _cbScripts = _setting.cbScripts || [] |
| | | |
| | | _setting.default = _setting.default || 'true' // 默认sql |
| | | _setting.sysInterface = _setting.sysInterface || 'false' // 是否为系统接口 |
| | |
| | | _search = _search ? 'where ' + _search : '' |
| | | |
| | | let status = fromJS(_setting).toJS() |
| | | status.requestMode = status.requestMode || 'system' |
| | | status.procMode = status.procMode || 'script' |
| | | status.callbackType = status.callbackType || 'script' |
| | | let regoptions = this.getRegOptions(search) |
| | | |
| | | if (config.urlFields && config.urlFields.length > 0) { |
| | |
| | | _scripts.forEach(item => { |
| | | item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`) |
| | | }) |
| | | _preScripts.forEach(item => { |
| | | item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`) |
| | | }) |
| | | _cbScripts.forEach(item => { |
| | | item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`) |
| | | }) |
| | | if (_setting.dataresource) { |
| | | _setting.dataresource = _setting.dataresource.replace(reg, `$ex@${m.func_code}@ex$`) |
| | | } |
| | |
| | | regoptions: regoptions, // 搜索条件,正则替换 |
| | | columns: columns, |
| | | scripts: _scripts, |
| | | preScripts: _preScripts, |
| | | cbScripts: _cbScripts, |
| | | status |
| | | }) |
| | | } |
| | |
| | | } |
| | | |
| | | handleConfirm = (trigger) => { |
| | | const { activeKey, setting, scripts, preScripts, cbScripts } = this.state |
| | | const { activeKey, setting, scripts } = this.state |
| | | |
| | | let _loading = false |
| | | if (this.scriptsForm && this.scriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.scriptsForm.props.form.getFieldValue('sql'))) { |
| | | _loading = true |
| | | } else if (this.preScriptsForm && this.preScriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.preScriptsForm.props.form.getFieldValue('sql'))) { |
| | | _loading = true |
| | | } else if (this.cbScriptsForm && this.cbScriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.cbScriptsForm.props.form.getFieldValue('sql'))) { |
| | | _loading = true |
| | | } |
| | | |
| | | if (_loading) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '存在未保存脚本,请点击确定保存,或点击取消放弃修改!', |
| | |
| | | }, () => { |
| | | this.sqlverify(() => { |
| | | this.setState({loading: false}) |
| | | resolve({...res, scripts, preScripts, cbScripts}) |
| | | resolve({...res, scripts}) |
| | | }, () => { |
| | | this.setState({loading: false}) |
| | | reject() |
| | |
| | | return new Promise((resolve, reject) => { |
| | | this.sqlverify(() => { |
| | | this.setState({loading: false}) |
| | | resolve({...setting, scripts, preScripts, cbScripts}) |
| | | resolve({...setting, scripts}) |
| | | }, () => { |
| | | this.setState({loading: false}) |
| | | reject() |
| | |
| | | } else { |
| | | this.setState({loading: false}) |
| | | return new Promise((resolve) => { |
| | | resolve({...setting, scripts, preScripts, cbScripts}) |
| | | resolve({...setting, scripts}) |
| | | }) |
| | | } |
| | | } |
| | |
| | | sqlverify = (_resolve, _reject, type, uscripts) => { |
| | | const { setting, scripts, arr_field, regoptions, search } = this.state |
| | | |
| | | if (setting.interType !== 'system' && setting.requestMode !== 'system') { // 不使用系统接口时,不需要sql验证 |
| | | if (setting.interType !== 'system') { // 不使用系统接口时,不需要sql验证 |
| | | _resolve() |
| | | return |
| | | } |
| | |
| | | |
| | | // 标签切换 |
| | | changeTab = (val) => { |
| | | const { activeKey, search, arr_field, setting } = this.state |
| | | const { activeKey, search, arr_field } = this.state |
| | | |
| | | let _loading = false |
| | | if (this.scriptsForm && this.scriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.scriptsForm.props.form.getFieldValue('sql'))) { |
| | | _loading = true |
| | | } else if (this.preScriptsForm && this.preScriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.preScriptsForm.props.form.getFieldValue('sql'))) { |
| | | _loading = true |
| | | } else if (this.cbScriptsForm && this.cbScriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.cbScriptsForm.props.form.getFieldValue('sql'))) { |
| | | _loading = true |
| | | } |
| | | |
| | | if (_loading) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '存在未保存脚本,请点击确定保存,或点击取消放弃修改!', |
| | |
| | | return |
| | | } |
| | | |
| | | if (activeKey !== 'setting') { |
| | | if (setting.interType !== 'system' && setting.requestMode !== 'system' && val === 'scripts') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '使用系统接口时,才可以设置自定义脚本!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (setting.interType !== 'custom' && (val === 'prescripts' || val === 'cbscripts')) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '使用自定义接口时,才可以设置前置或回调脚本!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | } |
| | | |
| | | if (activeKey === 'setting') { |
| | | let _defaultSql = '' |
| | | this.settingForm.handleConfirm().then(res => { |
| | | if (res.interType !== 'system' && res.requestMode !== 'system' && val === 'scripts') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '使用系统接口时,才可以设置自定义脚本!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (res.interType !== 'custom' && (val === 'prescripts' || val === 'cbscripts')) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '使用自定义接口时,才可以设置前置或回调脚本!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | if (res.dataresource) { |
| | | let _dataresource = res.dataresource |
| | | |
| | |
| | | scriptsUpdate = (scripts) => { |
| | | this.setState({scripts}) |
| | | } |
| | | |
| | | // 前置脚本更新 |
| | | preScriptsUpdate = (preScripts) => { |
| | | this.setState({preScripts}) |
| | | } |
| | | |
| | | // 后置脚本更新 |
| | | cbScriptsUpdate = (cbScripts) => { |
| | | this.setState({cbScripts}) |
| | | } |
| | | |
| | | handleDelete = (item) => { |
| | | const { script, scripts } = this.state |
| | |
| | | |
| | | render() { |
| | | const { config, menu, dict } = this.props |
| | | const { loading, activeKey, setting, defaultSql, columns, scripts, preScripts, cbScripts, status, regoptions, visible, script, scriptValue } = this.state |
| | | const { loading, activeKey, setting, defaultSql, columns, scripts, status, visible, script, scriptValue } = this.state |
| | | |
| | | return ( |
| | | <div className="model-table-setting-form-box"> |
| | |
| | | 自定义脚本 |
| | | {scripts.length ? <span className="count-tip">{scripts.length}</span> : null} |
| | | </span> |
| | | } disabled={!(status.interType === 'system' || (status.interType === 'custom' && status.requestMode === 'system'))} key="scripts" id="mk-setting-scripts"> |
| | | } disabled={status.interType !== 'system'} key="scripts" id="mk-setting-scripts"> |
| | | {scripts.length ? <BorderOutlined className="full-scripts" onClick={() => { |
| | | if (this.scriptsForm && (this.scriptsForm.state.editItem || (this.scriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.scriptsForm.props.form.getFieldValue('sql'))))) { |
| | | notification.warning({ |
| | |
| | | scriptsChange={this.scriptsChange} |
| | | scriptsUpdate={this.scriptsUpdate} |
| | | wrappedComponentRef={(inst) => this.scriptsForm = inst} |
| | | /> |
| | | </TabPane> |
| | | <TabPane tab={ |
| | | <span> |
| | | 前置脚本 |
| | | {preScripts.length ? <span className="count-tip">{preScripts.length}</span> : null} |
| | | </span> |
| | | } disabled={status.interType !== 'custom' || status.procMode !== 'script'} key="prescripts"> |
| | | <SimpleScript |
| | | dict={dict} |
| | | setting={setting} |
| | | scripts={preScripts} |
| | | regoptions={regoptions} |
| | | urlFields={config.urlFields} |
| | | searches={this.props.search} |
| | | scriptsUpdate={this.preScriptsUpdate} |
| | | wrappedComponentRef={(inst) => this.preScriptsForm = inst} |
| | | /> |
| | | </TabPane> |
| | | <TabPane tab={ |
| | | <span> |
| | | 回调脚本 |
| | | {cbScripts.length ? <span className="count-tip">{cbScripts.length}</span> : null} |
| | | </span> |
| | | } disabled={status.interType !== 'custom' || status.callbackType !== 'script'} key="cbscripts"> |
| | | <SimpleScript |
| | | dict={dict} |
| | | setting={setting} |
| | | scripts={cbScripts} |
| | | scriptsUpdate={this.cbScriptsUpdate} |
| | | wrappedComponentRef={(inst) => this.cbScriptsForm = inst} |
| | | /> |
| | | </TabPane> |
| | | </Tabs> |
| | |
| | | } |
| | | } |
| | | } |
| | | .mk-color-move { |
| | | height: 40px; |
| | | .color-sketch-block { |
| | | position: relative; |
| | | top: 7px; |
| | | } |
| | | } |
| | | .operation-btn { |
| | | display: inline-block; |
| | | font-size: 16px; |
| | |
| | | } |
| | | |
| | | getsysScript = () => { |
| | | if (sessionStorage.getItem('mk_sys_scripts')) { |
| | | this.setState({ |
| | | systemScripts: JSON.parse(sessionStorage.getItem('mk_sys_scripts')) |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let _scriptSql = `Select distinct func+Remark as funcname,longparam, s.Sort from s_custom_script s inner join (select OpenID from sapp where ID=@Appkey@) p on s.openid = case when s.appkey='' then s.openid else p.OpenID end order by s.Sort` |
| | | |
| | | _scriptSql = Utils.formatOptions(_scriptSql) |
| | |
| | | Api.getSystemConfig(_sParam).then(res => { |
| | | if (res.status) { |
| | | let _scripts = res.data.map(item => { |
| | | let _item = { |
| | | return { |
| | | name: item.funcname, |
| | | value: window.decodeURIComponent(window.atob(item.longparam)) |
| | | } |
| | | return _item |
| | | }) |
| | | |
| | | sessionStorage.setItem('mk_sys_scripts', JSON.stringify(_scripts)) |
| | | |
| | | this.setState({ |
| | | systemScripts: _scripts |
| | | }) |
| | |
| | | } |
| | | |
| | | getsysScript = () => { |
| | | if (sessionStorage.getItem('mk_sys_scripts')) { |
| | | this.setState({ |
| | | systemScripts: JSON.parse(sessionStorage.getItem('mk_sys_scripts')) |
| | | }) |
| | | return |
| | | } |
| | | let _scriptSql = `Select distinct func+Remark as funcname,longparam, s.Sort from s_custom_script s inner join (select OpenID from sapp where ID=@Appkey@) p on s.openid = case when s.appkey='' then s.openid else p.OpenID end order by s.Sort` |
| | | |
| | | _scriptSql = Utils.formatOptions(_scriptSql) |
| | |
| | | return _item |
| | | }) |
| | | |
| | | sessionStorage.setItem('mk_sys_scripts', JSON.stringify(_scripts)) |
| | | |
| | | this.setState({ |
| | | systemScripts: _scripts |
| | | }) |
| | |
| | | } |
| | | |
| | | if (item.btnlog) { |
| | | item.btnlog = [] |
| | | item.btnlog = null |
| | | } |
| | | |
| | | let oriUids = {} |
| | |
| | | } |
| | | |
| | | if (item.btnlog) { |
| | | item.btnlog = [] |
| | | item.btnlog = null |
| | | } |
| | | |
| | | let oriUids = {} |
| | |
| | | backElements: [] |
| | | } |
| | | ], |
| | | headerStyle: {}, parentId: '', width: 24, scripts: [], btnlog: [], pageable: false, |
| | | headerStyle: {}, parentId: '', width: 24, scripts: [], pageable: false, |
| | | wrap: {name: 'logo', width: 24, datatype: 'static', cardType: '', blacklist: []}, |
| | | name: 'logo', floor: 1, switchable: true, |
| | | setting:{interType: 'system'}, tabId: '', style:{paddingTop: '8vh', paddingBottom: '10vh'}, dataName: Utils.getuuid(), format: 'object', subtype: 'propcard', type: 'card', uuid: Utils.getuuid(), columns: [] |
| | |
| | | backElements: [] |
| | | } |
| | | ], |
| | | headerStyle: {}, parentId: '', width: 24, scripts: [], btnlog: [], pageable: false, |
| | | headerStyle: {}, parentId: '', width: 24, scripts: [], pageable: false, |
| | | wrap: {name: 'Power', width: 24, datatype: 'static', cardType: '', blacklist: []}, |
| | | name: 'Power', floor: 1, switchable: true, |
| | | setting:{interType: 'system'}, tabId: '', style:{}, dataName: Utils.getuuid(), format: 'object', subtype: 'propcard', type: 'card', uuid: Utils.getuuid(), columns: [] |
| | |
| | | <header className="sys-header-container ant-menu-dark"> |
| | | <div className="header-logo"><img src={MainLogo} alt=""/></div> |
| | | <div className="title">HS</div> |
| | | <div className="close" onClick={() => window.close()}>关闭</div> |
| | | <div className="header-setting"> |
| | | <img src={this.state.avatar} alt=""/> |
| | | <span> |
| | | <span className="username">{this.state.userName}</span> |
| | | </span> |
| | | </div> |
| | | <div className="close" onClick={() => window.close()}>关闭</div> |
| | | </header> |
| | | ) |
| | | } |
| | |
| | | } |
| | | |
| | | .close { |
| | | position: absolute; |
| | | float: right; |
| | | font-size: 16px; |
| | | color: #ffffff; |
| | | right: 90px; |
| | | top: 12px; |
| | | margin-top: 13px; |
| | | margin-right: 15px; |
| | | cursor: pointer; |
| | | } |
| | | |