From 03e1f933ce9771a7cdacddbff5be7186ba1d4718 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期四, 05 二月 2026 17:29:02 +0800
Subject: [PATCH] 安全培训考核更正名字错字

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

diff --git a/src/pages/safeProduction/safetyTrainingAssessment/index.vue b/src/pages/safeProduction/safetyTrainingAssessment/index.vue
new file mode 100644
index 0000000..905f9e8
--- /dev/null
+++ b/src/pages/safeProduction/safetyTrainingAssessment/index.vue
@@ -0,0 +1,448 @@
+<template>
+  <view class="sales-accoun">
+    <!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 -->
+    <PageHeader title="瀹夊叏鍩硅鑰冩牳"
+                @back="goBack" />
+    <!-- 鎼滅储鍜岀瓫閫夊尯鍩� -->
+    <view class="search-section">
+      <view class="search-bar">
+        <view @click="selectDate"
+              class="search-input">
+          <view class="search-text">{{ searchKeyword? searchKeyword : '璇烽�夋嫨鍩硅鏃ユ湡' }}</view>
+        </view>
+        <view class="filter-button"
+              @click="clearDate">
+          <u-icon name="close-circle"
+                  size="24"
+                  color="#999"></u-icon>
+        </view>
+      </view>
+      <!-- 鍩硅璁板綍鎸夐挳 -->
+      <view class="record-button">
+        <u-button type="info"
+                  @click="viewTrainingRecord">鍩硅璁板綍</u-button>
+      </view>
+    </view>
+    <!-- 鏍囩椤� -->
+    <view class="tabs-section">
+      <up-tabs v-model="searchForm.state"
+               :list="tabList"
+               itemStyle="width: 33%;height: 80rpx;"
+               @change="tabhandleQuery">
+      </up-tabs>
+    </view>
+    <!-- 鍩硅璁板綍鍒楄〃 -->
+    <view class="ledger-list"
+          v-if="trainingList.length > 0">
+      <view v-for="(item, index) in trainingList"
+            :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.courseCode }}</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.courseCode || '-' }}</text>
+            </view>
+            <view class="detail-row">
+              <text class="detail-label">鍩硅鏃ユ湡</text>
+              <text class="detail-value">{{ item.trainingDate || '-' }}</text>
+            </view>
+            <view class="detail-row">
+              <text class="detail-label">寮�濮嬫椂闂�</text>
+              <text class="detail-value">{{ item.openingTime || '-' }}</text>
+            </view>
+            <view class="detail-row">
+              <text class="detail-label">缁撴潫鏃堕棿</text>
+              <text class="detail-value">{{ item.endTime || '-' }}</text>
+            </view>
+            <view class="detail-row">
+              <text class="detail-label">鍩硅鐩爣</text>
+              <text class="detail-value">{{ item.trainingObjectives || '-' }}</text>
+            </view>
+            <view class="detail-row">
+              <text class="detail-label">鍙傚姞瀵硅薄</text>
+              <text class="detail-value">{{ item.participants || '-' }}</text>
+            </view>
+            <view class="detail-row">
+              <text class="detail-label">鍩硅鍐呭</text>
+              <text class="detail-value">{{ item.trainingContent || '-' }}</text>
+            </view>
+            <view class="detail-row">
+              <text class="detail-label">鍩硅璁插笀</text>
+              <text class="detail-value">{{ item.trainingLecturer || '-' }}</text>
+            </view>
+            <view class="detail-row">
+              <text class="detail-label">椤圭洰瀛﹀垎</text>
+              <text class="detail-value">{{ item.projectCredits || '-' }}</text>
+            </view>
+            <view class="detail-row">
+              <text class="detail-label">鍩硅鏂瑰紡</text>
+              <text class="detail-value">{{ getTrainingModeLabel(item.trainingMode) || '-' }}</text>
+            </view>
+            <view class="detail-row">
+              <text class="detail-label">鍩硅鍦扮偣</text>
+              <text class="detail-value">{{ item.placeTraining || '-' }}</text>
+            </view>
+            <view class="detail-row">
+              <text class="detail-label">璇炬椂</text>
+              <text class="detail-value">{{ item.classHour || '-' }}</text>
+            </view>
+          </view>
+          <!-- 鎸夐挳鍖哄煙 -->
+          <view class="action-buttons">
+            <u-button type="primary"
+                      size="small"
+                      class="action-btn"
+                      :disabled="item.state !== 0"
+                      @click="editVisit(item)">
+              缂栬緫
+            </u-button>
+            <u-button type="info"
+                      size="small"
+                      class="action-btn"
+                      @click="viewFileList(item)">
+              闄勪欢
+            </u-button>
+            <u-button type="error"
+                      size="small"
+                      class="action-btn"
+                      @click="deleteVisit(item)">
+              鍒犻櫎
+            </u-button>
+          </view>
+          <view class="action-buttons">
+            <u-button type="warning"
+                      size="small"
+                      class="action-btn"
+                      :disabled="item.state !== 1"
+                      @click="signIn(item)">
+              绛惧埌
+            </u-button>
+            <u-button type="success"
+                      size="small"
+                      class="action-btn"
+                      :disabled="item.state === 0"
+                      @click="viewResultDetail(item)">
+              缁撴灉鏄庣粏
+            </u-button>
+          </view>
+        </view>
+      </view>
+    </view>
+    <view v-else
+          class="no-data">
+      <text>鏆傛棤鍩硅璁板綍</text>
+    </view>
+    <up-datetime-picker :show="trainingDateVisible"
+                        mode="date"
+                        @confirm="handleDateConfirm"
+                        @cancel="handleDateCancel"
+                        title="閫夋嫨鍩硅鏃ユ湡" />
+    <!-- 娴姩鏂板鎸夐挳 -->
+    <view class="fab-button"
+          @click="addVisit">
+      <up-icon name="plus"
+               size="24"
+               color="#ffffff"></up-icon>
+    </view>
+  </view>
+</template>
+
+<script setup>
+  import { ref, onMounted, reactive } from "vue";
+
+  import { onShow } from "@dcloudio/uni-app";
+  import PageHeader from "@/components/PageHeader.vue";
+  import {
+    safeTrainingListPage,
+    safeTrainingDel,
+    safeTrainingSign,
+    safeTrainingGet,
+  } from "@/api/safeProduction/safetyTrainingAssessment";
+  import useUserStore from "@/store/modules/user";
+  import { useDict } from "@/utils/dict";
+  import dayjs from "dayjs";
+  // 鏇挎崲 toast 鏂规硶
+  defineOptions({ name: "safety-training-index" });
+  const showToast = message => {
+    uni.showToast({
+      title: message,
+      icon: "none",
+    });
+  };
+
+  const userStore = useUserStore();
+
+  // 鑾峰彇瀛楀吀鏁版嵁
+  const { safe_training_methods } = useDict("safe_training_methods");
+
+  // 鎼滅储鍏抽敭璇�
+  const searchKeyword = ref("");
+  // 鏃ユ湡閫夋嫨鍣ㄧ姸鎬�
+  const trainingDateVisible = ref(false);
+
+  const tabList = reactive([
+    { name: "鏈紑濮�", value: 0 },
+    { name: "杩涜涓�", value: 1 },
+    { name: "宸茬粨鏉�", value: 2 },
+  ]);
+  // 鎼滅储琛ㄥ崟
+  const searchForm = ref({
+    state: 0, // 榛樿鏄剧ず宸茬粨鏉�
+    trainingDate: "",
+  });
+  const tabhandleQuery = val => {
+    searchForm.value.state = val.value;
+    getList();
+  };
+  const getTrainingModeLabel = mode => {
+    if (!safe_training_methods || !Array.isArray(safe_training_methods.value)) {
+      return mode || "-";
+    }
+    const dictItem = safe_training_methods.value.find(
+      item => String(item.value) === String(mode)
+    );
+    return dictItem ? dictItem.label : mode || "-";
+  };
+
+  // 鍩硅璁板綍鏁版嵁
+  const trainingList = ref([]);
+  // 杩斿洖涓婁竴椤�
+  const goBack = () => {
+    uni.navigateBack();
+  };
+  const viewFileList = item => {
+    uni.setStorageSync("safetyTrainingFileId", item.id);
+    uni.navigateTo({
+      url: "/pages/safeProduction/safetyTrainingAssessment/fileList",
+    });
+  };
+  const currentUserId = ref("");
+  // 绛惧埌鍔熻兘
+  const signIn = item => {
+    uni.showModal({
+      title: "鎻愮ず",
+      content: "纭绛惧埌鍚楋紵",
+      success: function (res) {
+        if (res.confirm) {
+          safeTrainingSign({
+            safeTrainingId: item.id,
+            userId: currentUserId.value,
+          })
+            .then(res => {
+              if (res.code === 200) {
+                uni.showToast({ title: "绛惧埌鎴愬姛", icon: "success" });
+                setTimeout(() => {}, 1000);
+              } else {
+                uni.showToast({ title: res.msg || "绛惧埌澶辫触", icon: "none" });
+              }
+            })
+            .catch(() => {
+              uni.showToast({ title: "绛惧埌澶辫触锛岃閲嶈瘯", icon: "none" });
+            });
+        }
+      },
+    });
+  };
+
+  // 鏌ョ湅缁撴灉鏄庣粏
+  const viewResultDetail = item => {
+    uni.setStorageSync("safetyTrainingResultId", item.id);
+    uni.setStorageSync("safetyTrainingResultNums", item.nums);
+
+    uni.navigateTo({
+      url: "/pages/safeProduction/safetyTrainingAssessment/resultDetail",
+    });
+  };
+
+  // 鏌ョ湅鍩硅璁板綍
+  const viewTrainingRecord = () => {
+    uni.navigateTo({
+      url: "/pages/safeProduction/safetyTrainingAssessment/record",
+    });
+  };
+  // 娓呴櫎鏃ユ湡閫夋嫨
+  const clearDate = () => {
+    searchKeyword.value = "";
+    searchForm.value.trainingDate = "";
+    getList();
+  };
+  // 鏄剧ず鏃ユ湡閫夋嫨鍣�
+  const selectDate = () => {
+    trainingDateVisible.value = true;
+  };
+
+  // 澶勭悊鏃ユ湡閫夋嫨纭
+  const handleDateConfirm = e => {
+    searchKeyword.value = dayjs(e.value).format("YYYY-MM-DD");
+    searchForm.value.trainingDate = dayjs(e.value).format("YYYY-MM-DD");
+    trainingDateVisible.value = false;
+    getList();
+  };
+
+  // 澶勭悊鏃ユ湡閫夋嫨鍙栨秷
+  const handleDateCancel = () => {
+    trainingDateVisible.value = false;
+  };
+
+  // 鏌ヨ鍒楄〃
+  const getList = () => {
+    showLoadingToast("鍔犺浇涓�...");
+    const params = {
+      current: -1,
+      size: -1,
+      trainingDate: searchForm.value.trainingDate,
+      state: searchForm.value.state,
+    };
+    safeTrainingListPage(params)
+      .then(res => {
+        trainingList.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("safetyTraining", {});
+    uni.navigateTo({
+      url: "/pages/safeProduction/safetyTrainingAssessment/detail",
+    });
+  };
+  // 缂栬緫鍩硅
+  const editVisit = item => {
+    uni.setStorageSync("safetyTraining", item);
+    uni.navigateTo({
+      url: "/pages/safeProduction/safetyTrainingAssessment/detail",
+    });
+  };
+  // 鍒犻櫎鍩硅
+  const deleteVisit = item => {
+    uni.showModal({
+      title: "鍒犻櫎纭",
+      content: `纭畾瑕佸垹闄よ鍩硅璁板綍鍚楋紵`,
+      success: res => {
+        if (res.confirm) {
+          deleteClientVisit(item.id);
+        }
+      },
+    });
+  };
+  // 鍒犻櫎鍩硅璁板綍
+  const deleteClientVisit = id => {
+    showLoadingToast("鍒犻櫎涓�...");
+    safeTrainingDel([id])
+      .then(() => {
+        closeToast();
+        showToast("鍒犻櫎鎴愬姛");
+        getList();
+      })
+      .catch(() => {
+        closeToast();
+        showToast("鍒犻櫎澶辫触");
+      });
+  };
+  // 鏌ョ湅璇︽儏
+  const viewDetail = item => {
+    uni.setStorageSync("safetyTraining", item);
+    uni.navigateTo({
+      url: "/pages/safeProduction/safetyTrainingAssessment/view",
+    });
+  };
+
+  onMounted(() => {
+    userStore.getInfo().then(res => {
+      currentUserId.value = res.user.userId;
+    });
+    // currentUserId
+    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;
+  }
+
+  // 鍩硅璁板綍鎸夐挳
+  .record-button {
+    margin-top: 10px;
+    text-align: center;
+  }
+
+  // 鐗瑰畾鐨勫浘鏍囨牱寮�
+  .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); // 淇濇寔椤甸潰鐗规湁鐨勯槾褰辨晥鏋�
+  }
+  .action-buttons {
+    gap: 4px;
+  }
+  .action-buttons {
+    padding: 0 0 10rpx 0;
+  }
+
+  .tabs-section {
+    background: #fff;
+    margin-bottom: 1rem;
+    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.05);
+  }
+  .search-text {
+    // font-size: 24rpx;
+    color: #a6a6a6;
+    height: 70rpx;
+    line-height: 70rpx;
+    margin-left: 20rpx;
+  }
+</style>
\ No newline at end of file

--
Gitblit v1.9.3