23 lines
697 B
TypeScript
23 lines
697 B
TypeScript
import { ref } from 'vue'
|
|
import { getProductNameList } from '@/apis/equipment/product'
|
|
import type { LabelValueState } from '@/types/global'
|
|
|
|
/** 设备名称列表 */
|
|
export function productName(options?: { onSuccess?: () => void }) {
|
|
const loading = ref(false)
|
|
const productNameList = ref<LabelValueState[]>([])
|
|
|
|
const getProductName = async () => {
|
|
try {
|
|
loading.value = true
|
|
const res = await getProductNameList()
|
|
productNameList.value = res.data
|
|
// eslint-disable-next-line ts/no-unused-expressions
|
|
options?.onSuccess && options.onSuccess()
|
|
} finally {
|
|
loading.value = false
|
|
}
|
|
}
|
|
return { productNameList, getProductName, loading }
|
|
}
|