fix(mes): 修改多个组件以使用整数类型的字典选项

pull/879/MERGE
YunaiV 2026-05-30 20:38:43 +08:00
parent e80e5203a4
commit d08413a68e
4 changed files with 15 additions and 12 deletions

View File

@ -5,7 +5,7 @@ export interface WmMiscIssueVO {
id: number id: number
code: string code: string
name: string name: string
type: string type: number
sourceDocType: string sourceDocType: string
sourceDocId: number sourceDocId: number
sourceDocCode: string sourceDocCode: string

View File

@ -40,7 +40,7 @@
:disabled="isHeaderReadonly" :disabled="isHeaderReadonly"
> >
<el-option <el-option
v-for="dict in getStrDictOptions(DICT_TYPE.MES_WM_MISC_ISSUE_TYPE)" v-for="dict in getIntDictOptions(DICT_TYPE.MES_WM_MISC_ISSUE_TYPE)"
:key="dict.value" :key="dict.value"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
@ -120,7 +120,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict' import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { WmMiscIssueApi, WmMiscIssueVO } from '@/api/mes/wm/miscissue' import { WmMiscIssueApi, WmMiscIssueVO } from '@/api/mes/wm/miscissue'
import { AutoCodeRecordApi } from '@/api/mes/md/autocode/record' import { AutoCodeRecordApi } from '@/api/mes/md/autocode/record'
import MiscIssueLineList from './MiscIssueLineList.vue' import MiscIssueLineList from './MiscIssueLineList.vue'

View File

@ -35,7 +35,7 @@
class="!w-240px" class="!w-240px"
> >
<el-option <el-option
v-for="dict in getStrDictOptions(DICT_TYPE.MES_WM_MISC_ISSUE_TYPE)" v-for="dict in getIntDictOptions(DICT_TYPE.MES_WM_MISC_ISSUE_TYPE)"
:key="dict.value" :key="dict.value"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
@ -195,7 +195,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { dateFormatter2 } from '@/utils/formatTime' import { dateFormatter2 } from '@/utils/formatTime'
import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict' import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import download from '@/utils/download' import download from '@/utils/download'
import { WmMiscIssueApi, WmMiscIssueVO } from '@/api/mes/wm/miscissue' import { WmMiscIssueApi, WmMiscIssueVO } from '@/api/mes/wm/miscissue'
import MiscIssueForm from './MiscIssueForm.vue' import MiscIssueForm from './MiscIssueForm.vue'

View File

@ -118,13 +118,12 @@
</template> </template>
<template v-else-if="formData.type === MesWmStockTakingParamTypeEnum.QUALITY_STATUS"> <template v-else-if="formData.type === MesWmStockTakingParamTypeEnum.QUALITY_STATUS">
<el-select <el-select
v-model="formData.valueCode" v-model="qualityStatusValue"
placeholder="请选择质量状态" placeholder="请选择质量状态"
class="!w-full" class="!w-full"
@change="handleQualityStatusChange"
> >
<el-option <el-option
v-for="dict in getStrDictOptions(DICT_TYPE.MES_WM_QUALITY_STATUS)" v-for="dict in getIntDictOptions(DICT_TYPE.MES_WM_QUALITY_STATUS)"
:key="dict.value" :key="dict.value"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
@ -148,7 +147,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict' import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { import {
StockTakingPlanParamApi, StockTakingPlanParamApi,
type StockTakingPlanParamVO type StockTakingPlanParamVO
@ -219,6 +218,10 @@ const formData = ref<StockTakingPlanParamVO>({
valueName: '', valueName: '',
remark: '' remark: ''
}) })
const qualityStatusValue = computed({
get: () => (formData.value.valueCode ? Number(formData.value.valueCode) : undefined),
set: (val?: number) => handleQualityStatusChange(val)
})
const formRules = reactive({ const formRules = reactive({
type: [{ required: true, message: '请选择条件类型', trigger: 'change' }], type: [{ required: true, message: '请选择条件类型', trigger: 'change' }],
valueId: [ valueId: [
@ -331,11 +334,11 @@ const handleBatchChange = (batch?: any) => {
} }
/** 质量状态选择器变化 */ /** 质量状态选择器变化 */
const handleQualityStatusChange = (val: string) => { const handleQualityStatusChange = (val?: number) => {
const dictOptions = getStrDictOptions(DICT_TYPE.MES_WM_QUALITY_STATUS) const dictOptions = getIntDictOptions(DICT_TYPE.MES_WM_QUALITY_STATUS)
const selected = dictOptions.find((d) => d.value === val) const selected = dictOptions.find((d) => d.value === val)
formData.value.valueId = undefined // ID formData.value.valueId = undefined // ID
formData.value.valueCode = val formData.value.valueCode = val == null ? '' : String(val)
formData.value.valueName = selected?.label || '' formData.value.valueName = selected?.label || ''
} }