style:入库单据/出库单据-状态修改

besure_bit
黄伟杰 1 week ago
parent cdaf1e54df
commit 62ff9ca57e

@ -22,6 +22,20 @@ export interface DictState {
isSetDict: boolean isSetDict: boolean
} }
const normalizeDictMap = (dictMap: Recordable = {}) => {
const normalizedDictMap: Recordable = {}
Object.keys(dictMap || {}).forEach((dictType) => {
const normalizedDictType = dictType.trim()
const dictList = dictMap[dictType]
if (Array.isArray(normalizedDictMap[normalizedDictType]) && Array.isArray(dictList)) {
normalizedDictMap[normalizedDictType].push(...dictList)
} else {
normalizedDictMap[normalizedDictType] = dictList
}
})
return normalizedDictMap
}
export const useDictStore = defineStore('dict', { export const useDictStore = defineStore('dict', {
state: (): DictState => ({ state: (): DictState => ({
dictMap: new Map<string, any>(), dictMap: new Map<string, any>(),
@ -31,7 +45,7 @@ export const useDictStore = defineStore('dict', {
getDictMap(): Recordable { getDictMap(): Recordable {
const dictMap = wsCache.get(CACHE_KEY.DICT_CACHE) const dictMap = wsCache.get(CACHE_KEY.DICT_CACHE)
if (dictMap) { if (dictMap) {
this.dictMap = dictMap this.dictMap = normalizeDictMap(dictMap)
} }
return this.dictMap return this.dictMap
}, },
@ -43,13 +57,15 @@ export const useDictStore = defineStore('dict', {
async setDictMap() { async setDictMap() {
const dictMap = wsCache.get(CACHE_KEY.DICT_CACHE) const dictMap = wsCache.get(CACHE_KEY.DICT_CACHE)
if (dictMap) { if (dictMap) {
const dictTypes = Object.keys(dictMap || {}) const normalizedDictMap = normalizeDictMap(dictMap)
const dictTypes = Object.keys(normalizedDictMap || {})
const firstDictType = dictTypes[0] const firstDictType = dictTypes[0]
const firstList = firstDictType ? dictMap[firstDictType] : undefined const firstList = firstDictType ? normalizedDictMap[firstDictType] : undefined
const needsUpgrade = const needsUpgrade =
Array.isArray(firstList) && firstList.length > 0 && !('labelEn' in (firstList[0] || {})) Array.isArray(firstList) && firstList.length > 0 && !('labelEn' in (firstList[0] || {}))
if (!needsUpgrade) { if (!needsUpgrade) {
this.dictMap = dictMap this.dictMap = normalizedDictMap
wsCache.set(CACHE_KEY.DICT_CACHE, normalizedDictMap, { exp: 60 })
this.isSetDict = true this.isSetDict = true
return return
} }
@ -58,11 +74,12 @@ export const useDictStore = defineStore('dict', {
const res = await getSimpleDictDataList() const res = await getSimpleDictDataList()
const dictDataMap = new Map<string, any>() const dictDataMap = new Map<string, any>()
res.forEach((dictData: DictDataVO) => { res.forEach((dictData: DictDataVO) => {
const enumValueObj = dictDataMap[dictData.dictType] const dictType = dictData.dictType.trim()
const enumValueObj = dictDataMap[dictType]
if (!enumValueObj) { if (!enumValueObj) {
dictDataMap[dictData.dictType] = [] dictDataMap[dictType] = []
} }
dictDataMap[dictData.dictType].push({ dictDataMap[dictType].push({
value: dictData.value, value: dictData.value,
label: dictData.label, label: dictData.label,
labelEn: (dictData as any).labelEn, labelEn: (dictData as any).labelEn,
@ -91,11 +108,12 @@ export const useDictStore = defineStore('dict', {
const res = await getSimpleDictDataList() const res = await getSimpleDictDataList()
const dictDataMap = new Map<string, any>() const dictDataMap = new Map<string, any>()
res.forEach((dictData: DictDataVO) => { res.forEach((dictData: DictDataVO) => {
const enumValueObj = dictDataMap[dictData.dictType] const dictType = dictData.dictType.trim()
const enumValueObj = dictDataMap[dictType]
if (!enumValueObj) { if (!enumValueObj) {
dictDataMap[dictData.dictType] = [] dictDataMap[dictType] = []
} }
dictDataMap[dictData.dictType].push({ dictDataMap[dictType].push({
value: dictData.value, value: dictData.value,
label: dictData.label, label: dictData.label,
labelEn: (dictData as any).labelEn, labelEn: (dictData as any).labelEn,

@ -228,6 +228,10 @@ export enum DICT_TYPE {
ERP_AUDIT_STATUS = 'erp_audit_status',// ERP 审批状态 ERP_AUDIT_STATUS = 'erp_audit_status',// ERP 审批状态
ERP_STOCK_RECORD_BIZ_TYPE = 'erp_stock_record_biz_type',// 库存明细的业务类型 ERP_STOCK_RECORD_BIZ_TYPE = 'erp_stock_record_biz_type',// 库存明细的业务类型
ERP_MOLD_STATUS = 'erp_mold_status',// ERP 模具状态 ERP_MOLD_STATUS = 'erp_mold_status',// ERP 模具状态
WAREHOUSE_DOCUMENT_TYPES = 'warehouse_document_types', // 入库单据类型
WAREHOUSE_DOCUMENT_OUT_TYPES = 'warehouse_document_out_types', // 出库单据类型
WAREHOUSE_RECEIVING_STATUS = 'warehouse_receiving_status', // 入库状态
WAREHOUSE_OUTBOUND_STATUS = 'Warehouse_outbound_status', // 出库状态
SUBMOLD_TYPE = 'submold_type', // 子模具类型 SUBMOLD_TYPE = 'submold_type', // 子模具类型
ERP_MAINTAIN_TYPE = 'maintain_type',// ERP 保养类型 ERP_MAINTAIN_TYPE = 'maintain_type',// ERP 保养类型

@ -86,7 +86,7 @@
class="!w-240px" class="!w-240px"
> >
<el-option <el-option
v-for="dict in getIntDictOptions(DICT_TYPE.ERP_AUDIT_STATUS)" v-for="dict in getIntDictOptions(DICT_TYPE.WAREHOUSE_RECEIVING_STATUS)"
:key="dict.value" :key="dict.value"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
@ -197,7 +197,7 @@
prop="status" prop="status"
sortable> sortable>
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.ERP_AUDIT_STATUS" :value="scope.row.status" /> <dict-tag :type="DICT_TYPE.WAREHOUSE_RECEIVING_STATUS" :value="scope.row.status" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -357,12 +357,12 @@ const queryParams = reactive({
productId: undefined, productId: undefined,
supplierId: undefined, supplierId: undefined,
inTime: [], inTime: [],
status: undefined,
remark: undefined, remark: undefined,
inType: undefined, inType: undefined,
creator: undefined creator: undefined
}) })
const WAREHOUSE_DOCUMENT_TYPES = 'warehouse_document_types' const stockInTypeOptions = computed(() => getStrDictOptions(DICT_TYPE.WAREHOUSE_DOCUMENT_TYPES))
const stockInTypeOptions = computed(() => getStrDictOptions(WAREHOUSE_DOCUMENT_TYPES))
const inTypeToInfoKey = (inType: string) => { const inTypeToInfoKey = (inType: string) => {
const map: Record<string, string> = { const map: Record<string, string> = {
'产品入库': 'productInfo', '产品入库': 'productInfo',

@ -86,7 +86,7 @@
class="!w-240px" class="!w-240px"
> >
<el-option <el-option
v-for="dict in getIntDictOptions(DICT_TYPE.ERP_AUDIT_STATUS)" v-for="dict in getIntDictOptions(DICT_TYPE.WAREHOUSE_OUTBOUND_STATUS)"
:key="dict.value" :key="dict.value"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
@ -197,7 +197,7 @@
prop="status" prop="status"
sortable> sortable>
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.ERP_AUDIT_STATUS" :value="scope.row.status" /> <dict-tag :type="DICT_TYPE.WAREHOUSE_OUTBOUND_STATUS" :value="scope.row.status" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -359,8 +359,7 @@ const queryParams = reactive({
outType: undefined, outType: undefined,
creator: undefined creator: undefined
}) })
const WAREHOUSE_DOCUMENT_TYPES = 'warehouse_document_out_types' const stockOutTypeOptions = computed(() => getStrDictOptions(DICT_TYPE.WAREHOUSE_DOCUMENT_OUT_TYPES))
const stockOutTypeOptions = computed(() => getStrDictOptions(WAREHOUSE_DOCUMENT_TYPES))
const outTypeToInfoKey = (outType: string) => { const outTypeToInfoKey = (outType: string) => {
const map: Record<string, string> = { const map: Record<string, string> = {
'产品出库': 'productInfo', '产品出库': 'productInfo',

Loading…
Cancel
Save