| | |
| | | .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; |
| | |
| | | key: 'prefix', |
| | | label: '前缀', |
| | | initVal: card.prefix || '', |
| | | tooltip: '扫码信息将与前缀拼接后执行。注:跳转菜单需以mkbid开头。', |
| | | tooltip: '扫码信息将与前缀拼接后执行。注:跳转菜单需以mkbid(:或,)开头,mkbid(:或,)跳转后将被去除。例如:mkbid:123456 跳转后页面BID为 123456。', |
| | | required: false |
| | | }, |
| | | { |
| | |
| | | field: 'prefix', |
| | | label: '前缀', |
| | | initval: wrap.prefix || '', |
| | | tooltip: '扫码信息将与前缀拼接后执行。注:跳转菜单需以mkbid开头。', |
| | | tooltip: '扫码信息将与前缀拼接后执行。注:跳转菜单需以mkbid(:或,)开头,mkbid(:或,)跳转后将被去除。例如:mkbid:123456 跳转后页面BID为 123456。', |
| | | required: false |
| | | }, |
| | | { |
| | |
| | | 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 |
| | | } |
| | |
| | | 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 |
| | | } |
| | | |
| | |
| | | /** |
| | | * @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 |
| | |
| | | |
| | | let table = [] |
| | | |
| | | data && data.forEach((item, index) => { |
| | | data.forEach((item, index) => { |
| | | let _row = {} |
| | | |
| | | item.$Index = index + 1 + '' |
| | |
| | | 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 = '' |
| | | } |
| | | } |
| | |
| | | |
| | | 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 = {} |
| | |
| | | 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 = '' |
| | |
| | | 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`) |
| | | } |
| | | }) |
| | | |
| | |
| | | table.push(_topRow) |
| | | } |
| | | |
| | | data && data.forEach((item, index) => { |
| | | data.forEach((item, index) => { |
| | | let _row = {} |
| | | |
| | | item.$Index = index + 1 + '' |
| | |
| | | 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 = '' |
| | | } |
| | | } |
| | |
| | | |
| | | 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') |
| | |
| | | } 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' : '' |
| | |
| | | import { DatePicker } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import MKEmitter from '@/utils/events.js' |
| | | |
| | | const { MonthPicker } = DatePicker |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | 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) => { |
| | |
| | | )} |
| | | </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' |
| | |
| | | </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" /> |
| | |
| | | <Radio value="true">是</Radio> |
| | | </Radio.Group>)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | </Col> : null} */} |
| | | </Row> |
| | | </Form> |
| | | </div> |
| | |
| | | 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' |
| | |
| | | verify: {}, |
| | | debugId: '', |
| | | activeKey: 'setting', |
| | | visible: false, |
| | | line: null, |
| | | searchKey: '', |
| | | excelColumns: [ |
| | | { |
| | |
| | | editable: true, |
| | | required: false, |
| | | keyCol: true, |
| | | width: '8%', |
| | | width: '10%', |
| | | render: (text) => { |
| | | if (text === 'image') { |
| | | return '图片' |
| | |
| | | {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', |
| | |
| | | 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: [ |
| | | { |
| | |
| | | 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}) |
| | | } |
| | | |
| | | // 标签切换 |
| | |
| | | |
| | | 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 }, |
| | |
| | | <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={ |
| | |
| | | </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> |
| | | ) |
| | | } |
| | |
| | | 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 { |
New file |
| | |
| | | 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) |
| | |
| | | key: 'enter', |
| | | label: '回车事件', |
| | | initVal: (card.type === 'text' || card.type === 'number') ? (card.enter || 'sub') : (card.enter || 'false'), |
| | | tooltip: '1、点击Enter键或文本类表单输入回车符;2、下拉选择或开关的选项切换。', |
| | | tooltip: '1、点击Enter键或文本类表单输入回车符;2、下拉选择、时间、开关的选项切换。', |
| | | options: [{ |
| | | value: 'sub', |
| | | text: '提交' |
| | |
| | | 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'], |
| | |
| | | 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') { |