| | |
| | | * @description 按钮删除 |
| | | */ |
| | | deleteElement = (card) => { |
| | | const { cards, cardCell, side } = this.props |
| | | const { dict, elements } = this.state |
| | | let _this = this |
| | | |
| | |
| | | if (card.eleType === 'button') { |
| | | MKEmitter.emit('delButtons', [card.uuid]) |
| | | } |
| | | if (card.OpenType === 'popview' || card.verify || card.modal) { |
| | | card.$parentId = cardCell.uuid |
| | | card.$side = side || '' |
| | | |
| | | MKEmitter.emit('logButton', cards.uuid, card) |
| | | } |
| | | |
| | | _this.setState({ |
| | | elements: _elements |
| | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('submitStyle', this.getStyle) |
| | | MKEmitter.addListener('submitModal', this.handleSave) |
| | | MKEmitter.addListener('logButton', this.logButton) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | } |
| | | MKEmitter.removeListener('submitStyle', this.getStyle) |
| | | 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.setState({ |
| | | card: {...card, btnlog} |
| | | }) |
| | | this.props.updateConfig({...card, btnlog}) |
| | | } |
| | | |
| | | /** |
| | | * @description 卡片行外层信息更新(数据源,样式等) |
| | | */ |
| | |
| | | content: '确定删除卡片吗?', |
| | | onOk() { |
| | | card.subcards = card.subcards.filter(item => item.uuid !== cell.uuid) |
| | | |
| | | |
| | | let uuids = [] |
| | | cell.elements && cell.elements.forEach(c => { |
| | | if (c.eleType === 'button') { |
| | | uuids.push(c.uuid) |
| | | } |
| | | }) |
| | | cell.backElements && cell.backElements.forEach(c => { |
| | | if (c.eleType === 'button') { |
| | | uuids.push(c.uuid) |
| | | } |
| | | }) |
| | | MKEmitter.emit('delButtons', uuids) |
| | | |
| | | if (card.btnlog) { |
| | | card.btnlog = card.btnlog.filter(c => c.$parentId !== cell.uuid) |
| | | } |
| | | |
| | | _this.setState({card}) |
| | | _this.props.updateConfig(card) |
| | | }, |
| | |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('submitStyle', this.getStyle) |
| | | MKEmitter.addListener('logButton', this.logButton) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | return |
| | | } |
| | | MKEmitter.removeListener('submitStyle', this.getStyle) |
| | | 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.setState({ |
| | | card: {...card, btnlog} |
| | | }) |
| | | this.props.updateConfig({...card, btnlog}) |
| | | } |
| | | |
| | | /** |
| | |
| | | content: '确定删除卡片吗?', |
| | | onOk() { |
| | | card.subcards = card.subcards.filter(item => item.uuid !== cell.uuid) |
| | | |
| | | |
| | | let uuids = [] |
| | | cell.elements && cell.elements.forEach(c => { |
| | | if (c.eleType === 'button') { |
| | | uuids.push(c.uuid) |
| | | } |
| | | }) |
| | | cell.backElements && cell.backElements.forEach(c => { |
| | | if (c.eleType === 'button') { |
| | | uuids.push(c.uuid) |
| | | } |
| | | }) |
| | | MKEmitter.emit('delButtons', uuids) |
| | | |
| | | if (card.btnlog) { |
| | | card.btnlog = card.btnlog.filter(c => c.$parentId !== cell.uuid) |
| | | } |
| | | |
| | | _this.setState({card}) |
| | | _this.props.updateConfig(card) |
| | | }, |
| | |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('submitStyle', this.getStyle) |
| | | MKEmitter.addListener('logButton', this.logButton) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | return |
| | | } |
| | | MKEmitter.removeListener('submitStyle', this.getStyle) |
| | | 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.setState({ |
| | | card: {...card, btnlog} |
| | | }) |
| | | this.props.updateConfig({...card, btnlog}) |
| | | } |
| | | |
| | | /** |
| | |
| | | content: '确定删除卡片吗?', |
| | | onOk() { |
| | | card.subcards = card.subcards.filter(item => item.uuid !== cell.uuid) |
| | | |
| | | |
| | | let uuids = [] |
| | | cell.elements && cell.elements.forEach(c => { |
| | | if (c.eleType === 'button') { |
| | | uuids.push(c.uuid) |
| | | } |
| | | }) |
| | | |
| | | MKEmitter.emit('delButtons', uuids) |
| | | |
| | | if (card.btnlog) { |
| | | card.btnlog = card.btnlog.filter(c => c.$parentId !== cell.uuid) |
| | | } |
| | | |
| | | _this.setState({card}) |
| | | _this.props.updateConfig(card) |
| | | }, |
| | |
| | | } |
| | | |
| | | values.Ot = 'notRequired' |
| | | } else if (values.OpenType === 'popview') { |
| | | values.createTab = true // 用于标记按钮复制时,是否复制原有标签 |
| | | } else if (values.OpenType === 'funcbutton') { // 转换打印时打开方式 |
| | | if (values.funcType === 'print') { |
| | | values.OpenType = values.execMode |
| | |
| | | MKEmitter.emit('delButtons', [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}) |
| | | _this.props.updateaction({...config, action: _actionlist, btnlog}) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | |
| | | let _columns = fromJS(this.state.columns).toJS() |
| | | _columns = this.loopDelCol(_columns, col) |
| | | |
| | | if (col.type === 'action') { |
| | | let uuids = [] |
| | | col.elements && col.elements.forEach(c => { |
| | | uuids.push(c.uuid) |
| | | }) |
| | | MKEmitter.emit('delButtons', uuids) |
| | | } |
| | | |
| | | this.setState({ |
| | | columns: _columns |
| | | }, () => { |
| | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('submitStyle', this.getStyle) |
| | | MKEmitter.addListener('submitModal', this.handleSave) |
| | | MKEmitter.addListener('logButton', this.logButton) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | } |
| | | MKEmitter.removeListener('submitStyle', this.getStyle) |
| | | MKEmitter.removeListener('submitModal', this.handleSave) |
| | | MKEmitter.removeListener('logButton', this.logButton) |
| | | } |
| | | |
| | | /** |
| | |
| | | this.props.updateConfig(component) |
| | | } |
| | | |
| | | logButton = (id, item) => { |
| | | const { card } = this.state |
| | | |
| | | if (id !== card.uuid) return |
| | | |
| | | let btnlog = card.btnlog || [] |
| | | btnlog.push(item) |
| | | |
| | | this.setState({ |
| | | card: {...card, btnlog} |
| | | }) |
| | | this.props.updateConfig({...card, btnlog}) |
| | | } |
| | | |
| | | /** |
| | | * @description 单个卡片信息更新 |
| | |
| | | import { Empty, notification, Modal } from 'antd' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import Card from './card' |
| | | import './index.scss' |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | let uuids = [] |
| | | const getUuids = (item) => { |
| | | if (item.type === 'tabs') { |
| | | item.subtabs.forEach(tab => { |
| | | tab.components.forEach(c => { |
| | | getUuids(c) |
| | | }) |
| | | }) |
| | | } else { |
| | | if (item.action && item.action.length) { |
| | | item.action.forEach(act => { |
| | | if (!act.origin) { |
| | | uuids.push(act.uuid) |
| | | } |
| | | }) |
| | | } |
| | | if (item.type === 'card') { |
| | | item.subcards.forEach(_card => { |
| | | _card.elements && _card.elements.forEach(cell => { |
| | | if (cell.eleType === 'button') { |
| | | uuids.push(cell.uuid) |
| | | } |
| | | }) |
| | | _card.backElements && _card.backElements.forEach(cell => { |
| | | if (cell.eleType === 'button') { |
| | | uuids.push(cell.uuid) |
| | | } |
| | | }) |
| | | }) |
| | | } else if (item.type === 'table' && item.subtype === 'tablecard') { |
| | | item.subcards.forEach(_card => { |
| | | _card.elements && _card.elements.forEach(cell => { |
| | | if (cell.eleType === 'button') { |
| | | uuids.push(cell.uuid) |
| | | } |
| | | }) |
| | | }) |
| | | } else if (item.type === 'table' && item.subtype === 'normaltable') { |
| | | item.cols && item.cols.forEach(col => { |
| | | if (col.type !== 'action') return |
| | | col.elements && col.elements.forEach(cell => { |
| | | uuids.push(cell.uuid) |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | |
| | | getUuids(card) |
| | | |
| | | confirm({ |
| | | title: `确定删除《${card.name}》吗?`, |
| | | content: hasComponent ? '当前组件中含有子组件!' : '', |
| | | onOk() { |
| | | MKEmitter.emit('delButtons', uuids) |
| | | handleList({...config, components: cards.filter(item => item.uuid !== card.uuid)}) |
| | | }, |
| | | onCancel() {} |
| | |
| | | menu: PropTypes.any, // 菜单配置信息 |
| | | config: PropTypes.object, // 组件配置 |
| | | setting: PropTypes.object, // 数据源配置 |
| | | modules: PropTypes.array, // 列设置 |
| | | modules: PropTypes.array, // 可绑定的上级组件 |
| | | columns: PropTypes.array, // 列设置 |
| | | scripts: PropTypes.array, // 自定义脚本 |
| | | } |
| | |
| | | import { Empty, notification, Modal } from 'antd' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import Card from './card' |
| | | import './index.scss' |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | let uuids = [] |
| | | const getUuids = (item) => { |
| | | if (item.type === 'tabs') { |
| | | item.subtabs.forEach(tab => { |
| | | tab.components.forEach(c => { |
| | | getUuids(c) |
| | | }) |
| | | }) |
| | | } else { |
| | | if (item.action && item.action.length) { |
| | | item.action.forEach(act => { |
| | | if (!act.origin) { |
| | | uuids.push(act.uuid) |
| | | } |
| | | }) |
| | | } |
| | | if (item.type === 'card') { |
| | | item.subcards.forEach(_card => { |
| | | _card.elements && _card.elements.forEach(cell => { |
| | | if (cell.eleType === 'button') { |
| | | uuids.push(cell.uuid) |
| | | } |
| | | }) |
| | | _card.backElements && _card.backElements.forEach(cell => { |
| | | if (cell.eleType === 'button') { |
| | | uuids.push(cell.uuid) |
| | | } |
| | | }) |
| | | }) |
| | | } else if (item.type === 'table' && item.subtype === 'tablecard') { |
| | | item.subcards.forEach(_card => { |
| | | _card.elements && _card.elements.forEach(cell => { |
| | | if (cell.eleType === 'button') { |
| | | uuids.push(cell.uuid) |
| | | } |
| | | }) |
| | | }) |
| | | } else if (item.type === 'table' && item.subtype === 'normaltable') { |
| | | item.cols && item.cols.forEach(col => { |
| | | if (col.type !== 'action') return |
| | | col.elements && col.elements.forEach(cell => { |
| | | uuids.push(cell.uuid) |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | |
| | | getUuids(card) |
| | | |
| | | confirm({ |
| | | title: `确定删除《${card.name}》吗?`, |
| | | content: hasComponent ? '当前组件中含有子组件!' : '', |
| | | onOk() { |
| | | MKEmitter.emit('delButtons', uuids) |
| | | handleList({...menu, components: cards.filter(item => item.uuid !== card.uuid)}) |
| | | }, |
| | | onCancel() {} |
| | |
| | | columns: null, // 显示列 |
| | | activeIndex: null, // 标记当前选中行 |
| | | rowspans: null, // 行合并字段信息 |
| | | pickup: false |
| | | pickup: false, // 收起未选择项 |
| | | orderfields: {} // 排序id与field转换 |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | |
| | | let radio = 5 // 虚化比例 |
| | | let _format = false // 是否虚化处理 |
| | | let rowspans = [] |
| | | let orderfields = {} |
| | | |
| | | if (window.GLOB.dataFormat && menuType !== 'HS' && memberLevel) { |
| | | _format = true |
| | |
| | | if (item.marks && item.marks.length === 0) { |
| | | item.marks = '' |
| | | } |
| | | |
| | | |
| | | if (item.field) { |
| | | orderfields[item.uuid] = item.field |
| | | } |
| | | |
| | | cell = { |
| | | align: item.Align, |
| | | dataIndex: item.uuid, |
| | |
| | | |
| | | this.setState({ |
| | | columns: _columns, |
| | | rowspans |
| | | rowspans, |
| | | orderfields |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | changeTable = (pagination, filters, sorter) => { |
| | | const { orderfields } = this.state |
| | | |
| | | this.setState({ |
| | | pageIndex: pagination.current, |
| | | pageSize: pagination.pageSize, |
| | |
| | | activeIndex: null, |
| | | pickup: false |
| | | }) |
| | | |
| | | sorter.field = orderfields[sorter.field] || '' |
| | | |
| | | this.props.refreshdata(pagination, filters, sorter) |
| | | } |
| | | |
| | |
| | | } else if (type === 'form') { |
| | | if (config.groups.length > 1) { |
| | | config.groups.forEach(group => { |
| | | let _items = [] |
| | | group.sublist.forEach(item => { |
| | | if (columnsMap.has(item.field.toLowerCase())) { |
| | | let cell = columnsMap.get(item.field.toLowerCase()) |
| | | |
| | | if (cell.selected && cell.type === item.type) { // 数据选择状态及类型未修改时,直接添加 |
| | | items.push(item) |
| | | _items.push(item) |
| | | } else if (cell.selected) { // 数据类型修改时,重置类型及初始值 |
| | | item.type = cell.type |
| | | item.initval = '' |
| | | items.push(item) |
| | | _items.push(item) |
| | | } |
| | | columnsMap.delete(item.field.toLowerCase()) |
| | | } else if (!item.origin) { // 过滤示例项 |
| | | items.push(item) |
| | | _items.push(item) |
| | | } |
| | | }) |
| | | group.sublist = items |
| | | group.sublist = _items |
| | | }) |
| | | |
| | | let _columns = [...columnsMap.values()] |