| | |
| | | } |
| | | if (col.format === 'percent') { |
| | | content = content * 100 |
| | | if (!col.round) { |
| | | content = +content.toFixed(2) |
| | | } |
| | | } else if (col.format === 'abs') { |
| | | content = Math.abs(content) |
| | | } |
| | |
| | | content = '' |
| | | } |
| | | } else { |
| | | if (col.eval === 'false' && col.noValue === 'hide') { // 空值隐藏 |
| | | Object.keys(record).forEach(key => { |
| | | if (/^\$/.test(key)) return |
| | | if (record[key]) return |
| | | |
| | | content = content.replace(new RegExp('[^@]*@' + key + '@', 'ig'), '') |
| | | }) |
| | | } |
| | | |
| | | Object.keys(record).forEach(key => { |
| | | let reg = new RegExp('@' + key + '@', 'ig') |
| | | content = content.replace(reg, record[key]) |
| | |
| | | this.props.refreshdata({pageIndex}) |
| | | } |
| | | |
| | | mkCheckTopLine = (menuId, id, type) => { |
| | | mkCheckTopLine = (menuId, id, selected) => { |
| | | const { MenuID, data, setting } = this.props |
| | | |
| | | if (MenuID !== menuId || !data || data.length === 0) return |
| | | if (MenuID !== menuId) return |
| | | if (!data || data.length === 0) { |
| | | MKEmitter.emit('resetSelectLine', menuId, '', '') |
| | | return |
| | | } |
| | | |
| | | if (type === 'sign') { |
| | | let index = '' |
| | | let keys = [] |
| | | let items = [] |
| | | let index = -1 |
| | | let keys = [] |
| | | let items = [] |
| | | |
| | | if (id) { |
| | | index = data.findIndex(item => item.$$uuid === id && !item.$disabled) |
| | | } |
| | | |
| | | if (index !== -1) { |
| | | keys = [index] |
| | | items = [data[index]] |
| | | } else if (selected === 'sign') { |
| | | data.forEach((item, i) => { |
| | | if (!item.$disabled && item.selected === 'true') { |
| | | items.push(item) |
| | |
| | | index = i |
| | | } |
| | | }) |
| | | |
| | | this.changedata(index) |
| | | this.setState({ selectedRowKeys: keys, activeIndex: index }) |
| | | this.props.chgSelectData(items) |
| | | |
| | | if (setting.$hasSyncModule) { |
| | | MKEmitter.emit('syncBalconyData', MenuID, items, data.length === keys.length) |
| | | } else if (selected !== 'false') { |
| | | if (!data[0].$disabled) { |
| | | index = 0 |
| | | keys = [index] |
| | | items = [data[index]] |
| | | } |
| | | } |
| | | |
| | | if (index === -1) { |
| | | MKEmitter.emit('resetSelectLine', menuId, '', '') |
| | | return |
| | | } |
| | | |
| | | let index = 0 |
| | | if (id) { |
| | | index = data.findIndex(item => item.$$uuid === id) |
| | | if (index === -1) { |
| | | index = 0 |
| | | } |
| | | } |
| | | |
| | | if (data[index].$disabled) return |
| | | |
| | | this.changedata(index) |
| | | this.setState({ selectedRowKeys: [index], activeIndex: index }) |
| | | this.props.chgSelectData([data[index]]) |
| | | this.setState({ selectedRowKeys: keys, activeIndex: index }) |
| | | this.props.chgSelectData(items) |
| | | |
| | | if (setting.$hasSyncModule) { |
| | | MKEmitter.emit('syncBalconyData', MenuID, [data[index]], data.length === 1) |
| | | MKEmitter.emit('syncBalconyData', MenuID, items, data.length === keys.length) |
| | | } |
| | | } |
| | | |
| | |
| | | if (setting.$hasSyncModule) { |
| | | MKEmitter.emit('syncBalconyData', MenuID, selects, data.length === selects.length) |
| | | } |
| | | } else if (type === 'false') { |
| | | this.setState({ |
| | | selectedRowKeys: [], |
| | | activeIndex: null, |
| | | pickup: false |
| | | }) |
| | | } else if (type === 'repage') { |
| | | this.setState({ |
| | | pageIndex: Index, |
| | | selectedRowKeys: [], |
| | | activeIndex: null, |
| | | pickup: false |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | pageIndex: 1, |
| | | pageIndex: type === 'false' ? this.state.pageIndex : 1, |
| | | selectedRowKeys: [], |
| | | activeIndex: null, |
| | | pickup: false |