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

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

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