feat:设备/模具/质量管理-添加输入值输入框

main
黄伟杰 4 weeks ago
parent 34f6bf6547
commit f7dc112b15

@ -24,6 +24,8 @@ export interface TicketResultVO {
inspectionItemName?: string
inspectionMethod?: string
judgmentCriteria?: string
valueType?: string | number
textInput?: string
inspectionResult?: string | number
images?: string
remark?: string

@ -32,6 +32,7 @@ export interface ZjTaskResultVO {
remark: string
images?: string
zjResult?: number
textInput?: string
}
export const ZjTaskApi = {
@ -64,7 +65,7 @@ export const ZjTaskApi = {
},
batchUpdateZjTaskResults: async (
results: { id: number; taskId: number; images?: string; zjResult: number }[],
results: { id: number; taskId: number; images?: string; zjResult: number; textInput?: string }[],
) => {
return await request.post({ url: `/mes/zj-task-results/batch-update`, data: { results } })
},

@ -24,6 +24,8 @@ export interface TicketResultVO {
inspectionItemName?: string
inspectionMethod?: string
judgmentCriteria?: string
valueType?: string | number
textInput?: string
inspectionResult?: string | number
images?: string
remark?: string

@ -1,5 +1,5 @@
<template>
<Dialog v-model="dialogVisible" :title="dialogTitle" width="1100px">
<Dialog v-model="dialogVisible" :title="dialogTitle" width="1500px">
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" :row-key="getRowKey">
<el-table-column
type="index"
@ -67,6 +67,30 @@
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column :label="t('EquipmentManagement.DvSubject.valueType')" align="center" prop="valueType" width="120">
<template #default="scope">
<el-tag
v-if="scope.row.valueType !== undefined && scope.row.valueType !== null && String(scope.row.valueType) !== ''"
effect="light" :type="getTagType('value_types', scope.row.valueType)"
:color="getTagColor('value_types', scope.row.valueType)"
:style="getTagStyle('value_types', scope.row.valueType)" disable-transitions>
{{ getTagLabel('value_types', scope.row.valueType) }}
</el-tag>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="输入值" align="center" min-width="150">
<template #default="scope">
<el-input
v-if="String(scope.row.valueType) === '0' || String(scope.row.valueType) === '2'"
v-model="scope.row.textInput"
:disabled="String(scope.row.inspectionResult) !== '0'"
clearable
placeholder="请输入"
/>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column
:label="t('EquipmentManagement.WorkOrderManagement.remark')"
align="center"
@ -125,6 +149,9 @@
<script setup lang="ts">
import { TicketManagementApi, TicketResultVO } from '@/api/mes/ticketManagement'
import { getStrDictOptions } from '@/utils/dict'
import { isHexColor } from '@/utils/color'
import { useDictStoreWithOut } from '@/store/modules/dict'
defineOptions({ name: 'TicketResultDialog' })
@ -132,6 +159,9 @@ const emit = defineEmits(['success'])
const message = useMessage()
const { t } = useI18n()
const dictStore = useDictStoreWithOut()
const dictReady = ref(false)
const dialogVisible = ref(false)
const dialogTitle = ref(t('EquipmentManagement.WorkOrderManagement.dialogTitleDefault'))
const loading = ref(false)
@ -145,6 +175,37 @@ const cancelReason = ref<string | undefined>(undefined)
const decisionMap = reactive<Record<string, '1' | '2' | undefined>>({})
const imageMap = reactive<Record<string, string>>({})
const getTagDict = (dictType: string, value: any) => {
if (!dictReady.value) return undefined
const v = value === '' || value === null || value === undefined ? undefined : String(value)
if (!v) return undefined
return getStrDictOptions(dictType).find((d) => d.value === v)
}
const getTagLabel = (dictType: string, value: any) => {
const found = getTagDict(dictType, value)
return found?.label ?? (value ?? '')
}
const getTagType = (dictType: string, value: any) => {
const found = getTagDict(dictType, value)
const type = found?.colorType
if (type + '' === 'primary' || type + '' === 'default') return '' as any
return (type ?? '') as any
}
const getTagColor = (dictType: string, value: any) => {
const found = getTagDict(dictType, value)
if (found?.cssClass && isHexColor(found.cssClass)) return found.cssClass
return ''
}
const getTagStyle = (dictType: string, value: any) => {
const color = getTagColor(dictType, value)
if (!color) return ''
return 'color: #fff'
}
const queryParams = reactive({
pageNo: 1,
pageSize: 10
@ -164,6 +225,11 @@ const open = async (options: { managementId: number; title?: string; jobStatus?:
defineExpose({ open })
onMounted(async () => {
await dictStore.setDictMap()
dictReady.value = true
})
const getList = async () => {
if (!managementId.value) return
loading.value = true

@ -75,6 +75,17 @@
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="输入值" align="center" min-width="150">
<template #default="scope">
<el-input
v-if="String(scope.row.zjResult) === '0'"
v-model="scope.row.textInput"
clearable
placeholder="请输入"
/>
<span v-else>{{ scope.row.textInput || '-' }}</span>
</template>
</el-table-column>
<el-table-column
:label="t('QualityManagement.TicketResultDialog.remark')"
align="center"
@ -259,7 +270,7 @@ const handleSave = async () => {
const decision = decisionMap[String(row.id)]
if (decision !== 1 && decision !== 2) continue
const img = imageMap[String(row.id)] || row.images
payload.push({ id: row.id, taskId: currentTaskId, images: img, zjResult: decision })
payload.push({ id: row.id, taskId: currentTaskId, images: img, zjResult: decision, textInput: row.textInput })
}
if (!payload.length) {
message.error('暂无需要保存的记录')
@ -301,3 +312,8 @@ const isAllSelected = () => {
return true
}
</script>
<style scoped lang="scss">
:deep(.el-upload) {
margin: 0 auto;
}
</style>

@ -1,5 +1,5 @@
<template>
<Dialog v-model="dialogVisible" :title="dialogTitle" width="1100px">
<Dialog v-model="dialogVisible" :title="dialogTitle" width="1500px">
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" :row-key="getRowKey">
<el-table-column type="index" :label="t('MoldManagement.TicketResultDialog.index')" align="center" width="70" />
<el-table-column :label="t('MoldManagement.TicketResultDialog.inspectionItemName')" align="center" prop="inspectionItemName" min-width="200" />
@ -29,6 +29,30 @@ v-else-if="scope.row.images" :src="parseFirstImage(scope.row.images)"
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column :label="t('EquipmentManagement.DvSubject.valueType')" align="center" prop="valueType" width="120">
<template #default="scope">
<el-tag
v-if="scope.row.valueType !== undefined && scope.row.valueType !== null && String(scope.row.valueType) !== ''"
effect="light" :type="getTagType('value_types', scope.row.valueType)"
:color="getTagColor('value_types', scope.row.valueType)"
:style="getTagStyle('value_types', scope.row.valueType)" disable-transitions>
{{ getTagLabel('value_types', scope.row.valueType) }}
</el-tag>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="输入值" align="center" min-width="150">
<template #default="scope">
<el-input
v-if="String(scope.row.valueType) === '0' || String(scope.row.valueType) === '2'"
v-model="scope.row.textInput"
:disabled="String(scope.row.inspectionResult) !== '0'"
clearable
placeholder="请输入"
/>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column :label="t('MoldManagement.TicketResultDialog.remark')" align="center" prop="remark" min-width="180" />
<el-table-column :label="t('MoldManagement.TicketResultDialog.operate')" align="center" min-width="220" fixed="right">
<template #default="scope">
@ -63,12 +87,18 @@ v-else-if="scope.row.images" :src="parseFirstImage(scope.row.images)"
<script setup lang="ts">
import { TicketManagementApi, TicketResultVO } from '@/api/mold/ticketManagement'
import { getStrDictOptions } from '@/utils/dict'
import { isHexColor } from '@/utils/color'
import { useDictStoreWithOut } from '@/store/modules/dict'
defineOptions({ name: 'TicketResultDialog' })
const { t } = useI18n()
const message = useMessage()
const dictStore = useDictStoreWithOut()
const dictReady = ref(false)
const dialogVisible = ref(false)
const dialogTitle = ref('检验结果')
const loading = ref(false)
@ -82,6 +112,37 @@ const cancelReason = ref<string | undefined>(undefined)
const decisionMap = reactive<Record<string, '1' | '2' | undefined>>({})
const imageMap = reactive<Record<string, string>>({})
const getTagDict = (dictType: string, value: any) => {
if (!dictReady.value) return undefined
const v = value === '' || value === null || value === undefined ? undefined : String(value)
if (!v) return undefined
return getStrDictOptions(dictType).find((d) => d.value === v)
}
const getTagLabel = (dictType: string, value: any) => {
const found = getTagDict(dictType, value)
return found?.label ?? (value ?? '')
}
const getTagType = (dictType: string, value: any) => {
const found = getTagDict(dictType, value)
const type = found?.colorType
if (type + '' === 'primary' || type + '' === 'default') return '' as any
return (type ?? '') as any
}
const getTagColor = (dictType: string, value: any) => {
const found = getTagDict(dictType, value)
if (found?.cssClass && isHexColor(found.cssClass)) return found.cssClass
return ''
}
const getTagStyle = (dictType: string, value: any) => {
const color = getTagColor(dictType, value)
if (!color) return ''
return 'color: #fff'
}
const queryParams = reactive({
pageNo: 1,
pageSize: 10
@ -101,6 +162,11 @@ const open = async (options: { managementId: number; title?: string; jobStatus?:
defineExpose({ open })
onMounted(async () => {
await dictStore.setDictMap()
dictReady.value = true
})
const getList = async () => {
if (!managementId.value) return
loading.value = true

Loading…
Cancel
Save