From ff817dab1f7b3e762896446afbcd68579381adcf Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期一, 02 二月 2026 16:52:10 +0800
Subject: [PATCH] 危险作业审批模块开发

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

diff --git a/src/pages/safeProduction/hazardSourceLedger/index.vue b/src/pages/safeProduction/hazardSourceLedger/index.vue
new file mode 100644
index 0000000..494e3b4
--- /dev/null
+++ b/src/pages/safeProduction/hazardSourceLedger/index.vue
@@ -0,0 +1,291 @@
+<template>
+  <view class="sales-accoun">
+    <!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 -->
+    <PageHeader title="鍗遍櫓婧愬彴璐�"
+                @back="goBack" />
+    <!-- 鎼滅储鍜岀瓫閫夊尯鍩� -->
+    <view class="search-section">
+      <view class="search-bar">
+        <view class="search-input">
+          <up-input class="search-text"
+                    placeholder="璇疯緭鍏ュ嵄闄╂簮鍚嶇О"
+                    v-model="customerName"
+                    @blur="getList"
+                    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="visitList.length > 0">
+      <view v-for="(item, index) in visitList"
+            :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.name }}</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.code || '-' }}</text>
+            </view>
+            <view class="detail-row">
+              <text class="detail-label">鍗遍櫓婧愮被鍨�</text>
+              <text class="detail-value">{{ hazard_source_type.find(i => i.value === item.type)?.label || '-' }}</text>
+            </view>
+            <view class="detail-row">
+              <text class="detail-label">椋庨櫓绛夌骇</text>
+              <u-tag :type="getRiskLevelType(item.riskLevel)">
+                {{ item.riskLevel || '-' }}
+              </u-tag>
+            </view>
+            <view class="detail-row">
+              <text class="detail-label">鎵�鍦ㄤ綅缃�</text>
+              <text class="detail-value">{{ item.location || '-' }}</text>
+            </view>
+            <view class="detail-row">
+              <text class="detail-label">绠℃帶鎺柦</text>
+              <text class="detail-value">{{ item.controlMeasures || '-' }}</text>
+            </view>
+            <view class="detail-row">
+              <text class="detail-label">搴撳瓨鏁伴噺</text>
+              <text class="detail-value">{{ item.stockQty || '-' }}</text>
+            </view>
+            <view class="detail-row">
+              <text class="detail-label">绠℃帶璐d换浜�</text>
+              <text class="detail-value">{{ item.principalUser || '-' }}</text>
+            </view>
+            <view class="detail-row">
+              <text class="detail-label">璐d换浜鸿仈绯荤數璇�</text>
+              <text class="detail-value">{{ item.principalMobile || '-' }}</text>
+            </view>
+            <view class="detail-row">
+              <text class="detail-label">瑙勬牸 / 椋庨櫓鎻忚堪</text>
+              <text class="detail-value">{{ item.specInfo || '-' }}</text>
+            </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="editVisit(item)">
+              缂栬緫
+            </u-button>
+            <u-button type="error"
+                      size="small"
+                      class="action-btn"
+                      @click="deleteVisit(item)">
+              鍒犻櫎
+            </u-button>
+          </view>
+        </view>
+      </view>
+    </view>
+    <view v-else
+          class="no-data">
+      <text>鏆傛棤鎷滆璁板綍</text>
+    </view>
+    <!-- 娴姩鏂板鎸夐挳 -->
+    <view class="fab-button"
+          @click="addVisit">
+      <up-icon name="plus"
+               size="24"
+               color="#ffffff"></up-icon>
+    </view>
+  </view>
+</template>
+
+<script setup>
+  import { ref, onMounted } from "vue";
+
+  import { onShow } from "@dcloudio/uni-app";
+  import PageHeader from "@/components/PageHeader.vue";
+  import { delCustomer } from "@/api/cooperativeOffice/clientVisit";
+  import {
+    qualificationsListPage,
+    safeCertificationDel,
+  } from "@/api/safeProduction/safeQualifications";
+  import {
+    safeHazardListPage,
+    safeHazardDel,
+  } from "@/api/safeProduction/hazardSourceLedger";
+  import useUserStore from "@/store/modules/user";
+  import { useDict } from "@/utils/dict";
+  // 鏇挎崲 toast 鏂规硶
+  defineOptions({ name: "client-visit-index" });
+  const showToast = message => {
+    uni.showToast({
+      title: message,
+      icon: "none",
+    });
+  };
+  const getRiskLevelType = riskLevel => {
+    const typeMap = {
+      浣庨闄�: "info",
+      涓�鑸闄�: "info",
+      杈冨ぇ椋庨櫓: "warning",
+      閲嶅ぇ椋庨櫓: "error",
+    };
+    return typeMap[riskLevel] || "info";
+  };
+
+  import dayjs from "dayjs";
+
+  const userStore = useUserStore();
+
+  // 鎼滅储鍏抽敭璇�
+  const customerName = ref("");
+
+  // 鎷滆璁板綍鏁版嵁
+  const visitList = ref([]);
+  // 杩斿洖涓婁竴椤�
+  const goBack = () => {
+    uni.navigateBack();
+  };
+
+  // 鏌ヨ鍒楄〃
+  const getList = () => {
+    showLoadingToast("鍔犺浇涓�...");
+    const params = {
+      current: -1,
+      size: -1,
+      name: customerName.value,
+    };
+    safeHazardListPage(params)
+      .then(res => {
+        visitList.value = res.records || res.data?.records || [];
+        closeToast();
+      })
+      .catch(() => {
+        closeToast();
+        showToast("鑾峰彇鏁版嵁澶辫触");
+      });
+  };
+
+  // 鏄剧ず鍔犺浇鎻愮ず
+  const showLoadingToast = message => {
+    uni.showLoading({
+      title: message,
+      mask: true,
+    });
+  };
+
+  // 鍏抽棴鎻愮ず
+  const closeToast = () => {
+    uni.hideLoading();
+  };
+
+  // 鏂板鍗遍櫓婧�
+  const addVisit = () => {
+    uni.setStorageSync("hazardSourceLedger", {});
+    uni.navigateTo({
+      url: "/pages/safeProduction/hazardSourceLedger/detail",
+    });
+  };
+  // 缂栬緫鍗遍櫓婧�
+  const editVisit = item => {
+    uni.setStorageSync("hazardSourceLedger", item);
+    uni.navigateTo({
+      url: "/pages/safeProduction/hazardSourceLedger/detail",
+    });
+  };
+  // 鍒犻櫎鍗遍櫓婧�
+  const deleteVisit = item => {
+    uni.showModal({
+      title: "鍒犻櫎纭",
+      content: `纭畾瑕佸垹闄よ鍗遍櫓婧愬悧锛焋,
+      success: res => {
+        if (res.confirm) {
+          deleteClientVisit(item.id);
+        }
+      },
+    });
+  };
+  const { hazard_source_type } = useDict("hazard_source_type");
+  const { risk_level } = useDict("risk_level");
+
+  // 鍒犻櫎鍗遍櫓婧愯褰�
+  const deleteClientVisit = id => {
+    showLoadingToast("鍒犻櫎涓�...");
+    safeHazardDel([id])
+      .then(() => {
+        closeToast();
+        showToast("鍒犻櫎鎴愬姛");
+        getList();
+      })
+      .catch(() => {
+        closeToast();
+        showToast("鍒犻櫎澶辫触");
+      });
+  };
+  // 鏌ョ湅璇︽儏
+  const viewDetail = item => {
+    uni.setStorageSync("hazardSourceLedger", item);
+    uni.navigateTo({
+      url: "/pages/safeProduction/hazardSourceLedger/view",
+    });
+  };
+
+  onMounted(() => {
+    getList();
+  });
+
+  onShow(() => {
+    getList();
+  });
+</script>
+
+<style scoped lang="scss">
+  @import "../../../styles/sales-common.scss";
+
+  // 椤甸潰鐗瑰畾鐨勬牱寮忚鐩�
+  .sales-accoun {
+    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; // 淇濈暀椤甸潰鐗规湁鐨勬枃鏈崲琛屾牱寮�
+  }
+
+  // 鐗瑰畾鐨勬诞鍔ㄦ寜閽牱寮�
+  .fab-button {
+    background: #667eea; // 淇濇寔椤甸潰鐗规湁鐨勮儗鏅壊
+    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3); // 淇濇寔椤甸潰鐗规湁鐨勯槾褰辨晥鏋�
+  }
+</style>
+

--
Gitblit v1.9.3