| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 | 
							- import {
 
- 	defineStore
 
- } from 'pinia';
 
- export const useSetWareHouseStore = defineStore('warehouse', {
 
- 	state: () => ({
 
- 		warehouseList: [],
 
- 		regionList: [],
 
- 		locationList: []
 
- 	}),
 
- 	getters: {
 
- 		getData: (state) => {
 
- 			state.warehouseList, state.regionList, state.locationList
 
- 		},
 
- 	},
 
- 	actions: {
 
- 		// 仓库列表数据
 
- 		getList(state) {
 
- 			return new Promise((resolve, reject) => {
 
- 				uni.$reqGet('warehouseDropDownList')
 
- 					.then(({
 
- 						code,
 
- 						data,
 
- 						msg
 
- 					}) => {
 
- 						if (code === 0) {
 
- 							this.warehouseList = []
 
- 							data?.forEach(item => {
 
- 								this.warehouseList.push({
 
- 									id: item.id,
 
- 									text: item.name,
 
- 									value: item.id
 
- 								})
 
- 							})
 
- 							resolve(this.warehouseList)
 
- 						} else {
 
- 							reject(msg)
 
- 						}
 
- 					})
 
- 			})
 
- 		},
 
- 		// 根据ID查询区域列表数据
 
- 		handleGetRegionList(wmsStockId) {
 
- 			return new Promise((resolve, reject) => {
 
- 				uni.$reqGet('regionDropDownList', {
 
- 						wmsStockId
 
- 					})
 
- 					.then(({
 
- 						code,
 
- 						data,
 
- 						msg
 
- 					}) => {
 
- 						if (code === 0) {
 
- 							this.regionList = []
 
- 							data?.forEach(item => {
 
- 								this.regionList.push({
 
- 									id: item.id,
 
- 									text: item.name,
 
- 									value: item.id
 
- 								})
 
- 							})
 
- 							resolve(this.regionList)
 
- 						} else {
 
- 							reject(msg)
 
- 						}
 
- 					})
 
- 			})
 
- 		},
 
- 		// 根据ID查询货位列表数据
 
- 		handleGetLocationList(stockArea) {
 
- 			return new Promise((resolve, reject) => {
 
- 				uni.$reqGet('locationDropDownList', {
 
- 						stockArea
 
- 					})
 
- 					.then(({
 
- 						code,
 
- 						data,
 
- 						msg
 
- 					}) => {
 
- 						if (code === 0) {
 
- 							this.locationList = []
 
- 							data?.forEach(item => {
 
- 								this.locationList.push({
 
- 									id: item.id,
 
- 									text: item.name,
 
- 									value: item.id
 
- 								})
 
- 							})
 
- 							resolve(this.locationList)
 
- 						} else {
 
- 							reject(msg)
 
- 						}
 
- 					})
 
- 			})
 
- 		}
 
- 	},
 
- 	persist: true, // 设置持久化
 
- 	// 单独设置存储位置
 
- 	// persist: {
 
- 	//   storage: window.localStorage,
 
- 	// },
 
- })
 
 
  |