From dd8b9f13a3eac9f57be8187df5ea487ecc4bd8f7 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期三, 17 九月 2025 15:34:58 +0800
Subject: [PATCH] 设备运行白名单
---
src/views/collaborativeApproval/sealManagement/index.vue | 136 +++++++++++++++++++++++++++++++++++++++++----
1 files changed, 123 insertions(+), 13 deletions(-)
diff --git a/src/views/collaborativeApproval/sealManagement/index.vue b/src/views/collaborativeApproval/sealManagement/index.vue
index 1f88715..4cf5a14 100644
--- a/src/views/collaborativeApproval/sealManagement/index.vue
+++ b/src/views/collaborativeApproval/sealManagement/index.vue
@@ -124,7 +124,7 @@
<el-button link type="primary" @click="handleEdit(scope.row)">缂栬緫</el-button>
<el-button link type="danger" @click="repealEdit(scope.row)">搴熷純</el-button>
<el-button link type="success" @click="viewVersionHistory(scope.row)">鐗堟湰鍘嗗彶</el-button>
- <!-- <el-button link type="warning" @click="viewReadStatus(scope.row)">闃呰鐘舵��</el-button> -->
+ <el-button link type="warning" @click="viewReadStatus(scope.row)">闃呰鐘舵��</el-button>
</template>
</el-table-column>
</el-table>
@@ -262,6 +262,10 @@
<h4>鍒跺害鍐呭</h4>
<div class="regulation-content">{{ currentRegulationDetail.content }}</div>
</div>
+ <!-- 濡傛灉tableData>0 鏄剧ず -->
+ <div style="margin: 10px 0;" v-if="tableData && tableData.length > 0" >
+ <el-button type="success" @click="resetForm(currentRegulationDetail)">纭鏌ョ湅</el-button>
+ </div>
</div>
</el-dialog>
@@ -286,7 +290,7 @@
<el-table :data="readStatusList" style="width: 100%;margin-bottom: 10px">
<el-table-column prop="employee" label="鍛樺伐濮撳悕" width="120" />
<el-table-column prop="department" label="鎵�灞為儴闂�" width="150" />
- <el-table-column prop="readTime" label="闃呰鏃堕棿" width="180" />
+ <el-table-column prop="createTime" label="闃呰鏃堕棿" width="180" />
<el-table-column prop="confirmTime" label="纭鏃堕棿" width="180" />
<el-table-column prop="status" label="鐘舵��" width="100">
<template #default="scope">
@@ -304,12 +308,16 @@
import { ref, reactive, onMounted } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { Plus } from '@element-plus/icons-vue'
-import { listSealApplication, addSealApplication, updateSealApplication,listRuleManagement,addRuleManagement,updateRuleManagement,delRuleManagement } from '@/api/collaborativeApproval/sealManagement.js'
+import { listSealApplication, addSealApplication, updateSealApplication,listRuleManagement,addRuleManagement,updateRuleManagement,delRuleManagement,getReadingStatusByRuleId,getReadingStatusList,addReadingStatus,updateReadingStatus } from '@/api/collaborativeApproval/sealManagement.js'
import { el } from 'element-plus/es/locales.mjs'
+import { getUserProfile } from '@/api/system/user.js'
+import {staffJoinDel, staffJoinListPage} from "@/api/personnelManagement/onboarding.js";
// 鍝嶅簲寮忔暟鎹�
+const currentUser = ref(null)
const activeTab = ref('seal')
const operationType = ref('add')
+const tableData = ref([])
// 鐢ㄥ嵃鐢宠鐩稿叧
const showSealApplyDialog = ref(false)
const tableLoading = ref(false)
@@ -363,6 +371,16 @@
requireConfirm: false
})
+const readStatus = ref({
+ id: '',
+ ruleId: '',
+ employee: '',
+ department: '',
+ createTime: '',
+ confirmTime: '',
+ status: 'unconfirmed'
+})
+
const regulationRules = {
title: [{ required: true, message: '璇疯緭鍏ュ埗搴︽爣棰�', trigger: 'blur' }],
category: [{ required: true, message: '璇烽�夋嫨鍒跺害鍒嗙被', trigger: 'change' }],
@@ -383,11 +401,10 @@
const versionHistory = ref([])
-const readStatusList = ref([
- { employee: '闄堝織寮�', department: '閿�鍞儴', readTime: '2025-01-11 10:30:00', confirmTime: '2025-01-11 10:35:00', status: 'confirmed' },
- { employee: '鍒橀泤濠�', department: '鎶�鏈儴', readTime: '2025-01-11 14:20:00', confirmTime: '', status: 'unconfirmed' },
- { employee: '鐜嬪缓鍥�', department: '璐㈠姟閮�', readTime: '2025-01-12 09:15:00', confirmTime: '2025-01-12 09:20:00', status: 'confirmed' }
-])
+const readStatusList = ref([])
+ // { employee: '闄堝織寮�', department: '閿�鍞儴', readTime: '2025-01-11 10:30:00', confirmTime: '2025-01-11 10:35:00', status: 'confirmed' },
+ // { employee: '鍒橀泤濠�', department: '鎶�鏈儴', readTime: '2025-01-11 14:20:00', confirmTime: '', status: 'unconfirmed' },
+ // { employee: '鐜嬪缓鍥�', department: '璐㈠姟閮�', readTime: '2025-01-12 09:15:00', confirmTime: '2025-01-12 09:20:00', status: 'confirmed' }
// 鐢ㄥ嵃鐢宠鐘舵��
const getStatusType = (status) => {
@@ -596,11 +613,33 @@
ElMessage.success('宸叉嫆缁濈敵璇�')
})
}
-// 鏌ョ湅鍒跺害璇︽儏
-const viewRegulation = (row) => {
- currentRegulationDetail.value = row
- showRegulationDetailDialog.value = true
-}
+// 鑾峰彇鍦ㄨ亴鍛樺伐鍒楄〃
+const getList = () => {
+ tableLoading.value = true;
+ //鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛淇℃伅
+ getUserProfile().then(res => {
+ if(res.code == 200){
+ console.log(res.data.userName)
+ currentUser.value = res.data.userName
+ }
+ })
+ staffJoinListPage({staffState: 1}).then(res => {
+ tableLoading.value = false;
+ // tableData.value = res.data.records
+ // //绛涢�夊嚭鍜宑urrentUser鍚屽悕鐨勪汉鍛�
+ tableData.value = res.data.records.filter(item => item.staffName === currentUser.value)
+ console.log("tableData",tableData.value)
+ page.total = res.data.total;
+
+ if(tableData.value.length == 0){
+ ElMessage.error('褰撳墠鐢ㄦ埛鏈姞鍏ヤ换浣曢儴闂�')
+ }
+ }).catch(err => {
+ tableLoading.value = false;
+ })
+
+
+};
// 鏌ョ湅鍒跺害鐗堟湰鍘嗗彶
const viewVersionHistory = (row) => {
@@ -615,10 +654,81 @@
}
})
}
+// 鏌ョ湅鍒跺害璇︽儏
+const viewRegulation = (row) => {
+ getList()
+ currentRegulationDetail.value = row
+ showRegulationDetailDialog.value = true
+ getReadingStatusByRuleId(row.id).then(res => {
+ if(res.code == 200){
+ readStatusList.value = res.data
+ if(readStatusList.value.length==0 && tableData.value.length>0){
+ const params = {
+ ruleId: row.id,
+ employee: tableData.value[0].staffName,
+ department: tableData.value[0].postJob,
+ status: 'unconfirmed'
+ }
+ addReadingStatus(params).then(res => {
+ if(res.code == 200){
+ ElMessage.success('鍒跺害闃呰鎴愬姛')
+ }
+ })
+ }
+ }
+ })
+
+}
// 鏌ョ湅鍒跺害闃呰鐘舵��
const viewReadStatus = (row) => {
showReadStatusDialog.value = true
+ //鏌ョ湅闃呰鐘舵�佸垪琛�
+ getReadingStatusByRuleId(row.id).then(res => {
+ if(res.code == 200){
+ readStatusList.value = res.data
+ }
+ })
}
+
+//纭鏌ョ湅
+const resetForm = (row) => {
+ console.log("row",row)
+ row.readCount = row.readCount + 1
+
+ updateRuleManagement(row).then(res => {
+ if(res.code == 200){
+ ElMessage.success('鏌ョ湅鏁伴噺淇敼鎴愬姛')
+ //淇敼闃呰鐘舵��
+ //鏍规嵁鍒跺害id鍜屽綋鍓嶇櫥褰曠殑鍛樺伐寰楀埌闃呰鐘舵��
+ // let item = readStatusList.value.filter(item => item.employee == tableData.value[0].staffName )
+ // if(item.length>0){
+ // item[0].status = 'confirmed',
+ // item[0].confirmTime = new Date().toISOString().replace('T', ' ').split('.')[0];
+ // }
+ // 绛涢�夊綋鍓嶅憳宸ュ搴旇鍒跺害鐨勯槄璇荤姸鎬佽褰�
+ let statusItem = readStatusList.value.find(item => item.employee === tableData.value[0].staffName && item.ruleId === row.id);
+
+ if (statusItem) {
+ // 濡傛灉鎵惧埌璁板綍锛屾洿鏂扮姸鎬佸拰纭鏃堕棿
+ statusItem.status = 'confirmed';
+ // 鏍煎紡鍖栨椂闂翠负"YYYY-MM-DD HH:mm:ss"鏍煎紡
+ const now = new Date();
+ statusItem.confirmTime = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')} ${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}:${String(now.getSeconds()).padStart(2, '0')}`;
+ // statusItem.confirmTime = new Date().toISOString().replace('T', ' ').split('.')[0];
+
+ updateReadingStatus(statusItem).then(res => {
+ if(res.code == 200){
+ ElMessage.success('鍒跺害闃呰鐘舵�佷慨鏀规垚鍔�')
+ }
+ })
+ }
+
+ }
+ })
+}
+
+
+
// 鑾峰彇鍗扮珷鐢宠鍒楄〃鏁版嵁
const getSealApplicationList = async () => {
tableLoading.value = true
--
Gitblit v1.9.3