货无忧
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

60 lines
1.0 KiB

import {
defineStore
} from 'pinia';
import {
ref
} from 'vue';
import {
postFindAllAllocationId
} from '@/api/user.js';
const useStorageStore = defineStore('useStorageStore', () => {
/** 存储本仓库位信息 */
const storageArr = ref([])
/** 请求本仓库位信息 */
const HANDLE_GETSTORAGEINFO = async () => {
const response = await postFindAllAllocationId()
const {
code,
data
} = response
if (code !== 200) return
storageArr.value = data || []
}
/** 清空库位信息 */
const HANDLE_CLEARSTORAGE = () => {
storageArr.value.splice(0)
}
/**
* 检测是否为库位码
* @param {string} code 扫描的code码
* @return {boolean} 是否为库位码的判断
* */
const HANDLE_ISSTORAGECODE = (code) => {
let _flag = false
for (let item of storageArr.value) {
if ((item + '') === (code + '')) {
_flag = true
// 退出循环
break
}
}
return _flag
}
return {
storageArr,
HANDLE_GETSTORAGEINFO,
HANDLE_CLEARSTORAGE,
HANDLE_ISSTORAGECODE
}
})
export default useStorageStore