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;
|
};
|