| | |
| | | <Form.Item label="可用字段" className="field-able"> |
| | | <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'公共值,请按照@xxx@格式使用。'}><span style={{color: '#1890ff'}}>BID, LoginUID, SessionUid, UserID, Appkey, time_id, typename</span></Tooltip>, |
| | | <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'系统变量,系统会定义变量并赋值。'}><span style={{color: '#fa8c16'}}>UserName, FullName, RoleID, mk_departmentcode, mk_organization, mk_user_type, mk_nation, mk_province, mk_city, mk_district, mk_address</span></Tooltip>, |
| | | <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'排序、分页以及搜索条件变量,请按照@xxx@格式使用。'}>orderBy, pageSize, pageIndex{usefulFields ? ', ' + usefulFields : ''}{type === 'calendar' ? ', mk_year' : ''}</Tooltip> |
| | | <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'排序、分页以及搜索条件变量,请按照@xxx@格式使用。使用@pageSize@代表自定义分页,总数请以mk_total返回。'}>orderBy, pageSize, pageIndex{usefulFields ? ', ' + usefulFields : ''}{type === 'calendar' ? ', mk_year' : ''}</Tooltip> |
| | | <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'url变量,请按照@xxx@格式使用。'}>{urlFields ? ', ' : ''}<span style={{color: '#13c2c2'}}>{urlFields}</span></Tooltip> |
| | | </Form.Item> |
| | | </Col> |
| | |
| | | |
| | | component.setting.customScript = _customScript // 整理后自定义脚本 |
| | | |
| | | if (component.setting.laypage) { |
| | | component.setting.custompage = /@pageSize@/i.test(component.setting.dataresource + component.setting.customScript) |
| | | } |
| | | |
| | | component.setting.delay = delay |
| | | delay += 20 |
| | | |
| | |
| | | if (result.status) { |
| | | this.loaded = true |
| | | if (config.$cache && config.setting.onload !== 'false') { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | Api.writeCacheConfig(config.uuid, result.data || []) |
| | | } |
| | | |
| | | let data = [] |
| | |
| | | pageSize: 10, |
| | | orderBy: '', |
| | | pageOptions: [], |
| | | activeKey: '', // 选中卡 |
| | | selectKeys: [], // 多选时选中卡片 |
| | | selectedData: [], // 选中数据,用于工具栏按钮 |
| | | loading: false, // 数据加载状态 |
| | | card: null, // 卡片设置 |
| | | data: null, // 数据 |
| | | activeKey: '', |
| | | selectKeys: [], |
| | | selectedData: [], |
| | | loading: false, |
| | | card: null, |
| | | data: null, |
| | | total: null, |
| | | precards: [], |
| | | nextcards: [], |
| | |
| | | |
| | | if (selected === 'false' && !id) return |
| | | |
| | | setTimeout(() => { |
| | | this.checkTopLine(id) |
| | | }, 200) |
| | | this.checkTopLine(id) |
| | | |
| | | if (selected === 'init') { |
| | | this.setState({selected: 'false'}) |
| | |
| | | }) |
| | | } |
| | | |
| | | let total = result.total || 0 |
| | | if (config.setting.custompage && data.length) { |
| | | total = data[data.length - 1].mk_total || 0 |
| | | } |
| | | |
| | | this.setState({ |
| | | activeKey: '', |
| | | selectKeys: [], |
| | | selectedData: [], |
| | | data: data, |
| | | total: result.total, |
| | | total: total, |
| | | loading: false |
| | | }) |
| | | |
| | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | let data = fromJS(this.state.data).toJS() |
| | | let selectedData = fromJS(this.state.selectedData).toJS() |
| | | let selectKeys = fromJS(this.state.selectKeys).toJS() |
| | | let activeKey = this.state.activeKey |
| | | |
| | | if (result.data && result.data[0]) { |
| | | let _data = result.data[0] |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | _data.$$BID = BID || '' |
| | | _data.$$BData = BData || '' |
| | | |
| | | try { |
| | | data = data.map(item => { |
| | | if (item[config.setting.primaryKey] === _data[config.setting.primaryKey]) { |
| | | _data.key = item.key |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | _data.$$BID = BID || '' |
| | | _data.$$BData = BData || '' |
| | | _data.$Index = item.$Index |
| | | return _data |
| | | } else { |
| | | return item |
| | | } |
| | | data = data.map(item => { |
| | | if (item.$$uuid === _data.$$uuid) { |
| | | _data.key = item.key |
| | | _data.$Index = item.$Index |
| | | return _data |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | if (!_data.$Index) { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | } catch (e) { |
| | | console.warn('数据查询错误') |
| | | return |
| | | } |
| | | |
| | | MKEmitter.emit('resetSelectLine', config.uuid, _data.$$uuid || '', _data) |
| | | } |
| | | selectedData = selectedData.map(item => { |
| | | if (item.$$uuid === _data.$$uuid) { |
| | | return _data |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | data: data, |
| | | loading: false |
| | | }) |
| | | this.setState({ |
| | | data: data, |
| | | selectedData: selectedData, |
| | | loading: false |
| | | }) |
| | | |
| | | if (_data.key === activeKey) { |
| | | MKEmitter.emit('resetSelectLine', config.uuid, _data.$$uuid || '', _data) |
| | | } |
| | | if (config.setting.$hasSyncModule) { |
| | | MKEmitter.emit('syncBalconyData', config.uuid, selectedData, data.length === selectedData.length) |
| | | } |
| | | } else { |
| | | let index = data.findIndex(item => item.$$uuid === id) |
| | | |
| | | if (index === -1) { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | return |
| | | } |
| | | |
| | | data = data.filter(item => item.$$uuid !== id) |
| | | data = data.map((item, i) => { |
| | | item.key = i |
| | | return item |
| | | }) |
| | | |
| | | let trans = activeKey === index |
| | | let _item = null |
| | | |
| | | if (config.wrap.cardType) { |
| | | selectKeys = selectKeys.filter(key => key !== index) |
| | | selectKeys = selectKeys.map(key => key > index ? key - 1 : key) |
| | | |
| | | selectedData = selectKeys.map(key => data[key]).filter(Boolean) |
| | | |
| | | activeKey = selectKeys.length ? selectKeys[selectKeys.length - 1] : '' |
| | | |
| | | if (trans && selectedData.length) { |
| | | _item = selectedData[selectedData.length - 1] |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | data: data, |
| | | activeKey: activeKey, |
| | | selectKeys: selectKeys, |
| | | selectedData: selectedData, |
| | | loading: false |
| | | }) |
| | | |
| | | if (trans) { |
| | | MKEmitter.emit('resetSelectLine', config.uuid, (_item ? _item.$$uuid : ''), _item) |
| | | } |
| | | |
| | | if (config.setting.$hasSyncModule) { |
| | | MKEmitter.emit('syncBalconyData', config.uuid, selectedData, data.length === selectedData.length) |
| | | } |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | if (activeKey === index) return |
| | | |
| | | _selectedData = [item] |
| | | _selectKeys = [index] |
| | | _activeKey = index |
| | | } |
| | | |
| | |
| | | wrapStyle: wrapStyle, |
| | | card: _card, |
| | | search: _config.$searches, |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | arr_field: _config.columns.map(col => col.field).join(',') |
| | | }) |
| | | } |
| | | |
| | |
| | | opens = [] |
| | | } |
| | | |
| | | let total = result.total || 0 |
| | | if (config.setting.custompage && data.length) { |
| | | total = data[data.length - 1].mk_total || 0 |
| | | } |
| | | |
| | | this.setState({ |
| | | activeKey: '', |
| | | selectKeys: [], |
| | | opens: opens, |
| | | selectedData: [], |
| | | data: data, |
| | | total: result.total, |
| | | total: total, |
| | | loading: false |
| | | }) |
| | | |
| | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | let data = fromJS(this.state.data).toJS() |
| | | let selectedData = fromJS(this.state.selectedData).toJS() |
| | | let selectKeys = fromJS(this.state.selectKeys).toJS() |
| | | let activeKey = this.state.activeKey |
| | | |
| | | if (result.data && result.data[0]) { |
| | | let _data = result.data[0] |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | _data.$$BID = BID || '' |
| | | _data.$$BData = BData || '' |
| | | |
| | | try { |
| | | data = data.map(item => { |
| | | if (item[config.setting.primaryKey] === _data[config.setting.primaryKey]) { |
| | | let children = [] |
| | | data = data.map(item => { |
| | | if (item.$$uuid === _data.$$uuid) { |
| | | let children = [] |
| | | |
| | | if (_data[config.setting.subdata]) { |
| | | let _children = _data[config.setting.subdata] |
| | | if (_data[config.setting.subdata]) { |
| | | let _children = _data[config.setting.subdata] |
| | | |
| | | delete _data[config.setting.subdata] |
| | | delete _data[config.setting.subdata] |
| | | |
| | | _children.forEach((cell, i) => { |
| | | cell.key = i |
| | | cell.$$uuid = cell[config.setting.subKey] || '' |
| | | cell.$$parentId = _data[config.setting.primaryKey] || '' |
| | | cell.$$BID = _data[config.setting.primaryKey] || '' |
| | | cell.$$BData = {..._data} |
| | | cell.$Index = i + 1 + '' |
| | | _children.forEach((cell, i) => { |
| | | cell.key = i |
| | | cell.$$uuid = cell[config.setting.subKey] || '' |
| | | cell.$$parentId = _data[config.setting.primaryKey] || '' |
| | | cell.$$BID = _data[config.setting.primaryKey] || '' |
| | | cell.$$BData = {..._data} |
| | | cell.$Index = i + 1 + '' |
| | | |
| | | if (cell.$$uuid) { |
| | | children.push(cell) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | _data.children = children |
| | | |
| | | _data.key = item.key |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | _data.$$BID = BID || '' |
| | | _data.$$BData = BData || '' |
| | | _data.$Index = item.$Index |
| | | return _data |
| | | } else { |
| | | return item |
| | | if (cell.$$uuid) { |
| | | children.push(cell) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | _data.children = children |
| | | _data.key = item.key |
| | | _data.$Index = item.$Index |
| | | return _data |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | |
| | | if (!_data.$Index) { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | } catch (e) { |
| | | console.warn('数据查询错误') |
| | | return |
| | | } |
| | | |
| | | MKEmitter.emit('resetSelectLine', config.uuid, _data.$$uuid || '', _data) |
| | | } |
| | | selectedData = selectedData.map(item => { |
| | | if (item.$$uuid === _data.$$uuid) { |
| | | return _data |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | data: data, |
| | | loading: false |
| | | }) |
| | | this.setState({ |
| | | data: data, |
| | | selectedData: selectedData, |
| | | loading: false |
| | | }) |
| | | |
| | | if (_data.key === activeKey) { |
| | | MKEmitter.emit('resetSelectLine', config.uuid, _data.$$uuid || '', _data) |
| | | } |
| | | } else { |
| | | let index = data.findIndex(item => item.$$uuid === id) |
| | | |
| | | if (index === -1) { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | return |
| | | } |
| | | |
| | | data = data.filter(item => item.$$uuid !== id) |
| | | data = data.map((item, i) => { |
| | | item.key = i |
| | | return item |
| | | }) |
| | | |
| | | let trans = activeKey === index |
| | | let _item = null |
| | | |
| | | if (config.wrap.cardType) { |
| | | selectKeys = selectKeys.filter(key => key !== index) |
| | | selectKeys = selectKeys.map(key => key > index ? key - 1 : key) |
| | | |
| | | selectedData = selectKeys.map(key => data[key]).filter(Boolean) |
| | | |
| | | activeKey = selectKeys.length ? selectKeys[selectKeys.length - 1] : '' |
| | | |
| | | if (trans && selectedData.length) { |
| | | _item = selectedData[selectedData.length - 1] |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | data: data, |
| | | activeKey: activeKey, |
| | | selectKeys: selectKeys, |
| | | selectedData: selectedData, |
| | | loading: false |
| | | }) |
| | | |
| | | if (trans) { |
| | | MKEmitter.emit('resetSelectLine', config.uuid, (_item ? _item.$$uuid : ''), _item) |
| | | } |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | if (activeKey === index) return |
| | | |
| | | _selectedData = [item] |
| | | _selectKeys = [index] |
| | | _activeKey = index |
| | | } |
| | | |
| | |
| | | |
| | | window.GLOB.SyncData.delete(_config.dataName) |
| | | } |
| | | } else if (_config.wrap.datatype === 'public' && window.GLOB.CacheData.get(_config.wrap.publicId)) { |
| | | } else if (_config.wrap.datatype === 'public' && window.GLOB.CacheData.has(_config.wrap.publicId)) { |
| | | _data = window.GLOB.CacheData.get(_config.wrap.publicId) |
| | | _data = fromJS(_data).toJS() |
| | | this.loaded = true |
| | |
| | | |
| | | this.setState({data: _data}) |
| | | }) |
| | | } else { |
| | | if (config.wrap.goback === 'true' && data.$$empty) { |
| | | this.timer && this.timer.stop() |
| | | |
| | | MKEmitter.emit('closeTabView', config.$pageId) |
| | | } else { |
| | | if (selected !== 'false') { |
| | | this.checkTopLine() |
| | | } else { |
| | | this.transferLine() |
| | | } |
| | | this.autoExec() |
| | | } |
| | | } |
| | | } else { |
| | | if (!this.loaded) { |
| | |
| | | } |
| | | } else { |
| | | if (selected !== 'false') { |
| | | setTimeout(() => { |
| | | this.checkTopLine() |
| | | }, 200) |
| | | this.checkTopLine() |
| | | } |
| | | |
| | | if (config.$cache && config.$time && config.wrap.autoExec) { |
| | |
| | | }) |
| | | } |
| | | |
| | | let total = result.total || 0 |
| | | if (config.setting.custompage && data.length) { |
| | | total = data[data.length - 1].mk_total || 0 |
| | | } |
| | | |
| | | this.setState({ |
| | | data: data, |
| | | total: result.total, |
| | | total: total, |
| | | loading: false |
| | | }) |
| | | |
| | |
| | | |
| | | this.setState({data: _data}) |
| | | }) |
| | | } else { |
| | | this.openModal() |
| | | } |
| | | } else { |
| | | if (!this.loaded) { |
| | |
| | | |
| | | this.setState({data: _data}) |
| | | }) |
| | | } else { |
| | | this.openModal() |
| | | } |
| | | } else { |
| | | if (!this.loaded) { |
| | |
| | | } else if (this.loaded) { |
| | | this.openModal() |
| | | } |
| | | } else if (config.wrap.display === 'modal' && config.wrap.datatype === 'static') { |
| | | } else if (config.wrap.datatype === 'static') { |
| | | this.openModal() |
| | | } |
| | | } |
| | |
| | | this.loaded = true |
| | | |
| | | this.setState({data: _data}, () => { |
| | | if (config.wrap.display === 'modal') { |
| | | this.openModal() |
| | | } |
| | | this.openModal() |
| | | }) |
| | | |
| | | window.GLOB.SyncData.delete(config.dataName) |
| | |
| | | |
| | | openModal = (ErrCode) => { |
| | | const { config, data } = this.state |
| | | |
| | | if (config.wrap.display !== 'modal') return |
| | | |
| | | let code = config.wrap.code || ('modal' + config.uuid) |
| | | let tip = localStorage.getItem(code) |
| | |
| | | data: _data, |
| | | loading: false |
| | | }, () => { |
| | | if (config.wrap.display === 'modal') { |
| | | this.openModal(result.ErrCode) |
| | | } |
| | | this.openModal(result.ErrCode) |
| | | }) |
| | | |
| | | if (config.timer && config.clearField && result.data && result.data[0]) { |
| | |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | } |
| | | |
| | | _data.$$loaded = true |
| | | |
| | | window.GLOB.CacheData.set(config.uuid, _data) |
| | | |
| | | MKEmitter.emit('mkPublicData', config.uuid, _data) |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | onSelectChange = (selectedRowKeys, e) => { |
| | | const { setting, MenuID, data } = this.props |
| | | |
| | |
| | | } |
| | | |
| | | let selects = this.props.data.filter((item, _index) => newkeys.includes(_index) && !item.$disabled) |
| | | |
| | | |
| | | this.props.chgSelectData(selects) |
| | | |
| | | if (setting.$hasSyncModule) { |
| | |
| | | MKEmitter.emit('resetSelectLine', MenuID, _id, _data) |
| | | } |
| | | |
| | | resetTable = (id, repage, pageIndex) => { |
| | | const { MenuID } = this.props |
| | | resetTable = (id, type, Index) => { |
| | | const { MenuID, setting, data } = this.props |
| | | |
| | | if (id !== MenuID) return |
| | | |
| | | if (repage === 'false') { |
| | | if (type === 'delete') { |
| | | let selectKeys = fromJS(this.state.selectedRowKeys).toJS() |
| | | let activeKey = this.state.activeIndex |
| | | |
| | | let trans = activeKey === Index |
| | | let _item = null |
| | | let selects = [] |
| | | |
| | | if (setting.tableType) { |
| | | selectKeys = selectKeys.filter(key => key !== Index) |
| | | selectKeys = selectKeys.map(key => key > Index ? key - 1 : key) |
| | | |
| | | selects = selectKeys.map(key => data[key]).filter(Boolean) |
| | | |
| | | activeKey = selectKeys.length ? selectKeys[selectKeys.length - 1] : null |
| | | |
| | | if (trans && selects.length) { |
| | | _item = selects[selects.length - 1] |
| | | } |
| | | } |
| | | |
| | | this.setState({ selectedRowKeys: selectKeys, activeIndex: activeKey }) |
| | | |
| | | this.props.chgSelectData(selects) |
| | | |
| | | if (trans) { |
| | | MKEmitter.emit('resetSelectLine', MenuID, (_item ? _item.$$uuid : ''), _item) |
| | | } |
| | | |
| | | 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 (repage === 'repage') { |
| | | } else if (type === 'repage') { |
| | | this.setState({ |
| | | pageIndex: pageIndex, |
| | | pageIndex: Index, |
| | | selectedRowKeys: [], |
| | | activeIndex: null, |
| | | pickup: false |
| | |
| | | start = pageSize * (pageIndex - 1) + 1 |
| | | } |
| | | |
| | | this.setState({ |
| | | data: result.data.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[setting.primaryKey] || '' |
| | | item.$$key = '' + item.key + item.$$uuid |
| | | item.$$BID = BID || '' |
| | | item.$$BData = BData || '' |
| | | item.$Index = start + index + '' |
| | | let data = result.data.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[setting.primaryKey] || '' |
| | | item.$$key = '' + item.key + item.$$uuid |
| | | item.$$BID = BID || '' |
| | | item.$$BData = BData || '' |
| | | item.$Index = start + index + '' |
| | | |
| | | if (config.absFields) { |
| | | config.absFields.forEach(f => { |
| | | if (!isNaN(item[f])) { |
| | | item[f] = Math.abs(item[f]) |
| | | } |
| | | }) |
| | | } |
| | | if (setting.controlField) { |
| | | if (setting.controlVal.includes(item[setting.controlField] + '')) { |
| | | item.$disabled = true |
| | | if (config.absFields) { |
| | | config.absFields.forEach(f => { |
| | | if (!isNaN(item[f])) { |
| | | item[f] = Math.abs(item[f]) |
| | | } |
| | | }) |
| | | } |
| | | if (setting.controlField) { |
| | | if (setting.controlVal.includes(item[setting.controlField] + '')) { |
| | | item.$disabled = true |
| | | } |
| | | |
| | | return item |
| | | }), |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | let total = result.total || 0 |
| | | if (config.setting.custompage && data.length) { |
| | | total = data[data.length - 1].mk_total || 0 |
| | | } |
| | | |
| | | this.setState({ |
| | | data: data, |
| | | selectedData: [], |
| | | total: result.total, |
| | | total: total, |
| | | loading: false |
| | | }) |
| | | |
| | |
| | | if (result.status) { |
| | | let data = fromJS(this.state.data).toJS() |
| | | let selectedData = fromJS(this.state.selectedData).toJS() |
| | | |
| | | if (result.data && result.data[0]) { |
| | | let _data = result.data[0] || {} |
| | | _data.$$uuid = _data[setting.primaryKey] || '' |
| | |
| | | }) |
| | | } |
| | | |
| | | try { |
| | | data = data.map(item => { |
| | | if (item.$$uuid === _data.$$uuid) { |
| | | _data.key = item.key |
| | | _data.$$key = '' + item.key + item.$$uuid |
| | | _data.$Index = item.$Index |
| | | return _data |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | selectedData = selectedData.map(item => { |
| | | if (_data.$$uuid === item.$$uuid) { |
| | | return _data |
| | | } |
| | | data = data.map(item => { |
| | | if (item.$$uuid === _data.$$uuid) { |
| | | _data.key = item.key |
| | | _data.$$key = '' + item.key + item.$$uuid |
| | | _data.$Index = item.$Index |
| | | return _data |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | |
| | | if (!_data.$Index) { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | } catch (e) { |
| | | console.warn('数据查询错误') |
| | | return |
| | | } |
| | | |
| | | MKEmitter.emit('resetSelectLine', config.uuid, _data.$$uuid || '', _data) |
| | | } |
| | | selectedData = selectedData.map(item => { |
| | | if (_data.$$uuid === item.$$uuid) { |
| | | return _data |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | data, |
| | | selectedData, |
| | | loading: false |
| | | }) |
| | | if (selectedData.length && _data.$$uuid === selectedData[selectedData.length - 1].$$uuid) { |
| | | MKEmitter.emit('resetSelectLine', config.uuid, _data.$$uuid || '', _data) |
| | | } |
| | | |
| | | this.setState({ |
| | | data, |
| | | selectedData, |
| | | loading: false |
| | | }) |
| | | } else { |
| | | let index = data.findIndex(item => item.$$uuid === id) |
| | | |
| | | if (index === -1) { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | return |
| | | } |
| | | |
| | | data = data.filter(item => item.$$uuid !== id) |
| | | data = data.map((item, i) => { |
| | | item.key = i |
| | | item.$$key = '' + item.key + item.$$uuid |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | data: data, |
| | | loading: false |
| | | }) |
| | | |
| | | setTimeout(() => { |
| | | MKEmitter.emit('resetTable', config.uuid, 'delete', index) |
| | | }, 20) |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | return item |
| | | }) |
| | | |
| | | let total = result.total || 0 |
| | | if (config.setting.custompage && data.length) { |
| | | total = data[data.length - 1].mk_total || 0 |
| | | } |
| | | |
| | | this.setState({ |
| | | data: data, |
| | | selectedData: [], |
| | | total: result.total, |
| | | total: total, |
| | | loading: false |
| | | }) |
| | | |
| | |
| | | if (result.status) { |
| | | this.loaded = true |
| | | if (config.$cache && pageIndex === 1 && config.setting.onload !== 'false') { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | Api.writeCacheConfig(config.uuid, result.data || []) |
| | | } |
| | | |
| | | if (repage === 'false' && result.data && result.data.length === 0 && result.total > 0 && pageIndex > 1) { |
| | |
| | | return item |
| | | }) |
| | | |
| | | let total = result.total || 0 |
| | | if (config.setting.custompage && data.length) { |
| | | total = data[data.length - 1].mk_total || 0 |
| | | } |
| | | |
| | | this.setState({ |
| | | data: data, |
| | | selectedData: [], |
| | | total: result.total, |
| | | total: total, |
| | | loading: false |
| | | }) |
| | | |
| | |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | if (!result.data || !result.data[0]) { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | |
| | | return |
| | | } |
| | | |
| | | let data = fromJS(this.state.data).toJS() |
| | | let selectedData = fromJS(this.state.selectedData).toJS() |
| | | |
| | | let _data = result.data[0] |
| | | _data.$$uuid = _data[setting.primaryKey] || '' |
| | | _data.$$BID = BID || '' |
| | | _data.$$BData = BData || '' |
| | | |
| | | if (config.absFields) { |
| | | config.absFields.forEach(f => { |
| | | if (!isNaN(_data[f])) { |
| | | _data[f] = Math.abs(_data[f]) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | try { |
| | | if (!result.data) { |
| | | // if (result.data && result.data[0]) { |
| | | let _data = result.data[0] |
| | | _data.$$uuid = _data[setting.primaryKey] || '' |
| | | _data.$$BID = BID || '' |
| | | _data.$$BData = BData || '' |
| | | |
| | | if (config.absFields) { |
| | | config.absFields.forEach(f => { |
| | | if (!isNaN(_data[f])) { |
| | | _data[f] = Math.abs(_data[f]) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | data = data.map(item => { |
| | | if (item.$$uuid === _data.$$uuid) { |
| | | _data.key = item.key |
| | |
| | | return item |
| | | } |
| | | }) |
| | | |
| | | if (!_data.$Index) { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | return |
| | | } |
| | | |
| | | selectedData = selectedData.map(item => { |
| | | if (_data.$$uuid === item.$$uuid) { |
| | | return _data |
| | | } |
| | | return item |
| | | }) |
| | | } catch (e) { |
| | | console.warn('数据查询错误') |
| | | |
| | | if (selectedData.length && _data.$$uuid === selectedData[selectedData.length - 1].$$uuid) { |
| | | MKEmitter.emit('resetSelectLine', config.uuid, _data.$$uuid || '', _data) |
| | | } |
| | | |
| | | this.setState({ |
| | | data, |
| | | selectedData, |
| | | loading: false |
| | | }) |
| | | |
| | | if (config.setting.$hasSyncModule) { |
| | | MKEmitter.emit('syncBalconyData', config.uuid, selectedData, data.length === selectedData.length) |
| | | } |
| | | } else { |
| | | let index = data.findIndex(item => item.$$uuid === id) |
| | | |
| | | if (index === -1) { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | return |
| | | } |
| | | |
| | | data = data.filter(item => item.$$uuid !== id) |
| | | data = data.map((item, i) => { |
| | | item.key = i |
| | | item.$$key = '' + item.key + item.$$uuid |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | data: data, |
| | | loading: false |
| | | }) |
| | | |
| | | setTimeout(() => { |
| | | MKEmitter.emit('resetTable', config.uuid, 'delete', index) |
| | | }, 20) |
| | | } |
| | | |
| | | MKEmitter.emit('resetSelectLine', config.uuid, _data.$$uuid || '', _data) |
| | | |
| | | this.setState({ |
| | | data, |
| | | selectedData, |
| | | loading: false |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | style.display = 'none' |
| | | } |
| | | |
| | | let content = <> |
| | | {config.search && config.search.length ? |
| | | <MainSearch BID={BID} config={config} refreshdata={this.refreshbysearch}/> : null |
| | | } |
| | | {actions.length > 0 ? <MainAction |
| | | BID={BID} |
| | | setting={setting} |
| | | actions={actions} |
| | | BData={BData} |
| | | columns={config.columns} |
| | | selectedData={selectedData} |
| | | /> : <div className="mk-action-space" style={{height: '25px'}}></div>} |
| | | <div className={'main-table-box ' + (!actions || actions.length === 0 ? 'no-action' : '')}> |
| | | <MainTable |
| | | setting={setting} |
| | | columns={columns} |
| | | MenuID={config.uuid} |
| | | data={this.state.data} |
| | | fields={config.columns} |
| | | total={this.state.total} |
| | | lineMarks={config.lineMarks} |
| | | loading={this.state.loading} |
| | | refreshdata={this.refreshbytable} |
| | | statFValue={this.state.statFValue} |
| | | chgSelectData={(selects) => this.setState({selectedData: selects})} |
| | | /> |
| | | </div> |
| | | </> |
| | | |
| | | return ( |
| | | <div className="custom-normal-table" id={'anchor' + config.uuid} style={style}> |
| | | {config.wrap.collapse === 'true' ? <Collapse bordered={false} defaultActiveKey="1" expandIconPosition="right"> |
| | | <Panel forceRender={true} header={<NormalHeader config={config}/>} key="1"> |
| | | {config.search && config.search.length ? |
| | | <MainSearch BID={BID} config={config} refreshdata={this.refreshbysearch}/> : null |
| | | } |
| | | {actions.length > 0 ? <MainAction |
| | | BID={BID} |
| | | setting={setting} |
| | | actions={actions} |
| | | BData={BData} |
| | | columns={config.columns} |
| | | selectedData={selectedData} |
| | | /> : <div className="mk-action-space" style={{height: '25px'}}></div>} |
| | | <div className="main-table-box"> |
| | | <MainTable |
| | | setting={setting} |
| | | columns={columns} |
| | | MenuID={config.uuid} |
| | | data={data} |
| | | fields={config.columns} |
| | | total={this.state.total} |
| | | lineMarks={config.lineMarks} |
| | | loading={this.state.loading} |
| | | refreshdata={this.refreshbytable} |
| | | statFValue={this.state.statFValue} |
| | | chgSelectData={(selects) => this.setState({selectedData: selects})} |
| | | /> |
| | | </div> |
| | | {content} |
| | | </Panel> |
| | | </Collapse> : <> |
| | | <NormalHeader config={config}/> |
| | | {config.search && config.search.length ? |
| | | <MainSearch BID={BID} config={config} refreshdata={this.refreshbysearch}/> : null |
| | | } |
| | | {actions.length > 0 ? <MainAction |
| | | BID={BID} |
| | | setting={setting} |
| | | actions={actions} |
| | | BData={BData} |
| | | columns={config.columns} |
| | | selectedData={selectedData} |
| | | /> : <div className="mk-action-space" style={{height: '25px'}}></div>} |
| | | <div className={'main-table-box ' + (!actions || actions.length === 0 ? 'no-action' : '')}> |
| | | <MainTable |
| | | setting={setting} |
| | | columns={columns} |
| | | MenuID={config.uuid} |
| | | data={this.state.data} |
| | | fields={config.columns} |
| | | total={this.state.total} |
| | | lineMarks={config.lineMarks} |
| | | loading={this.state.loading} |
| | | refreshdata={this.refreshbytable} |
| | | statFValue={this.state.statFValue} |
| | | chgSelectData={(selects) => this.setState({selectedData: selects})} |
| | | /> |
| | | </div> |
| | | {content} |
| | | </>} |
| | | </div> |
| | | ) |
| | |
| | | |
| | | component.setting.customScript = _customScript // 整理后自定义脚本 |
| | | |
| | | if (component.setting.laypage) { |
| | | component.setting.custompage = /@pageSize@/i.test(component.setting.dataresource + component.setting.customScript) |
| | | } |
| | | |
| | | if (component.setting.sync === 'true') { |
| | | // pageable 是否分页,组件属性,不分页的组件才可以统一查询 |
| | | if ((!component.pageable || (component.pageable && !component.setting.laypage)) && component.setting.onload === 'true') { |
| | |
| | | |
| | | component.setting.customScript = _customScript // 整理后自定义脚本 |
| | | |
| | | if (component.setting.laypage) { |
| | | component.setting.custompage = /@pageSize@/i.test(component.setting.dataresource + component.setting.customScript) |
| | | } |
| | | |
| | | if (component.setting.sync === 'true') { |
| | | // pageable 是否分页,组件属性,不分页的组件才可以统一查询 |
| | | if ((!component.pageable || (component.pageable && !component.setting.laypage)) && component.setting.onload === 'true') { |
| | |
| | | } |
| | | |
| | | let _search = '' |
| | | let cus_page = /@pageSize@/i.test(_dataresource + _customScript) |
| | | |
| | | if (_dataresource) { |
| | | if (setting.queryType === 'statistics') { // 统计数据源,内容替换 |
| | |
| | | } |
| | | |
| | | if (_dataresource && setting.laypage && orderBy && !id) { |
| | | if (cus_page) { |
| | | if (setting.custompage) { |
| | | LText = `/*system_query*/select ${arrFields} from ${_dataresource} ${_search} ` |
| | | } else { |
| | | LText = `/*system_query*/select top ${pageSize} ${arrFields} from (select ${arrFields} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows ` |
| | | } |
| | | if (setting.sub_field) { |
| | | DateCount = `/*system_query*/select count(1) as total from (select distinct ${setting.primaryKey} from ${_dataresource} ${_search})a` |
| | | } else { |
| | | DateCount = `/*system_query*/select count(1) as total from ${_dataresource} ${_search}` |
| | | if (setting.sub_field) { |
| | | DateCount = `/*system_query*/select count(1) as total from (select distinct ${setting.primaryKey} from ${_dataresource} ${_search})a` |
| | | } else { |
| | | DateCount = `/*system_query*/select count(1) as total from ${_dataresource} ${_search}` |
| | | } |
| | | } |
| | | } else if (_dataresource && orderBy) { |
| | | LText = `/*system_query*/select ${arrFields} from (select ${arrFields} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows ` |