From 41accaed7b2260f9033701f048b5b65b01a6369d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 21 十一月 2023 15:42:19 +0800 Subject: [PATCH] 2023-11-21 --- src/menu/components/chart/antv-bar/chartcompile/index.jsx | 309 +++++++++++++++++++-------------- src/utils/utils-datamanage.js | 18 + src/tabviews/custom/components/chart/antv-bar-line/index.jsx | 98 +++++++++- src/tabviews/zshare/topSearch/index.jsx | 12 + src/templates/zshare/formconfig.jsx | 1 src/menu/datasource/index.jsx | 3 src/tabviews/zshare/topSearch/mkSelect/index.jsx | 6 src/tabviews/custom/popview/index.jsx | 9 src/menu/components/chart/antv-bar/index.jsx | 13 + src/tabviews/custom/index.jsx | 14 + src/views/billprint/index.jsx | 9 src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx | 2 src/utils/utils.js | 3 src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx | 2 src/templates/sharecomponent/searchcomponent/searchform/index.jsx | 36 ++++ 15 files changed, 371 insertions(+), 164 deletions(-) diff --git a/src/menu/components/chart/antv-bar/chartcompile/index.jsx b/src/menu/components/chart/antv-bar/chartcompile/index.jsx index 4604d38..b6ddf6e 100644 --- a/src/menu/components/chart/antv-bar/chartcompile/index.jsx +++ b/src/menu/components/chart/antv-bar/chartcompile/index.jsx @@ -137,133 +137,7 @@ } }, ], - cusColumns: [ - { - title: '鎸囨爣', - dataIndex: 'name', - editable: false, - width: '14%' - }, - { - title: '褰㈢姸', - dataIndex: 'shape', - inputType: 'cascader', - editable: true, - width: '12%', - render: (text, record) => { - return text.join(' / ').replace('line', '鎶樼嚎').replace('bar', '鏌卞舰') - }, - options: [ - { - value: 'line', - label: '鎶樼嚎', - children: [ - { value: 'smooth', label: 'smooth' }, - { value: 'line', label: 'line' }, - { value: 'dot', label: 'dot' }, - { value: 'dash', label: 'dash' }, - { value: 'hv', label: 'hv' }, - { value: 'vh', label: 'vh' }, - { value: 'hvh', label: 'hvh' }, - { value: 'vhv', label: 'vhv' } - ] - }, - { - value: 'bar', - label: '鏌卞舰', - children: [ - { value: 'rect', label: 'rect' }, - { value: 'hollow-rect', label: 'hollow-rect' }, - { value: 'line', label: 'line' }, - { value: 'tick', label: 'tick' }, - { value: 'funnel', label: 'funnel' }, - { value: 'pyramid', label: 'pyramid' } - ], - } - ] - }, - { - title: '鍧愭爣杞�', - dataIndex: 'axis', - inputType: 'select', - editable: true, - width: '12%', - options: [ - { value: 'true', text: '鏄剧ず'}, - { value: 'false', text: '闅愯棌'} - ], - render: (text, record) => { - let trans = {'true': '鏄剧ず', 'false': '闅愯棌'} - return trans[text] || '闅愯棌' - } - }, - { - title: '鏍囨敞', - dataIndex: 'label', - inputType: 'select', - editable: true, - width: '12%', - options: [ - { value: 'true', text: '鏄剧ず'}, - { value: 'false', text: '闅愯棌'} - ], - render: (text, record) => { - let trans = {'true': '鏄剧ず', 'false': '闅愯棌'} - return trans[text] || '' - } - }, - { - title: '鏍囬', - dataIndex: 'title', - inputType: 'select', - editable: true, - required: false, - width: '12%', - options: [ - { value: 'true', text: '鏄剧ず'}, - { value: 'false', text: '闅愯棌'} - ], - render: (text, record) => { - let trans = {'true': '鏄剧ず', 'false': '闅愯棌'} - return trans[text] || '' - } - }, - { - title: '鏄剧ず锛堝��/%锛�', - dataIndex: 'show', - inputType: 'select', - editable: true, - required: false, - width: '12%', - options: [ - { value: 'value', text: '鏁板��'}, - { value: 'percent', text: '鐧惧垎姣�'}, - { value: 'thdSeparator', text: '鍗冨垎浣�'} - ], - render: (text, record) => { - let trans = {value: '鏁板��', percent: '鐧惧垎姣�', thdSeparator: '鍗冨垎浣�'} - return trans[text] || '' - } - }, - { - title: '鏈�灏忓��', - dataIndex: 'min', - inputType: 'number', - editable: true, - max: 9999999999, - required: false, - width: '12%' - }, - { - title: '鏈�澶у��', - dataIndex: 'max', - inputType: 'number', - editable: true, - max: 9999999999, - required: false, - width: '12%' - }, - ] + cusColumns: [] } showDrawer = () => { @@ -302,6 +176,18 @@ } } + if (!plot.zoomYaxis && plot.customs) { + plot.customs.forEach(item => { + if (item.min || item.min === 0) { + plot.zoomYaxis = 'custom' + } else if (item.max || item.max === 0) { + plot.zoomYaxis = 'custom' + } + }) + } + + plot.zoomYaxis = plot.zoomYaxis || 'default' + this.setState({ visible: true, view: 'base', @@ -310,7 +196,8 @@ fieldName: fieldName, plot: plot, baseFormlist: getBaseForm(plot, config.columns), - formlist: getOptionForm(plot, config.columns) + formlist: getOptionForm(plot, config.columns), + cusColumns: this.getCusColumns(plot.zoomYaxis) }) } @@ -494,6 +381,153 @@ this.setState({plot: {...plot, enabled: val}}) } + zoomChange = (e) => { + const { plot } = this.state + let val = e.target.value + + this.setState({plot: {...plot, zoomYaxis: val}, cusColumns: this.getCusColumns(val)}) + } + + getCusColumns = (zoomYaxis) => { + let cusColumns = [ + { + title: '鎸囨爣', + dataIndex: 'name', + editable: false, + width: '12%' + }, + { + title: '褰㈢姸', + dataIndex: 'shape', + inputType: 'cascader', + editable: true, + width: '12%', + render: (text, record) => { + return text.join(' / ').replace('line', '鎶樼嚎').replace('bar', '鏌卞舰') + }, + options: [ + { + value: 'line', + label: '鎶樼嚎', + children: [ + { value: 'smooth', label: 'smooth' }, + { value: 'line', label: 'line' }, + { value: 'dot', label: 'dot' }, + { value: 'dash', label: 'dash' }, + { value: 'hv', label: 'hv' }, + { value: 'vh', label: 'vh' }, + { value: 'hvh', label: 'hvh' }, + { value: 'vhv', label: 'vhv' } + ] + }, + { + value: 'bar', + label: '鏌卞舰', + children: [ + { value: 'rect', label: 'rect' }, + { value: 'hollow-rect', label: 'hollow-rect' }, + { value: 'line', label: 'line' }, + { value: 'tick', label: 'tick' }, + { value: 'funnel', label: 'funnel' }, + { value: 'pyramid', label: 'pyramid' } + ], + } + ] + }, + { + title: '鍧愭爣杞�', + dataIndex: 'axis', + inputType: 'select', + editable: true, + width: '12%', + options: [ + { value: 'true', text: '鏄剧ず'}, + { value: 'false', text: '闅愯棌'} + ], + render: (text, record) => { + let trans = {'true': '鏄剧ず', 'false': '闅愯棌'} + return trans[text] || '闅愯棌' + } + }, + { + title: '鏍囨敞', + dataIndex: 'label', + inputType: 'select', + editable: true, + width: '12%', + options: [ + { value: 'true', text: '鏄剧ず'}, + { value: 'false', text: '闅愯棌'} + ], + render: (text, record) => { + let trans = {'true': '鏄剧ず', 'false': '闅愯棌'} + return trans[text] || '' + } + }, + { + title: '鏍囬', + dataIndex: 'title', + inputType: 'select', + editable: true, + required: false, + width: '12%', + options: [ + { value: 'true', text: '鏄剧ず'}, + { value: 'false', text: '闅愯棌'} + ], + render: (text, record) => { + let trans = {'true': '鏄剧ず', 'false': '闅愯棌'} + return trans[text] || '' + } + }, + { + title: '鏄剧ず锛堝��/%锛�', + dataIndex: 'show', + inputType: 'select', + editable: true, + required: false, + width: '12%', + options: [ + { value: 'value', text: '鏁板��'}, + { value: 'percent', text: '鐧惧垎姣�'}, + { value: 'thdSeparator', text: '鍗冨垎浣�'} + ], + render: (text, record) => { + let trans = {value: '鏁板��', percent: '鐧惧垎姣�', thdSeparator: '鍗冨垎浣�'} + return trans[text] || '' + } + }, + { + title: '鏈�灏忓��', + dataIndex: 'min', + inputType: 'number', + editable: true, + max: 9999999999, + required: false, + width: '12%' + }, + { + title: '鏈�澶у��', + dataIndex: 'max', + inputType: 'number', + editable: true, + max: 9999999999, + required: false, + width: '12%' + }, + ] + + if (zoomYaxis !== 'custom') { + cusColumns.pop() + cusColumns.pop() + cusColumns.forEach(item => { + item.width = '16%' + }) + } + + return cusColumns + } + mutilBarChange = (e) => { const { plot } = this.state let val = e.target.value @@ -540,8 +574,8 @@ _plot.customs = [] delete _plot.Yaxis } else if (!is(fromJS(values.Yaxis), fromJS(plot.Yaxis || []))) { - _plot.enabled = 'false' - _plot.colors = null + // _plot.enabled = 'false' + // _plot.colors = null let labels = {} config.columns.forEach(col => { @@ -872,7 +906,7 @@ </div> </TabPane> : null} {plot ? <TabPane tab="鑷畾涔夊浘褰㈣缃�" disabled={datatype === 'statistics'} key="custom"> - <Col span={12}> + <Col span={8}> <Form {...formItemLayout}> <Form.Item label="鏄惁鍚敤" style={{marginBottom: 10}}> <Radio.Group value={plot.enabled || 'false'} onChange={this.enabledChange}> @@ -882,7 +916,7 @@ </Form.Item> </Form> </Col> - <Col span={12}> + <Col span={8}> <Form {...formItemLayout}> <Form.Item label="澶氭煴鎺掑垪" style={{marginBottom: 10}}> <Radio.Group value={plot.mutilBar || 'dodge'} onChange={this.mutilBarChange}> @@ -893,6 +927,17 @@ </Form.Item> </Form> </Col> + <Col span={8}> + <Form {...formItemLayout}> + <Form.Item label="Y杞村尯闂�" style={{marginBottom: 10}}> + <Radio.Group value={plot.zoomYaxis} onChange={this.zoomChange}> + <Radio value="default">榛樿</Radio> + <Radio value="custom">鑷畾涔�</Radio> + <Radio value="adjust">鑷�傚簲</Radio> + </Radio.Group> + </Form.Item> + </Form> + </Col> <Col style={{fontSize: '12px', color: '#757575', paddingLeft: '10px'}} span={24}>娉細浣跨敤鑷畾涔夎缃椂锛屾樉绀虹殑鍧愭爣杞寸涓�涓湪宸︿晶锛岀浜屼釜鍦ㄥ彸渚э紝澶氫綑鐨勪笉鐢熸晥銆�</Col> <EditTable indexShow={false} actions={['edit', 'move']} data={plot.customs || []} columns={cusColumns} onChange={this.changeCustom}/> </TabPane> : null} diff --git a/src/menu/components/chart/antv-bar/index.jsx b/src/menu/components/chart/antv-bar/index.jsx index 7d21460..f206035 100644 --- a/src/menu/components/chart/antv-bar/index.jsx +++ b/src/menu/components/chart/antv-bar/index.jsx @@ -1335,6 +1335,17 @@ this.updateComponent(_card) } + plotchange = (card) => { + if (card.plot.enabled === 'true' && card.plot.zoomYaxis !== 'custom' && card.plot.customs) { + card.plot.customs.forEach(item => { + item.min = '' + item.max = '' + }) + } + + this.updateComponent(card) + } + clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { e.stopPropagation() @@ -1359,7 +1370,7 @@ <div className="mk-popover-control"> {appType !== 'mob' ? <PlusCircleOutlined className="plus" title="娣诲姞鎼滅储" onClick={this.addSearch}/> : null} {appType !== 'mob' ? <PlusSquareOutlined className="plus" title="娣诲姞鎸夐挳" onClick={this.addButton}/> : null} - <ChartCompileForm config={card} plotchange={this.updateComponent}/> + <ChartCompileForm config={card} plotchange={this.plotchange}/> <CopyComponent type="line" card={card}/> <PasteComponent config={card} options={['action', 'search']} updateConfig={this.updateComponent} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> diff --git a/src/menu/datasource/index.jsx b/src/menu/datasource/index.jsx index 31909af..0121e76 100644 --- a/src/menu/datasource/index.jsx +++ b/src/menu/datasource/index.jsx @@ -212,6 +212,9 @@ if (config.subtype !== 'dualdatacard') { delete res.subColumns + if (config.type === 'interface') { + res.setting.laypage = 'false' + } } else { res.subColumns = res.subColumns.map(item => { if (/int/ig.test(item.datatype)) { diff --git a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx index 16d88bb..0566da8 100644 --- a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx +++ b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx @@ -160,6 +160,12 @@ _config.plot.$label = label } + + if (_config.plot.zoomYaxis === 'adjust' && _config.plot.mutilBar === 'stack') { + if (_config.plot.Bar_axis) { + _config.plot.zoomFields = _config.plot.Yaxis.filter(cell => !_config.plot.Bar_axis.includes(cell)) + } + } } else { _config.plot.enabled = 'false' } @@ -1191,6 +1197,41 @@ */ customrender = (data) => { const { plot, transfield } = this.state + + let max = 0 + if (plot.zoomYaxis === 'adjust') { + data.forEach(item => { + if (plot.zoomFields) { + plot.zoomFields.forEach(f => { + if (item[f] > max) { + max = item[f] + } + }) + let sum = 0 + plot.Bar_axis.forEach(f => { + sum += item[f] + }) + if (sum > max) { + max = sum + } + } else { + plot.Yaxis.forEach(f => { + if (item[f] > max) { + max = item[f] + } + }) + } + }) + + if (!isNaN(max)) { + max = Math.ceil(max) + let s = Math.pow(10, (max + '').length - 1) + max = Math.ceil(max / s) * s + } else { + max = 0 + } + } + const ds = new DataSet() const dv = ds.createView().source(data) @@ -1303,11 +1344,19 @@ range: [0, 0.9] } - if (plot.min || plot.min === 0) { - c.min = plot.min - } - if (plot.max || plot.max === 0) { - c.max = plot.max + if (plot.zoomYaxis === 'adjust') { + if (max) { + c.min = 0 + c.max = max + } + } else { + if (plot.min || plot.min === 0) { + c.min = plot.min + } + if (plot.max || plot.max === 0) { + c.max = plot.max + c.min = c.min || 0 + } } view1.scale('value', c) view1.axis('value', plot.$yc) @@ -1318,7 +1367,7 @@ let colorIndex = 0 - if (plot.adjust !== 'stack') { + if (plot.mutilBar !== 'stack') { let _chart = view1 .interval() .position(`${plot.Xaxis}*value`) @@ -1386,7 +1435,7 @@ if (plot.barRadius) { _chart.style({ radius: [plot.barRadius, plot.barRadius, 0, 0] }) } - } else if (plot.adjust === 'stack') { + } else if (plot.mutilBar === 'stack') { let _chart = view1 .interval() .position(`${plot.Xaxis}*value`) @@ -1478,11 +1527,18 @@ range: [0, 0.9] } - if (item.min || item.min === 0) { - c.min = item.min - } - if (item.max || item.max === 0) { - c.max = item.max + if (plot.zoomYaxis === 'adjust') { + if (max) { + c.min = 0 + c.max = max + } + } else { + if (item.min || item.min === 0) { + c.min = item.min + } + if (item.max || item.max === 0) { + c.max = item.max + } } view2.scale(item.name, c) @@ -1544,11 +1600,18 @@ range: [0, 0.9] } - if (item.min || item.min === 0) { - c.min = item.min - } - if (item.max || item.max === 0) { - c.max = item.max + if (plot.zoomYaxis === 'adjust') { + if (max) { + c.min = 0 + c.max = max + } + } else { + if (item.min || item.min === 0) { + c.min = item.min + } + if (item.max || item.max === 0) { + c.max = item.max + } } view2.scale(item.name, c) @@ -1695,6 +1758,7 @@ } if (plot.max || plot.max === 0) { c.max = plot.max + c.min = c.min || 0 } chart.scale(_valfield, c) diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index 6e6ddab..89b981b 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -1065,6 +1065,8 @@ component.setting.arr_field = component.columns ? component.columns.map(col => col.field).join(',') : '' component.setting.useMSearch = component.setting.useMSearch === 'true' + component.setting.laypage = component.setting.laypage === 'true' // 鏄惁鍒嗛〉锛岃浆涓篵oolean 缁熶竴鏍煎紡 + if (component.setting.useMSearch) { if (!window.GLOB.SearchBox.has(component.$searchId)) { component.setting.useMSearch = false @@ -1077,10 +1079,14 @@ component.setting.sync = 'false' } + if (component.format === 'object') { + component.setting.laypage = false + component.setting.$top = true + } + if (component.setting.interType !== 'system') { // 涓嶄娇鐢ㄧ郴缁熷嚱鏁版椂 component.setting.sync = 'false' component.setting.dataresource = '' - component.setting.laypage = component.setting.laypage === 'true' return component } @@ -1101,8 +1107,7 @@ delete component.scripts component.setting.$name = component.$menuname || '' component.setting.execute = component.setting.execute !== 'false' // 榛樿sql鏄惁鎵ц锛岃浆涓篵oolean 缁熶竴鏍煎紡 - component.setting.laypage = component.setting.laypage === 'true' // 鏄惁鍒嗛〉锛岃浆涓篵oolean 缁熶竴鏍煎紡 - + if (!component.setting.execute) { component.setting.dataresource = '' } @@ -1218,6 +1223,8 @@ inter.setting.onload = 'false' } + inter.setting.laypage = false + inter.setting.$top = true inter.setting.useMSearch = inter.setting.useMSearch === 'true' inter.setting.arr_field = inter.columns.map(col => col.field).join(',') @@ -1241,7 +1248,6 @@ inter.setting.$name = '鍏叡鏁版嵁婧�-' + inter.setting.name inter.setting.execute = inter.setting.execute !== 'false' - inter.setting.laypage = true if (!inter.setting.execute) { inter.setting.dataresource = '' diff --git a/src/tabviews/custom/popview/index.jsx b/src/tabviews/custom/popview/index.jsx index 3bbee80..0dd6bfd 100644 --- a/src/tabviews/custom/popview/index.jsx +++ b/src/tabviews/custom/popview/index.jsx @@ -754,6 +754,8 @@ component.setting.arr_field = component.columns ? component.columns.map(col => col.field).join(',') : '' component.setting.useMSearch = component.setting.useMSearch === 'true' + component.setting.laypage = component.setting.laypage === 'true' // 鏄惁鍒嗛〉锛岃浆涓篵oolean 缁熶竴鏍煎紡 + if (component.setting.useMSearch) { if (!window.GLOB.SearchBox.has(component.$searchId)) { component.setting.useMSearch = false @@ -762,10 +764,14 @@ } } + if (component.format === 'object') { + component.setting.laypage = false + component.setting.$top = true + } + if (component.setting.interType !== 'system') { // 涓嶄娇鐢ㄧ郴缁熷嚱鏁版椂 component.setting.sync = 'false' component.setting.dataresource = '' - component.setting.laypage = component.setting.laypage === 'true' return component } @@ -786,7 +792,6 @@ delete component.scripts component.setting.$name = component.$menuname || '' component.setting.execute = component.setting.execute !== 'false' // 榛樿sql鏄惁鎵ц锛岃浆涓篵oolean 缁熶竴鏍煎紡 - component.setting.laypage = component.setting.laypage === 'true' // 鏄惁鍒嗛〉锛岃浆涓篵oolean 缁熶竴鏍煎紡 if (!component.setting.execute) { component.setting.dataresource = '' diff --git a/src/tabviews/zshare/topSearch/index.jsx b/src/tabviews/zshare/topSearch/index.jsx index 29db100..eda97f6 100644 --- a/src/tabviews/zshare/topSearch/index.jsx +++ b/src/tabviews/zshare/topSearch/index.jsx @@ -426,6 +426,7 @@ } resetSearch = (result) => { + let trigger = false let _searchlist = fromJS(this.state.searchlist).toJS().map(item => { if (['select', 'link', 'multiselect', 'checkcard', 'radio'].includes(item.type) && result[item.field] && result[item.field].length > 0) { let options = [] @@ -491,12 +492,23 @@ item.options = item.oriOptions } + if (item.$first && item.options.length > 0) { + item.initval = item.options[0].Value + trigger = true + } + return item }) this.setState({ searchlist: _searchlist }) + + if (trigger) { + setTimeout(() => { + this.handleSubmit() + }, 10) + } } recordChange = (val, defer, item) => { diff --git a/src/tabviews/zshare/topSearch/mkSelect/index.jsx b/src/tabviews/zshare/topSearch/mkSelect/index.jsx index be6c57b..87000f4 100644 --- a/src/tabviews/zshare/topSearch/mkSelect/index.jsx +++ b/src/tabviews/zshare/topSearch/mkSelect/index.jsx @@ -46,6 +46,12 @@ config: fromJS(nextProps.config).toJS(), options: fromJS(nextProps.config.options).toJS() }) + + if (config.$first && nextProps.config.initval) { + this.setState({ + value: nextProps.config.initval + }) + } } } diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx index 180710c..40af7ca 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx @@ -901,7 +901,7 @@ } key="excelcolumn"> <ColumnForm columnChange={this.columnChange}/> <Button className="excel-col-add mk-green" title="娣诲姞鏄剧ず鍒楀瓧娈�" onClick={this.columnFieldInput}> - 鍚屾鏄剧ず鍒� + 鍚屾瀛楁闆� </Button> <Button className="excel-col-add mk-red" title="娓呯┖Excel鍒�" onClick={this.clearField}> 娓呯┖Excel鍒� diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx index 6555fcc..b42893e 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx @@ -965,7 +965,7 @@ } key="columns"> <ColumnForm columnChange={this.columnChange}/> <Button className="excel-col-add mk-green" title="娣诲姞鏄剧ず鍒楀瓧娈�" onClick={this.columnFieldInput}> - 鍚屾鏄剧ず鍒� + 鍚屾瀛楁闆� </Button> <Button className="excel-col-add mk-red" title="娓呯┖Excel鍒�" onClick={this.clearField}> 娓呯┖Excel鍒� diff --git a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx b/src/templates/sharecomponent/searchcomponent/searchform/index.jsx index 6bfcbce..2a87811 100644 --- a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx +++ b/src/templates/sharecomponent/searchcomponent/searchform/index.jsx @@ -288,6 +288,25 @@ reLabel.field = '绫诲瀷瀛楁' } + reTooltip.initval = '' + if (type === 'select') { + if (this.record.resourceType === '0') { + reTooltip.initval = '鍒濆鍊煎簲涓烘暟鎹殑Value鍊硷紝鍙娇鐢ˊusername@銆丂fullName@' + } else if (this.record.resourceType === '1') { + reTooltip.initval = '鍒濆鍊煎簲涓恒�婂�悸峰瓧娈点�嬬殑鍊硷紝鍙娇鐢ˊusername@銆丂fullName@銆�$first銆傛敞锛氫娇鐢�$first鏃讹紝鎼滅储鏉′欢搴斾负蹇呭~銆�' + } + } else if (type === 'link') { + if (this.record.resourceType === '0') { + reTooltip.initval = '鍒濆鍊煎簲涓烘暟鎹殑Value鍊笺��' + } else if (this.record.resourceType === '1') { + reTooltip.initval = '鍒濆鍊煎簲涓恒�婂�悸峰瓧娈点�嬬殑鍊硷紝鍙娇鐢�$first銆傛敞锛氫娇鐢�$first鏃讹紝鎼滅储鏉′欢搴斾负蹇呭~銆�' + } + } else if (type === 'text') { + reTooltip.initval = '鍙娇鐢ˊusername@銆丂fullName@銆�' + } else if (type === 'range') { + reTooltip.initval = '浣跨敤閫楀彿鎷兼帴锛屼緥濡� 3,10' + } + return { shows, reOptions, @@ -690,6 +709,23 @@ values.field = values.field.join(',') } + if (['select', 'link'].includes(values.type)) { + if (values.resourceType === '1') { + if (/\$first/.test(values.initval) && values.initval.replace(/\s/g, '') === '$first') { + values.initval = '$first' + } + + if (values.initval === '$first' && values.required !== 'true') { + notification.warning({ + top: 92, + message: '浣跨敤$first鏃讹紝鎼滅储鏉′欢搴斾负蹇呭~锛�', + duration: 5 + }) + return + } + } + } + // 涓嬫媺鑿滃崟鎴栬仈鍔ㄨ彍鍗� if (['multiselect', 'select', 'link', 'radio'].includes(values.type)) { if (values.resourceType === '0') { diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index 7cd8e72..16eda0b 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -166,7 +166,6 @@ type: 'text', key: 'initval', label: '鍒濆鍊�', - tooltip: '绫诲瀷涓轰笅鎷夎彍鍗曟椂锛屽垵濮嬪�煎簲涓烘暟鎹殑Value鍊硷紙浣跨敤鏁版嵁婧愭椂锛屽簲涓恒�婂�悸峰瓧娈点�嬬殑鍊硷級;绫诲瀷涓烘暟鍊硷紙鍖洪棿锛夋椂锛屽垵濮嬪�间娇鐢ㄩ�楀彿鎷兼帴锛屼緥濡� 3,10锛涙枃鏈笌涓嬫媺鑿滃崟涓彲浣跨敤@username@銆丂fullName@', initVal: card.initval, required: false }, diff --git a/src/utils/utils-datamanage.js b/src/utils/utils-datamanage.js index 4544fe1..a06bc3f 100644 --- a/src/utils/utils-datamanage.js +++ b/src/utils/utils-datamanage.js @@ -204,8 +204,14 @@ } else { DateCount = `/*system_query*/select count(1) as total from ${_dataresource} ${_search}` } + } else if (setting.$top) { + if (orderBy) { + LText = `/*system_query*/select top 1 ${arr_field} from ${_dataresource} ${_search} order by ${orderBy} ` + } else { + LText = `/*system_query*/select top 1 ${arr_field} from ${_dataresource} ${_search} ` + } } else if (orderBy) { - LText = `/*system_query*/select ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows ` + LText = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search} order by ${orderBy} ` } else { LText = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search} ` } @@ -458,8 +464,14 @@ _search = _search ? 'where ' + _search : '' } - if (setting.order && _dataresource) { - _dataresource = `select top 1000 ${setting.arr_field} from (select ${setting.arr_field} ,ROW_NUMBER() over(order by ${setting.order}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows ` + if (setting.$top) { + if (setting.order && _dataresource) { + _dataresource = `select top 1 ${setting.arr_field} from ${_dataresource} ${_search} order by ${setting.order} ` + } else if (_dataresource) { + _dataresource = `select top 1 ${setting.arr_field} from ${_dataresource} ${_search} ` + } + } else if (setting.order && _dataresource) { + _dataresource = `select top 1000 ${setting.arr_field} from ${_dataresource} ${_search} order by ${setting.order} ` } else if (_dataresource) { _dataresource = `select top 1000 ${setting.arr_field} from ${_dataresource} ${_search} ` } diff --git a/src/utils/utils.js b/src/utils/utils.js index 7c45ab0..438788a 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -348,6 +348,9 @@ item.initval = '' item.initType = '' } + } else if ((item.type === 'select' || item.type === 'link') && item.initval === '$first' && item.resourceType === '1') { + item.initval = '' + item.$first = true } item.oriInitval = item.initval diff --git a/src/views/billprint/index.jsx b/src/views/billprint/index.jsx index 4ef6821..d7d4ea9 100644 --- a/src/views/billprint/index.jsx +++ b/src/views/billprint/index.jsx @@ -461,6 +461,11 @@ if (!component.format) return component // 娌℃湁鍔ㄦ�佹暟鎹� 鏁版嵁鏍煎紡 array 鎴� object component.setting.arr_field = component.columns ? component.columns.map(col => col.field).join(',') : '' + component.setting.laypage = false // 鏄惁鍒嗛〉锛岃浆涓篵oolean 缁熶竴鏍煎紡 + + if (component.format === 'object') { + component.setting.$top = true + } if (component.setting.interType !== 'system') { // 涓嶄娇鐢ㄧ郴缁熷嚱鏁版椂 component.setting.sync = 'false' @@ -484,7 +489,6 @@ delete component.scripts component.setting.execute = component.setting.execute !== 'false' // 榛樿sql鏄惁鎵ц锛岃浆涓篵oolean 缁熶竴鏍煎紡 - component.setting.laypage = false // 鏄惁鍒嗛〉锛岃浆涓篵oolean 缁熶竴鏍煎紡 component.setting.onload = 'true' // 榛樿鍔犺浇 if (!component.setting.execute) { @@ -673,7 +677,8 @@ inter.setting.$name = '鍏叡鏁版嵁婧�-' + inter.setting.name inter.setting.execute = inter.setting.execute !== 'false' - inter.setting.laypage = true + inter.setting.laypage = false + inter.setting.$top = true if (!inter.setting.execute) { inter.setting.dataresource = '' -- Gitblit v1.8.0