| | |
| | | import { ArrowUpOutlined } from '@ant-design/icons' |
| | | // import moment from 'moment' |
| | | |
| | | import { colorTransform } from '@/utils/option.js' |
| | | // import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import './index.scss' |
| | |
| | | } |
| | | |
| | | let uuids = {} |
| | | let formActions = [] |
| | | let popActions = [] |
| | | |
| | | let tbl = this.getTable(config, uuids) |
| | | let tbl = this.getTable(config, uuids, formActions, popActions) |
| | | |
| | | if (config.autoMatic && config.autoMatic.enable === 'true' && uuids[config.autoMatic.action]) { |
| | | _config.autoMatic = {...config.autoMatic} |
| | | _config.autoMatic.action = uuids[config.autoMatic.action] |
| | | } else { |
| | | _config.autoMatic = {enable: 'false'} |
| | | } |
| | | |
| | | _config.components.push(tbl) |
| | | |
| | | console.log(config) |
| | | console.log(_config) |
| | | |
| | | setTimeout(() => { |
| | | _resolve() |
| | | }, 5000) |
| | | } |
| | | |
| | | getTable = (config, uuids) => { |
| | | getTable = (config, uuids, formActions, popActions) => { |
| | | let _card = { |
| | | uuid: Utils.getuuid(), |
| | | type: 'table', |
| | |
| | | item.uuid = Utils.getuuid() |
| | | return item |
| | | }), |
| | | action: [ |
| | | { origin: true, uuid: Utils.getuuid(), label: '添加', intertype: 'system', OpenType: 'pop', execSuccess: 'grid', icon: 'plus', class: 'green', style: {color: 'rgb(255, 255, 255)', background: 'rgb(38, 194, 129)', marginRight: '15px'} }, |
| | | { origin: true, uuid: Utils.getuuid(), label: '修改', intertype: 'system', OpenType: 'pop', execSuccess: 'grid', icon: 'form', class: 'purple', style: {color: 'rgb(255, 255, 255)', background: 'rgb(142, 68, 173)', marginRight: '15px'} }, |
| | | { origin: true, uuid: Utils.getuuid(), label: '删除', intertype: 'system', OpenType: 'prompt', execSuccess: 'grid', Ot: 'required', icon: 'delete', class: 'danger', style: {color: 'rgb(255, 255, 255)', background: 'rgb(255, 77, 79)', marginRight: '15px'} } |
| | | ], |
| | | action: [], |
| | | subtype: 'basetable', |
| | | setting: { interType: 'system' }, |
| | | wrap: { bordered: 'true', tableType: 'checkbox', show: 'true' }, |
| | | setting: { }, |
| | | wrap: { }, |
| | | style: {}, |
| | | headerStyle: {}, |
| | | columns: [], |
| | | cols: [ |
| | | { origin: true, uuid: Utils.getuuid(), Align: 'left', label: 'label1', field: '', Hide: 'false', type: 'text', Width: 120 }, |
| | | { origin: true, uuid: Utils.getuuid(), Align: 'left', label: 'label2', field: '', Hide: 'false', IsSort: 'true', type: 'text', Width: 120 }, |
| | | { origin: true, uuid: Utils.getuuid(), Align: 'left', label: 'label3', field: '', Hide: 'false', IsSort: 'true', type: 'text', Width: 120 }, |
| | | ], |
| | | cols: [], |
| | | scripts: [] |
| | | } |
| | | |
| | | let _cols = {} |
| | | let _colspan = [] |
| | | let lineMarks = [] |
| | | config.columns.forEach(col => { |
| | | // if (col.type === 'index' || col.field) { |
| | | if (col.type === 'colspan') { |
| | | _colspan.push() |
| | | _colspan.push(col.subfield.split(', ')) |
| | | } |
| | | if (!col.field) return |
| | | |
| | | _cols[col.field] = col |
| | | let _col = fromJS(col).toJS() |
| | | |
| | | if (_col.marks) { |
| | | _col.marks = [] |
| | | col.marks.forEach(m => { |
| | | if (m.signType === 'card') return |
| | | |
| | | let field = [] |
| | | field.push(m.field) |
| | | field.push(m.contrastType) |
| | | |
| | | if (m.contrastField) { |
| | | field.push(m.contrastField) |
| | | } |
| | | let color = '#1890ff' |
| | | if (m.color && m.color[1]) { |
| | | color = colorTransform[m.color[1]] |
| | | } |
| | | let signType = ['font'] |
| | | if (m.signType === 'background') { |
| | | signType = ['background'] |
| | | } else if (m.signType === 'icon') { |
| | | if (m.position === 'back') { |
| | | signType = ['iconback'] |
| | | } else { |
| | | signType = ['iconfront'] |
| | | } |
| | | signType.push(m.iconType) |
| | | signType.push(m.icon) |
| | | } |
| | | |
| | | if (m.signType === 'line') { |
| | | lineMarks.push({ |
| | | $index: lineMarks.length + 1, |
| | | field: field, |
| | | color: color, |
| | | contrastValue: m.contrastValue || '', |
| | | match: m.match, |
| | | signType: ['background'] |
| | | }) |
| | | } else { |
| | | _col.marks.push({ |
| | | $index: _col.marks.length + 1, |
| | | field: field, |
| | | color: color, |
| | | contrastValue: m.contrastValue || '', |
| | | match: m.match, |
| | | signType: signType |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | _cols[col.field] = _col |
| | | }) |
| | | |
| | | _card.cols = [] |
| | | config.columns.forEach(col => { |
| | | if (col.type === 'index' || col.field) { |
| | | _card.cols.push(col) |
| | | if (col.type === 'index') { |
| | | _card.cols.push(fromJS(col).toJS()) |
| | | } else if (col.field && _cols[col.field]) { |
| | | let _col = fromJS(_cols[col.field]).toJS() |
| | | |
| | | if (_colspan.includes(col.field)) { |
| | | _col.Hide = 'true' |
| | | } |
| | | |
| | | _card.cols.push(_col) |
| | | } |
| | | |
| | | if (col.type === 'colspan') { |
| | | let ucol = { |
| | | Align: col.Align, |
| | | Hide: col.Hide, |
| | | label: col.label, |
| | | marks: [], |
| | | isSub: false, |
| | | uuid: col.uuid, |
| | | blacklist: [] |
| | | } |
| | | if (col.unfold === 'true') { |
| | | ucol.type = 'colspan' |
| | | ucol.subcols = [] |
| | | |
| | | col.subfield.split(', ').forEach(sub => { |
| | | if (_cols[sub]) { |
| | | let _col = fromJS(_cols[sub]).toJS() |
| | | _col.Hide = 'false' |
| | | _col.isSub = true |
| | | _col.uuid = Utils.getuuid() |
| | | |
| | | ucol.subcols.push(_col) |
| | | } |
| | | }) |
| | | |
| | | if (ucol.subcols.length > 0) { |
| | | _card.cols.push(ucol) |
| | | } |
| | | } else { |
| | | ucol.Width = 120 |
| | | ucol.type = 'custom' |
| | | ucol.elements = [] |
| | | ucol.style = {paddingTop: '12px', paddingLeft: '8px', paddingBottom: '12px', paddingRight: '8px'} |
| | | |
| | | col.subfield.split(', ').forEach(sub => { |
| | | if (_cols[sub]) { |
| | | let _col = { |
| | | copyable: 'false', |
| | | datatype: 'dynamic', |
| | | eleType: _cols[sub].type !== 'number' ? 'text' : 'number', |
| | | field: sub, |
| | | height: 1, |
| | | innerHeight: 21, |
| | | marks: _cols[sub].marks || null, |
| | | noValue: 'show', |
| | | style: {}, |
| | | width: 24, |
| | | uuid: Utils.getuuid() |
| | | } |
| | | |
| | | ucol.elements.push(_col) |
| | | } |
| | | }) |
| | | |
| | | if (ucol.elements.length > 0) { |
| | | _card.cols.push(ucol) |
| | | } |
| | | } |
| | | } |
| | | }) |
| | | |
| | | _card.lineMarks = lineMarks |
| | | _card.columns = [] |
| | | _card.absFields = [] |
| | | _card.cols.forEach(col => { |
| | |
| | | _card.absFields = null |
| | | } |
| | | |
| | | let colbtns = [] |
| | | let colors = { primary: '#1890ff', yellow: '#c49f47', orange: 'orange', danger: '#ff4d4f', green: '#26C281', dgreen: '#32c5d2', purple: '#8E44AD', cyan: '#13c2c2', gray: '#666666', default: '#333333' } |
| | | |
| | | config.action.forEach(btn => { |
| | | let _c = btn.class ? btn.class.replace('border-', '') : '' |
| | | let color = colors[_c] || '#1890ff' |
| | | let _btn = fromJS(btn).toJS() |
| | | _btn.uuid = Utils.getuuid() |
| | | delete _btn.position |
| | | delete _btn.linkTab |
| | | |
| | | uuids[btn.uuid] = _btn.uuid |
| | | |
| | | if (btn.OpenType === 'pop' || (btn.OpenType === 'funcbutton' && btn.funcType === 'print' && btn.execMode === 'pop')) { |
| | | |
| | | formActions.push({origin: btn.uuid, uuid: _btn.uuid}) |
| | | } else if (btn.OpenType === 'popview') { |
| | | |
| | | popActions.push({origin: btn.uuid, linkTab: btn.linkTab || '', uuid: _btn.uuid}) |
| | | } else if (btn.OpenType === 'tab') { |
| | | if (btn.tabTemplate === 'FormTab' || !btn.linkmenu || btn.linkmenu.length !== 3) { |
| | | return |
| | | } |
| | | } |
| | | |
| | | if (_btn.tabType === 'CommonTable') { |
| | | _btn.tabType = 'BaseTable' |
| | | } |
| | | |
| | | if (btn.position === 'grid') { |
| | | _btn.eleType = 'button' |
| | | _btn.width = 24 |
| | | _btn.style = {color: color, backgroundColor: 'transparent', borderColor: 'transparent'} |
| | | colbtns.push(_btn) |
| | | } else { |
| | | if (btn.class.indexOf('border') > -1 || btn.class === 'default') { |
| | | _btn.style = {color: color, backgroundColor: '#fff', borderColor: color, marginRight: '15px'} |
| | | } else { |
| | | _btn.style = {color: '#fff', backgroundColor: color, borderColor: color, marginRight: '15px'} |
| | | } |
| | | _card.action.push(_btn) |
| | | } |
| | | }) |
| | | |
| | | if (colbtns.length > 0) { |
| | | _card.cols.push({ |
| | | Align: 'left', |
| | | label: '操作', |
| | | marks: [], |
| | | isSub: false, |
| | | uuid: Utils.getuuid(), |
| | | type: 'action', |
| | | Width: 120, |
| | | elements: colbtns, |
| | | style: {paddingTop: '12px', paddingLeft: '8px', paddingBottom: '12px', paddingRight: '8px'} |
| | | }) |
| | | } |
| | | |
| | | let sets = ['tableName', 'interType', 'sysInterface', 'innerFunc', 'interface', 'proInterface', 'outerFunc', 'dataresource', ['queryType', 'query'], 'primaryKey', 'order', 'execute', ['laypage', 'true'], ['pageSize', 10], ['onload', 'true']] |
| | | let wraps = ['tableType', ['bordered', 'true'], 'actionfixed', ['size', 'middle'], ['selected', 'false'], ['tableMode', 'compatible'], ['mask', 'show'], ['borderColor', '#e8e8e8'], 'height', 'controlField', 'controlVal'] |
| | | // useMSearch supModule |
| | | _card.scripts = config.setting.scripts |
| | | |
| | | sets.forEach(n => { |
| | | if (n === 'interType' && !['system', 'inner', 'outer'].includes(config.setting.interType)) { |
| | | _card.setting.interType = 'system' |
| | | } else if (typeof(n) === 'string') { |
| | | _card.setting[n] = config.setting[n] || '' |
| | | } else { |
| | | _card.setting[n[0]] = config.setting[n[0]] || n[1] |
| | | } |
| | | }) |
| | | wraps.forEach(w => { |
| | | if (typeof(w) === 'string') { |
| | | _card.wrap[w] = config.setting[w] || '' |
| | | } else { |
| | | _card.wrap[w[0]] = config.setting[w[0]] || w[1] |
| | | } |
| | | }) |
| | | |
| | | if (config.setting.doubleClick && uuids[config.setting.doubleClick]) { |
| | | _card.wrap.doubleClick = uuids[config.setting.doubleClick] |
| | | } else { |
| | | _card.wrap.doubleClick = '' |
| | | } |
| | | |
| | | return _card |
| | | } |
| | | |