wujingjing
2024-04-22 f106e4dffb8279cb90726e83e7edd631f4c77699
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { ElMessage } from 'element-plus';
import { getDefaultLogicPolicyStd } from '/@/api/phm/logicPolicyStd';
import { GetLogicTreeListByPolicyIDStd } from '/@/api/phm/logicTreeStd';
import { LOGIC_SITE_CODE } from '/@/constants';
import { getSite } from '/@/projectCom/components/manage/utils';
 
export const getSiteData = (resetAllContent: Function) => {
    return getDefaultLogicPolicyStd().then(async (data) => {
        if (typeof data !== 'undefined') {
            const res = await GetLogicTreeListByPolicyIDStd({
                PolicyID: data.ID,
            });
 
            if (res?.Code === 0) {
                const resData = (res.Data || []) as [];
                return resData;
            } else {
                ElMessage.error('获取泵站列表失败' + (res?.Message ? `,${JSON.stringify(res.Message)}` : ''));
                resetAllContent?.();
            }
        } else {
            resetAllContent?.();
        }
    });
};
 
export const getSiteByID = (siteData, selectID?: string) => {
    const defaultSelectID = selectID ?? window.moduleConfig.comprehensive.logicSite.defaultSelectID;
    const first = getSite(
        siteData,
        { key: 'LogicType', value: LOGIC_SITE_CODE },
        {
            key: 'LogicID',
            value: defaultSelectID,
        }
    );
 
    return first;
};