From 9506b4ba45a478ff5132d04587d56a64cce079c1 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期二, 13 一月 2026 15:16:38 +0800
Subject: [PATCH] fix: 完成知识库,用印管理
---
src/views/collaborativeApproval/knowledgeBase/index.vue | 181 +++++++--------------------------------------
src/views/collaborativeApproval/sealManagement/index.vue | 53 +++++++++++--
2 files changed, 73 insertions(+), 161 deletions(-)
diff --git a/src/views/collaborativeApproval/knowledgeBase/index.vue b/src/views/collaborativeApproval/knowledgeBase/index.vue
index cb643ad..aeb1ba4 100644
--- a/src/views/collaborativeApproval/knowledgeBase/index.vue
+++ b/src/views/collaborativeApproval/knowledgeBase/index.vue
@@ -13,11 +13,12 @@
/>
<span class="search_title ml10">鐭ヨ瘑绫诲瀷锛�</span>
<el-select v-model="searchForm.type" clearable @change="handleQuery" style="width: 240px">
- <el-option label="鍚堝悓鐗规壒" :value="'contract'" />
- <el-option label="瀹℃壒妗堜緥" :value="'approval'" />
- <el-option label="瑙e喅鏂规" :value="'solution'" />
- <el-option label="缁忛獙鎬荤粨" :value="'experience'" />
- <el-option label="鎿嶄綔鎸囧崡" :value="'guide'" />
+ <el-option
+ v-for="item in knowledgeTypeOptions"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value"
+ />
</el-select>
<el-button type="primary" @click="handleQuery" style="margin-left: 10px">
鎼滅储
@@ -61,11 +62,12 @@
<el-col :span="12">
<el-form-item label="鐭ヨ瘑绫诲瀷" prop="type">
<el-select v-model="form.type" placeholder="璇烽�夋嫨鐭ヨ瘑绫诲瀷" style="width: 100%">
- <el-option label="鍚堝悓鐗规壒" value="contract" />
- <el-option label="瀹℃壒妗堜緥" value="approval" />
- <el-option label="瑙e喅鏂规" value="solution" />
- <el-option label="缁忛獙鎬荤粨" value="experience" />
- <el-option label="鎿嶄綔鎸囧崡" value="guide" />
+ <el-option
+ v-for="item in knowledgeTypeOptions"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value"
+ />
</el-select>
</el-form-item>
</el-col>
@@ -231,7 +233,7 @@
<script setup>
import { Search } from "@element-plus/icons-vue";
-import { onMounted, ref, reactive, toRefs, getCurrentInstance } from "vue";
+import { onMounted, ref, reactive, toRefs, getCurrentInstance, computed } from "vue";
import { ElMessage, ElMessageBox } from "element-plus";
import PIMTable from "@/components/PIMTable/PIMTable.vue";
import { listKnowledgeBase, delKnowledgeBase,addKnowledgeBase,updateKnowledgeBase } from "@/api/collaborativeApproval/knowledgeBase.js";
@@ -313,24 +315,10 @@
prop: "type",
dataType: "tag",
formatData: (params) => {
- const typeMap = {
- contract: "鍚堝悓鐗规壒",
- approval: "瀹℃壒妗堜緥",
- solution: "瑙e喅鏂规",
- experience: "缁忛獙鎬荤粨",
- guide: "鎿嶄綔鎸囧崡"
- };
- return typeMap[params] || params;
+ return getKnowledgeTypeLabel(params);
},
formatType: (params) => {
- const typeMap = {
- contract: "success",
- approval: "warning",
- solution: "primary",
- experience: "info",
- guide: "danger"
- };
- return typeMap[params] || "info";
+ return getKnowledgeTypeTagType(params);
}
},
{
@@ -401,111 +389,6 @@
}
]);
-// 妯℃嫙鏁版嵁
-// let mockData = [
-// {
-// id: "1",
-// title: "鐗规畩鍚堝悓瀹℃壒娴佺▼浼樺寲鏂规",
-// type: "contract",
-// scenario: "澶ч鍚堝悓蹇�熷鎵�",
-// efficiency: "high",
-// problem: "澶ч鍚堝悓瀹℃壒娴佺▼澶嶆潅锛屽鎵规椂闂撮暱锛屽奖鍝嶄笟鍔¤繘灞�",
-// solution: "寤虹珛缁胯壊閫氶亾锛屽绗﹀悎鏉′欢鐨勫悎鍚岄噰鐢ㄧ畝鍖栧鎵规祦绋嬶紝鐢遍儴闂ㄨ礋璐d汉鐩存帴瀹℃壒锛屽钩鍧囧鎵规椂闂翠粠3澶╃缉鐭嚦1澶�",
-// keyPoints: "缁胯壊閫氶亾鏉′欢,绠�鍖栨祦绋�,瀹℃壒鏉冮檺,鏃堕棿鎺у埗",
-// creator: "寮犵粡鐞�",
-// usageCount: 15,
-// createTime: "2024-01-15 10:30:00"
-// },
-// {
-// id: "2",
-// title: "璺ㄩ儴闂ㄥ崗浣滃鎵圭粡楠屾�荤粨",
-// type: "experience",
-// scenario: "澶氶儴闂ㄥ崗浣滈」鐩�",
-// efficiency: "medium",
-// problem: "璺ㄩ儴闂ㄩ」鐩鎵规椂锛屽悇閮ㄩ棬鎰忚涓嶇粺涓�锛屽鎵硅繘搴︾紦鎱�",
-// solution: "寤虹珛椤圭洰鍗忚皟鏈哄埗锛屾寚瀹氶」鐩礋璐d汉锛屽畾鏈熷彫寮�鍗忚皟浼氳锛岀粺涓�鍚勬柟鎰忚鍚庡啀杩涜瀹℃壒",
-// keyPoints: "椤圭洰鍗忚皟,瀹氭湡浼氳,缁熶竴鎰忚,璐熻矗浜哄埗搴�",
-// creator: "鏉庝富绠�",
-// usageCount: 8,
-// createTime: "2024-01-14 15:20:00"
-// },
-// {
-// id: "3",
-// title: "绱ф�ラ噰璐鎵规搷浣滄寚鍗�",
-// type: "guide",
-// scenario: "绱ф�ラ噰璐渶姹�",
-// efficiency: "high",
-// problem: "绱ф�ラ噰璐椂瀹℃壒娴佺▼澶嶆潅锛屾棤娉曟弧瓒崇揣鎬ラ渶姹�",
-// solution: "鍒跺畾绱ф�ラ噰璐鎵规爣鍑嗭紝鏄庣‘绱ф�ョ▼搴﹀垎绾э紝涓嶅悓绾у埆閲囩敤涓嶅悓瀹℃壒娴佺▼锛岀‘淇濈揣鎬ラ渶姹傚緱鍒板強鏃跺鐞�",
-// keyPoints: "绱ф�ュ垎绾�,鏍囧噯鍒跺畾,娴佺▼绠�鍖�,鍙婃椂澶勭悊",
-// creator: "鐜嬩笓鍛�",
-// usageCount: 12,
-// createTime: "2024-01-13 09:15:00"
-// }
-// ];
-
-// 鐭ヨ瘑鏍囬妯℃澘
-const titleTemplates = [
- "{type}瀹℃壒娴佺▼浼樺寲鏂规",
- "{scenario}澶勭悊缁忛獙鎬荤粨",
- "{type}鐗规畩鎯呭喌澶勭悊鎸囧崡",
- "{scenario}蹇�熷鎵规柟妗�",
- "{type}鏍囧噯鍖栨搷浣滄祦绋�",
- "{scenario}闂瑙e喅鏂规",
- "{type}鏈�浣冲疄璺垫�荤粨",
- "{scenario}鏁堢巼鎻愬崌鏂规"
-];
-
-// 鐭ヨ瘑绫诲瀷閰嶇疆
-const knowledgeTypes = [
- { type: "contract", label: "鍚堝悓鐗规壒", efficiency: "high" },
- { type: "approval", label: "瀹℃壒妗堜緥", efficiency: "medium" },
- { type: "solution", label: "瑙e喅鏂规", efficiency: "high" },
- { type: "experience", label: "缁忛獙鎬荤粨", efficiency: "medium" },
- { type: "guide", label: "鎿嶄綔鎸囧崡", efficiency: "low" }
-];
-
-// 鍦烘櫙鍒楄〃
-const scenarios = ["澶ч鍚堝悓瀹℃壒", "璺ㄩ儴闂ㄥ崗浣�", "绱ф�ラ噰璐�", "鐗规畩鐢宠", "娴佺▼浼樺寲", "闂澶勭悊", "鏍囧噯鍖栧缓璁�", "鏁堢巼鎻愬崌"];
-
-// 鑷姩鐢熸垚鏂版暟鎹�
-const generateNewData = () => {
- const newId = (mockData.length + 1).toString();
- const now = new Date();
- const randomType = knowledgeTypes[Math.floor(Math.random() * knowledgeTypes.length)];
- const randomScenario = scenarios[Math.floor(Math.random() * scenarios.length)];
-
- // 鐢熸垚闅忔満鏍囬
- let title = titleTemplates[Math.floor(Math.random() * titleTemplates.length)];
- title = title
- .replace('{type}', randomType.label)
- .replace('{scenario}', randomScenario);
-
- const newKnowledge = {
- id: newId,
- title: title,
- type: randomType.type,
- scenario: randomScenario,
- efficiency: randomType.efficiency,
- problem: `鍦�${randomScenario}杩囩▼涓亣鍒扮殑闂鎻忚堪...`,
- solution: `閽堝${randomScenario}鐨勮В鍐虫柟妗堝拰鎿嶄綔姝ラ...`,
- keyPoints: "鍏抽敭瑕佺偣1,鍏抽敭瑕佺偣2,鍏抽敭瑕佺偣3,鍏抽敭瑕佺偣4",
- creator: ["寮犵粡鐞�", "鏉庝富绠�", "鐜嬩笓鍛�", "鍒樻�荤洃"][Math.floor(Math.random() * 4)],
- usageCount: Math.floor(Math.random() * 20) + 1,
- createTime: now.toLocaleString()
- };
-
- // 娣诲姞鍒版暟鎹紑澶�
- mockData.unshift(newKnowledge);
-
- // 淇濇寔鏁版嵁閲忓湪鍚堢悊鑼冨洿鍐咃紙鏈�澶氫繚鐣�30鏉★級
- if (mockData.length > 30) {
- mockData = mockData.slice(0, 30);
- }
-
- console.log(`[${new Date().toLocaleString()}] 鑷姩鐢熸垚鏂扮煡璇�: ${title}`);
-};
-
// 鐢熷懡鍛ㄦ湡
onMounted(() => {
getList();
@@ -515,7 +398,6 @@
// 寮�濮嬭嚜鍔ㄥ埛鏂�
const startAutoRefresh = () => {
setInterval(() => {
- generateNewData();
getList();
}, 600000); // 10鍒嗛挓鍒锋柊涓�娆� (10 * 60 * 1000 = 600000ms)
};
@@ -605,14 +487,7 @@
// 鑾峰彇绫诲瀷鏍囩鏂囨湰
const getTypeLabel = (type) => {
- const typeMap = {
- contract: "鍚堝悓鐗规壒",
- approval: "瀹℃壒妗堜緥",
- solution: "瑙e喅鏂规",
- experience: "缁忛獙鎬荤粨",
- guide: "鎿嶄綔鎸囧崡"
- };
- return typeMap[type] || type;
+ return getKnowledgeTypeLabel(type);
};
// 鑾峰彇鏁堢巼鏍囩绫诲瀷
@@ -675,18 +550,6 @@
});
};
-// 鏀惰棌鐭ヨ瘑
-const markAsFavorite = () => {
- // 澧炲姞浣跨敤娆℃暟
- const index = mockData.findIndex(item => item.id === currentKnowledge.value.id);
- if (index !== -1) {
- mockData[index].usageCount += 1;
- currentKnowledge.value.usageCount += 1;
- }
-
- ElMessage.success("宸叉敹钘忥紝浣跨敤娆℃暟+1");
-};
-
// 鎻愪氦鐭ヨ瘑琛ㄥ崟
const submitForm = async () => {
try {
@@ -745,6 +608,18 @@
// 瀵煎嚭
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')
}
diff --git a/src/views/collaborativeApproval/sealManagement/index.vue b/src/views/collaborativeApproval/sealManagement/index.vue
index 88d33dc..8e0d054 100644
--- a/src/views/collaborativeApproval/sealManagement/index.vue
+++ b/src/views/collaborativeApproval/sealManagement/index.vue
@@ -12,11 +12,15 @@
<div class="tab-content">
<el-row :gutter="20" class="mb-20 ">
<span class="ml-10">鐢ㄥ嵃鏍囬锛�</span>
- <el-col :span="6">
+ <el-col :span="4">
<el-input v-model="sealSearchForm.title" placeholder="璇疯緭鍏ョ敵璇锋爣棰�" clearable />
</el-col>
+ <span class="ml-10">鐢ㄥ嵃缂栧彿锛�</span>
+ <el-col :span="4">
+ <el-input v-model="sealSearchForm.applicationNum" placeholder="璇疯緭鍏ョ敤鍗扮紪鍙�" clearable />
+ </el-col>
<span class="search_title">瀹℃壒鐘舵�侊細</span>
- <el-col :span="6">
+ <el-col :span="4">
<el-select v-model="sealSearchForm.status" placeholder="瀹℃壒鐘舵��" clearable>
<el-option label="寰呭鎵�" value="pending" />
<el-option label="宸查�氳繃" value="approved" />
@@ -96,6 +100,16 @@
</el-form-item>
<el-form-item label="鐢宠鍘熷洜" prop="reason">
<el-input v-model="sealForm.reason" type="textarea" :rows="4" placeholder="璇疯缁嗚鏄庣敤鍗板師鍥�" />
+ </el-form-item>
+ <el-form-item label="瀹℃壒浜�" prop="approveUserId">
+ <el-select v-model="sealForm.approveUserId" placeholder="璇烽�夋嫨瀹℃壒浜�" style="width: 100%" filterable>
+ <el-option
+ v-for="user in userList"
+ :key="user.userId"
+ :label="user.nickName"
+ :value="user.userId"
+ />
+ </el-select>
</el-form-item>
<el-form-item label="绱ф�ョ▼搴�" prop="urgency">
<el-radio-group v-model="sealForm.urgency">
@@ -240,12 +254,13 @@
</template>
<script setup>
-import { ref, reactive, onMounted, getCurrentInstance } from 'vue'
+import { ref, reactive, onMounted, getCurrentInstance, watch } from 'vue'
+import { useRoute } from 'vue-router'
import { ElMessage, ElMessageBox } from 'element-plus'
import { Plus } from '@element-plus/icons-vue'
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 { getUserProfile, userListNoPageByTenantId } from '@/api/system/user.js'
import {staffJoinDel, staffJoinListPage} from "@/api/personnelManagement/onboarding.js";
import useUserStore from '@/store/modules/user'
import { userLoginFacotryList } from "@/api/system/user.js"
@@ -257,16 +272,19 @@
const tableData = ref([])
// 鐢ㄥ嵃鐢宠鐩稿叧
const userStore = useUserStore()
+const route = useRoute()
const showSealApplyDialog = ref(false)
const tableLoading = ref(false)
const showSealDetailDialog = ref(false)
const currentSealDetail = ref(null)
const sealFormRef = ref()
+const userList = ref([])
const sealForm = reactive({
applicationNum: '',
title: '',
sealType: '',
reason: '',
+ approveUserId: '',
urgency: 'normal',
status: 'pending'
})
@@ -275,12 +293,14 @@
applicationNum: [{ required: true, message: '璇疯緭鍏ョ敵璇风紪鍙�', trigger: 'blur' }],
title: [{ required: true, message: '璇疯緭鍏ョ敵璇锋爣棰�', trigger: 'blur' }],
sealType: [{ required: true, message: '璇烽�夋嫨鐢ㄥ嵃绫诲瀷', trigger: 'change' }],
- reason: [{ required: true, message: '璇疯緭鍏ョ敵璇峰師鍥�', trigger: 'blur' }]
+ reason: [{ required: true, message: '璇疯緭鍏ョ敵璇峰師鍥�', trigger: 'blur' }],
+ approveUserId: [{ required: true, message: '璇烽�夋嫨瀹℃壒浜�', trigger: 'change' }]
}
const sealSearchForm = reactive({
title: '',
- status: ''
+ status: '',
+ applicationNum: ''
})
// 鍒嗛〉鍙傛暟
const page = reactive({
@@ -393,6 +413,7 @@
const resetSealSearch = () => {
sealSearchForm.title = ''
sealSearchForm.status = ''
+ sealSearchForm.applicationNum = ''
searchSealApplications()
}
// 鎼滅储鍒跺害
@@ -420,6 +441,7 @@
title: '',
sealType: '',
reason: '',
+ approveUserId: '',
urgency: 'normal',
status: 'pending'
})
@@ -713,9 +735,24 @@
})
}
+// 鐩戝惉瀵硅瘽妗嗘墦寮�锛岃幏鍙栫敤鎴峰垪琛�
+watch(showSealApplyDialog, (newVal) => {
+ if (newVal) {
+ userListNoPageByTenantId().then((res) => {
+ userList.value = res.data;
+ });
+ }
+});
+
onMounted(() => {
- // 鍒濆鍖�
- getSealApplicationList()
+ // 璺敱鎼哄甫 applicationNum 鏃讹紝棰勫~骞舵煡璇�
+ if (route.query.applicationNum) {
+ sealSearchForm.applicationNum = String(route.query.applicationNum)
+ page.current = 1
+ getSealApplicationList()
+ } else {
+ getSealApplicationList()
+ }
getRegulationList()
})
</script>
--
Gitblit v1.9.3