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

---
 src/views/dry/dataDefine/DryHerbFormula.data.ts |  207 +++++++++++++++++++++++++--------------------------
 1 files changed, 100 insertions(+), 107 deletions(-)

diff --git a/src/views/dry/dataDefine/DryHerbFormula.data.ts b/src/views/dry/dataDefine/DryHerbFormula.data.ts
index 20c04a9..6ff3611 100644
--- a/src/views/dry/dataDefine/DryHerbFormula.data.ts
+++ b/src/views/dry/dataDefine/DryHerbFormula.data.ts
@@ -2,6 +2,7 @@
 import {render} from "/@/utils/common/renderUtils";
 import {rules} from "/@/utils/helper/validator";
 import {queryById} from "/@/views/dry/api/DryHerbInfo.api"
+import { getFirstWordSpell } from "/@/utils/common/renderUtils";
 //鍒楄〃鏁版嵁
 export const columns: BasicColumn[] = [
 	{
@@ -20,12 +21,36 @@
 		dataIndex: 'eqpType_dictText',
 	},
   {
-    title: '閰嶆柟鍒嗙被',
+    title: '缂╁啓',
     align: 'center',
-    dataIndex: 'category',
+    dataIndex: 'abbr',
+  },
+  {
+    title: '鐗圭鐗╂枡',
+    align: 'center',
+    dataIndex: 'special',
     customRender: ({ text }) => {
-      return render.renderDict(text, 'formula_category');
+      return render.renderSwitch(text, [
+        { text: '鏄�', value: 'true' },
+        { text: '鍚�', value: 'false' },
+      ])
     },
+  },
+  {
+    title: '杞昏川鐗╂枡',
+    align: 'center',
+    dataIndex: 'light',
+    customRender: ({ text }) => {
+      return render.renderSwitch(text, [
+        { text: '鏄�', value: 'true' },
+        { text: '鍚�', value: 'false' },
+      ])
+    },
+  },
+  {
+    title: '鍒濆鍚按鐜�',
+    align: 'center',
+    dataIndex: 'initial',
   },
 	{
 		title: '鐩爣鍚按鐜�',
@@ -52,41 +77,25 @@
     align: 'center',
     dataIndex: 'fanSpeed',
   },
-	// {
-	// 	title: '鐜娓╁害',
-	// 	align: 'center',
-	// 	dataIndex: 'envTemp',
-	// },
-	// {
-	// 	title: '鐜婀垮害',
-	// 	align: 'center',
-	// 	dataIndex: 'envHum',
-	// },
+
 	{
-		title: '鑽℃枡寤舵椂ms',
+		title: '鍚敤缈绘枡绛栫暐',
 		align: 'center',
-		dataIndex: 'delay',
+		dataIndex: 'strategy',
+    customRender: ({ text }) => {
+      return render.renderSwitch(text, [
+        { text: '鏄�', value: 'true' },
+        { text: '鍚�', value: 'false' },
+      ])
+    },
 	},
-	// {
-	// 	title: '缈绘枡娆℃暟',
-	// 	align: 'center',
-	// 	dataIndex: 'turn',
-	// },
-  {
-    title: '鍚按鐜囪ˉ鍋�',
-    align: 'center',
-    dataIndex: 'moisOffset',
-  },
+
   {
     title: '鍐烽鏃堕暱',
     align: 'center',
     dataIndex: 'coolingDuration',
   },
-	// {
-	// 	title: '绉熸埛id',
-	// 	align: 'center',
-	// 	dataIndex: 'tenantId',
-	// },
+
 ]
 //鏌ヨ鏁版嵁
 export const searchFormSchema: FormSchema[] = [
@@ -115,6 +124,12 @@
           }
           queryById(param).then(res => {
             formModel.name = res.name
+            if (res.name) {
+              const abbr = getFirstWordSpell(res.name);
+              formModel.abbr = abbr.toUpperCase();
+            } else {
+              formModel.abbr = '';
+            }
           })
         },
       }
@@ -123,33 +138,69 @@
 			return [{ required: true, message: '璇烽�夋嫨鑽潗!' }]
 		},
 	},
