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/pages/qualityManagement/InspectItem/index.vue |  340 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 340 insertions(+), 0 deletions(-)

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>

--
Gitblit v1.9.3