From bfdcc3338716ca9ae50d4e694151fe9874d8fd17 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期四, 29 一月 2026 15:22:34 +0800
Subject: [PATCH] Merge branch 'dev_New' of http://114.132.189.42:9002/r/product-inventory-management into dev_New
---
src/api/safeProduction/accidentReportingRecord.js | 36 ++
src/views/safeProduction/accidentReportingRecord/index.vue | 859 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 895 insertions(+), 0 deletions(-)
diff --git a/src/api/safeProduction/accidentReportingRecord.js b/src/api/safeProduction/accidentReportingRecord.js
new file mode 100644
index 0000000..1314f8d
--- /dev/null
+++ b/src/api/safeProduction/accidentReportingRecord.js
@@ -0,0 +1,36 @@
+
+import request from "@/utils/request";
+
+// 鍒嗛〉鏌ヨ
+export function safeAccidentListPage(query) {
+ return request({
+ url: "/safeAccident/page",
+ method: "get",
+ params: query,
+ });
+}
+
+
+export function safeAccidentAdd(query) {
+ return request({
+ url: '/safeAccident',
+ method: 'post',
+ data: query
+ })
+}
+
+export function safeAccidentUpdate(query) {
+ return request({
+ url: '/safeAccident',
+ method: 'put',
+ data: query
+ })
+}
+
+export function safeAccidentDel(ids) {
+ return request({
+ url: '/safeAccident/' + ids,
+ method: 'delete',
+ data: ids
+ })
+}
diff --git a/src/views/safeProduction/accidentReportingRecord/index.vue b/src/views/safeProduction/accidentReportingRecord/index.vue
new file mode 100644
index 0000000..bf064cd
--- /dev/null
+++ b/src/views/safeProduction/accidentReportingRecord/index.vue
@@ -0,0 +1,859 @@
+<template>
+ <div class="app-container">
+ <div class="search_form">
+ <div>
+ <span class="search_title">浜嬫晠鍚嶇О锛�</span>
+ <el-input v-model="searchForm.accidentName"
+ style="width: 240px"
+ placeholder="璇疯緭鍏ヤ簨鏁呭悕绉版悳绱�"
+ @change="handleQuery"
+ clearable
+ :prefix-icon="Search" />
+ <span class="search_title ml10">浜嬫晠绫诲瀷锛�</span>
+ <el-select v-model="searchForm.accidentType"
+ clearable
+ @change="handleQuery"
+ style="width: 240px">
+ <el-option v-for="item in accidentTypeOptions"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value" />
+ </el-select>
+ <el-button type="primary"
+ @click="handleQuery"
+ style="margin-left: 10px">
+ 鎼滅储
+ </el-button>
+ </div>
+ <div>
+ <el-button type="primary"
+ @click="openForm('add')">鏂板浜嬫晠</el-button>
+ <el-button type="danger"
+ plain
+ @click="handleDelete">鍒犻櫎</el-button>
+ </div>
+ </div>
+ <div class="table_list">
+ <PIMTable rowKey="id"
+ :column="tableColumn"
+ :tableData="tableData"
+ :page="page"
+ :isSelection="true"
+ @selection-change="handleSelectionChange"
+ :tableLoading="tableLoading"
+ @pagination="pagination"
+ :total="page.total"></PIMTable>
+ </div>
+ <!-- 鏂板/缂栬緫浜嬫晠寮圭獥 -->
+ <el-dialog v-model="dialogVisible"
+ :title="dialogTitle"
+ width="800px"
+ :close-on-click-modal="false">
+ <el-form ref="formRef"
+ :model="form"
+ :rules="rules"
+ label-width="140px">
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <el-form-item label="浜嬫晠缂栧彿"
+ prop="accidentCode">
+ <el-input v-model="form.accidentCode"
+ placeholder="璇疯緭鍏ヤ簨鏁呯紪鍙�" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="浜嬫晠鍚嶇О"
+ prop="accidentName">
+ <el-input v-model="form.accidentName"
+ placeholder="璇疯緭鍏ヤ簨鏁呭悕绉�" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <el-form-item label="浜嬫晠鍙戠敓鏃堕棿锛�"
+ prop="happenTime">
+ <el-date-picker style="width: 100%"
+ v-model="form.happenTime"
+ value-format="YYYY-MM-DD HH:mm:ss"
+ format="YYYY-MM-DD HH:mm:ss"
+ type="datetime"
+ placeholder="璇烽�夋嫨"
+ clearable />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="浜嬫晠鍙戠敓浣嶇疆"
+ prop="happenLocation">
+ <el-input v-model="form.happenLocation"
+ placeholder="璇疯緭鍏ヤ簨鏁呭彂鐢熶綅缃�" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <el-form-item label="浜嬫晠绛夌骇"
+ prop="accidentGrade">
+ <el-select v-model="form.accidentGrade"
+ placeholder="璇烽�夋嫨浜嬫晠绛夌骇"
+ style="width: 100%">
+ <el-option v-for="item in accidentGradeOptions"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value" />
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="浜嬫晠绫诲瀷"
+ prop="accidentType">
+ <el-select v-model="form.accidentType"
+ placeholder="璇烽�夋嫨浜嬫晠绫诲瀷"
+ style="width: 100%">
+ <el-option v-for="item in accidentTypeOptions"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value" />
+ </el-select>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <el-form-item label="浜哄憳鎹熷け鎯呭喌 "
+ prop="personLoss">
+ <el-input v-model="form.personLoss"
+ placeholder="璇疯緭鍏ヤ汉鍛樻崯澶辨儏鍐�" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鐩存帴璐骇鎹熷け锛堝厓锛�"
+ prop="assetLoss">
+ <el-input v-model="form.assetLoss"
+ type="number"
+ placeholder="璇疯緭鍏ョ洿鎺ヨ储浜ф崯澶�" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <el-form-item label="涓婃姤浜�"
+ prop="createUser">
+ <el-select v-model="form.createUser"
+ placeholder="璇烽�夋嫨"
+ disabled
+ clearable>
+ <el-option v-for="item in userList"
+ :key="item.userId"
+ :label="item.nickName"
+ :value="item.userId" />
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="涓婃姤鏃堕棿"
+ prop="createTime">
+ <el-date-picker style="width: 100%"
+ v-model="form.createTime"
+ value-format="YYYY-MM-DD HH:mm:ss"
+ format="YYYY-MM-DD HH:mm:ss"
+ type="datetime"
+ disabled
+ placeholder="璇烽�夋嫨"
+ clearable />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-form-item label="浜嬫晠鐩存帴鍘熷洜"
+ prop="accidentCause">
+ <el-input v-model="form.accidentCause"
+ type="textarea"
+ :rows="3"
+ placeholder="璇疯緭鍏ヤ簨鏁呯洿鎺ュ師鍥�" />
+ </el-form-item>
+ <el-form-item label="浜嬫晠鏍规湰鍘熷洜"
+ prop="rootCause">
+ <el-input v-model="form.rootCause"
+ type="textarea"
+ :rows="3"
+ placeholder="璇疯緭鍏ヤ簨鏁呮牴鏈師鍥�" />
+ </el-form-item>
+ <el-form-item label="鐢熶骇褰卞搷鎯呭喌"
+ prop="productionLoss">
+ <el-input v-model="form.productionLoss"
+ type="textarea"
+ :rows="3"
+ placeholder="璇疯緭鍏ョ敓浜у奖鍝嶆儏鍐�" />
+ </el-form-item>
+ <el-form-item label="鐜板満搴旀�ュ缃帾鏂�"
+ prop="handleMeasures">
+ <el-input v-model="form.handleMeasures"
+ type="textarea"
+ :rows="3"
+ placeholder="鐜板満搴旀�ュ缃帾鏂�" />
+ </el-form-item>
+ <el-form-item label="澶囨敞"
+ prop="remark">
+ <el-input v-model="form.remark"
+ type="textarea"
+ :rows="3"
+ placeholder="璇疯緭鍏ュ娉�" />
+ </el-form-item>
+ </el-form>
+ <template #footer>
+ <span class="dialog-footer">
+ <el-button @click="dialogVisible = false">鍙栨秷</el-button>
+ <el-button type="primary"
+ @click="submitForm">纭畾</el-button>
+ </span>
+ </template>
+ </el-dialog>
+ <!-- 鏌ョ湅浜嬫晠璇︽儏寮圭獥 -->
+ <el-dialog v-model="viewDialogVisible"
+ title="浜嬫晠璇︽儏"
+ width="900px"
+ :close-on-click-modal="false">
+ <div class="knowledge-detail">
+ <el-descriptions :column="2"
+ border>
+ <el-descriptions-item label="浜嬫晠缂栫爜">
+ <span>{{ currentKnowledge.accidentCode }}</span>
+ </el-descriptions-item>
+ <el-descriptions-item label="浜嬫晠鍚嶇О">
+ <span>{{ currentKnowledge.accidentName }}</span>
+ </el-descriptions-item>
+ <el-descriptions-item label="浜嬫晠鍙戠敓鏃堕棿">
+ {{ currentKnowledge.happenTime }}
+ </el-descriptions-item>
+ <el-descriptions-item label="浜嬫晠鍙戠敓鍦扮偣">
+ {{ currentKnowledge.happenLocation }}
+ </el-descriptions-item>
+ <el-descriptions-item label="浜嬫晠绛夌骇">
+ {{ currentKnowledge.accidentGrade }}
+ </el-descriptions-item>
+ <el-descriptions-item label="浜嬫晠绫诲瀷">
+ {{ currentKnowledge.accidentType }}
+ </el-descriptions-item>
+ <el-descriptions-item label="浜哄憳浼や骸鎯呭喌">
+ {{ currentKnowledge.personLoss }}
+ </el-descriptions-item>
+ <el-descriptions-item label="鐩存帴璐骇鎹熷け锛堝厓锛�">
+ {{ currentKnowledge.assetLoss }}
+ </el-descriptions-item>
+ <el-descriptions-item label="涓婃姤浜�">
+ {{ currentKnowledge.createUserName }}
+ </el-descriptions-item>
+ <el-descriptions-item label="涓婃姤鏃堕棿">
+ {{ currentKnowledge.createTime }}
+ </el-descriptions-item>
+ </el-descriptions>
+ <div class="detail-section">
+ <h4>浜嬫晠鐩存帴鍘熷洜</h4>
+ <div class="detail-content">{{ currentKnowledge.accidentCause }}</div>
+ </div>
+ <div class="detail-section">
+ <h4>浜嬫晠鏍规湰鍘熷洜</h4>
+ <div class="detail-content">{{ currentKnowledge.rootCause }}</div>
+ </div>
+ <div class="detail-section">
+ <h4>鐢熶骇褰卞搷鎯呭喌</h4>
+ <div class="detail-content">{{ currentKnowledge.productionLoss }}</div>
+ </div>
+ <div class="detail-section">
+ <h4>鐜板満搴旀�ュ缃帾鏂�</h4>
+ <div class="detail-content">{{ currentKnowledge.handleMeasures }}</div>
+ </div>
+ <div class="detail-section">
+ <h4>澶囨敞</h4>
+ <div class="detail-content">{{ currentKnowledge.remark }}</div>
+ </div>
+ </div>
+ <template #footer>
+ <span class="dialog-footer">
+ <el-button @click="viewDialogVisible = false">鍏抽棴</el-button>
+ <!-- <el-button type="success" @click="markAsFavorite">鏀惰棌@</el-button> -->
+ </span>
+ </template>
+ </el-dialog>
+ </div>
+</template>
+
+<script setup>
+ import { Search } from "@element-plus/icons-vue";
+ import {
+ onMounted,
+ ref,
+ reactive,
+ toRefs,
+ getCurrentInstance,
+ computed,
+ } from "vue";
+ import { ElMessage, ElMessageBox } from "element-plus";
+ import PIMTable from "@/components/PIMTable/PIMTable.vue";
+ import { userListNoPage } from "@/api/system/user.js";
+ import useUserStore from "@/store/modules/user";
+ import {
+ safeAccidentListPage,
+ safeAccidentAdd,
+ safeAccidentUpdate,
+ safeAccidentDel,
+ } from "@/api/safeProduction/accidentReportingRecord.js";
+ import dayjs from "dayjs";
+ const userStore = useUserStore();
+ // 琛ㄥ崟楠岃瘉瑙勫垯
+ const rules = {
+ accidentCode: [
+ { required: true, message: "璇疯緭鍏ヤ簨鏁呯紪鍙�", trigger: "blur" },
+ ],
+ accidentName: [
+ { required: true, message: "璇疯緭鍏ヤ簨鏁呭悕绉�", trigger: "blur" },
+ ],
+ happenTime: [
+ { required: true, message: "璇烽�夋嫨浜嬫晠鍙戠敓鏃堕棿", trigger: "change" },
+ ],
+ happenLocation: [
+ { required: true, message: "璇疯緭鍏ヤ簨鏁呭彂鐢熶綅缃�", trigger: "blur" },
+ ],
+ accidentGrade: [
+ { required: true, message: "璇烽�夋嫨浜嬫晠绛夌骇", trigger: "change" },
+ ],
+ accidentType: [
+ { required: true, message: "璇烽�夋嫨浜嬫晠绫诲瀷", trigger: "change" },
+ ],
+ };
+
+ // 鍝嶅簲寮忔暟鎹�
+ const data = reactive({
+ searchForm: {
+ accidentName: "",
+ accidentType: "",
+ },
+ tableLoading: false,
+ page: {
+ current: 1,
+ size: 20,
+ total: 0,
+ },
+ tableData: [],
+ selectedIds: [],
+ form: {
+ accidentCode: "", // 浜嬫晠缂栫爜
+ accidentName: "", // 浜嬫晠鍚嶇О
+ happenTime: "", // 浜嬫晠鍙戠敓鏃堕棿
+ happenLocation: "", // 浜嬫晠鍙戠敓鍦扮偣
+ accidentGrade: "", // 浜嬫晠绛夌骇
+ accidentType: "", // 浜嬫晠绫诲瀷
+ personLoss: "", // 浜哄憳浼や骸
+ assetLoss: "", // 璧勪骇鎹熷け
+ createUser: "", // 鍒涘缓鐢ㄦ埛
+ createTime: "", // 鍒涘缓鏃堕棿
+ createUserName: "", // 鍒涘缓鐢ㄦ埛鍚�
+ accidentCause: "", // 浜嬫晠鐩存帴鍘熷洜
+ rootCause: "", // 浜嬫晠鏍规湰鍘熷洜
+ productionLoss: "", // 鐢熶骇鎹熷け
+ handleMeasures: "", // 搴旀�ュ缃帾鏂�
+ remark: "", // 澶囨敞
+ },
+ dialogVisible: false,
+ dialogTitle: "",
+ dialogType: "add",
+ viewDialogVisible: false,
+ currentKnowledge: {},
+ });
+
+ const {
+ searchForm,
+ tableLoading,
+ page,
+ tableData,
+ selectedIds,
+ form,
+ dialogVisible,
+ dialogTitle,
+ dialogType,
+ viewDialogVisible,
+ currentKnowledge,
+ } = toRefs(data);
+
+ // 琛ㄥ崟寮曠敤
+ const formRef = ref();
+
+ // 琛ㄦ牸鍒楅厤缃�
+ const tableColumn = ref([
+ {
+ label: "浜嬫晠缂栫爜",
+ prop: "accidentCode",
+ showOverflowTooltip: true,
+ },
+ {
+ label: "浜嬫晠鍚嶇О",
+ prop: "accidentName",
+ showOverflowTooltip: true,
+ },
+ {
+ label: "浜嬫晠鍙戠敓鏃堕棿",
+ prop: "happenTime",
+ showOverflowTooltip: true,
+ },
+ {
+ label: "浜嬫晠鍙戠敓浣嶇疆",
+ prop: "happenLocation",
+ showOverflowTooltip: true,
+ },
+ {
+ label: "浜嬫晠绛夌骇",
+ prop: "accidentGrade",
+ showOverflowTooltip: true,
+ },
+ {
+ label: "浜嬫晠绫诲瀷",
+ prop: "accidentType",
+ showOverflowTooltip: true,
+ },
+ {
+ dataType: "action",
+ label: "鎿嶄綔",
+ align: "center",
+ fixed: "right",
+ width: 200,
+ operation: [
+ {
+ name: "缂栬緫",
+ type: "text",
+ clickFun: row => {
+ openForm("edit", row);
+ },
+ },
+ {
+ name: "鏌ョ湅",
+ type: "text",
+ clickFun: row => {
+ viewKnowledge(row);
+ },
+ },
+ ],
+ },
+ ]);
+ const userList = ref([]);
+ // 鐢熷懡鍛ㄦ湡
+ onMounted(() => {
+ getCurrentFactoryName();
+ userListNoPage().then(res => {
+ userList.value = res.data;
+ });
+ getList();
+ startAutoRefresh();
+ });
+ const handleChange = userId => {
+ const selectedUser = userList.value.find(user => user.userId === userId);
+ if (selectedUser) {
+ form.value.coreResponsorUserName = selectedUser.nickName;
+ }
+ };
+ // 寮�濮嬭嚜鍔ㄥ埛鏂�
+ const startAutoRefresh = () => {
+ setInterval(() => {
+ getList();
+ }, 600000); // 10鍒嗛挓鍒锋柊涓�娆� (10 * 60 * 1000 = 600000ms)
+ };
+
+ // 鏌ヨ鏁版嵁
+ const handleQuery = () => {
+ page.value.current = 1;
+ getList();
+ };
+ const accidentGradeOptions = [
+ {
+ label: "杞诲井浜嬫晠",
+ value: "杞诲井浜嬫晠",
+ },
+ {
+ label: "涓�鑸簨鏁�",
+ value: "涓�鑸簨鏁�",
+ },
+ {
+ label: "杈冨ぇ浜嬫晠",
+ value: "杈冨ぇ浜嬫晠",
+ },
+ {
+ label: "閲嶅ぇ浜嬫晠",
+ value: "閲嶅ぇ浜嬫晠",
+ },
+ ];
+ const accidentTypeOptions = [
+ {
+ label: "璐d换浜嬫晠",
+ value: "璐d换浜嬫晠",
+ },
+ {
+ label: "闈炶矗浠讳簨鏁�",
+ value: "闈炶矗浠讳簨鏁�",
+ },
+ {
+ label: "鐮村潖鎬т簨鏁�",
+ value: "鐮村潖鎬т簨鏁�",
+ },
+ {
+ label: "閲嶅ぇ浜嬫晠",
+ value: "閲嶅ぇ浜嬫晠",
+ },
+ ];
+
+ const getList = () => {
+ tableLoading.value = true;
+ safeAccidentListPage({ ...page.value, ...searchForm.value })
+ .then(res => {
+ tableLoading.value = false;
+ tableData.value = res.data.records;
+ page.total = res.data.total;
+ })
+ .catch(err => {
+ tableLoading.value = false;
+ });
+ };
+
+ // 鍒嗛〉澶勭悊
+ const pagination = obj => {
+ page.value.current = obj.page;
+ page.value.size = obj.limit;
+ handleQuery();
+ };
+ const currentUserId = ref("");
+ const currentUserName = ref("");
+ const getCurrentFactoryName = async () => {
+ let res = await userStore.getInfo();
+ currentUserId.value = res.user.userId;
+ currentUserName.value = res.user.nickName;
+ };
+ // 閫夋嫨鍙樺寲澶勭悊
+ const handleSelectionChange = selection => {
+ selectedIds.value = selection.map(item => item.id);
+ };
+
+ // 鎵撳紑琛ㄥ崟
+ const openForm = (type, row = null) => {
+ dialogType.value = type;
+ if (type === "add") {
+ dialogTitle.value = "鏂板浜嬫晠";
+ // 閲嶇疆琛ㄥ崟
+ Object.assign(form.value, {
+ accidentCode: "", // 浜嬫晠缂栫爜
+ accidentName: "", // 浜嬫晠鍚嶇О
+ happenTime: "", // 浜嬫晠鍙戠敓鏃堕棿
+ happenLocation: "", // 浜嬫晠鍙戠敓鍦扮偣
+ accidentGrade: "", // 浜嬫晠绛夌骇
+ accidentType: "", // 浜嬫晠绫诲瀷
+ personLoss: "", // 浜哄憳浼や骸
+ assetLoss: "", // 璧勪骇鎹熷け
+ createUser: currentUserId.value, // 鍒涘缓鐢ㄦ埛
+ createTime: dayjs().format("YYYY-MM-DD HH:mm:ss"), // 鍒涘缓鏃堕棿
+ createUserName: currentUserName.value, // 鍒涘缓鐢ㄦ埛鍚�
+ accidentCause: "", // 浜嬫晠鐩存帴鍘熷洜
+ rootCause: "", // 浜嬫晠鏍规湰鍘熷洜
+ productionLoss: "", // 鐢熶骇鎹熷け
+ handleMeasures: "", // 搴旀�ュ缃帾鏂�
+ remark: "", // 澶囨敞
+ });
+ } else if (type === "edit" && row) {
+ dialogTitle.value = "缂栬緫浜嬫晠";
+ Object.assign(form.value, {
+ id: row.id,
+ accidentCode: row.accidentCode, // 浜嬫晠缂栫爜
+ accidentName: row.accidentName, // 浜嬫晠鍚嶇О
+ happenTime: row.happenTime, // 浜嬫晠鍙戠敓鏃堕棿
+ happenLocation: row.happenLocation, // 浜嬫晠鍙戠敓鍦扮偣
+ accidentGrade: row.accidentGrade, // 浜嬫晠绛夌骇
+ accidentType: row.accidentType, // 浜嬫晠绫诲瀷
+ personLoss: row.personLoss, // 浜哄憳浼や骸
+ assetLoss: row.assetLoss, // 璧勪骇鎹熷け
+ createUser: row.createUser, // 鍒涘缓鐢ㄦ埛
+ createTime: row.createTime, // 鍒涘缓鏃堕棿
+ createUserName: row.createUserName, // 鍒涘缓鐢ㄦ埛鍚�
+ accidentCause: row.accidentCause, // 浜嬫晠鐩存帴鍘熷洜
+ rootCause: row.rootCause, // 浜嬫晠鏍规湰鍘熷洜
+ productionLoss: row.productionLoss, // 鐢熶骇鎹熷け
+ handleMeasures: row.handleMeasures, // 搴旀�ュ缃帾鏂�
+ remark: row.remark, // 澶囨敞
+ });
+ }
+ dialogVisible.value = true;
+ };
+
+ // 鏌ョ湅浜嬫晠璇︽儏
+ const viewKnowledge = row => {
+ currentKnowledge.value = { ...row };
+ viewDialogVisible.value = true;
+ };
+ const getApplyScopeLabel = scope => {
+ const scopeMap = {
+ all: "鍏ㄤ綋鍛樺伐",
+ manager: "绠$悊灞�",
+ hr: "浜轰簨閮ㄩ棬",
+ finance: "璐㈠姟閮ㄩ棬",
+ tech: "鎶�鏈儴闂�",
+ };
+ return scopeMap[scope] || scope;
+ };
+
+ // 鑾峰彇绫诲瀷鏍囩绫诲瀷
+ const getTypeTagType = type => {
+ const typeMap = {
+ contract: "success",
+ approval: "warning",
+ solution: "primary",
+ experience: "info",
+ guide: "danger",
+ };
+ return typeMap[type] || "info";
+ };
+
+ // 鑾峰彇绫诲瀷鏍囩鏂囨湰
+ const getTypeLabel = type => {
+ return getKnowledgeTypeLabel(type);
+ };
+
+ // 鑾峰彇鏁堢巼鏍囩绫诲瀷
+ const getEfficiencyTagType = efficiency => {
+ const typeMap = {
+ high: "success",
+ medium: "warning",
+ low: "info",
+ };
+ return typeMap[efficiency] || "info";
+ };
+
+ // 鑾峰彇鏁堢巼鏍囩鏂囨湰
+ const getEfficiencyLabel = efficiency => {
+ const efficiencyMap = {
+ high: "鏄捐憲鎻愬崌",
+ medium: "涓�鑸彁鍗�",
+ low: "杞诲井鎻愬崌",
+ };
+ return efficiencyMap[efficiency] || efficiency;
+ };
+
+ // 鑾峰彇鏁堢巼鎻愬崌鐧惧垎姣�
+ const getEfficiencyScore = efficiency => {
+ const scoreMap = {
+ high: 40,
+ medium: 25,
+ low: 15,
+ };
+ return scoreMap[efficiency] || 0;
+ };
+
+ // 鑾峰彇骞冲潎鑺傜渷鏃堕棿
+ const getTimeSaved = efficiency => {
+ const timeMap = {
+ high: "2-3澶�",
+ medium: "1-2澶�",
+ low: "0.5-1澶�",
+ };
+ return timeMap[efficiency] || "鏈煡";
+ };
+ // 鎻愪氦搴旀�ラ妗堣〃鍗�
+ const submitForm = async () => {
+ try {
+ await formRef.value.validate();
+ if (dialogType.value === "add") {
+ safeAccidentAdd({ ...form.value })
+ .then(res => {
+ if (res.code == 200) {
+ ElMessage.success("娣诲姞鎴愬姛");
+ dialogVisible.value = false;
+ getList();
+ }
+ })
+ .catch(err => {
+ ElMessage.error(err.msg);
+ });
+ } else {
+ safeAccidentUpdate({ ...form.value })
+ .then(res => {
+ if (res.code == 200) {
+ ElMessage.success("鏇存柊鎴愬姛");
+ dialogVisible.value = false;
+ getList();
+ }
+ })
+ .catch(err => {
+ ElMessage.error(err.msg);
+ });
+ }
+ } catch (error) {
+ console.error("琛ㄥ崟楠岃瘉澶辫触:", error);
+ }
+ };
+
+ // 鍒犻櫎搴旀�ラ妗�
+ const handleDelete = () => {
+ if (selectedIds.value.length === 0) {
+ ElMessage.warning("璇烽�夋嫨瑕佸垹闄ょ殑搴旀�ラ妗�");
+ return;
+ }
+
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ // console.log(selectedIds.value);
+ safeAccidentDel(selectedIds.value).then(res => {
+ if (res.code == 200) {
+ ElMessage.success("鍒犻櫎鎴愬姛");
+ selectedIds.value = [];
+ getList();
+ }
+ });
+ })
+ .catch(() => {
+ // 鐢ㄦ埛鍙栨秷
+ });
+ };
+
+ // 瀵煎嚭
+ const { proxy } = getCurrentInstance();
+ const { knowledge_type } = proxy.useDict("knowledge_type");
+
+ // 瀛楀吀宸ュ叿
+ const knowledgeTypeOptions = computed(() => knowledge_type?.value || []);
+ const getKnowledgeTypeLabel = val => {
+ const item = knowledgeTypeOptions.value.find(
+ i => String(i.value) === String(val)
+ );
+ return item ? item.label : val;
+ };
+ const getKnowledgeTypeTagType = val => {
+ const item = knowledgeTypeOptions.value.find(
+ i => String(i.value) === String(val)
+ );
+ return item?.elTagType || "info";
+ };
+ const handleExport = () => {
+ proxy.download(
+ "/knowledgeBase/export",
+ { ...searchForm.value },
+ "搴旀�ラ妗堝簱.xlsx"
+ );
+ };
+</script>
+
+<style scoped>
+ .auto-refresh-info {
+ margin-bottom: 15px;
+ }
+
+ .auto-refresh-info .el-alert {
+ border-radius: 8px;
+ }
+
+ .dialog-footer {
+ text-align: right;
+ }
+
+ .knowledge-detail {
+ padding: 20px 0;
+ }
+
+ .detail-title {
+ font-size: 18px;
+ font-weight: bold;
+ color: #303133;
+ }
+
+ .detail-section {
+ margin-top: 24px;
+ }
+
+ .detail-section h4 {
+ margin: 0 0 12px 0;
+ font-size: 16px;
+ font-weight: 600;
+ color: #303133;
+ border-left: 4px solid #409eff;
+ padding-left: 12px;
+ }
+
+ .detail-content {
+ background: #f8f9fa;
+ padding: 16px;
+ border-radius: 6px;
+ line-height: 1.6;
+ color: #606266;
+ white-space: pre-wrap;
+ }
+
+ .key-points {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 8px;
+ }
+
+ .usage-stats {
+ margin-top: 16px;
+ }
+
+ .stat-item {
+ text-align: center;
+ padding: 20px;
+ background: #f8f9fa;
+ border-radius: 8px;
+ }
+
+ .stat-number {
+ font-size: 24px;
+ font-weight: bold;
+ color: #409eff;
+ margin-bottom: 8px;
+ }
+
+ .stat-label {
+ font-size: 14px;
+ color: #909399;
+ }
+
+ .exec-steps-container {
+ border: 1px solid #e4e7ed;
+ border-radius: 4px;
+ padding: 15px;
+ background-color: #f9fafc;
+ }
+
+ .exec-step-item {
+ margin-bottom: 10px;
+ padding: 10px;
+ background-color: #ffffff;
+ border: 1px solid #e4e7ed;
+ border-radius: 4px;
+ }
+
+ .step-header {
+ display: flex;
+ align-items: flex-start;
+ flex-direction: column;
+ }
+
+ .exec-step-view {
+ margin-bottom: 8px;
+ padding-left: 20px;
+ position: relative;
+ }
+
+ .step-number {
+ position: absolute;
+ left: 0;
+ font-weight: bold;
+ color: #409eff;
+ }
+
+ .step-title {
+ font-weight: bold;
+ margin-right: 5px;
+ }
+
+ .no-data {
+ color: #909399;
+ font-style: italic;
+ }
+</style>
--
Gitblit v1.9.3