| | |
| | | value: 'colspan', |
| | | text: '合并列' |
| | | }, { |
| | | value: 'extend', |
| | | text: '扩展列' |
| | | }, { |
| | | value: 'index', |
| | | text: '序号' |
| | | }] |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'colUnit', |
| | | label: '单位', |
| | | initVal: card.colUnit || 'day', |
| | | required: true, |
| | | options: [{ |
| | | value: 'day', |
| | | text: '天' |
| | | }, { |
| | | value: 'hour', |
| | | text: '小时' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'shift', |
| | | label: '偏移量', |
| | | initVal: card.shift || 0, |
| | | min: -1000, |
| | | max: 1000, |
| | | decimal: 0, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'quota', |
| | | label: '指标数', |
| | | initVal: card.quota || 7, |
| | | min: 1, |
| | | max: 1000, |
| | | decimal: 0, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'dayFormat', |
| | | label: '格式化', |
| | | initVal: card.dayFormat || 'M/DD', |
| | | required: true, |
| | | options: [{ |
| | | value: 'M/DD', |
| | | label: 'M/DD(4/29)' |
| | | }, { |
| | | value: 'M-DD', |
| | | label: 'M-DD(4-29)' |
| | | }, { |
| | | value: 'M月DD日', |
| | | label: 'M月DD日(4月29日)' |
| | | }, { |
| | | value: 'M/DD week', |
| | | label: 'M/DD week(4/29 星期一)' |
| | | }, { |
| | | value: 'M-DD week', |
| | | label: 'M-DD week(4-29 星期一)' |
| | | }, { |
| | | value: 'M月DD日 week', |
| | | label: 'M月DD日 week(4月29日 星期一)' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'hourFormat', |
| | | label: '格式化', |
| | | initVal: card.hourFormat || 'H:00', |
| | | required: true, |
| | | options: [{ |
| | | value: 'H:00', |
| | | label: 'H:00(15:00)' |
| | | }, { |
| | | value: 'H point', |
| | | label: 'H(15点)' |
| | | }, { |
| | | value: 'h:00', |
| | | label: 'h:00(3:00 pm)' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'supField', |
| | | label: '上级字段', |
| | | initVal: card.supField || '', |
| | | tooltip: '来源于上级组件的字段集(上级组件为空时从url参数中选取),该字段值(用逗号分隔)可控制扩展列的列名。', |
| | | required: false, |
| | | rules: [{ |
| | | pattern: /^[0-9a-zA-Z_]*$/ig, |
| | | message: '字段名只允许包含数字、字母以及_' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'editable', |
| | | label: '可编辑', |
| | | initVal: card.editable || 'false', |
| | |
| | | textarea: ['label', 'field', 'type', 'Align', 'Hide', 'Width', 'prefix', 'initval', 'postfix', 'blacklist'], |
| | | custom: ['label', 'type', 'Align', 'Width', 'blacklist', 'IsSort'], |
| | | colspan: ['label', 'type', 'Align', 'Hide', 'blacklist'], |
| | | extend: ['label', 'field', 'type', 'Align', 'Width', 'colUnit', 'shift', 'quota', 'supField'], |
| | | action: ['label', 'type', 'Align', 'Width'], |
| | | formula: ['label', 'type', 'Align', 'Hide', 'Width', 'prefix', 'postfix', 'eval', 'formula', 'blacklist'], |
| | | index: ['label', 'type', 'Align', 'Width'] |
| | |
| | | } else if (this.record.type === 'number') { |
| | | _options.push('max', 'min', 'enter', 'clearField') |
| | | } |
| | | } else if (this.record.type === 'extend') { |
| | | if (this.record.colUnit === 'day') { |
| | | _options.push('dayFormat') |
| | | } else { |
| | | _options.push('hourFormat') |
| | | } |
| | | } |
| | | if (this.record.type === 'formula' && this.record.eval === 'true') { |
| | | _options.push('decimal') |
| | |
| | | {column.type === 'custom' ? <PasteComponent options={['customCardElement', 'action']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} |
| | | {column.type === 'custom' ? <FontColorsOutlined className="style" title="调整样式" onClick={() => this.props.changeStyle(column)}/> : null} |
| | | <DeleteOutlined className="close" title="删除" onClick={this.deleteCol} /> |
| | | {['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } |
| | | {['text', 'number', 'formula', 'extend'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } |
| | | </div> |
| | | } trigger="hover"> |
| | | {children} |
| | |
| | | updatecolumn = (config) => { |
| | | config.absFields = [] |
| | | config.mergeCol = false |
| | | config.hasExtend = false |
| | | config.parCtrl = false |
| | | |
| | | let mapCol = (cols) => { |
| | | cols.forEach(col => { |
| | | if (col.type === 'number') { |
| | | if (col.format === 'abs') { |
| | | config.absFields.push(col.field) |
| | | } |
| | | } else if (col.type === 'extend') { |
| | | config.hasExtend = true |
| | | if (col.supField) { |
| | | config.parCtrl = true |
| | | } |
| | | } else if (col.type === 'colspan' && col.subcols) { |
| | | mapCol(col.subcols) |
| | |
| | | if (col.format === 'abs') { |
| | | config.absFields.push(col.field) |
| | | } |
| | | } else if (col.type === 'extend') { |
| | | config.hasExtend = true |
| | | if (col.supField) { |
| | | config.parCtrl = true |
| | | } |
| | | } else if (col.type === 'colspan' && col.subcols) { |
| | | mapCol(col.subcols) |
| | | } else if (col.type === 'text') { |
| | |
| | | text: '序号' |
| | | }] |
| | | |
| | | if (appType === 'mob') { |
| | | options = options.filter(item => item.value !== 'extend') |
| | | } |
| | | |
| | | if (!card.linkurl && (!card.linkmenu || card.linkmenu.length === 0)) { |
| | | card.perspective = '' |
| | | } |
| | |
| | | tooltip: '来源于上级组件的字段集(上级组件为空时从url参数中选取),该字段值(用逗号分隔)可控制扩展列的列名。', |
| | | required: false, |
| | | rules: [{ |
| | | pattern: /^[\u4E00-\u9FA50-9a-zA-Z_]*$/ig, |
| | | message: '字段名只允许包含数字、字母、汉字以及_' |
| | | pattern: /^[0-9a-zA-Z_]*$/ig, |
| | | message: '字段名只允许包含数字、字母以及_' |
| | | }] |
| | | }, |
| | | { |
| | |
| | | {column.type === 'custom' ? <PasteComponent options={['customCardElement', 'action']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} |
| | | {column.type === 'custom' ? <FontColorsOutlined className="style" title="调整样式" onClick={() => this.props.changeStyle(column)}/> : null} |
| | | <DeleteOutlined className="close" title="删除" onClick={this.deleteCol} /> |
| | | {['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } |
| | | {['text', 'number', 'formula', 'extend'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } |
| | | </div> |
| | | } trigger="hover"> |
| | | {children} |
| | |
| | | updatecolumn = (config) => { |
| | | config.absFields = [] |
| | | config.hasExtend = false |
| | | config.parCtrl = false |
| | | let mapCol = (cols) => { |
| | | cols.forEach(col => { |
| | | if (col.type === 'number') { |
| | |
| | | } |
| | | } else if (col.type === 'extend') { |
| | | config.hasExtend = true |
| | | if (col.supField) { |
| | | config.parCtrl = true |
| | | } |
| | | } else if (col.type === 'colspan' && col.subcols) { |
| | | mapCol(col.subcols) |
| | | } |
| | |
| | | col.type = 'custom' |
| | | } |
| | | |
| | | if (col.type === 'number') { |
| | | if (col.type === 'index') { |
| | | col.field = '$Index' |
| | | col.type = 'text' |
| | | } else if (col.type === 'number') { |
| | | if (col.sum === 'true') { |
| | | statFields.push(col) |
| | | } |
| | |
| | | }) |
| | | return |
| | | } |
| | | // window.open('https://kgcs.kuan-gu.com:10853/thirdPlatFormLogin?userName=admin&taxCode=91120222MA07GMNW97&taxName=天津畅享数字科技有限公司') |
| | | |
| | | this.clearData() |
| | | |
| | |
| | | chgSelectData: PropTypes.func, // 数据切换 |
| | | autoMatic: PropTypes.any, |
| | | allSearch: PropTypes.any, |
| | | colsCtrls: PropTypes.any |
| | | colsCtrls: PropTypes.any, |
| | | parCtrl: PropTypes.any |
| | | } |
| | | |
| | | state = { |
| | |
| | | if (item.rowspan === 'true') { |
| | | rowspans.push(item.field) |
| | | } |
| | | if (item.type === 'index') { |
| | | item.field = '$Index' |
| | | item.type = 'text' |
| | | } else if (_format && !Math.floor(Math.random() * radio)) { |
| | | if (_format && !Math.floor(Math.random() * radio)) { |
| | | item.blur = true |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | | const { allSearch } = this.props |
| | | const { allSearch, parCtrl } = this.props |
| | | const { allColumns } = this.state |
| | | |
| | | if (allSearch && !is(fromJS(allSearch), fromJS(nextProps.allSearch))) { |
| | |
| | | }, () => { |
| | | this.setState({reseting: false}) |
| | | }) |
| | | } else if (parCtrl && !is(fromJS(this.props.columns), fromJS(nextProps.columns))) { |
| | | let getColumns = (cols) => { |
| | | return cols.map(item => { |
| | | let cell = null |
| | | |
| | | if (item.type === 'colspan') { |
| | | cell = { title: item.label, align: item.Align } |
| | | cell.children = getColumns(item.subcols) |
| | | } else { |
| | | cell = { |
| | | align: item.Align, |
| | | dataIndex: item.uuid, |
| | | title: item.label, |
| | | sorter: (item.field || item.sortField) && item.IsSort === 'true', |
| | | width: item.Width || 120, |
| | | onCell: record => ({ |
| | | record, |
| | | col: item, |
| | | config: item.type === 'custom' ? {setting: this.props.setting, columns: this.props.fields} : null, |
| | | }) |
| | | } |
| | | } |
| | | |
| | | return cell |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | columns: getColumns(nextProps.columns) |
| | | }) |
| | | } |
| | | } |
| | | |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | |
| | | } |
| | | }) |
| | | |
| | | let _columns = [] |
| | | let initId = '' |
| | | |
| | | setting.hasSubmit = false |
| | |
| | | setting.commit = 'change' |
| | | } |
| | | |
| | | let index = 0 |
| | | let getColumns = (cols) => { |
| | | return cols.filter(item => { |
| | | if (item.Hide === 'true') return false |
| | |
| | | return false |
| | | } |
| | | } else if (item.type === 'custom') { |
| | | item.config = {setting: _config.setting, columns: _config.columns} |
| | | |
| | | item.elements.forEach(btn => { |
| | | if (btn.eleType !== 'button') return |
| | | if (btn.funcType === 'addline') { |
| | |
| | | } |
| | | }) |
| | | } else { |
| | | if (item.type === 'index') { |
| | | item.field = '$Index' |
| | | item.type = 'text' |
| | | } |
| | | |
| | | if (item.editable === 'true') { |
| | | item.$sort = index |
| | | index++ |
| | | |
| | | setting.hasSubmit = setting.commit !== 'change' |
| | | item.$ctrl = setting.commit === 'change' |
| | | |
| | | if (item.ctrlField) { |
| | | item.ctrlValue = item.ctrlValue.split(',') |
| | | } |
| | | if (!initId) { |
| | | initId = item.uuid |
| | | } |
| | |
| | | } |
| | | |
| | | if (item.type === 'number') { |
| | | |
| | | if (item.clearField) { |
| | | _config.columns.forEach(cell => { |
| | | if (cell.field === item.clearField) { |
| | | item.clearName = cell.label |
| | | } |
| | | }) |
| | | } |
| | | } else if (item.editType === 'date') { |
| | | item.format = 'YYYY-MM-DD' |
| | | |
| | | if (item.precision === 'hour') { |
| | | item.format = 'YYYY-MM-DD HH' |
| | | } else if (item.precision === 'minute') { |
| | | item.format = 'YYYY-MM-DD HH:mm' |
| | | } else if (item.precision === 'second') { |
| | | item.format = 'YYYY-MM-DD HH:mm:ss' |
| | | } |
| | | } else if (item.editType === 'select') { |
| | | item.map = new Map() |
| | | |
| | | item.options = item.options || [] |
| | | item.options = item.options.filter(cell => { |
| | | cell.value = cell.Value |
| | |
| | | |
| | | return !cell.Hide |
| | | }) |
| | | |
| | | if (item.resourceType !== '1') { |
| | | item.options.forEach(cell => { |
| | | item.map.set(cell.value, cell.label) |
| | | }) |
| | | } |
| | | } else if (item.editType === 'popSelect') { |
| | | if (item.pops) { |
| | | item.pops.forEach(cell => { |
| | |
| | | }) |
| | | } |
| | | |
| | | _columns = getColumns(_config.cols) |
| | | _config.cols = getColumns(_config.cols) |
| | | |
| | | let _columns = _config.cols |
| | | if (_config.hasExtend) { |
| | | _columns = this.getCols(_config.cols, BData, _config.setting.extendTime) |
| | | } |
| | | |
| | | setting.initId = initId |
| | | |
| | |
| | | |
| | | config.placeholder = placeholder |
| | | config.arr_field = arrfield.join(',') |
| | | } |
| | | |
| | | getCols = (cols, BData, time) => { |
| | | let _cols = [] |
| | | let weeks = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'] |
| | | |
| | | let excols = (col) => { |
| | | let _s = [] |
| | | let _marks = col.marks || [] |
| | | let names = [] |
| | | let fields = [] |
| | | |
| | | for (let i = 0; i < col.quota; i++) { |
| | | fields.push(col.field + (i === 0 ? '' : i)) |
| | | |
| | | if (col.colUnit === 'day') { |
| | | let hasweek = col.dayFormat.indexOf('week') > -1 |
| | | let format = col.dayFormat.replace(/\sweek/, '') |
| | | let day = moment().add(col.shift + i, 'days').format(format) |
| | | |
| | | if (hasweek) { |
| | | let _w = moment().add(col.shift + i, 'days').weekday() |
| | | day = day + ' ' + weeks[_w] |
| | | } |
| | | |
| | | names.push(day) |
| | | } else { |
| | | let format = col.hourFormat |
| | | if (format === 'H point') { |
| | | format = 'H点' |
| | | } |
| | | |
| | | let hour = moment(time).add(col.shift + i, 'hours').format(format) |
| | | |
| | | if (format === 'h:00') { |
| | | if (hour === '12:00') { |
| | | hour = hour + ' pm' |
| | | } else if (hour === moment(time).add(col.shift + i, 'hours').format('H:00')) { |
| | | hour = hour + ' am' |
| | | } else { |
| | | hour = hour + ' pm' |
| | | } |
| | | } |
| | | names.push(hour) |
| | | } |
| | | } |
| | | |
| | | if (col.supField) { |
| | | names = [] |
| | | if (BData && BData[col.supField]) { |
| | | names = BData[col.supField].split(',') |
| | | |
| | | if (names.length > fields.length) { |
| | | names.length = fields.length |
| | | } else if (fields.length > names.length) { |
| | | fields.length = names.length |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (names.length === 0) return _s |
| | | |
| | | _s = fields.map((f, i) => { |
| | | return { |
| | | type: 'text', |
| | | Align: col.Align, |
| | | Width: col.Width, |
| | | field: f, |
| | | label: names[i], |
| | | uuid: col.uuid + i, |
| | | marks: _marks.filter(mark => mark.field[0] === f || !fields.includes(mark.field[0])) |
| | | } |
| | | }) |
| | | |
| | | return _s |
| | | } |
| | | |
| | | cols.forEach(col => { |
| | | if (col.type === 'extend') { |
| | | let exs = excols(col) |
| | | _cols.push(...exs) |
| | | } else if (col.type === 'colspan') { |
| | | let subs = [] |
| | | col.subcols.forEach(subcol => { |
| | | if (subcol.type === 'extend') { |
| | | let exs = excols(subcol) |
| | | subs.push(...exs) |
| | | } else { |
| | | subs.push(col) |
| | | } |
| | | }) |
| | | |
| | | if (subs.length) { |
| | | _cols.push({...col, subcols: subs}) |
| | | } |
| | | } else { |
| | | _cols.push(col) |
| | | } |
| | | }) |
| | | |
| | | return _cols |
| | | } |
| | | |
| | | resetCols = (BData) => { |
| | | const { config, setting } = this.state |
| | | |
| | | MKEmitter.emit('transferData' + setting.tableId, [], 'clear') |
| | | |
| | | let columns = this.getCols(config.cols, BData, config.setting.extendTime) |
| | | |
| | | this.setState({ |
| | | columns: columns, |
| | | data: [], |
| | | selectedData: [], |
| | | total: 0 |
| | | }) |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | resetParentParam = (MenuID, id, data) => { |
| | | const { setting } = this.state |
| | | const { setting, config } = this.state |
| | | |
| | | if (!setting.supModule || setting.supModule !== MenuID) return |
| | | if (id !== this.state.BID || id !== '') { |
| | | if (config.parCtrl) { |
| | | this.resetCols(data) |
| | | } |
| | | |
| | | this.setState({ |
| | | pageIndex: 1, |
| | | BID: id, |
| | |
| | | submit={config.submit} |
| | | fields={config.columns} |
| | | total={this.state.total} |
| | | parCtrl={config.parCtrl} |
| | | colsCtrls={config.colsCtrls} |
| | | lineMarks={config.lineMarks} |
| | | loading={this.state.loading} |
| | |
| | | } |
| | | |
| | | render() { |
| | | let { col, config, record, style, className, ...resProps } = this.props |
| | | let { col, record, style, className, ...resProps } = this.props |
| | | const { editing } = this.state |
| | | |
| | | if (!col) return (<td {...resProps} className={className} style={style}/>) |
| | |
| | | if (col.editType === 'select' && col.options.length > 0) { |
| | | content = col.map.get(content) || content |
| | | } else if (col.editType === 'switch') { |
| | | if (content === config.openVal) { |
| | | content = config.openText |
| | | } else if (content === config.closeVal) { |
| | | content = config.closeText |
| | | if (content === col.openVal) { |
| | | content = col.openText |
| | | } else if (content === col.closeVal) { |
| | | content = col.closeText |
| | | } |
| | | } else if (col.editType === 'popSelect') { |
| | | if (col.showField) { |
| | |
| | | } |
| | | |
| | | children = ( |
| | | <CardCellComponent data={record} cards={config} elements={col.elements}/> |
| | | <CardCellComponent data={record} cards={col.config} elements={col.elements}/> |
| | | ) |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | render() { |
| | | let { col, config, record, style, className, ...resProps } = this.props |
| | | let { col, record, style, className, ...resProps } = this.props |
| | | |
| | | if (!col) return (<td {...resProps} className={className} style={style}/>) |
| | | |
| | |
| | | if (col.editType === 'select' && col.options.length > 0) { |
| | | content = col.map.get(content) || content |
| | | } else if (col.editType === 'switch') { |
| | | if (content === config.openVal) { |
| | | content = config.openText |
| | | } else if (content === config.closeVal) { |
| | | content = config.closeText |
| | | if (content === col.openVal) { |
| | | content = col.openText |
| | | } else if (content === col.closeVal) { |
| | | content = col.closeText |
| | | } |
| | | } else if (col.editType === 'popSelect') { |
| | | if (col.showField) { |
| | |
| | | } |
| | | |
| | | children = ( |
| | | <CardCellComponent data={record} cards={config} elements={col.elements}/> |
| | | <CardCellComponent data={record} cards={col.config} elements={col.elements}/> |
| | | ) |
| | | } |
| | | |
| | |
| | | let deForms = [] |
| | | let _forms = {} |
| | | let hasBid = false |
| | | let index = 0 |
| | | let checkForms = [] |
| | | let allForms = [] |
| | | |
| | |
| | | cell.children = getColumns(item.subcols, sk || item.uuid) |
| | | } else { |
| | | if (item.editable === 'true') { |
| | | item.$sort = index |
| | | index++ |
| | | _forms[item.field] = item |
| | | |
| | | allForms.push({uuid: sk || item.uuid, field: item.field}) |
| | | checkForms.push(item.field) |
| | | |
| | | if (item.ctrlField) { |
| | | item.ctrlValue = item.ctrlValue.split(',') |
| | | } |
| | | |
| | | if (item.type === 'number' && item.clearField) { |
| | | fields.forEach(cell => { |
| | | if (cell.field === item.clearField) { |
| | | item.clearName = cell.label |
| | | } |
| | | }) |
| | | } else if (item.type === 'text' && item.editType === 'select') { |
| | | item.map = new Map() |
| | | if (item.type === 'text' && item.editType === 'select') { |
| | | if (item.resourceType === '1') { |
| | | let _option = Utils.getSelectQueryOptions(item) |
| | | |
| | |
| | | item.arr_field = _option.field |
| | | |
| | | deForms.push(item) |
| | | } else { |
| | | item.options.forEach(cell => { |
| | | item.map.set(cell.value, cell.label) |
| | | }) |
| | | } |
| | | } else if (item.type === 'text' && item.editType === 'date') { |
| | | item.format = 'YYYY-MM-DD' |
| | | |
| | | if (item.precision === 'hour') { |
| | | item.format = 'YYYY-MM-DD HH' |
| | | } else if (item.precision === 'minute') { |
| | | item.format = 'YYYY-MM-DD HH:mm' |
| | | } else if (item.precision === 'second') { |
| | | item.format = 'YYYY-MM-DD HH:mm:ss' |
| | | } |
| | | } |
| | | } |
| | |
| | | $key: item.uuid, |
| | | onCell: record => ({ |
| | | record, |
| | | col: item, |
| | | config: item.type === 'custom' ? {setting, columns: fields} : null, |
| | | col: item |
| | | }) |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | | const { BID } = this.props |
| | | const { BID, parCtrl } = this.props |
| | | const { deForms } = this.state |
| | | |
| | | if (deForms && nextProps.BID !== BID) { |
| | | this.improveActionForm(deForms, nextProps.BID) |
| | | } |
| | | if (parCtrl && !is(fromJS(this.props.columns), fromJS(nextProps.columns))) { |
| | | let getColumns = (cols, sk) => { |
| | | return cols.map(item => { |
| | | let cell = null |
| | | |
| | | if (item.type === 'colspan') { |
| | | cell = { title: item.label, align: item.Align, $key: item.uuid } |
| | | cell.children = getColumns(item.subcols, sk || item.uuid) |
| | | } else { |
| | | cell = { |
| | | align: item.Align, |
| | | dataIndex: item.uuid, |
| | | title: item.editable === 'true' ? <span>{item.label}<EditOutlined className="system-color mk-edit-sign"/></span> : item.label, |
| | | sorter: (item.field || item.sortField) && item.IsSort === 'true', |
| | | width: item.Width || 120, |
| | | $key: item.uuid, |
| | | onCell: record => ({ |
| | | record, |
| | | col: item |
| | | }) |
| | | } |
| | | } |
| | | |
| | | return cell |
| | | }) |
| | | } |
| | | |
| | | let _columns = getColumns(nextProps.columns) |
| | | |
| | | this.setState({ |
| | | columns: _columns |
| | | }) |
| | | } |
| | | } |
| | | |
| | |
| | | transferData = (data, type) => { |
| | | const { edData, tableId } = this.state |
| | | |
| | | if (type === 'delete') { |
| | | if (type === 'clear') { |
| | | this.setState({edData: [], midData: []}) |
| | | return |
| | | } else if (type === 'delete') { |
| | | |
| | | } else if (type === 'line') { |
| | | let value = '' |
| | |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Collapse } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import UtilsDM from '@/utils/utils-datamanage.js' |
| | |
| | | _config.colsCtrls = null |
| | | } |
| | | |
| | | // if (_config.hasExtend) { |
| | | |
| | | // } |
| | | let columns = _config.cols |
| | | if (_config.hasExtend) { |
| | | columns = this.getCols(_config.cols, BData, _config.setting.extendTime) |
| | | } |
| | | |
| | | this.setState({ |
| | | pageSize: setting.pageSize || 10, |
| | |
| | | config: _config, |
| | | setting: setting, |
| | | actions: _config.action, |
| | | columns: _config.cols, |
| | | columns: columns, |
| | | search: _config.$searches, |
| | | allSearch |
| | | }) |
| | |
| | | window.GLOB.SyncData.delete(config.dataName) |
| | | |
| | | MKEmitter.removeListener('transferSyncData', this.transferSyncData) |
| | | } |
| | | |
| | | getCols = (cols, BData, time) => { |
| | | let _cols = [] |
| | | let weeks = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'] |
| | | |
| | | let excols = (col) => { |
| | | let _s = [] |
| | | let _marks = col.marks || [] |
| | | let names = [] |
| | | let fields = [] |
| | | |
| | | for (let i = 0; i < col.quota; i++) { |
| | | fields.push(col.field + (i === 0 ? '' : i)) |
| | | |
| | | if (col.colUnit === 'day') { |
| | | let hasweek = col.dayFormat.indexOf('week') > -1 |
| | | let format = col.dayFormat.replace(/\sweek/, '') |
| | | let day = moment().add(col.shift + i, 'days').format(format) |
| | | |
| | | if (hasweek) { |
| | | let _w = moment().add(col.shift + i, 'days').weekday() |
| | | day = day + ' ' + weeks[_w] |
| | | } |
| | | |
| | | names.push(day) |
| | | } else { |
| | | let format = col.hourFormat |
| | | if (format === 'H point') { |
| | | format = 'H点' |
| | | } |
| | | |
| | | let hour = moment(time).add(col.shift + i, 'hours').format(format) |
| | | |
| | | if (format === 'h:00') { |
| | | if (hour === '12:00') { |
| | | hour = hour + ' pm' |
| | | } else if (hour === moment(time).add(col.shift + i, 'hours').format('H:00')) { |
| | | hour = hour + ' am' |
| | | } else { |
| | | hour = hour + ' pm' |
| | | } |
| | | } |
| | | names.push(hour) |
| | | } |
| | | } |
| | | |
| | | if (col.supField) { |
| | | names = [] |
| | | if (BData && BData[col.supField]) { |
| | | names = BData[col.supField].split(',') |
| | | |
| | | if (names.length > fields.length) { |
| | | names.length = fields.length |
| | | } else if (fields.length > names.length) { |
| | | fields.length = names.length |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (names.length === 0) return _s |
| | | |
| | | _s = fields.map((f, i) => { |
| | | return { |
| | | type: 'text', |
| | | Align: col.Align, |
| | | Width: col.Width, |
| | | field: f, |
| | | label: names[i], |
| | | uuid: col.uuid + i, |
| | | marks: _marks.filter(mark => mark.field[0] === f || !fields.includes(mark.field[0])) |
| | | } |
| | | }) |
| | | |
| | | return _s |
| | | } |
| | | |
| | | cols.forEach(col => { |
| | | if (col.type === 'extend') { |
| | | let exs = excols(col) |
| | | _cols.push(...exs) |
| | | } else if (col.type === 'colspan') { |
| | | let subs = [] |
| | | col.subcols.forEach(subcol => { |
| | | if (subcol.type === 'extend') { |
| | | let exs = excols(subcol) |
| | | subs.push(...exs) |
| | | } else { |
| | | subs.push(col) |
| | | } |
| | | }) |
| | | |
| | | if (subs.length) { |
| | | _cols.push({...col, subcols: subs}) |
| | | } |
| | | } else { |
| | | _cols.push(col) |
| | | } |
| | | }) |
| | | |
| | | return _cols |
| | | } |
| | | |
| | | resetCols = (BData) => { |
| | | const { config } = this.state |
| | | |
| | | let columns = this.getCols(config.cols, BData, config.setting.extendTime) |
| | | |
| | | this.setState({ |
| | | columns: columns, |
| | | data: [], |
| | | selectedData: [], |
| | | total: 0 |
| | | }) |
| | | } |
| | | |
| | | /** |
| | |
| | | if (!setting.supModule || setting.supModule !== MenuID) return |
| | | |
| | | if (id !== this.state.BID || id !== '') { |
| | | if (config.parCtrl) { |
| | | this.resetCols(data) |
| | | } |
| | | this.setState({ |
| | | pageIndex: 1, |
| | | BID: id, |
| | |
| | | data={this.state.data} |
| | | fields={config.columns} |
| | | total={this.state.total} |
| | | parCtrl={config.parCtrl} |
| | | colsCtrls={config.colsCtrls} |
| | | lineMarks={config.lineMarks} |
| | | loading={this.state.loading} |
| | |
| | | col.type = 'custom' |
| | | } |
| | | |
| | | if (col.type === 'number') { |
| | | if (col.type === 'index') { |
| | | col.field = '$Index' |
| | | col.type = 'text' |
| | | } else if (col.type === 'number') { |
| | | if (typeof(col.decimal) === 'number') { |
| | | col.round = Math.pow(10, col.decimal) |
| | | if (col.format === 'percent') { |
| | |
| | | |
| | | if (item.hasExtend) { |
| | | item.setting.hasExtend = true |
| | | item.setting.tableMode = 'compatible' |
| | | item.setting.extendTime = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | item.colsCtrls = null |
| | | } |
| | |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { notification, Spin, Row, Col, Modal } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | |
| | | col.type = 'custom' |
| | | } |
| | | |
| | | if (col.type === 'number') { |
| | | if (col.type === 'index') { |
| | | col.field = '$Index' |
| | | col.type = 'text' |
| | | } else if (col.type === 'number') { |
| | | if (typeof(col.decimal) === 'number') { |
| | | col.round = Math.pow(10, col.decimal) |
| | | if (col.format === 'percent') { |
| | |
| | | |
| | | item.cols = getCols(item.cols) |
| | | |
| | | if (item.hasExtend) { |
| | | item.setting.hasExtend = true |
| | | item.setting.tableMode = 'compatible' |
| | | item.setting.extendTime = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | item.colsCtrls = null |
| | | } |
| | | |
| | | if (item.subtype === 'editable') { |
| | | item.submit.logLabel = item.$menuname + '-提交' |
| | | item.submit.$menuId = item.uuid |
| | |
| | | cols.push(col.field.toLowerCase()) |
| | | _columns.push(col) |
| | | |
| | | if (col.type === 'text' && col.field !== 'BID') { |
| | | if ((col.type === 'text' || col.type === 'textarea') && col.field !== 'BID') { |
| | | remarks.push(col) |
| | | } |
| | | }) |
| | |
| | | if (verify.flowType === 'reject') { |
| | | line = lines.filter(cell => cell.mkdata.flowType === 'reject' || cell.mknode === 'startEdge')[0] |
| | | } else { |
| | | let endEdge = null |
| | | lines = lines.filter(cell => { |
| | | if (cell.mknode === 'endEdge') { |
| | | endEdge = cell |
| | | return false |
| | | } |
| | | |
| | | return cell.mkdata.flowType !== 'reject' && cell.mknode !== 'startEdge' |
| | | }) |
| | | lines = lines.filter(cell => cell.mkdata.flowType !== 'reject' && cell.mknode !== 'startEdge') |
| | | |
| | | if (lines.length === 0) { |
| | | if (!endEdge) { |
| | | error = '无可执行的流程分支' |
| | | } else { |
| | | line = endEdge |
| | | } |
| | | error = '无可执行的流程分支' |
| | | } else { |
| | | let branchKey = verify.flowBranch ? verify.flowBranch.toLowerCase() : '' |
| | | |
| | |
| | | let _key = form.key.toLowerCase() |
| | | _data[_key] = form.value |
| | | }) |
| | | |
| | | |
| | | if (!branchKey) { |
| | | lines.forEach(line => { |
| | | if (line.mkdata.execCondition === 'open') { |
| | |
| | | } else if (!_data.hasOwnProperty(branchKey)) { |
| | | error = '信息中无流程控制字段。' |
| | | } else { |
| | | if (endEdge) { |
| | | line = endEdge |
| | | } |
| | | |
| | | let equalLine = null |
| | | let gtOrLtLine = [] |
| | | let unEqualLine = null |
| | |
| | | updateLogConfig = (config) => { |
| | | config.fstMenuId = this.state.config.fstMenuId || config.fstMenuId || '' |
| | | config.parentId = this.state.config.parentId || config.parentId || '' |
| | | config.open_edition = this.state.config.open_edition || '' |
| | | |
| | | this.setState({ |
| | | config: null |
| | |
| | | } |
| | | |
| | | updateLogConfig = (config) => { |
| | | config.open_edition = this.state.config.open_edition || '' |
| | | |
| | | this.setState({ |
| | | config: null |
| | | }, () => { |
| | |
| | | } |
| | | |
| | | updateLogConfig = (config) => { |
| | | config.open_edition = this.state.config.open_edition || '' |
| | | |
| | | this.setState({ |
| | | config: null |
| | | }, () => { |
| | |
| | | updateLogConfig = (config) => { |
| | | config.fstMenuId = this.state.config.fstMenuId || config.fstMenuId || '' |
| | | config.parentId = this.state.config.parentId || config.parentId || '' |
| | | config.open_edition = this.state.config.open_edition || '' |
| | | |
| | | this.setState({ |
| | | config: null |