Commit 248b636c authored by 田翔's avatar 田翔

fix: 台账列表增加人员id,SQL过滤增加变量配置

parent 5e92e62b
{
"name": "panda-xform",
"version": "4.0.2",
"description": "4.0.2: 文本默认本人部门问题",
"version": "4.0.3",
"description": "4.0.3: 台账列表增加人员id,SQL过滤增加变量配置",
"keywords": [
"panda-xform"
],
......
......@@ -1766,7 +1766,7 @@ const businessWidgets = [
required: true,
dependencies: ['accountName', '$id'],
default: [],
description: '单字段映射支持多选,多字段映射仅支持单选',
description: '多字段映射仅支持单选',
},
siteFilter: {
title: '站点过滤',
......@@ -1792,7 +1792,7 @@ const businessWidgets = [
title: 'SQL过滤',
name: 'SQL过滤',
type: 'string',
widget: 'textarea',
widget: 'SqlFilter',
props: {
placeholder: '示例:部门="XX部门"'
}
......@@ -1801,19 +1801,14 @@ const businessWidgets = [
title: '必填',
type: 'boolean',
default: false,
width: '31%',
props: {
style: {
marginLeft: '10px',
}
}
width: '33%',
},
disabled: {
title: '只读',
type: 'boolean',
widget: 'checkbox',
default: false,
width: '23%',
width: '33%',
},
...groupStyle,
}
......
......@@ -37,6 +37,7 @@ const getFormDataObj = (formData) => {
const RelationForm = (props) => {
const userID = window?.globalConfig?.userInfo?.OID || 1;
const codes = window?.pandaXform?.codes || {}
const { value, onChange, schema, addons } = props
const { disabled, '台账名称': accountName, '默认显示': defaultShow, '控制规则': controlShow, titleShow, '映射字段': mappedField } = schema
......@@ -269,6 +270,7 @@ const RelationForm = (props) => {
message.info('映射字段配置错误!')
}
let params = {
userID: userID,
accountName: accountName,
direction: 'desc',
timeField: '录入时间',
......
......@@ -83,6 +83,7 @@ const AccountSelector = (props) => {
}
setLoading(true);
let param = {
userID: userID,
accountName: accountName,
condition: sql ? window.btoa(encodeURIComponent(sql)) : '',
sortFields: '录入时间',
......
import React, { useState } from 'react'
import { Input, Modal, Dropdown, Menu } from 'antd'
import styles from './index.less'
import Drag from '../../../../components/Drag'
const fnList = [
{ label: '本人姓名', value: '$本人姓名' },
{ label: '本人ID', value: '$本人ID' },
{ label: '本人部门', value: '$本人部门' },
{ label: '本人部门ID', value: '$本人部门ID' },
]
const SqlFilter = (props) => {
const { value, onChange, addons } = props
const [visible, setVisible] = useState(false)
const [inputValue, setInputValue] = useState('')
const onFocus = () => {
setInputValue(value || '')
setVisible(true)
}
const insertFn = text => {
let ednIndex = document.getElementById('SqlFilter').selectionEnd
let rangeIndex = document.getElementById('SqlFilter').selectionStart
setInputValue(`${inputValue.slice(0, rangeIndex)}${text}${inputValue.slice(rangeIndex)}`)
rangeIndex += text.toString().length
ruleText.current.focus()
}
const onOk = () => {
onChange(inputValue)
}
const fnListRender = (
<Menu>
{fnList.map(item => (
<Menu.Item key={item.value} onClick={() => insertFn(item.value)}>
{item.label}
</Menu.Item>
))}
</Menu>
)
return (
<div className={styles.sqlFilter}>
<Input.TextArea
value={value}
onClick={onFocus}
style={{ width: '100%' }}
rows={4}
placeholder='示例:部门="XX部门"'
/>
<Drag
onCancel={() => setVisible(false)}
onOk={onOk}
title={'SQL过滤'}
visible={visible}
>
<div className={styles.textAreaBox}>
<Input.TextArea
id="SqlFilter"
value={inputValue}
onChange={(e) => setInputValue(e.target.value)}
rows={4}
placeholder='示例:部门="XX部门"'
/>
<Dropdown overlay={fnListRender} placement="bottom" arrow>
<div className={styles.insertFn}>自定义变量</div>
</Dropdown>
</div>
</Drag>
</div>
)
}
export default SqlFilter
\ No newline at end of file
.sqlFilter {
width: 100%;
.textAreaBox {
position: relative;
.insertFn {
position: absolute;
bottom: 10px;
right: 10px;
border: 1px solid #1890FF;
padding: 2px 15px;
border-radius: 5px;
z-index: 1;
cursor: pointer;
}
textArea {
max-height: 360px !important;
min-height: 250px !important;
border: 1px solid transparent;
background-color: #F0F2F6;
}
}
}
\ No newline at end of file
......@@ -10,6 +10,7 @@ import FieldName from './FieldName'
import CalculateRule from './CalculateRule'
import AddressSync from './AddressSync'
import SimpleList from './SimpleList'
import SqlFilter from './SqlFilter'
const groupSource = {
Dictionary,
......@@ -24,6 +25,7 @@ const groupSource = {
CalculateRule,
AddressSync,
SimpleList,
SqlFilter,
}
export default groupSource
\ No newline at end of file
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