Commit eb02c310 authored by 彭俊龙's avatar 彭俊龙

站点选择器默认选项逻辑优化

parent e11438b3
{ {
"name": "panda-xform", "name": "panda-xform",
"version": "6.10.27", "version": "6.10.29",
"description": "6.10.27 描述控件增加跟随某个字段同步隐藏属性", "description": "6.10.29 站点选择器默认选项逻辑优化",
"keywords": [ "keywords": [
"panda-xform" "panda-xform"
], ],
......
...@@ -30,7 +30,7 @@ const ComboBox = (props) => { ...@@ -30,7 +30,7 @@ const ComboBox = (props) => {
const [dictionaryList, setDictionaryList] = useState([]) const [dictionaryList, setDictionaryList] = useState([])
const [tableData, setTableData] = useState([]) const [tableData, setTableData] = useState([])
const [site, setSite] = useState([]) const [site, setSite] = useState([])
console.log(schema, value, 'ssssaweq');
useEffect(() => { useEffect(() => {
if (addons) { if (addons) {
addons.setValue(addons.dataPath, presetValue || '') addons.setValue(addons.dataPath, presetValue || '')
...@@ -59,16 +59,7 @@ const ComboBox = (props) => { ...@@ -59,16 +59,7 @@ const ComboBox = (props) => {
case '表数据': case '表数据':
return Array.isArray(tableData) ? tableData : [] return Array.isArray(tableData) ? tableData : []
case '站点': case '站点':
if(Array.isArray(site)){ return Array.isArray(site) ? site : []
if(siteSelect && siteSelect.length > 0){
let stationIds = siteSelect.map(s=> s+'')
return site.filter(s=> stationIds.includes(s.stationID))
}else{
return site;
}
}else{
return []
}
default: default:
return [] return []
} }
...@@ -129,7 +120,11 @@ const ComboBox = (props) => { ...@@ -129,7 +120,11 @@ const ComboBox = (props) => {
const { code, data, msg } = await getStationIDListByUserID(userID, !isMySite) const { code, data, msg } = await getStationIDListByUserID(userID, !isMySite)
if (code === 0) { if (code === 0) {
if (Array.isArray(data)) { if (Array.isArray(data)) {
let values = data.map(v => ({ stationID: v.stationID + '', stationName: v.stationName })) let _data = data;
if(sourceType === '站点' && siteSelect && siteSelect.length > 0){
_data = _data.filter(s=> siteSelect.includes(s.stationID))
}
let values = _data.map(v => ({ stationID: v.stationID + '', stationName: v.stationName }))
setSite(values) setSite(values)
if (!value && !presetValue && !formDisabled) { if (!value && !presetValue && !formDisabled) {
onChange(values[0][isStoreID ? 'stationID' : 'stationName']) onChange(values[0][isStoreID ? 'stationID' : 'stationName'])
......
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