From 077ab59c700b85efdd057265bf752ad5942395b2 Mon Sep 17 00:00:00 2001
From: ZN <zhang_12370@163.com>
Date: 星期二, 17 三月 2026 17:36:13 +0800
Subject: [PATCH] feat(quality): 新增质量管理模块的API接口和移动端页面
---
src/api/qualityManagement/inspectItem.js | 25
src/api/qualityManagement/qualityInspectParam.js | 27
src/api/qualityManagement/materialInspection.js | 166
src/pages/qualityManagement/InspectItem/index.vue | 340 +
src/pages/qualityManagement/finalInspection/add.vue | 1128 +++++
src/pages/qualityManagement/materialInspection/add.vue | 1134 +++++
src/pages/qualityManagement/finalInspection/fileList.vue | 566 ++
src/pages/qualityManagement/metricBinding/index.vue | 283 +
src/api/qualityManagement/nearExpiryReturn.js | 45
src/pages/qualityManagement/materialInspection/fileList.vue | 566 ++
src/pages/qualityManagement/processInspection/index.vue | 775 +++
src/pages/qualityManagement/processInspection/fileList.vue | 566 ++
src/pages/qualityManagement/metricMaintenance/detail.vue | 335 +
src/pages/qualityManagement/materialInspection/detail.vue | 421 ++
src/pages/qualityManagement/rawMaterial/index.vue | 335 +
src/pages/qualityManagement/processInspection/add.vue | 1128 +++++
src/api/qualityManagement/qualityTestStandardBinding.js | 28
src/pages/qualityManagement/finalInspection/detail.vue | 422 ++
src/pages/qualityManagement/visualization/qualityDashboard.vue | 276 +
src/api/qualityManagement/rawMaterial.js | 71
src/utils/native.ts | 56
src/pages/qualityManagement/finalInspection/index.vue | 776 +++
src/pages/qualityManagement/nonconformingManagement/index.vue | 434 ++
src/api/qualityManagement/metricMaintenance.js | 101
src/pages/qualityManagement/nearExpiryReturn/index.vue | 404 +
src/pages/qualityManagement/metricBinding/detail.vue | 268 +
src/pages/qualityManagement/processInspection/detail.vue | 423 ++
src/api/basicData/productProcess.js | 10
src/pages/qualityManagement/metricMaintenance/index.vue | 498 ++
src/api/qualityManagement/nonconformingManagement.js | 50
src/api/qualityManagement/qualityInspectFile.js | 26
src/pages/qualityManagement/materialInspection/index.vue | 775 +++
32 files changed, 12,458 insertions(+), 0 deletions(-)
diff --git a/src/api/basicData/productProcess.js b/src/api/basicData/productProcess.js
new file mode 100644
index 0000000..e0208fa
--- /dev/null
+++ b/src/api/basicData/productProcess.js
@@ -0,0 +1,10 @@
+import request from '@/utils/request'
+
+// 宸ュ簭鍒楄〃鍒嗛〉鏌ヨ
+export function productProcessListPage(query) {
+ return request({
+ url: '/productProcess/listPage',
+ method: 'get',
+ params: query
+ })
+}
diff --git a/src/api/qualityManagement/inspectItem.js b/src/api/qualityManagement/inspectItem.js
new file mode 100644
index 0000000..1203b57
--- /dev/null
+++ b/src/api/qualityManagement/inspectItem.js
@@ -0,0 +1,25 @@
+import request from "@/utils/request";
+
+export function qualityInspectItemListPage(data) {
+ return request({
+ url: "/qualityInspectItem/listPage",
+ method: "post",
+ data,
+ });
+}
+
+export function qualityInspectItemSave(data) {
+ return request({
+ url: "/qualityInspectItem/save",
+ method: "post",
+ data,
+ });
+}
+
+export function qualityInspectItemDelete(data) {
+ return request({
+ url: "/qualityInspectItem/delete",
+ method: "post",
+ data,
+ });
+}
diff --git a/src/api/qualityManagement/materialInspection.js b/src/api/qualityManagement/materialInspection.js
new file mode 100644
index 0000000..6f458b4
--- /dev/null
+++ b/src/api/qualityManagement/materialInspection.js
@@ -0,0 +1,166 @@
+import request from "@/utils/request";
+
+// 鏌ヨ鍘熸潗鏂欐楠屽垪琛�
+export function qualityInspectListPage(query) {
+ return request({
+ url: '/quality/qualityInspect/listPage',
+ method: 'get',
+ params: query,
+ })
+}
+
+// 鏂板鍘熸潗鏂欐楠�
+export function qualityInspectAdd(data) {
+ return request({
+ url: '/quality/qualityInspect/add',
+ method: 'post',
+ data: data,
+ })
+}
+
+// 淇敼鍘熸潗鏂欐楠�
+export function qualityInspectUpdate(data) {
+ return request({
+ url: '/quality/qualityInspect/update',
+ method: 'post',
+ data: data,
+ })
+}
+
+// 鍒犻櫎鍘熸潗鏂欐楠�
+export function qualityInspectDel(data) {
+ return request({
+ url: '/quality/rawMaterialInspection/delete',
+ method: 'post',
+ data: data,
+ })
+}
+
+// 鎻愪氦鍘熸潗鏂欐楠�
+export function submitQualityInspect(data) {
+ return request({
+ url: '/quality/qualityInspect/submit',
+ method: 'post',
+ data: data,
+ })
+}
+
+// 涓嬭浇鍘熸潗鏂欐楠屾姤鍛�
+export function downloadQualityInspect(data) {
+ return request({
+ url: '/quality/rawMaterialInspection/export',
+ method: 'post',
+ data: data,
+ responseType: "blob",
+ })
+}
+
+// 鑾峰彇渚涘簲鍟嗗垪琛�
+export function getSupplierList() {
+ return request({
+ url: '/basic/supplier/list',
+ method: 'get',
+ })
+}
+
+// 鑾峰彇浜у搧鍒楄〃
+export function getProductList() {
+ return request({
+ url: '/basic/product/list',
+ method: 'get',
+ })
+}
+
+// 鑾峰彇浜у搧鍨嬪彿鍒楄〃
+export function getProductModelList(productId) {
+ return request({
+ url: '/basic/productModel/list',
+ method: 'get',
+ params: { productId },
+ })
+}
+
+// 鑾峰彇妫�楠屽憳鍒楄〃
+export function getUserList() {
+ return request({
+ url: '/system/user/list',
+ method: 'get',
+ })
+}
+
+
+// 鏌ヨ妫�楠屾寚鏍�
+export function qualityInspectParamInfo(query) {
+ return request({
+ url: '/quality/qualityInspectParam/' + query,
+ method: 'get',
+ data: query,
+ })
+}
+// 鎻愪氦妫�楠�
+export function qualityInspectParamUpdate(query) {
+ return request({
+ url: '/quality/qualityInspectParam/update',
+ method: 'post',
+ data: query,
+ })
+}
+
+// 鍒犻櫎妫�楠岃褰�
+export function qualityInspectParamDel(query) {
+ return request({
+ url: '/quality/qualityInspectParam/del',
+ method: 'delete',
+ data: query,
+ })
+}
+// 鍒犻櫎鎸囨爣鍒楄〃
+export function qualityInspectDetailByProductId(params) {
+ return request({
+ url: "/qualityTestStandard/getQualityTestStandardByProductId",
+ method: "get",
+ params: params,
+ });
+}
+// 鏍规嵁鏍囧噯ID鑾峰彇鏍囧噯鍙傛暟
+export function getQualityTestStandardParamByTestStandardId(testStandardId) {
+ return request({
+ url: "/qualityTestStandard/getQualityTestStandardParamByTestStandardId",
+ method: "get",
+ params: { testStandardId },
+ });
+}
+
+// 鏌ヨ闄勪欢鍒楄〃
+export function qualityInspectFileListPage(query) {
+ return request({
+ url: '/quality/qualityInspectFile/listPage',
+ method: 'get',
+ params: query,
+ })
+}
+// 淇濆瓨闄勪欢鍒楄〃
+export function qualityInspectFileAdd(query) {
+ return request({
+ url: '/quality/qualityInspectFile/add',
+ method: 'post',
+ data: query,
+ })
+}
+// 鍒犻櫎闄勪欢鍒楄〃
+export function qualityInspectFileDel(query) {
+ return request({
+ url: '/quality/qualityInspectFile/del',
+ method: 'delete',
+ data: query,
+ })
+}
+
+
+// 宸ュ簭鏌ヨ
+export function list() {
+ return request({
+ url: "/productProcess/list",
+ method: "get",
+ });
+}
\ No newline at end of file
diff --git a/src/api/qualityManagement/metricMaintenance.js b/src/api/qualityManagement/metricMaintenance.js
new file mode 100644
index 0000000..95bcbc8
--- /dev/null
+++ b/src/api/qualityManagement/metricMaintenance.js
@@ -0,0 +1,101 @@
+import request from "@/utils/request";
+
+// 鏌ヨ鎸囨爣鍒楄〃
+export function qualityTestStandardListPage(query) {
+ return request({
+ url: "/qualityTestStandard/listPage",
+ method: "get",
+ params: query,
+ });
+}
+
+// 鏂板鎸囨爣鍒楄〃
+export function qualityTestStandardAdd(query) {
+ return request({
+ url: "/qualityTestStandard/add",
+ method: "post",
+ data: query,
+ });
+}
+
+// 淇敼鎸囨爣鍒楄〃
+export function qualityTestStandardUpdate(query) {
+ return request({
+ url: "/qualityTestStandard/update",
+ method: "post",
+ data: query,
+ });
+}
+
+// 鍒犻櫎鎸囨爣鍒楄〃
+export function qualityTestStandardDel(query) {
+ return request({
+ url: "/qualityTestStandard/del",
+ method: "delete",
+ data: query,
+ });
+}
+
+// 鍒犻櫎鎸囨爣鍒楄〃
+export function qualityInspectDetailByProductId(params) {
+ return request({
+ url: "/qualityTestStandard/getQualityTestStandardByProductId",
+ method: "get",
+ params: params,
+ });
+}
+
+// 澶嶅埗鏍囧噯鍙傛暟
+export function qualityTestStandardCopyParam(id) {
+ return request({
+ url: "/qualityTestStandard/copyParam",
+ method: "post",
+ data: { id },
+ });
+}
+
+// 鎵归噺瀹℃牳锛堢姸鎬侊細1=閫氳繃/鎵瑰噯锛�2=鎾ら攢锛�
+// 浼犲弬锛歔{ id, state }]
+export function qualityTestStandardAudit(data) {
+ return request({
+ url: "/qualityTestStandard/qualityTestStandardAudit",
+ method: "post",
+ data,
+ });
+}
+
+// 鏍囧噯鍙傛暟锛氬垪琛紙涓嶅垎椤碉級
+export function qualityTestStandardParamList(query) {
+ return request({
+ url: "/qualityTestStandardParam/list",
+ method: "get",
+ params: query,
+ });
+}
+
+// 鏍囧噯鍙傛暟锛氭柊澧�
+export function qualityTestStandardParamAdd(data) {
+ return request({
+ url: "/qualityTestStandardParam/add",
+ method: "post",
+ data,
+ });
+}
+
+// 鏍囧噯鍙傛暟锛氫慨鏀�
+export function qualityTestStandardParamUpdate(data) {
+ return request({
+ url: "/qualityTestStandardParam/update",
+ method: "post",
+ data,
+ });
+}
+
+// 鏍囧噯鍙傛暟锛氬垹闄わ紙浼� id 鏁扮粍锛�
+export function qualityTestStandardParamDel(ids) {
+ return request({
+ url: "/qualityTestStandardParam/del",
+ method: "delete",
+ data: ids,
+ });
+}
diff --git a/src/api/qualityManagement/nearExpiryReturn.js b/src/api/qualityManagement/nearExpiryReturn.js
new file mode 100644
index 0000000..af1f55a
--- /dev/null
+++ b/src/api/qualityManagement/nearExpiryReturn.js
@@ -0,0 +1,45 @@
+import request from '@/utils/request'
+
+// 鏌ヨ涓存湡閫�鍥炲彴璐﹀垪琛�
+export function nearExpiryReturnListPage(query) {
+ return request({
+ url: '/quality/nearExpiryReturn/listPage',
+ method: 'get',
+ params: query,
+ })
+}
+
+// 鏂板涓存湡閫�鍥炲彴璐�
+export function nearExpiryReturnAdd(data) {
+ return request({
+ url: '/quality/nearExpiryReturn/add',
+ method: 'post',
+ data: data,
+ })
+}
+
+// 淇敼涓存湡閫�鍥炲彴璐�
+export function nearExpiryReturnUpdate(data) {
+ return request({
+ url: '/quality/nearExpiryReturn/update',
+ method: 'post',
+ data: data,
+ })
+}
+
+// 鍒犻櫎涓存湡閫�鍥炲彴璐�
+export function nearExpiryReturnDel(ids) {
+ return request({
+ url: '/quality/nearExpiryReturn/del',
+ method: 'delete',
+ data: ids,
+ })
+}
+
+// 鑾峰彇涓存湡閫�鍥炲彴璐﹁鎯�
+export function nearExpiryReturnDetail(id) {
+ return request({
+ url: '/quality/nearExpiryReturn/' + id,
+ method: 'get',
+ })
+}
diff --git a/src/api/qualityManagement/nonconformingManagement.js b/src/api/qualityManagement/nonconformingManagement.js
new file mode 100644
index 0000000..50a1b74
--- /dev/null
+++ b/src/api/qualityManagement/nonconformingManagement.js
@@ -0,0 +1,50 @@
+import request from "@/utils/request";
+
+// 鏌ヨ涓嶅悎鏍肩鐞嗗垪琛�
+export function qualityUnqualifiedListPage(query) {
+ return request({
+ url: "/quality/qualityUnqualified/listPage",
+ method: "get",
+ params: query,
+ });
+}
+// 鏂板涓嶅悎鏍肩鐞嗗垪琛�
+export function qualityUnqualifiedAdd(query) {
+ return request({
+ url: "/quality/qualityUnqualified/add",
+ method: "post",
+ data: query,
+ });
+}
+// 淇敼涓嶅悎鏍肩鐞嗗垪琛�
+export function qualityUnqualifiedUpdate(query) {
+ return request({
+ url: "/quality/qualityUnqualified/update",
+ method: "post",
+ data: query,
+ });
+}
+// 涓嶅悎鏍煎鐞�
+export function qualityUnqualifiedDeal(query) {
+ return request({
+ url: "/quality/qualityUnqualified/deal",
+ method: "post",
+ data: query,
+ });
+}
+// 鍒犻櫎涓嶅悎鏍肩鐞嗗垪琛�
+export function qualityUnqualifiedDel(query) {
+ return request({
+ url: "/quality/qualityUnqualified/del",
+ method: "delete",
+ data: query,
+ });
+}
+// 鏌ヨ涓嶅悎鏍肩鐞嗕俊鎭�
+export function getQualityUnqualifiedInfo(query) {
+ return request({
+ url: "/quality/qualityUnqualified/" + query,
+ method: "get",
+ data: query,
+ });
+}
diff --git a/src/api/qualityManagement/qualityInspectFile.js b/src/api/qualityManagement/qualityInspectFile.js
new file mode 100644
index 0000000..9520dd5
--- /dev/null
+++ b/src/api/qualityManagement/qualityInspectFile.js
@@ -0,0 +1,26 @@
+import request from '@/utils/request'
+
+// 鏌ヨ闄勪欢鍒楄〃
+export function qualityInspectFileListPage(query) {
+ return request({
+ url: '/quality/qualityInspectFile/listPage',
+ method: 'get',
+ params: query,
+ })
+}
+// 淇濆瓨闄勪欢鍒楄〃
+export function qualityInspectFileAdd(query) {
+ return request({
+ url: '/quality/qualityInspectFile/add',
+ method: 'post',
+ data: query,
+ })
+}
+// 鍒犻櫎闄勪欢鍒楄〃
+export function qualityInspectFileDel(query) {
+ return request({
+ url: '/quality/qualityInspectFile/del',
+ method: 'delete',
+ data: query,
+ })
+}
diff --git a/src/api/qualityManagement/qualityInspectParam.js b/src/api/qualityManagement/qualityInspectParam.js
new file mode 100644
index 0000000..5241d64
--- /dev/null
+++ b/src/api/qualityManagement/qualityInspectParam.js
@@ -0,0 +1,27 @@
+import request from '@/utils/request'
+
+// 鏌ヨ妫�楠屾寚鏍�
+export function qualityInspectParamInfo(query) {
+ return request({
+ url: '/quality/qualityInspectParam/' + query,
+ method: 'get',
+ data: query,
+ })
+}
+// 鎻愪氦妫�楠�
+export function qualityInspectParamUpdate(query) {
+ return request({
+ url: '/quality/qualityInspectParam/update',
+ method: 'post',
+ data: query,
+ })
+}
+
+// 鍒犻櫎妫�楠岃褰�
+export function qualityInspectParamDel(query) {
+ return request({
+ url: '/quality/qualityInspectParam/del',
+ method: 'delete',
+ data: query,
+ })
+}
diff --git a/src/api/qualityManagement/qualityTestStandardBinding.js b/src/api/qualityManagement/qualityTestStandardBinding.js
new file mode 100644
index 0000000..e4432a6
--- /dev/null
+++ b/src/api/qualityManagement/qualityTestStandardBinding.js
@@ -0,0 +1,28 @@
+import request from "@/utils/request";
+
+// 缁戝畾鍒楄〃锛堜笉鍒嗛〉锛�
+export function qualityTestStandardBindingList(query) {
+ return request({
+ url: "/qualityTestStandardBinding/list",
+ method: "get",
+ params: query,
+ });
+}
+
+// 鏂板缁戝畾锛堟敮鎸佹壒閲忥級
+export function qualityTestStandardBindingAdd(data) {
+ return request({
+ url: "/qualityTestStandardBinding/add",
+ method: "post",
+ data,
+ });
+}
+
+// 鍒犻櫎缁戝畾锛堜紶 id 鏁扮粍锛�
+export function qualityTestStandardBindingDel(ids) {
+ return request({
+ url: "/qualityTestStandardBinding/del",
+ method: "delete",
+ data: ids,
+ });
+}
diff --git a/src/api/qualityManagement/rawMaterial.js b/src/api/qualityManagement/rawMaterial.js
new file mode 100644
index 0000000..f8f30de
--- /dev/null
+++ b/src/api/qualityManagement/rawMaterial.js
@@ -0,0 +1,71 @@
+import request from '@/utils/request'
+
+// 鏌ヨ鍘熸鍒楄〃
+export function findRawMaterialListPage(query) {
+ return request({
+ url: '/quality/rawMaterial/listPage',
+ method: 'get',
+ params: query,
+ })
+}
+
+// 鏌ヨ鍘熸璇︽儏
+export function findRawMaterialDetail(id) {
+ return request({
+ url: '/quality/rawMaterial/detail/' + id,
+ method: 'get',
+ })
+}
+
+// 鏂板鍘熸
+export function createRawMaterial(data) {
+ return request({
+ url: '/quality/rawMaterial',
+ method: 'post',
+ data: data,
+ })
+}
+
+// 鎻愪氦
+export function submitRawMaterial(id) {
+ return request({
+ url: '/quality/rawMaterial/submit/' + id,
+ method: 'patch',
+ })
+}
+
+// 淇敼妫�楠屼汉
+export function updateCheckUserName(data) {
+ return request({
+ url: '/quality/rawMaterial/updateCheckUserName',
+ method: 'patch',
+ data: data,
+ })
+}
+
+// 淇敼鍘熸
+export function updateRawMaterial(data) {
+ return request({
+ url: '/quality/rawMaterial',
+ method: 'put',
+ data: data,
+ })
+}
+
+// 鍒犻櫎鍘熸
+export function deleteRawMaterial(query) {
+ return request({
+ url: '/quality/rawMaterial',
+ method: 'delete',
+ data: query,
+ })
+}
+
+export function downloadRawMaterial(data) {
+ return request({
+ url: '/quality/rawMaterial/down',
+ method: 'post',
+ data: data,
+ responseType: "blob",
+ })
+}
diff --git a/src/pages/qualityManagement/InspectItem/index.vue b/src/pages/qualityManagement/InspectItem/index.vue
new file mode 100644
index 0000000..92ae99c
--- /dev/null
+++ b/src/pages/qualityManagement/InspectItem/index.vue
@@ -0,0 +1,340 @@
+<template>
+ <view class="inspect-item-page">
+ <PageHeader title="妫�娴嬮」缁存姢" @back="goBack" />
+
+ <!-- 鎼滅储鍖哄煙 -->
+ <view class="search-section">
+ <up-search
+ placeholder="璇疯緭鍏ユ娴嬮」鐩悕绉�"
+ v-model="searchForm.name"
+ @search="handleQuery"
+ @custom="handleQuery"
+ @clear="handleQuery"
+ :show-action="true"
+ action-text="鎼滅储"
+ :animation="true"
+ ></up-search>
+ </view>
+
+ <!-- 鍒楄〃鍖哄煙 -->
+ <view class="list-container" v-if="tableData.length > 0">
+ <view v-for="(item, index) in tableData" :key="index" class="list-item">
+ <view class="item-content" @click="openDialog('edit', item)">
+ <view class="item-row">
+ <text class="item-label">妫�娴嬮」鐩細</text>
+ <text class="item-value">{{ item.name }}</text>
+ </view>
+ <view class="item-row">
+ <text class="item-label">鍗曚綅锛�</text>
+ <text class="item-value">{{ item.unit || '-' }}</text>
+ </view>
+ <view class="item-row">
+ <text class="item-label">鏍囧噯鍊硷細</text>
+ <text class="item-value">{{ item.standardValue || '-' }}</text>
+ </view>
+ <view class="item-row">
+ <text class="item-label">鍐呮帶鍊硷細</text>
+ <text class="item-value">{{ item.internalControl || '-' }}</text>
+ </view>
+ </view>
+ <view class="item-actions">
+ <up-button type="primary" size="mini" @click.stop="openDialog('edit', item)">缂栬緫</up-button>
+ <up-button type="error" size="mini" @click.stop="handleDelete(item)">鍒犻櫎</up-button>
+ </view>
+ </view>
+
+ <!-- 鍔犺浇鏇村/鍒嗛〉 -->
+ <view class="pagination-container">
+ <up-loadmore :status="loadStatus" @loadmore="getList" />
+ </view>
+ </view>
+
+ <view v-else class="no-data">
+ <up-empty mode="data" text="鏆傛棤鏁版嵁"></up-empty>
+ </view>
+
+ <!-- 娴姩鏂板鎸夐挳 -->
+ <view class="fab-button" @click="openDialog('add')">
+ <up-icon name="plus" size="24" color="#ffffff"></up-icon>
+ </view>
+
+ <!-- 鏂板/淇敼寮圭獥 -->
+ <up-popup v-model:show="dialogVisible" mode="center" round closeable @close="closeDialog">
+ <view class="dialog-content">
+ <view class="dialog-header">
+ <text class="dialog-title">{{ operationType === 'add' ? '鏂板妫�娴嬮」鐩�' : '淇敼妫�娴嬮」鐩�' }}</text>
+ </view>
+ <up-form :model="form" ref="formRef" label-width="100" label-position="top">
+ <up-form-item label="妫�娴嬮」鐩�" prop="name" required borderBottom>
+ <up-input v-model="form.name" placeholder="璇疯緭鍏ユ娴嬮」鐩悕绉�" border="surround" />
+ </up-form-item>
+ <up-form-item label="鍗曚綅" prop="unit" required borderBottom>
+ <up-input v-model="form.unit" placeholder="璇疯緭鍏ュ崟浣�" border="surround" />
+ </up-form-item>
+ <up-form-item label="鏍囧噯鍊�" prop="standardValue" borderBottom>
+ <up-input v-model="form.standardValue" placeholder="璇疯緭鍏ユ爣鍑嗗��" border="surround" />
+ </up-form-item>
+ <up-form-item label="鍐呮帶鍊�" prop="internalControl" borderBottom>
+ <up-input v-model="form.internalControl" placeholder="璇疯緭鍏ュ唴鎺у��" border="surround" />
+ </up-form-item>
+ </up-form>
+ <view class="dialog-footer">
+ <up-button type="primary" text="纭" @click="submitForm" :loading="submitLoading"></up-button>
+ <up-button text="鍙栨秷" @click="closeDialog" customStyle="margin-top: 20rpx"></up-button>
+ </view>
+ </view>
+ </up-popup>
+ </view>
+</template>
+
+<script setup>
+import { ref, reactive, onMounted } from 'vue';
+import {
+ qualityInspectItemListPage,
+ qualityInspectItemSave,
+ qualityInspectItemDelete
+} from '@/api/qualityManagement/inspectItem.js';
+import { toast, showConfirm } from '@/utils/common';
+
+const searchForm = reactive({
+ name: ''
+});
+
+const tableData = ref([]);
+const page = reactive({
+ current: 1,
+ size: 20,
+ total: 0
+});
+const loadStatus = ref('loadmore');
+
+const dialogVisible = ref(false);
+const operationType = ref('add');
+const submitLoading = ref(false);
+const form = reactive({
+ id: null,
+ name: '',
+ unit: '',
+ standardValue: '',
+ internalControl: ''
+});
+
+const rules = {
+ name: {
+ type: 'string',
+ required: true,
+ message: '璇疯緭鍏ユ娴嬮」鐩悕绉�',
+ trigger: ['blur', 'change']
+ },
+ unit: {
+ type: 'string',
+ required: true,
+ message: '璇疯緭鍏ュ崟浣�',
+ trigger: ['blur', 'change']
+ }
+};
+
+const formRef = ref(null);
+
+const getList = () => {
+ if (loadStatus.value === 'loading' || (page.total > 0 && tableData.value.length >= page.total)) return;
+
+ loadStatus.value = 'loading';
+ const params = {
+ name: searchForm.name || null,
+ current: page.current,
+ size: page.size
+ };
+
+ qualityInspectItemListPage(params).then(res => {
+ const records = res?.data?.records || [];
+ if (page.current === 1) {
+ tableData.value = records;
+ } else {
+ tableData.value = [...tableData.value, ...records];
+ }
+ page.total = res?.data?.total || 0;
+
+ if (tableData.value.length >= page.total) {
+ loadStatus.value = 'nomore';
+ } else {
+ loadStatus.value = 'loadmore';
+ page.current++;
+ }
+ }).catch(() => {
+ loadStatus.value = 'loadmore';
+ });
+};
+
+const handleQuery = () => {
+ page.current = 1;
+ page.total = 0;
+ tableData.value = [];
+ loadStatus.value = 'loadmore';
+ getList();
+};
+
+const goBack = () => {
+ uni.navigateBack();
+};
+
+const openDialog = (type, row) => {
+ operationType.value = type;
+ if (type === 'edit' && row) {
+ Object.assign(form, {
+ id: row.id,
+ name: row.name,
+ unit: row.unit,
+ standardValue: row.standardValue,
+ internalControl: row.internalControl
+ });
+ } else {
+ Object.assign(form, {
+ id: null,
+ name: '',
+ unit: '',
+ standardValue: '',
+ internalControl: ''
+ });
+ }
+ dialogVisible.value = true;
+};
+
+const closeDialog = () => {
+ dialogVisible.value = false;
+};
+
+const submitForm = () => {
+ formRef.value.validate().then(res => {
+ submitLoading.value = true;
+ qualityInspectItemSave(form).then(() => {
+ toast(operationType.value === 'add' ? '鏂板鎴愬姛' : '淇敼鎴愬姛');
+ dialogVisible.value = false;
+ handleQuery();
+ }).finally(() => {
+ submitLoading.value = false;
+ });
+ }).catch(errors => {
+ console.log('楠岃瘉澶辫触', errors);
+ });
+};
+
+const handleDelete = (row) => {
+ showConfirm('纭鍒犻櫎璇ユ娴嬮」鐩悧锛�').then(res => {
+ if (res.confirm) {
+ qualityInspectItemDelete({ id: row.id }).then(() => {
+ toast('鍒犻櫎鎴愬姛');
+ handleQuery();
+ });
+ }
+ });
+};
+
+onMounted(() => {
+ handleQuery();
+});
+</script>
+
+<style lang="scss" scoped>
+.inspect-item-page {
+ padding-bottom: 120rpx;
+ background-color: #f5f7fa;
+ min-height: 100vh;
+}
+
+.search-section {
+ padding: 20rpx 30rpx;
+ background-color: #ffffff;
+ position: sticky;
+ top: 0;
+ z-index: 10;
+}
+
+.list-container {
+ padding: 20rpx;
+}
+
+.list-item {
+ background-color: #ffffff;
+ border-radius: 16rpx;
+ padding: 30rpx;
+ margin-bottom: 20rpx;
+ box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05);
+}
+
+.item-content {
+ margin-bottom: 20rpx;
+}
+
+.item-row {
+ display: flex;
+ margin-bottom: 10rpx;
+}
+
+.item-label {
+ color: #909399;
+ width: 160rpx;
+ font-size: 28rpx;
+}
+
+.item-value {
+ flex: 1;
+ color: #303133;
+ font-size: 28rpx;
+}
+
+.item-actions {
+ display: flex;
+ justify-content: flex-end;
+ gap: 20rpx;
+ border-top: 1rpx solid #ebeef5;
+ padding-top: 20rpx;
+}
+
+.pagination-container {
+ padding: 20rpx 0;
+}
+
+.no-data {
+ padding-top: 200rpx;
+}
+
+.fab-button {
+ position: fixed;
+ right: 40rpx;
+ bottom: 60rpx;
+ width: 100rpx;
+ height: 100rpx;
+ background-color: #3c9cff;
+ border-radius: 50%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ box-shadow: 0 4rpx 16rpx rgba(60, 156, 255, 0.4);
+ z-index: 99;
+}
+
+.dialog-content {
+ width: 600rpx;
+ padding: 40rpx;
+ background-color: #ffffff;
+ border-radius: 24rpx;
+ overflow: hidden;
+ box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.08);
+}
+
+.dialog-header {
+ margin-bottom: 30rpx;
+ text-align: center;
+}
+
+.dialog-title {
+ font-size: 32rpx;
+ font-weight: bold;
+ color: #303133;
+}
+
+.dialog-footer {
+ margin-top: 40rpx;
+}
+</style>
diff --git a/src/pages/qualityManagement/finalInspection/add.vue b/src/pages/qualityManagement/finalInspection/add.vue
new file mode 100644
index 0000000..a56b388
--- /dev/null
+++ b/src/pages/qualityManagement/finalInspection/add.vue
@@ -0,0 +1,1128 @@
+<template>
+ <view class="material-inspection-add">
+ <!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 -->
+ <PageHeader :title="isEdit ? '缂栬緫鍑哄巶妫�楠�' : '鏂板鍑哄巶妫�楠�'"
+ @back="goBack" />
+ <!-- 琛ㄥ崟鍐呭 -->
+ <up-form :model="form"
+ ref="formRef"
+ label-width="110"
+ :rules="rules">
+ <!-- 鍩烘湰淇℃伅 -->
+ <!-- <up-form-item label="宸ュ簭"
+ prop="process"
+ required
+ border-bottom>
+ <up-input v-model="form.process"
+ placeholder="璇烽�夋嫨宸ュ簭"
+ readonly
+ :disabled="processQuantityDisabled" />
+ <template #right>
+ <up-icon @click="showprocessSheet = true"
+ name="arrow-right" />
+ </template>
+ </up-form-item> -->
+ <up-form-item label="浜у搧鍚嶇О"
+ prop="productId"
+ required
+ border-bottom>
+ <up-input v-model="form.productName"
+ placeholder="璇烽�夋嫨浜у搧"
+ readonly
+ @click="showProductTree = true"
+ :disabled="isEdit" />
+ <template #right>
+ <up-icon @click="showProductTree = true"
+ name="arrow-right" />
+ </template>
+ </up-form-item>
+ <up-form-item label="瑙勬牸鍨嬪彿"
+ prop="productModelId"
+ required
+ border-bottom>
+ <up-input v-model="form.model"
+ placeholder="璇烽�夋嫨瑙勬牸鍨嬪彿"
+ readonly
+ :disabled="isEdit" />
+ <template #right>
+ <up-icon @click="showModelSheet = true"
+ name="arrow-right" />
+ </template>
+ </up-form-item>
+ <up-form-item label="鎸囨爣閫夋嫨"
+ prop="testStandardId"
+ border-bottom>
+ <up-input v-model="testStandardDisplay"
+ placeholder="璇烽�夋嫨鎸囨爣"
+ readonly />
+ <template #right>
+ <up-icon @click="openTestStandardSheet"
+ name="arrow-right" />
+ </template>
+ </up-form-item>
+ <up-form-item label="鍗曚綅"
+ prop="unit"
+ border-bottom>
+ <up-input v-model="form.unit"
+ placeholder="璇疯緭鍏ュ崟浣�"
+ disabled />
+ </up-form-item>
+ <up-form-item label="鏁伴噺"
+ prop="quantity"
+ required
+ border-bottom>
+ <up-input v-model="form.quantity"
+ type="number"
+ placeholder="璇疯緭鍏ユ暟閲�"
+ :disabled="processQuantityDisabled" />
+ </up-form-item>
+ <up-form-item label="妫�娴嬪崟浣�"
+ prop="checkCompany"
+ border-bottom>
+ <up-input v-model="form.checkCompany"
+ placeholder="璇疯緭鍏ユ娴嬪崟浣�"
+ clearable />
+ </up-form-item>
+ <up-form-item label="妫�娴嬬粨鏋�"
+ prop="checkResult"
+ required
+ border-bottom>
+ <up-input v-model="form.checkResult"
+ placeholder="璇烽�夋嫨妫�娴嬬粨鏋�"
+ readonly
+ @click="showResultSheet" />
+ <template #right>
+ <up-icon @click="showResultSheet = true"
+ name="arrow-right" />
+ </template>
+ </up-form-item>
+ <up-form-item label="妫�楠屽憳"
+ prop="checkName"
+ border-bottom>
+ <up-input v-model="form.checkName"
+ placeholder="璇烽�夋嫨妫�楠屽憳"
+ readonly
+ @click="showInspectorSheet" />
+ <template #right>
+ <up-icon @click="showInspectorSheet = true"
+ name="arrow-right" />
+ </template>
+ </up-form-item>
+ <up-form-item label="妫�娴嬫棩鏈�"
+ prop="checkTime"
+ required
+ border-bottom>
+ <up-input v-model="form.checkTime"
+ placeholder="璇烽�夋嫨妫�娴嬫棩鏈�"
+ readonly />
+ <!-- <template #right>
+ <up-icon name="calendar"
+ @click="showDatePicker"></up-icon>
+ </template> -->
+ </up-form-item>
+ <!-- 妫�楠岄」鐩� -->
+ <view class="inspection-items-container">
+ <view class="steps-header">
+ <text class="steps-title">妫�楠岄」鐩�</text>
+ <text class="steps-count">鍏� {{ tableData.length }} 涓」鐩�</text>
+ </view>
+ <view class="steps-list">
+ <view v-for="(item, index) in tableData"
+ :key="index"
+ class="exec-step-item">
+ <view class="step-number">
+ {{ index + 1 }}
+ </view>
+ <view class="step-content">
+ <view class="step-row">
+ <text class="step-label">鎸囨爣锛�</text>
+ <text class="step-value">{{ item.parameterItem }}</text>
+ </view>
+ <view class="step-row">
+ <text class="step-label">鍗曚綅锛�</text>
+ <text class="step-value">{{ item.unit }}</text>
+ </view>
+ <view class="step-row">
+ <text class="step-label">鏍囧噯鍊硷細</text>
+ <text class="step-value">{{ item.standardValue }}</text>
+ </view>
+ <view class="step-row">
+ <text class="step-label">鍐呮帶鍊硷細</text>
+ <text class="step-value">{{ item.controlValue }}</text>
+ </view>
+ <view class="step-row">
+ <text class="step-label">妫�楠屽�硷細</text>
+ <up-input v-model="item.testValue"
+ placeholder="璇疯緭鍏ユ楠屽��"
+ clearable
+ border-bottom
+ class="step-input" />
+ </view>
+ </view>
+ </view>
+ <view v-if="tableData.length === 0"
+ class="empty-data">
+ <text>璇峰厛閫夋嫨鎸囨爣</text>
+ </view>
+ </view>
+ </view>
+ </up-form>
+ <!-- 搴曢儴鎸夐挳 -->
+ <view class="bottom-buttons">
+ <up-button type="default"
+ size="default"
+ @click="goBack"
+ class="bottom-btn">
+ 鍙栨秷
+ </up-button>
+ <up-button type="primary"
+ size="default"
+ @click="submitForm"
+ :loading="loading"
+ class="bottom-btn">
+ {{ isEdit ? '淇濆瓨' : '鎻愪氦' }}
+ </up-button>
+ </view>
+ <!-- 鏃ユ湡閫夋嫨鍣� -->
+ <up-popup v-model:show="showDate"
+ mode="date"
+ :start-year="2020"
+ :end-year="2030"
+ @confirm="confirmDate" />
+ <!-- 宸ュ簭閫夋嫨 -->
+ <up-action-sheet :show="showprocessSheet"
+ :actions="processOptions"
+ @select="selectprocess"
+ @close="showprocessSheet = false"
+ title="閫夋嫨宸ュ簭" />
+ <!-- 浜у搧閫夋嫨 -->
+ <up-action-sheet :show="showProductSheet"
+ :actions="productSheetOptions"
+ @select="selectProduct"
+ @close="showProductSheet = false"
+ title="閫夋嫨浜у搧" />
+ <!-- 瑙勬牸鍨嬪彿閫夋嫨 -->
+ <up-action-sheet :show="showModelSheet"
+ :actions="modelSheetOptions"
+ @select="selectModel"
+ @close="showModelSheet = false"
+ title="閫夋嫨瑙勬牸鍨嬪彿" />
+ <!-- 妫�娴嬬粨鏋滈�夋嫨 -->
+ <up-action-sheet :show="showResultSheet"
+ :actions="resultSheetOptions"
+ @select="selectResult"
+ @close="showResultSheet = false"
+ title="閫夋嫨妫�娴嬬粨鏋�" />
+ <!-- 妫�楠屽憳閫夋嫨 -->
+ <up-action-sheet :show="showInspectorSheet"
+ :actions="userSheetOptions"
+ @select="selectInspector"
+ @close="showInspectorSheet = false"
+ title="閫夋嫨妫�楠屽憳" />
+ <!-- 鎸囨爣閫夋嫨 -->
+ <up-action-sheet :show="showTestStandardSheet"
+ :actions="testStandardSheetOptions"
+ @select="selectTestStandard"
+ @close="showTestStandardSheet = false"
+ title="閫夋嫨鎸囨爣" />
+ <!-- 浜у搧鏍戝舰閫夋嫨鍣� -->
+ <up-popup v-model:show="showProductTree"
+ position="bottom"
+ :round="true"
+ :closeable="true"
+ @close="showProductTree = false">
+ <view class="tree-selector">
+ <view class="tree-header">
+ <text class="tree-title">閫夋嫨浜у搧</text>
+ </view>
+ <view class="tree-content">
+ <view class="tree-node"
+ v-for="(node, index) in productOptions"
+ :key="index">
+ <view v-if="node.children && node.children.length > 0"
+ class="tree-node-header"
+ @click="toggleNode(node)">
+ <up-icon :name="node.expanded ? 'arrow-down' : 'arrow-right'"
+ class="tree-node-icon" />
+ <text class="tree-node-label">{{ node.label }}</text>
+ </view>
+ <view v-else
+ class="tree-node-header"
+ @click="selectTreeNode(node)">
+ <text class="tree-node-icon-placeholder"></text>
+ <text class="tree-node-label">{{ node.label }}</text>
+ <up-icon name="checkmark"
+ v-if="form.productId == node.value"
+ class="tree-node-check" />
+ </view>
+ <view v-if="node.children && node.children.length > 0 && node.expanded"
+ class="tree-node-children">
+ <view class="tree-node"
+ v-for="(child, childIndex) in node.children"
+ :key="childIndex">
+ <view v-if="child.children && child.children.length > 0"
+ class="tree-node-header"
+ @click="toggleNode(child)">
+ <up-icon :name="child.expanded ? 'arrow-down' : 'arrow-right'"
+ class="tree-node-icon" />
+ <text class="tree-node-label">{{ child.label }}</text>
+ </view>
+ <view v-else
+ class="tree-node-header"
+ @click="selectTreeNode(child)">
+ <text class="tree-node-icon-placeholder"></text>
+ <text class="tree-node-label">{{ child.label }}</text>
+ <up-icon name="checkmark"
+ v-if="form.productId == child.value"
+ class="tree-node-check" />
+ </view>
+ <view v-if="child.children && child.children.length > 0 && child.expanded"
+ class="tree-node-children">
+ <view class="tree-node"
+ v-for="(grandchild, grandchildIndex) in child.children"
+ :key="grandchildIndex">
+ <view class="tree-node-header"
+ @click="selectTreeNode(grandchild)">
+ <text class="tree-node-icon-placeholder"></text>
+ <text class="tree-node-label">{{ grandchild.label }}</text>
+ <up-icon name="checkmark"
+ v-if="form.productId == grandchild.value"
+ class="tree-node-check" />
+ </view>
+ </view>
+ </view>
+ </view>
+ </view>
+ </view>
+ </view>
+ </view>
+ </up-popup>
+ </view>
+</template>
+
+<script setup>
+ import { ref, computed, onMounted, nextTick } from "vue";
+ import { onShow } from "@dcloudio/uni-app";
+ import PageHeader from "@/components/PageHeader.vue";
+ import dayjs from "dayjs";
+ import { getOptions } from "@/api/procurementManagement/procurementLedger.js";
+ import { modelList, productTreeList } from "@/api/basicData/product.js";
+ import {
+ qualityInspectAdd,
+ qualityInspectUpdate,
+ qualityInspectParamInfo,
+ qualityInspectDetailByProductId,
+ getQualityTestStandardParamByTestStandardId,
+ list,
+ } from "@/api/qualityManagement/materialInspection.js";
+ import { userListNoPage } from "@/api/system/user.js";
+
+ // 鏄剧ず鎻愮ず淇℃伅
+ const showToast = message => {
+ uni.showToast({
+ title: message,
+ icon: "none",
+ });
+ };
+
+ // 琛ㄥ崟寮曠敤
+ const formRef = ref(null);
+ // 鍔犺浇鐘舵��
+ const loading = ref(false);
+ // 鏃ユ湡閫夋嫨鍣�
+ const showDate = ref(false);
+ // 宸ュ簭閫夋嫨
+ const showprocessSheet = ref(false);
+ // 浜у搧閫夋嫨
+ const showProductSheet = ref(false);
+ // 浜у搧鏍戝舰閫夋嫨鍣�
+ const showProductTree = ref(false);
+ // 瑙勬牸鍨嬪彿閫夋嫨
+ const showModelSheet = ref(false);
+ // 妫�娴嬬粨鏋滈�夋嫨
+ const showResultSheet = ref(false);
+ // 妫�楠屽憳閫夋嫨
+ const showInspectorSheet = ref(false);
+ // 鎸囨爣閫夋嫨
+ const showTestStandardSheet = ref(false);
+
+ // 琛ㄥ崟鏁版嵁
+ const form = ref({
+ checkTime: dayjs().format("YYYY-MM-DD"),
+ process: "",
+ checkName: "",
+ productName: "",
+ productId: "",
+ productModelId: "",
+ model: "",
+ testStandardId: "",
+ unit: "",
+ quantity: "",
+ checkCompany: "",
+ checkResult: "",
+ productMainId: null,
+ purchaseLedgerId: null,
+ });
+
+ // 鏄剧ず鐢ㄧ殑鍙橀噺
+ const testStandardDisplay = ref("");
+
+ // 妫�楠岄」鐩�
+ const tableData = ref([]);
+ const tableLoading = ref(false);
+
+ // 宸ュ簭鍒楄〃
+ const processList = ref([]);
+ // 浜у搧閫夐」
+ const productOptions = ref([]);
+ // 鍨嬪彿閫夐」
+ const modelOptions = ref([]);
+ // 妫�楠屽憳鍒楄〃
+ const userList = ref([]);
+ // 妫�娴嬬粨鏋滈�夐」
+ const resultOptions = ref([
+ { label: "鍚堟牸", value: "鍚堟牸" },
+ { label: "涓嶅悎鏍�", value: "涓嶅悎鏍�" },
+ ]);
+ // 鎸囨爣閫夐」
+ const testStandardOptions = ref([]);
+ // 褰撳墠浜у搧ID
+ const currentProductId = ref(0);
+
+ // ActionSheet閫夐」
+ const processOptions = computed(() => {
+ return processList.value.map(item => ({
+ name: item.name,
+ value: item.name,
+ }));
+ });
+
+ const productSheetOptions = computed(() => {
+ return productOptions.value.map(item => ({
+ name: item.label,
+ value: item.value,
+ }));
+ });
+
+ const modelSheetOptions = computed(() => {
+ return modelOptions.value.map(item => ({
+ name: item.model,
+ value: item.id,
+ }));
+ });
+
+ const resultSheetOptions = computed(() => {
+ return resultOptions.value.map(item => ({
+ name: item.label,
+ value: item.value,
+ }));
+ });
+
+ const userSheetOptions = computed(() => {
+ return userList.value.map(item => ({
+ name: item.nickName,
+ value: item.nickName,
+ }));
+ });
+
+ const testStandardSheetOptions = computed(() => {
+ return testStandardOptions.value.map(item => ({
+ name: item.standardName || item.standardNo,
+ value: item.id,
+ }));
+ });
+
+ // 琛ㄥ崟楠岃瘉瑙勫垯
+ const rules = {
+ checkTime: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ process: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ checkName: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+ productId: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ productModelId: [
+ { required: true, message: "璇烽�夋嫨浜у搧鍨嬪彿", trigger: "change" },
+ ],
+ testStandardId: [
+ { required: false, message: "璇烽�夋嫨鎸囨爣", trigger: "change" },
+ ],
+ unit: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+ quantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ checkCompany: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+ checkResult: [
+ { required: true, message: "璇烽�夋嫨妫�娴嬬粨鏋�", trigger: "change" },
+ ],
+ };
+
+ // 鏄惁涓虹紪杈戞ā寮�
+ const isEdit = computed(() => {
+ const id = getPageId();
+ return !!id;
+ });
+
+ // 缂栬緫鏃讹細productMainId 鎴� purchaseLedgerId 浠讳竴鏈夊�煎垯宸ュ簭銆佹暟閲忕疆鐏�
+ const processQuantityDisabled = computed(() => {
+ const v = form.value || {};
+ return !!(v.productMainId != null || v.purchaseLedgerId != null);
+ });
+
+ // 鑾峰彇椤甸潰ID
+ const getPageId = () => {
+ const pages = getCurrentPages();
+ const currentPage = pages[pages.length - 1];
+ return currentPage.options.id;
+ };
+
+ // 杩斿洖涓婁竴椤�
+ const goBack = () => {
+ uni.navigateBack();
+ };
+
+ // 鏄剧ず鏃ユ湡閫夋嫨鍣�
+ const showDatePicker = () => {
+ showDate.value = true;
+ };
+
+ // 纭鏃ユ湡閫夋嫨
+ const confirmDate = e => {
+ form.value.checkTime = dayjs(e.value).format("YYYY-MM-DD");
+ };
+
+ // 閫夋嫨宸ュ簭
+ const selectprocess = e => {
+ form.value.process = e.value;
+ showprocessSheet.value = false;
+ };
+
+ // 閫夋嫨浜у搧
+ const selectProduct = e => {
+ form.value.productId = e.value;
+ form.value.productName = e.name;
+ showProductSheet.value = false;
+ getModels(e.value);
+ };
+
+ // 鍒囨崲鏍戝舰鑺傜偣灞曞紑/鎶樺彔
+ const toggleNode = node => {
+ node.expanded = !node.expanded;
+ };
+
+ // 閫夋嫨鏍戝舰鑺傜偣
+ const selectTreeNode = node => {
+ // 纭繚鍙�夋嫨鏈鑺傜偣
+ if (!node.children || node.children.length == 0) {
+ form.value.productId = node.value;
+ form.value.productName = node.label;
+ showProductTree.value = false;
+ getModels(node.value);
+ }
+ };
+
+ // 杞崲浜у搧鏍戠粨鏋�
+ function convertIdToValue(data) {
+ return data.map(item => {
+ const { id, children, ...rest } = item;
+ const newItem = {
+ ...rest,
+ value: id, // 灏� id 鏀逛负 value
+ };
+ if (children && children.length > 0) {
+ newItem.children = convertIdToValue(children);
+ }
+
+ return newItem;
+ });
+ }
+
+ // 鏍规嵁ID鏌ユ壘鑺傜偣
+ const findNodeById = (nodes, productId) => {
+ for (let i = 0; i < nodes.length; i++) {
+ if (nodes[i].value === productId) {
+ return nodes[i].label; // 鎵惧埌鑺傜偣锛岃繑鍥炶鑺傜偣
+ }
+ if (nodes[i].children && nodes[i].children.length > 0) {
+ const foundNode = findNodeById(nodes[i].children, productId);
+ if (foundNode) {
+ return foundNode; // 鍦ㄥ瓙鑺傜偣涓壘鍒帮紝杩斿洖璇ヨ妭鐐�
+ }
+ }
+ }
+ return null; // 娌℃湁鎵惧埌鑺傜偣锛岃繑鍥瀗ull
+ };
+
+ // 閫夋嫨瑙勬牸鍨嬪彿
+ const selectModel = e => {
+ form.value.productModelId = e.value;
+ showModelSheet.value = false;
+ handleChangeModel(e.value);
+ };
+
+ // 澶勭悊鍨嬪彿鍙樺寲
+ const handleChangeModel = value => {
+ form.value.model =
+ modelOptions.value.find(item => item.id == value)?.model || "";
+ form.value.unit =
+ modelOptions.value.find(item => item.id == value)?.unit || "";
+ };
+
+ // 閫夋嫨妫�娴嬬粨鏋�
+ const selectResult = e => {
+ form.value.checkResult = e.value;
+ showResultSheet.value = false;
+ };
+
+ // 閫夋嫨妫�楠屽憳
+ const selectInspector = e => {
+ form.value.checkName = e.value;
+ showInspectorSheet.value = false;
+ };
+
+ // 閫夋嫨鎸囨爣
+ const selectTestStandard = e => {
+ form.value.testStandardId = e.value;
+ testStandardDisplay.value = e.name;
+ showTestStandardSheet.value = false;
+ handleTestStandardChange(e.value);
+ };
+
+ // 鎸囨爣閫夋嫨鍙樺寲澶勭悊
+ const handleTestStandardChange = testStandardId => {
+ if (!testStandardId) {
+ tableData.value = [];
+ return;
+ }
+ tableLoading.value = true;
+ getQualityTestStandardParamByTestStandardId(testStandardId)
+ .then(res => {
+ tableData.value = res.data || [];
+ })
+ .catch(error => {
+ console.error("鑾峰彇鏍囧噯鍙傛暟澶辫触:", error);
+ tableData.value = [];
+ })
+ .finally(() => {
+ tableLoading.value = false;
+ });
+ };
+ const openTestStandardSheet = () => {
+ console.log("openTestStandardSheet");
+ showTestStandardSheet.value = true;
+ };
+
+ // 鑾峰彇宸ュ簭鍒楄〃
+ const getprocessList = () => {
+ list().then(res => {
+ processList.value = res.data;
+ });
+ };
+
+ // 鑾峰彇浜у搧閫夐」
+ const getProductOptions = () => {
+ return productTreeList().then(res => {
+ productOptions.value = convertIdToValue(res);
+ return productOptions.value;
+ });
+ };
+
+ // 鑾峰彇鐢ㄦ埛鍒楄〃
+ const getUserList = async () => {
+ try {
+ const userRes = await userListNoPage();
+ userList.value = userRes.data || [];
+ } catch (e) {
+ console.error("鍔犺浇妫�楠屽憳鍒楄〃澶辫触", e);
+ userList.value = [];
+ }
+ };
+
+ // 鑾峰彇鍨嬪彿鍒楄〃
+ const getModels = value => {
+ form.value.productModelId = "";
+ form.value.unit = "";
+ modelOptions.value = [];
+ currentProductId.value = value;
+ form.value.productName = findNodeById(productOptions.value, value);
+ modelList({ id: value }).then(res => {
+ modelOptions.value = res;
+ });
+ if (currentProductId.value) {
+ getList();
+ }
+ };
+
+ // 鑾峰彇鎸囨爣鍒楄〃
+ const getList = () => {
+ if (!currentProductId.value) {
+ testStandardOptions.value = [];
+ tableData.value = [];
+ return;
+ }
+ let params = {
+ productId: currentProductId.value,
+ inspectType: 2,
+ };
+ qualityInspectDetailByProductId(params).then(res => {
+ // 淇濆瓨涓嬫媺妗嗛�夐」鏁版嵁
+ testStandardOptions.value = res.data || [];
+ // 娓呯┖琛ㄦ牸鏁版嵁锛岀瓑寰呯敤鎴烽�夋嫨鎸囨爣
+ tableData.value = [];
+ // 娓呯┖鎸囨爣閫夋嫨
+ form.value.testStandardId = "";
+ testStandardDisplay.value = "";
+ });
+ };
+
+ // 鑾峰彇妫�楠屽弬鏁板垪琛紙缂栬緫妯″紡锛�
+ const getQualityInspectParamList = id => {
+ qualityInspectParamInfo(id).then(res => {
+ tableData.value = res.data;
+ });
+ };
+
+ // 鎻愪氦琛ㄥ崟
+ const submitForm = async () => {
+ console.log("submitForm", form.value, tableData.value);
+ try {
+ // await formRef.value.validate();
+ if (!form.value.productModelId) {
+ showToast("璇烽�夋嫨瑙勬牸鍨嬪彿");
+ return;
+ }
+ // if (!form.value.process) {
+ // showToast("璇烽�夋嫨宸ュ簭");
+ // return;
+ // }
+ if (!form.value.quantity) {
+ showToast("璇疯緭鍏ユ暟閲�");
+ return;
+ }
+ if (!form.value.productId) {
+ showToast("璇烽�夋嫨浜у搧");
+ return;
+ }
+ if (!form.value.checkResult) {
+ showToast("璇烽�夋嫨妫�娴嬬粨鏋�");
+ return;
+ }
+
+ loading.value = true;
+
+ form.value.inspectType = 2;
+ if (isEdit.value) {
+ tableData.value.forEach(item => {
+ delete item.id;
+ });
+ }
+
+ const data = { ...form.value, qualityInspectParams: tableData.value };
+ data.quantity = Number(data.quantity);
+ if (isEdit.value) {
+ const res = await qualityInspectUpdate(data);
+ showToast("淇濆瓨鎴愬姛");
+ setTimeout(() => {
+ uni.navigateBack();
+ }, 1500);
+ } else {
+ const res = await qualityInspectAdd(data);
+ showToast("鎻愪氦鎴愬姛");
+ setTimeout(() => {
+ uni.navigateBack();
+ }, 1500);
+ }
+ } catch (error) {
+ console.error("琛ㄥ崟楠岃瘉澶辫触:", error);
+ showToast("鎻愪氦澶辫触锛岃閲嶈瘯");
+ } finally {
+ loading.value = false;
+ }
+ };
+
+ // 鍒濆鍖栬〃鍗�
+ const initForm = async () => {
+ const id = getPageId();
+ if (id) {
+ // 缂栬緫妯″紡锛屽姞杞芥暟鎹�
+ // 鍏堥噸缃〃鍗曟暟鎹�
+ form.value = {
+ checkTime: dayjs().format("YYYY-MM-DD"),
+ process: "",
+ checkName: "",
+ productName: "",
+ productId: "",
+ productModelId: "",
+ model: "",
+ testStandardId: "",
+ unit: "",
+ quantity: "",
+ checkCompany: "",
+ checkResult: "",
+ productMainId: null,
+ purchaseLedgerId: null,
+ };
+ testStandardOptions.value = [];
+ tableData.value = [];
+ // 鍏堢‘淇濅骇鍝佹爲宸插姞杞斤紝鍚﹀垯缂栬緫鏃朵骇鍝�/瑙勬牸鍨嬪彿鏃犳硶鍙嶆樉
+ await getProductOptions();
+ // 浠庢湰鍦板瓨鍌ㄨ幏鍙栫紪杈戞暟鎹�
+ const row = uni.getStorageSync("finalInspectionEditData") || {
+ id: id,
+ checkTime: "2026-03-03",
+ process: "涓婃捣閲戝睘鏉愭枡鏈夐檺鍏徃",
+ checkName: "寮犱笁",
+ productName: "涓嶉攬閽㈡澘鏉�",
+ productId: 1,
+ productModelId: 1,
+ model: "304",
+ testStandardId: "1",
+ unit: "kg",
+ quantity: 1000,
+ checkCompany: "绗笁鏂规娴嬫満鏋�",
+ checkResult: "鍚堟牸",
+ productMainId: null,
+ purchaseLedgerId: null,
+ };
+ // 鍏堜繚瀛� testStandardId锛岄伩鍏嶈娓呯┖
+ const savedTestStandardId = row.testStandardId;
+ form.value = { ...row };
+ currentProductId.value = row.productId || 0;
+ // 鍏抽敭锛氱紪杈戞椂鍔犺浇瑙勬牸鍨嬪彿涓嬫媺閫夐」锛屾墠鑳藉弽鏄� productModelId
+ if (currentProductId.value) {
+ try {
+ const res = await modelList({ id: currentProductId.value });
+ modelOptions.value = res || [];
+ // 鍚屾鍥炲~ model / unit
+ if (form.value.productModelId) {
+ handleChangeModel(form.value.productModelId);
+ }
+ } catch (e) {
+ console.error("鍔犺浇瑙勬牸鍨嬪彿澶辫触", e);
+ modelOptions.value = [];
+ }
+ }
+ // 缂栬緫妯″紡涓嬶紝鍏堝姞杞芥寚鏍囬�夐」锛岀劧鍚庡姞杞藉弬鏁板垪琛�
+ if (currentProductId.value) {
+ // 鍏堝姞杞芥寚鏍囬�夐」
+ let params = {
+ productId: currentProductId.value,
+ inspectType: 2,
+ };
+ qualityInspectDetailByProductId(params).then(res => {
+ testStandardOptions.value = res.data || [];
+ // 浣跨敤 nextTick 纭繚閫夐」宸茬粡娓叉煋
+ nextTick(() => {
+ // 濡傛灉缂栬緫鏁版嵁涓湁 testStandardId锛屽垯璁剧疆骞跺姞杞藉搴旂殑鍙傛暟
+ if (savedTestStandardId) {
+ // 纭繚绫诲瀷鍖归厤
+ const matchedOption = testStandardOptions.value.find(
+ item =>
+ item.id == savedTestStandardId ||
+ String(item.id) === String(savedTestStandardId)
+ );
+ if (matchedOption) {
+ // 纭繚浣跨敤鍖归厤椤圭殑 id
+ form.value.testStandardId = matchedOption.id;
+ testStandardDisplay.value =
+ matchedOption.standardName || matchedOption.standardNo;
+ // 缂栬緫淇濈暀鍘熸楠屽�硷紝鐩存帴鎷夊彇鍘熷弬鏁版暟鎹�
+ getQualityInspectParamList(row.id);
+ } else {
+ // 濡傛灉鎵句笉鍒板尮閰嶉」锛屽皾璇曠洿鎺ヤ娇鐢ㄥ師鍊�
+ console.warn(
+ "鏈壘鍒板尮閰嶇殑鎸囨爣閫夐」锛宼estStandardId:",
+ savedTestStandardId
+ );
+ form.value.testStandardId = savedTestStandardId;
+ getQualityInspectParamList(row.id);
+ }
+ } else {
+ // 鍚﹀垯浣跨敤鏃х殑閫昏緫
+ getQualityInspectParamList(row.id);
+ }
+ });
+ });
+ }
+ // 灞曞紑浜у搧鏍戝埌褰撳墠閫変腑鐨勮妭鐐�
+ expandProductTree(productOptions.value, row.productId);
+ } else {
+ // 鏂板妯″紡锛屽垵濮嬪寲琛ㄥ崟
+ form.value = {
+ checkTime: dayjs().format("YYYY-MM-DD"),
+ process: "",
+ checkName: "",
+ productName: "",
+ productId: "",
+ productModelId: "",
+ model: "",
+ testStandardId: "",
+ unit: "",
+ quantity: "",
+ checkCompany: "",
+ checkResult: "",
+ productMainId: null,
+ purchaseLedgerId: null,
+ };
+ }
+ };
+
+ // 灞曞紑浜у搧鏍戝埌鎸囧畾鑺傜偣
+ const expandProductTree = (nodes, targetId) => {
+ for (let i = 0; i < nodes.length; i++) {
+ const node = nodes[i];
+ if (node.value === targetId) {
+ return true; // 鎵惧埌鐩爣鑺傜偣
+ }
+ if (node.children && node.children.length > 0) {
+ const found = expandProductTree(node.children, targetId);
+ if (found) {
+ node.expanded = true; // 灞曞紑鐖惰妭鐐�
+ return true;
+ }
+ }
+ }
+ return false;
+ };
+
+ onMounted(() => {
+ getprocessList();
+ getProductOptions();
+ getUserList();
+ initForm();
+ });
+
+ onShow(() => {
+ initForm();
+ });
+</script>
+
+<style scoped lang="scss">
+ @import "@/static/scss/form-common.scss";
+
+ .material-inspection-add {
+ min-height: 100vh;
+ background: #f8f9fa;
+ padding-bottom: 100px;
+ }
+
+ // 妫�楠岄」鐩鍣�
+ .inspection-items-container {
+ padding: 20px;
+ background-color: #fff;
+ }
+
+ .steps-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 20px;
+ padding-bottom: 12px;
+ border-bottom: 1px solid #e4e7ed;
+ }
+
+ .steps-title {
+ font-size: 16px;
+ font-weight: 600;
+ color: #303133;
+ }
+
+ .steps-count {
+ font-size: 14px;
+ color: #909399;
+ }
+
+ .steps-list {
+ margin-bottom: 20px;
+ }
+
+ .exec-step-item {
+ position: relative;
+ display: flex;
+ margin-bottom: 16px;
+ padding: 16px;
+ background-color: #ffffff;
+ border: 1px solid #e4e7ed;
+ border-radius: 8px;
+ transition: all 0.3s ease;
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
+ }
+
+ .exec-step-item:hover {
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
+ border-color: #409eff;
+ transform: translateY(-1px);
+ }
+
+ .delete-btn {
+ position: absolute;
+ top: -25rpx;
+ right: -25rpx;
+ width: 50rpx;
+ height: 50rpx;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ text-align: center;
+ font-size: 20px;
+ border-radius: 50%;
+ background-color: red;
+ border: none;
+ z-index: 10;
+ }
+
+ .delete-btn:hover {
+ transform: scale(1.1);
+ box-shadow: 0 3px 6px rgba(245, 108, 108, 0.4);
+ }
+
+ .step-number {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 32px;
+ height: 32px;
+ margin-right: 16px;
+ background-color: #ecf5ff;
+ color: #409eff;
+ font-size: 14px;
+ font-weight: 600;
+ border-radius: 50%;
+ flex-shrink: 0;
+ }
+
+ .step-content {
+ flex: 1;
+ min-width: 0;
+ }
+
+ .step-row {
+ display: flex;
+ align-items: flex-start;
+ margin-bottom: 12px;
+ }
+
+ .step-row:last-child {
+ margin-bottom: 0;
+ }
+
+ .step-label {
+ display: inline-block;
+ width: 80px;
+ font-size: 14px;
+ color: #606266;
+ margin-right: 12px;
+ flex-shrink: 0;
+ line-height: 36px;
+ }
+
+ .step-input {
+ flex: 1;
+ min-width: 0;
+ }
+
+ .step-input input {
+ font-size: 14px;
+ color: #303133;
+ }
+
+ .add-step-btn {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 100%;
+ height: 44px;
+ line-height: 44px;
+ font-size: 14px;
+ border-radius: 8px;
+ transition: all 0.3s ease;
+ gap: 8px;
+ }
+
+ .add-step-btn:hover {
+ transform: translateY(-1px);
+ box-shadow: 0 2px 8px rgba(64, 158, 255, 0.3);
+ }
+
+ .add-step-btn text {
+ font-size: 14px;
+ }
+
+ // 搴曢儴鎸夐挳
+ .bottom-buttons {
+ position: fixed;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ display: flex;
+ padding: 16px 20px;
+ background: #ffffff;
+ border-top: 1px solid #f0f0f0;
+ gap: 16px;
+ }
+
+ .bottom-btn {
+ flex: 1;
+ }
+
+ // 鏍戝舰閫夋嫨鍣ㄦ牱寮�
+ .tree-selector {
+ width: 100%;
+ max-height: 70vh;
+ background: #ffffff;
+ border-radius: 16px 16px 0 0;
+ }
+
+ .tree-header {
+ padding: 16px 20px;
+ border-bottom: 1px solid #f0f0f0;
+ text-align: center;
+ }
+
+ .tree-title {
+ font-size: 16px;
+ font-weight: 600;
+ color: #303133;
+ }
+
+ .tree-content {
+ padding: 10px 0;
+ max-height: calc(70vh - 60px);
+ overflow-y: auto;
+ }
+
+ .tree-node {
+ padding: 0 20px;
+ }
+
+ .tree-node-header {
+ display: flex;
+ align-items: center;
+ padding: 12px 0;
+ cursor: pointer;
+ }
+
+ .tree-node-icon {
+ width: 20px;
+ height: 20px;
+ margin-right: 8px;
+ color: #909399;
+ }
+
+ .tree-node-icon-placeholder {
+ width: 20px;
+ height: 20px;
+ margin-right: 8px;
+ }
+
+ .tree-node-label {
+ flex: 1;
+ font-size: 14px;
+ color: #303133;
+ }
+
+ .tree-node-check {
+ width: 20px;
+ height: 20px;
+ color: #409eff;
+ }
+
+ .tree-node-children {
+ margin-left: 28px;
+ }
+</style>
diff --git a/src/pages/qualityManagement/finalInspection/detail.vue b/src/pages/qualityManagement/finalInspection/detail.vue
new file mode 100644
index 0000000..9af42a7
--- /dev/null
+++ b/src/pages/qualityManagement/finalInspection/detail.vue
@@ -0,0 +1,422 @@
+<template>
+ <view class="material-inspection-detail">
+ <!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 -->
+ <PageHeader title="鍑哄巶妫�楠岃鎯�"
+ @back="goBack" />
+ <!-- 璇︽儏鍐呭 -->
+ <view class="detail-section"
+ v-if="detailData">
+ <view class="detail-card">
+ <view class="card-header">
+ <view class="header-icon">
+ <up-icon name="file-text"
+ size="20"
+ color="#ffffff"></up-icon>
+ </view>
+ <text class="header-title">{{ detailData.productName || '-' }}</text>
+ <view class="status-tags">
+ <u-tag :type="getTagType(detailData.checkResult)"
+ size="small"
+ class="status-tag">
+ {{ detailData.checkResult || '-' }}
+ </u-tag>
+ <u-tag :type="getStateTagType(detailData.inspectState)"
+ size="small"
+ class="status-tag">
+ {{ detailData.inspectState ? '宸叉彁浜�' : '鏈彁浜�' }}
+ </u-tag>
+ </view>
+ </view>
+ <up-divider></up-divider>
+ <view class="detail-content">
+ <view class="detail-row">
+ <text class="detail-label">妫�娴嬫棩鏈�</text>
+ <text class="detail-value">{{ formatDateTime(detailData.checkTime) || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">鐢熶骇宸ュ崟鍙�</text>
+ <text class="detail-value">{{ detailData.workOrderNo || '-' }}</text>
+ </view>
+ <!-- <view class="detail-row">
+ <text class="detail-label">宸ュ簭</text>
+ <text class="detail-value">{{ detailData.process || '-' }}</text>
+ </view> -->
+ <view class="detail-row">
+ <text class="detail-label">妫�楠屽憳</text>
+ <text class="detail-value">{{ detailData.checkName || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">浜у搧鍚嶇О</text>
+ <text class="detail-value">{{ detailData.productName || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">瑙勬牸鍨嬪彿</text>
+ <text class="detail-value">{{ detailData.model || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">鍗曚綅</text>
+ <text class="detail-value">{{ detailData.unit || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">鏁伴噺</text>
+ <text class="detail-value">{{ detailData.quantity || 0 }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">妫�娴嬪崟浣�</text>
+ <text class="detail-value">{{ detailData.checkCompany || '-' }}</text>
+ </view>
+ <!-- <view class="detail-row">
+ <text class="detail-label">妫�楠屾爣鍑�</text>
+ <text class="detail-value">{{ detailData.testStandardName || '-' }}</text>
+ </view> -->
+ </view>
+ </view>
+ <!-- 妫�楠岄」鐩� -->
+ <view class="detail-card"
+ v-if="inspectionItems.length > 0">
+ <view class="card-header">
+ <view class="header-icon secondary">
+ <up-icon name="list"
+ size="20"
+ color="#ffffff"></up-icon>
+ </view>
+ <text class="header-title">妫�楠岄」鐩�</text>
+ </view>
+ <up-divider></up-divider>
+ <view class="inspection-items">
+ <view v-for="(item, index) in inspectionItems"
+ :key="index"
+ class="inspection-item">
+ <text class="item-name">{{ item.parameterItem || '妫�楠岄」鐩�' }}</text>
+ <view class="item-details">
+ <view class="item-detail-row">
+ <text class="item-detail-label">鍗曚綅:</text>
+ <text class="item-detail-value">{{ item.unit || '-' }}</text>
+ </view>
+ <view class="item-detail-row">
+ <text class="item-detail-label">鏍囧噯鍊�:</text>
+ <text class="item-detail-value">{{ item.standardValue || '-' }}</text>
+ </view>
+ <view class="item-detail-row">
+ <text class="item-detail-label">鍐呮帶鍊�:</text>
+ <text class="item-detail-value">{{ item.controlValue || '-' }}</text>
+ </view>
+ <view class="item-detail-row">
+ <text class="item-detail-label">妫�楠屽��:</text>
+ <text class="item-detail-value result"
+ :class="getResultClass(item.testValue, item.standardValue)">
+ {{ item.testValue || '-' }}
+ </text>
+ </view>
+ </view>
+ </view>
+ </view>
+ </view>
+ <!-- 鎿嶄綔鎸夐挳 -->
+ <!-- <view class="action-buttons">
+ <u-button type="primary"
+ class="action-btn"
+ @click="downloadReport">
+ 涓嬭浇鎶ュ憡
+ </u-button>
+ </view> -->
+ </view>
+ <view v-else
+ class="no-data">
+ <up-empty mode="data"
+ text="鏆傛棤妫�楠岃鎯�"></up-empty>
+ </view>
+ </view>
+</template>
+
+<script setup>
+ import { ref, onMounted } from "vue";
+ import { onShow } from "@dcloudio/uni-app";
+ import PageHeader from "@/components/PageHeader.vue";
+ import dayjs from "dayjs";
+ import { qualityInspectParamInfo } from "@/api/qualityManagement/materialInspection.js";
+
+ // 鏄剧ず鎻愮ず淇℃伅
+ const showToast = message => {
+ uni.showToast({
+ title: message,
+ icon: "none",
+ });
+ };
+
+ // 璇︽儏鏁版嵁
+ const detailData = ref(null);
+ // 妫�楠岄」鐩�
+ const inspectionItems = ref([]);
+
+ // 杩斿洖涓婁竴椤�
+ const goBack = () => {
+ uni.navigateBack();
+ };
+
+ // 鏍煎紡鍖栨棩鏈熸椂闂�
+ const formatDateTime = date => {
+ if (!date) return "";
+ return dayjs(date).format("YYYY-MM-DD");
+ };
+
+ // 鑾峰彇鏍囩绫诲瀷
+ const getTagType = result => {
+ switch (result) {
+ case "鍚堟牸":
+ return "success";
+ case "涓嶅悎鏍�":
+ return "error";
+ default:
+ return "info";
+ }
+ };
+
+ // 鑾峰彇鐘舵�佹爣绛剧被鍨�
+ const getStateTagType = state => {
+ return state ? "success" : "warning";
+ };
+
+ // 鑾峰彇缁撴灉鏍峰紡
+ const getResultClass = (testValue, standardValue) => {
+ // 绠�鍗曠殑缁撴灉鍒ゆ柇閫昏緫锛屽疄闄呴」鐩腑鍙兘闇�瑕佹洿澶嶆潅鐨勫垽鏂�
+ if (testValue === "鍚堟牸") {
+ return "result-passed";
+ } else if (testValue === "涓嶅悎鏍�") {
+ return "result-rejected";
+ }
+ return "";
+ };
+
+ // 涓嬭浇鎶ュ憡
+ const downloadReport = () => {
+ uni.showToast({
+ title: "鎶ュ憡涓嬭浇涓�...",
+ icon: "loading",
+ });
+
+ // 妯℃嫙涓嬭浇
+ setTimeout(() => {
+ uni.showToast({
+ title: "鎶ュ憡涓嬭浇鎴愬姛",
+ icon: "success",
+ });
+ }, 1500);
+ };
+
+ // 鑾峰彇椤甸潰ID
+ const getPageId = () => {
+ const pages = getCurrentPages();
+ const currentPage = pages[pages.length - 1];
+ return currentPage.options.id;
+ };
+
+ // 鑾峰彇璇︽儏鏁版嵁
+ const getDetail = () => {
+ const id = getPageId();
+ if (!id) {
+ showToast("鍙傛暟閿欒");
+ return;
+ }
+
+ // 浠庢湰鍦板瓨鍌ㄨ幏鍙栬鎯呮暟鎹�
+ try {
+ const detailDataFromStorage = uni.getStorageSync("finalInspectionEditData");
+ if (detailDataFromStorage) {
+ detailData.value = detailDataFromStorage;
+ console.log(detailData.value, "detailData.value");
+ // 浣跨敤qualityInspectParamInfo鑾峰彇妫�楠岄」鐩�
+ qualityInspectParamInfo(id)
+ .then(res => {
+ if (res.data && res.data.length > 0) {
+ inspectionItems.value = res.data;
+ } else if (
+ detailDataFromStorage.qualityInspectParams &&
+ detailDataFromStorage.qualityInspectParams.length > 0
+ ) {
+ // 濡傛灉鎺ュ彛娌℃湁杩斿洖鏁版嵁锛屼娇鐢ㄦ湰鍦板瓨鍌ㄤ腑鐨勬暟鎹�
+ inspectionItems.value = detailDataFromStorage.qualityInspectParams;
+ }
+ })
+ .catch(error => {
+ console.error("鑾峰彇妫�楠岄」鐩け璐�:", error);
+ // 鎺ュ彛璋冪敤澶辫触鏃讹紝浣跨敤鏈湴瀛樺偍涓殑鏁版嵁鎴栨ā鎷熸暟鎹�
+ if (
+ detailDataFromStorage.qualityInspectParams &&
+ detailDataFromStorage.qualityInspectParams.length > 0
+ ) {
+ inspectionItems.value = detailDataFromStorage.qualityInspectParams;
+ }
+ });
+ }
+ } catch (error) {
+ console.error("鍔犺浇璇︽儏鏁版嵁澶辫触:", error);
+ showToast("鍔犺浇璇︽儏鏁版嵁澶辫触锛岃閲嶈瘯");
+ }
+ };
+
+ onShow(() => {
+ getDetail();
+ });
+
+ onMounted(() => {
+ getDetail();
+ });
+</script>
+
+<style scoped lang="scss">
+ .material-inspection-detail {
+ min-height: 100vh;
+ background: #f5f5f5;
+ padding-bottom: 20px;
+ }
+
+ .detail-section {
+ padding: 15px;
+ }
+
+ .detail-card {
+ background: #fff;
+ border-radius: 12px;
+ padding: 16px;
+ margin-bottom: 12px;
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
+ }
+
+ .card-header {
+ display: flex;
+ align-items: center;
+ margin-bottom: 12px;
+ }
+
+ .header-icon {
+ width: 40px;
+ height: 40px;
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+ border-radius: 8px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ margin-right: 12px;
+ }
+
+ .header-icon.secondary {
+ background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
+ }
+
+ .header-icon.tertiary {
+ background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
+ }
+
+ .header-title {
+ flex: 1;
+ font-size: 16px;
+ font-weight: 600;
+ color: #333;
+ }
+
+ .status-tag {
+ margin-left: 20rpx;
+ }
+
+ .detail-content {
+ padding-top: 8px;
+ }
+
+ .detail-row {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 10px 0;
+ border-bottom: 1px solid #f0f0f0;
+ }
+
+ .detail-row:last-child {
+ border-bottom: none;
+ }
+
+ .detail-label {
+ font-size: 14px;
+ color: #666;
+ min-width: 100px;
+ }
+
+ .detail-value {
+ font-size: 14px;
+ color: #333;
+ text-align: right;
+ flex: 1;
+ }
+
+ // 妫�楠岄」鐩�
+ .inspection-items {
+ padding-top: 8px;
+ }
+
+ .inspection-item {
+ padding: 12px;
+ background: #f8f9fa;
+ border-radius: 8px;
+ margin-bottom: 10px;
+ }
+
+ .inspection-item:last-child {
+ margin-bottom: 0;
+ }
+
+ .item-name {
+ display: block;
+ font-size: 14px;
+ font-weight: 500;
+ color: #333;
+ margin-bottom: 8px;
+ padding-bottom: 8px;
+ border-bottom: 1px solid #f0f0f0;
+ }
+
+ .item-details {
+ padding-top: 8px;
+ }
+
+ .item-detail-row {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 6px;
+ }
+
+ .item-detail-row:last-child {
+ margin-bottom: 0;
+ }
+
+ .item-detail-label {
+ font-size: 12px;
+ color: #666;
+ min-width: 60px;
+ }
+
+ .item-detail-value {
+ font-size: 12px;
+ color: #333;
+ text-align: right;
+ flex: 1;
+ }
+
+ .item-detail-value.result {
+ font-weight: 500;
+ }
+
+ .result-passed {
+ color: #67c23a;
+ }
+
+ .result-rejected {
+ color: #f56c6c;
+ }
+
+ // 绌虹姸鎬�
+ .no-data {
+ padding: 60px 20px;
+ text-align: center;
+ }
+</style>
diff --git a/src/pages/qualityManagement/finalInspection/fileList.vue b/src/pages/qualityManagement/finalInspection/fileList.vue
new file mode 100644
index 0000000..126158d
--- /dev/null
+++ b/src/pages/qualityManagement/finalInspection/fileList.vue
@@ -0,0 +1,566 @@
+<template>
+ <view class="file-list-page">
+ <!-- 椤甸潰澶撮儴 -->
+ <PageHeader title="闄勪欢绠$悊"
+ @back="goBack" />
+ <!-- 闄勪欢鍒楄〃 -->
+ <view class="file-list-container">
+ <view v-if="fileList.length > 0"
+ class="file-list">
+ <view v-for="(file, index) in fileList"
+ :key="file.id || index"
+ class="file-item">
+ <!-- 鏂囦欢鍥炬爣 -->
+ <!-- <view class="file-icon"
+ :class="getFileIconClass(file.fileType)">
+ <up-icon :name="getFileIcon(file.fileType)"
+ size="24"
+ color="#ffffff" />
+ </view> -->
+ <!-- 鏂囦欢淇℃伅 -->
+ <view class="file-info">
+ <text class="file-name">{{ file.name }}</text>
+ <!-- <text class="file-meta">{{ formatFileSize(file.fileSize) }} 路 {{ file.uploadTime || file.createTime }}</text> -->
+ </view>
+ <!-- 鎿嶄綔鎸夐挳 -->
+ <view class="file-actions">
+ <!-- <u-button size="small"
+ type="primary"
+ plain
+ @click="previewFile(file)">棰勮</u-button> -->
+ <u-button size="small"
+ type="info"
+ plain
+ @click="downloadFile(file)">涓嬭浇骞堕瑙�</u-button>
+ <u-button size="small"
+ type="error"
+ plain
+ @click="confirmDelete(file, index)">鍒犻櫎</u-button>
+ </view>
+ </view>
+ </view>
+ <!-- 绌虹姸鎬� -->
+ <view v-else
+ class="empty-state">
+ <up-icon name="document"
+ size="64"
+ color="#c0c4cc" />
+ <text class="empty-text">鏆傛棤闄勪欢</text>
+ </view>
+ </view>
+ <!-- <a rel="nofollow"
+ id="downloadLink"
+ href="#"
+ style="display:none;">涓嬭浇鏂囨湰鏂囦欢</a> -->
+ <!-- 涓婁紶鎸夐挳 -->
+ <view class="upload-button"
+ @click="chooseFile">
+ <up-icon name="plus"
+ size="24"
+ color="#ffffff" />
+ <text class="upload-text">涓婁紶闄勪欢</text>
+ </view>
+ </view>
+</template>
+
+<script setup>
+ import { ref, onMounted } from "vue";
+ import PageHeader from "@/components/PageHeader.vue";
+ import config from "@/config";
+ import { getToken } from "@/utils/auth";
+ // import { saveAs } from "file-saver";
+ import {
+ listRuleFiles,
+ delRuleFile,
+ } from "@/api/managementMeetings/rulesRegulationsManagement";
+ import {
+ qualityInspectFileAdd,
+ qualityInspectFileListPage,
+ qualityInspectFileDel,
+ } from "@/api/qualityManagement/materialInspection";
+ import { blobValidate } from "@/utils/ruoyi";
+
+ // 闄勪欢鍒楄〃
+ const fileList = ref([]);
+
+ // 杩斿洖涓婁竴椤�
+ const goBack = () => {
+ uni.navigateBack();
+ };
+ // const request = axios.create({
+ // baseURL: "URL.com",
+ // adapter: axiosAdapterUniapp,
+ // });
+ // 鑾峰彇鏂囦欢鍥炬爣
+ const getFileIcon = fileType => {
+ const iconMap = {
+ doc: "document",
+ docx: "document",
+ xls: "grid",
+ xlsx: "grid",
+ pdf: "document",
+ ppt: "copy",
+ pptx: "copy",
+ txt: "document",
+ jpg: "image",
+ jpeg: "image",
+ png: "image",
+ gif: "image",
+ zip: "folder",
+ rar: "folder",
+ };
+ return iconMap[fileType.toLowerCase()] || "document";
+ };
+
+ // 鑾峰彇鏂囦欢鍥炬爣鏍峰紡绫�
+ const getFileIconClass = fileType => {
+ const colorMap = {
+ doc: "blue",
+ docx: "blue",
+ xls: "green",
+ xlsx: "green",
+ pdf: "red",
+ ppt: "orange",
+ pptx: "orange",
+ txt: "gray",
+ jpg: "purple",
+ jpeg: "purple",
+ png: "purple",
+ gif: "purple",
+ zip: "yellow",
+ rar: "yellow",
+ };
+ return colorMap[fileType.toLowerCase()] || "gray";
+ };
+
+ // 鏍煎紡鍖栨枃浠跺ぇ灏�
+ const formatFileSize = bytes => {
+ if (bytes === 0) return "0 B";
+ const k = 1024;
+ const sizes = ["B", "KB", "MB", "GB"];
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
+ };
+
+ // 閫夋嫨鏂囦欢
+ const chooseFile = () => {
+ uni.chooseImage({
+ count: 9,
+ sizeType: ["original", "compressed"],
+ sourceType: ["album", "camera"],
+ success: res => {
+ console.log(res, "閫夋嫨鍥剧墖鎴愬姛");
+ uploadFiles(res.tempFiles);
+ },
+ fail: err => {
+ console.error("閫夋嫨鍥剧墖澶辫触:", err);
+ showToast("閫夋嫨鏂囦欢澶辫触");
+ },
+ });
+ // uni.chooseFile({
+ // count: 9,
+ // extension: [
+ // ".doc",
+ // ".docx",
+ // ".xls",
+ // ".xlsx",
+ // ".pdf",
+ // ".ppt",
+ // ".pptx",
+ // ".txt",
+ // ".jpg",
+ // ".jpeg",
+ // ".png",
+ // ".gif",
+ // ".zip",
+ // ".rar",
+ // ],
+ // success: res => {
+ // console.log(res, "閫夋嫨鏂囦欢鎴愬姛");
+ // uploadFiles(res.tempFiles);
+ // },
+ // fail: err => {
+ // showToast("閫夋嫨鏂囦欢澶辫触");
+ // },
+ // });
+ };
+
+ // 涓婁紶鏂囦欢
+ const uploadFiles = tempFiles => {
+ console.log(tempFiles, "涓婁紶鏂囦欢1");
+ tempFiles.forEach((tempFile, index) => {
+ // 鏄剧ず涓婁紶涓彁绀�
+ uni.showLoading({
+ title: "涓婁紶涓�...",
+ mask: true,
+ });
+ console.log(tempFile, "涓婁紶鏂囦欢2");
+ // 1. 鐩存帴浣跨敤 uni.uploadFile 涓婁紶鏂囦欢
+ uni.uploadFile({
+ url: config.baseUrl + "/file/upload",
+ filePath: tempFile.path,
+ name: "file",
+ header: {
+ Authorization: "Bearer " + getToken(),
+ },
+ success: uploadRes => {
+ uni.hideLoading();
+ console.log(uploadRes, "涓婁紶鏂囦欢3");
+
+ try {
+ const res = JSON.parse(uploadRes.data);
+ console.log(res, "涓婁紶鏂囦欢4");
+ if (res.code === 200) {
+ // 2. 鎻愬彇鏂囦欢淇℃伅
+ const fileName = tempFile.name
+ ? tempFile.name
+ : tempFile.path.split("/").pop();
+ // const fileType = fileName.split(".").pop();
+ // 3. 鏋勯�犱繚瀛樻枃浠朵俊鎭殑鍙傛暟
+ const saveData = {
+ name: fileName,
+ inspectId: rulesRegulationsManagementId.value,
+ url: res.data.tempPath || "",
+ };
+ console.log(saveData, "淇濆瓨鏂囦欢淇℃伅鍙傛暟");
+ // 4. 璋冪敤 addRuleFile 鎺ュ彛淇濆瓨鏂囦欢淇℃伅
+ qualityInspectFileAdd(saveData)
+ .then(addRes => {
+ if (addRes.code === 200) {
+ // 5. 娣诲姞鍒版枃浠跺垪琛�
+ const newFile = {
+ ...addRes.data,
+ uploadTime: new Date().toLocaleString(),
+ };
+ // fileList.value.push(newFile);
+ getFileList();
+ showToast("涓婁紶鎴愬姛");
+ } else {
+ showToast("淇濆瓨鏂囦欢淇℃伅澶辫触");
+ }
+ })
+ .catch(err => {
+ console.error("淇濆瓨鏂囦欢淇℃伅澶辫触:", err);
+ showToast("淇濆瓨鏂囦欢淇℃伅澶辫触");
+ });
+ } else {
+ showToast("鏂囦欢涓婁紶澶辫触");
+ }
+ } catch (e) {
+ console.error("瑙f瀽涓婁紶缁撴灉澶辫触:", e);
+ showToast("涓婁紶澶辫触");
+ }
+ },
+ fail: err => {
+ uni.hideLoading();
+ console.error("涓婁紶澶辫触:", err);
+ showToast("涓婁紶澶辫触");
+ },
+ });
+ });
+ };
+ // 涓嬭浇鏂囦欢
+ const downloadFile = file => {
+ var url =
+ config.baseUrl +
+ "/common/download?fileName=" +
+ encodeURIComponent(file.url) +
+ "&delete=true";
+ console.log(url, "url");
+
+ uni
+ .downloadFile({
+ url: url,
+ responseType: "blob",
+ header: { Authorization: "Bearer " + getToken() },
+ })
+ .then(res => {
+ let osType = uni.getStorageSync("deviceInfo").osName;
+ let filePath = res.tempFilePath;
+ if (osType === "ios") {
+ uni.openDocument({
+ filePath: filePath,
+ showMenu: true,
+ success: res => {
+ resolve(res);
+ },
+ fail: err => {
+ console.log("uni.openDocument--fail");
+ reject(err);
+ },
+ });
+ } else {
+ uni.saveFile({
+ tempFilePath: filePath,
+ success: fileRes => {
+ uni.showToast({
+ icon: "none",
+ mask: true,
+ title:
+ "鏂囦欢宸蹭繚瀛橈細Android/data/uni.UNI720216F/apps/__UNI__720216F/" +
+ fileRes.savedFilePath, //淇濆瓨璺緞
+ duration: 3000,
+ });
+ setTimeout(() => {
+ //鎵撳紑鏂囨。鏌ョ湅
+ uni.openDocument({
+ filePath: fileRes.savedFilePath,
+ success: function (res) {
+ resolve(fileRes);
+ },
+ });
+ }, 3000);
+ },
+ fail: err => {
+ console.log("uni.save--fail");
+ reject(err);
+ },
+ });
+ }
+ // const isBlob = blobValidate(res.data);
+ // if (isBlob) {
+ // const blob = new Blob([res.data], { type: "text/plain" });
+ // const url = URL.createObjectURL(blob);
+ // const downloadLink = document.getElementById("downloadLink");
+ // downloadLink.href = url;
+ // downloadLink.download = file.name;
+ // downloadLink.click();
+ // showToast("涓嬭浇鎴愬姛");
+ // } else {
+ // showToast("涓嬭浇澶辫触");
+ // }
+ })
+ .catch(err => {
+ console.error("涓嬭浇澶辫触:", err);
+ showToast("涓嬭浇澶辫触");
+ });
+ };
+
+ // 纭鍒犻櫎
+ const confirmDelete = (file, index) => {
+ uni.showModal({
+ title: "鍒犻櫎纭",
+ content: `纭畾瑕佸垹闄ら檮浠� "${file.name}" 鍚楋紵`,
+ success: res => {
+ if (res.confirm) {
+ deleteFile(file.id, index);
+ }
+ },
+ });
+ };
+
+ // 鍒犻櫎鏂囦欢
+ const deleteFile = (fileId, index) => {
+ uni.showLoading({
+ title: "鍒犻櫎涓�...",
+ mask: true,
+ });
+
+ qualityInspectFileDel([fileId])
+ .then(res => {
+ uni.hideLoading();
+ if (res.code === 200) {
+ // fileList.value.splice(index, 1);
+ getFileList();
+ showToast("鍒犻櫎鎴愬姛");
+ } else {
+ showToast("鍒犻櫎澶辫触");
+ }
+ })
+ .catch(err => {
+ uni.hideLoading();
+ showToast("鍒犻櫎澶辫触");
+ });
+ };
+
+ // 鏄剧ず鎻愮ず
+ const showToast = message => {
+ uni.showToast({
+ title: message,
+ icon: "none",
+ });
+ };
+ const rulesRegulationsManagementId = ref("");
+ // 椤甸潰鍔犺浇鏃�
+ onMounted(() => {
+ rulesRegulationsManagementId.value = uni.getStorageSync(
+ "qualityInspectFileId"
+ );
+ // 浠� API 鑾峰彇闄勪欢鍒楄〃
+ getFileList();
+ // 浠庢湰鍦板瓨鍌ㄨ幏鍙� rulesRegulationsManagementId
+ });
+
+ // 鑾峰彇闄勪欢鍒楄〃
+ const getFileList = () => {
+ uni.showLoading({
+ title: "鍔犺浇涓�...",
+ mask: true,
+ });
+
+ qualityInspectFileListPage({
+ inspectId: rulesRegulationsManagementId.value,
+ current: -1,
+ size: -1,
+ })
+ .then(res => {
+ uni.hideLoading();
+ if (res.code === 200) {
+ fileList.value = res.data.records || [];
+ } else {
+ showToast("鑾峰彇闄勪欢鍒楄〃澶辫触");
+ }
+ })
+ .catch(err => {
+ uni.hideLoading();
+ showToast("鑾峰彇闄勪欢鍒楄〃澶辫触");
+ });
+ };
+</script>
+
+<style scoped lang="scss">
+ @import "../../../styles/sales-common.scss";
+
+ .file-list-page {
+ min-height: 100vh;
+ background: #f8f9fa;
+ padding-bottom: 100rpx;
+ }
+
+ .file-list-container {
+ padding: 20rpx;
+ }
+
+ .file-list {
+ background: #ffffff;
+ border-radius: 8rpx;
+ overflow: hidden;
+ box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
+ }
+
+ .file-item {
+ display: flex;
+ align-items: center;
+ padding: 20rpx;
+ border-bottom: 1rpx solid #f0f0f0;
+
+ &:last-child {
+ border-bottom: none;
+ }
+ }
+
+ .file-icon {
+ width: 56rpx;
+ height: 56rpx;
+ border-radius: 8rpx;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ margin-right: 20rpx;
+
+ &.blue {
+ background: #409eff;
+ }
+
+ &.green {
+ background: #67c23a;
+ }
+
+ &.red {
+ background: #f56c6c;
+ }
+
+ &.orange {
+ background: #e6a23c;
+ }
+
+ &.gray {
+ background: #909399;
+ }
+
+ &.purple {
+ background: #909399;
+ }
+
+ &.yellow {
+ background: #e6a23c;
+ }
+ }
+
+ .file-info {
+ flex: 1;
+ min-width: 0;
+ }
+
+ .file-name {
+ display: block;
+ font-size: 16px;
+ color: #303133;
+ margin-bottom: 8rpx;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+
+ .file-meta {
+ display: block;
+ font-size: 12px;
+ color: #909399;
+ }
+
+ .file-actions {
+ display: flex;
+ gap: 12rpx;
+ }
+
+ .empty-state {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ padding: 100rpx 0;
+ background: #ffffff;
+ border-radius: 8rpx;
+ box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
+ }
+
+ .empty-text {
+ font-size: 14px;
+ color: #909399;
+ margin-top: 20rpx;
+ }
+
+ .upload-button {
+ position: fixed;
+ bottom: 40rpx;
+ right: 40rpx;
+ width: 130rpx;
+ height: 130rpx;
+ border-radius: 50%;
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ box-shadow: 0 4rpx 16rpx rgba(102, 126, 234, 0.4);
+ z-index: 1000;
+ }
+
+ .upload-text {
+ font-size: 10px;
+ color: #ffffff;
+ margin-top: 4rpx;
+ }
+
+ .upload-progress {
+ padding: 40rpx 0;
+ }
+
+ .upload-progress-text {
+ display: block;
+ text-align: center;
+ margin-top: 20rpx;
+ font-size: 14px;
+ color: #606266;
+ }
+</style>
\ No newline at end of file
diff --git a/src/pages/qualityManagement/finalInspection/index.vue b/src/pages/qualityManagement/finalInspection/index.vue
new file mode 100644
index 0000000..dd65105
--- /dev/null
+++ b/src/pages/qualityManagement/finalInspection/index.vue
@@ -0,0 +1,776 @@
+<template>
+ <view class="material-inspection-page">
+ <!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 -->
+ <PageHeader title="鍑哄巶妫�楠�"
+ @back="goBack" />
+ <!-- 鎼滅储鍖哄煙 -->
+ <view class="search-section">
+ <up-search
+ placeholder="璇疯緭鍏ヤ骇鍝佸悕绉版悳绱�"
+ v-model="searchForm.productName"
+ @search="getList"
+ @custom="getList"
+ @clear="getList"
+ :show-action="true"
+ action-text="鎼滅储"
+ :animation="true"
+ ></up-search>
+ </view>
+ <!-- 缁熻淇℃伅鍗$墖 -->
+ <!-- <view class="stats-cards">
+ <view class="stat-card">
+ <text class="stat-number">{{ totalCount }}</text>
+ <text class="stat-label">鎬绘楠�</text>
+ </view>
+ <view class="stat-card">
+ <text class="stat-number">{{ submittedCount }}</text>
+ <text class="stat-label">宸叉彁浜�</text>
+ </view>
+ <view class="stat-card">
+ <text class="stat-number">{{ pendingCount }}</text>
+ <text class="stat-label">寰呮彁浜�</text>
+ </view>
+ <view class="stat-card">
+ <text class="stat-number">{{ qualifiedCount }}</text>
+ <text class="stat-label">宸插悎鏍�</text>
+ </view>
+ </view> -->
+ <!-- 妫�楠屽垪琛� -->
+ <view class="inspection-list"
+ v-if="inspectionList.length > 0">
+ <view v-for="(item, index) in inspectionList"
+ :key="index">
+ <view class="inspection-item"
+ @click="viewDetail(item)">
+ <view class="item-header">
+ <view class="item-left">
+ <!-- <view class="material-icon"
+ :class="getStateClass(item.inspectState)">
+ <up-icon :name="getStateIcon(item.inspectState)"
+ size="16"
+ color="#ffffff"></up-icon>
+ </view> -->
+ <view class="material-info">
+ <text class="material-name">{{ item.productName }}</text>
+ <text class="material-code">{{ item.model }}</text>
+ </view>
+ </view>
+ <view class="status-tags">
+ <u-tag :type="getTagType(item.checkResult)"
+ size="mini"
+ class="status-tag">
+ {{ item.checkResult }}
+ </u-tag>
+ <u-tag :type="getStateTagType(item.inspectState)"
+ size="mini"
+ class="status-tag">
+ {{ item.inspectState ? '宸叉彁浜�' : '鏈彁浜�' }}
+ </u-tag>
+ </view>
+ </view>
+ <up-divider></up-divider>
+ <view class="item-details">
+ <view class="detail-row">
+ <text class="detail-label">妫�娴嬫棩鏈�</text>
+ <text class="detail-value">{{ formatDateTime(item.checkTime) || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">鐢熶骇宸ュ崟鍙�</text>
+ <text class="detail-value">{{ item.workOrderNo || '-' }}</text>
+ </view>
+ <!-- <view class="detail-row">
+ <text class="detail-label">宸ュ簭</text>
+ <text class="detail-value">{{ item.process || '-' }}</text>
+ </view> -->
+ <view class="detail-row">
+ <text class="detail-label">妫�楠屽憳</text>
+ <text class="detail-value">{{ item.checkName || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">鏁伴噺</text>
+ <text class="detail-value">{{ item.quantity || 0 }} {{ item.unit || '' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">妫�娴嬪崟浣�</text>
+ <text class="detail-value">{{ item.checkCompany || '-' }}</text>
+ </view>
+ </view>
+ <!-- 鎿嶄綔鎸夐挳 -->
+ <view class="action-buttons">
+ <!-- <u-button type="primary"
+ size="small"
+ class="action-btn"
+ :disabled="item.inspectState"
+ @click.stop="startInspection(item)">
+ 缂栬緫
+ </u-button> -->
+ <u-button type="info"
+ size="small"
+ class="action-btn"
+ @click.stop="viewDetail(item)">
+ 璇︽儏
+ </u-button>
+ <!-- <u-button type="success"
+ size="small"
+ class="action-btn"
+ :disabled="item.inspectState"
+ @click.stop="submitInspection(item)">
+ 鎻愪氦
+ </u-button> -->
+ </view>
+ <view class="action-buttons">
+ <!-- <u-button type="info"
+ size="small"
+ class="action-btn"
+ @click.stop="viewFileList(item)">
+ 闄勪欢
+ </u-button>
+ <u-button type="warning"
+ size="small"
+ class="action-btn"
+ :disabled="item.inspectState || item.checkName !== ''"
+ @click.stop="assignInspector(item)">
+ 鍒嗛厤妫�楠屽憳
+ </u-button> -->
+ </view>
+ </view>
+ </view>
+ </view>
+ <view v-else
+ class="no-data">
+ <up-empty mode="data"
+ text="鏆傛棤妫�楠屼换鍔�"></up-empty>
+ </view>
+ <!-- 鍒嗛〉缁勪欢 -->
+ <!-- 娴姩鏂板鎸夐挳 -->
+ <!-- <view class="fab-button"
+ @click="addInspection">
+ <up-icon name="plus"
+ size="24"
+ color="#ffffff"></up-icon>
+ </view> -->
+ <!-- 鏃ユ湡閫夋嫨鍣� -->
+ <up-popup v-model:show="showDate"
+ mode="date"
+ :start-year="2020"
+ :end-year="2030"
+ :range="true"
+ @confirm="confirmDate" />
+ <!-- 鍒嗛厤妫�楠屽憳寮圭獥 -->
+ <up-popup v-model:show="showAssignDialog"
+ mode="center"
+ round
+ style="width: 80%">
+ <view class="assign-dialog">
+ <view class="dialog-header">
+ <text class="dialog-title">鍒嗛厤妫�楠屽憳</text>
+ <up-icon name="close"
+ size="20"
+ color="#999"
+ @click="showAssignDialog = false"></up-icon>
+ </view>
+ <view class="dialog-content">
+ <up-form-item label="妫�楠屽憳"
+ prop="checkName"
+ :label-width="60"
+ required>
+ <up-input v-model="assignForm.checkName"
+ placeholder="璇烽�夋嫨妫�楠屽憳"
+ readonly />
+ <template #right>
+ <up-icon @click="showInspectorSheet = true"
+ name="arrow-right" />
+ </template>
+ </up-form-item>
+ </view>
+ <view class="dialog-footer">
+ <u-button type="default"
+ class="footer-btn"
+ @click="showAssignDialog = false">
+ 鍙栨秷
+ </u-button>
+ <u-button type="primary"
+ class="footer-btn"
+ @click="submitAssign">
+ 纭畾
+ </u-button>
+ </view>
+ </view>
+ </up-popup>
+ <!-- 妫�楠屽憳閫夋嫨 -->
+ <up-action-sheet :show="showInspectorSheet"
+ :actions="userSheetOptions"
+ @select="selectInspector"
+ title="閫夋嫨妫�楠屽憳" />
+ </view>
+</template>
+
+<script setup>
+ import { ref, computed, onMounted } from "vue";
+ import { onShow } from "@dcloudio/uni-app";
+ import PageHeader from "@/components/PageHeader.vue";
+ import dayjs from "dayjs";
+ import {
+ submitQualityInspect,
+ qualityInspectUpdate,
+ qualityInspectListPage,
+ } from "@/api/qualityManagement/materialInspection.js";
+ import { userListNoPage } from "@/api/system/user.js";
+
+ // 鏄剧ず鎻愮ず淇℃伅
+ const showToast = message => {
+ uni.showToast({
+ title: message,
+ icon: "none",
+ });
+ };
+
+ // 鎼滅储琛ㄥ崟
+ const searchForm = ref({
+ productName: "",
+ entryDate: undefined,
+ entryDateStart: undefined,
+ entryDateEnd: undefined,
+ });
+
+ // 鏃ユ湡閫夋嫨鍣�
+ const showDate = ref(false);
+
+ // 鍒嗛厤妫�楠屽憳寮圭獥
+ const showAssignDialog = ref(false);
+ const showInspectorSheet = ref(false);
+ const assignForm = ref({
+ checkName: "",
+ });
+ const currentAssignRow = ref(null);
+
+ // 妫�楠屽垪琛ㄦ暟鎹�
+ const inspectionList = ref([]);
+
+ // 鍒嗛〉鏁版嵁
+ const page = ref({
+ current: -1,
+ size: -1,
+ total: 0,
+ });
+
+ // 鍔犺浇鐘舵��
+ const tableLoading = ref(false);
+
+ // 缁熻鏁版嵁
+ const totalCount = ref(0);
+ const submittedCount = ref(0);
+ const pendingCount = ref(0);
+ const qualifiedCount = ref(0);
+
+ // 妫�楠屽憳鍒楄〃
+ const userList = ref([]);
+
+ // ActionSheet閫夐」
+ const userSheetOptions = computed(() => {
+ return userList.value.map(item => ({
+ name: item.nickName,
+ value: item.nickName,
+ }));
+ });
+
+ // 杩斿洖涓婁竴椤�
+ const goBack = () => {
+ uni.navigateBack();
+ };
+
+ // 鏍煎紡鍖栨棩鏈熸椂闂�
+ const formatDateTime = dateStr => {
+ if (!dateStr) return "";
+ return dayjs(dateStr).format("YYYY-MM-DD");
+ };
+
+ // 鑾峰彇鐘舵�佹牱寮�
+ const getStateClass = inspectState => {
+ return inspectState ? "state-submitted" : "state-pending";
+ };
+
+ // 鑾峰彇鐘舵�佸浘鏍�
+ const getStateIcon = inspectState => {
+ return inspectState ? "checkmark-circle" : "time";
+ };
+
+ // 鑾峰彇鏍囩绫诲瀷
+ const getTagType = checkResult => {
+ if (checkResult === "鍚堟牸") return "success";
+ if (checkResult === "涓嶅悎鏍�") return "error";
+ return "default";
+ };
+
+ // 鑾峰彇鐘舵�佹爣绛剧被鍨�
+ const getStateTagType = inspectState => {
+ return inspectState ? "success" : "warning";
+ };
+
+ // 鏄剧ず鏃ユ湡閫夋嫨鍣�
+ const showDatePicker = () => {
+ showDate.value = true;
+ };
+
+ // 纭鏃ユ湡閫夋嫨
+ const confirmDate = e => {
+ searchForm.value.entryDate = e.value;
+ searchForm.value.entryDateStart = dayjs(e.value[0]).format("YYYY-MM-DD");
+ searchForm.value.entryDateEnd = dayjs(e.value[1]).format("YYYY-MM-DD");
+ getList();
+ };
+ const viewFileList = item => {
+ uni.setStorageSync("qualityInspectFileId", item.id);
+ uni.navigateTo({
+ url: "/pages/qualityManagement/finalInspection/fileList",
+ });
+ };
+
+ // 娓呴櫎鏃ユ湡鑼冨洿
+ const clearDateRange = () => {
+ searchForm.value.entryDate = undefined;
+ searchForm.value.entryDateStart = undefined;
+ searchForm.value.entryDateEnd = undefined;
+ getList();
+ };
+
+ // 鑾峰彇鐢ㄦ埛鍒楄〃
+ const getUserList = async () => {
+ try {
+ const userRes = await userListNoPage();
+ userList.value = userRes.data || [];
+ } catch (e) {
+ console.error("鍔犺浇妫�楠屽憳鍒楄〃澶辫触", e);
+ userList.value = [];
+ }
+ };
+
+ // 鏌ヨ鍒楄〃
+ const getList = () => {
+ tableLoading.value = true;
+ const params = { ...searchForm.value, ...page.value };
+ params.entryDate = undefined;
+ qualityInspectListPage({ ...params, inspectType: 2 })
+ .then(res => {
+ tableLoading.value = false;
+ inspectionList.value = res.data.records || [];
+ page.value.total = res.data.total || 0;
+ totalCount.value = res.data.total || 0;
+ submittedCount.value = inspectionList.value.filter(
+ item => item.inspectState
+ ).length;
+ pendingCount.value = inspectionList.value.filter(
+ item => !item.inspectState
+ ).length;
+ qualifiedCount.value = inspectionList.value.filter(
+ item => item.checkResult === "鍚堟牸"
+ ).length;
+ })
+ .catch(err => {
+ tableLoading.value = false;
+ console.error("鑾峰彇鍒楄〃澶辫触:", err);
+ showToast("鑾峰彇鍒楄〃澶辫触锛岃閲嶈瘯");
+ });
+ };
+
+ // 缂栬緫妫�楠�
+ const startInspection = item => {
+ if (!item) {
+ showToast("鍙傛暟閿欒");
+ return;
+ }
+ console.log(item, "item");
+ // 瀛樺偍瀹屾暣鐨勬楠屾暟鎹�
+ uni.setStorageSync("finalInspectionEditData", item);
+ // 璺宠浆鍒扮紪杈戦〉闈�
+ uni.navigateTo({
+ url: `/pages/qualityManagement/finalInspection/add?id=${item.id}&isEdit=true`,
+ });
+ };
+
+ // 鏌ョ湅璇︽儏
+ const viewDetail = item => {
+ if (!item) {
+ showToast("鍙傛暟閿欒");
+ return;
+ }
+ uni.setStorageSync("finalInspectionEditData", item);
+ // 璺宠浆鍒拌鎯呴〉闈�
+ uni.navigateTo({
+ url: `/pages/qualityManagement/finalInspection/detail?id=${item.id}`,
+ });
+ };
+
+ // 鏂板妫�楠�
+ const addInspection = () => {
+ uni.navigateTo({
+ url: "/pages/qualityManagement/finalInspection/add",
+ });
+ };
+
+ // 鎻愪氦妫�楠�
+ const submitInspection = async item => {
+ if (!item) {
+ showToast("鍙傛暟閿欒");
+ return;
+ }
+ try {
+ const res = await submitQualityInspect({ id: item.id });
+ if (res.code === 200) {
+ showToast("鎻愪氦鎴愬姛");
+ setTimeout(() => {
+ getList();
+ }, 1000);
+ } else {
+ showToast("鎻愪氦澶辫触锛�" + (res.msg || "鏈煡閿欒"));
+ }
+ } catch (error) {
+ console.error("鎻愪氦澶辫触:", error);
+ showToast("鎻愪氦澶辫触锛岃閲嶈瘯");
+ }
+ };
+
+ // 鍒嗛厤妫�楠屽憳
+ const assignInspector = item => {
+ if (!item) {
+ showToast("鍙傛暟閿欒");
+ return;
+ }
+ currentAssignRow.value = item;
+ getUserList();
+ showAssignDialog.value = true;
+ };
+
+ // 閫夋嫨妫�楠屽憳
+ const selectInspector = e => {
+ assignForm.value.checkName = e.value;
+ showInspectorSheet.value = false;
+ };
+
+ // 鎻愪氦鍒嗛厤
+ const submitAssign = async () => {
+ if (!currentAssignRow.value || !assignForm.value.checkName) {
+ showToast("璇烽�夋嫨妫�楠屽憳");
+ return;
+ }
+ try {
+ const data = {
+ ...assignForm.value,
+ id: currentAssignRow.value.id,
+ };
+ const res = await qualityInspectUpdate(data);
+ if (res.code === 200) {
+ showToast("鍒嗛厤鎴愬姛");
+ showAssignDialog.value = false;
+ setTimeout(() => {
+ getList();
+ }, 1000);
+ } else {
+ showToast("鍒嗛厤澶辫触锛�" + (res.msg || "鏈煡閿欒"));
+ }
+ } catch (error) {
+ console.error("鍒嗛厤澶辫触:", error);
+ showToast("鍒嗛厤澶辫触锛岃閲嶈瘯");
+ }
+ };
+
+ // 澶勭悊鍒嗛〉
+ const handlePagination = obj => {
+ page.value.current = obj.current;
+ page.value.size = obj.size;
+ getList();
+ };
+
+ onMounted(() => {
+ getList();
+ getUserList();
+ });
+
+ onShow(() => {
+ getList();
+ });
+</script>
+
+<style scoped lang="scss">
+ @import "../../../styles/sales-common.scss";
+
+ .material-inspection-page {
+ min-height: 100vh;
+ background: #f8f9fa;
+ padding-bottom: 80px;
+ }
+
+ // 鎼滅储鍖哄煙
+ .search-section {
+ padding: 20rpx 30rpx;
+ background-color: #ffffff;
+ position: sticky;
+ top: 0;
+ z-index: 10;
+ }
+
+ // 缁熻鍗$墖
+ .stats-cards {
+ display: flex;
+ padding: 15px;
+ gap: 10px;
+ background: #fff;
+ margin-bottom: 10px;
+ }
+
+ .stat-card {
+ flex: 1;
+ background: #2979ff;
+ border-radius: 12px;
+ padding: 15px;
+ text-align: center;
+ color: #fff;
+ box-shadow: 0 2px 8px rgba(41, 121, 255, 0.2);
+ }
+
+ .stat-number {
+ display: block;
+ font-size: 20px;
+ font-weight: 600;
+ margin-bottom: 5px;
+ }
+
+ .stat-label {
+ font-size: 12px;
+ opacity: 0.9;
+ }
+
+ // 妫�楠屽垪琛�
+ .inspection-list {
+ padding: 20px;
+ }
+
+ .inspection-item {
+ background: #ffffff;
+ border-radius: 12px;
+ margin-bottom: 16px;
+ overflow: hidden;
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
+ padding: 0 16px;
+
+ &:active {
+ transform: scale(0.98);
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
+ }
+ }
+
+ .item-header {
+ padding: 16px 0;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ }
+
+ .item-left {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ }
+
+ .material-icon {
+ width: 24px;
+ height: 24px;
+ background: #2979ff;
+ border-radius: 4px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+
+ .state-pending {
+ background: #ff9900;
+ }
+
+ .state-submitted {
+ background: #52c41a;
+ }
+
+ .material-info {
+ flex: 1;
+ }
+
+ .material-name {
+ font-size: 14px;
+ color: #333;
+ font-weight: 500;
+ }
+
+ .material-code {
+ font-size: 12px;
+ color: #999;
+ margin-left: 8px;
+ }
+
+ .status-tags {
+ display: flex;
+ gap: 8px;
+ }
+
+ .status-tag {
+ margin: 0;
+ }
+
+ .date-range {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ margin-top: 10px;
+ padding: 8px 12px;
+ background: #f8f9fa;
+ border-radius: 8px;
+ }
+
+ .date-text {
+ font-size: 12px;
+ color: #666;
+ }
+
+ // 璇︽儏琛�
+ .item-details {
+ padding: 16px 0;
+ }
+
+ .detail-row {
+ display: flex;
+ align-items: flex-end;
+ justify-content: space-between;
+ margin-bottom: 8px;
+
+ &:last-child {
+ margin-bottom: 0;
+ }
+ }
+
+ .detail-label {
+ font-size: 12px;
+ color: #777777;
+ min-width: 60px;
+ }
+
+ .detail-value {
+ font-size: 12px;
+ color: #000000;
+ text-align: right;
+ flex: 1;
+ margin-left: 16px;
+ }
+
+ // 鎿嶄綔鎸夐挳
+ .action-buttons {
+ display: flex;
+ gap: 12px;
+ padding: 0 0 16px 0;
+ justify-content: space-between;
+ }
+
+ .action-btn {
+ flex: 1;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 8px;
+ }
+
+ // 绌虹姸鎬�
+ .no-data {
+ padding: 60px 20px;
+ text-align: center;
+ }
+
+ // 娴姩鎸夐挳
+ .fab-button {
+ position: fixed;
+ bottom: 20px;
+ right: 20px;
+ width: 56px;
+ height: 56px;
+ background: #2979ff;
+ border-radius: 50%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ box-shadow: 0 4px 16px rgba(41, 121, 255, 0.3);
+ z-index: 1000;
+ }
+
+ // 鍒嗛厤妫�楠屽憳寮圭獥
+ .assign-dialog {
+ padding: 24px;
+ background: #ffffff;
+ border-radius: 16px;
+ overflow: hidden;
+ }
+
+ .dialog-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 24px;
+ padding-bottom: 16px;
+ border-bottom: 1px solid #f0f0f0;
+ }
+
+ .dialog-title {
+ font-size: 18px;
+ font-weight: 600;
+ color: #303133;
+ }
+
+ .dialog-content {
+ margin-bottom: 24px;
+ }
+
+ .dialog-footer {
+ display: flex;
+ gap: 16px;
+ padding-top: 16px;
+ border-top: 1px solid #f0f0f0;
+ }
+
+ .footer-btn {
+ flex: 1;
+ height: 44px;
+ font-size: 16px;
+ }
+
+ // 杈撳叆妗嗘牱寮�
+ :deep(.up-input__inner) {
+ border-radius: 8px;
+ height: 44px;
+ font-size: 14px;
+ }
+
+ // 琛ㄥ崟椤规牱寮�
+ :deep(.up-form-item) {
+ margin-bottom: 0;
+ }
+
+ :deep(.up-form-item__label) {
+ font-size: 14px;
+ color: #606266;
+ margin-bottom: 8px;
+ }
+
+ // 鎸夐挳鏍峰紡
+ :deep(.up-button--primary) {
+ border-radius: 8px;
+ }
+
+ :deep(.up-button--default) {
+ border-radius: 8px;
+ }
+
+ // 鍒嗛〉缁勪欢
+ .pagination {
+ padding: 20px;
+ background: #fff;
+ margin-top: 10px;
+ display: flex;
+ justify-content: center;
+ }
+</style>
diff --git a/src/pages/qualityManagement/materialInspection/add.vue b/src/pages/qualityManagement/materialInspection/add.vue
new file mode 100644
index 0000000..0309813
--- /dev/null
+++ b/src/pages/qualityManagement/materialInspection/add.vue
@@ -0,0 +1,1134 @@
+<template>
+ <view class="material-inspection-add">
+ <!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 -->
+ <PageHeader :title="isEdit ? '缂栬緫鍘熸潗鏂欐楠�' : '鏂板鍘熸潗鏂欐楠�'"
+ @back="goBack" />
+ <!-- 琛ㄥ崟鍐呭 -->
+ <up-form :model="form"
+ ref="formRef"
+ label-width="110"
+ :rules="rules">
+ <!-- 鍩烘湰淇℃伅 -->
+ <up-form-item label="渚涘簲鍟�"
+ prop="supplier"
+ required
+ border-bottom>
+ <up-input v-model="form.supplier"
+ placeholder="璇烽�夋嫨渚涘簲鍟�"
+ readonly
+ :disabled="supplierQuantityDisabled" />
+ <template #right>
+ <up-icon @click="showSupplierSheet = true"
+ name="arrow-right" />
+ </template>
+ </up-form-item>
+ <up-form-item label="浜у搧鍚嶇О"
+ prop="productId"
+ required
+ border-bottom>
+ <up-input v-model="form.productName"
+ placeholder="璇烽�夋嫨浜у搧"
+ readonly
+ @click="showProductTree = true"
+ :disabled="isEdit" />
+ <template #right>
+ <up-icon @click="showProductTree = true"
+ name="arrow-right" />
+ </template>
+ </up-form-item>
+ <up-form-item label="瑙勬牸鍨嬪彿"
+ prop="productModelId"
+ required
+ border-bottom>
+ <up-input v-model="form.model"
+ placeholder="璇烽�夋嫨瑙勬牸鍨嬪彿"
+ readonly
+ :disabled="isEdit" />
+ <template #right>
+ <up-icon @click="showModelSheet = true"
+ name="arrow-right" />
+ </template>
+ </up-form-item>
+ <up-form-item label="鎸囨爣閫夋嫨"
+ prop="testStandardId"
+ border-bottom>
+ <up-input v-model="testStandardDisplay"
+ placeholder="璇烽�夋嫨鎸囨爣"
+ readonly />
+ <template #right>
+ <up-icon @click="openTestStandardSheet"
+ name="arrow-right" />
+ </template>
+ </up-form-item>
+ <up-form-item label="鍗曚綅"
+ prop="unit"
+ border-bottom>
+ <up-input v-model="form.unit"
+ placeholder="璇疯緭鍏ュ崟浣�"
+ disabled />
+ </up-form-item>
+ <up-form-item label="鏁伴噺"
+ prop="quantity"
+ required
+ border-bottom>
+ <up-input v-model="form.quantity"
+ type="number"
+ placeholder="璇疯緭鍏ユ暟閲�"
+ :disabled="supplierQuantityDisabled" />
+ </up-form-item>
+ <up-form-item label="妫�娴嬪崟浣�"
+ prop="checkCompany"
+ border-bottom>
+ <up-input v-model="form.checkCompany"
+ placeholder="璇疯緭鍏ユ娴嬪崟浣�"
+ clearable />
+ </up-form-item>
+ <up-form-item label="妫�娴嬬粨鏋�"
+ prop="checkResult"
+ required
+ border-bottom>
+ <up-input v-model="form.checkResult"
+ placeholder="璇烽�夋嫨妫�娴嬬粨鏋�"
+ readonly
+ @click="showResultSheet" />
+ <template #right>
+ <up-icon @click="showResultSheet = true"
+ name="arrow-right" />
+ </template>
+ </up-form-item>
+ <up-form-item label="妫�楠屽憳"
+ prop="checkName"
+ border-bottom>
+ <up-input v-model="form.checkName"
+ placeholder="璇烽�夋嫨妫�楠屽憳"
+ readonly
+ @click="showInspectorSheet" />
+ <template #right>
+ <up-icon @click="showInspectorSheet = true"
+ name="arrow-right" />
+ </template>
+ </up-form-item>
+ <up-form-item label="妫�娴嬫棩鏈�"
+ prop="checkTime"
+ required
+ border-bottom>
+ <up-input v-model="form.checkTime"
+ placeholder="璇烽�夋嫨妫�娴嬫棩鏈�"
+ readonly />
+ <!-- <template #right>
+ <up-icon name="calendar"
+ @click="showDatePicker"></up-icon>
+ </template> -->
+ </up-form-item>
+ <!-- <up-form-item label="閲囪喘璁㈠崟鍙�"
+ prop="purchaseContractNo"
+ border-bottom>
+ <up-input v-model="form.purchaseContractNo"
+ placeholder="璇疯緭鍏ラ噰璐鍗曞彿"
+ clearable />
+ </up-form-item> -->
+ <!-- 妫�楠岄」鐩� -->
+ <view class="inspection-items-container">
+ <view class="steps-header">
+ <text class="steps-title">妫�楠岄」鐩�</text>
+ <text class="steps-count">鍏� {{ tableData.length }} 涓」鐩�</text>
+ </view>
+ <view class="steps-list">
+ <view v-for="(item, index) in tableData"
+ :key="index"
+ class="exec-step-item">
+ <view class="step-number">
+ {{ index + 1 }}
+ </view>
+ <view class="step-content">
+ <view class="step-row">
+ <text class="step-label">鎸囨爣锛�</text>
+ <text class="step-value">{{ item.parameterItem }}</text>
+ </view>
+ <view class="step-row">
+ <text class="step-label">鍗曚綅锛�</text>
+ <text class="step-value">{{ item.unit }}</text>
+ </view>
+ <view class="step-row">
+ <text class="step-label">鏍囧噯鍊硷細</text>
+ <text class="step-value">{{ item.standardValue }}</text>
+ </view>
+ <view class="step-row">
+ <text class="step-label">鍐呮帶鍊硷細</text>
+ <text class="step-value">{{ item.controlValue }}</text>
+ </view>
+ <view class="step-row">
+ <text class="step-label">妫�楠屽�硷細</text>
+ <up-input v-model="item.testValue"
+ placeholder="璇疯緭鍏ユ楠屽��"
+ clearable
+ border-bottom
+ class="step-input" />
+ </view>
+ </view>
+ </view>
+ <view v-if="tableData.length === 0"
+ class="empty-data">
+ <text>璇峰厛閫夋嫨鎸囨爣</text>
+ </view>
+ </view>
+ </view>
+ </up-form>
+ <!-- 搴曢儴鎸夐挳 -->
+ <view class="bottom-buttons">
+ <up-button type="default"
+ size="default"
+ @click="goBack"
+ class="bottom-btn">
+ 鍙栨秷
+ </up-button>
+ <up-button type="primary"
+ size="default"
+ @click="submitForm"
+ :loading="loading"
+ class="bottom-btn">
+ {{ isEdit ? '淇濆瓨' : '鎻愪氦' }}
+ </up-button>
+ </view>
+ <!-- 鏃ユ湡閫夋嫨鍣� -->
+ <up-popup v-model:show="showDate"
+ mode="date"
+ :start-year="2020"
+ :end-year="2030"
+ @confirm="confirmDate" />
+ <!-- 渚涘簲鍟嗛�夋嫨 -->
+ <up-action-sheet :show="showSupplierSheet"
+ :actions="supplierOptions"
+ @select="selectSupplier"
+ @close="showSupplierSheet = false"
+ title="閫夋嫨渚涘簲鍟�" />
+ <!-- 浜у搧閫夋嫨 -->
+ <up-action-sheet :show="showProductSheet"
+ :actions="productSheetOptions"
+ @select="selectProduct"
+ @close="showProductSheet = false"
+ title="閫夋嫨浜у搧" />
+ <!-- 瑙勬牸鍨嬪彿閫夋嫨 -->
+ <up-action-sheet :show="showModelSheet"
+ :actions="modelSheetOptions"
+ @select="selectModel"
+ @close="showModelSheet = false"
+ title="閫夋嫨瑙勬牸鍨嬪彿" />
+ <!-- 妫�娴嬬粨鏋滈�夋嫨 -->
+ <up-action-sheet :show="showResultSheet"
+ :actions="resultSheetOptions"
+ @select="selectResult"
+ @close="showResultSheet = false"
+ title="閫夋嫨妫�娴嬬粨鏋�" />
+ <!-- 妫�楠屽憳閫夋嫨 -->
+ <up-action-sheet :show="showInspectorSheet"
+ :actions="userSheetOptions"
+ @select="selectInspector"
+ @close="showInspectorSheet = false"
+ title="閫夋嫨妫�楠屽憳" />
+ <!-- 鎸囨爣閫夋嫨 -->
+ <up-action-sheet :show="showTestStandardSheet"
+ :actions="testStandardSheetOptions"
+ @select="selectTestStandard"
+ @close="showTestStandardSheet = false"
+ title="閫夋嫨鎸囨爣" />
+ <!-- 浜у搧鏍戝舰閫夋嫨鍣� -->
+ <up-popup v-model:show="showProductTree"
+ position="bottom"
+ :round="true"
+ :closeable="true"
+ @close="showProductTree = false">
+ <view class="tree-selector">
+ <view class="tree-header">
+ <text class="tree-title">閫夋嫨浜у搧</text>
+ </view>
+ <view class="tree-content">
+ <view class="tree-node"
+ v-for="(node, index) in productOptions"
+ :key="index">
+ <view v-if="node.children && node.children.length > 0"
+ class="tree-node-header"
+ @click="toggleNode(node)">
+ <up-icon :name="node.expanded ? 'arrow-down' : 'arrow-right'"
+ class="tree-node-icon" />
+ <text class="tree-node-label">{{ node.label }}</text>
+ </view>
+ <view v-else
+ class="tree-node-header"
+ @click="selectTreeNode(node)">
+ <text class="tree-node-icon-placeholder"></text>
+ <text class="tree-node-label">{{ node.label }}</text>
+ <up-icon name="checkmark"
+ v-if="form.productId == node.value"
+ class="tree-node-check" />
+ </view>
+ <view v-if="node.children && node.children.length > 0 && node.expanded"
+ class="tree-node-children">
+ <view class="tree-node"
+ v-for="(child, childIndex) in node.children"
+ :key="childIndex">
+ <view v-if="child.children && child.children.length > 0"
+ class="tree-node-header"
+ @click="toggleNode(child)">
+ <up-icon :name="child.expanded ? 'arrow-down' : 'arrow-right'"
+ class="tree-node-icon" />
+ <text class="tree-node-label">{{ child.label }}</text>
+ </view>
+ <view v-else
+ class="tree-node-header"
+ @click="selectTreeNode(child)">
+ <text class="tree-node-icon-placeholder"></text>
+ <text class="tree-node-label">{{ child.label }}</text>
+ <up-icon name="checkmark"
+ v-if="form.productId == child.value"
+ class="tree-node-check" />
+ </view>
+ <view v-if="child.children && child.children.length > 0 && child.expanded"
+ class="tree-node-children">
+ <view class="tree-node"
+ v-for="(grandchild, grandchildIndex) in child.children"
+ :key="grandchildIndex">
+ <view class="tree-node-header"
+ @click="selectTreeNode(grandchild)">
+ <text class="tree-node-icon-placeholder"></text>
+ <text class="tree-node-label">{{ grandchild.label }}</text>
+ <up-icon name="checkmark"
+ v-if="form.productId == grandchild.value"
+ class="tree-node-check" />
+ </view>
+ </view>
+ </view>
+ </view>
+ </view>
+ </view>
+ </view>
+ </view>
+ </up-popup>
+ </view>
+</template>
+
+<script setup>
+ import { ref, computed, onMounted, nextTick } from "vue";
+ import { onShow } from "@dcloudio/uni-app";
+ import PageHeader from "@/components/PageHeader.vue";
+ import dayjs from "dayjs";
+ import { getOptions } from "@/api/procurementManagement/procurementLedger.js";
+ import { modelList, productTreeList } from "@/api/basicData/product.js";
+ import {
+ qualityInspectAdd,
+ qualityInspectUpdate,
+ qualityInspectParamInfo,
+ qualityInspectDetailByProductId,
+ getQualityTestStandardParamByTestStandardId,
+ } from "@/api/qualityManagement/materialInspection.js";
+ import { userListNoPage } from "@/api/system/user.js";
+
+ // 鏄剧ず鎻愮ず淇℃伅
+ const showToast = message => {
+ uni.showToast({
+ title: message,
+ icon: "none",
+ });
+ };
+
+ // 琛ㄥ崟寮曠敤
+ const formRef = ref(null);
+ // 鍔犺浇鐘舵��
+ const loading = ref(false);
+ // 鏃ユ湡閫夋嫨鍣�
+ const showDate = ref(false);
+ // 渚涘簲鍟嗛�夋嫨
+ const showSupplierSheet = ref(false);
+ // 浜у搧閫夋嫨
+ const showProductSheet = ref(false);
+ // 浜у搧鏍戝舰閫夋嫨鍣�
+ const showProductTree = ref(false);
+ // 瑙勬牸鍨嬪彿閫夋嫨
+ const showModelSheet = ref(false);
+ // 妫�娴嬬粨鏋滈�夋嫨
+ const showResultSheet = ref(false);
+ // 妫�楠屽憳閫夋嫨
+ const showInspectorSheet = ref(false);
+ // 鎸囨爣閫夋嫨
+ const showTestStandardSheet = ref(false);
+
+ // 琛ㄥ崟鏁版嵁
+ const form = ref({
+ checkTime: dayjs().format("YYYY-MM-DD"),
+ supplier: "",
+ checkName: "",
+ productName: "",
+ productId: "",
+ productModelId: "",
+ model: "",
+ testStandardId: "",
+ unit: "",
+ quantity: "",
+ checkCompany: "",
+ checkResult: "",
+ productMainId: null,
+ purchaseLedgerId: null,
+ });
+
+ // 鏄剧ず鐢ㄧ殑鍙橀噺
+ const testStandardDisplay = ref("");
+
+ // 妫�楠岄」鐩�
+ const tableData = ref([]);
+ const tableLoading = ref(false);
+
+ // 渚涘簲鍟嗗垪琛�
+ const supplierList = ref([]);
+ // 浜у搧閫夐」
+ const productOptions = ref([]);
+ // 鍨嬪彿閫夐」
+ const modelOptions = ref([]);
+ // 妫�楠屽憳鍒楄〃
+ const userList = ref([]);
+ // 妫�娴嬬粨鏋滈�夐」
+ const resultOptions = ref([
+ { label: "鍚堟牸", value: "鍚堟牸" },
+ { label: "涓嶅悎鏍�", value: "涓嶅悎鏍�" },
+ ]);
+ // 鎸囨爣閫夐」
+ const testStandardOptions = ref([]);
+ // 褰撳墠浜у搧ID
+ const currentProductId = ref(0);
+
+ // ActionSheet閫夐」
+ const supplierOptions = computed(() => {
+ return supplierList.value.map(item => ({
+ name: item.supplierName,
+ value: item.supplierName,
+ }));
+ });
+
+ const productSheetOptions = computed(() => {
+ return productOptions.value.map(item => ({
+ name: item.label,
+ value: item.value,
+ }));
+ });
+
+ const modelSheetOptions = computed(() => {
+ return modelOptions.value.map(item => ({
+ name: item.model,
+ value: item.id,
+ }));
+ });
+
+ const resultSheetOptions = computed(() => {
+ return resultOptions.value.map(item => ({
+ name: item.label,
+ value: item.value,
+ }));
+ });
+
+ const userSheetOptions = computed(() => {
+ return userList.value.map(item => ({
+ name: item.nickName,
+ value: item.nickName,
+ }));
+ });
+
+ const testStandardSheetOptions = computed(() => {
+ return testStandardOptions.value.map(item => ({
+ name: item.standardName || item.standardNo,
+ value: item.id,
+ }));
+ });
+
+ // 琛ㄥ崟楠岃瘉瑙勫垯
+ const rules = {
+ checkTime: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ supplier: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ checkName: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+ productId: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ productModelId: [
+ { required: true, message: "璇烽�夋嫨浜у搧鍨嬪彿", trigger: "change" },
+ ],
+ testStandardId: [
+ { required: false, message: "璇烽�夋嫨鎸囨爣", trigger: "change" },
+ ],
+ unit: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+ quantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ checkCompany: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+ checkResult: [
+ { required: true, message: "璇烽�夋嫨妫�娴嬬粨鏋�", trigger: "change" },
+ ],
+ };
+
+ // 鏄惁涓虹紪杈戞ā寮�
+ const isEdit = computed(() => {
+ const id = getPageId();
+ return !!id;
+ });
+
+ // 缂栬緫鏃讹細productMainId 鎴� purchaseLedgerId 浠讳竴鏈夊�煎垯渚涘簲鍟嗐�佹暟閲忕疆鐏�
+ const supplierQuantityDisabled = computed(() => {
+ const v = form.value || {};
+ return !!(v.productMainId != null || v.purchaseLedgerId != null);
+ });
+
+ // 鑾峰彇椤甸潰ID
+ const getPageId = () => {
+ const pages = getCurrentPages();
+ const currentPage = pages[pages.length - 1];
+ return currentPage.options.id;
+ };
+
+ // 杩斿洖涓婁竴椤�
+ const goBack = () => {
+ uni.navigateBack();
+ };
+
+ // 鏄剧ず鏃ユ湡閫夋嫨鍣�
+ const showDatePicker = () => {
+ showDate.value = true;
+ };
+
+ // 纭鏃ユ湡閫夋嫨
+ const confirmDate = e => {
+ form.value.checkTime = dayjs(e.value).format("YYYY-MM-DD");
+ };
+
+ // 閫夋嫨渚涘簲鍟�
+ const selectSupplier = e => {
+ form.value.supplier = e.value;
+ showSupplierSheet.value = false;
+ };
+
+ // 閫夋嫨浜у搧
+ const selectProduct = e => {
+ form.value.productId = e.value;
+ form.value.productName = e.name;
+ showProductSheet.value = false;
+ getModels(e.value);
+ };
+
+ // 鍒囨崲鏍戝舰鑺傜偣灞曞紑/鎶樺彔
+ const toggleNode = node => {
+ node.expanded = !node.expanded;
+ };
+
+ // 閫夋嫨鏍戝舰鑺傜偣
+ const selectTreeNode = node => {
+ // 纭繚鍙�夋嫨鏈鑺傜偣
+ if (!node.children || node.children.length == 0) {
+ form.value.productId = node.value;
+ form.value.productName = node.label;
+ showProductTree.value = false;
+ getModels(node.value);
+ }
+ };
+
+ // 杞崲浜у搧鏍戠粨鏋�
+ function convertIdToValue(data) {
+ return data.map(item => {
+ const { id, children, ...rest } = item;
+ const newItem = {
+ ...rest,
+ value: id, // 灏� id 鏀逛负 value
+ };
+ if (children && children.length > 0) {
+ newItem.children = convertIdToValue(children);
+ }
+
+ return newItem;
+ });
+ }
+
+ // 鏍规嵁ID鏌ユ壘鑺傜偣
+ const findNodeById = (nodes, productId) => {
+ for (let i = 0; i < nodes.length; i++) {
+ if (nodes[i].value === productId) {
+ return nodes[i].label; // 鎵惧埌鑺傜偣锛岃繑鍥炶鑺傜偣
+ }
+ if (nodes[i].children && nodes[i].children.length > 0) {
+ const foundNode = findNodeById(nodes[i].children, productId);
+ if (foundNode) {
+ return foundNode; // 鍦ㄥ瓙鑺傜偣涓壘鍒帮紝杩斿洖璇ヨ妭鐐�
+ }
+ }
+ }
+ return null; // 娌℃湁鎵惧埌鑺傜偣锛岃繑鍥瀗ull
+ };
+
+ // 閫夋嫨瑙勬牸鍨嬪彿
+ const selectModel = e => {
+ form.value.productModelId = e.value;
+ showModelSheet.value = false;
+ handleChangeModel(e.value);
+ };
+
+ // 澶勭悊鍨嬪彿鍙樺寲
+ const handleChangeModel = value => {
+ form.value.model =
+ modelOptions.value.find(item => item.id == value)?.model || "";
+ form.value.unit =
+ modelOptions.value.find(item => item.id == value)?.unit || "";
+ };
+
+ // 閫夋嫨妫�娴嬬粨鏋�
+ const selectResult = e => {
+ form.value.checkResult = e.value;
+ showResultSheet.value = false;
+ };
+
+ // 閫夋嫨妫�楠屽憳
+ const selectInspector = e => {
+ form.value.checkName = e.value;
+ showInspectorSheet.value = false;
+ };
+
+ // 閫夋嫨鎸囨爣
+ const selectTestStandard = e => {
+ form.value.testStandardId = e.value;
+ testStandardDisplay.value = e.name;
+ showTestStandardSheet.value = false;
+ handleTestStandardChange(e.value);
+ };
+
+ // 鎸囨爣閫夋嫨鍙樺寲澶勭悊
+ const handleTestStandardChange = testStandardId => {
+ if (!testStandardId) {
+ tableData.value = [];
+ return;
+ }
+ tableLoading.value = true;
+ getQualityTestStandardParamByTestStandardId(testStandardId)
+ .then(res => {
+ tableData.value = res.data || [];
+ })
+ .catch(error => {
+ console.error("鑾峰彇鏍囧噯鍙傛暟澶辫触:", error);
+ tableData.value = [];
+ })
+ .finally(() => {
+ tableLoading.value = false;
+ });
+ };
+ const openTestStandardSheet = () => {
+ console.log("openTestStandardSheet");
+ showTestStandardSheet.value = true;
+ };
+
+ // 鑾峰彇渚涘簲鍟嗗垪琛�
+ const getSuppliers = () => {
+ getOptions().then(res => {
+ supplierList.value = res.data;
+ });
+ };
+
+ // 鑾峰彇浜у搧閫夐」
+ const getProductOptions = () => {
+ return productTreeList().then(res => {
+ productOptions.value = convertIdToValue(res);
+ return productOptions.value;
+ });
+ };
+
+ // 鑾峰彇鐢ㄦ埛鍒楄〃
+ const getUserList = async () => {
+ try {
+ const userRes = await userListNoPage();
+ userList.value = userRes.data || [];
+ } catch (e) {
+ console.error("鍔犺浇妫�楠屽憳鍒楄〃澶辫触", e);
+ userList.value = [];
+ }
+ };
+
+ // 鑾峰彇鍨嬪彿鍒楄〃
+ const getModels = value => {
+ form.value.productModelId = "";
+ form.value.unit = "";
+ modelOptions.value = [];
+ currentProductId.value = value;
+ form.value.productName = findNodeById(productOptions.value, value);
+ modelList({ id: value }).then(res => {
+ modelOptions.value = res;
+ });
+ if (currentProductId.value) {
+ getList();
+ }
+ };
+
+ // 鑾峰彇鎸囨爣鍒楄〃
+ const getList = () => {
+ if (!currentProductId.value) {
+ testStandardOptions.value = [];
+ tableData.value = [];
+ return;
+ }
+ let params = {
+ productId: currentProductId.value,
+ inspectType: 0,
+ };
+ qualityInspectDetailByProductId(params).then(res => {
+ // 淇濆瓨涓嬫媺妗嗛�夐」鏁版嵁
+ testStandardOptions.value = res.data || [];
+ // 娓呯┖琛ㄦ牸鏁版嵁锛岀瓑寰呯敤鎴烽�夋嫨鎸囨爣
+ tableData.value = [];
+ // 娓呯┖鎸囨爣閫夋嫨
+ form.value.testStandardId = "";
+ testStandardDisplay.value = "";
+ });
+ };
+
+ // 鑾峰彇妫�楠屽弬鏁板垪琛紙缂栬緫妯″紡锛�
+ const getQualityInspectParamList = id => {
+ qualityInspectParamInfo(id).then(res => {
+ tableData.value = res.data;
+ });
+ };
+
+ // 鎻愪氦琛ㄥ崟
+ const submitForm = async () => {
+ console.log("submitForm", form.value, tableData.value);
+ try {
+ // await formRef.value.validate();
+ if (!form.value.productModelId) {
+ showToast("璇烽�夋嫨瑙勬牸鍨嬪彿");
+ return;
+ }
+ if (!form.value.supplier) {
+ showToast("璇烽�夋嫨渚涘簲鍟�");
+ return;
+ }
+ if (!form.value.quantity) {
+ showToast("璇疯緭鍏ユ暟閲�");
+ return;
+ }
+ if (!form.value.productId) {
+ showToast("璇烽�夋嫨浜у搧");
+ return;
+ }
+ if (!form.value.checkResult) {
+ showToast("璇烽�夋嫨妫�娴嬬粨鏋�");
+ return;
+ }
+
+ loading.value = true;
+
+ form.value.inspectType = 0;
+ if (isEdit.value) {
+ tableData.value.forEach(item => {
+ delete item.id;
+ });
+ }
+
+ const data = { ...form.value, qualityInspectParams: tableData.value };
+ data.quantity = Number(data.quantity);
+ if (isEdit.value) {
+ const res = await qualityInspectUpdate(data);
+ showToast("淇濆瓨鎴愬姛");
+ setTimeout(() => {
+ uni.navigateBack();
+ }, 1500);
+ } else {
+ const res = await qualityInspectAdd(data);
+ showToast("鎻愪氦鎴愬姛");
+ setTimeout(() => {
+ uni.navigateBack();
+ }, 1500);
+ }
+ } catch (error) {
+ console.error("琛ㄥ崟楠岃瘉澶辫触:", error);
+ showToast("鎻愪氦澶辫触锛岃閲嶈瘯");
+ } finally {
+ loading.value = false;
+ }
+ };
+
+ // 鍒濆鍖栬〃鍗�
+ const initForm = async () => {
+ const id = getPageId();
+ if (id) {
+ // 缂栬緫妯″紡锛屽姞杞芥暟鎹�
+ // 鍏堥噸缃〃鍗曟暟鎹�
+ form.value = {
+ checkTime: dayjs().format("YYYY-MM-DD"),
+ supplier: "",
+ checkName: "",
+ productName: "",
+ productId: "",
+ productModelId: "",
+ model: "",
+ testStandardId: "",
+ unit: "",
+ quantity: "",
+ checkCompany: "",
+ checkResult: "",
+ productMainId: null,
+ purchaseLedgerId: null,
+ };
+ testStandardOptions.value = [];
+ tableData.value = [];
+ // 鍏堢‘淇濅骇鍝佹爲宸插姞杞斤紝鍚﹀垯缂栬緫鏃朵骇鍝�/瑙勬牸鍨嬪彿鏃犳硶鍙嶆樉
+ await getProductOptions();
+ // 浠庢湰鍦板瓨鍌ㄨ幏鍙栫紪杈戞暟鎹�
+ const row = uni.getStorageSync("inspectionEditData") || {
+ id: id,
+ checkTime: "2026-03-03",
+ supplier: "涓婃捣閲戝睘鏉愭枡鏈夐檺鍏徃",
+ checkName: "寮犱笁",
+ productName: "涓嶉攬閽㈡澘鏉�",
+ productId: 1,
+ productModelId: 1,
+ model: "304",
+ testStandardId: "1",
+ unit: "kg",
+ quantity: 1000,
+ checkCompany: "绗笁鏂规娴嬫満鏋�",
+ checkResult: "鍚堟牸",
+ productMainId: null,
+ purchaseLedgerId: null,
+ };
+ // 鍏堜繚瀛� testStandardId锛岄伩鍏嶈娓呯┖
+ const savedTestStandardId = row.testStandardId;
+ form.value = { ...row };
+ currentProductId.value = row.productId || 0;
+ // 鍏抽敭锛氱紪杈戞椂鍔犺浇瑙勬牸鍨嬪彿涓嬫媺閫夐」锛屾墠鑳藉弽鏄� productModelId
+ if (currentProductId.value) {
+ try {
+ const res = await modelList({ id: currentProductId.value });
+ modelOptions.value = res || [];
+ // 鍚屾鍥炲~ model / unit
+ if (form.value.productModelId) {
+ handleChangeModel(form.value.productModelId);
+ }
+ } catch (e) {
+ console.error("鍔犺浇瑙勬牸鍨嬪彿澶辫触", e);
+ modelOptions.value = [];
+ }
+ }
+ // 缂栬緫妯″紡涓嬶紝鍏堝姞杞芥寚鏍囬�夐」锛岀劧鍚庡姞杞藉弬鏁板垪琛�
+ if (currentProductId.value) {
+ // 鍏堝姞杞芥寚鏍囬�夐」
+ let params = {
+ productId: currentProductId.value,
+ inspectType: 0,
+ };
+ qualityInspectDetailByProductId(params).then(res => {
+ testStandardOptions.value = res.data || [];
+ // 浣跨敤 nextTick 纭繚閫夐」宸茬粡娓叉煋
+ nextTick(() => {
+ // 濡傛灉缂栬緫鏁版嵁涓湁 testStandardId锛屽垯璁剧疆骞跺姞杞藉搴旂殑鍙傛暟
+ if (savedTestStandardId) {
+ // 纭繚绫诲瀷鍖归厤
+ const matchedOption = testStandardOptions.value.find(
+ item =>
+ item.id == savedTestStandardId ||
+ String(item.id) === String(savedTestStandardId)
+ );
+ if (matchedOption) {
+ // 纭繚浣跨敤鍖归厤椤圭殑 id
+ form.value.testStandardId = matchedOption.id;
+ testStandardDisplay.value =
+ matchedOption.standardName || matchedOption.standardNo;
+ // 缂栬緫淇濈暀鍘熸楠屽�硷紝鐩存帴鎷夊彇鍘熷弬鏁版暟鎹�
+ getQualityInspectParamList(row.id);
+ } else {
+ // 濡傛灉鎵句笉鍒板尮閰嶉」锛屽皾璇曠洿鎺ヤ娇鐢ㄥ師鍊�
+ console.warn(
+ "鏈壘鍒板尮閰嶇殑鎸囨爣閫夐」锛宼estStandardId:",
+ savedTestStandardId
+ );
+ form.value.testStandardId = savedTestStandardId;
+ getQualityInspectParamList(row.id);
+ }
+ } else {
+ // 鍚﹀垯浣跨敤鏃х殑閫昏緫
+ getQualityInspectParamList(row.id);
+ }
+ });
+ });
+ }
+ // 灞曞紑浜у搧鏍戝埌褰撳墠閫変腑鐨勮妭鐐�
+ expandProductTree(productOptions.value, row.productId);
+ } else {
+ // 鏂板妯″紡锛屽垵濮嬪寲琛ㄥ崟
+ form.value = {
+ checkTime: dayjs().format("YYYY-MM-DD"),
+ supplier: "",
+ checkName: "",
+ productName: "",
+ productId: "",
+ productModelId: "",
+ model: "",
+ testStandardId: "",
+ unit: "",
+ quantity: "",
+ checkCompany: "",
+ checkResult: "",
+ productMainId: null,
+ purchaseLedgerId: null,
+ };
+ }
+ };
+
+ // 灞曞紑浜у搧鏍戝埌鎸囧畾鑺傜偣
+ const expandProductTree = (nodes, targetId) => {
+ for (let i = 0; i < nodes.length; i++) {
+ const node = nodes[i];
+ if (node.value === targetId) {
+ return true; // 鎵惧埌鐩爣鑺傜偣
+ }
+ if (node.children && node.children.length > 0) {
+ const found = expandProductTree(node.children, targetId);
+ if (found) {
+ node.expanded = true; // 灞曞紑鐖惰妭鐐�
+ return true;
+ }
+ }
+ }
+ return false;
+ };
+
+ onMounted(() => {
+ getSuppliers();
+ getProductOptions();
+ getUserList();
+ initForm();
+ });
+
+ onShow(() => {
+ initForm();
+ });
+</script>
+
+<style scoped lang="scss">
+ @import "@/static/scss/form-common.scss";
+
+ .material-inspection-add {
+ min-height: 100vh;
+ background: #f8f9fa;
+ padding-bottom: 100px;
+ }
+
+ // 妫�楠岄」鐩鍣�
+ .inspection-items-container {
+ padding: 20px;
+ background-color: #fff;
+ }
+
+ .steps-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 20px;
+ padding-bottom: 12px;
+ border-bottom: 1px solid #e4e7ed;
+ }
+
+ .steps-title {
+ font-size: 16px;
+ font-weight: 600;
+ color: #303133;
+ }
+
+ .steps-count {
+ font-size: 14px;
+ color: #909399;
+ }
+
+ .steps-list {
+ margin-bottom: 20px;
+ }
+
+ .exec-step-item {
+ position: relative;
+ display: flex;
+ margin-bottom: 16px;
+ padding: 16px;
+ background-color: #ffffff;
+ border: 1px solid #e4e7ed;
+ border-radius: 8px;
+ transition: all 0.3s ease;
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
+ }
+
+ .exec-step-item:hover {
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
+ border-color: #409eff;
+ transform: translateY(-1px);
+ }
+
+ .delete-btn {
+ position: absolute;
+ top: -25rpx;
+ right: -25rpx;
+ width: 50rpx;
+ height: 50rpx;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ text-align: center;
+ font-size: 20px;
+ border-radius: 50%;
+ background-color: red;
+ border: none;
+ z-index: 10;
+ }
+
+ .delete-btn:hover {
+ transform: scale(1.1);
+ box-shadow: 0 3px 6px rgba(245, 108, 108, 0.4);
+ }
+
+ .step-number {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 32px;
+ height: 32px;
+ margin-right: 16px;
+ background-color: #ecf5ff;
+ color: #409eff;
+ font-size: 14px;
+ font-weight: 600;
+ border-radius: 50%;
+ flex-shrink: 0;
+ }
+
+ .step-content {
+ flex: 1;
+ min-width: 0;
+ }
+
+ .step-row {
+ display: flex;
+ align-items: flex-start;
+ margin-bottom: 12px;
+ }
+
+ .step-row:last-child {
+ margin-bottom: 0;
+ }
+
+ .step-label {
+ display: inline-block;
+ width: 80px;
+ font-size: 14px;
+ color: #606266;
+ margin-right: 12px;
+ flex-shrink: 0;
+ line-height: 36px;
+ }
+
+ .step-input {
+ flex: 1;
+ min-width: 0;
+ }
+
+ .step-input input {
+ font-size: 14px;
+ color: #303133;
+ }
+
+ .add-step-btn {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 100%;
+ height: 44px;
+ line-height: 44px;
+ font-size: 14px;
+ border-radius: 8px;
+ transition: all 0.3s ease;
+ gap: 8px;
+ }
+
+ .add-step-btn:hover {
+ transform: translateY(-1px);
+ box-shadow: 0 2px 8px rgba(64, 158, 255, 0.3);
+ }
+
+ .add-step-btn text {
+ font-size: 14px;
+ }
+
+ // 搴曢儴鎸夐挳
+ .bottom-buttons {
+ position: fixed;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ display: flex;
+ padding: 16px 20px;
+ background: #ffffff;
+ border-top: 1px solid #f0f0f0;
+ gap: 16px;
+ }
+
+ .bottom-btn {
+ flex: 1;
+ }
+
+ // 鏍戝舰閫夋嫨鍣ㄦ牱寮�
+ .tree-selector {
+ width: 100%;
+ max-height: 70vh;
+ background: #ffffff;
+ border-radius: 16px 16px 0 0;
+ }
+
+ .tree-header {
+ padding: 16px 20px;
+ border-bottom: 1px solid #f0f0f0;
+ text-align: center;
+ }
+
+ .tree-title {
+ font-size: 16px;
+ font-weight: 600;
+ color: #303133;
+ }
+
+ .tree-content {
+ padding: 10px 0;
+ max-height: calc(70vh - 60px);
+ overflow-y: auto;
+ }
+
+ .tree-node {
+ padding: 0 20px;
+ }
+
+ .tree-node-header {
+ display: flex;
+ align-items: center;
+ padding: 12px 0;
+ cursor: pointer;
+ }
+
+ .tree-node-icon {
+ width: 20px;
+ height: 20px;
+ margin-right: 8px;
+ color: #909399;
+ }
+
+ .tree-node-icon-placeholder {
+ width: 20px;
+ height: 20px;
+ margin-right: 8px;
+ }
+
+ .tree-node-label {
+ flex: 1;
+ font-size: 14px;
+ color: #303133;
+ }
+
+ .tree-node-check {
+ width: 20px;
+ height: 20px;
+ color: #409eff;
+ }
+
+ .tree-node-children {
+ margin-left: 28px;
+ }
+</style>
diff --git a/src/pages/qualityManagement/materialInspection/detail.vue b/src/pages/qualityManagement/materialInspection/detail.vue
new file mode 100644
index 0000000..4064577
--- /dev/null
+++ b/src/pages/qualityManagement/materialInspection/detail.vue
@@ -0,0 +1,421 @@
+<template>
+ <view class="material-inspection-detail">
+ <!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 -->
+ <PageHeader title="鍘熸潗鏂欐楠岃鎯�"
+ @back="goBack" />
+ <!-- 璇︽儏鍐呭 -->
+ <view class="detail-section"
+ v-if="detailData">
+ <view class="detail-card">
+ <view class="card-header">
+ <view class="header-icon">
+ <up-icon name="file-text"
+ size="20"
+ color="#ffffff"></up-icon>
+ </view>
+ <text class="header-title">{{ detailData.productName || '-' }}</text>
+ <view class="status-tags">
+ <u-tag :type="getTagType(detailData.checkResult)"
+ size="small"
+ class="status-tag">
+ {{ detailData.checkResult || '-' }}
+ </u-tag>
+ <u-tag :type="getStateTagType(detailData.inspectState)"
+ size="small"
+ class="status-tag">
+ {{ detailData.inspectState ? '宸叉彁浜�' : '鏈彁浜�' }}
+ </u-tag>
+ </view>
+ </view>
+ <up-divider></up-divider>
+ <view class="detail-content">
+ <view class="detail-row">
+ <text class="detail-label">妫�娴嬫棩鏈�</text>
+ <text class="detail-value">{{ formatDateTime(detailData.checkTime) || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">閲囪喘璁㈠崟鍙�</text>
+ <text class="detail-value">{{ detailData.purchaseContractNo || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">渚涘簲鍟�</text>
+ <text class="detail-value">{{ detailData.supplier || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">妫�楠屽憳</text>
+ <text class="detail-value">{{ detailData.checkName || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">浜у搧鍚嶇О</text>
+ <text class="detail-value">{{ detailData.productName || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">瑙勬牸鍨嬪彿</text>
+ <text class="detail-value">{{ detailData.model || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">鍗曚綅</text>
+ <text class="detail-value">{{ detailData.unit || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">鏁伴噺</text>
+ <text class="detail-value">{{ detailData.quantity || 0 }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">妫�娴嬪崟浣�</text>
+ <text class="detail-value">{{ detailData.checkCompany || '-' }}</text>
+ </view>
+ <!-- <view class="detail-row">
+ <text class="detail-label">妫�楠屾爣鍑�</text>
+ <text class="detail-value">{{ detailData.testStandardName || '-' }}</text>
+ </view> -->
+ </view>
+ </view>
+ <!-- 妫�楠岄」鐩� -->
+ <view class="detail-card"
+ v-if="inspectionItems.length > 0">
+ <view class="card-header">
+ <view class="header-icon secondary">
+ <up-icon name="list"
+ size="20"
+ color="#ffffff"></up-icon>
+ </view>
+ <text class="header-title">妫�楠岄」鐩�</text>
+ </view>
+ <up-divider></up-divider>
+ <view class="inspection-items">
+ <view v-for="(item, index) in inspectionItems"
+ :key="index"
+ class="inspection-item">
+ <text class="item-name">{{ item.parameterItem || '妫�楠岄」鐩�' }}</text>
+ <view class="item-details">
+ <view class="item-detail-row">
+ <text class="item-detail-label">鍗曚綅:</text>
+ <text class="item-detail-value">{{ item.unit || '-' }}</text>
+ </view>
+ <view class="item-detail-row">
+ <text class="item-detail-label">鏍囧噯鍊�:</text>
+ <text class="item-detail-value">{{ item.standardValue || '-' }}</text>
+ </view>
+ <view class="item-detail-row">
+ <text class="item-detail-label">鍐呮帶鍊�:</text>
+ <text class="item-detail-value">{{ item.controlValue || '-' }}</text>
+ </view>
+ <view class="item-detail-row">
+ <text class="item-detail-label">妫�楠屽��:</text>
+ <text class="item-detail-value result"
+ :class="getResultClass(item.testValue, item.standardValue)">
+ {{ item.testValue || '-' }}
+ </text>
+ </view>
+ </view>
+ </view>
+ </view>
+ </view>
+ <!-- 鎿嶄綔鎸夐挳 -->
+ <!-- <view class="action-buttons">
+ <u-button type="primary"
+ class="action-btn"
+ @click="downloadReport">
+ 涓嬭浇鎶ュ憡
+ </u-button>
+ </view> -->
+ </view>
+ <view v-else
+ class="no-data">
+ <up-empty mode="data"
+ text="鏆傛棤妫�楠岃鎯�"></up-empty>
+ </view>
+ </view>
+</template>
+
+<script setup>
+ import { ref, onMounted } from "vue";
+ import { onShow } from "@dcloudio/uni-app";
+ import PageHeader from "@/components/PageHeader.vue";
+ import dayjs from "dayjs";
+ import { qualityInspectParamInfo } from "@/api/qualityManagement/materialInspection.js";
+
+ // 鏄剧ず鎻愮ず淇℃伅
+ const showToast = message => {
+ uni.showToast({
+ title: message,
+ icon: "none",
+ });
+ };
+
+ // 璇︽儏鏁版嵁
+ const detailData = ref(null);
+ // 妫�楠岄」鐩�
+ const inspectionItems = ref([]);
+
+ // 杩斿洖涓婁竴椤�
+ const goBack = () => {
+ uni.navigateBack();
+ };
+
+ // 鏍煎紡鍖栨棩鏈熸椂闂�
+ const formatDateTime = date => {
+ if (!date) return "";
+ return dayjs(date).format("YYYY-MM-DD");
+ };
+
+ // 鑾峰彇鏍囩绫诲瀷
+ const getTagType = result => {
+ switch (result) {
+ case "鍚堟牸":
+ return "success";
+ case "涓嶅悎鏍�":
+ return "error";
+ default:
+ return "info";
+ }
+ };
+
+ // 鑾峰彇鐘舵�佹爣绛剧被鍨�
+ const getStateTagType = state => {
+ return state ? "success" : "warning";
+ };
+
+ // 鑾峰彇缁撴灉鏍峰紡
+ const getResultClass = (testValue, standardValue) => {
+ // 绠�鍗曠殑缁撴灉鍒ゆ柇閫昏緫锛屽疄闄呴」鐩腑鍙兘闇�瑕佹洿澶嶆潅鐨勫垽鏂�
+ if (testValue === "鍚堟牸") {
+ return "result-passed";
+ } else if (testValue === "涓嶅悎鏍�") {
+ return "result-rejected";
+ }
+ return "";
+ };
+
+ // 涓嬭浇鎶ュ憡
+ const downloadReport = () => {
+ uni.showToast({
+ title: "鎶ュ憡涓嬭浇涓�...",
+ icon: "loading",
+ });
+
+ // 妯℃嫙涓嬭浇
+ setTimeout(() => {
+ uni.showToast({
+ title: "鎶ュ憡涓嬭浇鎴愬姛",
+ icon: "success",
+ });
+ }, 1500);
+ };
+
+ // 鑾峰彇椤甸潰ID
+ const getPageId = () => {
+ const pages = getCurrentPages();
+ const currentPage = pages[pages.length - 1];
+ return currentPage.options.id;
+ };
+
+ // 鑾峰彇璇︽儏鏁版嵁
+ const getDetail = () => {
+ const id = getPageId();
+ if (!id) {
+ showToast("鍙傛暟閿欒");
+ return;
+ }
+
+ // 浠庢湰鍦板瓨鍌ㄨ幏鍙栬鎯呮暟鎹�
+ try {
+ const detailDataFromStorage = uni.getStorageSync("inspectionEditData");
+ if (detailDataFromStorage) {
+ detailData.value = detailDataFromStorage;
+ // 浣跨敤qualityInspectParamInfo鑾峰彇妫�楠岄」鐩�
+ qualityInspectParamInfo(id)
+ .then(res => {
+ if (res.data && res.data.length > 0) {
+ inspectionItems.value = res.data;
+ } else if (
+ detailDataFromStorage.qualityInspectParams &&
+ detailDataFromStorage.qualityInspectParams.length > 0
+ ) {
+ // 濡傛灉鎺ュ彛娌℃湁杩斿洖鏁版嵁锛屼娇鐢ㄦ湰鍦板瓨鍌ㄤ腑鐨勬暟鎹�
+ inspectionItems.value = detailDataFromStorage.qualityInspectParams;
+ }
+ })
+ .catch(error => {
+ console.error("鑾峰彇妫�楠岄」鐩け璐�:", error);
+ // 鎺ュ彛璋冪敤澶辫触鏃讹紝浣跨敤鏈湴瀛樺偍涓殑鏁版嵁鎴栨ā鎷熸暟鎹�
+ if (
+ detailDataFromStorage.qualityInspectParams &&
+ detailDataFromStorage.qualityInspectParams.length > 0
+ ) {
+ inspectionItems.value = detailDataFromStorage.qualityInspectParams;
+ }
+ });
+ }
+ } catch (error) {
+ console.error("鍔犺浇璇︽儏鏁版嵁澶辫触:", error);
+ showToast("鍔犺浇璇︽儏鏁版嵁澶辫触锛岃閲嶈瘯");
+ }
+ };
+
+ onShow(() => {
+ getDetail();
+ });
+
+ onMounted(() => {
+ getDetail();
+ });
+</script>
+
+<style scoped lang="scss">
+ .material-inspection-detail {
+ min-height: 100vh;
+ background: #f5f5f5;
+ padding-bottom: 20px;
+ }
+
+ .detail-section {
+ padding: 15px;
+ }
+
+ .detail-card {
+ background: #fff;
+ border-radius: 12px;
+ padding: 16px;
+ margin-bottom: 12px;
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
+ }
+
+ .card-header {
+ display: flex;
+ align-items: center;
+ margin-bottom: 12px;
+ }
+
+ .header-icon {
+ width: 40px;
+ height: 40px;
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+ border-radius: 8px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ margin-right: 12px;
+ }
+
+ .header-icon.secondary {
+ background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
+ }
+
+ .header-icon.tertiary {
+ background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
+ }
+
+ .header-title {
+ flex: 1;
+ font-size: 16px;
+ font-weight: 600;
+ color: #333;
+ }
+
+ .status-tag {
+ margin-left: 20rpx;
+ }
+
+ .detail-content {
+ padding-top: 8px;
+ }
+
+ .detail-row {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 10px 0;
+ border-bottom: 1px solid #f0f0f0;
+ }
+
+ .detail-row:last-child {
+ border-bottom: none;
+ }
+
+ .detail-label {
+ font-size: 14px;
+ color: #666;
+ min-width: 100px;
+ }
+
+ .detail-value {
+ font-size: 14px;
+ color: #333;
+ text-align: right;
+ flex: 1;
+ }
+
+ // 妫�楠岄」鐩�
+ .inspection-items {
+ padding-top: 8px;
+ }
+
+ .inspection-item {
+ padding: 12px;
+ background: #f8f9fa;
+ border-radius: 8px;
+ margin-bottom: 10px;
+ }
+
+ .inspection-item:last-child {
+ margin-bottom: 0;
+ }
+
+ .item-name {
+ display: block;
+ font-size: 14px;
+ font-weight: 500;
+ color: #333;
+ margin-bottom: 8px;
+ padding-bottom: 8px;
+ border-bottom: 1px solid #f0f0f0;
+ }
+
+ .item-details {
+ padding-top: 8px;
+ }
+
+ .item-detail-row {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 6px;
+ }
+
+ .item-detail-row:last-child {
+ margin-bottom: 0;
+ }
+
+ .item-detail-label {
+ font-size: 12px;
+ color: #666;
+ min-width: 60px;
+ }
+
+ .item-detail-value {
+ font-size: 12px;
+ color: #333;
+ text-align: right;
+ flex: 1;
+ }
+
+ .item-detail-value.result {
+ font-weight: 500;
+ }
+
+ .result-passed {
+ color: #67c23a;
+ }
+
+ .result-rejected {
+ color: #f56c6c;
+ }
+
+ // 绌虹姸鎬�
+ .no-data {
+ padding: 60px 20px;
+ text-align: center;
+ }
+</style>
diff --git a/src/pages/qualityManagement/materialInspection/fileList.vue b/src/pages/qualityManagement/materialInspection/fileList.vue
new file mode 100644
index 0000000..126158d
--- /dev/null
+++ b/src/pages/qualityManagement/materialInspection/fileList.vue
@@ -0,0 +1,566 @@
+<template>
+ <view class="file-list-page">
+ <!-- 椤甸潰澶撮儴 -->
+ <PageHeader title="闄勪欢绠$悊"
+ @back="goBack" />
+ <!-- 闄勪欢鍒楄〃 -->
+ <view class="file-list-container">
+ <view v-if="fileList.length > 0"
+ class="file-list">
+ <view v-for="(file, index) in fileList"
+ :key="file.id || index"
+ class="file-item">
+ <!-- 鏂囦欢鍥炬爣 -->
+ <!-- <view class="file-icon"
+ :class="getFileIconClass(file.fileType)">
+ <up-icon :name="getFileIcon(file.fileType)"
+ size="24"
+ color="#ffffff" />
+ </view> -->
+ <!-- 鏂囦欢淇℃伅 -->
+ <view class="file-info">
+ <text class="file-name">{{ file.name }}</text>
+ <!-- <text class="file-meta">{{ formatFileSize(file.fileSize) }} 路 {{ file.uploadTime || file.createTime }}</text> -->
+ </view>
+ <!-- 鎿嶄綔鎸夐挳 -->
+ <view class="file-actions">
+ <!-- <u-button size="small"
+ type="primary"
+ plain
+ @click="previewFile(file)">棰勮</u-button> -->
+ <u-button size="small"
+ type="info"
+ plain
+ @click="downloadFile(file)">涓嬭浇骞堕瑙�</u-button>
+ <u-button size="small"
+ type="error"
+ plain
+ @click="confirmDelete(file, index)">鍒犻櫎</u-button>
+ </view>
+ </view>
+ </view>
+ <!-- 绌虹姸鎬� -->
+ <view v-else
+ class="empty-state">
+ <up-icon name="document"
+ size="64"
+ color="#c0c4cc" />
+ <text class="empty-text">鏆傛棤闄勪欢</text>
+ </view>
+ </view>
+ <!-- <a rel="nofollow"
+ id="downloadLink"
+ href="#"
+ style="display:none;">涓嬭浇鏂囨湰鏂囦欢</a> -->
+ <!-- 涓婁紶鎸夐挳 -->
+ <view class="upload-button"
+ @click="chooseFile">
+ <up-icon name="plus"
+ size="24"
+ color="#ffffff" />
+ <text class="upload-text">涓婁紶闄勪欢</text>
+ </view>
+ </view>
+</template>
+
+<script setup>
+ import { ref, onMounted } from "vue";
+ import PageHeader from "@/components/PageHeader.vue";
+ import config from "@/config";
+ import { getToken } from "@/utils/auth";
+ // import { saveAs } from "file-saver";
+ import {
+ listRuleFiles,
+ delRuleFile,
+ } from "@/api/managementMeetings/rulesRegulationsManagement";
+ import {
+ qualityInspectFileAdd,
+ qualityInspectFileListPage,
+ qualityInspectFileDel,
+ } from "@/api/qualityManagement/materialInspection";
+ import { blobValidate } from "@/utils/ruoyi";
+
+ // 闄勪欢鍒楄〃
+ const fileList = ref([]);
+
+ // 杩斿洖涓婁竴椤�
+ const goBack = () => {
+ uni.navigateBack();
+ };
+ // const request = axios.create({
+ // baseURL: "URL.com",
+ // adapter: axiosAdapterUniapp,
+ // });
+ // 鑾峰彇鏂囦欢鍥炬爣
+ const getFileIcon = fileType => {
+ const iconMap = {
+ doc: "document",
+ docx: "document",
+ xls: "grid",
+ xlsx: "grid",
+ pdf: "document",
+ ppt: "copy",
+ pptx: "copy",
+ txt: "document",
+ jpg: "image",
+ jpeg: "image",
+ png: "image",
+ gif: "image",
+ zip: "folder",
+ rar: "folder",
+ };
+ return iconMap[fileType.toLowerCase()] || "document";
+ };
+
+ // 鑾峰彇鏂囦欢鍥炬爣鏍峰紡绫�
+ const getFileIconClass = fileType => {
+ const colorMap = {
+ doc: "blue",
+ docx: "blue",
+ xls: "green",
+ xlsx: "green",
+ pdf: "red",
+ ppt: "orange",
+ pptx: "orange",
+ txt: "gray",
+ jpg: "purple",
+ jpeg: "purple",
+ png: "purple",
+ gif: "purple",
+ zip: "yellow",
+ rar: "yellow",
+ };
+ return colorMap[fileType.toLowerCase()] || "gray";
+ };
+
+ // 鏍煎紡鍖栨枃浠跺ぇ灏�
+ const formatFileSize = bytes => {
+ if (bytes === 0) return "0 B";
+ const k = 1024;
+ const sizes = ["B", "KB", "MB", "GB"];
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
+ };
+
+ // 閫夋嫨鏂囦欢
+ const chooseFile = () => {
+ uni.chooseImage({
+ count: 9,
+ sizeType: ["original", "compressed"],
+ sourceType: ["album", "camera"],
+ success: res => {
+ console.log(res, "閫夋嫨鍥剧墖鎴愬姛");
+ uploadFiles(res.tempFiles);
+ },
+ fail: err => {
+ console.error("閫夋嫨鍥剧墖澶辫触:", err);
+ showToast("閫夋嫨鏂囦欢澶辫触");
+ },
+ });
+ // uni.chooseFile({
+ // count: 9,
+ // extension: [
+ // ".doc",
+ // ".docx",
+ // ".xls",
+ // ".xlsx",
+ // ".pdf",
+ // ".ppt",
+ // ".pptx",
+ // ".txt",
+ // ".jpg",
+ // ".jpeg",
+ // ".png",
+ // ".gif",
+ // ".zip",
+ // ".rar",
+ // ],
+ // success: res => {
+ // console.log(res, "閫夋嫨鏂囦欢鎴愬姛");
+ // uploadFiles(res.tempFiles);
+ // },
+ // fail: err => {
+ // showToast("閫夋嫨鏂囦欢澶辫触");
+ // },
+ // });
+ };
+
+ // 涓婁紶鏂囦欢
+ const uploadFiles = tempFiles => {
+ console.log(tempFiles, "涓婁紶鏂囦欢1");
+ tempFiles.forEach((tempFile, index) => {
+ // 鏄剧ず涓婁紶涓彁绀�
+ uni.showLoading({
+ title: "涓婁紶涓�...",
+ mask: true,
+ });
+ console.log(tempFile, "涓婁紶鏂囦欢2");
+ // 1. 鐩存帴浣跨敤 uni.uploadFile 涓婁紶鏂囦欢
+ uni.uploadFile({
+ url: config.baseUrl + "/file/upload",
+ filePath: tempFile.path,
+ name: "file",
+ header: {
+ Authorization: "Bearer " + getToken(),
+ },
+ success: uploadRes => {
+ uni.hideLoading();
+ console.log(uploadRes, "涓婁紶鏂囦欢3");
+
+ try {
+ const res = JSON.parse(uploadRes.data);
+ console.log(res, "涓婁紶鏂囦欢4");
+ if (res.code === 200) {
+ // 2. 鎻愬彇鏂囦欢淇℃伅
+ const fileName = tempFile.name
+ ? tempFile.name
+ : tempFile.path.split("/").pop();
+ // const fileType = fileName.split(".").pop();
+ // 3. 鏋勯�犱繚瀛樻枃浠朵俊鎭殑鍙傛暟
+ const saveData = {
+ name: fileName,
+ inspectId: rulesRegulationsManagementId.value,
+ url: res.data.tempPath || "",
+ };
+ console.log(saveData, "淇濆瓨鏂囦欢淇℃伅鍙傛暟");
+ // 4. 璋冪敤 addRuleFile 鎺ュ彛淇濆瓨鏂囦欢淇℃伅
+ qualityInspectFileAdd(saveData)
+ .then(addRes => {
+ if (addRes.code === 200) {
+ // 5. 娣诲姞鍒版枃浠跺垪琛�
+ const newFile = {
+ ...addRes.data,
+ uploadTime: new Date().toLocaleString(),
+ };
+ // fileList.value.push(newFile);
+ getFileList();
+ showToast("涓婁紶鎴愬姛");
+ } else {
+ showToast("淇濆瓨鏂囦欢淇℃伅澶辫触");
+ }
+ })
+ .catch(err => {
+ console.error("淇濆瓨鏂囦欢淇℃伅澶辫触:", err);
+ showToast("淇濆瓨鏂囦欢淇℃伅澶辫触");
+ });
+ } else {
+ showToast("鏂囦欢涓婁紶澶辫触");
+ }
+ } catch (e) {
+ console.error("瑙f瀽涓婁紶缁撴灉澶辫触:", e);
+ showToast("涓婁紶澶辫触");
+ }
+ },
+ fail: err => {
+ uni.hideLoading();
+ console.error("涓婁紶澶辫触:", err);
+ showToast("涓婁紶澶辫触");
+ },
+ });
+ });
+ };
+ // 涓嬭浇鏂囦欢
+ const downloadFile = file => {
+ var url =
+ config.baseUrl +
+ "/common/download?fileName=" +
+ encodeURIComponent(file.url) +
+ "&delete=true";
+ console.log(url, "url");
+
+ uni
+ .downloadFile({
+ url: url,
+ responseType: "blob",
+ header: { Authorization: "Bearer " + getToken() },
+ })
+ .then(res => {
+ let osType = uni.getStorageSync("deviceInfo").osName;
+ let filePath = res.tempFilePath;
+ if (osType === "ios") {
+ uni.openDocument({
+ filePath: filePath,
+ showMenu: true,
+ success: res => {
+ resolve(res);
+ },
+ fail: err => {
+ console.log("uni.openDocument--fail");
+ reject(err);
+ },
+ });
+ } else {
+ uni.saveFile({
+ tempFilePath: filePath,
+ success: fileRes => {
+ uni.showToast({
+ icon: "none",
+ mask: true,
+ title:
+ "鏂囦欢宸蹭繚瀛橈細Android/data/uni.UNI720216F/apps/__UNI__720216F/" +
+ fileRes.savedFilePath, //淇濆瓨璺緞
+ duration: 3000,
+ });
+ setTimeout(() => {
+ //鎵撳紑鏂囨。鏌ョ湅
+ uni.openDocument({
+ filePath: fileRes.savedFilePath,
+ success: function (res) {
+ resolve(fileRes);
+ },
+ });
+ }, 3000);
+ },
+ fail: err => {
+ console.log("uni.save--fail");
+ reject(err);
+ },
+ });
+ }
+ // const isBlob = blobValidate(res.data);
+ // if (isBlob) {
+ // const blob = new Blob([res.data], { type: "text/plain" });
+ // const url = URL.createObjectURL(blob);
+ // const downloadLink = document.getElementById("downloadLink");
+ // downloadLink.href = url;
+ // downloadLink.download = file.name;
+ // downloadLink.click();
+ // showToast("涓嬭浇鎴愬姛");
+ // } else {
+ // showToast("涓嬭浇澶辫触");
+ // }
+ })
+ .catch(err => {
+ console.error("涓嬭浇澶辫触:", err);
+ showToast("涓嬭浇澶辫触");
+ });
+ };
+
+ // 纭鍒犻櫎
+ const confirmDelete = (file, index) => {
+ uni.showModal({
+ title: "鍒犻櫎纭",
+ content: `纭畾瑕佸垹闄ら檮浠� "${file.name}" 鍚楋紵`,
+ success: res => {
+ if (res.confirm) {
+ deleteFile(file.id, index);
+ }
+ },
+ });
+ };
+
+ // 鍒犻櫎鏂囦欢
+ const deleteFile = (fileId, index) => {
+ uni.showLoading({
+ title: "鍒犻櫎涓�...",
+ mask: true,
+ });
+
+ qualityInspectFileDel([fileId])
+ .then(res => {
+ uni.hideLoading();
+ if (res.code === 200) {
+ // fileList.value.splice(index, 1);
+ getFileList();
+ showToast("鍒犻櫎鎴愬姛");
+ } else {
+ showToast("鍒犻櫎澶辫触");
+ }
+ })
+ .catch(err => {
+ uni.hideLoading();
+ showToast("鍒犻櫎澶辫触");
+ });
+ };
+
+ // 鏄剧ず鎻愮ず
+ const showToast = message => {
+ uni.showToast({
+ title: message,
+ icon: "none",
+ });
+ };
+ const rulesRegulationsManagementId = ref("");
+ // 椤甸潰鍔犺浇鏃�
+ onMounted(() => {
+ rulesRegulationsManagementId.value = uni.getStorageSync(
+ "qualityInspectFileId"
+ );
+ // 浠� API 鑾峰彇闄勪欢鍒楄〃
+ getFileList();
+ // 浠庢湰鍦板瓨鍌ㄨ幏鍙� rulesRegulationsManagementId
+ });
+
+ // 鑾峰彇闄勪欢鍒楄〃
+ const getFileList = () => {
+ uni.showLoading({
+ title: "鍔犺浇涓�...",
+ mask: true,
+ });
+
+ qualityInspectFileListPage({
+ inspectId: rulesRegulationsManagementId.value,
+ current: -1,
+ size: -1,
+ })
+ .then(res => {
+ uni.hideLoading();
+ if (res.code === 200) {
+ fileList.value = res.data.records || [];
+ } else {
+ showToast("鑾峰彇闄勪欢鍒楄〃澶辫触");
+ }
+ })
+ .catch(err => {
+ uni.hideLoading();
+ showToast("鑾峰彇闄勪欢鍒楄〃澶辫触");
+ });
+ };
+</script>
+
+<style scoped lang="scss">
+ @import "../../../styles/sales-common.scss";
+
+ .file-list-page {
+ min-height: 100vh;
+ background: #f8f9fa;
+ padding-bottom: 100rpx;
+ }
+
+ .file-list-container {
+ padding: 20rpx;
+ }
+
+ .file-list {
+ background: #ffffff;
+ border-radius: 8rpx;
+ overflow: hidden;
+ box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
+ }
+
+ .file-item {
+ display: flex;
+ align-items: center;
+ padding: 20rpx;
+ border-bottom: 1rpx solid #f0f0f0;
+
+ &:last-child {
+ border-bottom: none;
+ }
+ }
+
+ .file-icon {
+ width: 56rpx;
+ height: 56rpx;
+ border-radius: 8rpx;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ margin-right: 20rpx;
+
+ &.blue {
+ background: #409eff;
+ }
+
+ &.green {
+ background: #67c23a;
+ }
+
+ &.red {
+ background: #f56c6c;
+ }
+
+ &.orange {
+ background: #e6a23c;
+ }
+
+ &.gray {
+ background: #909399;
+ }
+
+ &.purple {
+ background: #909399;
+ }
+
+ &.yellow {
+ background: #e6a23c;
+ }
+ }
+
+ .file-info {
+ flex: 1;
+ min-width: 0;
+ }
+
+ .file-name {
+ display: block;
+ font-size: 16px;
+ color: #303133;
+ margin-bottom: 8rpx;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+
+ .file-meta {
+ display: block;
+ font-size: 12px;
+ color: #909399;
+ }
+
+ .file-actions {
+ display: flex;
+ gap: 12rpx;
+ }
+
+ .empty-state {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ padding: 100rpx 0;
+ background: #ffffff;
+ border-radius: 8rpx;
+ box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
+ }
+
+ .empty-text {
+ font-size: 14px;
+ color: #909399;
+ margin-top: 20rpx;
+ }
+
+ .upload-button {
+ position: fixed;
+ bottom: 40rpx;
+ right: 40rpx;
+ width: 130rpx;
+ height: 130rpx;
+ border-radius: 50%;
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ box-shadow: 0 4rpx 16rpx rgba(102, 126, 234, 0.4);
+ z-index: 1000;
+ }
+
+ .upload-text {
+ font-size: 10px;
+ color: #ffffff;
+ margin-top: 4rpx;
+ }
+
+ .upload-progress {
+ padding: 40rpx 0;
+ }
+
+ .upload-progress-text {
+ display: block;
+ text-align: center;
+ margin-top: 20rpx;
+ font-size: 14px;
+ color: #606266;
+ }
+</style>
\ No newline at end of file
diff --git a/src/pages/qualityManagement/materialInspection/index.vue b/src/pages/qualityManagement/materialInspection/index.vue
new file mode 100644
index 0000000..0e95df7
--- /dev/null
+++ b/src/pages/qualityManagement/materialInspection/index.vue
@@ -0,0 +1,775 @@
+<template>
+ <view class="material-inspection-page">
+ <!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 -->
+ <PageHeader title="鍘熸潗鏂欐楠�"
+ @back="goBack" />
+ <!-- 鎼滅储鍖哄煙 -->
+ <view class="search-section">
+ <up-search
+ placeholder="璇疯緭鍏ヤ緵搴斿晢鎼滅储"
+ v-model="searchForm.supplier"
+ @search="getList"
+ @custom="getList"
+ @clear="getList"
+ :show-action="true"
+ action-text="鎼滅储"
+ :animation="true"
+ ></up-search>
+ </view>
+ <!-- 缁熻淇℃伅鍗$墖 -->
+ <!-- <view class="stats-cards">
+ <view class="stat-card">
+ <text class="stat-number">{{ totalCount }}</text>
+ <text class="stat-label">鎬绘楠�</text>
+ </view>
+ <view class="stat-card">
+ <text class="stat-number">{{ submittedCount }}</text>
+ <text class="stat-label">宸叉彁浜�</text>
+ </view>
+ <view class="stat-card">
+ <text class="stat-number">{{ pendingCount }}</text>
+ <text class="stat-label">寰呮彁浜�</text>
+ </view>
+ <view class="stat-card">
+ <text class="stat-number">{{ qualifiedCount }}</text>
+ <text class="stat-label">宸插悎鏍�</text>
+ </view>
+ </view> -->
+ <!-- 妫�楠屽垪琛� -->
+ <view class="inspection-list"
+ v-if="inspectionList.length > 0">
+ <view v-for="(item, index) in inspectionList"
+ :key="index">
+ <view class="inspection-item"
+ @click="viewDetail(item)">
+ <view class="item-header">
+ <view class="item-left">
+ <!-- <view class="material-icon"
+ :class="getStateClass(item.inspectState)">
+ <up-icon :name="getStateIcon(item.inspectState)"
+ size="16"
+ color="#ffffff"></up-icon>
+ </view> -->
+ <view class="material-info">
+ <text class="material-name">{{ item.productName }}</text>
+ <text class="material-code">{{ item.model }}</text>
+ </view>
+ </view>
+ <view class="status-tags">
+ <u-tag :type="getTagType(item.checkResult)"
+ size="mini"
+ class="status-tag">
+ {{ item.checkResult }}
+ </u-tag>
+ <u-tag :type="getStateTagType(item.inspectState)"
+ size="mini"
+ class="status-tag">
+ {{ item.inspectState ? '宸叉彁浜�' : '鏈彁浜�' }}
+ </u-tag>
+ </view>
+ </view>
+ <up-divider></up-divider>
+ <view class="item-details">
+ <view class="detail-row">
+ <text class="detail-label">妫�娴嬫棩鏈�</text>
+ <text class="detail-value">{{ formatDateTime(item.checkTime) || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">閲囪喘璁㈠崟鍙�</text>
+ <text class="detail-value">{{ item.purchaseContractNo || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">渚涘簲鍟�</text>
+ <text class="detail-value">{{ item.supplier || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">妫�楠屽憳</text>
+ <text class="detail-value">{{ item.checkName || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">鏁伴噺</text>
+ <text class="detail-value">{{ item.quantity || 0 }} {{ item.unit || '' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">妫�娴嬪崟浣�</text>
+ <text class="detail-value">{{ item.checkCompany || '-' }}</text>
+ </view>
+ </view>
+ <!-- 鎿嶄綔鎸夐挳 -->
+ <view class="action-buttons">
+ <!-- <u-button type="primary"
+ size="small"
+ class="action-btn"
+ :disabled="item.inspectState"
+ @click.stop="startInspection(item)">
+ 缂栬緫
+ </u-button> -->
+ <u-button type="info"
+ size="small"
+ class="action-btn"
+ @click.stop="viewDetail(item)">
+ 璇︽儏
+ </u-button>
+ <!-- <u-button type="success"
+ size="small"
+ class="action-btn"
+ :disabled="item.inspectState"
+ @click.stop="submitInspection(item)">
+ 鎻愪氦
+ </u-button> -->
+ </view>
+ <view class="action-buttons">
+ <!-- <u-button type="info"
+ size="small"
+ class="action-btn"
+ @click.stop="viewFileList(item)">
+ 闄勪欢
+ </u-button>
+ <u-button type="warning"
+ size="small"
+ class="action-btn"
+ :disabled="item.inspectState || item.checkName !== ''"
+ @click.stop="assignInspector(item)">
+ 鍒嗛厤妫�楠屽憳
+ </u-button> -->
+ </view>
+ </view>
+ </view>
+ </view>
+ <view v-else
+ class="no-data">
+ <up-empty mode="data"
+ text="鏆傛棤妫�楠屼换鍔�"></up-empty>
+ </view>
+ <!-- 鍒嗛〉缁勪欢 -->
+ <!-- 娴姩鏂板鎸夐挳 -->
+ <!-- <view class="fab-button"
+ @click="addInspection">
+ <up-icon name="plus"
+ size="24"
+ color="#ffffff"></up-icon>
+ </view> -->
+ <!-- 鏃ユ湡閫夋嫨鍣� -->
+ <up-popup v-model:show="showDate"
+ mode="date"
+ :start-year="2020"
+ :end-year="2030"
+ :range="true"
+ @confirm="confirmDate" />
+ <!-- 鍒嗛厤妫�楠屽憳寮圭獥 -->
+ <up-popup v-model:show="showAssignDialog"
+ mode="center"
+ round
+ style="width: 80%">
+ <view class="assign-dialog">
+ <view class="dialog-header">
+ <text class="dialog-title">鍒嗛厤妫�楠屽憳</text>
+ <up-icon name="close"
+ size="20"
+ color="#999"
+ @click="showAssignDialog = false"></up-icon>
+ </view>
+ <view class="dialog-content">
+ <up-form-item label="妫�楠屽憳"
+ prop="checkName"
+ :label-width="60"
+ required>
+ <up-input v-model="assignForm.checkName"
+ placeholder="璇烽�夋嫨妫�楠屽憳"
+ readonly />
+ <template #right>
+ <up-icon @click="showInspectorSheet = true"
+ name="arrow-right" />
+ </template>
+ </up-form-item>
+ </view>
+ <view class="dialog-footer">
+ <u-button type="default"
+ class="footer-btn"
+ @click="showAssignDialog = false">
+ 鍙栨秷
+ </u-button>
+ <u-button type="primary"
+ class="footer-btn"
+ @click="submitAssign">
+ 纭畾
+ </u-button>
+ </view>
+ </view>
+ </up-popup>
+ <!-- 妫�楠屽憳閫夋嫨 -->
+ <up-action-sheet :show="showInspectorSheet"
+ :actions="userSheetOptions"
+ @select="selectInspector"
+ title="閫夋嫨妫�楠屽憳" />
+ </view>
+</template>
+
+<script setup>
+ import { ref, computed, onMounted } from "vue";
+ import { onShow } from "@dcloudio/uni-app";
+ import PageHeader from "@/components/PageHeader.vue";
+ import dayjs from "dayjs";
+ import {
+ submitQualityInspect,
+ qualityInspectUpdate,
+ qualityInspectListPage,
+ } from "@/api/qualityManagement/materialInspection.js";
+ import { userListNoPage } from "@/api/system/user.js";
+
+ // 鏄剧ず鎻愮ず淇℃伅
+ const showToast = message => {
+ uni.showToast({
+ title: message,
+ icon: "none",
+ });
+ };
+
+ // 鎼滅储琛ㄥ崟
+ const searchForm = ref({
+ supplier: "",
+ entryDate: undefined,
+ entryDateStart: undefined,
+ entryDateEnd: undefined,
+ });
+
+ // 鏃ユ湡閫夋嫨鍣�
+ const showDate = ref(false);
+
+ // 鍒嗛厤妫�楠屽憳寮圭獥
+ const showAssignDialog = ref(false);
+ const showInspectorSheet = ref(false);
+ const assignForm = ref({
+ checkName: "",
+ });
+ const currentAssignRow = ref(null);
+
+ // 妫�楠屽垪琛ㄦ暟鎹�
+ const inspectionList = ref([]);
+
+ // 鍒嗛〉鏁版嵁
+ const page = ref({
+ current: -1,
+ size: -1,
+ total: 0,
+ });
+
+ // 鍔犺浇鐘舵��
+ const tableLoading = ref(false);
+
+ // 缁熻鏁版嵁
+ const totalCount = ref(0);
+ const submittedCount = ref(0);
+ const pendingCount = ref(0);
+ const qualifiedCount = ref(0);
+
+ // 妫�楠屽憳鍒楄〃
+ const userList = ref([]);
+
+ // ActionSheet閫夐」
+ const userSheetOptions = computed(() => {
+ return userList.value.map(item => ({
+ name: item.nickName,
+ value: item.nickName,
+ }));
+ });
+
+ // 杩斿洖涓婁竴椤�
+ const goBack = () => {
+ uni.navigateBack();
+ };
+
+ // 鏍煎紡鍖栨棩鏈熸椂闂�
+ const formatDateTime = dateStr => {
+ if (!dateStr) return "";
+ return dayjs(dateStr).format("YYYY-MM-DD");
+ };
+
+ // 鑾峰彇鐘舵�佹牱寮�
+ const getStateClass = inspectState => {
+ return inspectState ? "state-submitted" : "state-pending";
+ };
+
+ // 鑾峰彇鐘舵�佸浘鏍�
+ const getStateIcon = inspectState => {
+ return inspectState ? "checkmark-circle" : "time";
+ };
+
+ // 鑾峰彇鏍囩绫诲瀷
+ const getTagType = checkResult => {
+ if (checkResult === "鍚堟牸") return "success";
+ if (checkResult === "涓嶅悎鏍�") return "error";
+ return "default";
+ };
+
+ // 鑾峰彇鐘舵�佹爣绛剧被鍨�
+ const getStateTagType = inspectState => {
+ return inspectState ? "success" : "warning";
+ };
+
+ // 鏄剧ず鏃ユ湡閫夋嫨鍣�
+ const showDatePicker = () => {
+ showDate.value = true;
+ };
+
+ // 纭鏃ユ湡閫夋嫨
+ const confirmDate = e => {
+ searchForm.value.entryDate = e.value;
+ searchForm.value.entryDateStart = dayjs(e.value[0]).format("YYYY-MM-DD");
+ searchForm.value.entryDateEnd = dayjs(e.value[1]).format("YYYY-MM-DD");
+ getList();
+ };
+ const viewFileList = item => {
+ uni.setStorageSync("qualityInspectFileId", item.id);
+ uni.navigateTo({
+ url: "/pages/qualityManagement/materialInspection/fileList",
+ });
+ };
+
+ // 娓呴櫎鏃ユ湡鑼冨洿
+ const clearDateRange = () => {
+ searchForm.value.entryDate = undefined;
+ searchForm.value.entryDateStart = undefined;
+ searchForm.value.entryDateEnd = undefined;
+ getList();
+ };
+
+ // 鑾峰彇鐢ㄦ埛鍒楄〃
+ const getUserList = async () => {
+ try {
+ const userRes = await userListNoPage();
+ userList.value = userRes.data || [];
+ } catch (e) {
+ console.error("鍔犺浇妫�楠屽憳鍒楄〃澶辫触", e);
+ userList.value = [];
+ }
+ };
+
+ // 鏌ヨ鍒楄〃
+ const getList = () => {
+ tableLoading.value = true;
+ const params = { ...searchForm.value, ...page.value };
+ params.entryDate = undefined;
+ qualityInspectListPage({ ...params, inspectType: 0 })
+ .then(res => {
+ tableLoading.value = false;
+ inspectionList.value = res.data.records || [];
+ page.value.total = res.data.total || 0;
+ totalCount.value = res.data.total || 0;
+ submittedCount.value = inspectionList.value.filter(
+ item => item.inspectState
+ ).length;
+ pendingCount.value = inspectionList.value.filter(
+ item => !item.inspectState
+ ).length;
+ qualifiedCount.value = inspectionList.value.filter(
+ item => item.checkResult === "鍚堟牸"
+ ).length;
+ })
+ .catch(err => {
+ tableLoading.value = false;
+ console.error("鑾峰彇鍒楄〃澶辫触:", err);
+ showToast("鑾峰彇鍒楄〃澶辫触锛岃閲嶈瘯");
+ });
+ };
+
+ // 缂栬緫妫�楠�
+ const startInspection = item => {
+ if (!item) {
+ showToast("鍙傛暟閿欒");
+ return;
+ }
+ // 瀛樺偍瀹屾暣鐨勬楠屾暟鎹�
+ uni.setStorageSync("inspectionEditData", item);
+ // 璺宠浆鍒扮紪杈戦〉闈�
+ uni.navigateTo({
+ url: `/pages/qualityManagement/materialInspection/add?id=${item.id}&isEdit=true`,
+ });
+ };
+
+ // 鏌ョ湅璇︽儏
+ const viewDetail = item => {
+ if (!item) {
+ showToast("鍙傛暟閿欒");
+ return;
+ }
+ uni.setStorageSync("inspectionEditData", item);
+ // 璺宠浆鍒拌鎯呴〉闈�
+ uni.navigateTo({
+ url: `/pages/qualityManagement/materialInspection/detail?id=${item.id}`,
+ });
+ };
+
+ // 鏂板妫�楠�
+ const addInspection = () => {
+ uni.navigateTo({
+ url: "/pages/qualityManagement/materialInspection/add",
+ });
+ };
+
+ // 鎻愪氦妫�楠�
+ const submitInspection = async item => {
+ if (!item) {
+ showToast("鍙傛暟閿欒");
+ return;
+ }
+ try {
+ const res = await submitQualityInspect({ id: item.id });
+ if (res.code === 200) {
+ showToast("鎻愪氦鎴愬姛");
+ setTimeout(() => {
+ getList();
+ }, 1000);
+ } else {
+ showToast("鎻愪氦澶辫触锛�" + (res.msg || "鏈煡閿欒"));
+ }
+ } catch (error) {
+ console.error("鎻愪氦澶辫触:", error);
+ showToast("鎻愪氦澶辫触锛岃閲嶈瘯");
+ }
+ };
+
+ // 鍒嗛厤妫�楠屽憳
+ const assignInspector = item => {
+ if (!item) {
+ showToast("鍙傛暟閿欒");
+ return;
+ }
+ currentAssignRow.value = item;
+ getUserList();
+ showAssignDialog.value = true;
+ };
+
+ // 閫夋嫨妫�楠屽憳
+ const selectInspector = e => {
+ assignForm.value.checkName = e.value;
+ showInspectorSheet.value = false;
+ };
+
+ // 鎻愪氦鍒嗛厤
+ const submitAssign = async () => {
+ if (!currentAssignRow.value || !assignForm.value.checkName) {
+ showToast("璇烽�夋嫨妫�楠屽憳");
+ return;
+ }
+ try {
+ const data = {
+ ...assignForm.value,
+ id: currentAssignRow.value.id,
+ };
+ const res = await qualityInspectUpdate(data);
+ if (res.code === 200) {
+ showToast("鍒嗛厤鎴愬姛");
+ showAssignDialog.value = false;
+ setTimeout(() => {
+ getList();
+ }, 1000);
+ } else {
+ showToast("鍒嗛厤澶辫触锛�" + (res.msg || "鏈煡閿欒"));
+ }
+ } catch (error) {
+ console.error("鍒嗛厤澶辫触:", error);
+ showToast("鍒嗛厤澶辫触锛岃閲嶈瘯");
+ }
+ };
+
+ // 澶勭悊鍒嗛〉
+ const handlePagination = obj => {
+ page.value.current = obj.current;
+ page.value.size = obj.size;
+ getList();
+ };
+
+ onMounted(() => {
+ getList();
+ getUserList();
+ });
+
+ onShow(() => {
+ getList();
+ });
+</script>
+
+<style scoped lang="scss">
+ @import "../../../styles/sales-common.scss";
+
+ .material-inspection-page {
+ min-height: 100vh;
+ background: #f8f9fa;
+ padding-bottom: 80px;
+ }
+
+ // 鎼滅储鍖哄煙
+ .search-section {
+ padding: 20rpx 30rpx;
+ background-color: #ffffff;
+ position: sticky;
+ top: 0;
+ z-index: 10;
+ }
+
+ // 缁熻鍗$墖
+ .stats-cards {
+ display: flex;
+ padding: 15px;
+ gap: 10px;
+ background: #fff;
+ margin-bottom: 10px;
+ }
+
+ .stat-card {
+ flex: 1;
+ background: #2979ff;
+ border-radius: 12px;
+ padding: 15px;
+ text-align: center;
+ color: #fff;
+ box-shadow: 0 2px 8px rgba(41, 121, 255, 0.2);
+ }
+
+ .stat-number {
+ display: block;
+ font-size: 20px;
+ font-weight: 600;
+ margin-bottom: 5px;
+ }
+
+ .stat-label {
+ font-size: 12px;
+ opacity: 0.9;
+ }
+
+ // 妫�楠屽垪琛�
+ .inspection-list {
+ padding: 20px;
+ }
+
+ .inspection-item {
+ background: #ffffff;
+ border-radius: 12px;
+ margin-bottom: 16px;
+ overflow: hidden;
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
+ padding: 0 16px;
+
+ &:active {
+ transform: scale(0.98);
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
+ }
+ }
+
+ .item-header {
+ padding: 16px 0;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ }
+
+ .item-left {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ }
+
+ .material-icon {
+ width: 24px;
+ height: 24px;
+ background: #2979ff;
+ border-radius: 4px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+
+ .state-pending {
+ background: #ff9900;
+ }
+
+ .state-submitted {
+ background: #52c41a;
+ }
+
+ .material-info {
+ flex: 1;
+ }
+
+ .material-name {
+ font-size: 14px;
+ color: #333;
+ font-weight: 500;
+ }
+
+ .material-code {
+ font-size: 12px;
+ color: #999;
+ margin-left: 8px;
+ }
+
+ .status-tags {
+ display: flex;
+ gap: 8px;
+ }
+
+ .status-tag {
+ margin: 0;
+ }
+
+ .date-range {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ margin-top: 10px;
+ padding: 8px 12px;
+ background: #f8f9fa;
+ border-radius: 8px;
+ }
+
+ .date-text {
+ font-size: 12px;
+ color: #666;
+ }
+
+ // 璇︽儏琛�
+ .item-details {
+ padding: 16px 0;
+ }
+
+ .detail-row {
+ display: flex;
+ align-items: flex-end;
+ justify-content: space-between;
+ margin-bottom: 8px;
+
+ &:last-child {
+ margin-bottom: 0;
+ }
+ }
+
+ .detail-label {
+ font-size: 12px;
+ color: #777777;
+ min-width: 60px;
+ }
+
+ .detail-value {
+ font-size: 12px;
+ color: #000000;
+ text-align: right;
+ flex: 1;
+ margin-left: 16px;
+ }
+
+ // 鎿嶄綔鎸夐挳
+ .action-buttons {
+ display: flex;
+ gap: 12px;
+ padding: 0 0 16px 0;
+ justify-content: space-between;
+ }
+
+ .action-btn {
+ flex: 1;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 8px;
+ }
+
+ // 绌虹姸鎬�
+ .no-data {
+ padding: 60px 20px;
+ text-align: center;
+ }
+
+ // 娴姩鎸夐挳
+ .fab-button {
+ position: fixed;
+ bottom: 20px;
+ right: 20px;
+ width: 56px;
+ height: 56px;
+ background: #2979ff;
+ border-radius: 50%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ box-shadow: 0 4px 16px rgba(41, 121, 255, 0.3);
+ z-index: 1000;
+ }
+
+ // 鍒嗛厤妫�楠屽憳寮圭獥
+ .assign-dialog {
+ padding: 24px;
+ background: #ffffff;
+ border-radius: 16px;
+ overflow: hidden;
+ }
+
+ .dialog-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 24px;
+ padding-bottom: 16px;
+ border-bottom: 1px solid #f0f0f0;
+ }
+
+ .dialog-title {
+ font-size: 18px;
+ font-weight: 600;
+ color: #303133;
+ }
+
+ .dialog-content {
+ margin-bottom: 24px;
+ }
+
+ .dialog-footer {
+ display: flex;
+ gap: 16px;
+ padding-top: 16px;
+ border-top: 1px solid #f0f0f0;
+ }
+
+ .footer-btn {
+ flex: 1;
+ height: 44px;
+ font-size: 16px;
+ }
+
+ // 杈撳叆妗嗘牱寮�
+ :deep(.up-input__inner) {
+ border-radius: 8px;
+ height: 44px;
+ font-size: 14px;
+ }
+
+ // 琛ㄥ崟椤规牱寮�
+ :deep(.up-form-item) {
+ margin-bottom: 0;
+ }
+
+ :deep(.up-form-item__label) {
+ font-size: 14px;
+ color: #606266;
+ margin-bottom: 8px;
+ }
+
+ // 鎸夐挳鏍峰紡
+ :deep(.up-button--primary) {
+ border-radius: 8px;
+ }
+
+ :deep(.up-button--default) {
+ border-radius: 8px;
+ }
+
+ // 鍒嗛〉缁勪欢
+ .pagination {
+ padding: 20px;
+ background: #fff;
+ margin-top: 10px;
+ display: flex;
+ justify-content: center;
+ }
+</style>
diff --git a/src/pages/qualityManagement/metricBinding/detail.vue b/src/pages/qualityManagement/metricBinding/detail.vue
new file mode 100644
index 0000000..43055ec
--- /dev/null
+++ b/src/pages/qualityManagement/metricBinding/detail.vue
@@ -0,0 +1,268 @@
+<template>
+ <view class="binding-detail-page">
+ <PageHeader :title="'缁戝畾鍏崇郴: ' + standardNo" @back="goBack" />
+
+ <view class="detail-info-header">
+ <view class="info-row">
+ <text class="info-label">鏍囧噯缂栧彿锛�</text>
+ <text class="info-value">{{ standardNo }}</text>
+ </view>
+ </view>
+
+ <view class="list-container" v-if="bindingList.length > 0">
+ <view v-for="(item, index) in bindingList" :key="index" class="list-item">
+ <view class="item-content">
+ <text class="product-name">{{ item.productName }}</text>
+ </view>
+ <view class="item-actions">
+ <up-button type="error" size="mini" @click.stop="handleUnbind(item)">瑙i櫎缁戝畾</up-button>
+ </view>
+ </view>
+ </view>
+
+ <view v-else class="no-data">
+ <up-empty mode="data" text="鏆傛棤缁戝畾鍏崇郴"></up-empty>
+ </view>
+
+ <view class="fab-button" @click="openBindingDialog">
+ <up-icon name="plus" size="24" color="#ffffff"></up-icon>
+ </view>
+
+ <!-- 娣诲姞缁戝畾寮圭獥 -->
+ <up-popup v-model:show="showBindingDialog" mode="bottom" round closeable @close="showBindingDialog = false">
+ <view class="binding-dialog">
+ <view class="dialog-header">
+ <text class="dialog-title">娣诲姞浜у搧缁戝畾</text>
+ </view>
+ <view class="search-box">
+ <up-search
+ placeholder="鎼滅储浜у搧"
+ v-model="productSearch"
+ @search="filterProducts"
+ @custom="filterProducts"
+ @clear="filterProducts"
+ :show-action="true"
+ action-text="绛涢��"
+ :animation="true"
+ ></up-search>
+ </view>
+ <scroll-view scroll-y class="product-list">
+ <up-checkbox-group v-model="selectedProductIds" placement="column">
+ <up-checkbox
+ v-for="item in filteredProducts"
+ :key="item.id"
+ :label="item.productName"
+ :name="item.id"
+ customStyle="margin-bottom: 20rpx"
+ ></up-checkbox>
+ </up-checkbox-group>
+ </scroll-view>
+ <view class="dialog-footer">
+ <up-button type="primary" text="纭缁戝畾" @click="submitBinding" :loading="submitLoading"></up-button>
+ </view>
+ </view>
+ </up-popup>
+ </view>
+</template>
+
+<script setup>
+import { ref, reactive, onMounted, computed } from 'vue';
+import { onLoad } from '@dcloudio/uni-app';
+import {
+ qualityTestStandardBindingList,
+ qualityTestStandardBindingAdd,
+ qualityTestStandardBindingDel
+} from '@/api/qualityManagement/qualityTestStandardBinding.js';
+import { productTreeList } from '@/api/basicData/product.js';
+import { toast, showConfirm } from '@/utils/common';
+
+const standardId = ref(null);
+const standardNo = ref('');
+
+const bindingList = ref([]);
+const loading = ref(false);
+
+const showBindingDialog = ref(false);
+const productSearch = ref('');
+const allProducts = ref([]);
+const filteredProducts = ref([]);
+const selectedProductIds = ref([]);
+const submitLoading = ref(false);
+
+const getList = () => {
+ loading.value = true;
+ qualityTestStandardBindingList({ standardId: standardId.value }).then(res => {
+ bindingList.value = res.data || [];
+ }).finally(() => {
+ loading.value = false;
+ });
+};
+
+const openBindingDialog = () => {
+ selectedProductIds.value = [];
+ productSearch.value = '';
+ filteredProducts.value = allProducts.value;
+ showBindingDialog.value = true;
+};
+
+const filterProducts = () => {
+ if (!productSearch.value) {
+ filteredProducts.value = allProducts.value;
+ } else {
+ filteredProducts.value = allProducts.value.filter(p =>
+ p.productName.toLowerCase().includes(productSearch.value.toLowerCase())
+ );
+ }
+};
+
+const submitBinding = () => {
+ if (selectedProductIds.value.length === 0) {
+ toast('璇烽�夋嫨瑕佺粦瀹氱殑浜у搧');
+ return;
+ }
+
+ submitLoading.value = true;
+ const data = selectedProductIds.value.map(productId => ({
+ standardId: standardId.value,
+ productId
+ }));
+
+ qualityTestStandardBindingAdd(data).then(() => {
+ toast('缁戝畾鎴愬姛');
+ showBindingDialog.value = false;
+ getList();
+ }).finally(() => {
+ submitLoading.value = false;
+ });
+};
+
+const handleUnbind = (row) => {
+ showConfirm('纭瑙i櫎璇ヤ骇鍝佺殑缁戝畾鍏崇郴鍚楋紵').then(res => {
+ if (res.confirm) {
+ qualityTestStandardBindingDel([row.id]).then(() => {
+ toast('瑙g粦鎴愬姛');
+ getList();
+ });
+ }
+ });
+};
+
+const goBack = () => {
+ uni.navigateBack();
+};
+
+onLoad((options) => {
+ standardId.value = options.id;
+ standardNo.value = options.standardNo;
+ getList();
+
+ productTreeList().then(res => {
+ allProducts.value = res.data || [];
+ filteredProducts.value = allProducts.value;
+ });
+});
+</script>
+
+<style lang="scss" scoped>
+.binding-detail-page {
+ padding-bottom: 120rpx;
+ background-color: #f5f7fa;
+ min-height: 100vh;
+}
+
+.detail-info-header {
+ padding: 30rpx;
+ background-color: #ffffff;
+ margin-bottom: 20rpx;
+}
+
+.info-row {
+ display: flex;
+ align-items: center;
+}
+
+.info-label {
+ color: #909399;
+ font-size: 28rpx;
+ width: 160rpx;
+}
+
+.info-value {
+ color: #303133;
+ font-size: 28rpx;
+ font-weight: bold;
+}
+
+.list-container {
+ padding: 20rpx;
+}
+
+.list-item {
+ background-color: #ffffff;
+ border-radius: 16rpx;
+ padding: 30rpx;
+ margin-bottom: 20rpx;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+}
+
+.product-name {
+ font-size: 30rpx;
+ color: #303133;
+ font-weight: 500;
+}
+
+.no-data {
+ padding-top: 200rpx;
+}
+
+.fab-button {
+ position: fixed;
+ right: 40rpx;
+ bottom: 60rpx;
+ width: 100rpx;
+ height: 100rpx;
+ background-color: #3c9cff;
+ border-radius: 50%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ box-shadow: 0 4rpx 16rpx rgba(60, 156, 255, 0.4);
+ z-index: 99;
+}
+
+.binding-dialog {
+ background-color: #ffffff;
+ padding: 40rpx;
+ max-height: 80vh;
+ display: flex;
+ flex-direction: column;
+ border-radius: 24rpx 24rpx 0 0;
+ overflow: hidden;
+}
+
+.dialog-header {
+ margin-bottom: 30rpx;
+ text-align: center;
+}
+
+.dialog-title {
+ font-size: 32rpx;
+ font-weight: bold;
+}
+
+.search-box {
+ margin-bottom: 30rpx;
+}
+
+.product-list {
+ flex: 1;
+ min-height: 400rpx;
+}
+
+.dialog-footer {
+ margin-top: 40rpx;
+ padding-bottom: env(safe-area-inset-bottom);
+}
+</style>
diff --git a/src/pages/qualityManagement/metricBinding/index.vue b/src/pages/qualityManagement/metricBinding/index.vue
new file mode 100644
index 0000000..2b180e1
--- /dev/null
+++ b/src/pages/qualityManagement/metricBinding/index.vue
@@ -0,0 +1,283 @@
+<template>
+ <view class="metric-binding-page">
+ <PageHeader title="鎸囨爣缁戝畾" @back="goBack" />
+
+ <!-- 鎼滅储涓庣瓫閫� -->
+ <view class="search-section">
+ <up-search
+ placeholder="鏍囧噯缂栧彿/鏍囧噯鍚嶇О"
+ v-model="searchForm.keyword"
+ @search="handleQuery"
+ @custom="handleQuery"
+ @clear="handleQuery"
+ :show-action="true"
+ action-text="鎼滅储"
+ :animation="true"
+ customStyle="margin-bottom: 20rpx"
+ ></up-search>
+ <view class="filter-row">
+ <view class="filter-item" @click="showTypeSelect = true">
+ <text>{{ typeLabel }}</text>
+ <up-icon name="arrow-down" size="14" color="#999"></up-icon>
+ </view>
+ <view class="filter-item" @click="showStatusSelect = true">
+ <text>{{ statusLabel }}</text>
+ <up-icon name="arrow-down" size="14" color="#999"></up-icon>
+ </view>
+ </view>
+ </view>
+
+ <!-- 鍒楄〃鍖哄煙 -->
+ <view class="list-container" v-if="tableData.length > 0">
+ <view v-for="(item, index) in tableData" :key="index" class="list-item" @click="viewDetail(item)">
+ <view class="item-header">
+ <text class="standard-no">{{ item.standardNo }}</text>
+ <up-tag :text="getStatusText(item.state)" :type="getStatusType(item.state)" size="mini"></up-tag>
+ </view>
+ <view class="item-content">
+ <view class="item-row">
+ <text class="item-label">鏍囧噯鍚嶇О锛�</text>
+ <text class="item-value">{{ item.standardName }}</text>
+ </view>
+ <view class="item-row">
+ <text class="item-label">绫诲埆锛�</text>
+ <text class="item-value">{{ getInspectTypeText(item.inspectType) }}</text>
+ </view>
+ </view>
+ </view>
+ <view class="pagination-container">
+ <up-loadmore :status="loadStatus" @loadmore="getList" />
+ </view>
+ </view>
+
+ <view v-else class="no-data">
+ <up-empty mode="data" text="鏆傛棤鏁版嵁"></up-empty>
+ </view>
+
+ <!-- 绫诲埆閫夋嫨鍣� -->
+ <up-action-sheet
+ :actions="typeActions"
+ :show="showTypeSelect"
+ @close="showTypeSelect = false"
+ @select="selectType"
+ title="璇烽�夋嫨绫诲埆"
+ ></up-action-sheet>
+
+ <!-- 鐘舵�侀�夋嫨鍣� -->
+ <up-action-sheet
+ :actions="statusActions"
+ :show="showStatusSelect"
+ @close="showStatusSelect = false"
+ @select="selectStatus"
+ title="璇烽�夋嫨鐘舵��"
+ ></up-action-sheet>
+ </view>
+</template>
+
+<script setup>
+import { ref, reactive, onMounted, computed } from 'vue';
+import {
+ qualityTestStandardListPage
+} from '@/api/qualityManagement/metricMaintenance.js';
+
+const searchForm = reactive({
+ keyword: '',
+ inspectType: '',
+ state: ''
+});
+
+const tableData = ref([]);
+const page = reactive({
+ current: 1,
+ size: 20,
+ total: 0
+});
+const loadStatus = ref('loadmore');
+
+const showTypeSelect = ref(false);
+const typeActions = [
+ { name: '鍏ㄩ儴', value: '' },
+ { name: '鍘熸潗鏂欐楠�', value: '0' },
+ { name: '杩囩▼妫�楠�', value: '1' },
+ { name: '鍑哄巶妫�楠�', value: '2' }
+];
+const typeLabel = computed(() => {
+ const action = typeActions.find(a => a.value === searchForm.inspectType);
+ return action ? action.name : '鍏ㄩ儴绫诲埆';
+});
+
+const showStatusSelect = ref(false);
+const statusActions = [
+ { name: '鍏ㄩ儴', value: '' },
+ { name: '鑽夌', value: '0' },
+ { name: '閫氳繃', value: '1' },
+ { name: '鎾ら攢', value: '2' }
+];
+const statusLabel = computed(() => {
+ const action = statusActions.find(a => a.value === searchForm.state);
+ return action ? action.name : '鍏ㄩ儴鐘舵��';
+});
+
+const getInspectTypeText = (type) => {
+ const types = { '0': '鍘熸潗鏂欐楠�', '1': '杩囩▼妫�楠�', '2': '鍑哄巶妫�楠�' };
+ return types[type] || '-';
+};
+
+const getStatusText = (state) => {
+ const states = { '0': '鑽夌', '1': '閫氳繃', '2': '鎾ら攢' };
+ return states[state] || '鏈煡';
+};
+
+const getStatusType = (state) => {
+ const types = { '0': 'info', '1': 'success', '2': 'warning' };
+ return types[state] || 'info';
+};
+
+const getList = () => {
+ if (loadStatus.value === 'loading' || (page.total > 0 && tableData.value.length >= page.total)) return;
+
+ loadStatus.value = 'loading';
+ const params = {
+ standardNo: searchForm.keyword || null,
+ inspectType: searchForm.inspectType || null,
+ state: searchForm.state || null,
+ current: page.current,
+ size: page.size
+ };
+
+ qualityTestStandardListPage(params).then(res => {
+ const records = res?.data?.records || [];
+ if (page.current === 1) {
+ tableData.value = records;
+ } else {
+ tableData.value = [...tableData.value, ...records];
+ }
+ page.total = res?.data?.total || 0;
+
+ if (tableData.value.length >= page.total) {
+ loadStatus.value = 'nomore';
+ } else {
+ loadStatus.value = 'loadmore';
+ page.current++;
+ }
+ }).catch(() => {
+ loadStatus.value = 'loadmore';
+ });
+};
+
+const handleQuery = () => {
+ page.current = 1;
+ page.total = 0;
+ tableData.value = [];
+ loadStatus.value = 'loadmore';
+ getList();
+};
+
+const selectType = (e) => {
+ searchForm.inspectType = e.value;
+ handleQuery();
+};
+
+const selectStatus = (e) => {
+ searchForm.state = e.value;
+ handleQuery();
+};
+
+const viewDetail = (item) => {
+ uni.navigateTo({
+ url: `/pages/qualityManagement/metricBinding/detail?id=${item.id}&standardNo=${item.standardNo}`
+ });
+};
+
+const goBack = () => {
+ uni.navigateBack();
+};
+
+onMounted(() => {
+ handleQuery();
+});
+</script>
+
+<style lang="scss" scoped>
+.metric-binding-page {
+ padding-bottom: 20rpx;
+ background-color: #f5f7fa;
+ min-height: 100vh;
+}
+
+.search-section {
+ padding: 20rpx 30rpx;
+ background-color: #ffffff;
+ position: sticky;
+ top: 0;
+ z-index: 10;
+}
+
+.filter-row {
+ display: flex;
+ justify-content: space-around;
+ padding: 10rpx 0;
+}
+
+.filter-item {
+ display: flex;
+ align-items: center;
+ gap: 10rpx;
+ font-size: 28rpx;
+ color: #606266;
+}
+
+.list-container {
+ padding: 20rpx;
+}
+
+.list-item {
+ background-color: #ffffff;
+ border-radius: 16rpx;
+ padding: 30rpx;
+ margin-bottom: 20rpx;
+ box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05);
+}
+
+.item-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 20rpx;
+}
+
+.standard-no {
+ font-size: 30rpx;
+ font-weight: bold;
+ color: #303133;
+}
+
+.item-content {
+ margin-bottom: 10rpx;
+}
+
+.item-row {
+ display: flex;
+ margin-bottom: 10rpx;
+}
+
+.item-label {
+ color: #909399;
+ width: 160rpx;
+ font-size: 28rpx;
+}
+
+.item-value {
+ flex: 1;
+ color: #303133;
+ font-size: 28rpx;
+}
+
+.pagination-container {
+ padding: 20rpx 0;
+}
+
+.no-data {
+ padding-top: 200rpx;
+}
+</style>
diff --git a/src/pages/qualityManagement/metricMaintenance/detail.vue b/src/pages/qualityManagement/metricMaintenance/detail.vue
new file mode 100644
index 0000000..d27d34d
--- /dev/null
+++ b/src/pages/qualityManagement/metricMaintenance/detail.vue
@@ -0,0 +1,335 @@
+<template>
+ <view class="metric-detail-page">
+ <PageHeader :title="'鏍囧噯鍙傛暟: ' + standardNo" @back="goBack" />
+
+ <!-- 淇℃伅澶撮儴 -->
+ <view class="detail-info-header">
+ <view class="info-row">
+ <text class="info-label">鏍囧噯缂栧彿锛�</text>
+ <text class="info-value">{{ standardNo }}</text>
+ </view>
+ <view class="info-row">
+ <text class="info-label">鐘舵�侊細</text>
+ <up-tag :text="getStatusText(state)" :type="getStatusType(state)" size="mini"></up-tag>
+ </view>
+ </view>
+
+ <!-- 鍙傛暟鍒楄〃 -->
+ <view class="list-container" v-if="paramList.length > 0">
+ <view v-for="(item, index) in paramList" :key="index" class="list-item">
+ <view class="item-content">
+ <view class="item-header">
+ <text class="param-name">{{ item.parameterItem }}</text>
+ <text class="param-unit">{{ item.unit || '-' }}</text>
+ </view>
+ <view class="item-row">
+ <text class="item-label">鏍囧噯鍊硷細</text>
+ <text class="item-value">{{ item.standardValue || '-' }}</text>
+ </view>
+ <view class="item-row">
+ <text class="item-label">鍐呮帶鍊硷細</text>
+ <text class="item-value">{{ item.controlValue || '-' }}</text>
+ </view>
+ <view class="item-row">
+ <text class="item-label">榛樿鍊硷細</text>
+ <text class="item-value">{{ item.defaultValue || '-' }}</text>
+ </view>
+ </view>
+ <view class="item-actions" v-if="!isReadonly">
+ <up-button type="primary" size="mini" @click.stop="openParamDialog('edit', item)">缂栬緫</up-button>
+ <up-button type="error" size="mini" @click.stop="handleDelete(item)">鍒犻櫎</up-button>
+ </view>
+ </view>
+ </view>
+
+ <view v-else class="no-data">
+ <up-empty mode="data" text="鏆傛棤鍙傛暟"></up-empty>
+ </view>
+
+ <!-- 娴姩鏂板鎸夐挳 -->
+ <view class="fab-button" v-if="!isReadonly" @click="openParamDialog('add')">
+ <up-icon name="plus" size="24" color="#ffffff"></up-icon>
+ </view>
+
+ <!-- 鍙傛暟缂栬緫寮圭獥 -->
+ <up-popup v-model:show="paramDialogVisible" mode="center" round closeable @close="closeParamDialog">
+ <view class="dialog-content">
+ <view class="dialog-header">
+ <text class="dialog-title">{{ operationType === 'add' ? '鏂板鍙傛暟' : '淇敼鍙傛暟' }}</text>
+ </view>
+ <up-form :model="form" ref="formRef" label-width="80">
+ <up-form-item label="鍙傛暟椤�" prop="parameterItem" required>
+ <up-input v-model="form.parameterItem" placeholder="璇疯緭鍏ュ弬鏁伴」" border="bottom" />
+ </up-form-item>
+ <up-form-item label="鍗曚綅" prop="unit">
+ <up-input v-model="form.unit" placeholder="璇疯緭鍏ュ崟浣�" border="bottom" />
+ </up-form-item>
+ <up-form-item label="鏍囧噯鍊�" prop="standardValue">
+ <up-input v-model="form.standardValue" placeholder="璇疯緭鍏ユ爣鍑嗗��" border="bottom" />
+ </up-form-item>
+ <up-form-item label="鍐呮帶鍊�" prop="controlValue">
+ <up-input v-model="form.controlValue" placeholder="璇疯緭鍏ュ唴鎺у��" border="bottom" />
+ </up-form-item>
+ <up-form-item label="榛樿鍊�" prop="defaultValue">
+ <up-input v-model="form.defaultValue" placeholder="璇疯緭鍏ラ粯璁ゅ��" border="bottom" />
+ </up-form-item>
+ </up-form>
+ <view class="dialog-footer">
+ <up-button type="primary" text="纭" @click="submitForm" :loading="submitLoading"></up-button>
+ <up-button text="鍙栨秷" @click="closeParamDialog" customStyle="margin-top: 20rpx"></up-button>
+ </view>
+ </view>
+ </up-popup>
+ </view>
+</template>
+
+<script setup>
+import { ref, reactive, onMounted, computed } from 'vue';
+import { onLoad } from '@dcloudio/uni-app';
+import {
+ qualityTestStandardParamList,
+ qualityTestStandardParamAdd,
+ qualityTestStandardParamUpdate,
+ qualityTestStandardParamDel
+} from '@/api/qualityManagement/metricMaintenance.js';
+import { toast, showConfirm } from '@/utils/common';
+
+const standardId = ref(null);
+const standardNo = ref('');
+const state = ref('0');
+
+const paramList = ref([]);
+const loading = ref(false);
+
+const isReadonly = computed(() => state.value === '1' || state.value === 1);
+
+const paramDialogVisible = ref(false);
+const operationType = ref('add');
+const submitLoading = ref(false);
+const form = reactive({
+ id: null,
+ standardId: null,
+ parameterItem: '',
+ unit: '',
+ standardValue: '',
+ controlValue: '',
+ defaultValue: ''
+});
+
+const getStatusText = (s) => {
+ const states = { '0': '鑽夌', '1': '閫氳繃', '2': '鎾ら攢' };
+ return states[s] || '鏈煡';
+};
+
+const getStatusType = (s) => {
+ const types = { '0': 'info', '1': 'success', '2': 'warning' };
+ return types[s] || 'info';
+};
+
+const getList = () => {
+ loading.value = true;
+ qualityTestStandardParamList({ standardId: standardId.value }).then(res => {
+ paramList.value = res.data || [];
+ }).finally(() => {
+ loading.value = false;
+ });
+};
+
+const openParamDialog = (type, row) => {
+ operationType.value = type;
+ if (type === 'edit' && row) {
+ Object.assign(form, {
+ id: row.id,
+ standardId: standardId.value,
+ parameterItem: row.parameterItem,
+ unit: row.unit,
+ standardValue: row.standardValue,
+ controlValue: row.controlValue,
+ defaultValue: row.defaultValue
+ });
+ } else {
+ Object.assign(form, {
+ id: null,
+ standardId: standardId.value,
+ parameterItem: '',
+ unit: '',
+ standardValue: '',
+ controlValue: '',
+ defaultValue: ''
+ });
+ }
+ paramDialogVisible.value = true;
+};
+
+const closeParamDialog = () => {
+ paramDialogVisible.value = false;
+};
+
+const submitForm = () => {
+ submitLoading.value = true;
+ const api = operationType.value === 'add' ? qualityTestStandardParamAdd : qualityTestStandardParamUpdate;
+ api(form).then(() => {
+ toast('淇濆瓨鎴愬姛');
+ paramDialogVisible.value = false;
+ getList();
+ }).finally(() => {
+ submitLoading.value = false;
+ });
+};
+
+const handleDelete = (row) => {
+ showConfirm('纭鍒犻櫎璇ュ弬鏁伴」鍚楋紵').then(res => {
+ if (res.confirm) {
+ qualityTestStandardParamDel([row.id]).then(() => {
+ toast('鍒犻櫎鎴愬姛');
+ getList();
+ });
+ }
+ });
+};
+
+const goBack = () => {
+ uni.navigateBack();
+};
+
+onLoad((options) => {
+ standardId.value = options.id;
+ standardNo.value = options.standardNo;
+ state.value = options.state;
+ getList();
+});
+</script>
+
+<style lang="scss" scoped>
+.metric-detail-page {
+ padding-bottom: 120rpx;
+ background-color: #f5f7fa;
+ min-height: 100vh;
+}
+
+.detail-info-header {
+ padding: 30rpx;
+ background-color: #ffffff;
+ margin-bottom: 20rpx;
+ box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05);
+}
+
+.info-row {
+ display: flex;
+ align-items: center;
+ margin-bottom: 10rpx;
+}
+
+.info-label {
+ color: #909399;
+ font-size: 28rpx;
+ width: 160rpx;
+}
+
+.info-value {
+ color: #303133;
+ font-size: 28rpx;
+ font-weight: bold;
+}
+
+.list-container {
+ padding: 20rpx;
+}
+
+.list-item {
+ background-color: #ffffff;
+ border-radius: 16rpx;
+ padding: 30rpx;
+ margin-bottom: 20rpx;
+}
+
+.item-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 20rpx;
+}
+
+.param-name {
+ font-size: 30rpx;
+ font-weight: bold;
+ color: #303133;
+}
+
+.param-unit {
+ font-size: 26rpx;
+ color: #909399;
+ background-color: #f0f2f5;
+ padding: 4rpx 12rpx;
+ border-radius: 4rpx;
+}
+
+.item-row {
+ display: flex;
+ margin-bottom: 10rpx;
+}
+
+.item-label {
+ color: #909399;
+ width: 160rpx;
+ font-size: 26rpx;
+}
+
+.item-value {
+ flex: 1;
+ color: #303133;
+ font-size: 26rpx;
+}
+
+.item-actions {
+ display: flex;
+ justify-content: flex-end;
+ gap: 20rpx;
+ border-top: 1rpx solid #ebeef5;
+ padding-top: 20rpx;
+ margin-top: 20rpx;
+}
+
+.no-data {
+ padding-top: 200rpx;
+}
+
+.fab-button {
+ position: fixed;
+ right: 40rpx;
+ bottom: 60rpx;
+ width: 100rpx;
+ height: 100rpx;
+ background-color: #3c9cff;
+ border-radius: 50%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ box-shadow: 0 4rpx 16rpx rgba(60, 156, 255, 0.4);
+ z-index: 99;
+}
+
+.dialog-content {
+ width: 650rpx;
+ padding: 40rpx;
+ background-color: #ffffff;
+ border-radius: 24rpx;
+ overflow: hidden;
+ box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.08);
+}
+
+.dialog-header {
+ margin-bottom: 30rpx;
+ text-align: center;
+}
+
+.dialog-title {
+ font-size: 32rpx;
+ font-weight: bold;
+ color: #303133;
+}
+
+.dialog-footer {
+ margin-top: 40rpx;
+}
+</style>
diff --git a/src/pages/qualityManagement/metricMaintenance/index.vue b/src/pages/qualityManagement/metricMaintenance/index.vue
new file mode 100644
index 0000000..ab59b5d
--- /dev/null
+++ b/src/pages/qualityManagement/metricMaintenance/index.vue
@@ -0,0 +1,498 @@
+<template>
+ <view class="metric-maintenance-page">
+ <PageHeader title="鎸囨爣缁存姢" @back="goBack" />
+
+ <!-- 鎼滅储涓庣瓫閫� -->
+ <view class="search-section">
+ <up-search
+ placeholder="鏍囧噯缂栧彿/鏍囧噯鍚嶇О"
+ v-model="searchForm.keyword"
+ @search="handleQuery"
+ @custom="handleQuery"
+ @clear="handleQuery"
+ :show-action="true"
+ action-text="鎼滅储"
+ :animation="true"
+ customStyle="margin-bottom: 20rpx"
+ ></up-search>
+ <view class="filter-row">
+ <view class="filter-item" @click="showTypeSelect = true">
+ <text>{{ typeLabel }}</text>
+ <up-icon name="arrow-down" size="14" color="#999"></up-icon>
+ </view>
+ <view class="filter-item" @click="showStatusSelect = true">
+ <text>{{ statusLabel }}</text>
+ <up-icon name="arrow-down" size="14" color="#999"></up-icon>
+ </view>
+ </view>
+ </view>
+
+ <!-- 鍒楄〃鍖哄煙 -->
+ <view class="list-container" v-if="tableData.length > 0">
+ <view v-for="(item, index) in tableData" :key="index" class="list-item" @click="viewDetail(item)">
+ <view class="item-header">
+ <text class="standard-no">{{ item.standardNo }}</text>
+ <up-tag :text="getStatusText(item.state)" :type="getStatusType(item.state)" size="mini"></up-tag>
+ </view>
+ <view class="item-content">
+ <view class="item-row">
+ <text class="item-label">鏍囧噯鍚嶇О锛�</text>
+ <text class="item-value">{{ item.standardName }}</text>
+ </view>
+ <view class="item-row">
+ <text class="item-label">绫诲埆锛�</text>
+ <text class="item-value">{{ getInspectTypeText(item.inspectType) }}</text>
+ </view>
+ <view class="item-row">
+ <text class="item-label">宸ュ簭锛�</text>
+ <text class="item-value">{{ item.processName || '-' }}</text>
+ </view>
+ </view>
+ <view class="item-actions">
+ <up-button type="primary" size="mini" @click.stop="openStandardDialog('edit', item)">缂栬緫</up-button>
+ <up-button v-if="item.state !== 1" type="success" size="mini" @click.stop="handleAudit(item, 1)">鎵瑰噯</up-button>
+ <up-button v-if="item.state === 1" type="warning" size="mini" @click.stop="handleAudit(item, 2)">鎾ら攢</up-button>
+ <up-button type="error" size="mini" @click.stop="handleDelete(item)">鍒犻櫎</up-button>
+ </view>
+ </view>
+ <view class="pagination-container">
+ <up-loadmore :status="loadStatus" @loadmore="getList" />
+ </view>
+ </view>
+
+ <view v-else class="no-data">
+ <up-empty mode="data" text="鏆傛棤鏁版嵁"></up-empty>
+ </view>
+
+ <!-- 娴姩鏂板鎸夐挳 -->
+ <view class="fab-button" @click="openStandardDialog('add')">
+ <up-icon name="plus" size="24" color="#ffffff"></up-icon>
+ </view>
+
+ <!-- 绫诲埆閫夋嫨鍣� -->
+ <up-action-sheet
+ :actions="typeActions"
+ :show="showTypeSelect"
+ @close="showTypeSelect = false"
+ @select="selectType"
+ title="璇烽�夋嫨绫诲埆"
+ ></up-action-sheet>
+
+ <!-- 鐘舵�侀�夋嫨鍣� -->
+ <up-action-sheet
+ :actions="statusActions"
+ :show="showStatusSelect"
+ @close="showStatusSelect = false"
+ @select="selectStatus"
+ title="璇烽�夋嫨鐘舵��"
+ ></up-action-sheet>
+
+ <!-- 鏍囧噯缂栬緫寮圭獥 -->
+ <up-popup v-model:show="standardDialogVisible" mode="center" round closeable @close="closeStandardDialog">
+ <view class="dialog-content">
+ <view class="dialog-header">
+ <text class="dialog-title">{{ standardOperationType === 'add' ? '鏂板妫�娴嬫爣鍑�' : '淇敼妫�娴嬫爣鍑�' }}</text>
+ </view>
+ <up-form :model="standardForm" ref="standardFormRef" label-width="100" label-position="top">
+ <up-form-item label="鏍囧噯缂栧彿" prop="standardNo" required borderBottom>
+ <up-input v-model="standardForm.standardNo" placeholder="璇疯緭鍏ユ爣鍑嗙紪鍙�" border="surround" />
+ </up-form-item>
+ <up-form-item label="鏍囧噯鍚嶇О" prop="standardName" required borderBottom>
+ <up-input v-model="standardForm.standardName" placeholder="璇疯緭鍏ユ爣鍑嗗悕绉�" border="surround" />
+ </up-form-item>
+ <up-form-item label="绫诲埆" prop="inspectType" required borderBottom>
+ <up-radio-group v-model="standardForm.inspectType">
+ <up-radio label="鍘熸潗鏂�" name="0"></up-radio>
+ <up-radio label="杩囩▼" name="1" customStyle="margin-left: 20rpx"></up-radio>
+ <up-radio label="鍑哄巶" name="2" customStyle="margin-left: 20rpx"></up-radio>
+ </up-radio-group>
+ </up-form-item>
+ <up-form-item label="宸ュ簭" prop="processId" borderBottom>
+ <up-input
+ v-model="processName"
+ placeholder="璇烽�夋嫨宸ュ簭"
+ border="surround"
+ readonly
+ @click="showProcessSelect = true"
+ />
+ </up-form-item>
+ <up-form-item label="澶囨敞" prop="remark" borderBottom>
+ <up-textarea v-model="standardForm.remark" placeholder="璇疯緭鍏ュ娉�" count border="surround" />
+ </up-form-item>
+ </up-form>
+ <view class="dialog-footer">
+ <up-button type="primary" text="纭" @click="submitStandardForm" :loading="submitLoading"></up-button>
+ <up-button text="鍙栨秷" @click="closeStandardDialog" customStyle="margin-top: 20rpx"></up-button>
+ </view>
+ </view>
+ </up-popup>
+
+ <!-- 宸ュ簭閫夋嫨鍣� -->
+ <up-picker
+ :show="showProcessSelect"
+ :columns="[processOptions]"
+ keyName="label"
+ @confirm="confirmProcess"
+ @cancel="showProcessSelect = false"
+ ></up-picker>
+ </view>
+</template>
+
+<script setup>
+import { ref, reactive, onMounted, computed } from 'vue';
+import {
+ qualityTestStandardListPage,
+ qualityTestStandardAdd,
+ qualityTestStandardUpdate,
+ qualityTestStandardDel,
+ qualityTestStandardAudit
+} from '@/api/qualityManagement/metricMaintenance.js';
+import { productProcessListPage } from '@/api/basicData/productProcess.js';
+import { toast, showConfirm } from '@/utils/common';
+
+const searchForm = reactive({
+ keyword: '',
+ inspectType: '',
+ state: ''
+});
+
+const tableData = ref([]);
+const page = reactive({
+ current: 1,
+ size: 20,
+ total: 0
+});
+const loadStatus = ref('loadmore');
+
+const showTypeSelect = ref(false);
+const typeActions = [
+ { name: '鍏ㄩ儴', value: '' },
+ { name: '鍘熸潗鏂欐楠�', value: '0' },
+ { name: '杩囩▼妫�楠�', value: '1' },
+ { name: '鍑哄巶妫�楠�', value: '2' }
+];
+const typeLabel = computed(() => {
+ const action = typeActions.find(a => a.value === searchForm.inspectType);
+ return action ? action.name : '鍏ㄩ儴绫诲埆';
+});
+
+const showStatusSelect = ref(false);
+const statusActions = [
+ { name: '鍏ㄩ儴', value: '' },
+ { name: '鑽夌', value: '0' },
+ { name: '閫氳繃', value: '1' },
+ { name: '鎾ら攢', value: '2' }
+];
+const statusLabel = computed(() => {
+ const action = statusActions.find(a => a.value === searchForm.state);
+ return action ? action.name : '鍏ㄩ儴鐘舵��';
+});
+
+const standardDialogVisible = ref(false);
+const standardOperationType = ref('add');
+const submitLoading = ref(false);
+const standardForm = reactive({
+ id: null,
+ standardNo: '',
+ standardName: '',
+ inspectType: '0',
+ processId: null,
+ remark: '',
+ state: '0'
+});
+
+const processOptions = ref([]);
+const showProcessSelect = ref(false);
+const processName = ref('');
+
+const getInspectTypeText = (type) => {
+ const types = { '0': '鍘熸潗鏂欐楠�', '1': '杩囩▼妫�楠�', '2': '鍑哄巶妫�楠�' };
+ return types[type] || '-';
+};
+
+const getStatusText = (state) => {
+ const states = { '0': '鑽夌', '1': '閫氳繃', '2': '鎾ら攢' };
+ return states[state] || '鏈煡';
+};
+
+const getStatusType = (state) => {
+ const types = { '0': 'info', '1': 'success', '2': 'warning' };
+ return types[state] || 'info';
+};
+
+const getList = () => {
+ if (loadStatus.value === 'loading' || (page.total > 0 && tableData.value.length >= page.total)) return;
+
+ loadStatus.value = 'loading';
+ const params = {
+ standardNo: searchForm.keyword || null,
+ inspectType: searchForm.inspectType || null,
+ state: searchForm.state || null,
+ current: page.current,
+ size: page.size
+ };
+
+ qualityTestStandardListPage(params).then(res => {
+ const records = res?.data?.records || [];
+ if (page.current === 1) {
+ tableData.value = records;
+ } else {
+ tableData.value = [...tableData.value, ...records];
+ }
+ page.total = res?.data?.total || 0;
+
+ if (tableData.value.length >= page.total) {
+ loadStatus.value = 'nomore';
+ } else {
+ loadStatus.value = 'loadmore';
+ page.current++;
+ }
+ }).catch(() => {
+ loadStatus.value = 'loadmore';
+ });
+};
+
+const handleQuery = () => {
+ page.current = 1;
+ page.total = 0;
+ tableData.value = [];
+ loadStatus.value = 'loadmore';
+ getList();
+};
+
+const selectType = (e) => {
+ searchForm.inspectType = e.value;
+ handleQuery();
+};
+
+const selectStatus = (e) => {
+ searchForm.state = e.value;
+ handleQuery();
+};
+
+const viewDetail = (item) => {
+ uni.navigateTo({
+ url: `/pages/qualityManagement/metricMaintenance/detail?id=${item.id}&standardNo=${item.standardNo}&state=${item.state}`
+ });
+};
+
+const openStandardDialog = (type, row) => {
+ standardOperationType.value = type;
+ if (type === 'edit' && row) {
+ Object.assign(standardForm, {
+ id: row.id,
+ standardNo: row.standardNo,
+ standardName: row.standardName,
+ inspectType: String(row.inspectType),
+ processId: row.processId,
+ remark: row.remark,
+ state: String(row.state)
+ });
+ const process = processOptions.value.find(p => p.value === row.processId);
+ processName.value = process ? process.label : '';
+ } else {
+ Object.assign(standardForm, {
+ id: null,
+ standardNo: '',
+ standardName: '',
+ inspectType: '0',
+ processId: null,
+ remark: '',
+ state: '0'
+ });
+ processName.value = '';
+ }
+ standardDialogVisible.value = true;
+};
+
+const closeStandardDialog = () => {
+ standardDialogVisible.value = false;
+};
+
+const submitStandardForm = () => {
+ submitLoading.value = true;
+ const api = standardOperationType.value === 'add' ? qualityTestStandardAdd : qualityTestStandardUpdate;
+ api(standardForm).then(() => {
+ toast('淇濆瓨鎴愬姛');
+ standardDialogVisible.value = false;
+ handleQuery();
+ }).finally(() => {
+ submitLoading.value = false;
+ });
+};
+
+const handleAudit = (row, state) => {
+ const text = state === 1 ? '鎵瑰噯' : '鎾ら攢';
+ showConfirm(`纭${text}璇ユ娴嬫爣鍑嗗悧锛焋).then(res => {
+ if (res.confirm) {
+ qualityTestStandardAudit([{ id: row.id, state }]).then(() => {
+ toast(`${text}鎴愬姛`);
+ handleQuery();
+ });
+ }
+ });
+};
+
+const handleDelete = (row) => {
+ showConfirm('纭鍒犻櫎璇ユ娴嬫爣鍑嗗悧锛�').then(res => {
+ if (res.confirm) {
+ qualityTestStandardDel([row.id]).then(() => {
+ toast('鍒犻櫎鎴愬姛');
+ handleQuery();
+ });
+ }
+ });
+};
+
+const confirmProcess = (e) => {
+ const val = e.value[0];
+ standardForm.processId = val.value;
+ processName.value = val.label;
+ showProcessSelect.value = false;
+};
+
+const goBack = () => {
+ uni.navigateBack();
+};
+
+onMounted(() => {
+ handleQuery();
+ productProcessListPage({ current: 1, size: 1000 }).then(res => {
+ processOptions.value = (res?.data?.records || []).map(p => ({
+ label: p.processName,
+ value: p.id
+ }));
+ });
+});
+</script>
+
+<style lang="scss" scoped>
+.metric-maintenance-page {
+ padding-bottom: 120rpx;
+ background-color: #f5f7fa;
+ min-height: 100vh;
+}
+
+.search-section {
+ padding: 20rpx 30rpx;
+ background-color: #ffffff;
+ position: sticky;
+ top: 0;
+ z-index: 10;
+}
+
+.filter-row {
+ display: flex;
+ justify-content: space-around;
+ padding: 10rpx 0;
+}
+
+.filter-item {
+ display: flex;
+ align-items: center;
+ gap: 10rpx;
+ font-size: 28rpx;
+ color: #606266;
+}
+
+.list-container {
+ padding: 20rpx;
+}
+
+.list-item {
+ background-color: #ffffff;
+ border-radius: 16rpx;
+ padding: 30rpx;
+ margin-bottom: 20rpx;
+ box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05);
+}
+
+.item-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 20rpx;
+}
+
+.standard-no {
+ font-size: 30rpx;
+ font-weight: bold;
+ color: #303133;
+}
+
+.item-content {
+ margin-bottom: 20rpx;
+}
+
+.item-row {
+ display: flex;
+ margin-bottom: 10rpx;
+}
+
+.item-label {
+ color: #909399;
+ width: 160rpx;
+ font-size: 28rpx;
+}
+
+.item-value {
+ flex: 1;
+ color: #303133;
+ font-size: 28rpx;
+}
+
+.item-actions {
+ display: flex;
+ justify-content: flex-end;
+ gap: 20rpx;
+ border-top: 1rpx solid #ebeef5;
+ padding-top: 20rpx;
+}
+
+.pagination-container {
+ padding: 20rpx 0;
+}
+
+.no-data {
+ padding-top: 200rpx;
+}
+
+.fab-button {
+ position: fixed;
+ right: 40rpx;
+ bottom: 60rpx;
+ width: 100rpx;
+ height: 100rpx;
+ background-color: #3c9cff;
+ border-radius: 50%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ box-shadow: 0 4rpx 16rpx rgba(60, 156, 255, 0.4);
+ z-index: 99;
+}
+
+.dialog-content {
+ width: 650rpx;
+ padding: 40rpx;
+ background-color: #ffffff;
+ border-radius: 24rpx;
+ overflow: hidden;
+ box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.08);
+}
+
+.dialog-header {
+ margin-bottom: 30rpx;
+ text-align: center;
+}
+
+.dialog-title {
+ font-size: 32rpx;
+ font-weight: bold;
+ color: #303133;
+}
+
+.dialog-footer {
+ margin-top: 40rpx;
+}
+</style>
diff --git a/src/pages/qualityManagement/nearExpiryReturn/index.vue b/src/pages/qualityManagement/nearExpiryReturn/index.vue
new file mode 100644
index 0000000..fe98cea
--- /dev/null
+++ b/src/pages/qualityManagement/nearExpiryReturn/index.vue
@@ -0,0 +1,404 @@
+<template>
+ <view class="near-expiry-return-page">
+ <PageHeader title="杩戞晥鏈熼��璐�" @back="goBack" />
+
+ <!-- 鎼滅储鍖哄煙 -->
+ <view class="search-section">
+ <up-search
+ placeholder="浜у搧鍚嶇О/鎵规鍙�"
+ v-model="searchForm.keyword"
+ @search="handleQuery"
+ @custom="handleQuery"
+ @clear="handleQuery"
+ :show-action="true"
+ action-text="鎼滅储"
+ :animation="true"
+ ></up-search>
+ </view>
+
+ <!-- 鍒楄〃鍖哄煙 -->
+ <view class="list-container" v-if="tableData.length > 0">
+ <view v-for="(item, index) in tableData" :key="index" class="list-item">
+ <view class="item-header">
+ <text class="product-name">{{ item.productName }}</text>
+ <up-tag :text="getStatusText(item.status)" :type="getStatusType(item.status)" size="mini"></up-tag>
+ </view>
+ <view class="item-content">
+ <view class="item-row">
+ <text class="item-label">鎵规鍙凤細</text>
+ <text class="item-value">{{ item.batchNumber }}</text>
+ </view>
+ <view class="item-row">
+ <text class="item-label">閫�鍥炴暟閲忥細</text>
+ <text class="item-value">{{ item.returnQuantity }}</text>
+ </view>
+ <view class="item-row">
+ <text class="item-label">閫�鍥炴棩鏈燂細</text>
+ <text class="item-value">{{ item.returnDate }}</text>
+ </view>
+ <view class="item-row">
+ <text class="item-label">鍒版湡鏃ユ湡锛�</text>
+ <text class="item-value">{{ item.expiryDate }}</text>
+ </view>
+ </view>
+ <view class="item-actions">
+ <up-button type="primary" size="mini" @click.stop="openDialog('edit', item)">缂栬緫</up-button>
+ <up-button type="error" size="mini" @click.stop="handleDelete(item)">鍒犻櫎</up-button>
+ </view>
+ </view>
+ <view class="pagination-container">
+ <up-loadmore :status="loadStatus" @loadmore="getList" />
+ </view>
+ </view>
+
+ <view v-else class="no-data">
+ <up-empty mode="data" text="鏆傛棤鏁版嵁"></up-empty>
+ </view>
+
+ <!-- 娴姩鏂板鎸夐挳 -->
+ <view class="fab-button" @click="openDialog('add')">
+ <up-icon name="plus" size="24" color="#ffffff"></up-icon>
+ </view>
+
+ <!-- 鏂板/缂栬緫寮圭獥 -->
+ <up-popup v-model:show="dialogVisible" mode="center" round closeable @close="closeDialog">
+ <view class="dialog-content">
+ <view class="dialog-header">
+ <text class="dialog-title">{{ operationType === 'add' ? '鏂板閫�璐у彴璐�' : '淇敼閫�璐у彴璐�' }}</text>
+ </view>
+ <up-form :model="form" ref="formRef" label-width="100" label-position="top">
+ <up-form-item label="浜у搧鍚嶇О" prop="productName" required borderBottom>
+ <up-input v-model="form.productName" placeholder="璇疯緭鍏ヤ骇鍝佸悕绉�" border="surround" />
+ </up-form-item>
+ <up-form-item label="浜у搧瑙勬牸" prop="productSpec" borderBottom>
+ <up-input v-model="form.productSpec" placeholder="璇疯緭鍏ヤ骇鍝佽鏍�" border="surround" />
+ </up-form-item>
+ <up-form-item label="鎵规鍙�" prop="batchNumber" required borderBottom>
+ <up-input v-model="form.batchNumber" placeholder="璇疯緭鍏ユ壒娆″彿" border="surround" />
+ </up-form-item>
+ <up-form-item label="閫�鍥炴暟閲�" prop="returnQuantity" required borderBottom>
+ <up-number-box v-model="form.returnQuantity" :min="1" />
+ </up-form-item>
+ <up-form-item label="閫�鍥炴棩鏈�" prop="returnDate" required borderBottom>
+ <up-input
+ v-model="form.returnDate"
+ placeholder="璇烽�夋嫨閫�鍥炴棩鏈�"
+ border="surround"
+ readonly
+ @click="showDatePicker('returnDate')"
+ />
+ </up-form-item>
+ <up-form-item label="鍒版湡鏃ユ湡" prop="expiryDate" borderBottom>
+ <up-input
+ v-model="form.expiryDate"
+ placeholder="璇烽�夋嫨鍒版湡鏃ユ湡"
+ border="surround"
+ readonly
+ @click="showDatePicker('expiryDate')"
+ />
+ </up-form-item>
+ <up-form-item label="閫�鍥炲師鍥�" prop="returnReason" borderBottom>
+ <up-textarea v-model="form.returnReason" placeholder="璇疯緭鍏ラ��鍥炲師鍥�" count border="surround" />
+ </up-form-item>
+ </up-form>
+ <view class="dialog-footer">
+ <up-button type="primary" text="纭" @click="submitForm" :loading="submitLoading"></up-button>
+ <up-button text="鍙栨秷" @click="closeDialog" customStyle="margin-top: 20rpx"></up-button>
+ </view>
+ </view>
+ </up-popup>
+
+ <!-- 鏃ユ湡閫夋嫨鍣� -->
+ <up-datetime-picker
+ :show="datePickerVisible"
+ v-model="dateValue"
+ mode="date"
+ @confirm="confirmDate"
+ @cancel="datePickerVisible = false"
+ ></up-datetime-picker>
+ </view>
+</template>
+
+<script setup>
+import { ref, reactive, onMounted } from 'vue';
+import {
+ nearExpiryReturnListPage,
+ nearExpiryReturnAdd,
+ nearExpiryReturnUpdate,
+ nearExpiryReturnDel
+} from '@/api/qualityManagement/nearExpiryReturn.js';
+import { toast, showConfirm } from '@/utils/common';
+import dayjs from 'dayjs';
+
+const searchForm = reactive({
+ keyword: ''
+});
+
+const tableData = ref([]);
+const page = reactive({
+ current: 1,
+ size: 20,
+ total: 0
+});
+const loadStatus = ref('loadmore');
+
+const dialogVisible = ref(false);
+const operationType = ref('add');
+const submitLoading = ref(false);
+const form = reactive({
+ id: null,
+ productName: '',
+ productSpec: '',
+ batchNumber: '',
+ returnQuantity: 1,
+ returnDate: '',
+ expiryDate: '',
+ returnReason: '',
+ status: '0'
+});
+
+const datePickerVisible = ref(false);
+const dateValue = ref(Number(new Date()));
+const currentDateField = ref('');
+
+const getStatusText = (status) => {
+ const states = { '0': '寰呭鐞�', '1': '宸插鐞�' };
+ return states[status] || '鏈煡';
+};
+
+const getStatusType = (status) => {
+ const types = { '0': 'warning', '1': 'success' };
+ return types[status] || 'info';
+};
+
+const getList = () => {
+ if (loadStatus.value === 'loading' || (page.total > 0 && tableData.length >= page.total)) return;
+
+ loadStatus.value = 'loading';
+ const params = {
+ productName: searchForm.keyword || null,
+ current: page.current,
+ size: page.size
+ };
+
+ nearExpiryReturnListPage(params).then(res => {
+ const records = res?.data?.records || [];
+ if (page.current === 1) {
+ tableData.value = records;
+ } else {
+ tableData.value = [...tableData.value, ...records];
+ }
+ page.total = res?.data?.total || 0;
+
+ if (tableData.value.length >= page.total) {
+ loadStatus.value = 'nomore';
+ } else {
+ loadStatus.value = 'loadmore';
+ page.current++;
+ }
+ }).catch(() => {
+ loadStatus.value = 'loadmore';
+ });
+};
+
+const handleQuery = () => {
+ page.current = 1;
+ page.total = 0;
+ tableData.value = [];
+ loadStatus.value = 'loadmore';
+ getList();
+};
+
+const openDialog = (type, row) => {
+ operationType.value = type;
+ if (type === 'edit' && row) {
+ Object.assign(form, {
+ id: row.id,
+ productName: row.productName,
+ productSpec: row.productSpec,
+ batchNumber: row.batchNumber,
+ returnQuantity: row.returnQuantity,
+ returnDate: row.returnDate,
+ expiryDate: row.expiryDate,
+ returnReason: row.returnReason,
+ status: String(row.status)
+ });
+ } else {
+ Object.assign(form, {
+ id: null,
+ productName: '',
+ productSpec: '',
+ batchNumber: '',
+ returnQuantity: 1,
+ returnDate: dayjs().format('YYYY-MM-DD'),
+ expiryDate: '',
+ returnReason: '',
+ status: '0'
+ });
+ }
+ dialogVisible.value = true;
+};
+
+const closeDialog = () => {
+ dialogVisible.value = false;
+};
+
+const submitForm = () => {
+ submitLoading.value = true;
+ const api = operationType.value === 'add' ? nearExpiryReturnAdd : nearExpiryReturnUpdate;
+ api(form).then(() => {
+ toast('淇濆瓨鎴愬姛');
+ dialogVisible.value = false;
+ handleQuery();
+ }).finally(() => {
+ submitLoading.value = false;
+ });
+};
+
+const handleDelete = (row) => {
+ showConfirm('纭鍒犻櫎璇ラ��璐у彴璐﹀悧锛�').then(res => {
+ if (res.confirm) {
+ nearExpiryReturnDel([row.id]).then(() => {
+ toast('鍒犻櫎鎴愬姛');
+ handleQuery();
+ });
+ }
+ });
+};
+
+const showDatePicker = (field) => {
+ currentDateField.value = field;
+ dateValue.value = form[field] ? Number(new Date(form[field])) : Number(new Date());
+ datePickerVisible.value = true;
+};
+
+const confirmDate = (e) => {
+ form[currentDateField.value] = dayjs(e.value).format('YYYY-MM-DD');
+ datePickerVisible.value = false;
+};
+
+const goBack = () => {
+ uni.navigateBack();
+};
+
+onMounted(() => {
+ handleQuery();
+});
+</script>
+
+<style lang="scss" scoped>
+.near-expiry-return-page {
+ padding-bottom: 120rpx;
+ background-color: #f5f7fa;
+ min-height: 100vh;
+}
+
+.search-section {
+ padding: 20rpx 30rpx;
+ background-color: #ffffff;
+ position: sticky;
+ top: 0;
+ z-index: 10;
+}
+
+.list-container {
+ padding: 20rpx;
+}
+
+.list-item {
+ background-color: #ffffff;
+ border-radius: 16rpx;
+ padding: 30rpx;
+ margin-bottom: 20rpx;
+ box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05);
+}
+
+.item-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 20rpx;
+}
+
+.product-name {
+ font-size: 30rpx;
+ font-weight: bold;
+ color: #303133;
+}
+
+.item-content {
+ margin-bottom: 20rpx;
+}
+
+.item-row {
+ display: flex;
+ margin-bottom: 10rpx;
+}
+
+.item-label {
+ color: #909399;
+ width: 160rpx;
+ font-size: 28rpx;
+}
+
+.item-value {
+ flex: 1;
+ color: #303133;
+ font-size: 28rpx;
+}
+
+.item-actions {
+ display: flex;
+ justify-content: flex-end;
+ gap: 20rpx;
+ border-top: 1rpx solid #ebeef5;
+ padding-top: 20rpx;
+}
+
+.pagination-container {
+ padding: 20rpx 0;
+}
+
+.no-data {
+ padding-top: 200rpx;
+}
+
+.fab-button {
+ position: fixed;
+ right: 40rpx;
+ bottom: 60rpx;
+ width: 100rpx;
+ height: 100rpx;
+ background-color: #3c9cff;
+ border-radius: 50%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ box-shadow: 0 4rpx 16rpx rgba(60, 156, 255, 0.4);
+ z-index: 99;
+}
+
+.dialog-content {
+ width: 650rpx;
+ padding: 40rpx;
+ background-color: #ffffff;
+ border-radius: 24rpx;
+ overflow: hidden;
+ box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.08);
+}
+
+.dialog-header {
+ margin-bottom: 30rpx;
+ text-align: center;
+}
+
+.dialog-title {
+ font-size: 32rpx;
+ font-weight: bold;
+ color: #303133;
+}
+
+.dialog-footer {
+ margin-top: 40rpx;
+}
+</style>
diff --git a/src/pages/qualityManagement/nonconformingManagement/index.vue b/src/pages/qualityManagement/nonconformingManagement/index.vue
new file mode 100644
index 0000000..5efa7ae
--- /dev/null
+++ b/src/pages/qualityManagement/nonconformingManagement/index.vue
@@ -0,0 +1,434 @@
+<template>
+ <view class="nonconforming-management-page">
+ <PageHeader title="涓嶅悎鏍煎搧绠$悊" @back="goBack" />
+
+ <!-- 鎼滅储涓庣瓫閫� -->
+ <view class="search-section">
+ <up-search
+ placeholder="璇疯緭鍏ヤ骇鍝佸悕绉版悳绱�"
+ v-model="searchForm.productName"
+ @search="handleQuery"
+ @custom="handleQuery"
+ @clear="handleQuery"
+ :show-action="true"
+ action-text="鎼滅储"
+ :animation="true"
+ customStyle="margin-bottom: 20rpx"
+ ></up-search>
+ <view class="filter-row">
+ <view class="filter-item" @click="showTypeSelect = true">
+ <text>{{ typeLabel }}</text>
+ <up-icon name="arrow-down" size="14" color="#999"></up-icon>
+ </view>
+ <view class="filter-item" @click="showStatusSelect = true">
+ <text>{{ statusLabel }}</text>
+ <up-icon name="arrow-down" size="14" color="#999"></up-icon>
+ </view>
+ </view>
+ </view>
+
+ <!-- 鍒楄〃鍖哄煙 -->
+ <view class="list-container" v-if="tableData.length > 0">
+ <view v-for="(item, index) in tableData" :key="index" class="list-item">
+ <view class="item-header">
+ <text class="product-name">{{ item.productName }}</text>
+ <up-tag :text="getStatusText(item.inspectState)" :type="getStatusType(item.inspectState)" size="mini"></up-tag>
+ </view>
+ <view class="item-content">
+ <view class="item-row">
+ <text class="item-label">绫诲埆锛�</text>
+ <text class="item-value">{{ getInspectTypeText(item.inspectType) }}</text>
+ </view>
+ <view class="item-row">
+ <text class="item-label">妫�娴嬫棩鏈燂細</text>
+ <text class="item-value">{{ item.checkTime || '-' }}</text>
+ </view>
+ <view class="item-row">
+ <text class="item-label">瑙勬牸鍨嬪彿锛�</text>
+ <text class="item-value">{{ item.model || '-' }}</text>
+ </view>
+ <view class="item-row">
+ <text class="item-label">涓嶅悎鏍肩幇璞★細</text>
+ <text class="item-value text-error">{{ item.defectivePhenomena || '-' }}</text>
+ </view>
+ <view class="item-row" v-if="item.inspectState === 1">
+ <text class="item-label">澶勭悊缁撴灉锛�</text>
+ <text class="item-value text-success">{{ item.dealResult || '-' }}</text>
+ </view>
+ </view>
+ <view class="item-actions">
+ <up-button v-if="item.inspectState === 0" type="primary" size="mini" @click.stop="openDealDialog(item)">澶勭悊</up-button>
+ <up-button type="error" size="mini" @click.stop="handleDelete(item)">鍒犻櫎</up-button>
+ </view>
+ </view>
+ <view class="pagination-container">
+ <up-loadmore :status="loadStatus" @loadmore="getList" />
+ </view>
+ </view>
+
+ <view v-else class="no-data">
+ <up-empty mode="data" text="鏆傛棤鏁版嵁"></up-empty>
+ </view>
+
+ <!-- 绫诲瀷閫夋嫨鍣� -->
+ <up-action-sheet
+ :actions="typeActions"
+ :show="showTypeSelect"
+ @close="showTypeSelect = false"
+ @select="selectType"
+ title="璇烽�夋嫨绫诲埆"
+ ></up-action-sheet>
+
+ <!-- 鐘舵�侀�夋嫨鍣� -->
+ <up-action-sheet
+ :actions="statusActions"
+ :show="showStatusSelect"
+ @close="showStatusSelect = false"
+ @select="selectStatus"
+ title="璇烽�夋嫨鐘舵��"
+ ></up-action-sheet>
+
+ <!-- 澶勭悊寮圭獥 -->
+ <up-popup v-model:show="dealDialogVisible" mode="center" round closeable @close="dealDialogVisible = false">
+ <view class="dialog-content">
+ <view class="dialog-header">
+ <text class="dialog-title">涓嶅悎鏍煎搧澶勭悊</text>
+ </view>
+ <up-form :model="dealForm" ref="dealFormRef" label-width="100" label-position="top">
+ <view class="info-summary">
+ <text class="summary-text">浜у搧锛歿{ currentItem?.productName }}</text>
+ <text class="summary-text">涓嶅悎鏍肩幇璞★細{{ currentItem?.defectivePhenomena }}</text>
+ </view>
+ <up-form-item label="澶勭悊缁撴灉" prop="dealResult" required borderBottom>
+ <up-textarea v-model="dealForm.dealResult" placeholder="璇疯緭鍏ュ鐞嗙粨鏋�" count border="surround" />
+ </up-form-item>
+ <up-form-item label="澶勭悊鏃ユ湡" prop="dealTime" required borderBottom>
+ <up-input
+ v-model="dealForm.dealTime"
+ placeholder="璇烽�夋嫨澶勭悊鏃ユ湡"
+ border="surround"
+ readonly
+ @click="showDatePicker = true"
+ />
+ </up-form-item>
+ </up-form>
+ <view class="dialog-footer">
+ <up-button type="primary" text="鎻愪氦澶勭悊" @click="submitDeal" :loading="submitLoading"></up-button>
+ <up-button text="鍙栨秷" @click="dealDialogVisible = false" customStyle="margin-top: 20rpx"></up-button>
+ </view>
+ </view>
+ </up-popup>
+
+ <!-- 鏃ユ湡閫夋嫨鍣� -->
+ <up-datetime-picker
+ :show="showDatePicker"
+ v-model="dateValue"
+ mode="date"
+ @confirm="confirmDate"
+ @cancel="showDatePicker = false"
+ ></up-datetime-picker>
+ </view>
+</template>
+
+<script setup>
+import { ref, reactive, onMounted, computed } from 'vue';
+import {
+ qualityUnqualifiedListPage,
+ qualityUnqualifiedDeal,
+ qualityUnqualifiedDel
+} from '@/api/qualityManagement/nonconformingManagement.js';
+import { toast, showConfirm } from '@/utils/common';
+import dayjs from 'dayjs';
+
+const searchForm = reactive({
+ productName: '',
+ inspectType: '',
+ inspectState: ''
+});
+
+const tableData = ref([]);
+const page = reactive({
+ current: 1,
+ size: 20,
+ total: 0
+});
+const loadStatus = ref('loadmore');
+
+const showTypeSelect = ref(false);
+const typeActions = [
+ { name: '鍏ㄩ儴', value: '' },
+ { name: '鍏ュ巶妫�', value: '0' },
+ { name: '杞﹂棿妫�', value: '1' },
+ { name: '鍑哄巶妫�', value: '2' }
+];
+const typeLabel = computed(() => {
+ const action = typeActions.find(a => a.value === searchForm.inspectType);
+ return action ? action.name : '鍏ㄩ儴绫诲埆';
+});
+
+const showStatusSelect = ref(false);
+const statusActions = [
+ { name: '鍏ㄩ儴', value: '' },
+ { name: '寰呭鐞�', value: '0' },
+ { name: '宸插鐞�', value: '1' }
+];
+const statusLabel = computed(() => {
+ const action = statusActions.find(a => a.value === searchForm.inspectState);
+ return action ? action.name : '鍏ㄩ儴鐘舵��';
+});
+
+const dealDialogVisible = ref(false);
+const submitLoading = ref(false);
+const currentItem = ref(null);
+const dealForm = reactive({
+ id: null,
+ dealResult: '',
+ dealTime: dayjs().format('YYYY-MM-DD')
+});
+
+const showDatePicker = ref(false);
+const dateValue = ref(Number(new Date()));
+
+const getInspectTypeText = (type) => {
+ const types = { '0': '鍏ュ巶妫�', '1': '杞﹂棿妫�', '2': '鍑哄巶妫�' };
+ return types[type] || '-';
+};
+
+const getStatusText = (state) => {
+ return state === 1 ? '宸插鐞�' : '寰呭鐞�';
+};
+
+const getStatusType = (state) => {
+ return state === 1 ? 'success' : 'warning';
+};
+
+const getList = () => {
+ if (loadStatus.value === 'loading' || (page.total > 0 && tableData.value.length >= page.total)) return;
+
+ loadStatus.value = 'loading';
+ const params = {
+ productName: searchForm.productName || null,
+ inspectType: searchForm.inspectType || null,
+ inspectState: searchForm.inspectState || null,
+ current: page.current,
+ size: page.size
+ };
+
+ qualityUnqualifiedListPage(params).then(res => {
+ const records = res?.data?.records || [];
+ if (page.current === 1) {
+ tableData.value = records;
+ } else {
+ tableData.value = [...tableData.value, ...records];
+ }
+ page.total = res?.data?.total || 0;
+
+ if (tableData.value.length >= page.total) {
+ loadStatus.value = 'nomore';
+ } else {
+ loadStatus.value = 'loadmore';
+ page.current++;
+ }
+ }).catch(() => {
+ loadStatus.value = 'loadmore';
+ });
+};
+
+const handleQuery = () => {
+ page.current = 1;
+ page.total = 0;
+ tableData.value = [];
+ loadStatus.value = 'loadmore';
+ getList();
+};
+
+const selectType = (e) => {
+ searchForm.inspectType = e.value;
+ handleQuery();
+};
+
+const selectStatus = (e) => {
+ searchForm.inspectState = e.value;
+ handleQuery();
+};
+
+const openDealDialog = (item) => {
+ currentItem.value = item;
+ dealForm.id = item.id;
+ dealForm.dealResult = '';
+ dealForm.dealTime = dayjs().format('YYYY-MM-DD');
+ dealDialogVisible.value = true;
+};
+
+const submitDeal = () => {
+ if (!dealForm.dealResult) {
+ toast('璇疯緭鍏ュ鐞嗙粨鏋�');
+ return;
+ }
+ submitLoading.value = true;
+ qualityUnqualifiedDeal(dealForm).then(() => {
+ toast('澶勭悊鎴愬姛');
+ dealDialogVisible.value = false;
+ handleQuery();
+ }).finally(() => {
+ submitLoading.value = false;
+ });
+};
+
+const handleDelete = (row) => {
+ showConfirm('纭鍒犻櫎璇ヤ笉鍚堟牸璁板綍鍚楋紵').then(res => {
+ if (res.confirm) {
+ qualityUnqualifiedDel([row.id]).then(() => {
+ toast('鍒犻櫎鎴愬姛');
+ handleQuery();
+ });
+ }
+ });
+};
+
+const confirmDate = (e) => {
+ dealForm.dealTime = dayjs(e.value).format('YYYY-MM-DD');
+ showDatePicker.value = false;
+};
+
+const goBack = () => {
+ uni.navigateBack();
+};
+
+onMounted(() => {
+ handleQuery();
+});
+</script>
+
+<style lang="scss" scoped>
+.nonconforming-management-page {
+ padding-bottom: 20rpx;
+ background-color: #f5f7fa;
+ min-height: 100vh;
+}
+
+.search-section {
+ padding: 20rpx 30rpx;
+ background-color: #ffffff;
+ position: sticky;
+ top: 0;
+ z-index: 10;
+}
+
+.filter-row {
+ display: flex;
+ justify-content: space-around;
+ padding: 10rpx 0;
+}
+
+.filter-item {
+ display: flex;
+ align-items: center;
+ gap: 10rpx;
+ font-size: 28rpx;
+ color: #606266;
+}
+
+.list-container {
+ padding: 20rpx;
+}
+
+.list-item {
+ background-color: #ffffff;
+ border-radius: 16rpx;
+ padding: 30rpx;
+ margin-bottom: 20rpx;
+ box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05);
+}
+
+.item-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 20rpx;
+}
+
+.product-name {
+ font-size: 30rpx;
+ font-weight: bold;
+ color: #303133;
+}
+
+.item-content {
+ margin-bottom: 20rpx;
+}
+
+.item-row {
+ display: flex;
+ margin-bottom: 10rpx;
+}
+
+.item-label {
+ color: #909399;
+ width: 180rpx;
+ font-size: 28rpx;
+}
+
+.item-value {
+ flex: 1;
+ color: #303133;
+ font-size: 28rpx;
+}
+
+.text-error {
+ color: #f56c6c;
+}
+
+.text-success {
+ color: #67c23a;
+}
+
+.item-actions {
+ display: flex;
+ justify-content: flex-end;
+ gap: 20rpx;
+ border-top: 1rpx solid #ebeef5;
+ padding-top: 20rpx;
+}
+
+.no-data {
+ padding-top: 200rpx;
+}
+
+.dialog-content {
+ width: 650rpx;
+ padding: 40rpx;
+ background-color: #ffffff;
+ border-radius: 24rpx;
+ overflow: hidden;
+ box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.08);
+}
+
+.dialog-header {
+ margin-bottom: 30rpx;
+ text-align: center;
+}
+
+.dialog-title {
+ font-size: 32rpx;
+ font-weight: bold;
+}
+
+.info-summary {
+ background-color: #f5f7fa;
+ padding: 20rpx;
+ border-radius: 8rpx;
+ margin-bottom: 30rpx;
+}
+
+.summary-text {
+ display: block;
+ font-size: 26rpx;
+ color: #606266;
+ margin-bottom: 10rpx;
+}
+
+.dialog-footer {
+ margin-top: 40rpx;
+}
+</style>
diff --git a/src/pages/qualityManagement/processInspection/add.vue b/src/pages/qualityManagement/processInspection/add.vue
new file mode 100644
index 0000000..87a3feb
--- /dev/null
+++ b/src/pages/qualityManagement/processInspection/add.vue
@@ -0,0 +1,1128 @@
+<template>
+ <view class="material-inspection-add">
+ <!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 -->
+ <PageHeader :title="isEdit ? '缂栬緫杩囩▼妫�楠�' : '鏂板杩囩▼妫�楠�'"
+ @back="goBack" />
+ <!-- 琛ㄥ崟鍐呭 -->
+ <up-form :model="form"
+ ref="formRef"
+ label-width="110"
+ :rules="rules">
+ <!-- 鍩烘湰淇℃伅 -->
+ <up-form-item label="宸ュ簭"
+ prop="process"
+ required
+ border-bottom>
+ <up-input v-model="form.process"
+ placeholder="璇烽�夋嫨宸ュ簭"
+ readonly
+ :disabled="processQuantityDisabled" />
+ <template #right>
+ <up-icon @click="showprocessSheet = true"
+ name="arrow-right" />
+ </template>
+ </up-form-item>
+ <up-form-item label="浜у搧鍚嶇О"
+ prop="productId"
+ required
+ border-bottom>
+ <up-input v-model="form.productName"
+ placeholder="璇烽�夋嫨浜у搧"
+ readonly
+ @click="showProductTree = true"
+ :disabled="isEdit" />
+ <template #right>
+ <up-icon @click="showProductTree = true"
+ name="arrow-right" />
+ </template>
+ </up-form-item>
+ <up-form-item label="瑙勬牸鍨嬪彿"
+ prop="productModelId"
+ required
+ border-bottom>
+ <up-input v-model="form.model"
+ placeholder="璇烽�夋嫨瑙勬牸鍨嬪彿"
+ readonly
+ :disabled="isEdit" />
+ <template #right>
+ <up-icon @click="showModelSheet = true"
+ name="arrow-right" />
+ </template>
+ </up-form-item>
+ <up-form-item label="鎸囨爣閫夋嫨"
+ prop="testStandardId"
+ border-bottom>
+ <up-input v-model="testStandardDisplay"
+ placeholder="璇烽�夋嫨鎸囨爣"
+ readonly />
+ <template #right>
+ <up-icon @click="openTestStandardSheet"
+ name="arrow-right" />
+ </template>
+ </up-form-item>
+ <up-form-item label="鍗曚綅"
+ prop="unit"
+ border-bottom>
+ <up-input v-model="form.unit"
+ placeholder="璇疯緭鍏ュ崟浣�"
+ disabled />
+ </up-form-item>
+ <up-form-item label="鏁伴噺"
+ prop="quantity"
+ required
+ border-bottom>
+ <up-input v-model="form.quantity"
+ type="number"
+ placeholder="璇疯緭鍏ユ暟閲�"
+ :disabled="processQuantityDisabled" />
+ </up-form-item>
+ <up-form-item label="妫�娴嬪崟浣�"
+ prop="checkCompany"
+ border-bottom>
+ <up-input v-model="form.checkCompany"
+ placeholder="璇疯緭鍏ユ娴嬪崟浣�"
+ clearable />
+ </up-form-item>
+ <up-form-item label="妫�娴嬬粨鏋�"
+ prop="checkResult"
+ required
+ border-bottom>
+ <up-input v-model="form.checkResult"
+ placeholder="璇烽�夋嫨妫�娴嬬粨鏋�"
+ readonly
+ @click="showResultSheet" />
+ <template #right>
+ <up-icon @click="showResultSheet = true"
+ name="arrow-right" />
+ </template>
+ </up-form-item>
+ <up-form-item label="妫�楠屽憳"
+ prop="checkName"
+ border-bottom>
+ <up-input v-model="form.checkName"
+ placeholder="璇烽�夋嫨妫�楠屽憳"
+ readonly
+ @click="showInspectorSheet" />
+ <template #right>
+ <up-icon @click="showInspectorSheet = true"
+ name="arrow-right" />
+ </template>
+ </up-form-item>
+ <up-form-item label="妫�娴嬫棩鏈�"
+ prop="checkTime"
+ required
+ border-bottom>
+ <up-input v-model="form.checkTime"
+ placeholder="璇烽�夋嫨妫�娴嬫棩鏈�"
+ readonly />
+ <!-- <template #right>
+ <up-icon name="calendar"
+ @click="showDatePicker"></up-icon>
+ </template> -->
+ </up-form-item>
+ <!-- 妫�楠岄」鐩� -->
+ <view class="inspection-items-container">
+ <view class="steps-header">
+ <text class="steps-title">妫�楠岄」鐩�</text>
+ <text class="steps-count">鍏� {{ tableData.length }} 涓」鐩�</text>
+ </view>
+ <view class="steps-list">
+ <view v-for="(item, index) in tableData"
+ :key="index"
+ class="exec-step-item">
+ <view class="step-number">
+ {{ index + 1 }}
+ </view>
+ <view class="step-content">
+ <view class="step-row">
+ <text class="step-label">鎸囨爣锛�</text>
+ <text class="step-value">{{ item.parameterItem }}</text>
+ </view>
+ <view class="step-row">
+ <text class="step-label">鍗曚綅锛�</text>
+ <text class="step-value">{{ item.unit }}</text>
+ </view>
+ <view class="step-row">
+ <text class="step-label">鏍囧噯鍊硷細</text>
+ <text class="step-value">{{ item.standardValue }}</text>
+ </view>
+ <view class="step-row">
+ <text class="step-label">鍐呮帶鍊硷細</text>
+ <text class="step-value">{{ item.controlValue }}</text>
+ </view>
+ <view class="step-row">
+ <text class="step-label">妫�楠屽�硷細</text>
+ <up-input v-model="item.testValue"
+ placeholder="璇疯緭鍏ユ楠屽��"
+ clearable
+ border-bottom
+ class="step-input" />
+ </view>
+ </view>
+ </view>
+ <view v-if="tableData.length === 0"
+ class="empty-data">
+ <text>璇峰厛閫夋嫨鎸囨爣</text>
+ </view>
+ </view>
+ </view>
+ </up-form>
+ <!-- 搴曢儴鎸夐挳 -->
+ <view class="bottom-buttons">
+ <up-button type="default"
+ size="default"
+ @click="goBack"
+ class="bottom-btn">
+ 鍙栨秷
+ </up-button>
+ <up-button type="primary"
+ size="default"
+ @click="submitForm"
+ :loading="loading"
+ class="bottom-btn">
+ {{ isEdit ? '淇濆瓨' : '鎻愪氦' }}
+ </up-button>
+ </view>
+ <!-- 鏃ユ湡閫夋嫨鍣� -->
+ <up-popup v-model:show="showDate"
+ mode="date"
+ :start-year="2020"
+ :end-year="2030"
+ @confirm="confirmDate" />
+ <!-- 宸ュ簭閫夋嫨 -->
+ <up-action-sheet :show="showprocessSheet"
+ :actions="processOptions"
+ @select="selectprocess"
+ @close="showprocessSheet = false"
+ title="閫夋嫨宸ュ簭" />
+ <!-- 浜у搧閫夋嫨 -->
+ <up-action-sheet :show="showProductSheet"
+ :actions="productSheetOptions"
+ @select="selectProduct"
+ @close="showProductSheet = false"
+ title="閫夋嫨浜у搧" />
+ <!-- 瑙勬牸鍨嬪彿閫夋嫨 -->
+ <up-action-sheet :show="showModelSheet"
+ :actions="modelSheetOptions"
+ @select="selectModel"
+ @close="showModelSheet = false"
+ title="閫夋嫨瑙勬牸鍨嬪彿" />
+ <!-- 妫�娴嬬粨鏋滈�夋嫨 -->
+ <up-action-sheet :show="showResultSheet"
+ :actions="resultSheetOptions"
+ @select="selectResult"
+ @close="showResultSheet = false"
+ title="閫夋嫨妫�娴嬬粨鏋�" />
+ <!-- 妫�楠屽憳閫夋嫨 -->
+ <up-action-sheet :show="showInspectorSheet"
+ :actions="userSheetOptions"
+ @select="selectInspector"
+ @close="showInspectorSheet = false"
+ title="閫夋嫨妫�楠屽憳" />
+ <!-- 鎸囨爣閫夋嫨 -->
+ <up-action-sheet :show="showTestStandardSheet"
+ :actions="testStandardSheetOptions"
+ @select="selectTestStandard"
+ @close="showTestStandardSheet = false"
+ title="閫夋嫨鎸囨爣" />
+ <!-- 浜у搧鏍戝舰閫夋嫨鍣� -->
+ <up-popup v-model:show="showProductTree"
+ position="bottom"
+ :round="true"
+ :closeable="true"
+ @close="showProductTree = false">
+ <view class="tree-selector">
+ <view class="tree-header">
+ <text class="tree-title">閫夋嫨浜у搧</text>
+ </view>
+ <view class="tree-content">
+ <view class="tree-node"
+ v-for="(node, index) in productOptions"
+ :key="index">
+ <view v-if="node.children && node.children.length > 0"
+ class="tree-node-header"
+ @click="toggleNode(node)">
+ <up-icon :name="node.expanded ? 'arrow-down' : 'arrow-right'"
+ class="tree-node-icon" />
+ <text class="tree-node-label">{{ node.label }}</text>
+ </view>
+ <view v-else
+ class="tree-node-header"
+ @click="selectTreeNode(node)">
+ <text class="tree-node-icon-placeholder"></text>
+ <text class="tree-node-label">{{ node.label }}</text>
+ <up-icon name="checkmark"
+ v-if="form.productId == node.value"
+ class="tree-node-check" />
+ </view>
+ <view v-if="node.children && node.children.length > 0 && node.expanded"
+ class="tree-node-children">
+ <view class="tree-node"
+ v-for="(child, childIndex) in node.children"
+ :key="childIndex">
+ <view v-if="child.children && child.children.length > 0"
+ class="tree-node-header"
+ @click="toggleNode(child)">
+ <up-icon :name="child.expanded ? 'arrow-down' : 'arrow-right'"
+ class="tree-node-icon" />
+ <text class="tree-node-label">{{ child.label }}</text>
+ </view>
+ <view v-else
+ class="tree-node-header"
+ @click="selectTreeNode(child)">
+ <text class="tree-node-icon-placeholder"></text>
+ <text class="tree-node-label">{{ child.label }}</text>
+ <up-icon name="checkmark"
+ v-if="form.productId == child.value"
+ class="tree-node-check" />
+ </view>
+ <view v-if="child.children && child.children.length > 0 && child.expanded"
+ class="tree-node-children">
+ <view class="tree-node"
+ v-for="(grandchild, grandchildIndex) in child.children"
+ :key="grandchildIndex">
+ <view class="tree-node-header"
+ @click="selectTreeNode(grandchild)">
+ <text class="tree-node-icon-placeholder"></text>
+ <text class="tree-node-label">{{ grandchild.label }}</text>
+ <up-icon name="checkmark"
+ v-if="form.productId == grandchild.value"
+ class="tree-node-check" />
+ </view>
+ </view>
+ </view>
+ </view>
+ </view>
+ </view>
+ </view>
+ </view>
+ </up-popup>
+ </view>
+</template>
+
+<script setup>
+ import { ref, computed, onMounted, nextTick } from "vue";
+ import { onShow } from "@dcloudio/uni-app";
+ import PageHeader from "@/components/PageHeader.vue";
+ import dayjs from "dayjs";
+ import { getOptions } from "@/api/procurementManagement/procurementLedger.js";
+ import { modelList, productTreeList } from "@/api/basicData/product.js";
+ import {
+ qualityInspectAdd,
+ qualityInspectUpdate,
+ qualityInspectParamInfo,
+ qualityInspectDetailByProductId,
+ getQualityTestStandardParamByTestStandardId,
+ list,
+ } from "@/api/qualityManagement/materialInspection.js";
+ import { userListNoPage } from "@/api/system/user.js";
+
+ // 鏄剧ず鎻愮ず淇℃伅
+ const showToast = message => {
+ uni.showToast({
+ title: message,
+ icon: "none",
+ });
+ };
+
+ // 琛ㄥ崟寮曠敤
+ const formRef = ref(null);
+ // 鍔犺浇鐘舵��
+ const loading = ref(false);
+ // 鏃ユ湡閫夋嫨鍣�
+ const showDate = ref(false);
+ // 宸ュ簭閫夋嫨
+ const showprocessSheet = ref(false);
+ // 浜у搧閫夋嫨
+ const showProductSheet = ref(false);
+ // 浜у搧鏍戝舰閫夋嫨鍣�
+ const showProductTree = ref(false);
+ // 瑙勬牸鍨嬪彿閫夋嫨
+ const showModelSheet = ref(false);
+ // 妫�娴嬬粨鏋滈�夋嫨
+ const showResultSheet = ref(false);
+ // 妫�楠屽憳閫夋嫨
+ const showInspectorSheet = ref(false);
+ // 鎸囨爣閫夋嫨
+ const showTestStandardSheet = ref(false);
+
+ // 琛ㄥ崟鏁版嵁
+ const form = ref({
+ checkTime: dayjs().format("YYYY-MM-DD"),
+ process: "",
+ checkName: "",
+ productName: "",
+ productId: "",
+ productModelId: "",
+ model: "",
+ testStandardId: "",
+ unit: "",
+ quantity: "",
+ checkCompany: "",
+ checkResult: "",
+ productMainId: null,
+ purchaseLedgerId: null,
+ });
+
+ // 鏄剧ず鐢ㄧ殑鍙橀噺
+ const testStandardDisplay = ref("");
+
+ // 妫�楠岄」鐩�
+ const tableData = ref([]);
+ const tableLoading = ref(false);
+
+ // 宸ュ簭鍒楄〃
+ const processList = ref([]);
+ // 浜у搧閫夐」
+ const productOptions = ref([]);
+ // 鍨嬪彿閫夐」
+ const modelOptions = ref([]);
+ // 妫�楠屽憳鍒楄〃
+ const userList = ref([]);
+ // 妫�娴嬬粨鏋滈�夐」
+ const resultOptions = ref([
+ { label: "鍚堟牸", value: "鍚堟牸" },
+ { label: "涓嶅悎鏍�", value: "涓嶅悎鏍�" },
+ ]);
+ // 鎸囨爣閫夐」
+ const testStandardOptions = ref([]);
+ // 褰撳墠浜у搧ID
+ const currentProductId = ref(0);
+
+ // ActionSheet閫夐」
+ const processOptions = computed(() => {
+ return processList.value.map(item => ({
+ name: item.name,
+ value: item.name,
+ }));
+ });
+
+ const productSheetOptions = computed(() => {
+ return productOptions.value.map(item => ({
+ name: item.label,
+ value: item.value,
+ }));
+ });
+
+ const modelSheetOptions = computed(() => {
+ return modelOptions.value.map(item => ({
+ name: item.model,
+ value: item.id,
+ }));
+ });
+
+ const resultSheetOptions = computed(() => {
+ return resultOptions.value.map(item => ({
+ name: item.label,
+ value: item.value,
+ }));
+ });
+
+ const userSheetOptions = computed(() => {
+ return userList.value.map(item => ({
+ name: item.nickName,
+ value: item.nickName,
+ }));
+ });
+
+ const testStandardSheetOptions = computed(() => {
+ return testStandardOptions.value.map(item => ({
+ name: item.standardName || item.standardNo,
+ value: item.id,
+ }));
+ });
+
+ // 琛ㄥ崟楠岃瘉瑙勫垯
+ const rules = {
+ checkTime: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ process: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ checkName: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+ productId: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ productModelId: [
+ { required: true, message: "璇烽�夋嫨浜у搧鍨嬪彿", trigger: "change" },
+ ],
+ testStandardId: [
+ { required: false, message: "璇烽�夋嫨鎸囨爣", trigger: "change" },
+ ],
+ unit: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+ quantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ checkCompany: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+ checkResult: [
+ { required: true, message: "璇烽�夋嫨妫�娴嬬粨鏋�", trigger: "change" },
+ ],
+ };
+
+ // 鏄惁涓虹紪杈戞ā寮�
+ const isEdit = computed(() => {
+ const id = getPageId();
+ return !!id;
+ });
+
+ // 缂栬緫鏃讹細productMainId 鎴� purchaseLedgerId 浠讳竴鏈夊�煎垯宸ュ簭銆佹暟閲忕疆鐏�
+ const processQuantityDisabled = computed(() => {
+ const v = form.value || {};
+ return !!(v.productMainId != null || v.purchaseLedgerId != null);
+ });
+
+ // 鑾峰彇椤甸潰ID
+ const getPageId = () => {
+ const pages = getCurrentPages();
+ const currentPage = pages[pages.length - 1];
+ return currentPage.options.id;
+ };
+
+ // 杩斿洖涓婁竴椤�
+ const goBack = () => {
+ uni.navigateBack();
+ };
+
+ // 鏄剧ず鏃ユ湡閫夋嫨鍣�
+ const showDatePicker = () => {
+ showDate.value = true;
+ };
+
+ // 纭鏃ユ湡閫夋嫨
+ const confirmDate = e => {
+ form.value.checkTime = dayjs(e.value).format("YYYY-MM-DD");
+ };
+
+ // 閫夋嫨宸ュ簭
+ const selectprocess = e => {
+ form.value.process = e.value;
+ showprocessSheet.value = false;
+ };
+
+ // 閫夋嫨浜у搧
+ const selectProduct = e => {
+ form.value.productId = e.value;
+ form.value.productName = e.name;
+ showProductSheet.value = false;
+ getModels(e.value);
+ };
+
+ // 鍒囨崲鏍戝舰鑺傜偣灞曞紑/鎶樺彔
+ const toggleNode = node => {
+ node.expanded = !node.expanded;
+ };
+
+ // 閫夋嫨鏍戝舰鑺傜偣
+ const selectTreeNode = node => {
+ // 纭繚鍙�夋嫨鏈鑺傜偣
+ if (!node.children || node.children.length == 0) {
+ form.value.productId = node.value;
+ form.value.productName = node.label;
+ showProductTree.value = false;
+ getModels(node.value);
+ }
+ };
+
+ // 杞崲浜у搧鏍戠粨鏋�
+ function convertIdToValue(data) {
+ return data.map(item => {
+ const { id, children, ...rest } = item;
+ const newItem = {
+ ...rest,
+ value: id, // 灏� id 鏀逛负 value
+ };
+ if (children && children.length > 0) {
+ newItem.children = convertIdToValue(children);
+ }
+
+ return newItem;
+ });
+ }
+
+ // 鏍规嵁ID鏌ユ壘鑺傜偣
+ const findNodeById = (nodes, productId) => {
+ for (let i = 0; i < nodes.length; i++) {
+ if (nodes[i].value === productId) {
+ return nodes[i].label; // 鎵惧埌鑺傜偣锛岃繑鍥炶鑺傜偣
+ }
+ if (nodes[i].children && nodes[i].children.length > 0) {
+ const foundNode = findNodeById(nodes[i].children, productId);
+ if (foundNode) {
+ return foundNode; // 鍦ㄥ瓙鑺傜偣涓壘鍒帮紝杩斿洖璇ヨ妭鐐�
+ }
+ }
+ }
+ return null; // 娌℃湁鎵惧埌鑺傜偣锛岃繑鍥瀗ull
+ };
+
+ // 閫夋嫨瑙勬牸鍨嬪彿
+ const selectModel = e => {
+ form.value.productModelId = e.value;
+ showModelSheet.value = false;
+ handleChangeModel(e.value);
+ };
+
+ // 澶勭悊鍨嬪彿鍙樺寲
+ const handleChangeModel = value => {
+ form.value.model =
+ modelOptions.value.find(item => item.id == value)?.model || "";
+ form.value.unit =
+ modelOptions.value.find(item => item.id == value)?.unit || "";
+ };
+
+ // 閫夋嫨妫�娴嬬粨鏋�
+ const selectResult = e => {
+ form.value.checkResult = e.value;
+ showResultSheet.value = false;
+ };
+
+ // 閫夋嫨妫�楠屽憳
+ const selectInspector = e => {
+ form.value.checkName = e.value;
+ showInspectorSheet.value = false;
+ };
+
+ // 閫夋嫨鎸囨爣
+ const selectTestStandard = e => {
+ form.value.testStandardId = e.value;
+ testStandardDisplay.value = e.name;
+ showTestStandardSheet.value = false;
+ handleTestStandardChange(e.value);
+ };
+
+ // 鎸囨爣閫夋嫨鍙樺寲澶勭悊
+ const handleTestStandardChange = testStandardId => {
+ if (!testStandardId) {
+ tableData.value = [];
+ return;
+ }
+ tableLoading.value = true;
+ getQualityTestStandardParamByTestStandardId(testStandardId)
+ .then(res => {
+ tableData.value = res.data || [];
+ })
+ .catch(error => {
+ console.error("鑾峰彇鏍囧噯鍙傛暟澶辫触:", error);
+ tableData.value = [];
+ })
+ .finally(() => {
+ tableLoading.value = false;
+ });
+ };
+ const openTestStandardSheet = () => {
+ console.log("openTestStandardSheet");
+ showTestStandardSheet.value = true;
+ };
+
+ // 鑾峰彇宸ュ簭鍒楄〃
+ const getprocessList = () => {
+ list().then(res => {
+ processList.value = res.data;
+ });
+ };
+
+ // 鑾峰彇浜у搧閫夐」
+ const getProductOptions = () => {
+ return productTreeList().then(res => {
+ productOptions.value = convertIdToValue(res);
+ return productOptions.value;
+ });
+ };
+
+ // 鑾峰彇鐢ㄦ埛鍒楄〃
+ const getUserList = async () => {
+ try {
+ const userRes = await userListNoPage();
+ userList.value = userRes.data || [];
+ } catch (e) {
+ console.error("鍔犺浇妫�楠屽憳鍒楄〃澶辫触", e);
+ userList.value = [];
+ }
+ };
+
+ // 鑾峰彇鍨嬪彿鍒楄〃
+ const getModels = value => {
+ form.value.productModelId = "";
+ form.value.unit = "";
+ modelOptions.value = [];
+ currentProductId.value = value;
+ form.value.productName = findNodeById(productOptions.value, value);
+ modelList({ id: value }).then(res => {
+ modelOptions.value = res;
+ });
+ if (currentProductId.value) {
+ getList();
+ }
+ };
+
+ // 鑾峰彇鎸囨爣鍒楄〃
+ const getList = () => {
+ if (!currentProductId.value) {
+ testStandardOptions.value = [];
+ tableData.value = [];
+ return;
+ }
+ let params = {
+ productId: currentProductId.value,
+ inspectType: 1,
+ };
+ qualityInspectDetailByProductId(params).then(res => {
+ // 淇濆瓨涓嬫媺妗嗛�夐」鏁版嵁
+ testStandardOptions.value = res.data || [];
+ // 娓呯┖琛ㄦ牸鏁版嵁锛岀瓑寰呯敤鎴烽�夋嫨鎸囨爣
+ tableData.value = [];
+ // 娓呯┖鎸囨爣閫夋嫨
+ form.value.testStandardId = "";
+ testStandardDisplay.value = "";
+ });
+ };
+
+ // 鑾峰彇妫�楠屽弬鏁板垪琛紙缂栬緫妯″紡锛�
+ const getQualityInspectParamList = id => {
+ qualityInspectParamInfo(id).then(res => {
+ tableData.value = res.data;
+ });
+ };
+
+ // 鎻愪氦琛ㄥ崟
+ const submitForm = async () => {
+ console.log("submitForm", form.value, tableData.value);
+ try {
+ // await formRef.value.validate();
+ if (!form.value.productModelId) {
+ showToast("璇烽�夋嫨瑙勬牸鍨嬪彿");
+ return;
+ }
+ if (!form.value.process) {
+ showToast("璇烽�夋嫨宸ュ簭");
+ return;
+ }
+ if (!form.value.quantity) {
+ showToast("璇疯緭鍏ユ暟閲�");
+ return;
+ }
+ if (!form.value.productId) {
+ showToast("璇烽�夋嫨浜у搧");
+ return;
+ }
+ if (!form.value.checkResult) {
+ showToast("璇烽�夋嫨妫�娴嬬粨鏋�");
+ return;
+ }
+
+ loading.value = true;
+
+ form.value.inspectType = 1;
+ if (isEdit.value) {
+ tableData.value.forEach(item => {
+ delete item.id;
+ });
+ }
+
+ const data = { ...form.value, qualityInspectParams: tableData.value };
+ data.quantity = Number(data.quantity);
+ if (isEdit.value) {
+ const res = await qualityInspectUpdate(data);
+ showToast("淇濆瓨鎴愬姛");
+ setTimeout(() => {
+ uni.navigateBack();
+ }, 1500);
+ } else {
+ const res = await qualityInspectAdd(data);
+ showToast("鎻愪氦鎴愬姛");
+ setTimeout(() => {
+ uni.navigateBack();
+ }, 1500);
+ }
+ } catch (error) {
+ console.error("琛ㄥ崟楠岃瘉澶辫触:", error);
+ showToast("鎻愪氦澶辫触锛岃閲嶈瘯");
+ } finally {
+ loading.value = false;
+ }
+ };
+
+ // 鍒濆鍖栬〃鍗�
+ const initForm = async () => {
+ const id = getPageId();
+ if (id) {
+ // 缂栬緫妯″紡锛屽姞杞芥暟鎹�
+ // 鍏堥噸缃〃鍗曟暟鎹�
+ form.value = {
+ checkTime: dayjs().format("YYYY-MM-DD"),
+ process: "",
+ checkName: "",
+ productName: "",
+ productId: "",
+ productModelId: "",
+ model: "",
+ testStandardId: "",
+ unit: "",
+ quantity: "",
+ checkCompany: "",
+ checkResult: "",
+ productMainId: null,
+ purchaseLedgerId: null,
+ };
+ testStandardOptions.value = [];
+ tableData.value = [];
+ // 鍏堢‘淇濅骇鍝佹爲宸插姞杞斤紝鍚﹀垯缂栬緫鏃朵骇鍝�/瑙勬牸鍨嬪彿鏃犳硶鍙嶆樉
+ await getProductOptions();
+ // 浠庢湰鍦板瓨鍌ㄨ幏鍙栫紪杈戞暟鎹�
+ const row = uni.getStorageSync("processInspectionEditData") || {
+ id: id,
+ checkTime: "2026-03-03",
+ process: "涓婃捣閲戝睘鏉愭枡鏈夐檺鍏徃",
+ checkName: "寮犱笁",
+ productName: "涓嶉攬閽㈡澘鏉�",
+ productId: 1,
+ productModelId: 1,
+ model: "304",
+ testStandardId: "1",
+ unit: "kg",
+ quantity: 1000,
+ checkCompany: "绗笁鏂规娴嬫満鏋�",
+ checkResult: "鍚堟牸",
+ productMainId: null,
+ purchaseLedgerId: null,
+ };
+ // 鍏堜繚瀛� testStandardId锛岄伩鍏嶈娓呯┖
+ const savedTestStandardId = row.testStandardId;
+ form.value = { ...row };
+ currentProductId.value = row.productId || 0;
+ // 鍏抽敭锛氱紪杈戞椂鍔犺浇瑙勬牸鍨嬪彿涓嬫媺閫夐」锛屾墠鑳藉弽鏄� productModelId
+ if (currentProductId.value) {
+ try {
+ const res = await modelList({ id: currentProductId.value });
+ modelOptions.value = res || [];
+ // 鍚屾鍥炲~ model / unit
+ if (form.value.productModelId) {
+ handleChangeModel(form.value.productModelId);
+ }
+ } catch (e) {
+ console.error("鍔犺浇瑙勬牸鍨嬪彿澶辫触", e);
+ modelOptions.value = [];
+ }
+ }
+ // 缂栬緫妯″紡涓嬶紝鍏堝姞杞芥寚鏍囬�夐」锛岀劧鍚庡姞杞藉弬鏁板垪琛�
+ if (currentProductId.value) {
+ // 鍏堝姞杞芥寚鏍囬�夐」
+ let params = {
+ productId: currentProductId.value,
+ inspectType: 1,
+ };
+ qualityInspectDetailByProductId(params).then(res => {
+ testStandardOptions.value = res.data || [];
+ // 浣跨敤 nextTick 纭繚閫夐」宸茬粡娓叉煋
+ nextTick(() => {
+ // 濡傛灉缂栬緫鏁版嵁涓湁 testStandardId锛屽垯璁剧疆骞跺姞杞藉搴旂殑鍙傛暟
+ if (savedTestStandardId) {
+ // 纭繚绫诲瀷鍖归厤
+ const matchedOption = testStandardOptions.value.find(
+ item =>
+ item.id == savedTestStandardId ||
+ String(item.id) === String(savedTestStandardId)
+ );
+ if (matchedOption) {
+ // 纭繚浣跨敤鍖归厤椤圭殑 id
+ form.value.testStandardId = matchedOption.id;
+ testStandardDisplay.value =
+ matchedOption.standardName || matchedOption.standardNo;
+ // 缂栬緫淇濈暀鍘熸楠屽�硷紝鐩存帴鎷夊彇鍘熷弬鏁版暟鎹�
+ getQualityInspectParamList(row.id);
+ } else {
+ // 濡傛灉鎵句笉鍒板尮閰嶉」锛屽皾璇曠洿鎺ヤ娇鐢ㄥ師鍊�
+ console.warn(
+ "鏈壘鍒板尮閰嶇殑鎸囨爣閫夐」锛宼estStandardId:",
+ savedTestStandardId
+ );
+ form.value.testStandardId = savedTestStandardId;
+ getQualityInspectParamList(row.id);
+ }
+ } else {
+ // 鍚﹀垯浣跨敤鏃х殑閫昏緫
+ getQualityInspectParamList(row.id);
+ }
+ });
+ });
+ }
+ // 灞曞紑浜у搧鏍戝埌褰撳墠閫変腑鐨勮妭鐐�
+ expandProductTree(productOptions.value, row.productId);
+ } else {
+ // 鏂板妯″紡锛屽垵濮嬪寲琛ㄥ崟
+ form.value = {
+ checkTime: dayjs().format("YYYY-MM-DD"),
+ process: "",
+ checkName: "",
+ productName: "",
+ productId: "",
+ productModelId: "",
+ model: "",
+ testStandardId: "",
+ unit: "",
+ quantity: "",
+ checkCompany: "",
+ checkResult: "",
+ productMainId: null,
+ purchaseLedgerId: null,
+ };
+ }
+ };
+
+ // 灞曞紑浜у搧鏍戝埌鎸囧畾鑺傜偣
+ const expandProductTree = (nodes, targetId) => {
+ for (let i = 0; i < nodes.length; i++) {
+ const node = nodes[i];
+ if (node.value === targetId) {
+ return true; // 鎵惧埌鐩爣鑺傜偣
+ }
+ if (node.children && node.children.length > 0) {
+ const found = expandProductTree(node.children, targetId);
+ if (found) {
+ node.expanded = true; // 灞曞紑鐖惰妭鐐�
+ return true;
+ }
+ }
+ }
+ return false;
+ };
+
+ onMounted(() => {
+ getprocessList();
+ getProductOptions();
+ getUserList();
+ initForm();
+ });
+
+ onShow(() => {
+ initForm();
+ });
+</script>
+
+<style scoped lang="scss">
+ @import "@/static/scss/form-common.scss";
+
+ .material-inspection-add {
+ min-height: 100vh;
+ background: #f8f9fa;
+ padding-bottom: 100px;
+ }
+
+ // 妫�楠岄」鐩鍣�
+ .inspection-items-container {
+ padding: 20px;
+ background-color: #fff;
+ }
+
+ .steps-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 20px;
+ padding-bottom: 12px;
+ border-bottom: 1px solid #e4e7ed;
+ }
+
+ .steps-title {
+ font-size: 16px;
+ font-weight: 600;
+ color: #303133;
+ }
+
+ .steps-count {
+ font-size: 14px;
+ color: #909399;
+ }
+
+ .steps-list {
+ margin-bottom: 20px;
+ }
+
+ .exec-step-item {
+ position: relative;
+ display: flex;
+ margin-bottom: 16px;
+ padding: 16px;
+ background-color: #ffffff;
+ border: 1px solid #e4e7ed;
+ border-radius: 8px;
+ transition: all 0.3s ease;
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
+ }
+
+ .exec-step-item:hover {
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
+ border-color: #409eff;
+ transform: translateY(-1px);
+ }
+
+ .delete-btn {
+ position: absolute;
+ top: -25rpx;
+ right: -25rpx;
+ width: 50rpx;
+ height: 50rpx;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ text-align: center;
+ font-size: 20px;
+ border-radius: 50%;
+ background-color: red;
+ border: none;
+ z-index: 10;
+ }
+
+ .delete-btn:hover {
+ transform: scale(1.1);
+ box-shadow: 0 3px 6px rgba(245, 108, 108, 0.4);
+ }
+
+ .step-number {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 32px;
+ height: 32px;
+ margin-right: 16px;
+ background-color: #ecf5ff;
+ color: #409eff;
+ font-size: 14px;
+ font-weight: 600;
+ border-radius: 50%;
+ flex-shrink: 0;
+ }
+
+ .step-content {
+ flex: 1;
+ min-width: 0;
+ }
+
+ .step-row {
+ display: flex;
+ align-items: flex-start;
+ margin-bottom: 12px;
+ }
+
+ .step-row:last-child {
+ margin-bottom: 0;
+ }
+
+ .step-label {
+ display: inline-block;
+ width: 80px;
+ font-size: 14px;
+ color: #606266;
+ margin-right: 12px;
+ flex-shrink: 0;
+ line-height: 36px;
+ }
+
+ .step-input {
+ flex: 1;
+ min-width: 0;
+ }
+
+ .step-input input {
+ font-size: 14px;
+ color: #303133;
+ }
+
+ .add-step-btn {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 100%;
+ height: 44px;
+ line-height: 44px;
+ font-size: 14px;
+ border-radius: 8px;
+ transition: all 0.3s ease;
+ gap: 8px;
+ }
+
+ .add-step-btn:hover {
+ transform: translateY(-1px);
+ box-shadow: 0 2px 8px rgba(64, 158, 255, 0.3);
+ }
+
+ .add-step-btn text {
+ font-size: 14px;
+ }
+
+ // 搴曢儴鎸夐挳
+ .bottom-buttons {
+ position: fixed;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ display: flex;
+ padding: 16px 20px;
+ background: #ffffff;
+ border-top: 1px solid #f0f0f0;
+ gap: 16px;
+ }
+
+ .bottom-btn {
+ flex: 1;
+ }
+
+ // 鏍戝舰閫夋嫨鍣ㄦ牱寮�
+ .tree-selector {
+ width: 100%;
+ max-height: 70vh;
+ background: #ffffff;
+ border-radius: 16px 16px 0 0;
+ }
+
+ .tree-header {
+ padding: 16px 20px;
+ border-bottom: 1px solid #f0f0f0;
+ text-align: center;
+ }
+
+ .tree-title {
+ font-size: 16px;
+ font-weight: 600;
+ color: #303133;
+ }
+
+ .tree-content {
+ padding: 10px 0;
+ max-height: calc(70vh - 60px);
+ overflow-y: auto;
+ }
+
+ .tree-node {
+ padding: 0 20px;
+ }
+
+ .tree-node-header {
+ display: flex;
+ align-items: center;
+ padding: 12px 0;
+ cursor: pointer;
+ }
+
+ .tree-node-icon {
+ width: 20px;
+ height: 20px;
+ margin-right: 8px;
+ color: #909399;
+ }
+
+ .tree-node-icon-placeholder {
+ width: 20px;
+ height: 20px;
+ margin-right: 8px;
+ }
+
+ .tree-node-label {
+ flex: 1;
+ font-size: 14px;
+ color: #303133;
+ }
+
+ .tree-node-check {
+ width: 20px;
+ height: 20px;
+ color: #409eff;
+ }
+
+ .tree-node-children {
+ margin-left: 28px;
+ }
+</style>
diff --git a/src/pages/qualityManagement/processInspection/detail.vue b/src/pages/qualityManagement/processInspection/detail.vue
new file mode 100644
index 0000000..6f1ec64
--- /dev/null
+++ b/src/pages/qualityManagement/processInspection/detail.vue
@@ -0,0 +1,423 @@
+<template>
+ <view class="material-inspection-detail">
+ <!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 -->
+ <PageHeader title="杩囩▼妫�楠岃鎯�"
+ @back="goBack" />
+ <!-- 璇︽儏鍐呭 -->
+ <view class="detail-section"
+ v-if="detailData">
+ <view class="detail-card">
+ <view class="card-header">
+ <view class="header-icon">
+ <up-icon name="file-text"
+ size="20"
+ color="#ffffff"></up-icon>
+ </view>
+ <text class="header-title">{{ detailData.productName || '-' }}</text>
+ <view class="status-tags">
+ <u-tag :type="getTagType(detailData.checkResult)"
+ size="small"
+ class="status-tag">
+ {{ detailData.checkResult || '-' }}
+ </u-tag>
+ <u-tag :type="getStateTagType(detailData.inspectState)"
+ size="small"
+ class="status-tag">
+ {{ detailData.inspectState ? '宸叉彁浜�' : '鏈彁浜�' }}
+ </u-tag>
+ </view>
+ </view>
+ <up-divider></up-divider>
+ <view class="detail-content">
+ <view class="detail-row">
+ <text class="detail-label">妫�娴嬫棩鏈�</text>
+ <text class="detail-value">{{ formatDateTime(detailData.checkTime) || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">鐢熶骇宸ュ崟鍙�</text>
+ <text class="detail-value">{{ detailData.workOrderNo || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">宸ュ簭</text>
+ <text class="detail-value">{{ detailData.process || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">妫�楠屽憳</text>
+ <text class="detail-value">{{ detailData.checkName || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">浜у搧鍚嶇О</text>
+ <text class="detail-value">{{ detailData.productName || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">瑙勬牸鍨嬪彿</text>
+ <text class="detail-value">{{ detailData.model || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">鍗曚綅</text>
+ <text class="detail-value">{{ detailData.unit || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">鏁伴噺</text>
+ <text class="detail-value">{{ detailData.quantity || 0 }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">妫�娴嬪崟浣�</text>
+ <text class="detail-value">{{ detailData.checkCompany || '-' }}</text>
+ </view>
+ <!-- <view class="detail-row">
+ <text class="detail-label">妫�楠屾爣鍑�</text>
+ <text class="detail-value">{{ detailData.testStandardName || '-' }}</text>
+ </view> -->
+ </view>
+ </view>
+ <!-- 妫�楠岄」鐩� -->
+ <view class="detail-card"
+ v-if="inspectionItems.length > 0">
+ <view class="card-header">
+ <view class="header-icon secondary">
+ <up-icon name="list"
+ size="20"
+ color="#ffffff"></up-icon>
+ </view>
+ <text class="header-title">妫�楠岄」鐩�</text>
+ </view>
+ <up-divider></up-divider>
+ <view class="inspection-items">
+ <view v-for="(item, index) in inspectionItems"
+ :key="index"
+ class="inspection-item">
+ <text class="item-name">{{ item.parameterItem || '妫�楠岄」鐩�' }}</text>
+ <view class="item-details">
+ <view class="item-detail-row">
+ <text class="item-detail-label">鍗曚綅:</text>
+ <text class="item-detail-value">{{ item.unit || '-' }}</text>
+ </view>
+ <view class="item-detail-row">
+ <text class="item-detail-label">鏍囧噯鍊�:</text>
+ <text class="item-detail-value">{{ item.standardValue || '-' }}</text>
+ </view>
+ <view class="item-detail-row">
+ <text class="item-detail-label">鍐呮帶鍊�:</text>
+ <text class="item-detail-value">{{ item.controlValue || '-' }}</text>
+ </view>
+ <view class="item-detail-row">
+ <text class="item-detail-label">妫�楠屽��:</text>
+ <text class="item-detail-value result"
+ :class="getResultClass(item.testValue, item.standardValue)">
+ {{ item.testValue || '-' }}
+ </text>
+ </view>
+ </view>
+ </view>
+ </view>
+ </view>
+ <!-- 鎿嶄綔鎸夐挳 -->
+ <!-- <view class="action-buttons">
+ <u-button type="primary"
+ class="action-btn"
+ @click="downloadReport">
+ 涓嬭浇鎶ュ憡
+ </u-button>
+ </view> -->
+ </view>
+ <view v-else
+ class="no-data">
+ <up-empty mode="data"
+ text="鏆傛棤妫�楠岃鎯�"></up-empty>
+ </view>
+ </view>
+</template>
+
+<script setup>
+ import { ref, onMounted } from "vue";
+ import { onShow } from "@dcloudio/uni-app";
+ import PageHeader from "@/components/PageHeader.vue";
+ import dayjs from "dayjs";
+ import { qualityInspectParamInfo } from "@/api/qualityManagement/materialInspection.js";
+
+ // 鏄剧ず鎻愮ず淇℃伅
+ const showToast = message => {
+ uni.showToast({
+ title: message,
+ icon: "none",
+ });
+ };
+
+ // 璇︽儏鏁版嵁
+ const detailData = ref(null);
+ // 妫�楠岄」鐩�
+ const inspectionItems = ref([]);
+
+ // 杩斿洖涓婁竴椤�
+ const goBack = () => {
+ uni.navigateBack();
+ };
+
+ // 鏍煎紡鍖栨棩鏈熸椂闂�
+ const formatDateTime = date => {
+ if (!date) return "";
+ return dayjs(date).format("YYYY-MM-DD");
+ };
+
+ // 鑾峰彇鏍囩绫诲瀷
+ const getTagType = result => {
+ switch (result) {
+ case "鍚堟牸":
+ return "success";
+ case "涓嶅悎鏍�":
+ return "error";
+ default:
+ return "info";
+ }
+ };
+
+ // 鑾峰彇鐘舵�佹爣绛剧被鍨�
+ const getStateTagType = state => {
+ return state ? "success" : "warning";
+ };
+
+ // 鑾峰彇缁撴灉鏍峰紡
+ const getResultClass = (testValue, standardValue) => {
+ // 绠�鍗曠殑缁撴灉鍒ゆ柇閫昏緫锛屽疄闄呴」鐩腑鍙兘闇�瑕佹洿澶嶆潅鐨勫垽鏂�
+ if (testValue === "鍚堟牸") {
+ return "result-passed";
+ } else if (testValue === "涓嶅悎鏍�") {
+ return "result-rejected";
+ }
+ return "";
+ };
+
+ // 涓嬭浇鎶ュ憡
+ const downloadReport = () => {
+ uni.showToast({
+ title: "鎶ュ憡涓嬭浇涓�...",
+ icon: "loading",
+ });
+
+ // 妯℃嫙涓嬭浇
+ setTimeout(() => {
+ uni.showToast({
+ title: "鎶ュ憡涓嬭浇鎴愬姛",
+ icon: "success",
+ });
+ }, 1500);
+ };
+
+ // 鑾峰彇椤甸潰ID
+ const getPageId = () => {
+ const pages = getCurrentPages();
+ const currentPage = pages[pages.length - 1];
+ return currentPage.options.id;
+ };
+
+ // 鑾峰彇璇︽儏鏁版嵁
+ const getDetail = () => {
+ const id = getPageId();
+ if (!id) {
+ showToast("鍙傛暟閿欒");
+ return;
+ }
+
+ // 浠庢湰鍦板瓨鍌ㄨ幏鍙栬鎯呮暟鎹�
+ try {
+ const detailDataFromStorage = uni.getStorageSync(
+ "processInspectionEditData"
+ );
+ if (detailDataFromStorage) {
+ detailData.value = detailDataFromStorage;
+ // 浣跨敤qualityInspectParamInfo鑾峰彇妫�楠岄」鐩�
+ qualityInspectParamInfo(id)
+ .then(res => {
+ if (res.data && res.data.length > 0) {
+ inspectionItems.value = res.data;
+ } else if (
+ detailDataFromStorage.qualityInspectParams &&
+ detailDataFromStorage.qualityInspectParams.length > 0
+ ) {
+ // 濡傛灉鎺ュ彛娌℃湁杩斿洖鏁版嵁锛屼娇鐢ㄦ湰鍦板瓨鍌ㄤ腑鐨勬暟鎹�
+ inspectionItems.value = detailDataFromStorage.qualityInspectParams;
+ }
+ })
+ .catch(error => {
+ console.error("鑾峰彇妫�楠岄」鐩け璐�:", error);
+ // 鎺ュ彛璋冪敤澶辫触鏃讹紝浣跨敤鏈湴瀛樺偍涓殑鏁版嵁鎴栨ā鎷熸暟鎹�
+ if (
+ detailDataFromStorage.qualityInspectParams &&
+ detailDataFromStorage.qualityInspectParams.length > 0
+ ) {
+ inspectionItems.value = detailDataFromStorage.qualityInspectParams;
+ }
+ });
+ }
+ } catch (error) {
+ console.error("鍔犺浇璇︽儏鏁版嵁澶辫触:", error);
+ showToast("鍔犺浇璇︽儏鏁版嵁澶辫触锛岃閲嶈瘯");
+ }
+ };
+
+ onShow(() => {
+ getDetail();
+ });
+
+ onMounted(() => {
+ getDetail();
+ });
+</script>
+
+<style scoped lang="scss">
+ .material-inspection-detail {
+ min-height: 100vh;
+ background: #f5f5f5;
+ padding-bottom: 20px;
+ }
+
+ .detail-section {
+ padding: 15px;
+ }
+
+ .detail-card {
+ background: #fff;
+ border-radius: 12px;
+ padding: 16px;
+ margin-bottom: 12px;
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
+ }
+
+ .card-header {
+ display: flex;
+ align-items: center;
+ margin-bottom: 12px;
+ }
+
+ .header-icon {
+ width: 40px;
+ height: 40px;
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+ border-radius: 8px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ margin-right: 12px;
+ }
+
+ .header-icon.secondary {
+ background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
+ }
+
+ .header-icon.tertiary {
+ background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
+ }
+
+ .header-title {
+ flex: 1;
+ font-size: 16px;
+ font-weight: 600;
+ color: #333;
+ }
+
+ .status-tag {
+ margin-left: 20rpx;
+ }
+
+ .detail-content {
+ padding-top: 8px;
+ }
+
+ .detail-row {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 10px 0;
+ border-bottom: 1px solid #f0f0f0;
+ }
+
+ .detail-row:last-child {
+ border-bottom: none;
+ }
+
+ .detail-label {
+ font-size: 14px;
+ color: #666;
+ min-width: 100px;
+ }
+
+ .detail-value {
+ font-size: 14px;
+ color: #333;
+ text-align: right;
+ flex: 1;
+ }
+
+ // 妫�楠岄」鐩�
+ .inspection-items {
+ padding-top: 8px;
+ }
+
+ .inspection-item {
+ padding: 12px;
+ background: #f8f9fa;
+ border-radius: 8px;
+ margin-bottom: 10px;
+ }
+
+ .inspection-item:last-child {
+ margin-bottom: 0;
+ }
+
+ .item-name {
+ display: block;
+ font-size: 14px;
+ font-weight: 500;
+ color: #333;
+ margin-bottom: 8px;
+ padding-bottom: 8px;
+ border-bottom: 1px solid #f0f0f0;
+ }
+
+ .item-details {
+ padding-top: 8px;
+ }
+
+ .item-detail-row {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 6px;
+ }
+
+ .item-detail-row:last-child {
+ margin-bottom: 0;
+ }
+
+ .item-detail-label {
+ font-size: 12px;
+ color: #666;
+ min-width: 60px;
+ }
+
+ .item-detail-value {
+ font-size: 12px;
+ color: #333;
+ text-align: right;
+ flex: 1;
+ }
+
+ .item-detail-value.result {
+ font-weight: 500;
+ }
+
+ .result-passed {
+ color: #67c23a;
+ }
+
+ .result-rejected {
+ color: #f56c6c;
+ }
+
+ // 绌虹姸鎬�
+ .no-data {
+ padding: 60px 20px;
+ text-align: center;
+ }
+</style>
diff --git a/src/pages/qualityManagement/processInspection/fileList.vue b/src/pages/qualityManagement/processInspection/fileList.vue
new file mode 100644
index 0000000..126158d
--- /dev/null
+++ b/src/pages/qualityManagement/processInspection/fileList.vue
@@ -0,0 +1,566 @@
+<template>
+ <view class="file-list-page">
+ <!-- 椤甸潰澶撮儴 -->
+ <PageHeader title="闄勪欢绠$悊"
+ @back="goBack" />
+ <!-- 闄勪欢鍒楄〃 -->
+ <view class="file-list-container">
+ <view v-if="fileList.length > 0"
+ class="file-list">
+ <view v-for="(file, index) in fileList"
+ :key="file.id || index"
+ class="file-item">
+ <!-- 鏂囦欢鍥炬爣 -->
+ <!-- <view class="file-icon"
+ :class="getFileIconClass(file.fileType)">
+ <up-icon :name="getFileIcon(file.fileType)"
+ size="24"
+ color="#ffffff" />
+ </view> -->
+ <!-- 鏂囦欢淇℃伅 -->
+ <view class="file-info">
+ <text class="file-name">{{ file.name }}</text>
+ <!-- <text class="file-meta">{{ formatFileSize(file.fileSize) }} 路 {{ file.uploadTime || file.createTime }}</text> -->
+ </view>
+ <!-- 鎿嶄綔鎸夐挳 -->
+ <view class="file-actions">
+ <!-- <u-button size="small"
+ type="primary"
+ plain
+ @click="previewFile(file)">棰勮</u-button> -->
+ <u-button size="small"
+ type="info"
+ plain
+ @click="downloadFile(file)">涓嬭浇骞堕瑙�</u-button>
+ <u-button size="small"
+ type="error"
+ plain
+ @click="confirmDelete(file, index)">鍒犻櫎</u-button>
+ </view>
+ </view>
+ </view>
+ <!-- 绌虹姸鎬� -->
+ <view v-else
+ class="empty-state">
+ <up-icon name="document"
+ size="64"
+ color="#c0c4cc" />
+ <text class="empty-text">鏆傛棤闄勪欢</text>
+ </view>
+ </view>
+ <!-- <a rel="nofollow"
+ id="downloadLink"
+ href="#"
+ style="display:none;">涓嬭浇鏂囨湰鏂囦欢</a> -->
+ <!-- 涓婁紶鎸夐挳 -->
+ <view class="upload-button"
+ @click="chooseFile">
+ <up-icon name="plus"
+ size="24"
+ color="#ffffff" />
+ <text class="upload-text">涓婁紶闄勪欢</text>
+ </view>
+ </view>
+</template>
+
+<script setup>
+ import { ref, onMounted } from "vue";
+ import PageHeader from "@/components/PageHeader.vue";
+ import config from "@/config";
+ import { getToken } from "@/utils/auth";
+ // import { saveAs } from "file-saver";
+ import {
+ listRuleFiles,
+ delRuleFile,
+ } from "@/api/managementMeetings/rulesRegulationsManagement";
+ import {
+ qualityInspectFileAdd,
+ qualityInspectFileListPage,
+ qualityInspectFileDel,
+ } from "@/api/qualityManagement/materialInspection";
+ import { blobValidate } from "@/utils/ruoyi";
+
+ // 闄勪欢鍒楄〃
+ const fileList = ref([]);
+
+ // 杩斿洖涓婁竴椤�
+ const goBack = () => {
+ uni.navigateBack();
+ };
+ // const request = axios.create({
+ // baseURL: "URL.com",
+ // adapter: axiosAdapterUniapp,
+ // });
+ // 鑾峰彇鏂囦欢鍥炬爣
+ const getFileIcon = fileType => {
+ const iconMap = {
+ doc: "document",
+ docx: "document",
+ xls: "grid",
+ xlsx: "grid",
+ pdf: "document",
+ ppt: "copy",
+ pptx: "copy",
+ txt: "document",
+ jpg: "image",
+ jpeg: "image",
+ png: "image",
+ gif: "image",
+ zip: "folder",
+ rar: "folder",
+ };
+ return iconMap[fileType.toLowerCase()] || "document";
+ };
+
+ // 鑾峰彇鏂囦欢鍥炬爣鏍峰紡绫�
+ const getFileIconClass = fileType => {
+ const colorMap = {
+ doc: "blue",
+ docx: "blue",
+ xls: "green",
+ xlsx: "green",
+ pdf: "red",
+ ppt: "orange",
+ pptx: "orange",
+ txt: "gray",
+ jpg: "purple",
+ jpeg: "purple",
+ png: "purple",
+ gif: "purple",
+ zip: "yellow",
+ rar: "yellow",
+ };
+ return colorMap[fileType.toLowerCase()] || "gray";
+ };
+
+ // 鏍煎紡鍖栨枃浠跺ぇ灏�
+ const formatFileSize = bytes => {
+ if (bytes === 0) return "0 B";
+ const k = 1024;
+ const sizes = ["B", "KB", "MB", "GB"];
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
+ };
+
+ // 閫夋嫨鏂囦欢
+ const chooseFile = () => {
+ uni.chooseImage({
+ count: 9,
+ sizeType: ["original", "compressed"],
+ sourceType: ["album", "camera"],
+ success: res => {
+ console.log(res, "閫夋嫨鍥剧墖鎴愬姛");
+ uploadFiles(res.tempFiles);
+ },
+ fail: err => {
+ console.error("閫夋嫨鍥剧墖澶辫触:", err);
+ showToast("閫夋嫨鏂囦欢澶辫触");
+ },
+ });
+ // uni.chooseFile({
+ // count: 9,
+ // extension: [
+ // ".doc",
+ // ".docx",
+ // ".xls",
+ // ".xlsx",
+ // ".pdf",
+ // ".ppt",
+ // ".pptx",
+ // ".txt",
+ // ".jpg",
+ // ".jpeg",
+ // ".png",
+ // ".gif",
+ // ".zip",
+ // ".rar",
+ // ],
+ // success: res => {
+ // console.log(res, "閫夋嫨鏂囦欢鎴愬姛");
+ // uploadFiles(res.tempFiles);
+ // },
+ // fail: err => {
+ // showToast("閫夋嫨鏂囦欢澶辫触");
+ // },
+ // });
+ };
+
+ // 涓婁紶鏂囦欢
+ const uploadFiles = tempFiles => {
+ console.log(tempFiles, "涓婁紶鏂囦欢1");
+ tempFiles.forEach((tempFile, index) => {
+ // 鏄剧ず涓婁紶涓彁绀�
+ uni.showLoading({
+ title: "涓婁紶涓�...",
+ mask: true,
+ });
+ console.log(tempFile, "涓婁紶鏂囦欢2");
+ // 1. 鐩存帴浣跨敤 uni.uploadFile 涓婁紶鏂囦欢
+ uni.uploadFile({
+ url: config.baseUrl + "/file/upload",
+ filePath: tempFile.path,
+ name: "file",
+ header: {
+ Authorization: "Bearer " + getToken(),
+ },
+ success: uploadRes => {
+ uni.hideLoading();
+ console.log(uploadRes, "涓婁紶鏂囦欢3");
+
+ try {
+ const res = JSON.parse(uploadRes.data);
+ console.log(res, "涓婁紶鏂囦欢4");
+ if (res.code === 200) {
+ // 2. 鎻愬彇鏂囦欢淇℃伅
+ const fileName = tempFile.name
+ ? tempFile.name
+ : tempFile.path.split("/").pop();
+ // const fileType = fileName.split(".").pop();
+ // 3. 鏋勯�犱繚瀛樻枃浠朵俊鎭殑鍙傛暟
+ const saveData = {
+ name: fileName,
+ inspectId: rulesRegulationsManagementId.value,
+ url: res.data.tempPath || "",
+ };
+ console.log(saveData, "淇濆瓨鏂囦欢淇℃伅鍙傛暟");
+ // 4. 璋冪敤 addRuleFile 鎺ュ彛淇濆瓨鏂囦欢淇℃伅
+ qualityInspectFileAdd(saveData)
+ .then(addRes => {
+ if (addRes.code === 200) {
+ // 5. 娣诲姞鍒版枃浠跺垪琛�
+ const newFile = {
+ ...addRes.data,
+ uploadTime: new Date().toLocaleString(),
+ };
+ // fileList.value.push(newFile);
+ getFileList();
+ showToast("涓婁紶鎴愬姛");
+ } else {
+ showToast("淇濆瓨鏂囦欢淇℃伅澶辫触");
+ }
+ })
+ .catch(err => {
+ console.error("淇濆瓨鏂囦欢淇℃伅澶辫触:", err);
+ showToast("淇濆瓨鏂囦欢淇℃伅澶辫触");
+ });
+ } else {
+ showToast("鏂囦欢涓婁紶澶辫触");
+ }
+ } catch (e) {
+ console.error("瑙f瀽涓婁紶缁撴灉澶辫触:", e);
+ showToast("涓婁紶澶辫触");
+ }
+ },
+ fail: err => {
+ uni.hideLoading();
+ console.error("涓婁紶澶辫触:", err);
+ showToast("涓婁紶澶辫触");
+ },
+ });
+ });
+ };
+ // 涓嬭浇鏂囦欢
+ const downloadFile = file => {
+ var url =
+ config.baseUrl +
+ "/common/download?fileName=" +
+ encodeURIComponent(file.url) +
+ "&delete=true";
+ console.log(url, "url");
+
+ uni
+ .downloadFile({
+ url: url,
+ responseType: "blob",
+ header: { Authorization: "Bearer " + getToken() },
+ })
+ .then(res => {
+ let osType = uni.getStorageSync("deviceInfo").osName;
+ let filePath = res.tempFilePath;
+ if (osType === "ios") {
+ uni.openDocument({
+ filePath: filePath,
+ showMenu: true,
+ success: res => {
+ resolve(res);
+ },
+ fail: err => {
+ console.log("uni.openDocument--fail");
+ reject(err);
+ },
+ });
+ } else {
+ uni.saveFile({
+ tempFilePath: filePath,
+ success: fileRes => {
+ uni.showToast({
+ icon: "none",
+ mask: true,
+ title:
+ "鏂囦欢宸蹭繚瀛橈細Android/data/uni.UNI720216F/apps/__UNI__720216F/" +
+ fileRes.savedFilePath, //淇濆瓨璺緞
+ duration: 3000,
+ });
+ setTimeout(() => {
+ //鎵撳紑鏂囨。鏌ョ湅
+ uni.openDocument({
+ filePath: fileRes.savedFilePath,
+ success: function (res) {
+ resolve(fileRes);
+ },
+ });
+ }, 3000);
+ },
+ fail: err => {
+ console.log("uni.save--fail");
+ reject(err);
+ },
+ });
+ }
+ // const isBlob = blobValidate(res.data);
+ // if (isBlob) {
+ // const blob = new Blob([res.data], { type: "text/plain" });
+ // const url = URL.createObjectURL(blob);
+ // const downloadLink = document.getElementById("downloadLink");
+ // downloadLink.href = url;
+ // downloadLink.download = file.name;
+ // downloadLink.click();
+ // showToast("涓嬭浇鎴愬姛");
+ // } else {
+ // showToast("涓嬭浇澶辫触");
+ // }
+ })
+ .catch(err => {
+ console.error("涓嬭浇澶辫触:", err);
+ showToast("涓嬭浇澶辫触");
+ });
+ };
+
+ // 纭鍒犻櫎
+ const confirmDelete = (file, index) => {
+ uni.showModal({
+ title: "鍒犻櫎纭",
+ content: `纭畾瑕佸垹闄ら檮浠� "${file.name}" 鍚楋紵`,
+ success: res => {
+ if (res.confirm) {
+ deleteFile(file.id, index);
+ }
+ },
+ });
+ };
+
+ // 鍒犻櫎鏂囦欢
+ const deleteFile = (fileId, index) => {
+ uni.showLoading({
+ title: "鍒犻櫎涓�...",
+ mask: true,
+ });
+
+ qualityInspectFileDel([fileId])
+ .then(res => {
+ uni.hideLoading();
+ if (res.code === 200) {
+ // fileList.value.splice(index, 1);
+ getFileList();
+ showToast("鍒犻櫎鎴愬姛");
+ } else {
+ showToast("鍒犻櫎澶辫触");
+ }
+ })
+ .catch(err => {
+ uni.hideLoading();
+ showToast("鍒犻櫎澶辫触");
+ });
+ };
+
+ // 鏄剧ず鎻愮ず
+ const showToast = message => {
+ uni.showToast({
+ title: message,
+ icon: "none",
+ });
+ };
+ const rulesRegulationsManagementId = ref("");
+ // 椤甸潰鍔犺浇鏃�
+ onMounted(() => {
+ rulesRegulationsManagementId.value = uni.getStorageSync(
+ "qualityInspectFileId"
+ );
+ // 浠� API 鑾峰彇闄勪欢鍒楄〃
+ getFileList();
+ // 浠庢湰鍦板瓨鍌ㄨ幏鍙� rulesRegulationsManagementId
+ });
+
+ // 鑾峰彇闄勪欢鍒楄〃
+ const getFileList = () => {
+ uni.showLoading({
+ title: "鍔犺浇涓�...",
+ mask: true,
+ });
+
+ qualityInspectFileListPage({
+ inspectId: rulesRegulationsManagementId.value,
+ current: -1,
+ size: -1,
+ })
+ .then(res => {
+ uni.hideLoading();
+ if (res.code === 200) {
+ fileList.value = res.data.records || [];
+ } else {
+ showToast("鑾峰彇闄勪欢鍒楄〃澶辫触");
+ }
+ })
+ .catch(err => {
+ uni.hideLoading();
+ showToast("鑾峰彇闄勪欢鍒楄〃澶辫触");
+ });
+ };
+</script>
+
+<style scoped lang="scss">
+ @import "../../../styles/sales-common.scss";
+
+ .file-list-page {
+ min-height: 100vh;
+ background: #f8f9fa;
+ padding-bottom: 100rpx;
+ }
+
+ .file-list-container {
+ padding: 20rpx;
+ }
+
+ .file-list {
+ background: #ffffff;
+ border-radius: 8rpx;
+ overflow: hidden;
+ box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
+ }
+
+ .file-item {
+ display: flex;
+ align-items: center;
+ padding: 20rpx;
+ border-bottom: 1rpx solid #f0f0f0;
+
+ &:last-child {
+ border-bottom: none;
+ }
+ }
+
+ .file-icon {
+ width: 56rpx;
+ height: 56rpx;
+ border-radius: 8rpx;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ margin-right: 20rpx;
+
+ &.blue {
+ background: #409eff;
+ }
+
+ &.green {
+ background: #67c23a;
+ }
+
+ &.red {
+ background: #f56c6c;
+ }
+
+ &.orange {
+ background: #e6a23c;
+ }
+
+ &.gray {
+ background: #909399;
+ }
+
+ &.purple {
+ background: #909399;
+ }
+
+ &.yellow {
+ background: #e6a23c;
+ }
+ }
+
+ .file-info {
+ flex: 1;
+ min-width: 0;
+ }
+
+ .file-name {
+ display: block;
+ font-size: 16px;
+ color: #303133;
+ margin-bottom: 8rpx;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+
+ .file-meta {
+ display: block;
+ font-size: 12px;
+ color: #909399;
+ }
+
+ .file-actions {
+ display: flex;
+ gap: 12rpx;
+ }
+
+ .empty-state {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ padding: 100rpx 0;
+ background: #ffffff;
+ border-radius: 8rpx;
+ box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
+ }
+
+ .empty-text {
+ font-size: 14px;
+ color: #909399;
+ margin-top: 20rpx;
+ }
+
+ .upload-button {
+ position: fixed;
+ bottom: 40rpx;
+ right: 40rpx;
+ width: 130rpx;
+ height: 130rpx;
+ border-radius: 50%;
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ box-shadow: 0 4rpx 16rpx rgba(102, 126, 234, 0.4);
+ z-index: 1000;
+ }
+
+ .upload-text {
+ font-size: 10px;
+ color: #ffffff;
+ margin-top: 4rpx;
+ }
+
+ .upload-progress {
+ padding: 40rpx 0;
+ }
+
+ .upload-progress-text {
+ display: block;
+ text-align: center;
+ margin-top: 20rpx;
+ font-size: 14px;
+ color: #606266;
+ }
+</style>
\ No newline at end of file
diff --git a/src/pages/qualityManagement/processInspection/index.vue b/src/pages/qualityManagement/processInspection/index.vue
new file mode 100644
index 0000000..befaef6
--- /dev/null
+++ b/src/pages/qualityManagement/processInspection/index.vue
@@ -0,0 +1,775 @@
+<template>
+ <view class="material-inspection-page">
+ <!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 -->
+ <PageHeader title="杩囩▼妫�楠�"
+ @back="goBack" />
+ <!-- 鎼滅储鍖哄煙 -->
+ <view class="search-section">
+ <up-search
+ placeholder="璇疯緭鍏ュ伐搴忔悳绱�"
+ v-model="searchForm.process"
+ @search="getList"
+ @custom="getList"
+ @clear="getList"
+ :show-action="true"
+ action-text="鎼滅储"
+ :animation="true"
+ ></up-search>
+ </view>
+ <!-- 缁熻淇℃伅鍗$墖 -->
+ <!-- <view class="stats-cards">
+ <view class="stat-card">
+ <text class="stat-number">{{ totalCount }}</text>
+ <text class="stat-label">鎬绘楠�</text>
+ </view>
+ <view class="stat-card">
+ <text class="stat-number">{{ submittedCount }}</text>
+ <text class="stat-label">宸叉彁浜�</text>
+ </view>
+ <view class="stat-card">
+ <text class="stat-number">{{ pendingCount }}</text>
+ <text class="stat-label">寰呮彁浜�</text>
+ </view>
+ <view class="stat-card">
+ <text class="stat-number">{{ qualifiedCount }}</text>
+ <text class="stat-label">宸插悎鏍�</text>
+ </view>
+ </view> -->
+ <!-- 妫�楠屽垪琛� -->
+ <view class="inspection-list"
+ v-if="inspectionList.length > 0">
+ <view v-for="(item, index) in inspectionList"
+ :key="index">
+ <view class="inspection-item"
+ @click="viewDetail(item)">
+ <view class="item-header">
+ <view class="item-left">
+ <!-- <view class="material-icon"
+ :class="getStateClass(item.inspectState)">
+ <up-icon :name="getStateIcon(item.inspectState)"
+ size="16"
+ color="#ffffff"></up-icon>
+ </view> -->
+ <view class="material-info">
+ <text class="material-name">{{ item.productName }}</text>
+ <text class="material-code">{{ item.model }}</text>
+ </view>
+ </view>
+ <view class="status-tags">
+ <u-tag :type="getTagType(item.checkResult)"
+ size="mini"
+ class="status-tag">
+ {{ item.checkResult }}
+ </u-tag>
+ <u-tag :type="getStateTagType(item.inspectState)"
+ size="mini"
+ class="status-tag">
+ {{ item.inspectState ? '宸叉彁浜�' : '鏈彁浜�' }}
+ </u-tag>
+ </view>
+ </view>
+ <up-divider></up-divider>
+ <view class="item-details">
+ <view class="detail-row">
+ <text class="detail-label">妫�娴嬫棩鏈�</text>
+ <text class="detail-value">{{ formatDateTime(item.checkTime) || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">鐢熶骇宸ュ崟鍙�</text>
+ <text class="detail-value">{{ item.workOrderNo || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">宸ュ簭</text>
+ <text class="detail-value">{{ item.process || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">妫�楠屽憳</text>
+ <text class="detail-value">{{ item.checkName || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">鏁伴噺</text>
+ <text class="detail-value">{{ item.quantity || 0 }} {{ item.unit || '' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">妫�娴嬪崟浣�</text>
+ <text class="detail-value">{{ item.checkCompany || '-' }}</text>
+ </view>
+ </view>
+ <!-- 鎿嶄綔鎸夐挳 -->
+ <view class="action-buttons">
+ <!-- <u-button type="primary"
+ size="small"
+ class="action-btn"
+ :disabled="item.inspectState"
+ @click.stop="startInspection(item)">
+ 缂栬緫
+ </u-button> -->
+ <u-button type="info"
+ size="small"
+ class="action-btn"
+ @click.stop="viewDetail(item)">
+ 璇︽儏
+ </u-button>
+ <!-- <u-button type="success"
+ size="small"
+ class="action-btn"
+ :disabled="item.inspectState"
+ @click.stop="submitInspection(item)">
+ 鎻愪氦
+ </u-button> -->
+ </view>
+ <view class="action-buttons">
+ <!-- <u-button type="info"
+ size="small"
+ class="action-btn"
+ @click.stop="viewFileList(item)">
+ 闄勪欢
+ </u-button>
+ <u-button type="warning"
+ size="small"
+ class="action-btn"
+ :disabled="item.inspectState || item.checkName !== ''"
+ @click.stop="assignInspector(item)">
+ 鍒嗛厤妫�楠屽憳
+ </u-button> -->
+ </view>
+ </view>
+ </view>
+ </view>
+ <view v-else
+ class="no-data">
+ <up-empty mode="data"
+ text="鏆傛棤妫�楠屼换鍔�"></up-empty>
+ </view>
+ <!-- 鍒嗛〉缁勪欢 -->
+ <!-- 娴姩鏂板鎸夐挳 -->
+ <!-- <view class="fab-button"
+ @click="addInspection">
+ <up-icon name="plus"
+ size="24"
+ color="#ffffff"></up-icon>
+ </view> -->
+ <!-- 鏃ユ湡閫夋嫨鍣� -->
+ <up-popup v-model:show="showDate"
+ mode="date"
+ :start-year="2020"
+ :end-year="2030"
+ :range="true"
+ @confirm="confirmDate" />
+ <!-- 鍒嗛厤妫�楠屽憳寮圭獥 -->
+ <up-popup v-model:show="showAssignDialog"
+ mode="center"
+ round
+ style="width: 80%">
+ <view class="assign-dialog">
+ <view class="dialog-header">
+ <text class="dialog-title">鍒嗛厤妫�楠屽憳</text>
+ <up-icon name="close"
+ size="20"
+ color="#999"
+ @click="showAssignDialog = false"></up-icon>
+ </view>
+ <view class="dialog-content">
+ <up-form-item label="妫�楠屽憳"
+ prop="checkName"
+ :label-width="60"
+ required>
+ <up-input v-model="assignForm.checkName"
+ placeholder="璇烽�夋嫨妫�楠屽憳"
+ readonly />
+ <template #right>
+ <up-icon @click="showInspectorSheet = true"
+ name="arrow-right" />
+ </template>
+ </up-form-item>
+ </view>
+ <view class="dialog-footer">
+ <u-button type="default"
+ class="footer-btn"
+ @click="showAssignDialog = false">
+ 鍙栨秷
+ </u-button>
+ <u-button type="primary"
+ class="footer-btn"
+ @click="submitAssign">
+ 纭畾
+ </u-button>
+ </view>
+ </view>
+ </up-popup>
+ <!-- 妫�楠屽憳閫夋嫨 -->
+ <up-action-sheet :show="showInspectorSheet"
+ :actions="userSheetOptions"
+ @select="selectInspector"
+ title="閫夋嫨妫�楠屽憳" />
+ </view>
+</template>
+
+<script setup>
+ import { ref, computed, onMounted } from "vue";
+ import { onShow } from "@dcloudio/uni-app";
+ import PageHeader from "@/components/PageHeader.vue";
+ import dayjs from "dayjs";
+ import {
+ submitQualityInspect,
+ qualityInspectUpdate,
+ qualityInspectListPage,
+ } from "@/api/qualityManagement/materialInspection.js";
+ import { userListNoPage } from "@/api/system/user.js";
+
+ // 鏄剧ず鎻愮ず淇℃伅
+ const showToast = message => {
+ uni.showToast({
+ title: message,
+ icon: "none",
+ });
+ };
+
+ // 鎼滅储琛ㄥ崟
+ const searchForm = ref({
+ process: "",
+ entryDate: undefined,
+ entryDateStart: undefined,
+ entryDateEnd: undefined,
+ });
+
+ // 鏃ユ湡閫夋嫨鍣�
+ const showDate = ref(false);
+
+ // 鍒嗛厤妫�楠屽憳寮圭獥
+ const showAssignDialog = ref(false);
+ const showInspectorSheet = ref(false);
+ const assignForm = ref({
+ checkName: "",
+ });
+ const currentAssignRow = ref(null);
+
+ // 妫�楠屽垪琛ㄦ暟鎹�
+ const inspectionList = ref([]);
+
+ // 鍒嗛〉鏁版嵁
+ const page = ref({
+ current: -1,
+ size: -1,
+ total: 0,
+ });
+
+ // 鍔犺浇鐘舵��
+ const tableLoading = ref(false);
+
+ // 缁熻鏁版嵁
+ const totalCount = ref(0);
+ const submittedCount = ref(0);
+ const pendingCount = ref(0);
+ const qualifiedCount = ref(0);
+
+ // 妫�楠屽憳鍒楄〃
+ const userList = ref([]);
+
+ // ActionSheet閫夐」
+ const userSheetOptions = computed(() => {
+ return userList.value.map(item => ({
+ name: item.nickName,
+ value: item.nickName,
+ }));
+ });
+
+ // 杩斿洖涓婁竴椤�
+ const goBack = () => {
+ uni.navigateBack();
+ };
+
+ // 鏍煎紡鍖栨棩鏈熸椂闂�
+ const formatDateTime = dateStr => {
+ if (!dateStr) return "";
+ return dayjs(dateStr).format("YYYY-MM-DD");
+ };
+
+ // 鑾峰彇鐘舵�佹牱寮�
+ const getStateClass = inspectState => {
+ return inspectState ? "state-submitted" : "state-pending";
+ };
+
+ // 鑾峰彇鐘舵�佸浘鏍�
+ const getStateIcon = inspectState => {
+ return inspectState ? "checkmark-circle" : "time";
+ };
+
+ // 鑾峰彇鏍囩绫诲瀷
+ const getTagType = checkResult => {
+ if (checkResult === "鍚堟牸") return "success";
+ if (checkResult === "涓嶅悎鏍�") return "error";
+ return "default";
+ };
+
+ // 鑾峰彇鐘舵�佹爣绛剧被鍨�
+ const getStateTagType = inspectState => {
+ return inspectState ? "success" : "warning";
+ };
+
+ // 鏄剧ず鏃ユ湡閫夋嫨鍣�
+ const showDatePicker = () => {
+ showDate.value = true;
+ };
+
+ // 纭鏃ユ湡閫夋嫨
+ const confirmDate = e => {
+ searchForm.value.entryDate = e.value;
+ searchForm.value.entryDateStart = dayjs(e.value[0]).format("YYYY-MM-DD");
+ searchForm.value.entryDateEnd = dayjs(e.value[1]).format("YYYY-MM-DD");
+ getList();
+ };
+ const viewFileList = item => {
+ uni.setStorageSync("qualityInspectFileId", item.id);
+ uni.navigateTo({
+ url: "/pages/qualityManagement/processInspection/fileList",
+ });
+ };
+
+ // 娓呴櫎鏃ユ湡鑼冨洿
+ const clearDateRange = () => {
+ searchForm.value.entryDate = undefined;
+ searchForm.value.entryDateStart = undefined;
+ searchForm.value.entryDateEnd = undefined;
+ getList();
+ };
+
+ // 鑾峰彇鐢ㄦ埛鍒楄〃
+ const getUserList = async () => {
+ try {
+ const userRes = await userListNoPage();
+ userList.value = userRes.data || [];
+ } catch (e) {
+ console.error("鍔犺浇妫�楠屽憳鍒楄〃澶辫触", e);
+ userList.value = [];
+ }
+ };
+
+ // 鏌ヨ鍒楄〃
+ const getList = () => {
+ tableLoading.value = true;
+ const params = { ...searchForm.value, ...page.value };
+ params.entryDate = undefined;
+ qualityInspectListPage({ ...params, inspectType: 1 })
+ .then(res => {
+ tableLoading.value = false;
+ inspectionList.value = res.data.records || [];
+ page.value.total = res.data.total || 0;
+ totalCount.value = res.data.total || 0;
+ submittedCount.value = inspectionList.value.filter(
+ item => item.inspectState
+ ).length;
+ pendingCount.value = inspectionList.value.filter(
+ item => !item.inspectState
+ ).length;
+ qualifiedCount.value = inspectionList.value.filter(
+ item => item.checkResult === "鍚堟牸"
+ ).length;
+ })
+ .catch(err => {
+ tableLoading.value = false;
+ console.error("鑾峰彇鍒楄〃澶辫触:", err);
+ showToast("鑾峰彇鍒楄〃澶辫触锛岃閲嶈瘯");
+ });
+ };
+
+ // 缂栬緫妫�楠�
+ const startInspection = item => {
+ if (!item) {
+ showToast("鍙傛暟閿欒");
+ return;
+ }
+ // 瀛樺偍瀹屾暣鐨勬楠屾暟鎹�
+ uni.setStorageSync("processInspectionEditData", item);
+ // 璺宠浆鍒扮紪杈戦〉闈�
+ uni.navigateTo({
+ url: `/pages/qualityManagement/processInspection/add?id=${item.id}&isEdit=true`,
+ });
+ };
+
+ // 鏌ョ湅璇︽儏
+ const viewDetail = item => {
+ if (!item) {
+ showToast("鍙傛暟閿欒");
+ return;
+ }
+ uni.setStorageSync("processInspectionEditData", item);
+ // 璺宠浆鍒拌鎯呴〉闈�
+ uni.navigateTo({
+ url: `/pages/qualityManagement/processInspection/detail?id=${item.id}`,
+ });
+ };
+
+ // 鏂板妫�楠�
+ const addInspection = () => {
+ uni.navigateTo({
+ url: "/pages/qualityManagement/processInspection/add",
+ });
+ };
+
+ // 鎻愪氦妫�楠�
+ const submitInspection = async item => {
+ if (!item) {
+ showToast("鍙傛暟閿欒");
+ return;
+ }
+ try {
+ const res = await submitQualityInspect({ id: item.id });
+ if (res.code === 200) {
+ showToast("鎻愪氦鎴愬姛");
+ setTimeout(() => {
+ getList();
+ }, 1000);
+ } else {
+ showToast("鎻愪氦澶辫触锛�" + (res.msg || "鏈煡閿欒"));
+ }
+ } catch (error) {
+ console.error("鎻愪氦澶辫触:", error);
+ showToast("鎻愪氦澶辫触锛岃閲嶈瘯");
+ }
+ };
+
+ // 鍒嗛厤妫�楠屽憳
+ const assignInspector = item => {
+ if (!item) {
+ showToast("鍙傛暟閿欒");
+ return;
+ }
+ currentAssignRow.value = item;
+ getUserList();
+ showAssignDialog.value = true;
+ };
+
+ // 閫夋嫨妫�楠屽憳
+ const selectInspector = e => {
+ assignForm.value.checkName = e.value;
+ showInspectorSheet.value = false;
+ };
+
+ // 鎻愪氦鍒嗛厤
+ const submitAssign = async () => {
+ if (!currentAssignRow.value || !assignForm.value.checkName) {
+ showToast("璇烽�夋嫨妫�楠屽憳");
+ return;
+ }
+ try {
+ const data = {
+ ...assignForm.value,
+ id: currentAssignRow.value.id,
+ };
+ const res = await qualityInspectUpdate(data);
+ if (res.code === 200) {
+ showToast("鍒嗛厤鎴愬姛");
+ showAssignDialog.value = false;
+ setTimeout(() => {
+ getList();
+ }, 1000);
+ } else {
+ showToast("鍒嗛厤澶辫触锛�" + (res.msg || "鏈煡閿欒"));
+ }
+ } catch (error) {
+ console.error("鍒嗛厤澶辫触:", error);
+ showToast("鍒嗛厤澶辫触锛岃閲嶈瘯");
+ }
+ };
+
+ // 澶勭悊鍒嗛〉
+ const handlePagination = obj => {
+ page.value.current = obj.current;
+ page.value.size = obj.size;
+ getList();
+ };
+
+ onMounted(() => {
+ getList();
+ getUserList();
+ });
+
+ onShow(() => {
+ getList();
+ });
+</script>
+
+<style scoped lang="scss">
+ @import "../../../styles/sales-common.scss";
+
+ .material-inspection-page {
+ min-height: 100vh;
+ background: #f8f9fa;
+ padding-bottom: 80px;
+ }
+
+ // 鎼滅储鍖哄煙
+ .search-section {
+ padding: 20rpx 30rpx;
+ background-color: #ffffff;
+ position: sticky;
+ top: 0;
+ z-index: 10;
+ }
+
+ // 缁熻鍗$墖
+ .stats-cards {
+ display: flex;
+ padding: 15px;
+ gap: 10px;
+ background: #fff;
+ margin-bottom: 10px;
+ }
+
+ .stat-card {
+ flex: 1;
+ background: #2979ff;
+ border-radius: 12px;
+ padding: 15px;
+ text-align: center;
+ color: #fff;
+ box-shadow: 0 2px 8px rgba(41, 121, 255, 0.2);
+ }
+
+ .stat-number {
+ display: block;
+ font-size: 20px;
+ font-weight: 600;
+ margin-bottom: 5px;
+ }
+
+ .stat-label {
+ font-size: 12px;
+ opacity: 0.9;
+ }
+
+ // 妫�楠屽垪琛�
+ .inspection-list {
+ padding: 20px;
+ }
+
+ .inspection-item {
+ background: #ffffff;
+ border-radius: 12px;
+ margin-bottom: 16px;
+ overflow: hidden;
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
+ padding: 0 16px;
+
+ &:active {
+ transform: scale(0.98);
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
+ }
+ }
+
+ .item-header {
+ padding: 16px 0;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ }
+
+ .item-left {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ }
+
+ .material-icon {
+ width: 24px;
+ height: 24px;
+ background: #2979ff;
+ border-radius: 4px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+
+ .state-pending {
+ background: #ff9900;
+ }
+
+ .state-submitted {
+ background: #52c41a;
+ }
+
+ .material-info {
+ flex: 1;
+ }
+
+ .material-name {
+ font-size: 14px;
+ color: #333;
+ font-weight: 500;
+ }
+
+ .material-code {
+ font-size: 12px;
+ color: #999;
+ margin-left: 8px;
+ }
+
+ .status-tags {
+ display: flex;
+ gap: 8px;
+ }
+
+ .status-tag {
+ margin: 0;
+ }
+
+ .date-range {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ margin-top: 10px;
+ padding: 8px 12px;
+ background: #f8f9fa;
+ border-radius: 8px;
+ }
+
+ .date-text {
+ font-size: 12px;
+ color: #666;
+ }
+
+ // 璇︽儏琛�
+ .item-details {
+ padding: 16px 0;
+ }
+
+ .detail-row {
+ display: flex;
+ align-items: flex-end;
+ justify-content: space-between;
+ margin-bottom: 8px;
+
+ &:last-child {
+ margin-bottom: 0;
+ }
+ }
+
+ .detail-label {
+ font-size: 12px;
+ color: #777777;
+ min-width: 60px;
+ }
+
+ .detail-value {
+ font-size: 12px;
+ color: #000000;
+ text-align: right;
+ flex: 1;
+ margin-left: 16px;
+ }
+
+ // 鎿嶄綔鎸夐挳
+ .action-buttons {
+ display: flex;
+ gap: 12px;
+ padding: 0 0 16px 0;
+ justify-content: space-between;
+ }
+
+ .action-btn {
+ flex: 1;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 8px;
+ }
+
+ // 绌虹姸鎬�
+ .no-data {
+ padding: 60px 20px;
+ text-align: center;
+ }
+
+ // 娴姩鎸夐挳
+ .fab-button {
+ position: fixed;
+ bottom: 20px;
+ right: 20px;
+ width: 56px;
+ height: 56px;
+ background: #2979ff;
+ border-radius: 50%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ box-shadow: 0 4px 16px rgba(41, 121, 255, 0.3);
+ z-index: 1000;
+ }
+
+ // 鍒嗛厤妫�楠屽憳寮圭獥
+ .assign-dialog {
+ padding: 24px;
+ background: #ffffff;
+ border-radius: 16px;
+ overflow: hidden;
+ }
+
+ .dialog-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 24px;
+ padding-bottom: 16px;
+ border-bottom: 1px solid #f0f0f0;
+ }
+
+ .dialog-title {
+ font-size: 18px;
+ font-weight: 600;
+ color: #303133;
+ }
+
+ .dialog-content {
+ margin-bottom: 24px;
+ }
+
+ .dialog-footer {
+ display: flex;
+ gap: 16px;
+ padding-top: 16px;
+ border-top: 1px solid #f0f0f0;
+ }
+
+ .footer-btn {
+ flex: 1;
+ height: 44px;
+ font-size: 16px;
+ }
+
+ // 杈撳叆妗嗘牱寮�
+ :deep(.up-input__inner) {
+ border-radius: 8px;
+ height: 44px;
+ font-size: 14px;
+ }
+
+ // 琛ㄥ崟椤规牱寮�
+ :deep(.up-form-item) {
+ margin-bottom: 0;
+ }
+
+ :deep(.up-form-item__label) {
+ font-size: 14px;
+ color: #606266;
+ margin-bottom: 8px;
+ }
+
+ // 鎸夐挳鏍峰紡
+ :deep(.up-button--primary) {
+ border-radius: 8px;
+ }
+
+ :deep(.up-button--default) {
+ border-radius: 8px;
+ }
+
+ // 鍒嗛〉缁勪欢
+ .pagination {
+ padding: 20px;
+ background: #fff;
+ margin-top: 10px;
+ display: flex;
+ justify-content: center;
+ }
+</style>
diff --git a/src/pages/qualityManagement/rawMaterial/index.vue b/src/pages/qualityManagement/rawMaterial/index.vue
new file mode 100644
index 0000000..8f2d009
--- /dev/null
+++ b/src/pages/qualityManagement/rawMaterial/index.vue
@@ -0,0 +1,335 @@
+<template>
+ <view class="raw-material-page">
+ <PageHeader title="鍘熸潗鏂�" @back="goBack" />
+
+ <!-- 鎼滅储涓庣瓫閫� -->
+ <view class="search-section">
+ <up-search
+ placeholder="璇疯緭鍏ユ壒鍙�"
+ v-model="searchForm.batchNo"
+ @search="handleQuery"
+ @custom="handleQuery"
+ @clear="handleQuery"
+ :show-action="true"
+ action-text="鎼滅储"
+ :animation="true"
+ ></up-search>
+ <view class="filter-row">
+ <view class="filter-item" @click="showTypeSelect = true">
+ <text>{{ typeLabel }}</text>
+ <up-icon name="arrow-down" size="14" color="#999"></up-icon>
+ </view>
+ <view class="filter-item" @click="showStatusSelect = true">
+ <text>{{ statusLabel }}</text>
+ <up-icon name="arrow-down" size="14" color="#999"></up-icon>
+ </view>
+ </view>
+ </view>
+
+ <!-- 鍒楄〃鍖哄煙 -->
+ <view class="list-container" v-if="tableData.length > 0">
+ <view v-for="(item, index) in tableData" :key="index" class="list-item">
+ <view class="item-header">
+ <text class="product-name">{{ item.productName }}</text>
+ <up-tag :text="item.inspectState ? '宸叉彁浜�' : '鏈彁浜�'" :type="item.inspectState ? 'success' : 'warning'" size="mini"></up-tag>
+ </view>
+ <view class="item-content">
+ <view class="item-row">
+ <text class="item-label">鎵规鍙凤細</text>
+ <text class="item-value">{{ item.batchNo }}</text>
+ </view>
+ <view class="item-row">
+ <text class="item-label">妫�楠岀被鍨嬶細</text>
+ <text class="item-value">{{ item.checkTypeText || '-' }}</text>
+ </view>
+ <view class="item-row">
+ <text class="item-label">瑙勬牸鍨嬪彿锛�</text>
+ <text class="item-value">{{ item.model || '-' }}</text>
+ </view>
+ <view class="item-row">
+ <text class="item-label">妫�娴嬫棩鏈燂細</text>
+ <text class="item-value">{{ item.checkTime || '-' }}</text>
+ </view>
+ <view class="item-row">
+ <text class="item-label">妫�娴嬬粨鏋滐細</text>
+ <up-tag :text="item.checkResult === 1 ? '鍚堟牸' : '涓嶅悎鏍�'" :type="item.checkResult === 1 ? 'success' : 'error'" size="mini"></up-tag>
+ </view>
+ </view>
+ <view class="item-actions">
+ <up-button v-if="!item.inspectState" type="primary" size="mini" @click.stop="openForm('edit', item)">缂栬緫</up-button>
+ <up-button v-if="!item.inspectState" type="success" size="mini" @click.stop="handleConfirmSubmit(item)">鎻愪氦</up-button>
+ <up-button type="error" size="mini" @click.stop="handleDelete(item)">鍒犻櫎</up-button>
+ </view>
+ </view>
+ <view class="pagination-container">
+ <up-loadmore :status="loadStatus" @loadmore="getList" />
+ </view>
+ </view>
+
+ <view v-else class="no-data">
+ <up-empty mode="data" text="鏆傛棤鏁版嵁"></up-empty>
+ </view>
+
+ <!-- 娴姩鏂板鎸夐挳 -->
+ <view class="fab-button" @click="openForm('add')">
+ <up-icon name="plus" size="24" color="#ffffff"></up-icon>
+ </view>
+
+ <!-- 绫诲瀷閫夋嫨鍣� -->
+ <up-action-sheet
+ :actions="typeActions"
+ :show="showTypeSelect"
+ @close="showTypeSelect = false"
+ @select="selectType"
+ title="璇烽�夋嫨绫诲埆"
+ ></up-action-sheet>
+
+ <!-- 鐘舵�侀�夋嫨鍣� -->
+ <up-action-sheet
+ :actions="statusActions"
+ :show="showStatusSelect"
+ @close="showStatusSelect = false"
+ @select="selectStatus"
+ title="璇烽�夋嫨鎻愪氦鐘舵��"
+ ></up-action-sheet>
+ </view>
+</template>
+
+<script setup>
+import { ref, reactive, onMounted, computed } from 'vue';
+import {
+ findRawMaterialListPage,
+ submitRawMaterial,
+ deleteRawMaterial
+} from '@/api/qualityManagement/rawMaterial.js';
+import { toast, showConfirm } from '@/utils/common';
+import useUserStore from '@/store/modules/user';
+
+const userStore = useUserStore();
+
+const searchForm = reactive({
+ batchNo: '',
+ checkType: '',
+ inspectState: ''
+});
+
+const tableData = ref([]);
+const page = reactive({
+ current: 1,
+ size: 20,
+ total: 0
+});
+const loadStatus = ref('loadmore');
+
+const showTypeSelect = ref(false);
+const typeActions = [
+ { name: '鍏ㄩ儴', value: '' },
+ { name: '鍏ュ巶妫�', value: '0' },
+ { name: '杞﹂棿妫�', value: '1' },
+ { name: '鍑哄巶妫�', value: '2' }
+];
+const typeLabel = computed(() => {
+ const action = typeActions.find(a => a.value === searchForm.checkType);
+ return action ? action.name : '鍏ㄩ儴绫诲埆';
+});
+
+const showStatusSelect = ref(false);
+const statusActions = [
+ { name: '鍏ㄩ儴', value: '' },
+ { name: '鏈彁浜�', value: '0' },
+ { name: '宸叉彁浜�', value: '1' }
+];
+const statusLabel = computed(() => {
+ const action = statusActions.find(a => a.value === searchForm.inspectState);
+ return action ? action.name : '鍏ㄩ儴鐘舵��';
+});
+
+const getList = () => {
+ if (loadStatus.value === 'loading' || (page.total > 0 && tableData.value.length >= page.total)) return;
+
+ loadStatus.value = 'loading';
+ const params = {
+ batchNo: searchForm.batchNo || null,
+ checkType: searchForm.checkType || null,
+ inspectState: searchForm.inspectState || null,
+ current: page.current,
+ size: page.size
+ };
+
+ findRawMaterialListPage(params).then(res => {
+ const records = res?.data?.records || [];
+ if (page.current === 1) {
+ tableData.value = records;
+ } else {
+ tableData.value = [...tableData.value, ...records];
+ }
+ page.total = res?.data?.total || 0;
+
+ if (tableData.value.length >= page.total) {
+ loadStatus.value = 'nomore';
+ } else {
+ loadStatus.value = 'loadmore';
+ page.current++;
+ }
+ }).catch(() => {
+ loadStatus.value = 'loadmore';
+ });
+};
+
+const handleQuery = () => {
+ page.current = 1;
+ page.total = 0;
+ tableData.value = [];
+ loadStatus.value = 'loadmore';
+ getList();
+};
+
+const selectType = (e) => {
+ searchForm.checkType = e.value;
+ handleQuery();
+};
+
+const selectStatus = (e) => {
+ searchForm.inspectState = e.value;
+ handleQuery();
+};
+
+const openForm = (type, item) => {
+ // Mobile usually navigates to a new page for add/edit if complex
+ // Here we'll just show a toast for now as the actual form components are many
+ toast('鍔熻兘寮�鍙戜腑锛岃鍦≒C绔搷浣�');
+};
+
+const handleConfirmSubmit = (row) => {
+ showConfirm('纭鎻愪氦璇ユ楠岃褰曞悧锛�').then(res => {
+ if (res.confirm) {
+ submitRawMaterial(row.id).then(() => {
+ toast('鎻愪氦鎴愬姛');
+ handleQuery();
+ });
+ }
+ });
+};
+
+const handleDelete = (row) => {
+ showConfirm('纭鍒犻櫎璇ヨ褰曞悧锛�').then(res => {
+ if (res.confirm) {
+ deleteRawMaterial({ id: row.id }).then(() => {
+ toast('鍒犻櫎鎴愬姛');
+ handleQuery();
+ });
+ }
+ });
+};
+
+const goBack = () => {
+ uni.navigateBack();
+};
+
+onMounted(() => {
+ handleQuery();
+});
+</script>
+
+<style lang="scss" scoped>
+.raw-material-page {
+ padding-bottom: 20rpx;
+ background-color: #f5f7fa;
+ min-height: 100vh;
+}
+
+.search-section {
+ padding: 20rpx 30rpx;
+ background-color: #ffffff;
+ position: sticky;
+ top: 0;
+ z-index: 10;
+}
+
+.filter-row {
+ display: flex;
+ justify-content: space-around;
+ padding: 10rpx 0;
+}
+
+.filter-item {
+ display: flex;
+ align-items: center;
+ gap: 10rpx;
+ font-size: 28rpx;
+ color: #606266;
+}
+
+.list-container {
+ padding: 20rpx;
+}
+
+.list-item {
+ background-color: #ffffff;
+ border-radius: 16rpx;
+ padding: 30rpx;
+ margin-bottom: 20rpx;
+ box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05);
+}
+
+.item-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 20rpx;
+}
+
+.product-name {
+ font-size: 30rpx;
+ font-weight: bold;
+ color: #303133;
+}
+
+.item-content {
+ margin-bottom: 20rpx;
+}
+
+.item-row {
+ display: flex;
+ margin-bottom: 10rpx;
+}
+
+.item-label {
+ color: #909399;
+ width: 180rpx;
+ font-size: 28rpx;
+}
+
+.item-value {
+ flex: 1;
+ color: #303133;
+ font-size: 28rpx;
+}
+
+.item-actions {
+ display: flex;
+ justify-content: flex-end;
+ gap: 20rpx;
+ border-top: 1rpx solid #ebeef5;
+ padding-top: 20rpx;
+}
+
+.no-data {
+ padding-top: 200rpx;
+}
+
+.fab-button {
+ position: fixed;
+ right: 40rpx;
+ bottom: 60rpx;
+ width: 100rpx;
+ height: 100rpx;
+ background-color: #3c9cff;
+ border-radius: 50%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ box-shadow: 0 4rpx 16rpx rgba(60, 156, 255, 0.4);
+ z-index: 99;
+}
+</style>
diff --git a/src/pages/qualityManagement/visualization/qualityDashboard.vue b/src/pages/qualityManagement/visualization/qualityDashboard.vue
new file mode 100644
index 0000000..d39e256
--- /dev/null
+++ b/src/pages/qualityManagement/visualization/qualityDashboard.vue
@@ -0,0 +1,276 @@
+<template>
+ <view class="quality-dashboard-page">
+ <PageHeader title="璐ㄩ噺鐪嬫澘" @back="goBack" />
+
+ <scroll-view scroll-y class="dashboard-scroll">
+ <!-- 鏍峰搧鐘舵�佸垪琛� -->
+ <view class="dashboard-card">
+ <view class="card-header">
+ <text class="card-title">妫�娴嬫牱鍝佸姩鎬佺姸鎬�</text>
+ <up-switch v-model="voiceEnabled" size="18" activeText="璇煶" inactiveText="闈欓煶"></up-switch>
+ </view>
+ <view class="status-list">
+ <view v-for="item in sampleStatus" :key="item.id" class="status-item">
+ <view class="status-left">
+ <view class="status-dot" :class="item.status"></view>
+ <text class="sample-name">{{ item.name }}</text>
+ </view>
+ <view class="status-right">
+ <up-tag :text="statusLabel(item.status)" :type="statusTagType(item.status)" size="mini"></up-tag>
+ <text class="sample-time">{{ item.time }}</text>
+ </view>
+ </view>
+ </view>
+ </view>
+
+ <!-- 鍚堟牸鐜囧垎鏋� (浠〃鐩�) -->
+ <view class="dashboard-card">
+ <view class="card-header">
+ <text class="card-title">鍚堟牸鐜囧垎鏋�</text>
+ </view>
+ <view class="chart-box">
+ <qiun-data-charts
+ type="gauge"
+ :opts="gaugeOpts"
+ :chartData="gaugeData"
+ />
+ </view>
+ <view class="passrate-summary">
+ <text>褰撳墠鍚堟牸鐜囷細</text>
+ <text class="highlight">{{ (passRate * 100).toFixed(1) }}%</text>
+ </view>
+ </view>
+
+ <!-- 浠诲姟鎺掕 (鏌辩姸鍥�) -->
+ <view class="dashboard-card">
+ <view class="card-header">
+ <text class="card-title">浠诲姟鎺掕 (Top 10)</text>
+ </view>
+ <view class="chart-box">
+ <qiun-data-charts
+ type="column"
+ :opts="columnOpts"
+ :chartData="columnData"
+ />
+ </view>
+ </view>
+
+ <!-- 鍘嗗彶瓒嬪娍 (鎶樼嚎鍥�) -->
+ <view class="dashboard-card">
+ <view class="card-header">
+ <text class="card-title">鍘嗗彶瓒嬪娍</text>
+ </view>
+ <view class="chart-box">
+ <qiun-data-charts
+ type="line"
+ :opts="lineOpts"
+ :chartData="lineData"
+ />
+ </view>
+ </view>
+ </scroll-view>
+ </view>
+</template>
+
+<script setup>
+import { ref, reactive, onMounted, onBeforeUnmount } from 'vue';
+
+const voiceEnabled = ref(false);
+let dataTimer = null;
+
+// 1) 鏍峰搧鍔ㄦ�佺姸鎬�
+const sampleStatus = ref([]);
+const statusPool = ['processing', 'warning', 'error', 'success'];
+
+const statusLabel = (s) => {
+ const labels = { 'processing': '妫�娴嬩腑', 'warning': '棰勮', 'error': '涓嶅悎鏍�', 'success': '鍚堟牸' };
+ return labels[s] || '鏈煡';
+};
+
+const statusTagType = (s) => {
+ const types = { 'processing': 'primary', 'warning': 'warning', 'error': 'error', 'success': 'success' };
+ return types[s] || 'info';
+};
+
+const randomSample = () => {
+ const id = Math.random().toString(36).slice(2, 8);
+ const status = statusPool[Math.floor(Math.random() * statusPool.length)];
+ const name = `鏍峰搧-${Math.floor(Math.random() * 900 + 100)}`;
+ const time = new Date().toLocaleTimeString('zh-CN', { hour12: false });
+ return { id, name, status, time };
+};
+
+// 2) 鍚堟牸鐜囧垎鏋� (浠〃鐩�)
+const passRate = ref(0.92);
+const gaugeData = ref({
+ categories: [{ value: 0.92, color: "#2fc25b" }],
+ series: [{ name: "鍚堟牸鐜�", data: 0.92 }]
+});
+const gaugeOpts = {
+ title: { name: "鍚堟牸鐜�", color: "#2fc25b", fontSize: 16 },
+ subtitle: { name: "92%", color: "#666666", fontSize: 12 },
+ extra: { gauge: { type: "default", width: 15, labelColor: "#666666", splitLine: { fixRadius: -10 } } }
+};
+
+// 3) 浠诲姟鎺掕 (鏌辩姸鍥�)
+const columnData = ref({
+ categories: ["浠诲姟1", "浠诲姟2", "浠诲姟3", "浠诲姟4", "浠诲姟5"],
+ series: [{ name: "瀹屾垚鏁�", data: [35, 36, 31, 33, 13] }]
+});
+const columnOpts = {
+ color: ["#1890FF"],
+ padding: [15, 15, 0, 5],
+ enableScroll: false,
+ xAxis: { disableGrid: true },
+ yAxis: { data: [{ min: 0 }] },
+ extra: { column: { type: "group", width: 30, activeBgColor: "#000000", activeBgOpacity: 0.08 } }
+};
+
+// 4) 鍘嗗彶瓒嬪娍 (鎶樼嚎鍥�)
+const lineData = ref({
+ categories: ["10:00", "10:05", "10:10", "10:15", "10:20"],
+ series: [
+ { name: "鏉ユ牱鏁�", data: [35, 8, 25, 37, 4, 20] },
+ { name: "瀹屾垚鏁�", data: [70, 40, 65, 100, 44, 68] }
+ ]
+});
+const lineOpts = {
+ color: ["#1890FF", "#91CB74"],
+ padding: [15, 10, 0, 15],
+ enableScroll: false,
+ xAxis: { disableGrid: true },
+ yAxis: { gridType: "dash", dashLength: 2 },
+ legend: { position: "top" },
+ extra: { line: { type: "straight", width: 2 } }
+};
+
+const refreshData = () => {
+ // 妯℃嫙鏁版嵁鏇存柊
+ const next = randomSample();
+ sampleStatus.value = [next, ...sampleStatus.value].slice(0, 5);
+
+ const delta = (Math.random() - 0.5) * 0.02;
+ passRate.value = Math.min(0.99, Math.max(0.6, passRate.value + delta));
+ gaugeData.value = {
+ series: [{ name: "鍚堟牸鐜�", data: passRate.value }]
+ };
+ gaugeOpts.subtitle.name = (passRate.value * 100).toFixed(1) + '%';
+};
+
+const goBack = () => {
+ uni.navigateBack();
+};
+
+onMounted(() => {
+ for (let i = 0; i < 5; i++) {
+ sampleStatus.value.push(randomSample());
+ }
+ dataTimer = setInterval(refreshData, 3000);
+});
+
+onBeforeUnmount(() => {
+ if (dataTimer) clearInterval(dataTimer);
+});
+</script>
+
+<style lang="scss" scoped>
+.quality-dashboard-page {
+ background-color: #f5f7fa;
+ height: 100vh;
+ display: flex;
+ flex-direction: column;
+}
+
+.dashboard-scroll {
+ flex: 1;
+ padding: 20rpx;
+}
+
+.dashboard-card {
+ background-color: #ffffff;
+ border-radius: 16rpx;
+ padding: 30rpx;
+ margin-bottom: 30rpx;
+ box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05);
+}
+
+.card-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 30rpx;
+ border-left: 8rpx solid #3c9cff;
+ padding-left: 20rpx;
+}
+
+.card-title {
+ font-size: 30rpx;
+ font-weight: bold;
+ color: #303133;
+}
+
+.status-list {
+ display: flex;
+ flex-direction: column;
+ gap: 20rpx;
+}
+
+.status-item {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 10rpx 0;
+}
+
+.status-left {
+ display: flex;
+ align-items: center;
+ gap: 15rpx;
+}
+
+.status-dot {
+ width: 12rpx;
+ height: 12rpx;
+ border-radius: 50%;
+
+ &.processing { background-color: #3c9cff; }
+ &.warning { background-color: #f9ae3d; }
+ &.error { background-color: #f56c6c; }
+ &.success { background-color: #5ac725; }
+}
+
+.sample-name {
+ font-size: 28rpx;
+ color: #303133;
+}
+
+.status-right {
+ display: flex;
+ align-items: center;
+ gap: 20rpx;
+}
+
+.sample-time {
+ font-size: 24rpx;
+ color: #909399;
+}
+
+.chart-box {
+ width: 100%;
+ height: 400rpx;
+}
+
+.passrate-summary {
+ text-align: center;
+ margin-top: 20rpx;
+ font-size: 28rpx;
+ color: #606266;
+
+ .highlight {
+ font-size: 36rpx;
+ font-weight: bold;
+ color: #3c9cff;
+ margin-left: 10rpx;
+ }
+}
+</style>
diff --git a/src/utils/native.ts b/src/utils/native.ts
new file mode 100644
index 0000000..66c79e5
--- /dev/null
+++ b/src/utils/native.ts
@@ -0,0 +1,56 @@
+/**
+ * 鍘熺敓鑳藉姏灏佽锛堟敮鎸佹潯浠剁紪璇戯級
+ */
+
+/**
+ * 鎵爜
+ */
+export function scanCode(): Promise<any> {
+ return new Promise((resolve, reject) => {
+ // #ifdef APP-PLUS || MP-WEIXIN
+ uni.scanCode({
+ success: (res) => resolve(res),
+ fail: (err) => reject(err)
+ });
+ // #endif
+
+ // #ifdef H5
+ // H5绔�氬父闇�瑕侀�氳繃寰俊JS-SDK鎴栫壒瀹氱殑鎵爜搴�
+ uni.showToast({ title: 'H5绔壂鐮侀渶鎺ュ叆寰俊JS-SDK', icon: 'none' });
+ reject(new Error('H5 scan not implemented'));
+ // #endif
+ });
+}
+
+/**
+ * 鎷嶇収鎴栭�夋嫨鍥剧墖
+ */
+export function chooseImage(count: number = 1): Promise<any> {
+ return new Promise((resolve, reject) => {
+ uni.chooseImage({
+ count,
+ sizeType: ['compressed'],
+ sourceType: ['camera', 'album'],
+ success: (res) => resolve(res),
+ fail: (err) => reject(err)
+ });
+ });
+}
+
+/**
+ * 钃濈墮鍒濆鍖栵紙绀轰緥锛�
+ */
+export function initBluetooth(): Promise<any> {
+ return new Promise((resolve, reject) => {
+ // #ifdef APP-PLUS || MP-WEIXIN
+ uni.openBluetoothAdapter({
+ success: (res) => resolve(res),
+ fail: (err) => reject(err)
+ });
+ // #endif
+
+ // #ifdef H5
+ reject(new Error('H5 does not support bluetooth'));
+ // #endif
+ });
+}
--
Gitblit v1.9.3