Commit 5a91d0e7 by liimin

refactor(store): 重构全局状态管理以兼容旧项目

- 将原有的模块化 store 重构为 Vuex 风格的扁平化结构
- 实现与旧项目 gl_tape/store 兼容的 API(dispatch, commit, getters)
- 暂时注释 RecordService 中的 watch 监听以避免潜在冲突
- 新增状态持久化功能(如 customerInfo 的本地存储)
1 parent 102cd697
......@@ -86,40 +86,40 @@ class RecordService {
initWatchers() {
// 监听 customerKey
this.unwatchCustomer = watch(
(): string => storeState.customerKey,
(val: string) => {
const customerInfo = storeState.customerInfo
this.handler('updateCustomerInfo', customerInfo, (val: UTSJSONObject | null) => { this.updateCustomerInfo(val) }, 1000)
},
{ immediate: true }
)
// 监听 receptionStatus
this.unwatchStatus = watch(
(): string => storeState.receptionStatus,
(val: string) => {
this.handler('updateReceptionStatus', val, (v: any) => { this.updateReceptionStatus(v as string) }, 200)
},
{ immediate: true }
)
this.unwatchBookList = watch(
(): UTSJSONObject[] => storeState.booksList,
(val: UTSJSONObject[]) => {
this.handler('updateBookList', val, (v: UTSJSONObject[]) => { this.updateBookList(v) }, 1500)
},
{ immediate: true }
)
this.unwatchReceptionKey = watch(
(): string => storeState.receptionKey,
(val: string) => {
const receptionTrack = storeState.receptionTrack
this.handler('updateMaterialPointList', receptionTrack, (v: UTSJSONObject[]) => { this.updateMaterialPointList(v) }, 1000)
},
{ immediate: true }
)
// this.unwatchCustomer = watch(
// (): string => storeState.customerKey,
// (val: string) => {
// const customerInfo = storeState.customerInfo
// this.handler('updateCustomerInfo', customerInfo, (val: UTSJSONObject | null) => { this.updateCustomerInfo(val) }, 1000)
// },
// { immediate: true }
// )
// // 监听 receptionStatus
// this.unwatchStatus = watch(
// (): string => storeState.receptionStatus,
// (val: string) => {
// this.handler('updateReceptionStatus', val, (v: any) => { this.updateReceptionStatus(v as string) }, 200)
// },
// { immediate: true }
// )
// this.unwatchBookList = watch(
// (): UTSJSONObject[] => storeState.booksList,
// (val: UTSJSONObject[]) => {
// this.handler('updateBookList', val, (v: UTSJSONObject[]) => { this.updateBookList(v) }, 1500)
// },
// { immediate: true }
// )
// this.unwatchReceptionKey = watch(
// (): string => storeState.receptionKey,
// (val: string) => {
// const receptionTrack = storeState.receptionTrack
// this.handler('updateMaterialPointList', receptionTrack, (v: UTSJSONObject[]) => { this.updateMaterialPointList(v) }, 1000)
// },
// { immediate: true }
// )
}
// --- 业务逻辑 ---
......@@ -404,12 +404,12 @@ class RecordService {
businessScene: sceneType
}
const newPointJson = JSON.parse(JSON.stringify(newPoint)) as UTSJSONObject
const pMap = point.toMap()
pMap.forEach((pv, pk) => {
newPointJson[pk] = pv
})
receptionCustomerMaterialPointList.push(newPointJson)
})
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!