src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx
@@ -207,6 +207,42 @@ }, { value: 'switch', text: '开关' }, { value: 'date', text: '日期(天)' }] }, { type: 'radio', key: 'precision', label: '精确度', initVal: card.precision || 'day', options: [{ value: 'day', text: '天' }, { value: 'hour', text: '小时' }, { value: 'minute', text: '分钟' }, { value: 'second', text: '秒' }] }, { type: 'radio', key: 'declareType', label: '数据类型', tooltip: '声明变量时的类型,时间格式datetime或文本格式nvarchar(50)。', initVal: card.declareType || 'datetime', options: [{ value: 'datetime', text: 'datetime' }, { value: 'nvarchar(50)', text: 'nvarchar(50)' }] }, { src/menu/components/table/edit-table/columns/editColumn/index.jsx
@@ -71,6 +71,8 @@ if (this.record.editType === 'switch') { _options.push('enter', 'openVal', 'closeVal', 'openText', 'closeText', 'editField') } else if (this.record.editType === 'date') { _options.push('required', 'precision', 'enter', 'declareType') } else if (this.record.editType === 'select') { _options.push('required', 'enter', 'resourceType', 'linkSubField', 'editField', 'dropdown') src/menu/datasource/verifycard/index.jsx
@@ -681,15 +681,17 @@ if (/列名\s*'[a-zA-Z0-9_-]+'\s*无效/.test(result.message)) { let tail = '' let type = '' searches.forEach(item => { if (item.forbid) return item.key.split(',').forEach(field => { if (new RegExp(`'${field}'`).test(result.message)) { tail = field type = '搜索条件' } if (setting.execute !== 'false' && setting.queryType !== 'statistics') { searches.forEach(item => { if (item.forbid) return item.key.split(',').forEach(field => { if (new RegExp(`'${field}'`).test(result.message)) { tail = field type = '搜索条件' } }) }) }) } if (!tail) { let keys = setting.order.replace(/\s+(asc|desc)/ig, '').replace(/\s+/g, '') src/tabviews/custom/components/table/edit-table/normalTable/cusSwitch/index.jsx
File was deleted src/tabviews/custom/components/table/edit-table/normalTable/cusSwitch/index.scss
File was deleted src/tabviews/custom/components/table/edit-table/normalTable/index.jsx
@@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' import { Table, Typography, Modal, Input, InputNumber, Button, notification, message, Select } from 'antd' import { Table, Typography, Modal, Input, InputNumber, Switch, Button, notification, message, Select, DatePicker } from 'antd' import { EditOutlined, QuestionCircleOutlined } from '@ant-design/icons' import moment from 'moment' import md5 from 'md5' @@ -10,13 +10,96 @@ import asyncComponent from '@/utils/asyncComponent' import Utils, { getEditTableSql, getMark } from '@/utils/utils.js' import MKEmitter from '@/utils/events.js' import CusSwitch from './cusSwitch' import Encrypts from '@/components/encrypts' import './index.scss' const { Paragraph } = Typography const MkIcon = asyncComponent(() => import('@/components/mk-icon')) const CardCellComponent = asyncComponent(() => import('@/tabviews/custom/components/card/cardcellList')) class CusSwitch extends Component { static propTpyes = { defaultValue: PropTypes.any, autoFocus: PropTypes.any, config: PropTypes.object, onChange: PropTypes.func } state = { status: false } UNSAFE_componentWillMount () { const { defaultValue, config } = this.props let status = false if (defaultValue === config.openVal) { status = true } this.setState({status}) } changeStatus = (val) => { const { config } = this.props this.setState({ status: val }, () => { let _val = val ? config.openVal : config.closeVal let _text = val ? config.openText : config.closeText this.props.onChange(_val, _text) }) } render() { const { config, autoFocus } = this.props const { status } = this.state return ( <Switch checkedChildren={config.openText} autoFocus={autoFocus} onBlur={this.props.onBlur} unCheckedChildren={config.closeText} checked={status} onChange={this.changeStatus} /> ) } } class CusDatePicker extends Component { static propTpyes = { defaultValue: PropTypes.any, config: PropTypes.object, onChange: PropTypes.func, blur: PropTypes.func } state = { value: null, open: false } UNSAFE_componentWillMount () { const { value, open } = this.props let _value = value || null if (_value) { _value = moment(_value, 'YYYY-MM-DD HH:mm:ss') } this.setState({value: _value, open: open === true}) } onOpenChange = (open) => { this.setState({open}) if (open === false) { this.props.blur() } } render() { const { config } = this.props const { value, open } = this.state return ( <DatePicker dropdownClassName={'mk-date-picker ' + config.precision} showTime={config.format !== 'YYYY-MM-DD'} format={config.format} open={open} defaultValue={value} onChange={this.props.onChange} onOpenChange={this.onOpenChange}/> ) } } class BodyRow extends React.Component { shouldComponentUpdate (nextProps, nextState) { @@ -254,6 +337,33 @@ MKEmitter.emit('changeRecord', col.tableId, {...record, ...values}) } onDateChange = (val) => { const { col, record } = this.props let _val = val ? moment(val).format(col.format) : '' if (col.precision === 'hour') { _val = _val + ':00:00' } else if (col.precision === 'minute') { _val = _val + ':00' } this.setState({editing: false}) setTimeout(() => { if (/\$next/.test(col.enter)) { MKEmitter.emit('nextLine', col, record.$$uuid) } else if (col.enter === '$sub') { MKEmitter.emit('subLine', col, record) } else if (col.enter !== '$noAct') { let node = document.getElementById(col.enter + record.$$uuid) node && node.click() } }, 50) MKEmitter.emit('changeRecord', col.tableId, {...record, [col.field]: _val}) } switchBlur = () => { setTimeout(() => { this.setState({editing: false}) @@ -325,6 +435,10 @@ if (!col.editType || col.editType === 'text') { return (<td className="editing_table_cell"> <Input className={err ? 'has-error' : ''} title={err} id={col.uuid + record.$$uuid} defaultValue={value} onChange={(e) => this.onChange(e.target.value)} onPressEnter={this.enterPress} onBlur={this.onBlur}/> </td>) } else if (col.editType === 'date') { return (<td className="editing_table_cell"> <CusDatePicker config={col} value={record[col.field] || null} open={true} onChange={this.onDateChange} blur={() => this.setState({editing: false})}/> </td>) } else if (col.editType === 'switch') { let _value = record[col.field] !== undefined ? record[col.field] : '' @@ -694,6 +808,31 @@ MKEmitter.emit('changeRecord', col.tableId, {...record, ...values}) } onDateChange = (val) => { const { col, record } = this.props let _val = val ? moment(val).format(col.format) : '' if (col.precision === 'hour') { _val = _val + ':00:00' } else if (col.precision === 'minute') { _val = _val + ':00' } setTimeout(() => { if (/\$next/.test(col.enter)) { MKEmitter.emit('nextLine', col, record.$$uuid) } else if (col.enter === '$sub') { MKEmitter.emit('subLine', col, record) } else if (col.enter !== '$noAct') { let node = document.getElementById(col.enter + record.$$uuid) node && node.click() } }, 50) MKEmitter.emit('changeRecord', col.tableId, {...record, [col.field]: _val}) } render() { let { col, config, record, style, className, ...resProps } = this.props const { err } = this.state @@ -717,6 +856,10 @@ } else if (col.editType === 'switch') { children = ( <CusSwitch config={col} autoFocus={false} defaultValue={_value} onChange={this.onSwitchChange} onBlur={() => {}}/> ) } else if (col.editType === 'date') { children = ( <CusDatePicker config={col} value={record[col.field] || null} onChange={this.onDateChange} blur={() => {}}/> ) } else { children = (<> @@ -1042,6 +1185,16 @@ 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' } } } @@ -1075,7 +1228,13 @@ if (item.field === setting.primaryKey) return if (_forms[item.field]) { forms.push({..._forms[item.field], datatype: item.datatype}) let _item = {..._forms[item.field]} if (_item.editType === 'date') { _item.datatype = _item.declareType || 'datetime' } else { _item.datatype = item.datatype } forms.push(_item) } else { forms.push(item) } @@ -1665,6 +1824,8 @@ let val = item[col.field] !== undefined ? (item[col.field] + '') : '' if (col.required === 'true' && !val) { line.push(`${col.label}不可为空`) } else if (col.datatype === 'datetime' && !val) { val = '1949-10-01' } item[col.field] = val } else if (col.type === 'number') { src/tabviews/custom/components/table/edit-table/normalTable/index.scss
@@ -9,7 +9,7 @@ >.ant-table-wrapper { position: relative; z-index: 1; // z-index: 1; } .ant-table { color: inherit; @@ -188,6 +188,14 @@ border: 1px solid var(--mk-sys-color); } } .ant-calendar-picker { display: block; position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px; } .has-error, .has-error .ant-input-number-input { border-color: #ff4d4f!important; } @@ -220,6 +228,10 @@ text-align: inherit; } } .ant-calendar-picker { display: block; height: 30px; } .has-error, .has-error .ant-input-number-input { border-color: #ff4d4f!important; } src/tabviews/zshare/actionList/index.scss
@@ -56,7 +56,10 @@ height: 34px; border-radius: 0px; padding-left: 15px!important; border-bottom-width: 1px!important; border: none; color: rgba(0, 0, 0, 0.65)!important; border-bottom: 1px solid #e8e8e8!important; background: #ffffff!important; .anticon { display: none; } src/tabviews/zshare/mutilform/mkPopSelect/index.jsx
@@ -350,8 +350,16 @@ dataSource={options} loading={loading} onRow={(record) => { let className = '' if (record.$disabled) { className = ' mk-disable-line ' } else if (value === record.$$uuid) { className = ' ant-table-row-selected ' } return { className: value === record.$$uuid ? ' ant-table-row-selected ' : '', className: className, onClick: () => {this.changeRow(record)}, } }} src/tabviews/zshare/mutilform/mkPopSelect/index.scss
@@ -39,6 +39,12 @@ tr.ant-table-row-selected td { background-color: var(--mk-sys-color3); } tr:not(.mk-disable-line) { cursor: pointer; } .mk-disable-line { color: rgba(0, 0, 0, 0.35); } } } .ant-modal-body::-webkit-scrollbar { src/templates/zshare/editTable/cusSwitch/index.jsx
File was deleted src/templates/zshare/editTable/cusSwitch/index.scss
File was deleted src/templates/zshare/editTable/index.jsx
@@ -2,13 +2,12 @@ import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' import { DndProvider, DragSource, DropTarget } from 'react-dnd' import { Table, Input, InputNumber, Popconfirm, Form, Select, Radio, Cascader, notification, message, Modal, Typography } from 'antd' import { Table, Input, InputNumber, Popconfirm, Switch, Form, Select, Radio, Cascader, notification, message, Modal, Typography } from 'antd' import { CopyOutlined, EditOutlined, DeleteOutlined, SwapOutlined, PlusOutlined } from '@ant-design/icons' import Utils from '@/utils/utils.js' import ColorSketch from '@/mob/colorsketch' import asyncComponent from '@/utils/asyncComponent' import CusSwitch from './cusSwitch' import MKEmitter from '@/utils/events.js' import './index.scss' @@ -19,6 +18,52 @@ let dragingIndex = -1 const { Paragraph } = Typography class CusSwitch extends Component { static propTpyes = { defaultValue: PropTypes.any, value: PropTypes.any, onChange: PropTypes.func } state = { status: true } UNSAFE_componentWillMount () { const { defaultValue, value } = this.props let initVal = 'true' if (this.props['data-__meta']) { initVal = this.props['data-__meta'].initialValue } else if (defaultValue) { initVal = defaultValue } else if (value) { initVal = value } if (initVal === 'false') { initVal = false } else { initVal = true } this.setState({status: initVal}) } changeStatus = (val) => { this.setState({ status: val }, () => { let _val = val ? 'true' : 'false' this.props.onChange && this.props.onChange(_val) }) } render() { const { status } = this.state return ( <Switch checkedChildren="是" unCheckedChildren="否" checked={status} onChange={this.changeStatus} /> ) } } class BodyRow extends React.Component { render() { const { isOver, moveAble, connectDragSource, connectDropTarget, moveRow, ...restProps } = this.props