2025-08-14 13:48:14 +08:00
|
|
|
import store from '@/store'
|
2025-08-14 17:16:31 +08:00
|
|
|
import {
|
|
|
|
|
getCompanySelectListAPI,
|
|
|
|
|
getMainProjectListAllAPI,
|
|
|
|
|
getSubCompanySelectListAPI,
|
|
|
|
|
getLotProjectSelectListAPI,
|
2025-08-15 16:19:21 +08:00
|
|
|
getSubSelectListAPI,
|
2025-08-14 17:16:31 +08:00
|
|
|
} from '@/api/common'
|
2025-08-14 13:48:14 +08:00
|
|
|
|
|
|
|
|
// 获取公司下拉列表
|
|
|
|
|
export async function getCompanySelectListCommonFun() {
|
|
|
|
|
const { companySelectList } = store.state.common
|
|
|
|
|
// 先判断store中有没有 如果没有则直接调接口 如果有则取store中的数据
|
|
|
|
|
if (companySelectList.length > 0) {
|
|
|
|
|
return companySelectList
|
|
|
|
|
}
|
|
|
|
|
const res = await getCompanySelectListAPI()
|
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
store.commit('SET_COMPANY_SELECT_LIST', res.rows)
|
|
|
|
|
return res.rows
|
|
|
|
|
}
|
|
|
|
|
return []
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-15 10:58:45 +08:00
|
|
|
// 获取总包工程下拉列表
|
2025-08-14 13:48:14 +08:00
|
|
|
export async function getMainProjectListCommonFun() {
|
|
|
|
|
const { mainProjectList } = store.state.common
|
|
|
|
|
if (mainProjectList.length > 0) {
|
|
|
|
|
return mainProjectList
|
|
|
|
|
}
|
|
|
|
|
const res = await getMainProjectListAllAPI()
|
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
store.commit('SET_MAIN_PROJECT_LIST', res.rows)
|
|
|
|
|
return res.rows
|
|
|
|
|
}
|
|
|
|
|
return []
|
|
|
|
|
}
|
2025-08-14 17:16:31 +08:00
|
|
|
|
|
|
|
|
// 获取分公司下拉列表
|
|
|
|
|
export async function getSubCompanySelectListCommonFun() {
|
|
|
|
|
const { subCompanySelectList } = store.state.common
|
|
|
|
|
if (subCompanySelectList.length > 0) {
|
|
|
|
|
return subCompanySelectList
|
|
|
|
|
}
|
|
|
|
|
const res = await getSubCompanySelectListAPI()
|
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
store.commit('SET_SUB_COMPANY_SELECT_LIST', res.rows)
|
|
|
|
|
return res.rows
|
|
|
|
|
}
|
|
|
|
|
return []
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取标段工程下拉列表
|
|
|
|
|
export async function getLotProjectSelectListCommonFun() {
|
|
|
|
|
const { lotProjectSelectList } = store.state.common
|
|
|
|
|
if (lotProjectSelectList.length > 0) {
|
|
|
|
|
return lotProjectSelectList
|
|
|
|
|
}
|
|
|
|
|
const res = await getLotProjectSelectListAPI()
|
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
store.commit('SET_LOT_PROJECT_SELECT_LIST', res.rows)
|
|
|
|
|
return res.rows
|
|
|
|
|
}
|
|
|
|
|
return []
|
|
|
|
|
}
|
2025-08-15 16:19:21 +08:00
|
|
|
// 获取分包下拉列表
|
|
|
|
|
export async function getSubSelectListCommonFun() {
|
|
|
|
|
const { subSelectList } = store.state.common
|
|
|
|
|
if (subSelectList.length > 0) {
|
|
|
|
|
return subSelectList
|
|
|
|
|
}
|
|
|
|
|
const res = await getSubSelectListAPI()
|
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
store.commit('SET_SUB_SELECT_LIST', res.rows)
|
|
|
|
|
return res.rows
|
|
|
|
|
}
|
|
|
|
|
return []
|
|
|
|
|
}
|