From 2b45840e53d250f517874bea495bffaeda172807 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 03 三月 2022 12:52:16 +0800 Subject: [PATCH] 2022-03-03 --- src/templates/zshare/modalform/index.jsx | 2 src/mob/searchconfig/index.jsx | 2 src/menu/components/form/formaction/actionform/index.jsx | 2 src/tabviews/custom/components/table/edit-table/normalTable/cusSwitch/index.scss | 40 + src/menu/components/card/cardcellcomponent/elementform/index.jsx | 4 src/templates/zshare/menuform/index.jsx | 2 src/tabviews/custom/components/table/edit-table/index.jsx | 42 + src/menu/components/table/edit-table/options.jsx | 12 src/menu/components/table/normal-table/columns/editColumn/index.jsx | 4 src/templates/sharecomponent/searchcomponent/searchform/index.scss | 2 src/components/simpleform/index.jsx | 2 src/menu/components/table/edit-table/columns/editColumn/index.scss | 25 src/api/index.js | 4 src/menu/components/table/edit-table/columns/editColumn/index.jsx | 337 ++++++++------- src/menu/modulesource/option.jsx | 4 src/templates/sharecomponent/chartgroupcomponent/chartform/index.jsx | 2 src/utils/utils.js | 1 src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx | 182 +++++++- src/index.js | 8 src/menu/replaceField/index.jsx | 83 +++ src/templates/formtabconfig/actionform/index.jsx | 4 src/tabviews/custom/components/table/edit-table/normalTable/index.jsx | 364 +++++++++++++--- src/tabviews/custom/components/table/edit-table/normalTable/index.scss | 39 + src/mob/searchconfig/settingform/index.jsx | 13 src/templates/modalconfig/menuform/index.jsx | 2 src/templates/zshare/modalform/index.scss | 2 src/templates/sharecomponent/columncomponent/gridbtnform/index.jsx | 4 src/tabviews/custom/components/table/edit-table/normalTable/cusSwitch/index.jsx | 47 ++ src/templates/sharecomponent/columncomponent/columnform/index.jsx | 4 src/templates/sharecomponent/searchcomponent/searchform/index.jsx | 4 src/views/login/index.jsx | 21 31 files changed, 956 insertions(+), 308 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index c47a9cc..6ae5789 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -48,7 +48,7 @@ } sessionStorage.clear() - sessionStorage.setItem('loginError', JSON.stringify({request: res.config ? res.config.data : '', response: JSON.stringify(res.data)})) + sessionStorage.setItem('loginError', JSON.stringify({url: res.config ? res.config.url : '', request: res.config ? res.config.data : '', response: JSON.stringify(res.data)})) window.history.replaceState(null, null, window.location.href.split('#')[0] + '#/login') window.location.reload() } @@ -59,7 +59,7 @@ if (window.debugger === true) { response.data.ErrCode = 'E' return Promise.resolve(response.data) - } else { + } else if (!sessionStorage.getItem('loginError')) { setCurrentUrl(response) } } else { diff --git a/src/components/simpleform/index.jsx b/src/components/simpleform/index.jsx index 6788adb..f5f752d 100644 --- a/src/components/simpleform/index.jsx +++ b/src/components/simpleform/index.jsx @@ -40,7 +40,7 @@ const { getFieldDecorator } = this.props.form const fields = [] this.props.formlist.forEach((item, index) => { - if (item.type === 'text') { // 鏂囨湰鎼滅储 + if (item.type === 'text') { fields.push( <Col span={24 / this.props.cols} key={index}> <Form.Item label={item.label}> diff --git a/src/index.js b/src/index.js index c325b21..033544f 100644 --- a/src/index.js +++ b/src/index.js @@ -43,15 +43,7 @@ ) } -if (sessionStorage.getItem('loginError')) { - try { - let res = JSON.parse(sessionStorage.getItem('loginError')) - console.info(res.request) - console.info(res.response) - } catch (e) {} -} sessionStorage.removeItem('isEditState') -sessionStorage.removeItem('loginError') sessionStorage.setItem('role_id', sessionStorage.getItem('localRole_id') || '') sessionStorage.setItem('dataM', sessionStorage.getItem('localDataM') || '') diff --git a/src/menu/components/card/cardcellcomponent/elementform/index.jsx b/src/menu/components/card/cardcellcomponent/elementform/index.jsx index 94e19cd..3406ca1 100644 --- a/src/menu/components/card/cardcellcomponent/elementform/index.jsx +++ b/src/menu/components/card/cardcellcomponent/elementform/index.jsx @@ -302,7 +302,7 @@ this.state.formlist.forEach((item, index) => { if (item.hidden || item.forbid) return - if (item.type === 'text') { // 鏂囨湰鎼滅储 + if (item.type === 'text') { fields.push( <Col span={12} key={index}> <Form.Item label={item.tooltip ? @@ -327,7 +327,7 @@ </Form.Item> </Col> ) - } else if (item.type === 'textarea') { // 鏂囨湰鎼滅储 + } else if (item.type === 'textarea') { fields.push( <Col span={24} className="textarea" key={index}> <Form.Item label={item.tooltip ? diff --git a/src/menu/components/form/formaction/actionform/index.jsx b/src/menu/components/form/formaction/actionform/index.jsx index f309fc7..baee983 100644 --- a/src/menu/components/form/formaction/actionform/index.jsx +++ b/src/menu/components/form/formaction/actionform/index.jsx @@ -149,7 +149,7 @@ this.state.formlist.forEach((item, index) => { if (item.hidden || item.forbid) return - if (item.type === 'text') { // 鏂囨湰鎼滅储 + if (item.type === 'text') { let _rules = [] if (item.key === 'innerFunc') { let str = '^(' + item.fields.join('|') + ')' diff --git a/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx b/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx index 50f3431..2f81f13 100644 --- a/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx +++ b/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx @@ -90,7 +90,7 @@ key: 'Width', min: 20, max: 1000, - decimal: 0, + precision: 0, label: Formdict['model.form.columnWidth'], initVal: card.Width || 120, required: true @@ -170,23 +170,139 @@ text: '鏄�' }] }, - // { - // type: 'radio', - // key: 'editType', - // label: '缂栬緫绫诲瀷', - // initVal: card.editType || 'text', - // required: true, - // options: [{ - // value: 'text', - // text: '鏂囨湰' - // }, { - // value: 'select', - // text: '涓嬫媺' - // }, { - // value: 'switch', - // text: '寮�鍏�' - // }] - // }, + { + type: 'radio', + key: 'editType', + label: '缂栬緫绫诲瀷', + initVal: card.editType || 'text', + required: true, + options: [{ + value: 'text', + text: '鏂囨湰' + }, { + value: 'select', + text: '涓嬫媺' + }, { + value: 'switch', + text: '寮�鍏�' + }] + }, + { + type: 'text', + key: 'initval', + label: '榛樿鍊�', + initVal: card.initval, + tooltip: '浣跨敤$copy鏃讹紝琛ㄧず鏂板鏃跺鍒朵笂涓�琛屼俊鎭��', + required: false + }, + { + type: 'text', + key: 'openVal', + label: '寮�鍚��', + initVal: card.openVal || '', + required: false + }, + { + type: 'text', + key: 'closeVal', + label: '鍏抽棴鍊�', + initVal: card.closeVal || '', + required: false + }, + { + type: 'text', + key: 'openText', + label: '寮�鍚彁绀�', + initVal: card.openText || '', + required: false + }, + { + type: 'text', + key: 'closeText', + label: '鍏抽棴鎻愮ず', + initVal: card.closeText || '', + required: false + }, + { + type: 'radio', + key: 'resourceType', + label: '閫夐」鏉ユ簮', + initVal: card.resourceType || '0', + required: true, + options: [{ + value: '0', + text: '鑷畾涔�' + }, { + value: '1', + text: '鏁版嵁婧�' + }] + }, + { + type: 'select', + key: 'editField', + label: '缂栬緫瀛楁', + initVal: card.editField || '', + tooltip: '褰撳�间笌鎻愮ず鏂囧瓧涓嶅悓鏃讹紝鍙澶栨坊鍔犵紪杈戝瓧娈碉紝浣滀负瀹為檯鍊肩殑褰曞叆瀛楁銆�', + allowClear: true, + required: false, + options: fields + }, + { + type: 'options', + key: 'options', + label: '閫夐」', + initVal: card.options || [], + required: true, + }, + { + type: 'codemirror', + key: 'dataSource', + label: '鏁版嵁婧�', + initVal: card.dataSource || '', + required: true, + }, + { + type: 'text', + key: 'valueField', + label: '鍊悸峰瓧娈�', + initVal: card.valueField || '', + required: true, + }, + { + type: 'text', + key: 'valueText', + label: '鏂囨湰路瀛楁', + initVal: card.valueText || '', + required: true, + }, + { + type: 'text', + key: 'orderBy', + label: '鎺掑簭路瀛楁', + initVal: card.orderBy || '', + required: false, + }, + { + type: 'select', + key: 'orderType', + label: '鎺掑簭鏂瑰紡', + initVal: card.orderType || 'asc', + options: [{ + value: 'asc', + text: Formdict['header.form.asc'] + }, { + value: 'desc', + text: Formdict['header.form.desc'] + }] + }, + { + type: 'text', + key: 'disableField', + label: '绂佺敤路瀛楁', + initVal: card.disableField || '', + tooltip: '璁剧疆绂佺敤瀛楁锛屼笖瀛楁鍊间负true鏃讹紝閫夐」涓嶅彲閫夈��', + required: false, + }, { type: 'radio', key: 'required', @@ -202,18 +318,24 @@ }] }, { - type: 'text', - key: 'initval', - label: '榛樿鍊�', - initVal: card.initval, - tooltip: '浣跨敤$copy鏃讹紝琛ㄧず鏂板鏃跺鍒朵笂涓�琛屼俊鎭��', - required: false + type: 'radio', + key: 'database', + label: '鏁版嵁搴�', + initVal: card.database || 'local', + options: [{ + value: 'local', + text: '鏈湴' + }, { + value: 'sso', + text: '绯荤粺' + }] }, { type: 'select', key: 'enter', label: '鍥炶溅鍒囨崲', initVal: card.enter || '$next', + tooltip: '鍖呮嫭鏂囨湰鎴栨暟鍊煎洖杞︿簨浠躲�佷笅鎷夎彍鍗曢�変腑浜嬩欢銆佸紑鍏冲垏鎹簨浠躲��', options: editCols }, { @@ -238,7 +360,7 @@ key: 'decimal', min: 0, max: 18, - decimal: 0, + precision: 0, label: Formdict['header.form.decimal'], initVal: card.decimal || 0, required: true @@ -302,7 +424,6 @@ label: Formdict['header.form.prefix'], initVal: card.prefix || '', required: false, - readonly: false }, { type: 'text', @@ -310,7 +431,6 @@ label: Formdict['header.form.postfix'], initVal: card.postfix || '', required: false, - readonly: false }, { type: 'radio', @@ -335,6 +455,14 @@ }, { type: 'multiselect', + key: 'linkSubField', + label: '濉厖琛ㄥ崟', + tooltip: '鍦ㄥ垏鎹㈤�夐」鏃朵細鎶婁俊鎭嚜鍔ㄥ~鍏ュ叧鑱旂殑瀛楁涓��', + initVal: card.linkSubField || [], + options: fields + }, + { + type: 'multiselect', key: 'blacklist', label: Formdict['header.form.blacklist'], initVal: card.blacklist || [], 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 8f7ea16..1af68b0 100644 --- a/src/menu/components/table/edit-table/columns/editColumn/index.jsx +++ b/src/menu/components/table/edit-table/columns/editColumn/index.jsx @@ -6,7 +6,10 @@ import { getColumnForm } from './formconfig' import { formRule } from '@/utils/option.js' +import CodeMirror from '@/templates/zshare/codemirror' +import EditTable from '@/templates/zshare/modalform/modaleditable' import './index.scss' + const { TextArea } = Input const columnTypeOptions = { @@ -33,9 +36,19 @@ state = { visible: false, formlist: null, + transfield: {} } column = null + + UNSAFE_componentWillMount() { + let transfield = {} + this.props.columns.forEach(item => { + transfield[item.field] = item.label + }) + + this.setState({transfield}) + } UNSAFE_componentWillReceiveProps (nextProps) { if (nextProps.column && !is(fromJS(this.props.column), fromJS(nextProps.column))) { @@ -48,7 +61,21 @@ if (this.column.editable === 'true') { if (this.column.type === 'text') { - _options.push('editType', 'required', 'enter', 'footEnter') + _options.push('editType') + + if (this.column.editType === 'switch') { + _options.push('enter', 'footEnter', 'openVal', 'closeVal', 'openText', 'closeText') + } else if (this.column.editType === 'select') { + _options.push('required', 'enter', 'footEnter', 'resourceType', 'linkSubField', 'editField') + + if (this.column.resourceType === '0') { + _options.push('options') + } else { + _options.push('dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'disableField', 'database') + } + } else { + _options.push('required', 'enter', 'footEnter') + } } else if (this.column.type === 'number') { _options.push('max', 'min', 'enter', 'footEnter') } @@ -61,6 +88,8 @@ let formlist = getColumnForm(column, this.props.fields, this.props.columns) this.column = fromJS(column).toJS() + this.column.editType = this.column.editType || 'text' + this.column.resourceType = this.column.resourceType || '0' let _options = this.getOptions() @@ -92,9 +121,7 @@ this.setState({ formlist: this.state.formlist.map(item => { - if (item.key === 'editable') { - item.initVal = this.column.editable || 'false' - } + item.initVal = this.column[item.key] || item.initVal item.hidden = !_options.includes(item.key) return item @@ -125,9 +152,7 @@ this.setState({ formlist: this.state.formlist.map(item => { - if (item.key === 'editable') { - item.initVal = this.column.editable || 'false' - } + item.initVal = this.column[item.key] || item.initVal item.hidden = !_options.includes(item.key) return item @@ -140,11 +165,12 @@ } } else if (key === 'format' && value === 'percent') { this.props.form.setFieldsValue({postfix: '%'}) - } else if (key === 'editable') { + } else if (key === 'editable' || key === 'editType' || key === 'resourceType') { let _options = this.getOptions() this.setState({ formlist: this.state.formlist.map(item => { + item.initVal = this.column[item.key] || item.initVal item.hidden = !_options.includes(item.key) return item @@ -153,9 +179,50 @@ } } + multiselectChange = (key, value) => { + if (key !== 'linkSubField') return + + this.column[key] = value + } + + handleEmpty = () => { + let field = this.props.form.getFieldValue('valueField') + + if (!field) { + notification.warning({ + top: 92, + message: '璇峰~鍐欏�悸峰瓧娈点��', + duration: 5 + }) + return + } + + let text = this.props.form.getFieldValue('valueText') + + if (!text) { + notification.warning({ + top: 92, + message: '璇峰~鍐欐枃鏈峰瓧娈点��', + duration: 5 + }) + return + } + + let resource = this.props.form.getFieldValue('dataSource') || '' + + resource = `select '' as ${field},'鍏ㄩ儴' as ${text} union all \n${resource}` + + this.props.form.setFieldsValue({dataSource: resource}) + } + + changeOptions = (data) => { + this.column.options = data || [] + } + getFields() { + const { dict } = this.props const { getFieldDecorator } = this.props.form - const { formlist } = this.state + const { formlist, transfield } = this.state const fields = [] if (!formlist) return null @@ -163,159 +230,113 @@ formlist.forEach((item, index) => { if (item.hidden || item.forbidden) return - if (item.type === 'text') { // 鏂囨湰鎼滅储 - let rules = [] - if (item.key !== 'linkurl') { - rules = [{ + let span = 12 + let rules = [] + let className = '' + let content = null + let extra = null + let initVal = item.initVal || '' + + if (item.type === 'text') { + rules = [ + { required: item.required, message: dict['form.required.input'] + item.label + '!' }, + { max: formRule.input.max, message: formRule.input.message - }] - } - fields.push( - <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal || '', - rules: [ - { - required: !!item.required, - message: this.props.dict['form.required.input'] + item.label + '!' - }, - ...rules - ] - })(<Input placeholder="" autoComplete="off" disabled={item.readonly} onPressEnter={this.handleSubmit} />)} - </Form.Item> - </Col> - ) + } + ] + + content = <Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} /> } else if (item.type === 'number') { - fields.push( - <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal, - rules: [ - { - required: !!item.required, - message: this.props.dict['form.required.input'] + item.label + '!' - } - ] - })(item.unlimit ? <InputNumber onPressEnter={this.handleSubmit}/> : - <InputNumber min={item.min} max={item.max} precision={item.decimal} onPressEnter={this.handleSubmit}/>)} - </Form.Item> - </Col> - ) + rules = [ + { required: item.required, message: dict['form.required.input'] + item.label + '!' } + ] + initVal = item.initVal + + if (!item.unlimit) { + content = <InputNumber min={item.min} max={item.max} precision={item.precision} onPressEnter={this.handleSubmit}/> + } else { + content = <InputNumber onPressEnter={this.handleSubmit}/> + } } else if (item.type === 'select') { - fields.push( - <Col span={12} key={index}> - <Form.Item label={item.label}> - {getFieldDecorator(item.key, { - initialValue: item.initVal || '', - rules: [ - { - required: !!item.required, - message: this.props.dict['form.required.select'] + item.label + '!' - } - ] - })( - <Select - showSearch - filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} - onChange={(value, option) => {this.typeChange(item.key, value, option)}} - getPopupContainer={() => document.getElementById('columnwinter')} - > - {item.options.map((option, index) => - <Select.Option key={index} datatype={option.datatype || ''} value={(option.value || option.field || option.MenuID)}> - {(option.text || option.label || option.MenuName)} - </Select.Option> - )} - </Select> - )} - </Form.Item> - </Col> - ) + rules = [ + { required: item.required, message: dict['form.required.select'] + item.label + '!' } + ] + content = <Select + showSearch + allowClear={item.allowClear === true} + filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} + onChange={(value, option) => {this.typeChange(item.key, value, option)}} + getPopupContainer={() => document.getElementById('edit-table-column-winter')} + > + {item.options.map((option, i) => + <Select.Option key={i} datatype={option.datatype || ''} value={(option.value || option.field || option.MenuID)}> + {(option.text || option.label || option.MenuName)} + </Select.Option> + )} + </Select> } else if (item.type === 'radio') { - fields.push( - <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal, - rules: [ - { - required: !!item.required, - message: this.props.dict['form.required.select'] + item.label + '!' - } - ] - })( - <Radio.Group onChange={(e) => {this.typeChange(item.key, e.target.value)}}> - { - item.options.map(option => { - return ( - <Radio key={option.value} value={option.value}>{option.text}</Radio> - ) - }) - } - </Radio.Group> - )} - </Form.Item> - </Col> - ) + rules = [ + { required: item.required, message: dict['form.required.select'] + item.label + '!' } + ] + initVal = item.initVal + + 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 === 'multiselect') { // 澶氶�� - fields.push( - <Col span={12} key={index}> - <Form.Item label={item.label}> - {getFieldDecorator(item.key, { - initialValue: item.initVal || [] - })( - <Select - showSearch - mode="multiple" - filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} - > - {item.options.map((option, i) => - <Select.Option id={i} key={i} value={option.value || option.field}>{option.text || option.label}</Select.Option> - )} - </Select> - )} - </Form.Item> - </Col> - ) - } else if (item.type === 'textarea') { // 鏂囨湰鎼滅储 - fields.push( - <Col span={24} key={index} className="textarea"> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal || '', - rules: [ - { - required: !!item.required, - message: this.props.dict['form.required.input'] + item.label + '!' - } - ] - })(<TextArea rows={2} disabled={item.readonly} placeholder={item.placeholder || ''} />)} - </Form.Item> - </Col> - ) + content = <Select + showSearch + mode="multiple" + filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} + onChange={(value) => this.multiselectChange(item.key, value)} + > + {item.options.map((option, i) => + <Select.Option key={i} value={option.value || option.field}>{option.text || option.label}</Select.Option> + )} + </Select> + } else if (item.type === 'textarea') { + span = 24 + className = 'text-area' + rules = [ + { required: item.required, message: dict['form.required.input'] + item.label + '!' } + ] + + content = <TextArea rows={item.rows || 2}/> + } else if (item.type === 'codemirror') { + rules = [ + { required: item.required, message: dict['form.required.input'] + item.label + '!' } + ] + span = 24 + className = 'text-area' + + extra = <span className="add-resource-empty" onClick={this.handleEmpty}>绌�</span> + + content = <CodeMirror /> + } else if (item.type === 'options') { + span = 24 + className = 'text-area' + + let linkSubFields = this.column.linkSubField || [] + + content = <EditTable type={'select'} module="form" transfield={transfield} linkSubFields={linkSubFields} onChange={this.changeOptions}/> } + + 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 + }> + {getFieldDecorator(item.key, { + initialValue: initVal, + rules: rules + })(content)} + </Form.Item> + </Col> + ) }) return fields } @@ -338,6 +359,8 @@ } this.setState({visible: false, formlist: null}) this.props.submitCol(values) + + this.column = null } }) } @@ -366,13 +389,13 @@ <Modal title="鏄剧ず鍒楃紪杈�" visible={visible} - width={800} + width={900} maskClosable={false} onOk={this.handleSubmit} onCancel={this.editModalCancel} destroyOnClose > - <Form {...formItemLayout} className="commontable-column-form" id="columnwinter"> + <Form {...formItemLayout} className="commontable-column-form" id="edit-table-column-winter"> <Row gutter={24}>{this.getFields()}</Row> </Form> </Modal> diff --git a/src/menu/components/table/edit-table/columns/editColumn/index.scss b/src/menu/components/table/edit-table/columns/editColumn/index.scss index 9885df8..e9dd7c5 100644 --- a/src/menu/components/table/edit-table/columns/editColumn/index.scss +++ b/src/menu/components/table/edit-table/columns/editColumn/index.scss @@ -6,12 +6,27 @@ padding-right: 3px; } } - .textarea { - .ant-form-item-label { - width: 12%; - } - .ant-form-item-control-wrapper { + .ant-form-item.text-area { + >.ant-form-item-control-wrapper { width: 88%; } + >.ant-form-item-label { + width: 12%; + } + .CodeMirror { + height: 150px; + } + } + .ant-form-extra { + padding-top: 0px; + min-height: 0px; + } + .add-resource-empty { + position: absolute; + right: 10px; + top: -25px; + color: #1890ff; + cursor: pointer; + font-size: 14px; } } diff --git a/src/menu/components/table/edit-table/options.jsx b/src/menu/components/table/edit-table/options.jsx index 3dcd8b3..307b6ca 100644 --- a/src/menu/components/table/edit-table/options.jsx +++ b/src/menu/components/table/edit-table/options.jsx @@ -146,6 +146,18 @@ ] }, { + type: 'radio', + field: 'cache', + label: '缂撳瓨', + initval: wrap.cache || 'true', + tooltip: '瀵逛簬浣跨敤鏁版嵁婧愮殑涓嬫媺鑿滃崟锛屼笅鎷夐�夐」鏄惁缂撳瓨鍒版湰鍦般��', + required: false, + options: [ + {value: 'true', label: '浣跨敤'}, + {value: 'false', label: '涓嶄娇鐢�'}, + ] + }, + { type: 'color', field: 'borderColor', label: '杈规棰滆壊', diff --git a/src/menu/components/table/normal-table/columns/editColumn/index.jsx b/src/menu/components/table/normal-table/columns/editColumn/index.jsx index 6222466..7aa7940 100644 --- a/src/menu/components/table/normal-table/columns/editColumn/index.jsx +++ b/src/menu/components/table/normal-table/columns/editColumn/index.jsx @@ -160,7 +160,7 @@ formlist.forEach((item, index) => { if (item.hidden || item.forbidden) return - if (item.type === 'text') { // 鏂囨湰鎼滅储 + if (item.type === 'text') { let rules = [] if (item.key !== 'linkurl') { rules = [{ @@ -313,7 +313,7 @@ </Form.Item> </Col> ) - } else if (item.type === 'textarea') { // 鏂囨湰鎼滅储 + } else if (item.type === 'textarea') { fields.push( <Col span={24} key={index} className="textarea"> <Form.Item label={item.tooltip ? diff --git a/src/menu/modulesource/option.jsx b/src/menu/modulesource/option.jsx index 1c30b6f..d640262 100644 --- a/src/menu/modulesource/option.jsx +++ b/src/menu/modulesource/option.jsx @@ -25,7 +25,7 @@ import chart from '@/assets/mobimg/chart.png' import tree from '@/assets/mobimg/tree.png' import timeline from '@/assets/mobimg/timeline.png' -import Voucher from '@/assets/mobimg/voucher.jpg' +// import Voucher from '@/assets/mobimg/voucher.jpg' // 缁勪欢閰嶇疆淇℃伅 export const menuOptions = [ @@ -58,5 +58,5 @@ { type: 'menu', url: Editor, component: 'editor', subtype: 'brafteditor', title: '瀵屾枃鏈�', width: 24, forbid: ['billPrint'] }, { type: 'menu', url: SandBox, component: 'code', subtype: 'sandbox', title: '鑷畾涔�', width: 24 }, { type: 'menu', url: group, component: 'group', subtype: 'normalgroup', title: '鍒嗙粍', width: 24, forbid: ['billPrint'] }, - { type: 'menu', url: Voucher, component: 'module', subtype: 'voucher', title: '鍑瘉', width: 24, forbid: ['billPrint'] }, + // { type: 'menu', url: Voucher, component: 'module', subtype: 'voucher', title: '鍑瘉', width: 24, forbid: ['billPrint'] }, ] diff --git a/src/menu/replaceField/index.jsx b/src/menu/replaceField/index.jsx index a295725..0fce450 100644 --- a/src/menu/replaceField/index.jsx +++ b/src/menu/replaceField/index.jsx @@ -201,6 +201,14 @@ return col }) } + if (m.verify && m.verify.columns) { + m.verify.columns = m.verify.columns.map(col => { + if (col.Column && map[col.Column.toLowerCase()]) { + col.Column = map[col.Column.toLowerCase()].FieldName + } + return col + }) + } }) } @@ -219,6 +227,14 @@ return col }) } + if (m.verify && m.verify.columns) { + m.verify.columns = m.verify.columns.map(col => { + if (col.Column && map[col.Column.toLowerCase()]) { + col.Column = map[col.Column.toLowerCase()].FieldName + } + return col + }) + } return m }) } @@ -232,6 +248,14 @@ m.modal.fields = m.modal.fields.map(col => { if (col.field && map[col.field.toLowerCase()]) { col.field = map[col.field.toLowerCase()].FieldName + } + return col + }) + } + if (m.verify && m.verify.columns) { + m.verify.columns = m.verify.columns.map(col => { + if (col.Column && map[col.Column.toLowerCase()]) { + col.Column = map[col.Column.toLowerCase()].FieldName } return col }) @@ -260,6 +284,14 @@ m.modal.fields = m.modal.fields.map(col => { if (col.field && map[col.field.toLowerCase()]) { col.field = map[col.field.toLowerCase()].FieldName + } + return col + }) + } + if (m.verify && m.verify.columns) { + m.verify.columns = m.verify.columns.map(col => { + if (col.Column && map[col.Column.toLowerCase()]) { + col.Column = map[col.Column.toLowerCase()].FieldName } return col }) @@ -323,6 +355,14 @@ return col }) } + if (m.verify && m.verify.columns) { + m.verify.columns = m.verify.columns.map(col => { + if (col.Column && map[col.Column.toLowerCase()]) { + col.Column = map[col.Column.toLowerCase()].FieldName + } + return col + }) + } return m }) @@ -361,6 +401,7 @@ } return col }) + config.search = config.search.map(col => { if (col.field && map[col.field.toLowerCase()]) { col.field = map[col.field.toLowerCase()].FieldName @@ -369,6 +410,18 @@ col.datefield = map[col.datefield.toLowerCase()].FieldName } return col + }) + + config.action = config.action.map(m => { + if (m.verify && m.verify.columns) { + m.verify.columns = m.verify.columns.map(col => { + if (col.Column && map[col.Column.toLowerCase()]) { + col.Column = map[col.Column.toLowerCase()].FieldName + } + return col + }) + } + return m }) } else if (this.props.type === 'form') { config.fields = config.fields.map(col => { @@ -439,6 +492,14 @@ return col }) } + if (m.verify && m.verify.columns) { + m.verify.columns = m.verify.columns.map(col => { + if (col.Column && map[col.Column.toLowerCase()]) { + col.Text = map[col.Column.toLowerCase()].FieldDec + } + return col + }) + } }) } @@ -451,6 +512,14 @@ m.modal.fields = m.modal.fields.map(col => { if (col.field && map[col.field.toLowerCase()]) { col.label = map[col.field.toLowerCase()].FieldDec + } + return col + }) + } + if (m.verify && m.verify.columns) { + m.verify.columns = m.verify.columns.map(col => { + if (col.Column && map[col.Column.toLowerCase()]) { + col.Text = map[col.Column.toLowerCase()].FieldDec } return col }) @@ -485,13 +554,25 @@ } return col }) - + config.search = config.search.map(col => { if (col.field && map[col.field.toLowerCase()]) { col.label = map[col.field.toLowerCase()].FieldDec } return col }) + + config.action = config.action.map(m => { + if (m.verify && m.verify.columns) { + m.verify.columns = m.verify.columns.map(col => { + if (col.Column && map[col.Column.toLowerCase()]) { + col.Text = map[col.Column.toLowerCase()].FieldDec + } + return col + }) + } + return m + }) } else if (this.props.type === 'form') { config.fields = config.fields.map(col => { if (col.field && map[col.field.toLowerCase()]) { diff --git a/src/mob/searchconfig/index.jsx b/src/mob/searchconfig/index.jsx index 127b319..795a7b0 100644 --- a/src/mob/searchconfig/index.jsx +++ b/src/mob/searchconfig/index.jsx @@ -516,7 +516,7 @@ <div className="am-navbar-title">{group.setting.title}</div> </div> : <div className="am-navbar"> {/* <LeftOutlined /> */} - <div className="search-bar"><SearchOutlined /></div> + <div className="search-bar"><SearchOutlined style={{marginRight: '10px'}}/>{group.setting.label || ''}</div> <Button >鍙栨秷</Button> </div>} {group.floor === 1 ? <PlusOutlined className="plus-group" onClick={this.plusGroup} /> : null} diff --git a/src/mob/searchconfig/settingform/index.jsx b/src/mob/searchconfig/settingform/index.jsx index 5dbc386..c064cdd 100644 --- a/src/mob/searchconfig/settingform/index.jsx +++ b/src/mob/searchconfig/settingform/index.jsx @@ -140,6 +140,19 @@ </Form.Item> </Col> : null} {type === 'search' ? <Col span={12}> + <Form.Item label="鎻愮ず鏂囧瓧"> + {getFieldDecorator('label', { + initialValue: config.setting.label, + rules: [ + { + max: formRule.input.max, + message: formRule.input.message + } + ] + })(<Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} />)} + </Form.Item> + </Col> : null} + {type === 'search' ? <Col span={12}> <Form.Item label="鍖归厤鏂瑰紡"> {getFieldDecorator('match', { initialValue: config.setting.match || 'like' diff --git a/src/tabviews/custom/components/table/edit-table/index.jsx b/src/tabviews/custom/components/table/edit-table/index.jsx index e598288..0018d0c 100644 --- a/src/tabviews/custom/components/table/edit-table/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/index.jsx @@ -56,6 +56,7 @@ let _data = null let _sync = _config.setting.sync === 'true' let setting = {..._config.setting, ..._config.wrap, style: {}} + setting.tableId = Utils.getuuid() if (_config.setting.sync === 'true' && data) { _data = data[_config.dataName] || [] @@ -81,7 +82,36 @@ _cols.set(item.field, item) }) + let _columns = [] + // let signAdd = false _config.cols.forEach(column => { + if (column.Hide === 'true') return + if (column.type === 'index') { + column.field = '$Index' + column.type = 'text' + } + + // if (setting.addable === 'true' && column.type !== 'action' && !signAdd) { + // column.addable = true + // signAdd = true + // } + + if (column.marks && column.marks.length === 0) { + column.marks = '' + } + + column.tableId = setting.tableId + + if (column.type === 'text' && column.editable === 'true' && column.editType === 'select') { + column.options = column.options || [] + column.options = column.options.filter(cell => { + cell.value = cell.Value + cell.label = cell.Text + + return !cell.Hide + }) + } + if (column.type === 'custom') { column.elements = column.elements.map(item => { if (item.eleType === 'number' && item.field && _cols.has(item.field) && typeof(item.decimal) !== 'number') { @@ -92,7 +122,17 @@ } else if (column.type === 'action') { column.operations = column.elements } + + _columns.push(column) }) + + // if (setting.delable !== 'false') { + // if (_columns[_columns.length - 1] && _columns[_columns.length - 1].type !== 'action') { + // _columns[_columns.length - 1].delable = true + // } else if (_columns[_columns.length - 2] && _columns[_columns.length - 2].type !== 'action') { + // _columns[_columns.length - 2].delable = true + // } + // } if (setting.color) { setting.style.color = setting.color @@ -116,7 +156,7 @@ setting: setting, searchlist: _config.search, actions: _config.action, - columns: _config.cols, + columns: _columns, arr_field: _config.columns.map(col => col.field).join(','), search: Utils.initMainSearch(_config.search) // 鎼滅储鏉′欢鍒濆鍖栵紙鍚湁鏃堕棿鏍煎紡锛岄渶瑕佽浆鍖栵級 }, () => { diff --git a/src/tabviews/custom/components/table/edit-table/normalTable/cusSwitch/index.jsx b/src/tabviews/custom/components/table/edit-table/normalTable/cusSwitch/index.jsx new file mode 100644 index 0000000..88e4302 --- /dev/null +++ b/src/tabviews/custom/components/table/edit-table/normalTable/cusSwitch/index.jsx @@ -0,0 +1,47 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +// import { is, fromJS } from 'immutable' +import { Switch } from 'antd' + +import './index.scss' + +class ColorSketch extends Component { + static propTpyes = { + defaultValue: 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 + this.props.onChange(_val) + }) + } + + render() { + const { config } = this.props + const { status } = this.state + return ( + <Switch checkedChildren={config.openText} autoFocus={true} onBlur={this.props.onBlur} unCheckedChildren={config.closeText} checked={status} onChange={this.changeStatus} /> + ) + } +} + +export default ColorSketch \ No newline at end of file diff --git a/src/tabviews/custom/components/table/edit-table/normalTable/cusSwitch/index.scss b/src/tabviews/custom/components/table/edit-table/normalTable/cusSwitch/index.scss new file mode 100644 index 0000000..96900ce --- /dev/null +++ b/src/tabviews/custom/components/table/edit-table/normalTable/cusSwitch/index.scss @@ -0,0 +1,40 @@ +.color-sketch-block { + height: 25px; + width: 100%; + + .color-sketch-block-box { + display: inline-block; + width: calc(100% - 160px); + height: 100%; + border-radius: 2px; + background: #ffffff url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg==') left center; + } + .color-sketch-block-inner { + display: inline-block; + cursor: pointer; + border-radius: 2px; + box-shadow: 0 0 0 1px rgba(0, 0, 0, .1); + width: 100%; + height: 100%; + } + .color-sketch-value { + display: inline-block; + width: 160px; + padding-left: 10px; + height: 25px; + line-height: 25px; + vertical-align: top; + white-space: nowrap; + overflow: visible; + } +} + +.color-sketch-popover { + z-index: 1090!important; + .ant-popover-inner-content { + padding: 0; + .sketch-picker { + width: 250px!important; + } + } +} \ No newline at end of file diff --git a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx index 1464bfa..59d6bd5 100644 --- a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx @@ -1,17 +1,19 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Table, Typography, Switch, Modal, Input, InputNumber, Tooltip, Button, notification, message } from 'antd' +import { Table, Typography, Switch, Modal, Input, InputNumber, Tooltip, Button, notification, message, Select } from 'antd' import { ExclamationCircleOutlined, EditOutlined, PlusOutlined } from '@ant-design/icons' import moment from 'moment' import Api from '@/api' +import options from '@/store/options.js' import asyncComponent from '@/utils/asyncComponent' import Utils, { getEditTableSql, getMark } from '@/utils/utils.js' import MkIcon from '@/components/mk-icon' import MKEmitter from '@/utils/events.js' import zhCN from '@/locales/zh-CN/main.js' import enUS from '@/locales/en-US/main.js' +import CusSwitch from './cusSwitch' import '@/assets/css/table.scss' import './index.scss' @@ -149,27 +151,34 @@ focus = () => { const { col, record } = this.props - let err = null - let val = record[col.field] !== undefined ? record[col.field] : '' - - if (col.type === 'number') { - val = +val - if (isNaN(val)) { - val = 0 + if (col.editType === 'switch' || col.editType === 'select') { + this.setState({editing: true}, () => { + let node = document.getElementById(col.uuid + record.$Index) + node && node.click() + }) + } else { + let err = null + let val = record[col.field] !== undefined ? record[col.field] : '' + + if (col.type === 'number') { + val = +val + if (isNaN(val)) { + val = 0 + } + if (typeof(col.max) === 'number' && val > col.max) { + err = col.label + '鏈�澶т负' + col.max + } else if (typeof(col.min) === 'number' && val < col.min) { + err = col.label + '鏈�灏忎负' + col.min + } + } else if (col.required === 'true' && !val) { + err = '璇峰~鍐�' + col.label } - if (typeof(col.max) === 'number' && val > col.max) { - err = col.label + '鏈�澶т负' + col.max - } else if (typeof(col.min) === 'number' && val < col.min) { - err = col.label + '鏈�灏忎负' + col.min - } - } else if (col.required === 'true' && !val) { - err = '璇峰~鍐�' + col.label + + this.setState({editing: true, value: val, err}, () => { + let node = document.getElementById(col.uuid + record.$Index) + node && node.select() + }) } - - this.setState({editing: true, value: val, err}, () => { - let node = document.getElementById(col.uuid + record.$Index) - node && node.select() - }) } onBlur = () => { @@ -202,6 +211,62 @@ err = '璇峰~鍐�' + col.label } this.setState({value: val, err}) + } + + onSwitchChange = (val) => { + const { col, record } = this.props + + this.setState({editing: false}) + + setTimeout(() => { + if (col.enter === '$next') { + MKEmitter.emit('nextLine', col, record.$Index) + } else { + MKEmitter.emit('tdFocus', col.enter + record.$Index) + } + }, 50) + + MKEmitter.emit('changeRecord', col.tableId, {...record, [col.field]: val}) + } + + onSelectChange = (val, option) => { + const { col, record } = this.props + + let values = {} + let _option = col.options.filter(m => m.key === option.key)[0] + + if (_option) { + if (col.linkSubField) { + col.linkSubField.forEach(m => { + values[m] = _option[m] !== undefined ? _option[m] : '' + }) + } + + if (col.editField) { + values[col.field] = _option.label + values[col.editField] = val + } else { + values[col.field] = val + } + } + + this.setState({editing: false}) + + setTimeout(() => { + if (col.enter === '$next') { + MKEmitter.emit('nextLine', col, record.$Index) + } else { + MKEmitter.emit('tdFocus', col.enter + record.$Index) + } + }, 50) + + MKEmitter.emit('changeRecord', col.tableId, {...record, ...values}) + } + + switchBlur = () => { + setTimeout(() => { + this.setState({editing: false}) + }, 10) } render() { @@ -241,10 +306,31 @@ if (col.editable === 'true') { if (editing) { - return (<td className="editing_table_cell"> - <Input id={col.uuid + record.$Index} defaultValue={value} onChange={(e) => this.onChange(e.target.value)} onPressEnter={this.enterPress} onBlur={this.onBlur}/> - {err ? <Tooltip title={err}><ExclamationCircleOutlined /></Tooltip> : null} - </td>) + if (!col.editType || col.editType === 'text') { + return (<td className="editing_table_cell"> + <Input id={col.uuid + record.$Index} defaultValue={value} onChange={(e) => this.onChange(e.target.value)} onPressEnter={this.enterPress} onBlur={this.onBlur}/> + {err ? <Tooltip title={err}><ExclamationCircleOutlined /></Tooltip> : null} + </td>) + } else if (col.editType === 'switch') { + let _value = record[col.field] !== undefined ? record[col.field] : '' + return (<td className="editing_table_cell"> + <CusSwitch config={col} defaultValue={_value} onChange={this.onSwitchChange} onBlur={this.switchBlur}/> + </td>) + } else { + let _value = record[col.field] !== undefined ? record[col.field] : '' + return (<td className="editing_table_cell"> + <Select + showSearch + defaultValue={_value} + id={col.uuid + record.$Index} + onBlur={() => this.setState({editing: false})} + filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} + onSelect={this.onSelectChange} + > + {col.options.map((item, i) => (<Select.Option key={item.key} disabled={item.$disabled} value={item.value}>{item.label}</Select.Option>))} + </Select> + </td>) + } } else { return (<td className={className + ' pointer'} style={style}><div className="mk-mask" onClick={this.focus}></div>{content}</td>) } @@ -384,6 +470,7 @@ ) } + // return (<td className={className} style={style}>{col.addable ? <PlusCircleOutlined className="mk-editable mk-plus"/> : null}{children}{col.delable ? <DeleteOutlined className="mk-editable mk-del"/> : null}</td>) return (<td className={className} style={style}>{children}</td>) } } @@ -425,31 +512,21 @@ let orderfields = {} let initEditLine = null let edColumns = [] - let tableId = (() => { - let uuid = [] - let _options = 'abcdefghigklmnopqrstuv' - for (let i = 0; i < 19; i++) { - uuid.push(_options.substr(Math.floor(Math.random() * 0x20), 1)) - } - return uuid.join('') - }) () let _columns = [] + let deForms = [] columns.forEach(item => { - if (item.Hide === 'true') return - if (item.type === 'index') { - item.field = '$Index' - item.type = 'text' - } - - item.tableId = tableId - if (!initEditLine && item.editable === 'true') { initEditLine = item } - if (item.marks && item.marks.length === 0) { - item.marks = '' + if (item.type === 'text' && item.editable === 'true' && item.editType === 'select' && item.resourceType === '1') { + let _option = Utils.getSelectQueryOptions(item) + + item.base_sql = window.btoa(window.encodeURIComponent(_option.sql)) + item.arr_field = _option.field + + deForms.push(item) } if (item.field) { @@ -481,22 +558,22 @@ _columns.push(_item) }) - if (setting.delable !== 'false') { - edColumns.push({ - align: 'center', - dataIndex: 'mkoperation', - title: '鎿嶄綔', - sorter: false, - width: 100, - onCell: record => ({ - record, - col: {type: 'operation', tableId: tableId}, - }) - }) - } + // if (setting.delable !== 'false') { + // edColumns.push({ + // align: 'center', + // dataIndex: 'mkoperation', + // title: '鎿嶄綔', + // sorter: false, + // width: 100, + // onCell: record => ({ + // record, + // col: {type: 'operation', tableId: setting.tableId}, + // }) + // }) + // } if (setting.borderColor) { // 杈规棰滆壊 - let style = `#${tableId} table, #${tableId} tr, #${tableId} th, #${tableId} td {border-color: ${setting.borderColor}}` + let style = `#${setting.tableId} table, #${setting.tableId} tr, #${setting.tableId} th, #${setting.tableId} td {border-color: ${setting.borderColor}}` let ele = document.createElement('style') ele.innerHTML = style document.getElementsByTagName('head')[0].appendChild(ele) @@ -516,10 +593,14 @@ data, columns: _columns, edColumns, - tableId, + tableId: setting.tableId, orderfields, initEditLine, editable: setting.editable + }, () => { + if (deForms.length > 0) { + this.improveActionForm(deForms) + } }) } @@ -530,19 +611,6 @@ componentDidMount () { const { fields, setting } = this.props const { data, editable } = this.state - - // let _fields = [] // 瀹氫箟鍏ㄩ儴瀛楁锛屼笉鍦ㄤ粠鍙紪杈戝垪涓�夊彇 - - // let fieldType = {} - // fields.forEach(item => { - // fieldType[item.field] = item.datatype - // }) - - // columns.forEach(col => { - // if (!col.field || col.type === 'index') return - - // _fields.push({...col, datatype: fieldType[col.field] || 'Nvarchar(50)'}) - // }) this.setState({ fields: fields.filter(item => item.field !== setting.primaryKey), @@ -583,6 +651,162 @@ } } } + + improveActionForm = (deForms) => { + const { BID, setting } = this.props + + let deffers = [] + let mainItems = [] // 浜戠鎴栧崟鐐规暟鎹� + let localItems = [] // 鏈湴鏁版嵁 + let cache = setting.cache !== 'false' + + deForms.forEach(item => { + if (item.database === 'sso') { + mainItems.push(`select '${item.uuid}' as obj_name,'${item.arr_field}' as arr_field,'${item.base_sql}' as LText`) + } else { + localItems.push(`select '${item.uuid}' as obj_name,'${item.arr_field}' as arr_field,'${item.base_sql}' as LText`) + } + }) + + if (options.sysType !== 'local') { + localItems = [...localItems, ...mainItems] + mainItems = [] + } + + // 鏈湴璇锋眰 + let param = { + func: 'sPC_Get_SelectedList', + LText: localItems.join(' union all '), + obj_name: '', + arr_field: '', + table_type: 'Y', + BID: BID || '' + } + + if (param.LText) { + param.LText = Utils.formatOptions(param.LText) + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + param.secretkey = Utils.encrypt(param.LText, param.timestamp) + + deffers.push( + new Promise(resolve => { + Api.getSystemCacheConfig(param, cache).then(res => { + if (!res.status) { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + } + resolve(res) + }) + }) + ) + } + + // 绯荤粺璇锋眰 + let mainparam = { + func: 'sPC_Get_SelectedList', + LText: mainItems.join(' union all '), + obj_name: '', + arr_field: '', + table_type: 'Y', + BID: BID || '' + } + + if (mainparam.LText) { + mainparam.LText = Utils.formatOptions(mainparam.LText) + mainparam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + mainparam.secretkey = Utils.encrypt(mainparam.LText, mainparam.timestamp) + + if (window.GLOB.mainSystemApi) { + mainparam.rduri = window.GLOB.mainSystemApi + } + + deffers.push( + new Promise(resolve => { + Api.getSystemCacheConfig(mainparam, cache).then(res => { + if (!res.status) { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + } + resolve(res) + }) + }) + ) + } + + Promise.all(deffers).then(response => { + let result = {...response[0], ...(response[1] || {})} + + delete result.ErrCode + delete result.ErrMesg + delete result.message + delete result.status + + this.resetFormList(result) + }) + } + + resetFormList = (result) => { + const { columns } = this.props + const { edColumns } = this.state + + let _edColumns = [] + + let reCols = {} + columns.forEach(item => { + if (item.resourceType === '1' && result[item.uuid] && result[item.uuid].length > 0) { + let options = [] + let _map = new Map() + result[item.uuid].forEach(cell => { + let _cell = {key: Utils.getuuid()} + + _cell.value = cell[item.valueField] + _cell.label = cell[item.valueText] + + if (!_cell.label && _cell.label !== 0) return + + if (_map.has(_cell.value)) return + _map.set(_cell.value, true) + + if (item.linkSubField) { + item.linkSubField.forEach(m => { + _cell[m] = cell[m] === undefined ? '' : cell[m] + }) + } + + if (item.disableField && cell[item.disableField] && /^true$/ig.test(cell[item.disableField])) { + _cell.$disabled = true + } + + options.push(_cell) + }) + + item.options = options + + reCols[item.uuid] = item + } + }) + + _edColumns = edColumns.map(item => { + if (reCols[item.dataIndex]) { + item.onCell = record => ({ + record, + col: reCols[item.dataIndex] + }) + } + + return item + }) + + this.setState({edColumns: []}, () => { + this.setState({edColumns: _edColumns}) + }) + } nextLine = (col, index) => { const { setting } = this.props diff --git a/src/tabviews/custom/components/table/edit-table/normalTable/index.scss b/src/tabviews/custom/components/table/edit-table/normalTable/index.scss index 044156a..b0dfbaa 100644 --- a/src/tabviews/custom/components/table/edit-table/normalTable/index.scss +++ b/src/tabviews/custom/components/table/edit-table/normalTable/index.scss @@ -135,20 +135,6 @@ } } } - .fix-header { - .ant-table-body { - min-height: unset - } - .ant-table-placeholder { - display: none; - } - .ant-table-wrapper { - display: none; - } - .ant-affix .ant-table-wrapper { - display: block; - } - } .ant-input { border: none; box-shadow: none!important; @@ -181,6 +167,22 @@ bottom: 0px; border: 1px solid #1890ff; } + .ant-select { + padding: 0px; + position: absolute; + top: 0px; + left: 0px; + right: 0px; + bottom: 0px; + .ant-select-selection { + height: 100%; + border-radius: 0; + + .ant-select-arrow { + display: none; + } + } + } .ant-input-number-input { position: absolute; top: 0px; @@ -210,6 +212,15 @@ right: 0; } } + .mk-editable { + display: inline-block; + } + .mk-plus { + position: absolute; + top: 45%; + left: -20px; + color: #1890ff; + } } .edit-custom-table.editable { td { diff --git a/src/templates/formtabconfig/actionform/index.jsx b/src/templates/formtabconfig/actionform/index.jsx index 7f4b88b..2c3ae5b 100644 --- a/src/templates/formtabconfig/actionform/index.jsx +++ b/src/templates/formtabconfig/actionform/index.jsx @@ -243,7 +243,7 @@ this.state.formlist.forEach((item, index) => { if (item.hidden) return - if (item.type === 'text') { // 鏂囨湰鎼滅储 + if (item.type === 'text') { let _rules = [] if (item.key === 'innerFunc') { let str = '^(' + item.fields.join('|') + ')' @@ -290,7 +290,7 @@ </Form.Item> </Col> ) - } else if (item.type === 'number') { // 鏂囨湰鎼滅储 + } else if (item.type === 'number') { fields.push( <Col span={12} key={index}> <Form.Item label={item.tooltip ? diff --git a/src/templates/modalconfig/menuform/index.jsx b/src/templates/modalconfig/menuform/index.jsx index aa09a7c..aa1b4bd 100644 --- a/src/templates/modalconfig/menuform/index.jsx +++ b/src/templates/modalconfig/menuform/index.jsx @@ -13,7 +13,7 @@ const { getFieldDecorator } = this.props.form const fields = [] this.props.formlist.forEach((item, index) => { - if (item.type === 'text') { // 鏂囨湰鎼滅储 + if (item.type === 'text') { fields.push( <Col span={24} key={index}> <Form.Item label={item.label}> diff --git a/src/templates/sharecomponent/chartgroupcomponent/chartform/index.jsx b/src/templates/sharecomponent/chartgroupcomponent/chartform/index.jsx index eb1f155..0c9ffd3 100644 --- a/src/templates/sharecomponent/chartgroupcomponent/chartform/index.jsx +++ b/src/templates/sharecomponent/chartgroupcomponent/chartform/index.jsx @@ -294,7 +294,7 @@ this.state.formlist.forEach((item, index) => { if (item.hidden) return - if (item.type === 'text') { // 鏂囨湰鎼滅储 + if (item.type === 'text') { fields.push( <Col span={12} key={index}> <Form.Item label={item.tooltip ? diff --git a/src/templates/sharecomponent/columncomponent/columnform/index.jsx b/src/templates/sharecomponent/columncomponent/columnform/index.jsx index 2991a73..a69897e 100644 --- a/src/templates/sharecomponent/columncomponent/columnform/index.jsx +++ b/src/templates/sharecomponent/columncomponent/columnform/index.jsx @@ -141,7 +141,7 @@ this.state.formlist.forEach((item, index) => { if (item.hidden) return - if (item.type === 'text') { // 鏂囨湰鎼滅储 + if (item.type === 'text') { let rules = [] if (item.key === 'field' || item.key === 'nameField') { rules = [{ @@ -178,7 +178,7 @@ </Form.Item> </Col> ) - } else if (item.type === 'textarea') { // 鏂囨湰鎼滅储 + } else if (item.type === 'textarea') { fields.push( <Col span={24} key={index} className="textarea"> <Form.Item label={item.tooltip ? diff --git a/src/templates/sharecomponent/columncomponent/gridbtnform/index.jsx b/src/templates/sharecomponent/columncomponent/gridbtnform/index.jsx index eada117..9fa3613 100644 --- a/src/templates/sharecomponent/columncomponent/gridbtnform/index.jsx +++ b/src/templates/sharecomponent/columncomponent/gridbtnform/index.jsx @@ -74,7 +74,7 @@ const { getFieldDecorator } = this.props.form const fields = [] this.state.formlist.forEach((item, index) => { - if (item.type === 'text') { // 鏂囨湰鎼滅储 + if (item.type === 'text') { fields.push( <Col span={12} key={index}> <Form.Item label={item.label}> @@ -94,7 +94,7 @@ </Form.Item> </Col> ) - } else if (item.type === 'number') { // 鏂囨湰鎼滅储 + } else if (item.type === 'number') { fields.push( <Col span={12} key={index}> <Form.Item label={item.label}> diff --git a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx b/src/templates/sharecomponent/searchcomponent/searchform/index.jsx index 2a7e48b..a1adcca 100644 --- a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx +++ b/src/templates/sharecomponent/searchcomponent/searchform/index.jsx @@ -431,7 +431,7 @@ let extra = null let initVal = item.initVal || '' - if (item.type === 'text') { // 鏂囨湰鎼滅储 + if (item.type === 'text') { let type = this.record.type rules = [ { required: item.required, message: dict['form.required.input'] + item.label + '!' } @@ -501,7 +501,7 @@ className = 'text-area' if (this.record.type === 'select' || this.record.type === 'link') { - extra = <span className="add-row-empty" onClick={this.handleEmpty}>鍏ㄩ儴</span> + extra = <span className="add-resource-empty" onClick={this.handleEmpty}>鍏ㄩ儴</span> } content = <CodeMirror /> diff --git a/src/templates/sharecomponent/searchcomponent/searchform/index.scss b/src/templates/sharecomponent/searchcomponent/searchform/index.scss index 13ef700..b1ed736 100644 --- a/src/templates/sharecomponent/searchcomponent/searchform/index.scss +++ b/src/templates/sharecomponent/searchcomponent/searchform/index.scss @@ -36,7 +36,7 @@ padding-top: 0px; min-height: 0px; } - .add-row-empty { + .add-resource-empty { position: absolute; right: 10px; top: -25px; diff --git a/src/templates/zshare/menuform/index.jsx b/src/templates/zshare/menuform/index.jsx index 302ad7e..d6bd07f 100644 --- a/src/templates/zshare/menuform/index.jsx +++ b/src/templates/zshare/menuform/index.jsx @@ -44,7 +44,7 @@ const { getFieldDecorator } = this.props.form const fields = [] this.state.formlist.forEach((item, index) => { - if (item.type === 'text') { // 鏂囨湰鎼滅储 + if (item.type === 'text') { fields.push( <Col span={24} key={index}> <Form.Item label={item.label}> diff --git a/src/templates/zshare/modalform/index.jsx b/src/templates/zshare/modalform/index.jsx index 87f09d5..acfb617 100644 --- a/src/templates/zshare/modalform/index.jsx +++ b/src/templates/zshare/modalform/index.jsx @@ -545,7 +545,7 @@ className = 'text-area' if (this.record.type === 'select' || this.record.type === 'link') { - extra = <span className="add-row-empty" onClick={this.handleEmpty}>绌�</span> + extra = <span className="add-resource-empty" onClick={this.handleEmpty}>绌�</span> } content = <CodeMirror /> diff --git a/src/templates/zshare/modalform/index.scss b/src/templates/zshare/modalform/index.scss index ecb16e5..6df9194 100644 --- a/src/templates/zshare/modalform/index.scss +++ b/src/templates/zshare/modalform/index.scss @@ -38,7 +38,7 @@ padding-top: 0px; min-height: 0px; } - .add-row-empty { + .add-resource-empty { position: absolute; right: 10px; top: -25px; diff --git a/src/utils/utils.js b/src/utils/utils.js index 24ebbb6..5cfdffc 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -2048,6 +2048,7 @@ let icon = null let color = null let position = null + style = JSON.parse(JSON.stringify(style)) marks.some(mark => { let originVal = record[mark.field[0]] + '' diff --git a/src/views/login/index.jsx b/src/views/login/index.jsx index 9c08b0d..9887c94 100644 --- a/src/views/login/index.jsx +++ b/src/views/login/index.jsx @@ -312,6 +312,27 @@ // if (!res || !res.ip) return // sessionStorage.setItem('ipAddress', res.ip) // }) + if (sessionStorage.getItem('loginError')) { + try { + let res = JSON.parse(sessionStorage.getItem('loginError')) + console.info(res.url) + console.info(res.request) + console.info(res.response) + + let result = JSON.parse(res.response) + + notification.warning({ + top: 92, + message: result.message, + duration: 5 + }) + } catch (e) {} + + setTimeout(() => { + sessionStorage.removeItem('loginError') + }, 1500) + } + const _addressUrl = window.location.href.split('#')[0] + 'queryAddress' if (localStorage.getItem(_addressUrl) !== 'true') { -- Gitblit v1.8.0