优化
This commit is contained in:
22
src/hooks/app/materialProcess.ts
Normal file
22
src/hooks/app/materialProcess.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { ref } from 'vue'
|
||||
import { selectList } from '@/apis/materialProcess/materialProcess'
|
||||
import type { LabelValueState } from '@/types/global'
|
||||
|
||||
/** 物料品类模块 */
|
||||
export function materialProcess(options?: { onSuccess?: () => void }) {
|
||||
const loading = ref(false)
|
||||
const materialProcessList = ref<LabelValueState[]>([])
|
||||
|
||||
const getMaterialProcessSelect = async () => {
|
||||
try {
|
||||
loading.value = true
|
||||
const res = await selectList()
|
||||
materialProcessList.value = res.data
|
||||
// eslint-disable-next-line ts/no-unused-expressions
|
||||
options?.onSuccess && options.onSuccess()
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
return { materialProcessList, getMaterialProcessSelect, loading }
|
||||
}
|
||||
22
src/hooks/app/materialType.ts
Normal file
22
src/hooks/app/materialType.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { ref } from 'vue'
|
||||
import { selectList } from '@/apis/materialType/materialType'
|
||||
import type { LabelValueState } from '@/types/global'
|
||||
|
||||
/** 物料品类模块 */
|
||||
export function materialType(options?: { onSuccess?: () => void }) {
|
||||
const loading = ref(false)
|
||||
const materialTypeList = ref<LabelValueState[]>([])
|
||||
|
||||
const getMaterialTypeSelect = async () => {
|
||||
try {
|
||||
loading.value = true
|
||||
const res = await selectList()
|
||||
materialTypeList.value = res.data
|
||||
// eslint-disable-next-line ts/no-unused-expressions
|
||||
options?.onSuccess && options.onSuccess()
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
return { materialTypeList, getMaterialTypeSelect, loading }
|
||||
}
|
||||
Reference in New Issue
Block a user