From 97081b89ee45da49b8dbb4173ab45df031fe3c0d Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期三, 20 五月 2026 16:58:40 +0800
Subject: [PATCH] 删除冗余和无效代码
---
src/views/officeProcessAutomation/EnterpriseNews/news-manage/enterpriseNewsUtils.js | 225 -------------------------------------------------------
1 files changed, 2 insertions(+), 223 deletions(-)
diff --git a/src/views/officeProcessAutomation/EnterpriseNews/news-manage/enterpriseNewsUtils.js b/src/views/officeProcessAutomation/EnterpriseNews/news-manage/enterpriseNewsUtils.js
index edc7f7e..4ba3085 100644
--- a/src/views/officeProcessAutomation/EnterpriseNews/news-manage/enterpriseNewsUtils.js
+++ b/src/views/officeProcessAutomation/EnterpriseNews/news-manage/enterpriseNewsUtils.js
@@ -40,19 +40,8 @@
{ value: "editor", label: "鍐呭缂栬緫" },
];
-export const STORAGE_KEY = "oa_enterprise_news_v1";
-
-/** 婕旂ず鐢ㄧ洰鏍囧彈浼楋紙鍚庢湡瀵规帴缁勭粐鏋舵瀯锛� */
-export const MOCK_AUDIENCE = [
- { userId: "u1", employeeNo: "zhangsan", name: "寮犱笁", deptName: "鐮斿彂閮�", isManagement: false },
- { userId: "u2", employeeNo: "lisi", name: "鏉庡洓", deptName: "鐮斿彂閮�", isManagement: false },
- { userId: "u3", employeeNo: "wangwu", name: "鐜嬩簲", deptName: "琛屾斂閮�", isManagement: false },
- { userId: "u4", employeeNo: "zhaoliu", name: "璧靛叚", deptName: "閿�鍞儴", isManagement: false },
- { userId: "u5", employeeNo: "sunqi", name: "瀛欎竷", deptName: "璐㈠姟閮�", isManagement: false },
- { userId: "u6", employeeNo: "zhouba", name: "鍛ㄥ叓", deptName: "鎬荤粡鍔�", isManagement: true },
- { userId: "u7", employeeNo: "wujiu", name: "鍚翠節", deptName: "鎬荤粡鍔�", isManagement: true },
- { userId: "u8", employeeNo: "zhengshi", name: "閮戝崄", deptName: "浜哄姏璧勬簮閮�", isManagement: false },
-];
+/** 鐩爣鍙椾紬锛堝鎺ョ粍缁囨灦鏋� API 鍓嶄负绌猴級 */
+export const MOCK_AUDIENCE = [];
const DEPT_OPTIONS = [
{ value: "101", label: "鐮斿彂閮�" },
@@ -123,205 +112,6 @@
};
}
-function buildReadRecords(readUserIds = []) {
- const set = new Set(readUserIds);
- return MOCK_AUDIENCE.map((u) => ({
- userId: u.userId,
- employeeNo: u.employeeNo,
- name: u.name,
- deptName: u.deptName,
- readAt: set.has(u.userId) ? dayjs().subtract(2, "day").format("YYYY-MM-DD HH:mm:ss") : "",
- lastRemindAt: "",
- }));
-}
-
-function createVersionSnapshot(row, changeNote = "鍙戝竷") {
- return {
- versionNo: row.versionNo || 1,
- title: row.title,
- summary: row.summary,
- contentHtml: row.contentHtml,
- newsType: row.newsType,
- publishTime: row.publishTime || dayjs().format("YYYY-MM-DD HH:mm:ss"),
- archivedAt: dayjs().format("YYYY-MM-DD HH:mm:ss"),
- changeNote,
- publisherName: row.publisherName || "绯荤粺",
- };
-}
-
-export function createInitialMockNews() {
- const policyContent =
- "<p><strong>2026 骞磋�冨嫟绠$悊鍒跺害锛堣瘯琛岋級</strong></p><p>涓�銆佷笂鐝椂闂� 9:00锛屽脊鎬ф墦鍗$獥鍙� 8:30鈥�9:30銆�</p><p>浜屻�佽鍋囬』鎻愬墠鍦� OA 鎻愪氦瀹℃壒銆�</p><p>涓夈�佹湰鍒跺害鑷� 2026-06-01 璧锋墽琛屻��</p>";
- const cultureContent =
- "<p>2026 浼佷笟骞翠細鍦嗘弧钀藉箷锛佹劅璋㈡瘡涓�浣嶅悓浜嬬殑鍙備笌锛屼互涓嬩负绮惧僵鐬棿鍥鹃泦銆�</p>";
- const strategyContent =
- "<p><strong>2026 涓嬪崐骞存垬鐣ユ柟鍚戯紙鍐呴儴锛�</strong></p><p>鑱氱劍鏍稿績浜у搧绾垮崌绾т笌娴峰甯傚満鎷撳睍锛屽叿浣撴寚鏍囪闄勪欢銆�</p>";
-
- const policyRow = {
- id: "news_1",
- newsNo: "EN202605150001",
- title: "鍏充簬鍙戝竷鏂拌�冨嫟鍒跺害鐨勯�氱煡",
- summary: "璇峰叏浣撳憳宸ヨ鐪熼槄璇诲苟纭鐭ユ倝锛岃嚜 2026-06-01 璧锋墽琛屻��",
- newsType: "policy",
- layoutTemplate: "policy",
- contentHtml: policyContent,
- coverImage: "",
- mediaList: [],
- attachmentList: [{ name: "鑰冨嫟鍒跺害2026.pdf", url: "/mock/attendance-policy.pdf" }],
- editorRole: "hr",
- reviewerRole: "admin",
- readScope: "all",
- targetDeptIds: [],
- targetUserIds: [],
- publishStatus: "published",
- publisherName: "浜哄姏璧勬簮閮�",
- publishTime: "2026-05-15 10:00:00",
- readRecords: buildReadRecords(["u6", "u7", "u8"]),
- remindLogs: [],
- likes: [],
- comments: [],
- versions: [
- {
- versionNo: 1,
- title: "鍏充簬鍙戝竷鏂拌�冨嫟鍒跺害鐨勯�氱煡锛堝緛姹傛剰瑙佺锛�",
- summary: "寰佹眰鎰忚绋�",
- contentHtml: "<p>寰佹眰鎰忚绋匡細涓婄彮鏃堕棿 9:00鈥︹��</p>",
- newsType: "policy",
- publishTime: "2026-05-10 09:00:00",
- archivedAt: "2026-05-15 09:55:00",
- changeNote: "瀹氱鍙戝竷",
- publisherName: "浜哄姏璧勬簮閮�",
- },
- ],
- versionNo: 2,
- requireReadConfirm: true,
- createTime: "2026-05-10 09:00:00",
- updateTime: "2026-05-15 10:00:00",
- };
-
- const cultureRow = {
- id: "news_2",
- newsNo: "EN202605200002",
- title: "2026 浼佷笟骞翠細绮惧僵鐬棿",
- summary: "骞翠細鍥鹃泦涓婄嚎锛屾杩庣偣璧炵暀瑷�锛屽叡寤轰紒涓氭枃鍖栥��",
- newsType: "culture",
- layoutTemplate: "gallery",
- contentHtml: cultureContent,
- coverImage: "/mock/annual-cover.jpg",
- mediaList: [
- { type: "image", name: "寮�鍦�.jpg", url: "/mock/annual-1.jpg" },
- { type: "image", name: "棰佸.jpg", url: "/mock/annual-2.jpg" },
- { type: "video", name: "骞翠細鑺辩诞.mp4", url: "/mock/annual.mp4" },
- ],
- attachmentList: [],
- editorRole: "dept_manager",
- reviewerRole: "admin",
- readScope: "all",
- targetDeptIds: [],
- targetUserIds: [],
- publishStatus: "published",
- publisherName: "琛屾斂閮�",
- publishTime: "2026-05-20 14:30:00",
- readRecords: buildReadRecords(["u1", "u2", "u3", "u4", "u5", "u6", "u7"]),
- remindLogs: [],
- likes: [
- { userId: "u1", name: "寮犱笁", time: "2026-05-20 15:01:00" },
- { userId: "u2", name: "鏉庡洓", time: "2026-05-20 15:05:00" },
- { userId: "u4", name: "璧靛叚", time: "2026-05-20 16:20:00" },
- ],
- comments: [
- { id: "c1", userId: "u1", name: "寮犱笁", content: "鑺傜洰澶簿褰╀簡锛�", time: "2026-05-20 15:10:00" },
- { id: "c2", userId: "u3", name: "鐜嬩簲", content: "鏈熷緟鏄庡勾鍐嶈仛锛�", time: "2026-05-20 17:00:00" },
- ],
- versions: [],
- versionNo: 1,
- requireReadConfirm: false,
- createTime: "2026-05-20 14:00:00",
- updateTime: "2026-05-20 14:30:00",
- };
-
- const strategyRow = {
- id: "news_3",
- newsNo: "EN202605220003",
- title: "2026 涓嬪崐骞存垬鐣ヨ鍒掕鐐�",
- summary: "浠呴檺绠$悊灞傞槄璇伙紝璇峰嬁瀵瑰浼犳挱銆�",
- newsType: "announcement",
- layoutTemplate: "briefing",
- contentHtml: strategyContent,
- coverImage: "",
- mediaList: [],
- attachmentList: [{ name: "鎴樼暐鎸囨爣.pdf", url: "/mock/strategy.pdf" }],
- editorRole: "admin",
- reviewerRole: "admin",
- readScope: "management",
- targetDeptIds: [],
- targetUserIds: [],
- publishStatus: "published",
- publisherName: "鎬荤粡鍔�",
- publishTime: "2026-05-22 09:00:00",
- readRecords: buildReadRecords(["u6", "u7"]),
- remindLogs: [],
- likes: [],
- comments: [],
- versions: [],
- versionNo: 1,
- requireReadConfirm: false,
- createTime: "2026-05-22 08:30:00",
- updateTime: "2026-05-22 09:00:00",
- };
-
- const industryDraft = {
- id: "news_4",
- newsNo: "EN202605250004",
- title: "鍒堕�犱笟鏁板瓧鍖栬浆鍨嬭秼鍔跨畝鎶�",
- summary: "琛屼笟鍔ㄦ�佽崏绋匡紝寰呯鐞嗗憳瀹℃牳鍚庡彂甯冦��",
- newsType: "industry",
- layoutTemplate: "standard",
- contentHtml: "<p>鏈湡绠�鎶ユ⒊鐞嗗伐涓氫簰鑱旂綉涓� AI 璐ㄦ搴旂敤妗堜緥鈥︹��</p>",
- coverImage: "",
- mediaList: [],
- attachmentList: [],
- editorRole: "editor",
- reviewerRole: "admin",
- readScope: "all",
- targetDeptIds: [],
- targetUserIds: [],
- publishStatus: "pending_review",
- publisherName: "甯傚満閮�",
- publishTime: "",
- readRecords: [],
- remindLogs: [],
- likes: [],
- comments: [],
- versions: [],
- versionNo: 1,
- requireReadConfirm: false,
- createTime: "2026-05-25 11:00:00",
- updateTime: "2026-05-25 11:00:00",
- };
-
- return [policyRow, cultureRow, strategyRow, industryDraft];
-}
-
-export function loadStoredNews() {
- try {
- const raw = localStorage.getItem(STORAGE_KEY);
- if (!raw) return null;
- const data = JSON.parse(raw);
- return Array.isArray(data) ? data : null;
- } catch {
- return null;
- }
-}
-
-export function saveStoredNews(rows) {
- try {
- localStorage.setItem(STORAGE_KEY, JSON.stringify(rows));
- } catch {
- /* ignore */
- }
-}
-
/** 鎸夐槄璇昏寖鍥磋В鏋愮洰鏍囧彈浼� */
export function resolveTargetAudience(row) {
const scope = row.readScope || "all";
@@ -351,17 +141,6 @@
if (!audience.length) return 0;
const readCount = (row.readRecords || []).filter((r) => r.readAt).length;
return Math.round((readCount / audience.length) * 100);
-}
-
-export function nextNewsNo() {
- return `EN${dayjs().format("YYYYMMDD")}${String(Math.floor(Math.random() * 9000) + 1000)}`;
-}
-
-export function pushVersionBeforeUpdate(row, changeNote) {
- const versions = row.versions || [];
- versions.unshift(createVersionSnapshot(row, changeNote));
- row.versions = versions;
- row.versionNo = (row.versionNo || 1) + 1;
}
export function validateNewsForm(form) {
--
Gitblit v1.9.3