From a3e955e801044d8abc2ec575cdf74a6815b8d963 Mon Sep 17 00:00:00 2001
From: baoshiwei <baoshiwei@shlanbao.cn>
Date: 星期四, 11 九月 2025 15:30:36 +0800
Subject: [PATCH] 优化配方维护功能-增加简写首字母自动填充,优化车间大屏和设备大屏界面

---
 src/utils/common/renderUtils.ts |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/src/utils/common/renderUtils.ts b/src/utils/common/renderUtils.ts
index cf8d1d6..f5cea17 100644
--- a/src/utils/common/renderUtils.ts
+++ b/src/utils/common/renderUtils.ts
@@ -7,6 +7,8 @@
 import { filterMultiDictText } from '/@/utils/dict/JDictSelectUtil.js';
 import { isEmpty } from '/@/utils/is';
 import { useMessage } from '/@/hooks/web/useMessage';
+import pinyin from 'chinese-to-pinyin';
+
 const { createMessage } = useMessage();
 
 const render = {
@@ -172,4 +174,25 @@
   }
 }
 
+/**
+ * 鑾峰彇涓枃瀛楃涓茬殑鍏ㄦ嫾
+ * @param str 涓枃瀛楃涓�
+ * @returns 鎷奸煶瀛楃涓�
+ */
+export function getFullWordSpell(str: string): string {
+  if (!str) return '';
+  return pinyin(str, { toneToNumber: true });
+}
+
+/**
+ * 鑾峰彇涓枃瀛楃涓茬殑棣栧瓧姣�
+ * @param str 涓枃瀛楃涓�
+ * @returns 棣栧瓧姣嶇粍鎴愮殑瀛楃涓�
+ */
+export function getFirstWordSpell(str: string): string {
+  if (!str) return '';
+  // 鑾峰彇姣忎釜瀛楃殑鎷奸煶棣栧瓧姣嶅苟杩炴帴
+  return pinyin(str, { keepRest: true, firstCharacter: true, removeSpace: true });
+}
+
 export { render, downloadFile };

--
Gitblit v1.9.3