From d08fba77101b83f211738c722403506cc7dab50b Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 08 五月 2024 22:41:50 +0800 Subject: [PATCH] 2024-05-08 --- src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx | 8 src/views/pcdesign/index.jsx | 2 src/tabviews/custom/components/table/normal-table/index.jsx | 128 +++++++++++ src/tabviews/custom/components/table/edit-table/normalTable/index.jsx | 97 ++++---- src/tabviews/custom/popview/index.jsx | 13 + src/tabviews/custom/components/table/edit-table/index.jsx | 172 ++++++++++++++ src/views/tabledesign/index.jsx | 1 src/tabviews/basetable/index.jsx | 5 src/tabviews/custom/components/module/invoice/index.jsx | 1 src/tabviews/custom/index.jsx | 6 src/tabviews/custom/components/share/normalTable/index.jsx | 40 +++ src/templates/zshare/verifycard/baseform/index.jsx | 2 src/menu/components/table/normal-table/index.jsx | 4 src/menu/components/table/edit-table/columns/editColumn/index.jsx | 7 src/menu/components/table/normal-table/columns/index.jsx | 2 src/views/mobdesign/index.jsx | 2 src/menu/components/table/edit-table/index.jsx | 12 + src/views/menudesign/index.jsx | 1 src/utils/utils.js | 22 - src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx | 92 ++++++++ src/menu/components/table/edit-table/columns/index.jsx | 2 21 files changed, 528 insertions(+), 91 deletions(-) diff --git a/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx b/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx index c34c943..05f72dd 100644 --- a/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx +++ b/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx @@ -37,6 +37,9 @@ value: 'colspan', text: '鍚堝苟鍒�' }, { + value: 'extend', + text: '鎵╁睍鍒�' + }, { value: 'index', text: '搴忓彿' }] @@ -210,6 +213,95 @@ }, { 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鏈圖D鏃�', + label: 'M鏈圖D鏃ワ紙4鏈�29鏃ワ級' + }, { + value: 'M/DD week', + label: 'M/DD week锛�4/29 鏄熸湡涓�锛�' + }, { + value: 'M-DD week', + label: 'M-DD week锛�4-29 鏄熸湡涓�锛�' + }, { + value: 'M鏈圖D鏃� week', + label: 'M鏈圖D鏃� 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', diff --git a/src/menu/components/table/edit-table/columns/editColumn/index.jsx b/src/menu/components/table/edit-table/columns/editColumn/index.jsx index fd16488..c531a1f 100644 --- a/src/menu/components/table/edit-table/columns/editColumn/index.jsx +++ b/src/menu/components/table/edit-table/columns/editColumn/index.jsx @@ -23,6 +23,7 @@ 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'] @@ -93,6 +94,12 @@ } 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') diff --git a/src/menu/components/table/edit-table/columns/index.jsx b/src/menu/components/table/edit-table/columns/index.jsx index 0956ffd..b410cc8 100644 --- a/src/menu/components/table/edit-table/columns/index.jsx +++ b/src/menu/components/table/edit-table/columns/index.jsx @@ -109,7 +109,7 @@ {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} diff --git a/src/menu/components/table/edit-table/index.jsx b/src/menu/components/table/edit-table/index.jsx index b4e2f7f..b6bfbee 100644 --- a/src/menu/components/table/edit-table/index.jsx +++ b/src/menu/components/table/edit-table/index.jsx @@ -296,12 +296,19 @@ 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) @@ -316,6 +323,11 @@ 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') { diff --git a/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx b/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx index 49c4c7f..bf962a6 100644 --- a/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx +++ b/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx @@ -68,6 +68,10 @@ text: '搴忓彿' }] + if (appType === 'mob') { + options = options.filter(item => item.value !== 'extend') + } + if (!card.linkurl && (!card.linkmenu || card.linkmenu.length === 0)) { card.perspective = '' } @@ -284,8 +288,8 @@ tooltip: '鏉ユ簮浜庝笂绾х粍浠剁殑瀛楁闆嗭紙涓婄骇缁勪欢涓虹┖鏃朵粠url鍙傛暟涓�夊彇锛夛紝璇ュ瓧娈靛�硷紙鐢ㄩ�楀彿鍒嗛殧锛夊彲鎺у埗鎵╁睍鍒楃殑鍒楀悕銆�', required: false, rules: [{ - pattern: /^[\u4E00-\u9FA50-9a-zA-Z_]*$/ig, - message: '瀛楁鍚嶅彧鍏佽鍖呭惈鏁板瓧銆佸瓧姣嶃�佹眽瀛椾互鍙奯' + pattern: /^[0-9a-zA-Z_]*$/ig, + message: '瀛楁鍚嶅彧鍏佽鍖呭惈鏁板瓧銆佸瓧姣嶄互鍙奯' }] }, { diff --git a/src/menu/components/table/normal-table/columns/index.jsx b/src/menu/components/table/normal-table/columns/index.jsx index a7a32e9..0279ed8 100644 --- a/src/menu/components/table/normal-table/columns/index.jsx +++ b/src/menu/components/table/normal-table/columns/index.jsx @@ -109,7 +109,7 @@ {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} diff --git a/src/menu/components/table/normal-table/index.jsx b/src/menu/components/table/normal-table/index.jsx index a7ce910..d53420d 100644 --- a/src/menu/components/table/normal-table/index.jsx +++ b/src/menu/components/table/normal-table/index.jsx @@ -331,6 +331,7 @@ updatecolumn = (config) => { config.absFields = [] config.hasExtend = false + config.parCtrl = false let mapCol = (cols) => { cols.forEach(col => { if (col.type === 'number') { @@ -339,6 +340,9 @@ } } else if (col.type === 'extend') { config.hasExtend = true + if (col.supField) { + config.parCtrl = true + } } else if (col.type === 'colspan' && col.subcols) { mapCol(col.subcols) } diff --git a/src/tabviews/basetable/index.jsx b/src/tabviews/basetable/index.jsx index 2382461..c6204fb 100644 --- a/src/tabviews/basetable/index.jsx +++ b/src/tabviews/basetable/index.jsx @@ -367,7 +367,10 @@ 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) } diff --git a/src/tabviews/custom/components/module/invoice/index.jsx b/src/tabviews/custom/components/module/invoice/index.jsx index a6c61d6..022d1d3 100644 --- a/src/tabviews/custom/components/module/invoice/index.jsx +++ b/src/tabviews/custom/components/module/invoice/index.jsx @@ -1015,6 +1015,7 @@ }) return } + // window.open('https://kgcs.kuan-gu.com:10853/thirdPlatFormLogin?userName=admin&taxCode=91120222MA07GMNW97&taxName=澶╂触鐣呬韩鏁板瓧绉戞妧鏈夐檺鍏徃') this.clearData() diff --git a/src/tabviews/custom/components/share/normalTable/index.jsx b/src/tabviews/custom/components/share/normalTable/index.jsx index 04f091d..f2f8eb5 100644 --- a/src/tabviews/custom/components/share/normalTable/index.jsx +++ b/src/tabviews/custom/components/share/normalTable/index.jsx @@ -507,7 +507,8 @@ chgSelectData: PropTypes.func, // 鏁版嵁鍒囨崲 autoMatic: PropTypes.any, allSearch: PropTypes.any, - colsCtrls: PropTypes.any + colsCtrls: PropTypes.any, + parCtrl: PropTypes.any } state = { @@ -556,10 +557,7 @@ 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 } @@ -655,7 +653,7 @@ } UNSAFE_componentWillReceiveProps(nextProps) { - const { allSearch } = this.props + const { allSearch, parCtrl } = this.props const { allColumns } = this.state if (allSearch && !is(fromJS(allSearch), fromJS(nextProps.allSearch))) { @@ -665,6 +663,36 @@ }, () => { 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) + }) } } diff --git a/src/tabviews/custom/components/table/edit-table/index.jsx b/src/tabviews/custom/components/table/edit-table/index.jsx index 1987005..116551f 100644 --- a/src/tabviews/custom/components/table/edit-table/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/index.jsx @@ -1,6 +1,7 @@ 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' @@ -74,7 +75,6 @@ } }) - let _columns = [] let initId = '' setting.hasSubmit = false @@ -82,6 +82,7 @@ setting.commit = 'change' } + let index = 0 let getColumns = (cols) => { return cols.filter(item => { if (item.Hide === 'true') return false @@ -95,6 +96,8 @@ 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') { @@ -107,15 +110,16 @@ } }) } 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 } @@ -130,8 +134,26 @@ } 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 @@ -139,6 +161,12 @@ 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 => { @@ -157,7 +185,12 @@ }) } - _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 @@ -256,6 +289,122 @@ 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 + }) } /** @@ -555,10 +704,14 @@ } 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, @@ -695,6 +848,7 @@ submit={config.submit} fields={config.columns} total={this.state.total} + parCtrl={config.parCtrl} colsCtrls={config.colsCtrls} lineMarks={config.lineMarks} loading={this.state.loading} diff --git a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx index 6909089..5763bcc 100644 --- a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx @@ -727,7 +727,7 @@ } 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}/>) @@ -747,10 +747,10 @@ 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) { @@ -1010,7 +1010,7 @@ } children = ( - <CardCellComponent data={record} cards={config} elements={col.elements}/> + <CardCellComponent data={record} cards={col.config} elements={col.elements}/> ) } @@ -1041,7 +1041,7 @@ } 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}/>) @@ -1092,10 +1092,10 @@ 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) { @@ -1324,7 +1324,7 @@ } children = ( - <CardCellComponent data={record} cards={config} elements={col.elements}/> + <CardCellComponent data={record} cards={col.config} elements={col.elements}/> ) } @@ -1385,7 +1385,6 @@ let deForms = [] let _forms = {} let hasBid = false - let index = 0 let checkForms = [] let allForms = [] @@ -1398,25 +1397,12 @@ 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) @@ -1428,20 +1414,6 @@ 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' } } } @@ -1461,8 +1433,7 @@ $key: item.uuid, onCell: record => ({ record, - col: item, - config: item.type === 'custom' ? {setting, columns: fields} : null, + col: item }) } } @@ -1539,11 +1510,44 @@ } 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 + }) } } @@ -1750,7 +1754,10 @@ 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 = '' diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx index 88851eb..323e0eb 100644 --- a/src/tabviews/custom/components/table/normal-table/index.jsx +++ b/src/tabviews/custom/components/table/normal-table/index.jsx @@ -2,6 +2,7 @@ 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' @@ -152,9 +153,10 @@ _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, @@ -165,7 +167,7 @@ config: _config, setting: setting, actions: _config.action, - columns: _config.cols, + columns: columns, search: _config.$searches, allSearch }) @@ -381,6 +383,120 @@ 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 + }) } /** @@ -784,6 +900,9 @@ 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, @@ -908,6 +1027,7 @@ data={this.state.data} fields={config.columns} total={this.state.total} + parCtrl={config.parCtrl} colsCtrls={config.colsCtrls} lineMarks={config.lineMarks} loading={this.state.loading} diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index be36ae9..8e44c3f 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -633,7 +633,10 @@ 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') { @@ -691,6 +694,7 @@ 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 } diff --git a/src/tabviews/custom/popview/index.jsx b/src/tabviews/custom/popview/index.jsx index 935f765..f813ecc 100644 --- a/src/tabviews/custom/popview/index.jsx +++ b/src/tabviews/custom/popview/index.jsx @@ -2,6 +2,7 @@ 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' @@ -361,7 +362,10 @@ 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') { @@ -412,6 +416,13 @@ 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 diff --git a/src/templates/zshare/verifycard/baseform/index.jsx b/src/templates/zshare/verifycard/baseform/index.jsx index ea5f30e..8a0e086 100644 --- a/src/templates/zshare/verifycard/baseform/index.jsx +++ b/src/templates/zshare/verifycard/baseform/index.jsx @@ -315,7 +315,7 @@ 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) } }) diff --git a/src/utils/utils.js b/src/utils/utils.js index bbee372..c69f18b 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -2174,22 +2174,10 @@ 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() : '' @@ -2197,7 +2185,7 @@ let _key = form.key.toLowerCase() _data[_key] = form.value }) - + if (!branchKey) { lines.forEach(line => { if (line.mkdata.execCondition === 'open') { @@ -2210,10 +2198,6 @@ } else if (!_data.hasOwnProperty(branchKey)) { error = '淇℃伅涓棤娴佺▼鎺у埗瀛楁銆�' } else { - if (endEdge) { - line = endEdge - } - let equalLine = null let gtOrLtLine = [] let unEqualLine = null diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx index 3f94889..400e163 100644 --- a/src/views/menudesign/index.jsx +++ b/src/views/menudesign/index.jsx @@ -1160,6 +1160,7 @@ 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 diff --git a/src/views/mobdesign/index.jsx b/src/views/mobdesign/index.jsx index d6e5f24..b713e00 100644 --- a/src/views/mobdesign/index.jsx +++ b/src/views/mobdesign/index.jsx @@ -2030,6 +2030,8 @@ } updateLogConfig = (config) => { + config.open_edition = this.state.config.open_edition || '' + this.setState({ config: null }, () => { diff --git a/src/views/pcdesign/index.jsx b/src/views/pcdesign/index.jsx index 8206e33..63ef5fb 100644 --- a/src/views/pcdesign/index.jsx +++ b/src/views/pcdesign/index.jsx @@ -1679,6 +1679,8 @@ } updateLogConfig = (config) => { + config.open_edition = this.state.config.open_edition || '' + this.setState({ config: null }, () => { diff --git a/src/views/tabledesign/index.jsx b/src/views/tabledesign/index.jsx index ce28473..3880a3d 100644 --- a/src/views/tabledesign/index.jsx +++ b/src/views/tabledesign/index.jsx @@ -827,6 +827,7 @@ 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 -- Gitblit v1.8.0