feat:模具管理-添加点检项库

master
黄伟杰 4 weeks ago
parent d537a23660
commit 22179e1eac

@ -0,0 +1,41 @@
import request from '@/utils/request'
export function getMoldInspectionItemPage(params = {}) {
return request({
url: '/admin-api/mes/mold-subject/page',
method: 'get',
params
})
}
export function getMoldInspectionItemDetail(id) {
return request({
url: '/admin-api/mes/mold-subject/get',
method: 'get',
params: { id }
})
}
export function createMoldInspectionItem(data) {
return request({
url: '/admin-api/mes/mold-subject/create',
method: 'post',
data
})
}
export function updateMoldInspectionItem(data) {
return request({
url: '/admin-api/mes/mold-subject/update',
method: 'put',
data
})
}
export function deleteMoldInspectionItem(ids = []) {
return request({
url: '/admin-api/mes/mold-subject/delete',
method: 'delete',
params: { ids: Array.isArray(ids) ? ids.join(',') : String(ids) }
})
}

@ -227,6 +227,38 @@ const messages = {
loadEditFailed: '加载编辑数据失败',
confirmDelete: '确认删除该上下模记录吗?'
},
moldInspectionItems: {
moduleName: '点检项库',
subTitle: '模具管理点检项维护',
detailTitle: '点检项库详情',
basicInfo: '基础信息',
code: '项目编码',
name: '项目名称',
inspectionMethod: '检验方式',
valueType: '值类型',
isEnable: '是否启用',
judgmentCriteria: '判定基准',
creatorName: '创建人',
createTime: '创建时间',
searchPlaceholder: '请输入编码/名称/判定基准',
createTitle: '新增点检项',
editTitle: '编辑点检项',
empty: '暂无点检项数据',
loadEditFailed: '加载编辑数据失败',
confirmDelete: '确认删除该点检项吗?',
placeholderCode: '请输入项目编码',
placeholderName: '请输入项目名称',
placeholderInspectionMethod: '请选择检验方式',
placeholderValueType: '请选择值类型',
placeholderIsEnable: '请选择是否启用',
placeholderJudgmentCriteria: '请输入判定基准',
validatorSubjectCodeRequired: '项目编码不能为空',
validatorSubjectNameRequired: '项目名称不能为空',
validatorInspectionMethodRequired: '检验方式不能为空',
validatorValueTypeRequired: '值类型不能为空',
validatorIsEnableRequired: '是否启用不能为空',
validatorJudgmentCriteriaRequired: '判定基准不能为空'
},
mine: {
clickLogin: '点击登录',
username: '用户名:{name}',
@ -538,6 +570,38 @@ const messages = {
loadEditFailed: 'Failed to load edit data',
confirmDelete: 'Delete this mold operate record?'
},
moldInspectionItems: {
moduleName: 'Inspection Items',
subTitle: 'Mold inspection item maintenance',
detailTitle: 'Inspection Item Detail',
basicInfo: 'Basic Info',
code: 'Item Code',
name: 'Item Name',
inspectionMethod: 'Inspection Method',
valueType: 'Value Type',
isEnable: 'Enabled',
judgmentCriteria: 'Judgment Criteria',
creatorName: 'Creator',
createTime: 'Created At',
searchPlaceholder: 'Enter code/name/criteria',
createTitle: 'Create Inspection Item',
editTitle: 'Edit Inspection Item',
empty: 'No inspection item data',
loadEditFailed: 'Failed to load edit data',
confirmDelete: 'Delete this inspection item?',
placeholderCode: 'Enter item code',
placeholderName: 'Enter item name',
placeholderInspectionMethod: 'Select inspection method',
placeholderValueType: 'Select value type',
placeholderIsEnable: 'Select enabled status',
placeholderJudgmentCriteria: 'Enter judgment criteria',
validatorSubjectCodeRequired: 'Item code is required',
validatorSubjectNameRequired: 'Item name is required',
validatorInspectionMethodRequired: 'Inspection method is required',
validatorValueTypeRequired: 'Value type is required',
validatorIsEnableRequired: 'Enabled status is required',
validatorJudgmentCriteriaRequired: 'Judgment criteria is required'
},
mine: {
clickLogin: 'Tap to sign in',
username: 'Username: {name}',
@ -687,7 +751,9 @@ const literalMap = {
'模具入库': 'moldReturn.moduleName',
'模具入库详情': 'moldReturn.detailTitle',
'上下模': 'moldOperate.moduleName',
'上下模详情': 'moldOperate.detailTitle'
'上下模详情': 'moldOperate.detailTitle',
'点检项库': 'moldInspectionItems.moduleName',
'点检项库详情': 'moldInspectionItems.detailTitle'
}
function applyTabBarLanguage() {

@ -490,6 +490,20 @@
"navigationBarTitleText": "上下模详情",
"navigationStyle": "custom"
}
},
{
"path": "moldInspectionItems/index",
"style": {
"navigationBarTitleText": "点检项库",
"navigationStyle": "custom"
}
},
{
"path": "moldInspectionItems/detail",
"style": {
"navigationBarTitleText": "点检项库详情",
"navigationStyle": "custom"
}
}
]
}

