diff --git a/src/locales/en-US.js b/src/locales/en-US.js
index f0fbc80..89dcbf1 100644
--- a/src/locales/en-US.js
+++ b/src/locales/en-US.js
@@ -1101,7 +1101,10 @@ export default {
inspectionResultPending: 'Pending',
maxUploadCount: 'Max 3 images',
selectAllDecisionError: 'Please select all inspection results',
- currentMoldInfo: 'Current Mold Info',
+ currentMoldInfo: 'Mold Info',
+ moldGroupCode: 'Mold Group Code',
+ moldGroupName: 'Mold Group Name',
+ cavityCount: 'Cavity Count',
moldSize: 'Mold Size',
currentDevice: 'Current Device',
selectMold: 'Select Mold',
diff --git a/src/locales/zh-CN.js b/src/locales/zh-CN.js
index 05e7e21..55b3315 100644
--- a/src/locales/zh-CN.js
+++ b/src/locales/zh-CN.js
@@ -1104,7 +1104,10 @@ export default {
inspectionResultPending: '待判定',
maxUploadCount: '最多上传3张图片',
selectAllDecisionError: '请选择所有点检项的判定结果',
- currentMoldInfo: '当前模具信息',
+ currentMoldInfo: '模具信息',
+ moldGroupCode: '模具组编码',
+ moldGroupName: '模具组名称',
+ cavityCount: '模穴数',
moldSize: '模具尺寸',
currentDevice: '当前设备',
selectMold: '选择模具',
diff --git a/src/pages_function/pages/moldCheck/add.vue b/src/pages_function/pages/moldCheck/add.vue
index 0042257..0ba8050 100644
--- a/src/pages_function/pages/moldCheck/add.vue
+++ b/src/pages_function/pages/moldCheck/add.vue
@@ -12,36 +12,43 @@
{{ t('moldCheck.currentMoldInfo') }}
-
-
- {{ t('moldCheck.moldCode') }}
- {{ moldInfo.code || '-' }}
-
-
- {{ t('moldCheck.moldName') }}
- {{ moldInfo.name || '-' }}
-
-
- {{ t('moldCheck.product') }}
- {{ moldInfo.productName || '-' }}
-
-
- {{ t('moldCheck.moldSize') }}
- {{ moldInfo.moldSize || '-' }}
-
-
- {{ t('moldCheck.status') }}
- {{ moldInfo.statusLabel || '-' }}
-
-
- {{ t('moldCheck.currentDevice') }}
- {{ moldInfo.currentDevice || '-' }}
+
+ {{ t('moldCheck.selectMold') }}*
+
+
+ {{ moldInfo.id ? (moldInfo.name || moldInfo.code || '-') : t('moldCheck.selectMold') }}
+ {{ moldInfo.code || t('moldCheck.reSelectMold') }}
+
+
-
- *
- {{ moldInfo.id ? t('moldCheck.reSelectMold') : t('moldCheck.selectMold') }}
-
+
+
+
+ {{ t('moldCheck.moldGroupCode') }}
+ {{ moldInfo.code || '-' }}
+
+
+ {{ t('moldCheck.moldGroupName') }}
+ {{ moldInfo.name || '-' }}
+
+
+ {{ t('moldCheck.cavityCount') }}
+ {{ moldInfo.moldSize || '-' }}
+
+
+ {{ t('moldCheck.product') }}
+ {{ moldInfo.productName || '-' }}
+
+
+ {{ t('moldCheck.status') }}
+ {{ moldInfo.statusLabel || '-' }}
+
+
+ {{ t('moldCheck.currentDevice') }}
+ {{ moldInfo.currentDevice || '-' }}
+
+
@@ -54,7 +61,7 @@
{{ t('moldCheck.taskInfo') }}
- *{{ t('moldCheck.taskName') }}
+ {{ t('moldCheck.taskName') }}*
- *{{ t('moldCheck.templateSelection') }}
+ {{ t('moldCheck.templateSelection') }}*
{{ selectedTemplate?.planName || t('moldCheck.selectTemplate') }}
@@ -76,17 +83,83 @@
{{ t('moldCheck.inspectionMethod') }}
- {{ textValue(item.inspectionMethod) }}
+ {{ inspectionMethodText(item.inspectionMethod) }}
{{ t('moldCheck.judgmentCriteria') }}
{{ textValue(item.judgmentCriteria) }}
+
+ {{ t('moldCheck.textInput') }}
+
+
+
+
+
+ {{ t('moldCheck.textInput') }}
+
+
+
+ {{ t('moldCheck.images') }}
+
+
+
+ ×
+
+
+ +
+
+
+
+
+ {{ t('moldCheck.remark') }}
+
+
+
+ {{ t('moldCheck.resultText') }}
+
+
+ {{ t('moldCheck.inspectionResultPass') }}
+
+
+ {{ t('moldCheck.inspectionResultFail') }}
+
+ {{ t('moldCheck.inspectionResultPending') }}
+
+
@@ -168,7 +241,8 @@ import { reactive, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { useI18n } from 'vue-i18n'
import NavBar from '@/components/common/NavBar.vue'
-import { createMoldTicketDirect, getPlanMaintenancePage, getSubjectList, getMoldBrandDetail, getMoldList } from '@/api/mes/moldCheck'
+import { createMoldTicketDirect, getPlanMaintenancePage, getSubjectList, getMoldBrandDetail, uploadMoldCheckImage } from '@/api/mes/moldCheck'
+import { getBrandList } from '@/api/mes/mold'
import { DICT_TYPE, getDictLabel, initAllDict } from '@/utils/dict'
const { t } = useI18n()
@@ -287,7 +361,7 @@ async function loadMoldList(reset) {
if (moldSearchKeyword.value.trim()) {
params.name = moldSearchKeyword.value.trim()
}
- const res = await getMoldList(params)
+ const res = await getBrandList(params)
const root = res && res.data !== undefined ? res.data : res
const list = Array.isArray(root) ? root : (root?.list || root?.rows || root?.records || root?.data?.list || root?.data?.rows || root?.data?.records || [])
moldList.value = reset ? list : [...moldList.value, ...list]
@@ -366,15 +440,127 @@ function selectTemplate(template) {
async function loadInspectionItems(planId) {
try {
+ inspectionItems.value = []
const res = await getSubjectList(planId)
const root = res && res.data !== undefined ? res.data : res
const items = Array.isArray(root) ? root : (root?.list || root?.rows || root?.records || root?.data?.list || root?.data?.rows || root?.data?.records || root?.data || [])
- inspectionItems.value = Array.isArray(items) ? items : []
+ inspectionItems.value = Array.isArray(items) ? items.map((item, index) => ({
+ id: item.id,
+ subjectId: item.id,
+ inspectionItemName: item.subjectName ?? item.inspectionItemName ?? '',
+ inspectionMethod: item.inspectionMethod ?? '',
+ judgmentCriteria: item.judgmentCriteria ?? item.subjectStandard ?? '',
+ valueType: item.valueType ?? '',
+ textInput: item.textInput ?? '',
+ inspectionResult: String(item.inspectionResult ?? '0'),
+ images: item.images ?? '',
+ remark: item.remark ?? '',
+ required: item.required ?? item.isRequired ?? item.needCheck ?? item.mustCheck ?? false,
+ sort: index + 1
+ })) : []
} catch (error) {
uni.showToast({ title: t('functionCommon.loadFailed'), icon: 'none' })
}
}
+function isRequiredItem(item) {
+ const value = item?.required ?? item?.isRequired ?? item?.needCheck ?? item?.mustCheck
+ return value === true || value === 1 || value === '1'
+}
+
+function shouldShowInput(item) {
+ const valueType = String(item?.valueType ?? '')
+ return valueType === '0' || valueType === '2' || !!String(item?.textInput || '').trim()
+}
+
+function isNumericValueType(value) {
+ const normalized = String(value ?? '')
+ const label = String(valueTypeText(value) || '').toLowerCase()
+ return normalized === '2' || /数值|数字|number|numeric|digit|decimal/.test(label)
+}
+
+function numberInputValue(item) {
+ const value = Number(item?.textInput)
+ return Number.isFinite(value) ? value : 0
+}
+
+function onNumberInputChange(item, value) {
+ item.textInput = String(value)
+}
+
+function inspectionMethodText(value) {
+ return getDictLabel(DICT_TYPE.INSPECTION_METHOD, value, textValue(value))
+}
+
+function valueTypeText(value) {
+ return getDictLabel(DICT_TYPE.VALUE_TYPES, value, textValue(value))
+}
+
+function parseImages(value) {
+ if (!value) return []
+ if (Array.isArray(value)) return value.map((item) => String(item).trim()).filter(Boolean)
+ return String(value).split(',').map((item) => item.trim()).filter(Boolean)
+}
+
+function joinImages(value) {
+ return parseImages(value).join(',')
+}
+
+function resultOptionClass(item, value) {
+ const current = String(item?.inspectionResult || '')
+ if (current !== String(value)) return ''
+ return String(value) === '1' ? 'result-option-active' : 'result-option-danger'
+}
+
+function setDecision(item, value) {
+ item.inspectionResult = String(value)
+}
+
+async function chooseImages(item) {
+ try {
+ const currentCount = parseImages(item.images).length
+ const remain = Math.max(0, 3 - currentCount)
+ if (!remain) {
+ uni.showToast({ title: t('moldCheck.maxUploadCount'), icon: 'none' })
+ return
+ }
+ const res = await uni.chooseImage({ count: remain, sizeType: ['compressed'] })
+ const files = Array.isArray(res?.tempFilePaths) ? res.tempFilePaths : []
+ if (!files.length) return
+ uni.showLoading({ title: t('functionCommon.uploading'), mask: true })
+ const uploaded = []
+ for (const filePath of files) {
+ const uploadRes = await uploadMoldCheckImage(filePath)
+ const url = String(uploadRes?.data?.fileUrl || uploadRes?.data?.url || uploadRes?.data || uploadRes?.url || '').trim()
+ if (url) uploaded.push(url)
+ }
+ item.images = joinImages([...parseImages(item.images), ...uploaded])
+ } catch (error) {
+ const message = String(error?.errMsg || '')
+ if (!message.includes('cancel')) {
+ uni.showToast({ title: t('functionCommon.uploadImageFailed'), icon: 'none' })
+ }
+ } finally {
+ uni.hideLoading()
+ }
+}
+
+function removeImage(item, index) {
+ const next = parseImages(item.images)
+ next.splice(index, 1)
+ item.images = next.join(',')
+}
+
+function previewImage(current, urls) {
+ uni.previewImage({ current, urls })
+}
+
+function normalizeTextInput(value) {
+ if (value === 0 || value === '0') return '0'
+ const text = String(value ?? '').trim()
+ return text || undefined
+}
+
function textValue(value) {
if (value === 0) return '0'
if (value === null || value === undefined) return '-'
@@ -404,14 +590,34 @@ async function handleSubmit() {
return
}
+ const hasUnselected = inspectionItems.value.some((item) => String(item?.inspectionResult || '0') === '0')
+ if (inspectionItems.value.length && hasUnselected) {
+ uni.showToast({ title: t('moldCheck.selectAllDecisionError'), icon: 'none' })
+ return
+ }
+
submitLoading.value = true
try {
await createMoldTicketDirect({
name: taskName.value.trim(),
taskType: '1',
moldList: String(moldInfo.id),
- projectForm: String(selectedTemplate.value.id)
+ projectForm: String(selectedTemplate.value.id),
+ ticketResultsList: inspectionItems.value.map((item) => ({
+ id: item.id,
+ subjectId: item.subjectId,
+ inspectionItemName: item.inspectionItemName,
+ inspectionMethod: item.inspectionMethod,
+ judgmentCriteria: item.judgmentCriteria,
+ valueType: item.valueType,
+ textInput: normalizeTextInput(item.textInput),
+ inspectionResult: String(item.inspectionResult || '0'),
+ images: joinImages(item.images),
+ remark: item.remark,
+ sort: item.sort
+ }))
})
+ uni.setStorageSync('moldCheckListNeedRefresh', '1')
uni.showToast({ title: t('moldCheck.submitSuccess'), icon: 'success' })
setTimeout(() => {
uni.navigateBack()
@@ -428,26 +634,33 @@ async function handleSubmit() {
.page-container { min-height: 100vh; background-color: #f5f7fb; }
.detail-scroll { height: calc(100vh - 172rpx); }
.content-section { padding: 20rpx 24rpx 28rpx; }
-.section-card { background: #ffffff; border-radius: 24rpx; padding: 24rpx; margin-bottom: 20rpx; box-shadow: 0 6rpx 18rpx rgba(15, 23, 42, 0.05); }
-.section-header { display: flex; align-items: center; gap: 12rpx; margin-bottom: 20rpx; }
-.section-icon { width: 44rpx; height: 44rpx; border-radius: 12rpx; background: #eff6ff; display: flex; align-items: center; justify-content: center; }
+.section-card { background: #ffffff; border-radius: 20rpx; padding: 24rpx; margin-bottom: 20rpx; border: 1rpx solid #eef2f7; box-shadow: 0 6rpx 18rpx rgba(15, 23, 42, 0.04); }
+.section-header { display: flex; align-items: center; gap: 12rpx; margin-bottom: 22rpx; padding-bottom: 18rpx; border-bottom: 1rpx solid #f1f5f9; }
+.section-icon { width: 40rpx; height: 40rpx; border-radius: 10rpx; background: #eff6ff; display: flex; align-items: center; justify-content: center; }
.section-title { font-size: 32rpx; font-weight: 600; color: #1f2937; }
-.mold-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20rpx; }
-.mold-info-item { display: flex; flex-direction: column; gap: 8rpx; }
-.mold-info-label { font-size: 24rpx; color: #9ca3af; }
-.mold-info-value { font-size: 28rpx; color: #374151; }
-.mold-select-area { display: flex; align-items: center; justify-content: space-between; height: 88rpx; padding: 0 24rpx; background: #f8fafc; border-radius: 14rpx; }
+.mold-select-field { margin-bottom: 20rpx; }
+.mold-select-area { display: flex; align-items: center; justify-content: space-between; min-height: 92rpx; padding: 16rpx 22rpx; background: #f8fafc; border: 1rpx solid #e5e7eb; border-radius: 14rpx; box-sizing: border-box; }
+.mold-select-area.selected { background: #f9fbff; border-color: #bfdbfe; box-shadow: 0 4rpx 12rpx rgba(31, 124, 255, 0.08); }
+.mold-select-content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6rpx; }
.mold-select-placeholder { font-size: 28rpx; color: #9ca3af; }
-.mold-select-change { font-size: 26rpx; color: #1f7cff; }
-.status-tag { display: inline-block; padding: 6rpx 16rpx; border-radius: 8rpx; font-size: 24rpx; }
+.mold-select-value { font-size: 28rpx; font-weight: 600; color: #1f2937; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.mold-select-subtext { font-size: 24rpx; color: #6b7280; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.mold-info-panel { padding: 20rpx; background: #f8fafc; border: 1rpx solid #e8eef6; border-radius: 16rpx; }
+.mold-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; background: #ffffff; border: 1rpx solid #eef2f7; border-radius: 14rpx; overflow: hidden; }
+.mold-info-item { min-width: 0; display: flex; flex-direction: column; gap: 8rpx; padding: 18rpx 20rpx; border-right: 1rpx solid #f1f5f9; border-bottom: 1rpx solid #f1f5f9; }
+.mold-info-item:nth-child(2n) { border-right: 0; }
+.mold-info-item:nth-last-child(-n + 2) { border-bottom: 0; }
+.mold-info-label { font-size: 23rpx; color: #8a94a6; }
+.mold-info-value { font-size: 28rpx; color: #334155; line-height: 1.35; word-break: break-all; }
+.status-tag { display: inline-flex; align-items: center; align-self: flex-start; padding: 6rpx 16rpx; border-radius: 999rpx; font-size: 24rpx; }
.status-success { color: #15803d; background: #dcfce7; }
.status-warning { color: #d97706; background: #fef3c7; }
.status-danger { color: #dc2626; background: #fee2e2; }
.status-default { color: #6b7280; background: #f3f4f6; }
.form-field { display: flex; flex-direction: column; gap: 12rpx; }
.form-field + .form-field { margin-top: 24rpx; }
-.form-label { font-size: 26rpx; color: #6b7280; }
-.required-star { color: #ef4444; font-size: 28rpx; margin-right: 4rpx; }
+.form-label { font-size: 26rpx; color: #4b5563; font-weight: 500; }
+.required-star { color: #ef4444; font-size: 28rpx; margin-left: 4rpx; }
.form-input { width: 100%; height: 88rpx; padding: 0 24rpx; background: #f8fafc; border-radius: 14rpx; font-size: 28rpx; color: #374151; box-sizing: border-box; }
.template-select { display: flex; align-items: center; justify-content: space-between; height: 88rpx; padding: 0 24rpx; background: #f8fafc; border-radius: 14rpx; }
.template-text { font-size: 28rpx; color: #374151; }
@@ -457,10 +670,31 @@ async function handleSubmit() {
.inspection-header { display: flex; align-items: center; gap: 16rpx; }
.inspection-index { width: 44rpx; height: 44rpx; border-radius: 50%; background: #1f7cff; color: #ffffff; font-size: 24rpx; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.inspection-title { flex: 1; min-width: 0; font-size: 30rpx; font-weight: 600; color: #1f2937; }
+.required-tag { padding: 8rpx 16rpx; border-radius: 10rpx; background: #e8fff2; color: #22c55e; font-size: 24rpx; }
.inspection-fields { margin-top: 16rpx; display: flex; flex-direction: column; gap: 14rpx; }
.field-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 20rpx; }
.field-label { width: 170rpx; font-size: 27rpx; color: #9ca3af; flex-shrink: 0; }
.field-value { flex: 1; text-align: right; font-size: 28rpx; color: #374151; line-height: 1.5; }
+.field-block { display: flex; flex-direction: column; gap: 14rpx; }
+.block-label { width: auto; }
+.result-option-group { display: flex; align-items: center; gap: 16rpx; flex-wrap: wrap; }
+.result-option { min-width: 160rpx; height: 72rpx; padding: 0 24rpx; border-radius: 14rpx; border: 1rpx solid #d1d5db; color: #6b7280; font-size: 30rpx; display: flex; align-items: center; justify-content: center; background: #ffffff; }
+.result-option-active { border-color: #60a5fa; background: #eff6ff; color: #1f7cff; }
+.result-option-danger { border-color: #fca5a5; background: #fef2f2; color: #ef4444; }
+.pending-tag { padding: 8rpx 14rpx; border-radius: 10rpx; background: #f3f4f6; color: #9ca3af; font-size: 24rpx; }
+.form-textarea { width: 100%; min-height: 76rpx; max-height: 108rpx; background: #f8fafc; border-radius: 12rpx; padding: 10rpx 16rpx; font-size: 26rpx; color: #374151; box-sizing: border-box; }
+.number-box-wrap { width: 100%; }
+.number-box-wrap-inline { width: 320rpx; }
+.number-box-wrap :deep(.uni-numbox) { width: 100%; }
+.number-box-wrap :deep(.uni-numbox__value) { flex: 1; height: 60rpx; font-size: 24rpx; }
+.number-box-wrap :deep(.uni-numbox-btns) { min-width: 60rpx; justify-content: center; }
+.number-box-wrap :deep(.uni-numbox--text) { font-size: 18px; }
+.image-list { display: flex; flex-wrap: wrap; gap: 12rpx; }
+.image-item { position: relative; }
+.result-image { width: 140rpx; height: 140rpx; border-radius: 16rpx; background: #f3f4f6; }
+.image-remove { position: absolute; top: -12rpx; right: -12rpx; width: 36rpx; height: 36rpx; border-radius: 18rpx; background: rgba(15, 23, 42, 0.72); color: #ffffff; display: flex; align-items: center; justify-content: center; font-size: 24rpx; }
+.image-upload { width: 140rpx; height: 140rpx; border-radius: 16rpx; border: 2rpx dashed #cbd5e1; background: #f8fafc; display: flex; align-items: center; justify-content: center; }
+.image-upload-icon { font-size: 60rpx; color: #94a3b8; line-height: 1; }
.hint { padding: 48rpx 0; text-align: center; color: #9ca3af; font-size: 26rpx; }
.action-bar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 20rpx; padding: 20rpx 24rpx calc(20rpx + env(safe-area-inset-bottom)); background: #f5f7fb; }
.action-btn { flex: 1; height: 88rpx; border-radius: 18rpx; display: flex; align-items: center; justify-content: center; font-size: 30rpx; font-weight: 600; }
diff --git a/src/pages_function/pages/moldCheck/index.vue b/src/pages_function/pages/moldCheck/index.vue
index 8e5e0f2..47a099e 100644
--- a/src/pages_function/pages/moldCheck/index.vue
+++ b/src/pages_function/pages/moldCheck/index.vue
@@ -127,6 +127,10 @@ onLoad(async () => {
onShow(() => {
activateKeywordFocus()
+ if (uni.getStorageSync('moldCheckListNeedRefresh') === '1') {
+ uni.removeStorageSync('moldCheckListNeedRefresh')
+ fetchList(true)
+ }
})
onUnload(() => {