Commit 2cbc5f62 authored by 田翔's avatar 田翔

细节优化

parent 8bd9ec06
{ {
"name": "panda-xform", "name": "panda-xform",
"version": "2.0.3", "version": "2.0.4",
"description": "2.0.3: 修复编码报错问题", "description": "2.0.4: 细节优化",
"keywords": [ "keywords": [
"panda-xform" "panda-xform"
], ],
......
import React, { useEffect, useState, useRef } from 'react' import React, { useState, useRef } from 'react'
import { Modal, Input, Form, message, Dropdown, Menu, Tree } from 'antd' import { Modal, Input, message, Dropdown, Menu, Tree } from 'antd'
import styles from './index.less' import styles from './index.less'
import { getTableNumberList, getFormFieldAnalysisDtos } from '../../../../../apis/process' import { getTableNumberList, getFormFieldAnalysisDtos } from '../../../../../apis/process'
import { isObject } from '../../../../../utils' import { isObject } from '../../../../../utils'
...@@ -17,7 +17,7 @@ const fnList = [ ...@@ -17,7 +17,7 @@ const fnList = [
{ label: '向上取整', value: '$math.floor()' }, { label: '向上取整', value: '$math.floor()' },
] ]
const ControlRules = (props) => { const CalculateRule = (props) => {
const { value, onChange, addons } = props const { value, onChange, addons } = props
const { parent, name } = addons.formData const { parent, name } = addons.formData
...@@ -41,13 +41,17 @@ const ControlRules = (props) => { ...@@ -41,13 +41,17 @@ const ControlRules = (props) => {
} }
} }
setFieldList(array) setFieldList(array)
if (array.length > 0) {
setVisible(true)
} else {
message.error('无可用字段')
}
} else { } else {
message.error(msg) message.error(msg)
} }
} }
const inputClick = () => { const inputClick = () => {
setVisible(true)
getFieldList() getFieldList()
setRule(value || '') setRule(value || '')
if (value) { if (value) {
...@@ -165,4 +169,4 @@ const ControlRules = (props) => { ...@@ -165,4 +169,4 @@ const ControlRules = (props) => {
} }
export default ControlRules export default CalculateRule
import React, { useEffect, useState, useRef } from 'react' import React, { useState, useRef } from 'react'
import { Modal, Input, Form, message, Dropdown, Menu, Tree } from 'antd' import { Modal, Input, message, Dropdown, Menu, Tree } from 'antd'
import styles from './index.less' import styles from './index.less'
import { ReloadTableFields, ruleValidation } from '../../../../../apis/process' import { ReloadTableFields, ruleValidation } from '../../../../../apis/process'
...@@ -109,43 +109,47 @@ const ControlRules = (props) => { ...@@ -109,43 +109,47 @@ const ControlRules = (props) => {
destroyOnClose destroyOnClose
getContainer={false} getContainer={false}
> >
<div className={styles.configContent}> {
<div className={styles.leftTree}> parent?.tableName ? (
<Tree <div className={styles.configContent}>
blockNode <div className={styles.leftTree}>
defaultExpandedKeys={[parent.tableName]} <Tree
autoExpandParent={true} blockNode
onSelect={onSelect} defaultExpandedKeys={[parent.tableName]}
selectedKeys={[currentSelectId]} autoExpandParent={true}
treeData={fieldList} onSelect={onSelect}
/> selectedKeys={[currentSelectId]}
</div> treeData={fieldList}
<div className={styles.rightContent}> />
<div className={styles.textAreaBox}> </div>
<Dropdown overlay={fnListRender} placement="bottom" arrow> <div className={styles.rightContent}>
<div className={styles.insertFn}>插入函数</div> <div className={styles.textAreaBox}>
</Dropdown> <Dropdown overlay={fnListRender} placement="bottom" arrow>
<TextArea <div className={styles.insertFn}>插入函数</div>
id="ruleText" </Dropdown>
autoSize={{ minRows: 19, maxRows: 19 }} <TextArea
value={rule} id="ruleText"
rows={4} autoSize={{ minRows: 19, maxRows: 19 }}
ref={ruleText} value={rule}
onChange={e => setRule(e.target.value)} rows={4}
/> ref={ruleText}
onChange={e => setRule(e.target.value)}
/>
</div>
<ul className={styles.tipBox}>
<li>
<p>请从左侧面板选择字段或选项</p>
<p>
{'支持'} <i>英文</i> {'模式下运算符(+、-、*、/><==!=<=>='}
</p>
</li>
<li>{`示例:{表名.是否缴费} = ‘是’ and {表名.缴费金额} > 1000`}</li>
</ul>
</div>
</div> </div>
) : null
<ul className={styles.tipBox}> }
<li>
<p>请从左侧面板选择字段或选项</p>
<p>
{'支持'} <i>英文</i> {'模式下运算符(+、-、*、/><==!=<=>='}
</p>
</li>
<li>{`示例:{表名.是否缴费} = ‘是’ and {表名.缴费金额} > 1000`}</li>
</ul>
</div>
</div>
</Modal> </Modal>
</div> </div>
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment