From a64543f9746d5d52b42e7f001f7a0d645cf3e596 Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Fri, 06 Feb 2026 10:13:16 +0800
Subject: [PATCH] feat:更新任务工单

---
 packages/utils/common/index.js |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/packages/utils/common/index.js b/packages/utils/common/index.js
index 9d00919..c213e19 100644
--- a/packages/utils/common/index.js
+++ b/packages/utils/common/index.js
@@ -12,9 +12,30 @@
 	return rules
 }
 
+const isContactPhone = value => {
+	const mobile = /^1[3-9]\d{9}$/
+	const landline = /^0\d{2,3}-?\d{7,8}$/
+	return mobile.test(value) || landline.test(value)
+}
 
-export function getDictLabel(value, dictList) {
-	return dictList.find(item => item.dictKey === value)?.dictValue || value || '-'
+export const contactPhoneRules = (required = true, max = 50) => {
+	const validateContactPhone = (rule, value, callback) => {
+		const nextValue = String(value || '').trim()
+		if (!nextValue) return callback()
+		if (isContactPhone(nextValue)) return callback()
+		return callback(new Error('联系电话格式不正确'))
+	}
+
+	return [...fieldRules(required, max), { validator: validateContactPhone, trigger: ['blur', 'change'] }]
+}
+
+export function getDictLabel(value, dictList = []) {
+	if (value === null || value === undefined || value === '') return '';
+	const values = String(value).split(',');
+	return dictList
+		.filter(item => values.includes(String(item.dictKey)))
+		.map(item => item.dictValue)
+		.join(',');
 }
 
 export function blobDownload(res) {

--
Gitblit v1.9.3