From d693272409250e5d9afad65e82a8581dc395d7fa Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 08 五月 2026 18:03:04 +0800
Subject: [PATCH] 浪潮 1.日志前端页面开发与联调
---
src/views/collaborativeApproval/journal/index.vue | 268 ++++++++++++++++++++++++-----------------------------
1 files changed, 122 insertions(+), 146 deletions(-)
diff --git a/src/views/collaborativeApproval/journal/index.vue b/src/views/collaborativeApproval/journal/index.vue
index ff65c41..1ee7992 100644
--- a/src/views/collaborativeApproval/journal/index.vue
+++ b/src/views/collaborativeApproval/journal/index.vue
@@ -6,9 +6,6 @@
<el-form-item label="鏃ュ織鏍囬">
<el-input v-model="searchForm.title" placeholder="璇疯緭鍏ユ棩蹇楁爣棰�" clearable />
</el-form-item>
- <el-form-item label="鍒涘缓浜�">
- <el-input v-model="searchForm.createUserName" placeholder="璇疯緭鍏ュ垱寤轰汉" clearable />
- </el-form-item>
<el-form-item label="鍒涘缓鏃堕棿">
<el-date-picker
v-model="searchForm.dateRange"
@@ -37,7 +34,6 @@
<span>
<el-icon><Calendar /></el-icon>
鏃ユ姤
- <span class="tab-count" v-if="journalCount.daily > 0">({{ journalCount.daily }})</span>
</span>
</template>
</el-tab-pane>
@@ -46,7 +42,6 @@
<span>
<el-icon><Document /></el-icon>
鍛ㄦ姤
- <span class="tab-count" v-if="journalCount.weekly > 0">({{ journalCount.weekly }})</span>
</span>
</template>
</el-tab-pane>
@@ -55,7 +50,6 @@
<span>
<el-icon><DataAnalysis /></el-icon>
鏈堟姤
- <span class="tab-count" v-if="journalCount.monthly > 0">({{ journalCount.monthly }})</span>
</span>
</template>
</el-tab-pane>
@@ -64,31 +58,24 @@
<!-- 鏃ュ織琛ㄦ牸 -->
<el-table :data="journalList" v-loading="loading" border style="width: 100%">
<el-table-column type="index" label="搴忓彿" width="60" align="center" />
- <el-table-column prop="title" label="鏃ュ織鏍囬" min-width="200" show-overflow-tooltip>
+ <el-table-column prop="title" label="鏃ュ織鏍囬" show-overflow-tooltip />
+ <el-table-column prop="reportType" label="鎶ュ憡绫诲瀷" width="100" align="center">
<template #default="scope">
- <el-link type="primary" @click="handleView(scope.row)">{{ scope.row.title }}</el-link>
+ <el-tag :type="getTypeTagType(scope.row.reportType)">{{ getTypeText(scope.row.reportType) }}</el-tag>
</template>
</el-table-column>
- <el-table-column prop="type" label="鏃ュ織绫诲瀷" width="100" align="center">
+ <el-table-column prop="logType" label="鏃ュ織绫诲瀷" align="center">
<template #default="scope">
- <el-tag :type="getTypeTagType(scope.row.type)">{{ getTypeText(scope.row.type) }}</el-tag>
+ <el-tag>{{ getLogTypeText(scope.row.logType) }}</el-tag>
</template>
</el-table-column>
- <el-table-column prop="content" label="鏃ュ織鍐呭" min-width="300" show-overflow-tooltip />
- <el-table-column prop="createUserName" label="鍒涘缓浜�" width="120" align="center" />
- <el-table-column prop="createTime" label="鍒涘缓鏃堕棿" width="160" align="center" />
- <el-table-column prop="pushStatus" label="鎺ㄩ�佺姸鎬�" width="100" align="center">
- <template #default="scope">
- <el-tag :type="scope.row.pushStatus === 1 ? 'success' : 'info'">
- {{ scope.row.pushStatus === 1 ? '宸叉帹閫�' : '鏈帹閫�' }}
- </el-tag>
- </template>
- </el-table-column>
+ <el-table-column prop="createUserName" label="鍒涘缓浜�" align="center" />
+ <el-table-column prop="createTime" label="鍒涘缓鏃堕棿" align="center" />
+ <el-table-column prop="ccUserName" label="鎶勯�佷汉" align="center" />
<el-table-column label="鎿嶄綔" width="250" align="center" fixed="right">
<template #default="scope">
- <el-button link type="primary" @click="handleView(scope.row)">鏌ョ湅</el-button>
<el-button link type="primary" @click="handleEdit(scope.row)">缂栬緫</el-button>
- <el-button link type="success" @click="handlePush(scope.row)" v-if="scope.row.pushStatus !== 1">鎺ㄩ��</el-button>
+ <el-button link type="primary" @click="handleView(scope.row)">鏌ョ湅</el-button>
<el-button link type="danger" @click="handleDelete(scope.row.id)">鍒犻櫎</el-button>
</template>
</el-table-column>
@@ -98,9 +85,9 @@
<pagination
v-show="total > 0"
:total="total"
- v-model:page="queryParams.pageNum"
- v-model:limit="queryParams.pageSize"
- @pagination="getList"
+ v-model:page="queryParams.current"
+ v-model:limit="queryParams.size"
+ @pagination="({ page, limit }) => { queryParams.current = page; queryParams.size = limit; getList(); }"
/>
<!-- 绌虹姸鎬� -->
@@ -120,8 +107,8 @@
<el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
<el-row>
<el-col :span="12">
- <el-form-item label="鏃ュ織绫诲瀷" prop="type">
- <el-select v-model="form.type" placeholder="璇烽�夋嫨鏃ュ織绫诲瀷" style="width: 100%">
+ <el-form-item label="鎶ュ憡绫诲瀷">
+ <el-select v-model="form.reportType" disabled style="width: 100%">
<el-option label="鏃ユ姤" value="daily" />
<el-option label="鍛ㄦ姤" value="weekly" />
<el-option label="鏈堟姤" value="monthly" />
@@ -129,6 +116,18 @@
</el-form-item>
</el-col>
<el-col :span="12">
+ <el-form-item label="鏃ュ織绫诲瀷" prop="logType">
+ <el-select v-model="form.logType" placeholder="璇烽�夋嫨鏃ュ織绫诲瀷" style="width: 100%">
+ <el-option label="宸ヤ綔" value="work" />
+ <el-option label="椤圭洰" value="project" />
+ <el-option label="闂" value="problem" />
+ <el-option label="鍏朵粬" value="other" />
+ </el-select>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row>
+ <el-col :span="24">
<el-form-item label="鏃ュ織鏍囬" prop="title">
<el-input v-model="form.title" placeholder="璇疯緭鍏ユ棩蹇楁爣棰�" />
</el-form-item>
@@ -150,6 +149,31 @@
</el-row>
<el-row>
<el-col :span="24">
+ <el-form-item label="鎶勯�佷汉" prop="ccUserIds">
+ <el-select
+ v-model="form.ccUserIds"
+ multiple
+ filterable
+ remote
+ reserve-keyword
+ placeholder="璇疯緭鍏ユ妱閫佷汉鍚嶇О鎼滅储"
+ :remote-method="searchPushUsers"
+ :loading="userLoading"
+ style="width: 100%"
+ >
+ <el-option
+ v-for="item in userOptions"
+ :key="item.userId"
+ :label="item.nickName"
+ :value="item.userId"
+ >
+ </el-option>
+ </el-select>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row>
+ <el-col :span="24">
<el-form-item label="澶囨敞">
<el-input
v-model="form.remark"
@@ -164,11 +188,8 @@
</el-row>
</el-form>
<template #footer>
- <div class="dialog-footer">
- <el-button type="primary" @click="submitForm">淇� 瀛�</el-button>
- <el-button type="success" @click="submitAndPushForm">淇濆瓨骞舵帹閫�</el-button>
- <el-button @click="dialogVisible = false">鍙� 娑�</el-button>
- </div>
+ <el-button type="primary" @click="submitForm">淇濆瓨</el-button>
+ <el-button @click="dialogVisible = false">鍙� 娑�</el-button>
</template>
</el-dialog>
@@ -183,14 +204,15 @@
<div class="detail-header">
<h3 class="detail-title">{{ currentJournal.title }}</h3>
<div class="detail-meta">
- <el-tag :type="getTypeTagType(currentJournal.type)">{{ getTypeText(currentJournal.type) }}</el-tag>
+ <el-tag :type="getTypeTagType(currentJournal.reportType)">{{ getTypeText(currentJournal.reportType) }}</el-tag>
+ <el-tag>{{ getLogTypeText(currentJournal.logType) }}</el-tag>
<el-tag :type="currentJournal.pushStatus === 1 ? 'success' : 'info'">
{{ currentJournal.pushStatus === 1 ? '宸叉帹閫�' : '鏈帹閫�' }}
</el-tag>
</div>
</div>
<div class="detail-info">
- <span><el-icon><User /></el-icon> 鍒涘缓浜猴細{{ currentJournal.createUserName }}</span>
+ <span><el-icon><User /></el-icon> 鍒涘缓浜猴細{{ currentJournal.createUser }}</span>
<span><el-icon><Timer /></el-icon> 鍒涘缓鏃堕棿锛歿{ currentJournal.createTime }}</span>
</div>
<el-divider />
@@ -204,11 +226,9 @@
</div>
</div>
<template #footer>
- <div class="dialog-footer">
- <el-button type="primary" @click="handleEditFromView" v-if="currentJournal.pushStatus !== 1">缂� 杈�</el-button>
- <el-button type="success" @click="handlePushFromView" v-if="currentJournal.pushStatus !== 1">鎺� 閫�</el-button>
- <el-button @click="viewDialogVisible = false">鍏� 闂�</el-button>
- </div>
+ <el-button type="primary" @click="handleEditFromView" v-if="currentJournal.pushStatus !== 1">缂� 杈�</el-button>
+ <el-button type="success" @click="handlePushFromView" v-if="currentJournal.pushStatus !== 1">鎺� 閫�</el-button>
+ <el-button @click="viewDialogVisible = false">鍏� 闂�</el-button>
</template>
</el-dialog>
@@ -224,14 +244,14 @@
<p><strong>鏃ュ織绫诲瀷锛�</strong>{{ getTypeText(currentJournal.type) }}</p>
</div>
<el-form ref="pushFormRef" :model="pushForm" :rules="pushRules" label-width="100px">
- <el-form-item label="鎺ㄩ�佷汉鍛�" prop="userIds">
+ <el-form-item label="鎶勯�佷汉" prop="userIds">
<el-select
v-model="pushForm.userIds"
multiple
filterable
remote
reserve-keyword
- placeholder="璇疯緭鍏ョ敤鎴峰悕鎼滅储"
+ placeholder="璇疯緭鍏ユ妱閫佷汉鍚嶇О鎼滅储"
:remote-method="remoteSearchUser"
:loading="userLoading"
style="width: 100%"
@@ -239,11 +259,9 @@
<el-option
v-for="item in userOptions"
:key="item.userId"
- :label="item.userName"
+ :label="item.nickName"
:value="item.userId"
>
- <span>{{ item.userName }}</span>
- <span style="float: right; color: #8492a6; font-size: 13px">{{ item.deptName }}</span>
</el-option>
</el-select>
</el-form-item>
@@ -273,13 +291,11 @@
import useUserStore from "@/store/modules/user";
import {
listJournal,
- getJournal,
addJournal,
updateJournal,
- delJournal,
- pushJournal,
- listUser
+ delJournal
} from "@/api/collaborativeApproval/journal.js";
+import { userListNoPage } from "@/api/system/user.js";
import Pagination from "@/components/Pagination/index.vue";
const userStore = useUserStore();
@@ -288,19 +304,23 @@
const data = reactive({
searchForm: {
title: "",
- createUserName: "",
dateRange: []
},
form: {
id: undefined,
- type: "daily",
+ reportType: "daily",
+ logType: "work",
title: "",
content: "",
remark: "",
- pushStatus: 0
+ pushStatus: 0,
+ ccUserIds: []
},
rules: {
- type: [
+ reportType: [
+ { required: true, message: "璇烽�夋嫨鎶ュ憡绫诲瀷", trigger: "change" }
+ ],
+ logType: [
{ required: true, message: "璇烽�夋嫨鏃ュ織绫诲瀷", trigger: "change" }
],
title: [
@@ -331,8 +351,8 @@
// 鏌ヨ鍙傛暟
const queryParams = reactive({
- pageNum: 1,
- pageSize: 10
+ current: 1,
+ size: 10
});
// 鎺ㄩ�佽〃鍗�
@@ -359,16 +379,13 @@
const getList = () => {
loading.value = true;
const params = {
- pageNum: queryParams.pageNum,
- pageSize: queryParams.pageSize,
- type: activeJournalType.value
+ current: queryParams.current,
+ size: queryParams.size,
+ reportType: activeJournalType.value
};
-
+
if (searchForm.value.title) {
params.title = searchForm.value.title;
- }
- if (searchForm.value.createUserName) {
- params.createUserName = searchForm.value.createUserName;
}
if (searchForm.value.dateRange && searchForm.value.dateRange.length === 2) {
params.startTime = searchForm.value.dateRange[0];
@@ -390,10 +407,10 @@
// 鑾峰彇鎵�鏈夌被鍨嬫暟閲�
const getAllTypeCounts = () => {
- ['daily', 'weekly', 'monthly'].forEach(type => {
- listJournal({ pageNum: 1, pageSize: 1, type }).then(res => {
+ ['daily', 'weekly', 'monthly'].forEach(reportType => {
+ listJournal({ current: 1, size: 1, reportType }).then(res => {
if (res.code === 200) {
- journalCount[type] = res.data.total || 0;
+ journalCount[reportType] = res.data.total || 0;
}
});
});
@@ -402,13 +419,13 @@
// Tab鍒囨崲
const handleTabChange = (tabName) => {
activeJournalType.value = tabName;
- queryParams.pageNum = 1;
+ queryParams.current = 1;
getList();
};
// 鎼滅储
const handleQuery = () => {
- queryParams.pageNum = 1;
+ queryParams.current = 1;
getList();
};
@@ -416,22 +433,27 @@
const resetQuery = () => {
searchForm.value = {
title: "",
- createUserName: "",
dateRange: []
};
handleQuery();
};
// 鑾峰彇绫诲瀷鏂囨湰
-const getTypeText = (type) => {
+const getTypeText = (reportType) => {
const typeMap = { daily: "鏃ユ姤", weekly: "鍛ㄦ姤", monthly: "鏈堟姤" };
- return typeMap[type] || type;
+ return typeMap[reportType] || reportType;
+};
+
+// 鑾峰彇鏃ュ織绫诲瀷鏂囨湰
+const getLogTypeText = (logType) => {
+ const typeMap = { work: "宸ヤ綔", project: "椤圭洰", problem: "闂", other: "鍏朵粬" };
+ return typeMap[logType] || logType;
};
// 鑾峰彇绫诲瀷鏍囩鏍峰紡
-const getTypeTagType = (type) => {
+const getTypeTagType = (reportType) => {
const typeMap = { daily: "primary", weekly: "success", monthly: "warning" };
- return typeMap[type] || "";
+ return typeMap[reportType] || "";
};
// 鎵撳紑琛ㄥ崟
@@ -440,25 +462,25 @@
dialogTitle.value = "缂栧啓鏃ュ織";
form.value = {
id: undefined,
- type: activeJournalType.value,
+ reportType: activeJournalType.value,
+ logType: "work",
title: "",
content: "",
remark: "",
- pushStatus: 0
+ pushStatus: 0,
+ ccUserIds: []
};
}
dialogVisible.value = true;
+ loadUserOptions();
};
// 缂栬緫鏃ュ織
const handleEdit = (row) => {
- if (row.pushStatus === 1) {
- ElMessage.warning("宸叉帹閫佺殑鏃ュ織涓嶅彲缂栬緫");
- return;
- }
dialogTitle.value = "缂栬緫鏃ュ織";
- form.value = { ...row };
+ form.value = { ...row, ccUserIds: row.ccUserIds || [] };
dialogVisible.value = true;
+ loadUserOptions();
};
// 浠庢煡鐪嬮〉闈㈢紪杈�
@@ -469,12 +491,8 @@
// 鏌ョ湅鏃ュ織
const handleView = (row) => {
- getJournal(row.id).then(res => {
- if (res.code === 200) {
- currentJournal.value = res.data;
- viewDialogVisible.value = true;
- }
- });
+ currentJournal.value = { ...row };
+ viewDialogVisible.value = true;
};
// 鍒犻櫎鏃ュ織
@@ -488,11 +506,10 @@
type: "warning"
}
).then(() => {
- delJournal(id).then(res => {
+ delJournal([id]).then(res => {
if (res.code === 200) {
ElMessage.success("鍒犻櫎鎴愬姛");
getList();
- getAllTypeCounts();
}
});
});
@@ -517,79 +534,39 @@
// 鍔犺浇鐢ㄦ埛閫夐」
const loadUserOptions = () => {
- listUser({ pageNum: 1, pageSize: 100 }).then(res => {
+ userListNoPage().then(res => {
if (res.code === 200) {
- userOptions.value = res.data.records || res.data || [];
+ userOptions.value = res.data || [];
}
});
};
-// 杩滅▼鎼滅储鐢ㄦ埛
-const remoteSearchUser = (query) => {
- if (query) {
- userLoading.value = true;
- listUser({ userName: query, pageNum: 1, pageSize: 50 }).then(res => {
- if (res.code === 200) {
- userOptions.value = res.data.records || res.data || [];
- }
- userLoading.value = false;
- }).catch(() => {
- userLoading.value = false;
- });
- }
+// 杩滅▼鎼滅储鎶勯�佺敤鎴�
+const searchPushUsers = (query) => {
+ userLoading.value = true;
+ userListNoPage().then(res => {
+ if (res.code === 200) {
+ userOptions.value = res.data || [];
+ }
+ userLoading.value = false;
+ }).catch(() => {
+ userLoading.value = false;
+ });
};
// 鎻愪氦琛ㄥ崟
const submitForm = () => {
formRef.value.validate((valid) => {
if (valid) {
- const api = form.value.id ? updateJournal : addJournal;
- api(form.value).then(res => {
+ const isEdit = !!form.value.id;
+ const api = isEdit ? updateJournal : addJournal;
+ const saveData = { ...form.value };
+
+ api(saveData).then(res => {
if (res.code === 200) {
- ElMessage.success(form.value.id ? "淇敼鎴愬姛" : "鏂板鎴愬姛");
+ ElMessage.success(isEdit ? "淇敼鎴愬姛" : "淇濆瓨鎴愬姛");
dialogVisible.value = false;
getList();
- getAllTypeCounts();
- }
- });
- }
- });
-};
-
-// 鎻愪氦骞舵帹閫�
-const submitAndPushForm = () => {
- formRef.value.validate((valid) => {
- if (valid) {
- const api = form.value.id ? updateJournal : addJournal;
- api(form.value).then(res => {
- if (res.code === 200) {
- const journalId = form.value.id || res.data;
- dialogVisible.value = false;
- // 鎵撳紑鎺ㄩ�佸脊绐�
- currentJournal.value = { ...form.value, id: journalId };
- pushForm.journalId = journalId;
- pushForm.userIds = [];
- pushForm.remark = "";
- pushDialogVisible.value = true;
- loadUserOptions();
- getList();
- getAllTypeCounts();
- }
- });
- }
- });
-};
-
-// 鎻愪氦鎺ㄩ��
-const submitPush = () => {
- pushFormRef.value.validate((valid) => {
- if (valid) {
- pushJournal(pushForm).then(res => {
- if (res.code === 200) {
- ElMessage.success("鎺ㄩ�佹垚鍔�");
- pushDialogVisible.value = false;
- getList();
- getAllTypeCounts();
}
});
}
@@ -603,7 +580,6 @@
onMounted(() => {
getList();
- getAllTypeCounts();
});
</script>
--
Gitblit v1.9.3