Commit 11d92c10 authored by 田翔's avatar 田翔

fix: 台账列表站点过滤

parent e8eccee4
{
"name": "panda-xform",
"version": "4.3.9",
"description": "4.3.9 兼容性增强",
"version": "4.4.0",
"description": "4.4.0 台账列表站点过滤调整",
"keywords": [
"panda-xform"
],
......
......@@ -211,24 +211,28 @@ const Account = (props) => {
setSubmitLoading(true)
if (type === '添加') {
let params = { accountTable: accountName, id: operation.id, values: formValue, relationForm }
const { code, data } = await SaveTableDataInfo(params)
const { code, data, msg } = await SaveTableDataInfo(params)
if (code === 0) {
message.success('保存成功!')
setSubmitLoading(false)
setDetailShow(false)
getDataSource()
} else {
message.error(msg)
}
}
if (type === '编辑') {
let params = { accountTable: accountName, id: operation.id, values: formValue, relationForm }
const { code, data } = await EditTableDataInfo(params)
const { code, data, msg } = await EditTableDataInfo(params)
if (code === 0) {
message.success('修改成功!')
setSubmitLoading(false)
setDetailShow(false)
getDataSource()
} else {
message.error(msg)
}
}
setSubmitLoading(false)
}
const search = (values) => {
......@@ -239,6 +243,7 @@ const Account = (props) => {
const { code, data } = await GetAccountConfigInfo(accountName)
if (code === 0) {
setConfig({ ...data, formJson: isJson(data.formJson) ? JSON.parse(data.formJson) : {} })
getDataSource({ siteFilter: Boolean(data.enableSiteFilter) })
}
}
......@@ -259,11 +264,6 @@ const Account = (props) => {
getDataSource({ pageIndex, pageSize })
}
const getData = () => {
getConfig()
getDataSource()
}
const tableChange = (page, filters, sorter) => {
let queryWheres = []
Object.keys(filters).forEach(k => {
......@@ -286,7 +286,7 @@ const Account = (props) => {
}
useEffect(() => {
getData()
getConfig()
}, [])
return (
......
......@@ -10,10 +10,11 @@ import Drag from '../../../components/Drag'
const AccountSelector = (props) => {
console.log('props', props)
const userID = window?.globalConfig?.userInfo?.OID || 1
const { value, onChange, schema, addons } = props
const { disabled, accountName, fieldshine, siteFilter, sql, isMultiple, presetValue, placeholder, fieldList } = schema
const initParams = { userID: userID, accountName, sortFields: '录入时间', direction: 'desc', total: 0, pageIndex: 1, pageSize: 100 }
const initParams = { userID: userID, accountName, sortFields: '录入时间', direction: 'desc', total: 0, pageIndex: 1, pageSize: 100, siteFilter }
const [params, setParams] = useState(initParams)
const [loading, setLoading] = useState(false)
......@@ -32,7 +33,7 @@ const AccountSelector = (props) => {
return message.info('请配置映射字段!')
}
setVisible(true)
getDataSource()
getConfig()
}
}
......@@ -40,30 +41,17 @@ const AccountSelector = (props) => {
const { code, data } = await GetAccountConfigInfo(accountName);
if (code == 0) {
setConfig({ ...data, formJson: isJson(data.formJson) ? JSON.parse(data.formJson) : {} })
getDataSource()
}
}
const getDataSource = async (outParams = {}) => {
let queryWheres = [];
if (siteFilter) {
const { code, data } = await getStationListByUserID(...[userID, false]);
if (code === 0) {
queryWheres = [
{
field: '所属站点',
type: '包括',
value: data.join(',')
}
];
}
}
setLoading(true);
let param = {
userID: userID,
accountName: accountName,
condition: sql ? window.btoa(encodeURIComponent(sql)) : '',
sortFields: '录入时间',
queryWheres: queryWheres,
...params,
...outParams,
};
......@@ -161,7 +149,6 @@ const AccountSelector = (props) => {
useEffect(() => {
if (addons) {
addons.setValue(addons.dataPath, presetValue)
getConfig()
} else {
onChange(presetValue)
}
......
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