From f3d4db769ba9b51b799d981511a710fd443d0e08 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 21 四月 2025 12:18:03 +0800 Subject: [PATCH] Merge branch 'master' into positec --- src/menu/components/table/edit-table/columns/editColumn/index.jsx | 80 ++++++++++++++++++++++++++++------------ 1 files changed, 56 insertions(+), 24 deletions(-) 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 716a8c8..bec94a9 100644 --- a/src/menu/components/table/edit-table/columns/editColumn/index.jsx +++ b/src/menu/components/table/edit-table/columns/editColumn/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Modal, notification, Popover } from 'antd' +import { Form, Row, Col, Input, Select, InputNumber, Radio, Checkbox, Tooltip, Modal, notification, Popover } from 'antd' import { QuestionCircleOutlined } from '@ant-design/icons' import Api from '@/api' @@ -66,6 +66,8 @@ getOptions = () => { let _options = fromJS(columnTypeOptions[this.record.type]).toJS() + let reLabel = {} + if (['number', 'text'].includes(this.record.type) && this.record.editable === 'true') { _options.push('ctrlField') if (this.record.ctrlField) { @@ -81,7 +83,7 @@ } else if (this.record.editType === 'popSelect') { _options.push('required', 'enter', 'linkSubField', 'columns', 'dataSource', 'primaryKey', 'order', 'showField', 'controlField', 'searchKey', 'popWidth', 'laypage', 'cache', 'onload') } else if (this.record.editType === 'select') { - _options.push('required', 'enter', 'resourceType', 'linkSubField', 'dropdown') + _options.push('required', 'enter', 'resourceType', 'linkSubField', 'dropdown', 'showValue') if (this.record.resourceType === '0') { _options.push('options') @@ -91,8 +93,12 @@ } else { _options.push('required', 'enter') } + + reLabel.required = '蹇呭~' } else if (this.record.type === 'number') { - _options.push('max', 'min', 'enter', 'clearField') + _options.push('max', 'min', 'required', 'enter', 'clearField') + + reLabel.required = '涓嶇瓑浜�0' } } else if (this.record.type === 'extend') { if (this.record.colUnit === 'day') { @@ -101,8 +107,13 @@ _options.push('hourFormat') } } - if (this.record.type === 'formula' && this.record.eval === 'true') { - _options.push('decimal') + if (this.record.type === 'formula') { + if (this.record.eval === 'true') { + _options.push('decimal') + } + if (this.record.eval !== 'func') { + _options.push('evalchars') + } } else if (this.record.type === 'custom' && this.record.IsSort === 'true') { _options.push('sortField') } @@ -115,7 +126,7 @@ } } - return _options + return {options: _options, reLabel} } editColumn = (column) => { @@ -131,12 +142,16 @@ this.record[item.key] = item.initVal }) - let _options = this.getOptions() + let { options, reLabel } = this.getOptions() this.setState({ visible: true, formlist: formlist.map(item => { - item.hidden = !_options.includes(item.key) + item.hidden = !options.includes(item.key) + + if (reLabel[item.key]) { + item.label = reLabel[item.key] + } if (item.key === 'formula') { item.fields = this.props.fields.map(col => col.field) @@ -166,7 +181,7 @@ this.record.IsSort = 'false' } - let _options = this.getOptions() + let { options, reLabel } = this.getOptions() let _field = '' if (value === 'formula') { @@ -180,7 +195,10 @@ } item.initVal = this.record[item.key] - item.hidden = !_options.includes(item.key) + item.hidden = !options.includes(item.key) + if (reLabel[item.key]) { + item.label = reLabel[item.key] + } return item }) @@ -212,12 +230,15 @@ this.record.type = values.type if (values.type !== _type) { - let _options = this.getOptions() + let { options, reLabel } = this.getOptions() this.setState({ formlist: this.state.formlist.map(item => { item.initVal = this.record[item.key] - item.hidden = !_options.includes(item.key) + item.hidden = !options.includes(item.key) + if (reLabel[item.key]) { + item.label = reLabel[item.key] + } return item }) @@ -230,7 +251,7 @@ } else if (key === 'format' && value === 'percent') { this.props.form.setFieldsValue({postfix: '%'}) } else if (key === 'editType') { - let _options = this.getOptions() + let { options, reLabel } = this.getOptions() this.setState({ formlist: this.state.formlist.map(item => { @@ -239,18 +260,24 @@ } item.initVal = this.record[item.key] - item.hidden = !_options.includes(item.key) + item.hidden = !options.includes(item.key) + if (reLabel[item.key]) { + item.label = reLabel[item.key] + } return item }) }) } else if (['editable', 'editType', 'resourceType', 'ctrlField', 'eval', 'Hide', 'IsSort', 'textFormat'].includes(key)) { - let _options = this.getOptions() + let { options, reLabel } = this.getOptions() this.setState({ formlist: this.state.formlist.map(item => { item.initVal = this.record[item.key] - item.hidden = !_options.includes(item.key) + item.hidden = !options.includes(item.key) + if (reLabel[item.key]) { + item.label = reLabel[item.key] + } return item }) @@ -380,6 +407,15 @@ content = <Radio.Group onChange={(e) => {this.typeChange(item.key, e.target.value)}}> {item.options.map(option => <Radio key={option.value} value={option.value}>{option.text}</Radio>)} </Radio.Group> + } else if (item.type === 'checkbox') { + rules = [ + { required: item.required, message: '璇烽�夋嫨' + item.label + '!' } + ] + initVal = item.initVal + + content = <Checkbox.Group onChange={(e) => {this.typeChange(item.key, e.target.value)}}> + {item.options.map(option => <Checkbox key={option.value} value={option.value}>{option.text}</Checkbox>)} + </Checkbox.Group> } else if (item.type === 'multiselect') { // 澶氶�� content = <Select showSearch @@ -425,6 +461,7 @@ extra = <span className="add-resource-empty" onClick={this.handleEmpty}>绌�</span> } if (item.placeholder) { + className = 'show-public-var' extra = <><span className="resource-public-var">{item.placeholder}</span>{extra}</> } @@ -558,7 +595,7 @@ if (!pass) return } - if (values.editType === 'select' && values.resourceType === '1' && values.dataSource) { + if (values.editType === 'select' && values.resourceType === '1' && values.database !== 'sso' && values.dataSource) { let _option = Utils.getSelectQueryOptions(values) let sql = `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) @@ -566,13 +603,8 @@ // LoginUID|SessionUid|UserID|Appkey 宸叉浛鎹� sql = sql.replace(/@\$|\$@/ig, '') - - let rduri = '' - if (window.GLOB.mainSystemApi && values.database === 'sso') { - rduri = window.GLOB.mainSystemApi - } - Api.sDebug(sql, rduri).then(result => { + Api.sDebug(sql).then(result => { if (result.status || result.ErrCode === '-2') { this.setState({visible: false, loading: false, formlist: null}) this.props.submitCol(values) @@ -670,7 +702,7 @@ title="鏄剧ず鍒楃紪杈�" wrapClassName="mk-scroll-modal" visible={visible} - width={900} + width={950} maskClosable={false} onOk={this.handleSubmit} onCancel={this.editModalCancel} -- Gitblit v1.8.0