@ -259,11 +259,11 @@
<text class="submodule-name">点检保养</text>
</view>
<view class="function-grid">
<view class="function-item" @click="handleClick('点检项库')">
<view class="function-item" @click="handleClick('moldInspectionItems')">
<view class="function-icon" style="background: rgba(0, 188, 212, 0.1);">
<text class="icon-inner">📝</text>
</view>
<text class="function-name">点检项库</text>
<text class="function-name">{{ t('moldInspectionItems.moduleName') }}</text>
</view>
<view class="function-item" @click="handleClick('点检模板')">
<view class="function-icon" style="background: rgba(0, 188, 212, 0.1);">
@ -379,6 +379,7 @@ function handleClick(name) {
moldGet: '/pages_function/pages/moldget/index',
moldReturn: '/pages_function/pages/moldreturn/index',
moldOperate: '/pages_function/pages/moldoperate/index',
moldInspectionItems: '/pages_function/pages/moldInspectionItems/index',
'点检项库': '',
'点检模板': '',
'点检任务': '',

@ -0,0 +1,107 @@
<template>
<view class="page-container">
<view class="fixed-header">
<AppTitleHeader :title="t('moldInspectionItems.detailTitle')" />
</view>
<view class="content-section">
<view class="info-card">
<view class="card-title">{{ t('moldInspectionItems.basicInfo') }}</view>
<view class="info-list">
<view class="info-row">
<text class="info-label">{{ t('moldInspectionItems.code') }}</text>
<text class="info-value">{{ textValue(detailData.subjectCode) }}</text>
</view>
<view class="info-row">
<text class="info-label">{{ t('moldInspectionItems.name') }}</text>
<text class="info-value">{{ textValue(detailData.subjectName) }}</text>
</view>
<view class="info-row">
<text class="info-label">{{ t('moldInspectionItems.inspectionMethod') }}</text>
<text class="info-value">{{ dictLabel(inspectionMethodOptions, detailData.inspectionMethod) }}</text>
</view>
<view class="info-row">
<text class="info-label">{{ t('moldInspectionItems.valueType') }}</text>
<text class="info-value">{{ dictLabel(valueTypeOptions, detailData.valueType) }}</text>
</view>
<view class="info-row">
<text class="info-label">{{ t('moldInspectionItems.isEnable') }}</text>
<text class="info-value">{{ dictLabel(boolOptions, detailData.isEnable) }}</text>
</view>
<view class="info-row">
<text class="info-label">{{ t('moldInspectionItems.creatorName') }}</text>
<text class="info-value">{{ textValue(detailData.creatorName) }}</text>
</view>
<view class="info-row">
<text class="info-label">{{ t('moldInspectionItems.createTime') }}</text>
<text class="info-value">{{ formatDateTime(detailData.createTime) }}</text>
</view>
<view class="info-row remark-row">
<text class="info-label">{{ t('moldInspectionItems.judgmentCriteria') }}</text>
<text class="info-value remark-value">{{ textValue(detailData.judgmentCriteria) }}</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup>
import { reactive } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { useI18n } from 'vue-i18n'
import AppTitleHeader from '@/components/common/AppTitleHeader.vue'
import { useDict } from '@/utils/dict'
import { getMoldInspectionItemDetail } from '@/api/mes/moldInspectionItems'
const { t } = useI18n()
const { Inspection_method, value_types, infra_boolean_string } = useDict('Inspection_method', 'value_types', 'infra_boolean_string')
const inspectionMethodOptions = Inspection_method
const valueTypeOptions = value_types
const boolOptions = infra_boolean_string
const detailData = reactive({})
function textValue(v) {
if (v === 0) return '0'
if (v === null || v === undefined) return '-'
const s = String(v).trim()
return s || '-'
}
function dictLabel(options, value) {
const hit = (options.value || []).find((o) => String(o.value) === String(value))
return hit ? hit.label : textValue(value)
}
function formatDateTime(v) {
if (!v) return '-'
const d = new Date(Number(v))
if (Number.isNaN(d.getTime())) return textValue(v)
const p = (n) => String(n).padStart(2, '0')
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`
}
onLoad(async (query) => {
const id = query?.id
if (!id) {
uni.showToast({ title: t('functionCommon.noIdView'), icon: 'none' })
return
}
try {
const res = await getMoldInspectionItemDetail(id)
Object.assign(detailData, res?.data || {})
} catch (error) {
uni.showToast({ title: t('functionCommon.loadFailed'), icon: 'none' })
}
})
</script>
<style lang="scss" scoped>
.page-container { min-height: 100vh; background: #f0f2f5; }
.fixed-header { position: sticky; top: 0; z-index: 20; }
.content-section { padding: 0 24rpx 24rpx; }
.info-card { margin-top: 20rpx; background: #fff; border-radius: 20rpx; padding: 28rpx; box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.05); }
.card-title { font-size: 32rpx; color: #1a3a5c; font-weight: 700; margin-bottom: 18rpx; }
.info-row { display: flex; justify-content: space-between; align-items: flex-start; padding: 18rpx 0; border-bottom: 1rpx solid #edf0f3; }
.info-label { font-size: 27rpx; color: #8a9099; width: 220rpx; }
.info-value { flex: 1; text-align: right; font-size: 28rpx; color: #303133; line-height: 1.45; }
.remark-row { border-bottom: none; }
.remark-value { white-space: pre-wrap; }
</style>

@ -0,0 +1,419 @@
<template>
<view class="page-container">
<AppTitleHeader :title="t('moldInspectionItems.moduleName')" :subTitle="t('moldInspectionItems.subTitle')" :showSubTitle="true" />
<!-- 查询区域 -->
<view class="search-card">
<view class="search-row">
<view class="search-input-wrap">
<text class="iconfont icon-search search-icon"></text>
<input v-model="searchKeyword" class="search-input" :placeholder="t('moldInspectionItems.searchPlaceholder')" @confirm="handleSearch" />
</view>
<view class="search-btn" @click="handleSearch">{{ t('functionCommon.search') }}</view>
</view>
</view>
<!-- 列表区域 -->
<scroll-view scroll-y class="list-scroll" :scroll-top="scrollTop" @scroll="onScroll" @scrolltolower="loadMore" :lower-threshold="80">
<view class="list-wrap">
<view v-for="item in list" :key="item.id" class="type-card" @click="openDetail(item)">
<view class="card-header">
<view class="header-left">
<text class="type-name">{{ textValue(item.subjectName) }}</text>
<text class="type-code">{{ t('moldInspectionItems.code') }}: {{ textValue(item.subjectCode) }}</text>
</view>
<view class="card-actions">
<view class="action-btn edit-btn" @click.stop="openEdit(item)">
<uni-icons type="compose" size="18" color="#ffffff"></uni-icons>
</view>
<view class="action-btn delete-btn" @click.stop="confirmDelete(item)">
<uni-icons type="trash" size="18" color="#ffffff"></uni-icons>
</view>
</view>
</view>
<view class="card-body">
<view class="row">
<text class="label">{{ t('moldInspectionItems.inspectionMethod') }}</text>
<text class="value">{{ dictLabel(inspectionMethodOptions, item.inspectionMethod) }}</text>
</view>
<view class="row">
<text class="label">{{ t('moldInspectionItems.valueType') }}</text>
<text class="value">{{ dictLabel(valueTypeOptions, item.valueType) }}</text>
</view>
<view class="row">
<text class="label">{{ t('moldInspectionItems.isEnable') }}</text>
<text class="value">{{ dictLabel(boolOptions, item.isEnable) }}</text>
</view>
<view class="row">
<text class="label">{{ t('moldInspectionItems.creatorName') }}</text>
<text class="value">{{ textValue(item.creatorName) }}</text>
</view>
<view class="row">
<text class="label">{{ t('moldInspectionItems.createTime') }}</text>
<text class="value">{{ formatDateTime(item.createTime) }}</text>
</view>
</view>
</view>
<view v-if="loading && pageNo === 1" class="hint">{{ t('functionCommon.loading') }}</view>
<view v-else-if="!list.length" class="hint">{{ t('moldInspectionItems.empty') }}</view>
<view v-else-if="loadingMore" class="hint">{{ t('functionCommon.loadingMore') }}</view>
<view v-else-if="finished" class="hint">{{ t('functionCommon.noMoreData') }}</view>
</view>
</scroll-view>
<view class="fab-btn" @click="openCreate">
<uni-icons type="plusempty" size="30" color="#fff"></uni-icons>
</view>
<view v-if="showGoTop" class="go-top-btn" @click="goTop">
<uni-icons type="arrow-up" size="20" color="#1a3a5c"></uni-icons>
</view>
<!-- 新增/编辑弹框 -->
<uni-popup ref="formPopupRef" type="center" background-color="#fff">
<view class="popup-content">
<view class="popup-header">
<text class="popup-title">{{ formMode === 'create' ? t('moldInspectionItems.createTitle') : t('moldInspectionItems.editTitle') }}</text>
<view class="popup-close" @click="closeForm">
<text class="close-icon">×</text>
</view>
</view>
<scroll-view scroll-y class="form-scroll">
<view class="form-content">
<view class="form-item">
<text class="form-label">{{ t('moldInspectionItems.code') }} <text class="required-star">*</text></text>
<input v-model="formData.subjectCode" class="form-input" type="text" :placeholder="t('moldInspectionItems.placeholderCode')" />
</view>
<view class="form-item">
<text class="form-label">{{ t('moldInspectionItems.name') }} <text class="required-star">*</text></text>
<input v-model="formData.subjectName" class="form-input" type="text" :placeholder="t('moldInspectionItems.placeholderName')" />
</view>
<view class="form-item">
<text class="form-label">{{ t('moldInspectionItems.inspectionMethod') }} <text class="required-star">*</text></text>
<picker mode="selector" :range="inspectionMethodOptions" range-key="label" :value="inspectionMethodIndex" @change="onInspectionMethodChange">
<view class="picker-view">{{ inspectionMethodLabel || t('moldInspectionItems.placeholderInspectionMethod') }}</view>
</picker>
</view>
<view class="form-item">
<text class="form-label">{{ t('moldInspectionItems.valueType') }} <text class="required-star">*</text></text>
<picker mode="selector" :range="valueTypeOptions" range-key="label" :value="valueTypeIndex" @change="onValueTypeChange">
<view class="picker-view">{{ valueTypeLabel || t('moldInspectionItems.placeholderValueType') }}</view>
</picker>
</view>
<view class="form-item">
<text class="form-label">{{ t('moldInspectionItems.isEnable') }} <text class="required-star">*</text></text>
<picker mode="selector" :range="boolOptions" range-key="label" :value="boolIndex" @change="onBoolChange">
<view class="picker-view">{{ boolLabel || t('moldInspectionItems.placeholderIsEnable') }}</view>
</picker>
</view>
<view class="form-item">
<text class="form-label">{{ t('moldInspectionItems.judgmentCriteria') }} <text class="required-star">*</text></text>
<textarea v-model="formData.judgmentCriteria" class="form-textarea" :placeholder="t('moldInspectionItems.placeholderJudgmentCriteria')" maxlength="500" />
</view>
</view>
</scroll-view>
<view class="form-footer">
<view class="footer-btn cancel-btn" @click="closeForm"><text class="btn-text">{{ t('functionCommon.cancel') }}</text></view>
<view class="footer-btn confirm-btn" @click="submitForm"><text class="btn-text">{{ t('functionCommon.save') }}</text></view>
</view>
</view>
</uni-popup>
</view>
</template>
<script setup>
import { computed, reactive, ref } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import { useI18n } from 'vue-i18n'
import AppTitleHeader from '@/components/common/AppTitleHeader.vue'
import { useDict } from '@/utils/dict'
import { getMoldInspectionItemPage, getMoldInspectionItemDetail, createMoldInspectionItem, updateMoldInspectionItem, deleteMoldInspectionItem } from '@/api/mes/moldInspectionItems'
const { t } = useI18n()
const { Inspection_method, value_types, infra_boolean_string } = useDict('Inspection_method', 'value_types', 'infra_boolean_string')
const formPopupRef = ref(null)
const searchKeyword = ref('')
const list = ref([])
const loading = ref(false)
const loadingMore = ref(false)
const finished = ref(false)
const pageNo = ref(1)
const pageSize = ref(10)
const scrollTop = ref(0)
const showGoTop = ref(false)
const formMode = ref('create')
const formData = reactive({
id: undefined,
subjectCode: '',
subjectName: '',
inspectionMethod: '',
valueType: '',
isEnable: '',
judgmentCriteria: ''
})
const inspectionMethodOptions = computed(() => Inspection_method.value || [])
const valueTypeOptions = computed(() => value_types.value || [])
const boolOptions = computed(() => infra_boolean_string.value || [])
const inspectionMethodLabel = computed(() => dictLabel(inspectionMethodOptions.value, formData.inspectionMethod))
const valueTypeLabel = computed(() => dictLabel(valueTypeOptions.value, formData.valueType))
const boolLabel = computed(() => dictLabel(boolOptions.value, formData.isEnable))
const inspectionMethodIndex = computed(() => optionIndex(inspectionMethodOptions.value, formData.inspectionMethod))
const valueTypeIndex = computed(() => optionIndex(valueTypeOptions.value, formData.valueType))
const boolIndex = computed(() => optionIndex(boolOptions.value, formData.isEnable))
function optionIndex(options, value) {
const idx = options.findIndex((o) => String(o.value) === String(value))
return idx < 0 ? 0 : idx
}
function dictLabel(options, value) {
const hit = (options || []).find((o) => String(o.value) === String(value))
return hit ? hit.label : textValue(value)
}
function textValue(v) {
if (v === 0) return '0'
if (v === null || v === undefined) return '-'
const s = String(v).trim()
return s || '-'
}
function formatDateTime(v) {
if (!v) return '-'
const d = new Date(Number(v))
if (Number.isNaN(d.getTime())) return textValue(v)
const p = (n) => String(n).padStart(2, '0')
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`
}
function normalizePageData(res) {
const root = res && res.data !== undefined ? res.data : res
const l = root?.list || root?.rows || root?.records || root?.data?.list || []
const total = root?.total ?? root?.data?.total ?? (Array.isArray(l) ? l.length : 0)
return { list: Array.isArray(l) ? l : [], total: Number(total || 0) }
}
async function fetchList(reset = true) {
if (reset) {
pageNo.value = 1
finished.value = false
}
if (pageNo.value === 1) loading.value = true
else loadingMore.value = true
try {
const params = {
pageNo: pageNo.value,
pageSize: pageSize.value,
subjectCode: searchKeyword.value.trim() || undefined,
subjectName: searchKeyword.value.trim() || undefined,
judgmentCriteria: searchKeyword.value.trim() || undefined
}
const res = await getMoldInspectionItemPage(params)
const page = normalizePageData(res)
if (reset) list.value = page.list
else list.value = [...list.value, ...page.list]
finished.value = list.value.length >= page.total || page.list.length < pageSize.value
} catch (e) {
if (!reset) pageNo.value = Math.max(1, pageNo.value - 1)
uni.showToast({ title: t('functionCommon.loadFailed'), icon: 'none' })
} finally {
loading.value = false
loadingMore.value = false
}
}
async function handleSearch() { await fetchList(true) }
async function loadMore() {
if (loading.value || loadingMore.value || finished.value) return
pageNo.value += 1
await fetchList(false)
}
function onScroll(e) {
const top = Number(e?.detail?.scrollTop || 0)
showGoTop.value = top > 600
}
function goTop() { scrollTop.value = 0 }
function resetForm() {
formData.id = undefined
formData.subjectCode = ''
formData.subjectName = ''
formData.inspectionMethod = inspectionMethodOptions.value[0]?.value ?? ''
formData.valueType = valueTypeOptions.value[0]?.value ?? ''
formData.isEnable = boolOptions.value[0]?.value ?? ''
formData.judgmentCriteria = ''
}
function openCreate() {
formMode.value = 'create'
resetForm()
formPopupRef.value?.open()
}
async function openEdit(item) {
const id = item?.id
if (!id) {
uni.showToast({ title: t('functionCommon.noIdEdit'), icon: 'none' })
return
}
formMode.value = 'update'
resetForm()
try {
const res = await getMoldInspectionItemDetail(id)
const detail = res?.data || {}
formData.id = detail.id
formData.subjectCode = detail.subjectCode || ''
formData.subjectName = detail.subjectName || ''
formData.inspectionMethod = detail.inspectionMethod ?? formData.inspectionMethod
formData.valueType = detail.valueType ?? formData.valueType
formData.isEnable = detail.isEnable ?? formData.isEnable
formData.judgmentCriteria = detail.judgmentCriteria || ''
formPopupRef.value?.open()
} catch (e) {
uni.showToast({ title: t('moldInspectionItems.loadEditFailed'), icon: 'none' })
}
}
async function openDetail(item) {
if (!item?.id) {
uni.showToast({ title: t('functionCommon.noIdView'), icon: 'none' })
return
}
uni.navigateTo({
url: `/pages_function/pages/moldInspectionItems/detail?id=${encodeURIComponent(String(item.id))}`
})
}
async function confirmDelete(item) {
if (!item?.id) {
uni.showToast({ title: t('functionCommon.noIdDelete'), icon: 'none' })
return
}
uni.showModal({
title: t('functionCommon.confirmDelete'),
content: t('moldInspectionItems.confirmDelete'),
success: async ({ confirm }) => {
if (!confirm) return
try {
await deleteMoldInspectionItem([item.id])
uni.showToast({ title: t('functionCommon.deleteSuccess'), icon: 'success' })
await fetchList(true)
} catch (e) {
uni.showToast({ title: t('functionCommon.deleteFailed'), icon: 'none' })
}
}
})
}
function closeForm() { formPopupRef.value?.close() }
function onInspectionMethodChange(e) {
const idx = Number(e?.detail?.value || 0)
formData.inspectionMethod = inspectionMethodOptions.value[idx]?.value
}
function onValueTypeChange(e) {
const idx = Number(e?.detail?.value || 0)
formData.valueType = valueTypeOptions.value[idx]?.value
}
function onBoolChange(e) {
const idx = Number(e?.detail?.value || 0)
formData.isEnable = boolOptions.value[idx]?.value
}
function validateForm() {
if (!String(formData.subjectCode || '').trim()) {
uni.showToast({ title: t('moldInspectionItems.validatorSubjectCodeRequired'), icon: 'none' })
return false
}
if (!String(formData.subjectName || '').trim()) {
uni.showToast({ title: t('moldInspectionItems.validatorSubjectNameRequired'), icon: 'none' })
return false
}
if (formData.inspectionMethod === '' || formData.inspectionMethod === undefined || formData.inspectionMethod === null) {
uni.showToast({ title: t('moldInspectionItems.validatorInspectionMethodRequired'), icon: 'none' })
return false
}
if (formData.valueType === '' || formData.valueType === undefined || formData.valueType === null) {
uni.showToast({ title: t('moldInspectionItems.validatorValueTypeRequired'), icon: 'none' })
return false
}
if (formData.isEnable === '' || formData.isEnable === undefined || formData.isEnable === null) {
uni.showToast({ title: t('moldInspectionItems.validatorIsEnableRequired'), icon: 'none' })
return false
}
if (!String(formData.judgmentCriteria || '').trim()) {
uni.showToast({ title: t('moldInspectionItems.validatorJudgmentCriteriaRequired'), icon: 'none' })
return false
}
return true
}
async function submitForm() {
if (!validateForm()) return
const payload = {
id: formMode.value === 'update' ? formData.id : undefined,
subjectCode: String(formData.subjectCode).trim(),
subjectName: String(formData.subjectName).trim(),
inspectionMethod: formData.inspectionMethod,
valueType: formData.valueType,
isEnable: formData.isEnable,
judgmentCriteria: String(formData.judgmentCriteria).trim()
}
try {
if (formMode.value === 'create') {
await createMoldInspectionItem(payload)
uni.showToast({ title: t('functionCommon.createSuccess'), icon: 'success' })
} else {
await updateMoldInspectionItem(payload)
uni.showToast({ title: t('functionCommon.updateSuccess'), icon: 'success' })
}
closeForm()
await fetchList(true)
} catch (e) {
uni.showToast({ title: t('functionCommon.saveFailed'), icon: 'none' })
}
}
onShow(async () => {
await fetchList(true)
})
</script>
<style lang="scss" scoped>
.page-container { min-height: 100vh; background-color: #f0f2f5; }
.search-card { margin: 16rpx 24rpx; display: flex; gap: 16rpx; background: #fff; border-radius: 14rpx; padding: 16rpx; }
.search-row { display: flex; gap: 12rpx; width: 100%; }
.search-input-wrap { flex: 1; display: flex; align-items: center; background: #f5f7fa; border-radius: 40rpx; padding: 0 20rpx; }
.search-icon { color: #909399; font-size: 30rpx; }
.search-input { flex: 1; height: 68rpx; margin-left: 12rpx; font-size: 26rpx; }
.search-btn { min-width: 120rpx; height: 68rpx; border-radius: 34rpx; background: #1a3a5c; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 26rpx; }
.list-scroll { height: calc(100vh - 280rpx); }
.list-wrap { padding: 0 24rpx 130rpx; }
.type-card { background: #ffffff; border-radius: 18rpx; padding: 24rpx; margin-bottom: 18rpx; box-shadow: 0 4rpx 18rpx rgba(0, 0, 0, 0.05); }
.card-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 18rpx; border-bottom: 1rpx solid #edf0f3; }
.header-left { display: flex; flex-direction: column; gap: 8rpx; }
.type-name { font-size: 32rpx; font-weight: 700; color: #1f2d3d; }
.type-code { font-size: 24rpx; color: #8a9099; }
.card-actions { display: flex; gap: 14rpx; }
.action-btn { width: 60rpx; height: 60rpx; border-radius: 12rpx; display: flex; align-items: center; justify-content: center; }
.edit-btn { background: #1a3a5c; }
.delete-btn { background: #e34d59; }
.card-body { padding-top: 16rpx; }
.row { display: flex; justify-content: space-between; align-items: center; margin-top: 12rpx; }
.label { font-size: 26rpx; color: #8a9099; }
.value { font-size: 27rpx; color: #30363d; max-width: 62%; text-align: right; }
.hint { text-align: center; color: #909399; padding: 24rpx 0; }
.fab-btn { position: fixed; right: 34rpx; bottom: 120rpx; width: 96rpx; height: 96rpx; border-radius: 50%; background: linear-gradient(135deg, #1a3a5c 0%, #2d5a87 100%); display: flex; align-items: center; justify-content: center; box-shadow: 0 10rpx 30rpx rgba(26, 58, 92, 0.3); z-index: 20; }
.go-top-btn { position: fixed; right: 34rpx; bottom: 240rpx; width: 80rpx; height: 80rpx; border-radius: 50%; background: #fff; box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.12); display: flex; align-items: center; justify-content: center; }
.popup-content { width: 680rpx; max-height: 80vh; background: #fff; border-radius: 24rpx; overflow: hidden; }
.popup-header { height: 92rpx; display: flex; align-items: center; justify-content: center; position: relative; border-bottom: 1rpx solid #edf0f3; }
.popup-title { font-size: 32rpx; font-weight: 700; color: #1f2d3d; }
.popup-close { position: absolute; right: 24rpx; top: 20rpx; width: 48rpx; height: 48rpx; display: flex; align-items: center; justify-content: center; }
.close-icon { font-size: 42rpx; color: #9aa0a6; line-height: 1; }
.form-scroll { max-height: calc(80vh - 180rpx); }
.form-content { padding: 22rpx 28rpx; }
.form-item { margin-bottom: 18rpx; }
.form-label { display: block; font-size: 25rpx; color: #5f6b7a; margin-bottom: 10rpx; }
.required-star { color: #e34d59; }
.form-input,.picker-view { min-height: 72rpx; background: #f7f9fc; border-radius: 12rpx; padding: 0 18rpx; display: flex; align-items: center; font-size: 26rpx; color: #2f3a45; }
.form-textarea { width: 100%; min-height: 140rpx; background: #f7f9fc; border-radius: 12rpx; padding: 14rpx 18rpx; font-size: 26rpx; color: #2f3a45; box-sizing: border-box; }
.form-footer { height: 88rpx; display: flex; border-top: 1rpx solid #edf0f3; }
.footer-btn { flex: 1; display: flex; align-items: center; justify-content: center; }
.btn-text { font-size: 28rpx; }
.cancel-btn { background: #f4f6fa; color: #5f6b7a; }
.confirm-btn { background: #1a3a5c; color: #fff; }
</style>

@ -638,7 +638,7 @@ onShow(async () => {
font-size: 26rpx;
color: #8a9099;
}
.value {
font-size: 27rpx;
color: #30363d;

Loading…
Cancel
Save