From ec00255aab24865cd785e181704e502354b9c8f6 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期五, 13 三月 2026 13:52:49 +0800
Subject: [PATCH] Merge branch 'dev_KT' of http://114.132.189.42:9002/r/product-inventory-APP-before into dev_KT
---
src/pages/inspectionManagement/index.vue | 545 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 545 insertions(+), 0 deletions(-)
diff --git a/src/pages/inspectionManagement/index.vue b/src/pages/inspectionManagement/index.vue
new file mode 100644
index 0000000..349d1d0
--- /dev/null
+++ b/src/pages/inspectionManagement/index.vue
@@ -0,0 +1,545 @@
+<template>
+ <view class="inspection-management-page">
+ <PageHeader title="宸℃浠诲姟绠$悊"
+ @back="goBack" />
+ <view class="toolbar">
+ <view class="tab-wrap">
+ <view v-for="tab in tabs"
+ :key="tab.name"
+ class="tab-item"
+ :class="{ active: activeTab === tab.name }"
+ @click="switchTab(tab.name)">
+ {{ tab.label }}
+ </view>
+ </view>
+ <view class="search-section">
+ <view class="search-bar">
+ <view class="search-input">
+ <up-input class="search-text"
+ placeholder="璇疯緭鍏ュ贰妫�浠诲姟鍚嶇О"
+ v-model="queryParams.taskName"
+ clearable />
+ </view>
+ <view class="search-button"
+ @click="handleQuery">
+ <up-icon name="search"
+ size="24"
+ color="#999"></up-icon>
+ </view>
+ </view>
+ </view>
+ <view class="meta-bar">
+ <text class="meta-text">鍏� {{ total }} 鏉�</text>
+ </view>
+ </view>
+ <view class="list-section">
+ <uni-swipe-action>
+ <uni-swipe-action-item v-for="item in tableData"
+ :key="item.id"
+ :right-options="activeTab === 'taskManage' ? swipeOptions : []"
+ :disabled="activeTab !== 'taskManage'"
+ @click="onSwipeActionClick($event, item)">
+ <view class="ledger-item">
+ <view class="item-header">
+ <view class="item-left">
+ <view class="document-icon">
+ <up-icon name="file-text"
+ size="14"
+ color="#ffffff"></up-icon>
+ </view>
+ <text class="item-id">{{ item.taskName || "--" }}</text>
+ </view>
+ <view class="item-right">
+ <u-tag :type="getFrequencyTagType(item.frequencyType)"
+ :text="formatFrequency(item.frequencyType) || '鏈煡棰戞'" />
+ </view>
+ </view>
+ <up-divider></up-divider>
+ <view class="item-details">
+ <view class="detail-row">
+ <text class="detail-label">浠诲姟缂栧彿</text>
+ <text class="detail-value">{{ item.id || "--" }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">鎵ц宸℃浜�</text>
+ <view class="tag-wrap"
+ v-if="item.inspector?.length">
+ <uni-tag v-for="(person, index) in item.inspector"
+ :key="index"
+ :text="person"
+ type="primary"
+ size="small"
+ inverted />
+ </view>
+ <text class="detail-value"
+ v-else>--</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">寮�濮嬫棩鏈熶笌鏃堕棿</text>
+ <text class="detail-value highlight">{{ formatFrequencyDetail(item.frequencyDetail) }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">鐧昏浜�</text>
+ <text class="detail-value">{{ item.registrant || "--" }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">鐧昏鏃ユ湡</text>
+ <text class="detail-value">{{ item.createTime || "--" }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">澶囨敞</text>
+ <text class="detail-value">{{ item.remarks || "鏃�" }}</text>
+ </view>
+ <up-divider></up-divider>
+ <view class="card-actions">
+ <u-button v-if="activeTab === 'taskManage'"
+ type="primary"
+ size="small"
+ class="action-btn"
+ @click.stop="handleAdd(item)">缂栬緫</u-button>
+ <u-button v-else
+ type="success"
+ size="small"
+ class="action-btn"
+ @click.stop="viewFile(item)">鏌ョ湅闄勪欢</u-button>
+ </view>
+ </view>
+ </view>
+ </uni-swipe-action-item>
+ </uni-swipe-action>
+ <uni-load-more :status="loadMoreStatus"></uni-load-more>
+ <view v-if="!loading && tableData.length === 0"
+ class="no-data">
+ <text>鏆傛棤鏁版嵁</text>
+ </view>
+ </view>
+ <view v-if="activeTab === 'taskManage'"
+ class="fab-button"
+ @click="handleAdd()">
+ <up-icon name="plus"
+ size="24"
+ color="#ffffff"></up-icon>
+ </view>
+ <form-dia ref="formDia"
+ @closeDia="handleQuery" />
+ <view-files ref="viewFiles" />
+ </view>
+</template>
+
+<script setup>
+ import { ref, reactive, computed, nextTick } from "vue";
+ import { onShow, onReachBottom, onPullDownRefresh } from "@dcloudio/uni-app";
+ import PageHeader from "@/components/PageHeader.vue";
+ import FormDia from "@/pages/inspectionManagement/components/formDia.vue";
+ import ViewFiles from "@/pages/inspectionManagement/components/viewFiles.vue";
+ import {
+ delTimingTask,
+ inspectionTaskList,
+ timingTaskList,
+ } from "@/api/inspectionManagement/index.js";
+
+ const formDia = ref();
+ const viewFiles = ref();
+ const activeTab = ref("taskManage");
+ const tabs = [
+ { name: "taskManage", label: "瀹氭椂浠诲姟绠$悊" },
+ { name: "task", label: "瀹氭椂浠诲姟璁板綍" },
+ ];
+ const queryParams = reactive({
+ taskName: "",
+ });
+ const pageParams = reactive({
+ current: 1,
+ size: 10,
+ });
+ const total = ref(0);
+ const loading = ref(false);
+ const tableData = ref([]);
+ const swipeOptions = [
+ {
+ text: "鍒犻櫎",
+ style: {
+ backgroundColor: "#ee0a24",
+ },
+ },
+ ];
+
+ const noMore = computed(() => tableData.value.length >= total.value);
+ const loadMoreStatus = computed(() => {
+ if (loading.value) return "loading";
+ if (noMore.value) return "noMore";
+ return "more";
+ });
+
+ const goBack = () => {
+ uni.navigateBack();
+ };
+
+ const formatFrequency = value => {
+ if (value === "DAILY") return "姣忔棩";
+ if (value === "WEEKLY") return "姣忓懆";
+ if (value === "MONTHLY") return "姣忔湀";
+ if (value === "QUARTERLY") return "瀛e害";
+ return "";
+ };
+
+ const getFrequencyTagType = value => {
+ if (value === "DAILY") return "success";
+ if (value === "WEEKLY") return "primary";
+ if (value === "MONTHLY") return "warning";
+ return "info";
+ };
+
+ const formatFrequencyDetail = value => {
+ if (!value || typeof value !== "string") return "--";
+ return value.replace(
+ /MON|TUE|WED|THU|FRI|SAT|SUN/g,
+ item =>
+ ({
+ MON: "鍛ㄤ竴",
+ TUE: "鍛ㄤ簩",
+ WED: "鍛ㄤ笁",
+ THU: "鍛ㄥ洓",
+ FRI: "鍛ㄤ簲",
+ SAT: "鍛ㄥ叚",
+ SUN: "鍛ㄦ棩",
+ })[item] || item
+ );
+ };
+
+ const normalizeInspector = val => {
+ if (!val) return [];
+ if (Array.isArray(val)) return val.filter(Boolean);
+ if (typeof val === "string") {
+ return val
+ .split(",")
+ .map(item => item.trim())
+ .filter(Boolean);
+ }
+ return [String(val)];
+ };
+
+ const switchTab = tabName => {
+ if (activeTab.value === tabName) return;
+ activeTab.value = tabName;
+ handleQuery();
+ };
+
+ const getList = async () => {
+ if (loading.value) return;
+ loading.value = true;
+ try {
+ const params = {
+ ...queryParams,
+ current: pageParams.current,
+ size: pageParams.size,
+ };
+ const request = activeTab.value === "task" ? inspectionTaskList : timingTaskList;
+ const res = await request(params);
+ const records = res?.data?.records || [];
+ const normalized = records.map(item => ({
+ ...item,
+ inspector: normalizeInspector(item.inspector),
+ }));
+ if (pageParams.current === 1) {
+ tableData.value = normalized;
+ } else {
+ tableData.value = [...tableData.value, ...normalized];
+ }
+ total.value = Number(res?.data?.total || 0);
+ } catch (error) {
+ if (pageParams.current === 1) {
+ tableData.value = [];
+ }
+ uni.showToast({
+ title: "鑾峰彇鏁版嵁澶辫触",
+ icon: "none",
+ });
+ } finally {
+ loading.value = false;
+ }
+ };
+
+ const handleQuery = () => {
+ pageParams.current = 1;
+ total.value = 0;
+ getList();
+ };
+
+ const loadMore = () => {
+ if (loading.value || noMore.value) return;
+ pageParams.current += 1;
+ getList();
+ };
+
+ const handleAdd = row => {
+ nextTick(() => {
+ formDia.value?.openDialog(row ? "edit" : "add", row);
+ });
+ };
+
+ const viewFile = row => {
+ nextTick(() => {
+ viewFiles.value?.openDialog(row);
+ });
+ };
+
+ const deleteOne = async row => {
+ if (!row?.id) return;
+ const canDelete = await new Promise(resolve => {
+ uni.showModal({
+ title: "鎻愮ず",
+ content: "鏄惁纭鍒犻櫎璇ュ贰妫�浠诲姟锛�",
+ success: modalRes => resolve(Boolean(modalRes.confirm)),
+ fail: () => resolve(false),
+ });
+ });
+ if (!canDelete) return;
+ try {
+ await delTimingTask([row.id]);
+ uni.showToast({
+ title: "鍒犻櫎鎴愬姛",
+ icon: "success",
+ });
+ handleQuery();
+ } catch (error) {
+ uni.showToast({
+ title: "鍒犻櫎澶辫触",
+ icon: "none",
+ });
+ }
+ };
+
+ const onSwipeActionClick = (event, row) => {
+ if (activeTab.value !== "taskManage") return;
+ if (event?.position !== "right") return;
+ deleteOne(row);
+ };
+
+ onShow(() => {
+ handleQuery();
+ });
+
+ onReachBottom(() => {
+ loadMore();
+ });
+
+ onPullDownRefresh(() => {
+ handleQuery();
+ uni.stopPullDownRefresh();
+ });
+</script>
+
+<style scoped>
+ .inspection-management-page {
+ min-height: 100vh;
+ background: #f6f7fb;
+ }
+
+ .toolbar {
+ padding: 20rpx 24rpx;
+ background: #fff;
+ border-bottom: 1rpx solid #f0f0f0;
+ position: sticky;
+ top: 0;
+ z-index: 10;
+ }
+
+ .tab-wrap {
+ display: flex;
+ background: #f4f5f8;
+ border-radius: 16rpx;
+ padding: 6rpx;
+ }
+
+ .tab-item {
+ flex: 1;
+ text-align: center;
+ padding: 14rpx 0;
+ font-size: 26rpx;
+ color: #666;
+ border-radius: 12rpx;
+ }
+
+ .tab-item.active {
+ background: #1677ff;
+ color: #fff;
+ font-weight: 600;
+ }
+
+ .search-section {
+ margin-top: 20rpx;
+ }
+
+ .search-bar {
+ display: flex;
+ align-items: center;
+ background: #f7f8fa;
+ border-radius: 14rpx;
+ padding: 8rpx 12rpx 8rpx 16rpx;
+ border: 1rpx solid #eef1f5;
+ }
+
+ .search-input {
+ flex: 1;
+ min-width: 0;
+ }
+
+ .search-text {
+ background: transparent !important;
+ }
+
+ :deep(.search-text .u-input__content),
+ :deep(.search-text .up-input__content) {
+ background: transparent !important;
+ padding: 0 !important;
+ }
+
+ .search-button {
+ width: 64rpx;
+ height: 64rpx;
+ border-radius: 12rpx;
+ background: #ffffff;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+
+ .meta-bar {
+ margin-top: 16rpx;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ background: #f7f9fc;
+ border-radius: 12rpx;
+ padding: 10rpx 16rpx;
+ }
+
+ .meta-text {
+ color: #5c6b8a;
+ font-size: 22rpx;
+ }
+
+ .list-section {
+ padding: 20rpx 24rpx;
+ padding-bottom: calc(132rpx + env(safe-area-inset-bottom));
+ }
+
+ .ledger-item {
+ background: #ffffff;
+ border-radius: 20rpx;
+ margin-bottom: 16rpx;
+ overflow: hidden;
+ box-shadow: 0 8rpx 20rpx rgba(0, 0, 0, 0.05);
+ padding: 0 20rpx;
+ }
+
+ .item-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 22rpx 0;
+ }
+
+ .item-left {
+ display: flex;
+ align-items: center;
+ gap: 10rpx;
+ flex: 1;
+ min-width: 0;
+ }
+
+ .item-right {
+ display: flex;
+ align-items: center;
+ }
+
+ .document-icon {
+ width: 38rpx;
+ height: 38rpx;
+ border-radius: 8rpx;
+ background: #2979ff;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+
+ .item-id {
+ font-size: 28rpx;
+ color: #1f1f1f;
+ font-weight: 600;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+
+ .item-details {
+ padding: 18rpx 0 20rpx;
+ }
+
+ .detail-row {
+ display: flex;
+ align-items: flex-end;
+ justify-content: space-between;
+ margin-bottom: 12rpx;
+ }
+
+ .detail-label {
+ min-width: 160rpx;
+ color: #777;
+ font-size: 24rpx;
+ }
+
+ .detail-value {
+ flex: 1;
+ color: #333;
+ font-size: 24rpx;
+ text-align: right;
+ word-break: break-all;
+ margin-left: 12rpx;
+ }
+
+ .detail-value.highlight {
+ color: #2979ff;
+ font-weight: 500;
+ }
+
+ .tag-wrap {
+ flex: 1;
+ display: flex;
+ gap: 10rpx;
+ flex-wrap: wrap;
+ justify-content: flex-end;
+ }
+
+ .card-actions {
+ padding-top: 8rpx;
+ display: flex;
+ justify-content: flex-end;
+ }
+
+ .action-btn {
+ min-width: 140rpx;
+ }
+
+ .fab-button {
+ position: fixed;
+ bottom: calc(30px + env(safe-area-inset-bottom));
+ right: 30px;
+ 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;
+ }
+
+ .no-data {
+ padding: 40rpx 0;
+ text-align: center;
+ color: #999;
+ }
+</style>
--
Gitblit v1.9.3