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

fix: 台账列表站点过滤

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