From 37e28da53f6d4d7d8abe7626ba28ba7dbe16e7bb Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 08 四月 2024 15:36:01 +0800 Subject: [PATCH] 2024-04-08 --- src/templates/zshare/modalform/index.jsx | 7 src/templates/modalconfig/settingform/index.jsx | 2 src/templates/zshare/formconfig.jsx | 2 src/menu/components/share/actioncomponent/formconfig.jsx | 2 src/tabviews/custom/components/card/double-data-card/index.jsx | 13 - src/templates/sharecomponent/actioncomponent/verifyexcelout/otherform/index.jsx | 114 +++++++++++ src/mob/components/topbar/normal-navbar/options.jsx | 2 src/tabviews/zshare/actionList/exceloutbutton/index.jsx | 193 +++++++++++++------ src/tabviews/zshare/mutilform/index.jsx | 2 src/templates/sharecomponent/actioncomponent/verifyexcelout/datasource/index.jsx | 4 src/templates/sharecomponent/actioncomponent/verifyexcelout/otherform/index.scss | 0 src/templates/sharecomponent/actioncomponent/verifyexcelout/index.scss | 9 src/menu/components/group/normal-group/index.scss | 2 src/tabviews/custom/components/card/data-card/index.jsx | 10 src/tabviews/zshare/mutilform/mkDatePicker/index.jsx | 13 + src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx | 191 ++++++++++++------ 16 files changed, 413 insertions(+), 153 deletions(-) diff --git a/src/menu/components/group/normal-group/index.scss b/src/menu/components/group/normal-group/index.scss index f616fad..8d1307c 100644 --- a/src/menu/components/group/normal-group/index.scss +++ b/src/menu/components/group/normal-group/index.scss @@ -1,7 +1,7 @@ .menu-group-edit-box { position: relative; box-sizing: border-box; - background: #ffffff; + // background: #ffffff; background-position: center center; background-repeat: no-repeat; background-size: cover; diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx index 342dc62..469ee34 100644 --- a/src/menu/components/share/actioncomponent/formconfig.jsx +++ b/src/menu/components/share/actioncomponent/formconfig.jsx @@ -514,7 +514,7 @@ key: 'prefix', label: '鍓嶇紑', initVal: card.prefix || '', - tooltip: '鎵爜淇℃伅灏嗕笌鍓嶇紑鎷兼帴鍚庢墽琛屻�傛敞锛氳烦杞彍鍗曢渶浠kbid寮�澶淬��', + tooltip: '鎵爜淇℃伅灏嗕笌鍓嶇紑鎷兼帴鍚庢墽琛屻�傛敞锛氳烦杞彍鍗曢渶浠kbid锛�:鎴�,锛夊紑澶达紝mkbid锛�:鎴�,锛夎烦杞悗灏嗚鍘婚櫎銆備緥濡傦細mkbid:123456 璺宠浆鍚庨〉闈ID涓� 123456銆�', required: false }, { diff --git a/src/mob/components/topbar/normal-navbar/options.jsx b/src/mob/components/topbar/normal-navbar/options.jsx index 33f0c7d..43cc169 100644 --- a/src/mob/components/topbar/normal-navbar/options.jsx +++ b/src/mob/components/topbar/normal-navbar/options.jsx @@ -184,7 +184,7 @@ field: 'prefix', label: '鍓嶇紑', initval: wrap.prefix || '', - tooltip: '鎵爜淇℃伅灏嗕笌鍓嶇紑鎷兼帴鍚庢墽琛屻�傛敞锛氳烦杞彍鍗曢渶浠kbid寮�澶淬��', + tooltip: '鎵爜淇℃伅灏嗕笌鍓嶇紑鎷兼帴鍚庢墽琛屻�傛敞锛氳烦杞彍鍗曢渶浠kbid锛�:鎴�,锛夊紑澶达紝mkbid锛�:鎴�,锛夎烦杞悗灏嗚鍘婚櫎銆備緥濡傦細mkbid:123456 璺宠浆鍚庨〉闈ID涓� 123456銆�', required: false }, { diff --git a/src/tabviews/custom/components/card/data-card/index.jsx b/src/tabviews/custom/components/card/data-card/index.jsx index d6e2c0f..e4ad7be 100644 --- a/src/tabviews/custom/components/card/data-card/index.jsx +++ b/src/tabviews/custom/components/card/data-card/index.jsx @@ -755,13 +755,9 @@ loading: false }) - if (selected !== 'false' || (id && config.wrap.selected !== 'false')) { - this.prevCheck(id) - } else { - MKEmitter.emit('resetSelectLine', config.uuid, '', '') - if (config.setting.$hasSyncModule) { - MKEmitter.emit('syncBalconyData', config.uuid, [], false) - } + MKEmitter.emit('resetSelectLine', config.uuid, '', '') + if (config.setting.$hasSyncModule) { + MKEmitter.emit('syncBalconyData', config.uuid, [], false) } return } diff --git a/src/tabviews/custom/components/card/double-data-card/index.jsx b/src/tabviews/custom/components/card/double-data-card/index.jsx index e4fef85..bc0cd42 100644 --- a/src/tabviews/custom/components/card/double-data-card/index.jsx +++ b/src/tabviews/custom/components/card/double-data-card/index.jsx @@ -595,17 +595,8 @@ total: 0, loading: false }) - - if (selected !== 'false' || (id && config.wrap.selected !== 'false')) { - setTimeout(() => { - this.checkTopLine(id) - }, 10) - if (selected === 'init') { - this.setState({selected: 'false'}) - } - } else { - MKEmitter.emit('resetSelectLine', config.uuid, '', '') - } + + MKEmitter.emit('resetSelectLine', config.uuid, '', '') return } diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx index 3a33cdd..9899496 100644 --- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx +++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx @@ -449,23 +449,70 @@ /** * @description Excel 鐢熸垚 */ - exportExcel = (data, ErrCode, msg, search) => { + exportExcel = (data = [], ErrCode, msg, search) => { const { btn } = this.props let imgCol = false - let columns = btn.verify.columns.map(col => { + let merge = false + let styles = [] + let letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + + let columns = btn.verify.columns.map((col, index) => { if (col.type === 'image') { imgCol = true } + if (btn.verify.merge === 'true' && /.+-.+/.test(col.Text)) { + merge = true + } - if (col.type === 'number' && (col.decimal || col.decimal === 0) ) { - col.round = Math.pow(10, col.decimal) + let i = Math.floor(index / 26) + let s = letters[i - 1] || '' + col.name = s + letters[index % 26] + + if (col.type === 'number') { + if (col.decimal || col.decimal === 0) { + col.round = Math.pow(10, col.decimal) + + if (col.format) { + let dec = Array(col.decimal).fill(0).join('') + dec = dec ? '.' + dec : '' + if (col.format === 'thdSeparator') { + col.z = '#,##0' + dec + } else if (col.format === 'thdSepPm') { + col.z = '#,##0' + dec + ';' + col.z = col.z + '[Red]-' + col.z + } else if (col.format === 'percent') { + let _dec = '' + if (col.decimal > 2) { + Array(col.decimal - 2).fill(0).join('') + _dec = _dec ? '.' + _dec : '' + } + + col.z = '0' + _dec + '%' + } + } + } + } else if (col.type === 'text') { + if (col.wrapText === 'true') { + col.s = {alignment: { wrapText: true }} + } + if (col.textFormat) { + if (col.textFormat === 'YYYY-MM-DD') { + col.z = 'yyyy-mm-dd;@' + } else if (col.textFormat === 'YYYY-MM-DD HH:mm:ss') { + col.z = 'yyyy-mm-dd hh:mm:ss' + } + } + } + + if (col.z || col.s) { + styles.push(col) } return col }) - if (data && data[0]) { + if (data[0]) { let errors = [] columns.forEach(col => { if (col.output === 'false') return @@ -514,7 +561,7 @@ let table = [] - data && data.forEach((item, index) => { + data.forEach((item, index) => { let _row = {} item.$Index = index + 1 + '' @@ -522,20 +569,38 @@ columns.forEach((col, i) => { let val = item[col.Column] if (col.output === 'false') { - if (col.type === 'number') { + if (col.type === 'number' && col.noValue !== 'false') { val = 0 } else { val = '' } - } else if (col.type === 'number' && typeof(val) === 'number') { - if (col.abs === 'true') { - val = Math.abs(val) + } else if (col.type === 'number') { + if (val && typeof(val) === 'string' && !isNaN(val)) { + val = +val } - if (col.round) { - val = Math.round(val * col.round) / col.round - // val = val.toFixed(col.decimal) + if (typeof(val) === 'number') { + if (col.abs === 'true') { + val = Math.abs(val) + } + if (col.round) { + val = Math.round(val * col.round) / col.round + } + if (col.noValue === 'false' && val === 0) { + val = '' + } } - if (col.noValue === 'false' && val === 0) { + } else if (col.type === 'text') { + val = val + '' + + if (col.textFormat) { + if (col.textFormat === 'YYYY-MM-DD' && /^[1-9]\d{3}(-|\/)(0[1-9]|1[0-2])(-|\/)(0[1-9]|[1-2][0-9]|3[0-1])/.test(val)) { + val = `${val.substr(0, 4)}-${val.substr(5, 2)}-${val.substr(8, 2)}` + } else if (col.textFormat === 'YYYY-MM-DD HH:mm:ss' && /^[1-9]\d{3}(-|\/)(0[1-9]|1[0-2])(-|\/)(0[1-9]|[1-2][0-9]|3[0-1]).([0-1][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]/.test(val)) { + val = `${val.substr(0, 4)}-${val.substr(5, 2)}-${val.substr(8, 2)} ${val.substr(11, 2)}:${val.substr(14, 2)}:${val.substr(17, 2)}` + } + } + + if (col.noValue === 'false' && val < '1949-10-02') { val = '' } } @@ -550,16 +615,6 @@ this.execSuccess({ErrCode: ErrCode || 'S', message: msg || '瀵煎嚭鎴愬姛锛�'}) } else { - let letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' - let cols = [] - - for (let index = 0; index < columns.length; index++) { - let i = Math.floor(index / 26) - let s = letters[i - 1] || '' - - cols.push(s + letters[index % 26]) - } - let table = [] let _header = [] let _topRow = {} @@ -567,16 +622,16 @@ let requires = [] let merges = [] - columns.forEach((col, i) => { + columns.forEach(col => { _header.push(col.Column) _topRow[col.Column] = col.Text colwidth.push({wch: col.Width || 20}) if (col.required === 'true') { - requires.push(i) + requires.push(col.name) } }) - if (btn.verify.merge === 'true') { + if (merge) { let fLine = {} let sLine = {} let sign = '' @@ -588,16 +643,16 @@ sLine[col.Column] = _name if (sign === _sign) { - merges[merges.length - 1] = merges[merges.length - 1].split(':')[0] + `:${cols[i]}1` + merges[merges.length - 1] = merges[merges.length - 1].split(':')[0] + `:${col.name}1` } else { - merges.push(`${cols[i]}1:${cols[i]}2`) + merges.push(`${col.name}1:${col.name}2`) sign = _sign } } else { fLine[col.Column] = col.Text sLine[col.Column] = col.Text sign = '' - merges.push(`${cols[i]}1:${cols[i]}2`) + merges.push(`${col.name}1:${col.name}2`) } }) @@ -607,7 +662,7 @@ table.push(_topRow) } - data && data.forEach((item, index) => { + data.forEach((item, index) => { let _row = {} item.$Index = index + 1 + '' @@ -616,20 +671,38 @@ let val = item[col.Column] if (col.output === 'false') { - if (col.type === 'number') { + if (col.type === 'number' && col.noValue !== 'false') { val = 0 } else { val = '' } - } else if (col.type === 'number' && typeof(val) === 'number') { - if (col.abs === 'true') { - val = Math.abs(val) + } else if (col.type === 'number') { + if (val && typeof(val) === 'string' && !isNaN(val)) { + val = +val } - if (col.round) { - val = Math.round(val * col.round) / col.round - // val = val.toFixed(col.decimal) + if (typeof(val) === 'number') { + if (col.abs === 'true') { + val = Math.abs(val) + } + if (col.round) { + val = Math.round(val * col.round) / col.round + } + if (col.noValue === 'false' && val === 0) { + val = '' + } } - if (col.noValue === 'false' && val === 0) { + } else if (col.type === 'text') { + val = val + '' + + if (col.textFormat) { + if (col.textFormat === 'YYYY-MM-DD' && /^[1-9]\d{3}(-|\/)(0[1-9]|1[0-2])(-|\/)(0[1-9]|[1-2][0-9]|3[0-1])/.test(val)) { + val = `${val.substr(0, 4)}-${val.substr(5, 2)}-${val.substr(8, 2)}` + } else if (col.textFormat === 'YYYY-MM-DD HH:mm:ss' && /^[1-9]\d{3}(-|\/)(0[1-9]|1[0-2])(-|\/)(0[1-9]|[1-2][0-9]|3[0-1]).([0-1][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]/.test(val)) { + val = `${val.substr(0, 4)}-${val.substr(5, 2)}-${val.substr(8, 2)} ${val.substr(11, 2)}:${val.substr(14, 2)}:${val.substr(17, 2)}` + } + } + + if (col.noValue === 'false' && val < '1949-10-02') { val = '' } } @@ -650,47 +723,41 @@ if (requires.length) { requires.forEach(col => { - if (cols[col]) { - ws[cols[col] + '1'].s = {font: { color: { rgb: 'F5222D' } }} - } + ws[col + '1'].s = {font: { color: { rgb: 'F5222D' } }} }) } - if (merges.length) { + if (merge) { ws['!merges'] = [] merges.forEach(item => { ws['!merges'].push(XLSX.utils.decode_range(item)) }) - cols.forEach(col => { - if (ws[col + '1'].s) { - ws[col + '1'].s = {font: { color: { rgb: 'F5222D' } }, alignment: { horizontal: 'center', vertical: 'center' }} - } else { - ws[col + '1'].s = {alignment: { horizontal: 'center', vertical: 'center' }} - } - ws[col + '2'].s = {alignment: { horizontal: 'center', vertical: 'center' }} + columns.forEach(col => { + ws[col.name + '1'].s = ws[col.name + '1'].s || {} + ws[col.name + '1'].s.alignment = { horizontal: 'center', vertical: 'center' } + + ws[col.name + '2'].s = {alignment: { horizontal: 'center', vertical: 'center' }} }) } + // ws['A3'].s = {font: { sz: 10 , bold: true }, alignment: { horizontal: 'center', vertical: 'center' }, border: {top: {style: 'thin', color: '000000'}, left: {style: 'thin', color: '000000'}, bottom: {style: 'thin', color: '000000'}, right: {style: 'thin', color: '000000'}}}; // ws['A3'].z = '#,##0.00'; // ws['A3'].z = '#,##0.00;[Red]-#,##0.00;'; + // ws["A1"].s = {fill: { bgColor: { rgb: "FFFFAA" }}, font: { color: { rgb: "1890FF" } }} - if (btn.verify.wrapText === 'true' && data) { - let lines = data.length + 1 - let start = 2 - if (btn.verify.merge === 'true') { - lines = data.length + 2 - } - for (let n = 0; n < cols.length; n++) { - for (let m = start; m <= lines; m++) { - if (ws[cols[n] + m] && !ws[cols[n] + m].s) { - ws[cols[n] + m].s = {alignment: { wrapText: true }} + if (data.length && styles.length) { + for (let n = table.length - data.length + 1; n <= table.length; n++) { + styles.forEach(col => { + if (col.z) { + ws[col.name + n].z = col.z } - } + if (col.s) { + ws[col.name + n].s = col.s + } + }) } } - - // ws["A1"].s = {fill: { bgColor: { rgb: "FFFFAA" }}, font: { color: { rgb: "1890FF" } }} const wb = XLSX.utils.book_new() XLSX.utils.book_append_sheet(wb, ws, btn.verify.sheet || 'Sheet1') diff --git a/src/tabviews/zshare/mutilform/index.jsx b/src/tabviews/zshare/mutilform/index.jsx index 4773693..53ae1d3 100644 --- a/src/tabviews/zshare/mutilform/index.jsx +++ b/src/tabviews/zshare/mutilform/index.jsx @@ -1280,7 +1280,7 @@ } else if (item.type === 'radio') { content = (<MKRadio config={item} onChange={(val, other) => this.recordChange({[item.field]: val, ...other}, item)}/>) } else if (item.type === 'date' || item.type === 'datemonth') { - content = (<MKDatePicker config={item} onChange={(val) => this.recordChange({[item.field]: val})} />) + content = (<MKDatePicker config={item} onChange={(val) => this.recordChange({[item.field]: val})} onSubmit={this.props.inputSubmit}/>) } else if (item.type === 'fileupload') { className = item.readonly ? 'readonly' : '' className += item.fileType === 'picture-card' ? ' file-upload' : '' diff --git a/src/tabviews/zshare/mutilform/mkDatePicker/index.jsx b/src/tabviews/zshare/mutilform/mkDatePicker/index.jsx index 0fe72ab..48ababe 100644 --- a/src/tabviews/zshare/mutilform/mkDatePicker/index.jsx +++ b/src/tabviews/zshare/mutilform/mkDatePicker/index.jsx @@ -3,6 +3,8 @@ import { DatePicker } from 'antd' import moment from 'moment' +import MKEmitter from '@/utils/events.js' + const { MonthPicker } = DatePicker /** @@ -68,6 +70,17 @@ } this.props.onChange(_val) + + if (!config.enter || config.enter === 'false') return + + setTimeout(() => { + if (config.enter === 'tab') { + MKEmitter.emit('mkFC', 'focus', config.tabUuid) + } else if (config.enter === 'sub') { + config.tabUuid && MKEmitter.emit('mkFC', 'focus', config.tabUuid) + this.props.onSubmit(config.tabUuid) + } + }, 50) } disabledDate = (current) => { diff --git a/src/templates/modalconfig/settingform/index.jsx b/src/templates/modalconfig/settingform/index.jsx index 4ac0090..febd8d8 100644 --- a/src/templates/modalconfig/settingform/index.jsx +++ b/src/templates/modalconfig/settingform/index.jsx @@ -347,7 +347,7 @@ )} </Form.Item> </Col> : null} - {display === 'drawer' && appType !== 'mob' ? <Col span={12}> + {appType !== 'mob' ? <Col span={12}> <Form.Item label="琛ㄥ崟绫诲瀷"> {getFieldDecorator('formType', { initialValue: config.setting.formType || 'edit' diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/datasource/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/datasource/index.jsx index 1e04573..f8240c3 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/datasource/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/datasource/index.jsx @@ -286,7 +286,7 @@ </Radio.Group>)} </Form.Item> </Col> : null} - {btnType !== 'print' && excelHandle !== 'true' ? <Col span={8}> + {/* {btnType !== 'print' && excelHandle !== 'true' ? <Col span={8}> <Form.Item label={ <Tooltip placement="topLeft" title="Excel鍐呭鍖烘槸鍚﹁嚜鍔ㄦ崲琛屻��"> <QuestionCircleOutlined className="mk-form-tip" /> @@ -301,7 +301,7 @@ <Radio value="true">鏄�</Radio> </Radio.Group>)} </Form.Item> - </Col> : null} + </Col> : null} */} </Row> </Form> </div> diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx index 7362e15..b754c1e 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx @@ -9,6 +9,7 @@ import Utils from '@/utils/utils.js' import SettingUtils from './utils.jsx' import ColumnForm from './columnform' +import OtherForm from './otherform' import DataSource from './datasource' import CustomScript from './customscript' import asyncComponent from '@/utils/asyncComponent' @@ -30,6 +31,8 @@ verify: {}, debugId: '', activeKey: 'setting', + visible: false, + line: null, searchKey: '', excelColumns: [ { @@ -68,7 +71,7 @@ editable: true, required: false, keyCol: true, - width: '8%', + width: '10%', render: (text) => { if (text === 'image') { return '鍥剧墖' @@ -115,50 +118,50 @@ {value: 'false', text: '鍚�'} ] }, - { - title: '鍙栫粷瀵瑰��', - dataIndex: 'abs', - inputType: 'radio', - editable: true, - required: false, - keyVals: ['number'], - width: '10%', - render: (text, record) => { - if (record.type !== 'number') return '' + // { + // title: '鍙栫粷瀵瑰��', + // dataIndex: 'abs', + // inputType: 'radio', + // editable: true, + // required: false, + // keyVals: ['number'], + // width: '10%', + // render: (text, record) => { + // if (record.type !== 'number') return '' - if (text === 'true') { - return '鏄�' - } else { - return '鍚�' - } - }, - options: [ - {value: 'true', text: '鏄�'}, - {value: 'false', text: '鍚�'} - ] - }, - { - title: '0鍊煎鍑�', - dataIndex: 'noValue', - inputType: 'radio', - editable: true, - required: false, - keyVals: ['number'], - width: '10%', - render: (text, record) => { - if (record.type !== 'number') return '' + // if (text === 'true') { + // return '鏄�' + // } else { + // return '鍚�' + // } + // }, + // options: [ + // {value: 'true', text: '鏄�'}, + // {value: 'false', text: '鍚�'} + // ] + // }, + // { + // title: '0鍊煎鍑�', + // dataIndex: 'noValue', + // inputType: 'radio', + // editable: true, + // required: false, + // keyVals: ['number'], + // width: '10%', + // render: (text, record) => { + // if (record.type !== 'number') return '' - if (text !== 'false') { - return '鏄�' - } else { - return '鍚�' - } - }, - options: [ - {value: 'true', text: '鏄�'}, - {value: 'false', text: '鍚�'} - ] - }, + // if (text !== 'false') { + // return '鏄�' + // } else { + // return '鍚�' + // } + // }, + // options: [ + // {value: 'true', text: '鏄�'}, + // {value: 'false', text: '鍚�'} + // ] + // }, { title: '灏忔暟浣�', dataIndex: 'decimal', @@ -170,7 +173,56 @@ keyVals: ['number'], width: '12%', render: (text, record) => record.type === 'number' ? text : '' - } + }, + { + title: '鍏朵粬', + dataIndex: 'other', + required: false, + width: '18%', + render: (_, record) => { + if (record.type === 'number') { + let val = '' + + if (record.abs === 'true') { + val += '鍙栫粷瀵瑰�硷紱' + } + if (record.noValue === 'false') { + val += '0鍊间笉瀵煎嚭锛�' + } + if (record.format) { + if (record.format === 'thdSeparator') { + val += '鏍煎紡鍖栵細鍗冨垎浣嶏紱' + } else if (record.format === 'thdSepPm') { + val += '鏍煎紡鍖栵細鍗冨垎浣嶏紙璐熷�肩孩鑹诧級锛�' + } else if (record.format === 'percent') { + val += '鏍煎紡鍖栵細鐧惧垎姣旓紱' + } + } + + return <div>{val}<EditOutlined className="edit-other" onClick={() => {this.setState({visible: true, line: fromJS(record).toJS()})}} /></div> + } else if (record.type === 'text') { + let val = '' + + if (record.wrapText === 'true') { + val += '鑷姩鎹㈣锛�' + } + if (record.noValue === 'false') { + val += '绌哄�间笉瀵煎嚭锛�' + } + if (record.textFormat) { + if (record.textFormat === 'YYYY-MM-DD') { + val += '鏍煎紡鍖栵細YYYY-MM-DD锛�' + } else if (record.textFormat === 'YYYY-MM-DD HH:mm:ss') { + val += '鏍煎紡鍖栵細YYYY-MM-DD HH:mm:ss锛�' + } + } + + return <div>{val}<EditOutlined className="edit-other" onClick={() => {this.setState({visible: true, line: fromJS(record).toJS()})}} /></div> + } + + return '' + } + }, ], scriptsColumns: [ { @@ -779,27 +831,30 @@ col.type = 'text' } } + if (col.type === 'text' && col.format) { + delete col.format + } else if (col.type === 'number' && col.textFormat) { + delete col.textFormat + } return col }) - // if (columns[0] && !['image', 'text', 'number'].includes(columns[0].type)) { - // columns = columns.map(col => { - // let _cell = { - // uuid: Utils.getuuid(), - // Column: col.Column, - // Text: col.Text, - // Width: 20, - // abs: 'false', - // output: col.output || 'true', - // required: col.required || 'false', - // type: 'text', - // } - - // return _cell - // }) - // } this.setState({verify: {...verify, columns}}) + } + + lineSubmit = () => { + const { line, verify } = this.state + + let columns = verify.columns.map(col => { + if (col.uuid === line.uuid) { + return line + } + + return col + }) + + this.setState({verify: {...verify, columns}, line: null, visible: false}) } // 鏍囩鍒囨崲 @@ -988,7 +1043,7 @@ render() { const { card } = this.props - const { verify, excelColumns, scriptsColumns, activeKey, loading, searches, searchKey } = this.state + const { verify, excelColumns, scriptsColumns, activeKey, loading, searches, searchKey, visible, line } = this.state const formItemLayout = { labelCol: { xs: { span: 24 }, @@ -1021,7 +1076,7 @@ <Button className="excel-col-add mk-red" title="娓呯┖Excel鍒�" onClick={this.clearField}> 娓呯┖Excel鍒� </Button> - <div style={{color: '#959595', fontSize: '13px', paddingLeft: '10px'}}>濡傞渶瀵煎嚭搴忓彿锛岃浣跨敤瀛楁 $Index锛涙暟鍊肩被鍨嬪鍑烘椂鍙彇缁濆鍊间互鍙婅缃皬鏁颁綅锛涘鍑轰负鍚︽椂锛屼笉浣跨敤琛屼俊鎭紱绾㈣壊鏍囬瀵煎嚭鏃跺垪澶存枃瀛椾负绾㈣壊銆�</div> + <div style={{color: '#959595', fontSize: '13px', paddingLeft: '10px'}}>濡傞渶瀵煎嚭搴忓彿锛岃浣跨敤瀛楁 $Index锛涘鍑轰负鍚︽椂锛屼笉浣跨敤琛屼俊鎭紙鏂囨湰涓虹┖锛屾暟鍊间负0锛夛紱绾㈣壊鏍囬瀵煎嚭鏃跺垪澶存枃瀛椾负绾㈣壊銆�</div> <EditTable actions={['edit', 'move', 'copy', 'del']} type="excelcolumn" searchKey={searchKey} wrappedComponentRef={(inst) => this.columnRef = inst} data={verify.columns} columns={excelColumns} onChange={this.changeColumns}/> </TabPane> {card.intertype === 'system' ? <TabPane tab={ @@ -1140,6 +1195,18 @@ </Form> </TabPane> </Tabs> + <Modal + title="" + visible={visible} + width={1000} + maskClosable={false} + closable={false} + onOk={this.lineSubmit} + onCancel={() => {this.setState({visible: false, line: null})}} + destroyOnClose + > + <OtherForm line={line} onChange={(values) => this.setState({line: values})}/> + </Modal> </div> ) } diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.scss b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.scss index f96c1d1..dd96816 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.scss +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.scss @@ -96,6 +96,15 @@ padding: 0 5px; cursor: pointer; } + .edit-other { + opacity: 0; + color: #1890ff; + padding: 0 5px; + transition: opacity 0.2s; + } + tr:not([draggable="false"]) td:hover .edit-other { + opacity: 1; + } } .verify-excelout-box-tab { >.ant-spin { diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/otherform/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/otherform/index.jsx new file mode 100644 index 0000000..068d8ee --- /dev/null +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/otherform/index.jsx @@ -0,0 +1,114 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { Form, Row, Col, Radio, Tooltip, Select } from 'antd' +import { QuestionCircleOutlined } from '@ant-design/icons' +// import './index.scss' + +class ExcelOutOtherColumn extends Component { + static propTpyes = { + onChange: PropTypes.func + } + + onChange = (key, val) => { + const { line } = this.props + + this.props.onChange({...line, [key]: val}) + } + + render() { + const { getFieldDecorator } = this.props.form + const { line } = this.props + const formItemLayout = { + labelCol: { + xs: { span: 24 }, + sm: { span: 8 } + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 } + } + } + + return ( + <Form {...formItemLayout} style={{minHeight: '100px', paddingTop: '10px'}}> + <Row gutter={24}> + {line.type === 'number' ? <Col span={8}> + <Form.Item label="鍙栫粷瀵瑰��"> + {getFieldDecorator('abs', { + initialValue: line.abs || 'false' + })( + <Radio.Group style={{whiteSpace: 'nowrap'}} onChange={(e) => {this.onChange('abs', e.target.value)}}> + <Radio value="true">鏄�</Radio> + <Radio value="false">鍚�</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> : null} + {line.type === 'text' ? <Col span={8}> + <Form.Item label="鑷姩鎹㈣"> + {getFieldDecorator('wrapText', { + initialValue: line.wrapText || 'false' + })( + <Radio.Group style={{whiteSpace: 'nowrap'}} onChange={(e) => {this.onChange('wrapText', e.target.value)}}> + <Radio value="true">鏄�</Radio> + <Radio value="false">鍚�</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> : null} + <Col span={8}> + <Form.Item label={line.type === 'number' ? '0鍊�' : + <Tooltip placement="topLeft" title="鏃堕棿灏忎簬 1949-10-02 鏃躲��"> + <QuestionCircleOutlined className="mk-form-tip" /> + 绌哄�� + </Tooltip> + }> + {getFieldDecorator('noValue', { + initialValue: line.noValue || 'true' + })( + <Radio.Group style={{whiteSpace: 'nowrap'}} onChange={(e) => {this.onChange('noValue', e.target.value)}}> + <Radio value="true">瀵煎嚭</Radio> + <Radio value="false">涓嶅鍑�</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> + {line.type === 'number' ? <Col span={8}> + <Form.Item label={ + <Tooltip placement="topLeft" title="浣跨敤鏍煎紡鍖栨椂锛岄渶璁剧疆灏忔暟浣嶃��"> + <QuestionCircleOutlined className="mk-form-tip" /> + 鏍煎紡鍖� + </Tooltip> + }> + {getFieldDecorator('format', { + initialValue: line.format || '' + })( + <Select onChange={(val) => this.onChange('format', val)}> + <Select.Option value=""> 鏃� </Select.Option> + <Select.Option value="thdSeparator"> 鍗冨垎浣� </Select.Option> + <Select.Option value="thdSepPm"> 鍗冨垎浣嶏紙璐熷�肩孩鑹诧級 </Select.Option> + <Select.Option value="percent"> 鐧惧垎姣� </Select.Option> + </Select> + )} + </Form.Item> + </Col> : null} + {line.type === 'text' ? <Col span={8}> + <Form.Item label="鏍煎紡鍖�"> + {getFieldDecorator('textFormat', { + initialValue: line.textFormat || '' + })( + <Select onChange={(val) => this.onChange('textFormat', val)}> + <Select.Option value=""> 鏃� </Select.Option> + <Select.Option value="YYYY-MM-DD"> YYYY-MM-DD </Select.Option> + <Select.Option value="YYYY-MM-DD HH:mm:ss"> YYYY-MM-DD HH:mm:ss </Select.Option> + </Select> + )} + </Form.Item> + </Col> : null} + </Row> + </Form> + ) + } +} + +export default Form.create()(ExcelOutOtherColumn) \ No newline at end of file diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/otherform/index.scss b/src/templates/sharecomponent/actioncomponent/verifyexcelout/otherform/index.scss new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/otherform/index.scss diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index c2a388a..3414d0d 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -2571,7 +2571,7 @@ key: 'enter', label: '鍥炶溅浜嬩欢', initVal: (card.type === 'text' || card.type === 'number') ? (card.enter || 'sub') : (card.enter || 'false'), - tooltip: '1銆佺偣鍑籈nter閿垨鏂囨湰绫昏〃鍗曡緭鍏ュ洖杞︾锛�2銆佷笅鎷夐�夋嫨鎴栧紑鍏崇殑閫夐」鍒囨崲銆�', + tooltip: '1銆佺偣鍑籈nter閿垨鏂囨湰绫昏〃鍗曡緭鍏ュ洖杞︾锛�2銆佷笅鎷夐�夋嫨銆佹椂闂淬�佸紑鍏崇殑閫夐」鍒囨崲銆�', options: [{ value: 'sub', text: '鎻愪氦' diff --git a/src/templates/zshare/modalform/index.jsx b/src/templates/zshare/modalform/index.jsx index 6f21e10..2397159 100644 --- a/src/templates/zshare/modalform/index.jsx +++ b/src/templates/zshare/modalform/index.jsx @@ -31,8 +31,8 @@ fileupload: ['readonly', 'required', 'hidden', 'readin', 'fieldlength', 'maxfile', 'fileType', 'span', 'labelwidth', 'linkSubField', 'tooltip', 'extra', 'compress', 'miniSet', 'splitline', 'marginTop', 'marginBottom', 'maxSize'], switch: ['initval', 'openVal', 'closeVal', 'openText', 'closeText', 'readonly', 'hidden', 'readin', 'span', 'labelwidth', 'linkSubField', 'tooltip', 'extra', 'enter', 'splitline', 'marginTop', 'marginBottom'], check: ['initval', 'openVal', 'closeVal', 'readonly', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'enter', 'splitline', 'marginTop', 'marginBottom', 'checkTip'], - date: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'declareType', 'mode', 'splitline', 'place', 'marginTop', 'marginBottom', 'minDate', 'maxDate', 'precision'], - datemonth: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'splitline', 'place', 'marginTop', 'marginBottom'], + date: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'enter', 'declareType', 'mode', 'splitline', 'place', 'marginTop', 'marginBottom', 'minDate', 'maxDate', 'precision'], + datemonth: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'enter', 'splitline', 'place', 'marginTop', 'marginBottom'], // datetime: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'declareType', 'mode', 'splitline', 'marginTop', 'marginBottom', 'minDate', 'maxDate'], textarea: ['initval', 'readonly', 'required', 'hidden', 'readin', 'fieldlength', 'span', 'labelwidth', 'maxRows', 'encryption', 'interception', 'tooltip', 'extra', 'place', 'count', 'placeholder', 'marginTop', 'marginBottom'], cascader: ['readonly', 'required', 'hidden', 'readin', 'resourceType', 'fieldlength', 'span', 'labelwidth', 'tooltip', 'extra', 'place', 'splitline', 'marginTop', 'marginBottom', 'separator'], @@ -243,6 +243,9 @@ shows.push('unchecked') } } else if (['date', 'datemonth'].includes(type)) { + if (this.record.enter === 'tab' || this.record.enter === 'sub') { + shows.push('tabField') + } reOptions.initval = dateOptions[type] reTypes.initval = 'select' if (type === 'date') { -- Gitblit v1.8.0