-	{
-		label: '閰嶆柟鍚嶇О',
-		field: 'name',
-		component: 'Input',
+  {
+    label: '閰嶆柟鍚嶇О',
+    field: 'name',
+    component: 'Input',
     dynamicRules: ({ model, schema }) => {
       return [{ required: true, message: '璇疯緭鍏ラ厤鏂瑰悕绉�!' }, { ...rules.duplicateCheckRule('dry_herb_formula', 'name', model, schema)[0] }]
     },
-	},
+    componentProps: ({ formModel }) => {
+      return {
+        onChange: (e) => {
+          const value = e.target.value;
+          // 鐢熸垚鎷奸煶棣栧瓧姣嶅苟璧嬪�肩粰 abbr 瀛楁
+          if (value) {
+            const abbr = getFirstWordSpell(value);
+            formModel.abbr = abbr.toUpperCase();
+          } else {
+            formModel.abbr = '';
+          }
+        }
+      };
+    },
+  },
+
 	{
 		label: '璁惧绫诲瀷',
 		field: 'eqpType',
 		component: 'JSearchSelect',
 		componentProps: {
-			dict: 'dry_eqp_type,name,id',
+			dict: 'dry_eqp_type,name,id'
 		},
 		dynamicRules: ({ model, schema }) => {
-			return [{ required: true, message: '璇疯澶囪澶囩被鍨�!' }]
+			return [{ required: true, message: '璇烽�夋嫨璁惧绫诲瀷!' }]
 		},
+    defaultValue: '1952566592372215810',
 	},
   {
-    label: '閰嶆柟鍒嗙被',
-    field: 'category',
-    component: 'JDictSelectTag',
-    componentProps: {
-      dictCode: 'formula_category',
-      placeholder: '璇烽�夋嫨閰嶆柟鍒嗙被',
-      stringToNumber: true,
+    label: '棣栧瓧姣嶇缉鍐�',
+    field: 'abbr',
+    component: 'Input'
+  },
+  {
+    label: '鐗圭鐗╂枡',
+    field: 'special',
+    component: 'Switch',
+    defaultValue: false
+  },
+  {
+    label: '杞昏川鐗╂枡',
+    field: 'light',
+    component: 'Switch',
+    defaultValue: false
+  },
+  {
+    label: '鍒濆鍚按鐜�',
+    field: 'initial',
+    component: 'Input',
+    dynamicRules: ({ model, schema }) => {
+      return [{ required: false }, { pattern: /^-?\d+\.?\d*$/, message: '璇疯緭鍏ユ暟瀛�!' }]
+    },
+    renderComponentContent: () => {
+      return {
+        suffix: () => '%',
+      }
     },
   },
 	{
@@ -217,71 +268,13 @@
       }
     },
   },
-	// {
-	// 	label: '鐜娓╁害',
-	// 	field: 'envTemp',
-	// 	component: 'Input',
-	// 	dynamicRules: ({ model, schema }) => {
-	// 		return [{ required: false }, { pattern: /^-?\d+\.?\d*$/, message: '璇疯緭鍏ユ暟瀛�!' }]
-	// 	},
-	// 	renderComponentContent: () => {
-	// 		return {
-	// 			suffix: () => '鈩�',
-	// 		}
-	// 	},
-	// },
-	// {
-	// 	label: '鐜婀垮害',
-	// 	field: 'envHum',
-	// 	component: 'Input',
-	// 	dynamicRules: ({ model, schema }) => {
-	// 		return [{ required: false }, { pattern: /^-?\d+\.?\d*$/, message: '璇疯緭鍏ユ暟瀛�!' }]
-	// 	},
-	// 	renderComponentContent: () => {
-	// 		return {
-	// 			suffix: () => 'rh',
-	// 		}
-	// 	},
-	// },
+
 	{
-		label: '鑽℃枡寤舵椂',
-		field: 'delay',
-		component: 'Input',
-		dynamicRules: ({ model, schema }) => {
-			return [{ required: false }, { pattern: /^-?\d+\.?\d*$/, message: '璇疯緭鍏ユ暟瀛�!' }]
-		},
-		renderComponentContent: () => {
-			return {
-				suffix: () => 'ms',
-			}
-		},
+		label: '鍚敤缈绘枡绛栫暐',
+		field: 'strategy',
+    component: 'Switch',
+    defaultValue: false,
 	},
-	// {
-	// 	label: '缈绘枡娆℃暟',
-	// 	field: 'turn',
-	// 	component: 'Input',
-	// 	dynamicRules: ({ model, schema }) => {
-	// 		return [{ required: false }, { pattern: /^-?\d+\.?\d*$/, message: '璇疯緭鍏ユ暟瀛�!' }]
-	// 	},
-	// 	renderComponentContent: () => {
-	// 		return {
-	// 			suffix: () => '娆�',
-	// 		}
-	// 	},
-	// },
-  {
-    label: '鍚按鐜囪ˉ鍋�',
-    field: 'moisOffset',
-    component: 'Input',
-    dynamicRules: ({ model, schema }) => {
-      return [{ required: false }, { pattern: /^-?\d+\.?\d*$/, message: '璇疯緭鍏ユ暟瀛�!' }]
-    },
-    renderComponentContent: () => {
-      return {
-        suffix: () => '%',
-      }
-    },
-  },
   {
     label: '鍐烽鏃堕暱',
     field: 'coolingDuration',

--
Gitblit v1.9.3