From a60d21cdda7df7733050315fc6462a70c273fcb4 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期三, 04 二月 2026 17:01:02 +0800
Subject: [PATCH] Merge branch 'dev_new' of http://114.132.189.42:9002/r/product-inventory-APP-before into dev_new

---
 src/pages/safeProduction/accidentReportingRecord/index.vue |  357 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 357 insertions(+), 0 deletions(-)

diff --git a/src/pages/safeProduction/accidentReportingRecord/index.vue b/src/pages/safeProduction/accidentReportingRecord/index.vue
new file mode 100644
index 0000000..07e42fb
--- /dev/null
+++ b/src/pages/safeProduction/accidentReportingRecord/index.vue
@@ -0,0 +1,357 @@
+<template>
+  <view class="accident-report">
+    <!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 -->
+    <PageHeader title="浜嬫晠涓婃姤璁板綍"
+                @back="goBack" />
+    <!-- 鎼滅储鍖哄煙 -->
+    <view class="search-section">
+      <view class="search-bar">
+        <view class="search-input">
+          <up-input class="search-text"
+                    placeholder="璇疯緭鍏ヤ簨鏁呭悕绉�"
+                    v-model="accidentName"
+                    @change="searchChange"
+                    clearable />
+        </view>
+        <view class="filter-button"
+              @click="getList">
+          <u-icon name="search"
+                  size="24"
+                  color="#999"></u-icon>
+        </view>
+      </view>
+    </view>
+    <!-- 浜嬫晠璁板綍鍒楄〃 -->
+    <view class="ledger-list"
+          v-if="accidentList.length > 0">
+      <view v-for="(item, index) in accidentList"
+            :key="index">
+        <view class="ledger-item">
+          <!-- <view class="item-header">
+            <view class="item-left">
+              <view class="document-icon">
+                <up-icon name="file-text"
+                         size="16"
+                         color="#ffffff"></up-icon>
+              </view>
+              <text class="item-id">浜嬫晠鍚嶇О锛歿{ item.accidentName }}</text>
+            </view>
+          </view> -->
+          <view class="item-header">
+            <view class="item-left">
+              <view class="document-icon">
+                <up-icon name="file-text"
+                         size="16"
+                         color="#ffffff"></up-icon>
+              </view>
+              <text class="item-title">浜嬫晠鍚嶇О锛歿{ item.accidentName }}</text>
+            </view>
+          </view>
+          <up-divider></up-divider>
+          <view class="item-details">
+            <view class="detail-row">
+              <text class="detail-label">浜嬫晠缂栫爜</text>
+              <text class="detail-value">{{ item.accidentCode || '-' }}</text>
+            </view>
+            <view class="detail-row">
+              <text class="detail-label">浜嬫晠绫诲瀷</text>
+              <text class="detail-value">{{ accidentTypeLabel(item.accidentType) || '-' }}</text>
+            </view>
+            <view class="detail-row">
+              <text class="detail-label">鍙戠敓鏃堕棿</text>
+              <text class="detail-value">{{ item.happenTime || '-' }}</text>
+            </view>
+            <view class="detail-row">
+              <text class="detail-label">浜嬫晠鍦扮偣</text>
+              <text class="detail-value">{{ item.happenLocation || '-' }}</text>
+            </view>
+            <view class="detail-row">
+              <text class="detail-label">浜嬫晠绛夌骇</text>
+              <u-tag :type="accidentGradeType(item.accidentGrade)">
+                {{ item.accidentGrade || '-' }}
+              </u-tag>
+            </view>
+          </view>
+          <!-- 鎸夐挳鍖哄煙 -->
+          <view class="action-buttons">
+            <u-button type="info"
+                      size="small"
+                      class="action-btn"
+                      @click="viewDetail(item)">
+              鏌ョ湅璇︽儏
+            </u-button>
+            <u-button type="primary"
+                      size="small"
+                      class="action-btn"
+                      @click="editAccident(item)">
+              缂栬緫
+            </u-button>
+            <u-button type="error"
+                      size="small"
+                      class="action-btn"
+                      @click="deleteAccident(item)">
+              鍒犻櫎
+            </u-button>
+          </view>
+        </view>
+      </view>
+    </view>
+    <view v-else
+          class="no-data">
+      <text>鏆傛棤浜嬫晠璁板綍</text>
+    </view>
+    <!-- 娴姩鏂板鎸夐挳 -->
+    <view class="fab-button"
+          @click="addAccident">
+      <up-icon name="plus"
+               size="24"
+               color="#ffffff"></up-icon>
+    </view>
+  </view>
+</template>
+
+<script setup>
+  import { ref, onMounted, computed } from "vue";
+  import { onShow } from "@dcloudio/uni-app";
+  import PageHeader from "@/components/PageHeader.vue";
+  import {
+    safeAccidentListPage,
+    safeAccidentDel,
+  } from "@/api/safeProduction/accidentReportingRecord";
+  import { useDict } from "@/utils/dict";
+
+  // 鏇挎崲 toast 鏂规硶
+  defineOptions({ name: "accident-report-index" });
+  const showToast = message => {
+    uni.showToast({
+      title: message,
+      icon: "none",
+    });
+  };
+  // 搴旀�ラ妗堢被鍨嬮�夐」
+  const { accident_type } = useDict("accident_type");
+  const emergencyPlanTypeOptions = computed(() => accident_type?.value || []);
+
+  // 鎼滅储鍏抽敭璇�
+  const accidentName = ref("");
+
+  // 浜嬫晠璁板綍鏁版嵁
+  const accidentList = ref([]);
+
+  // 杩斿洖涓婁竴椤�
+  const goBack = () => {
+    uni.navigateBack();
+  };
+
+  const accidentGradeType = val => {
+    switch (val) {
+      case "杞诲井浜嬫晠":
+        return "info";
+      case "涓�鑸簨鏁�":
+        return "info";
+      case "杈冨ぇ浜嬫晠":
+        return "warning";
+      case "閲嶅ぇ浜嬫晠":
+        return "error";
+      default:
+        return "info";
+    }
+  };
+  const accidentGradeOptions = [
+    {
+      label: "杞诲井浜嬫晠",
+      value: "杞诲井浜嬫晠",
+    },
+    {
+      label: "涓�鑸簨鏁�",
+      value: "涓�鑸簨鏁�",
+    },
+    {
+      label: "杈冨ぇ浜嬫晠",
+      value: "杈冨ぇ浜嬫晠",
+    },
+    {
+      label: "閲嶅ぇ浜嬫晠",
+      value: "閲嶅ぇ浜嬫晠",
+    },
+  ];
+  // 鑾峰彇浜嬫晠绫诲瀷鏍囩
+  const accidentTypeLabel = val => {
+    const item = emergencyPlanTypeOptions.value.find(
+      i => String(i.value) === String(val)
+    );
+    return item ? item.label : val;
+  };
+  const searchChange = val => {
+    accidentName.value = val;
+    getList();
+  };
+
+  // 鏌ヨ鍒楄〃
+  const getList = () => {
+    showLoadingToast("鍔犺浇涓�...");
+    const params = {
+      current: -1,
+      size: -1,
+      accidentName: accidentName.value,
+    };
+    safeAccidentListPage(params)
+      .then(res => {
+        accidentList.value = res.records || res.data?.records || [];
+        closeToast();
+      })
+      .catch(() => {
+        closeToast();
+        showToast("鑾峰彇鏁版嵁澶辫触");
+      });
+  };
+
+  // 鏄剧ず鍔犺浇鎻愮ず
+  const showLoadingToast = message => {
+    uni.showLoading({
+      title: message,
+      mask: true,
+    });
+  };
+
+  // 鍏抽棴鎻愮ず
+  const closeToast = () => {
+    uni.hideLoading();
+  };
+
+  // 鏂板浜嬫晠璁板綍
+  const addAccident = () => {
+    uni.setStorageSync("accidentReport", {});
+    uni.navigateTo({
+      url: "/pages/safeProduction/accidentReportingRecord/detail",
+    });
+  };
+
+  // 缂栬緫浜嬫晠璁板綍
+  const editAccident = item => {
+    uni.setStorageSync("accidentReport", item);
+    uni.navigateTo({
+      url: "/pages/safeProduction/accidentReportingRecord/detail",
+    });
+  };
+
+  // 鍒犻櫎浜嬫晠璁板綍
+  const deleteAccident = item => {
+    uni.showModal({
+      title: "鍒犻櫎纭",
+      content: `纭畾瑕佸垹闄よ浜嬫晠璁板綍鍚楋紵`,
+      success: res => {
+        if (res.confirm) {
+          deleteAccidentRecord(item.id);
+        }
+      },
+    });
+  };
+
+  // 鍒犻櫎浜嬫晠璁板綍
+  const deleteAccidentRecord = id => {
+    showLoadingToast("鍒犻櫎涓�...");
+    safeAccidentDel([id])
+      .then(() => {
+        closeToast();
+        showToast("鍒犻櫎鎴愬姛");
+        getList();
+      })
+      .catch(() => {
+        closeToast();
+        showToast("鍒犻櫎澶辫触");
+      });
+  };
+
+  // 鏌ョ湅璇︽儏
+  const viewDetail = item => {
+    uni.setStorageSync("accidentReport", item);
+    uni.navigateTo({
+      url: "/pages/safeProduction/accidentReportingRecord/view",
+    });
+  };
+
+  onMounted(() => {
+    getList();
+  });
+
+  onShow(() => {
+    getList();
+  });
+</script>
+
+<style scoped lang="scss">
+  @import "../../../styles/sales-common.scss";
+
+  // 椤甸潰鐗瑰畾鐨勬牱寮忚鐩�
+  .accident-report {
+    min-height: 100vh;
+    background: #f8f9fa;
+    position: relative;
+    padding-bottom: 80px;
+  }
+
+  // 鐗瑰畾鐨勫浘鏍囨牱寮�
+  .document-icon {
+    background: #667eea; // 淇濇寔椤甸潰鐗规湁鐨勮儗鏅壊
+  }
+
+  // 鐗规湁鏍峰紡
+  .visit-status {
+    display: flex;
+    align-items: center;
+  }
+
+  .detail-value {
+    word-break: break-all; // 淇濈暀椤甸潰鐗规湁鐨勬枃鏈崲琛屾牱寮�
+    white-space: normal;
+    line-height: 1.4;
+  }
+
+  // 鐗瑰畾鐨勬诞鍔ㄦ寜閽牱寮�
+  .fab-button {
+    background: #667eea; // 淇濇寔椤甸潰鐗规湁鐨勮儗鏅壊
+    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3); // 淇濇寔椤甸潰鐗规湁鐨勯槾褰辨晥鏋�
+  }
+  .action-buttons {
+    gap: 4px;
+  }
+  .action-buttons {
+    padding: 0 0 10rpx 0;
+  }
+
+  // 瓒呮湡鏈暣鏀圭殑闅愭偅鏍峰紡
+  .overdue {
+    border-left: 8rpx solid #ff4d4f;
+    background-color: rgba(255, 77, 79, 0.02);
+  }
+
+  .overdue .item-header {
+    position: relative;
+    padding-left: 20rpx;
+  }
+
+  .overdue .item-header::after {
+    content: "瓒呮湡";
+    position: absolute;
+    top: 32rpx;
+    right: 20rpx;
+    font-size: 24rpx;
+    font-weight: 500;
+    color: #ff4d4f;
+    background-color: rgba(255, 77, 79, 0.1);
+    padding: 4rpx 16rpx;
+    border-radius: 16rpx;
+    border: 1rpx solid rgba(255, 77, 79, 0.3);
+  }
+
+  .overdue .detail-row:nth-child(7) .detail-value {
+    color: #ff4d4f;
+    font-weight: 500;
+  }
+
+  .overdue .detail-row {
+    padding-left: 20rpx;
+  }
+</style>
+

--
Gitblit v1.9.3