| | |
| | | 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 }, |
| | | { origin: true, uuid: Utils.getuuid(), Align: 'left', label: 'label2', field: '', Hide: 'false', IsSort: 'false', type: 'text', Width: 120 }, |
| | | { origin: true, uuid: Utils.getuuid(), Align: 'left', label: 'label3', field: '', Hide: 'false', IsSort: 'false', type: 'text', Width: 120 }, |
| | | ], |
| | | scripts: [], |
| | | isNew: true |
| | |
| | | } |
| | | MKEmitter.removeListener('completeSave', this.completeSave) |
| | | } |
| | | |
| | | // updateFix = (card) => { |
| | | // let fixs = {} |
| | | |
| | | // card.cols.forEach(col => { |
| | | // if (!col.field) return |
| | | // if (col.postfix || col.prefix) { |
| | | // fixs[col.field] = col |
| | | // } |
| | | // }) |
| | | |
| | | // card.cols.forEach(col => { |
| | | // if (col.type === 'custom') { |
| | | // col.elements.forEach(cell => { |
| | | // if (cell.datatype === 'dynamic') { |
| | | // cell.height = '' |
| | | // cell.innerHeight = 'auto' |
| | | |
| | | // if (fixs[cell.field]) { |
| | | // if (!cell.prefix && fixs[cell.field].prefix) { |
| | | // cell.prefix = fixs[cell.field].prefix |
| | | // } |
| | | // if (!cell.postfix && fixs[cell.field].postfix) { |
| | | // cell.postfix = fixs[cell.field].postfix |
| | | // } |
| | | // } |
| | | // } |
| | | // }) |
| | | // } |
| | | // }) |
| | | |
| | | // return card |
| | | // } |
| | | |
| | | completeSave = () => { |
| | | const { card } = this.state |
| | |
| | | if (card.errors.length === 0) { |
| | | card.$tables = getTables(card) |
| | | } |
| | | |
| | | delete card.$c_ds |
| | | delete card.$c_ac |
| | | delete card.$c_cl |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | getWrapForms = () => { |
| | | const { wrap, action, columns, cols } = this.state.card |
| | | |
| | | let _actions = [...action] |
| | | let _actions = [] |
| | | |
| | | cols.forEach(col => { |
| | | if (col.type !== 'action') return |
| | | _actions.push(...col.elements) |
| | | if (col.type === 'custom') { |
| | | col.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | |
| | | _actions.push(cell) |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | return getWrapForm(wrap, _actions, columns) |
| | | return getWrapForm(wrap, _actions, columns, action) |
| | | } |
| | | |
| | | updateWrap = (res) => { |
| | |
| | | res.drawerPlacement = card.wrap.drawerPlacement || 'right' |
| | | res.searchRatio = card.wrap.searchRatio || 6 |
| | | res.searchLwidth = card.wrap.searchLwidth !== undefined ? card.wrap.searchLwidth : 33.3 |
| | | res.borderRadius = card.wrap.borderRadius || 0 |
| | | res.resetContrl = card.wrap.resetContrl || 'init' |
| | | |
| | | this.updateComponent({...card, wrap: res}) |
| | | } |
| | |
| | | config.cols.forEach(col => { |
| | | if (!col.field) return |
| | | if (['text', 'picture', 'video', 'textarea'].includes(col.type)) { |
| | | let datatype = `Nvarchar(${col.fieldlength || 50})` |
| | | let type = 'text' |
| | | |
| | | if (col.type === 'text') { |
| | | if (col.textFormat === 'YYYY-MM-DD') { |
| | | datatype = 'date' |
| | | } else if (col.textFormat === 'YYYY-MM-DD HH:mm:ss') { |
| | | datatype = 'datetime' |
| | | } |
| | | } |
| | | |
| | | config.columns.push({ |
| | | datatype: `Nvarchar(${col.fieldlength || 50})`, |
| | | datatype: datatype, |
| | | field: col.field, |
| | | fieldlength: col.fieldlength || 50, |
| | | label: col.label, |
| | | type: 'text', |
| | | type: type, |
| | | uuid: col.uuid |
| | | }) |
| | | } else if (col.type === 'link') { |
| | |
| | | config.absFields = null |
| | | } |
| | | |
| | | if (!config.setting.primaryKey && config.columns.length > 0) { |
| | | config.columns.forEach(col => { |
| | | if (col.field.toLowerCase() === 'id') { |
| | | config.setting.primaryKey = col.field |
| | | } |
| | | }) |
| | | } |
| | | |
| | | this.updateComponent(config) |
| | | } |
| | | |