From 10f5efae1624c89d9a8f04ac331e07c895ea282a Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 25 五月 2024 18:22:58 +0800 Subject: [PATCH] 2024-05-25 --- src/menu/components/table/edit-table/columns/editColumn/index.jsx | 96 +++++++++++++++++++++++++++++++----------------- 1 files changed, 62 insertions(+), 34 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 7458ba3..dd97ea0 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'] @@ -65,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) { @@ -78,7 +81,7 @@ } else if (this.record.editType === 'date') { _options.push('required', 'precision', 'enter', 'declareType') } else if (this.record.editType === 'popSelect') { - _options.push('required', 'enter', 'linkSubField', 'columns', 'dataSource', 'primaryKey', 'order', 'controlField', 'searchKey', 'popWidth', 'laypage', 'cache', 'onload') + _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') @@ -90,8 +93,18 @@ } 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') { + _options.push('dayFormat') + } else { + _options.push('hourFormat') } } if (this.record.type === 'formula' && this.record.eval === 'true') { @@ -99,11 +112,16 @@ } else if (this.record.type === 'custom' && this.record.IsSort === 'true') { _options.push('sortField') } - if (['number', 'formula'].includes(this.record.type) && this.record.Hide !== 'true') { - _options.push('noValue') + + if (this.record.Hide !== 'true') { + if (['number', 'formula'].includes(this.record.type)) { + _options.push('noValue') + } else if (this.record.type === 'text' && ['YYYY-MM-DD', 'YYYY-MM-DD HH:mm:ss'].includes(this.record.textFormat)) { + _options.push('noValue') + } } - return _options + return {options: _options, reLabel} } editColumn = (column) => { @@ -119,12 +137,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) @@ -154,7 +176,7 @@ this.record.IsSort = 'false' } - let _options = this.getOptions() + let { options, reLabel } = this.getOptions() let _field = '' if (value === 'formula') { @@ -168,7 +190,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 }) @@ -200,12 +225,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 }) @@ -218,7 +246,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 => { @@ -227,18 +255,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'].includes(key)) { - let _options = this.getOptions() + } else if (['editable', 'editType', 'resourceType', 'ctrlField', 'eval', 'Hide', 'IsSort', 'textFormat'].includes(key)) { + 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 }) @@ -306,6 +340,14 @@ let content = null let extra = null let initVal = item.initVal || '' + let label = item.label + if (item.tooltip) { + if (item.toolWidth) { + label = <Tooltip placement="topLeft" overlayStyle={{maxWidth: item.toolWidth}} title={<div onClick={(e) => e.stopPropagation()}>{item.tooltip}</div>}><QuestionCircleOutlined className="mk-form-tip" />{item.label}</Tooltip> + } else { + label = <Tooltip placement="topLeft" title={<div onClick={(e) => e.stopPropagation()}>{item.tooltip}</div>}><QuestionCircleOutlined className="mk-form-tip" />{item.label}</Tooltip> + } + } if (item.type === 'text') { rules = [ @@ -380,12 +422,7 @@ if (item.key === 'formula') { fields.push( <Col span={span} key={index}> - <Form.Item className={className} extra={extra} label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> + <Form.Item className={className} extra={extra} label={label}> {getFieldDecorator(item.key, { initialValue: initVal, rules: rules @@ -442,12 +479,7 @@ fields.push( <Col span={span} key={index}> - <Form.Item className={className} extra={extra} label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> + <Form.Item className={className} extra={extra} label={label}> {getFieldDecorator(item.key, { initialValue: initVal, rules: rules @@ -555,7 +587,7 @@ ${_option.sql}` // LoginUID|SessionUid|UserID|Appkey 宸叉浛鎹� - sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|time_id)@/ig, `'1949-10-01 15:00:00'`) + sql = sql.replace(/@\$|\$@/ig, '') let rduri = '' if (window.GLOB.mainSystemApi && values.database === 'sso') { @@ -612,11 +644,7 @@ sql = `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) ${sql}` - sql = sql.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') - sql = sql.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) - sql = sql.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) - sql = sql.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) - sql = sql.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) + sql = sql.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, `''`) Api.sDebug(sql).then(result => { if (result.status || result.ErrCode === '-2') { -- Gitblit v1.8.0