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 |  255 +++++++++++++++++++++++++++++++++-----------------
 1 files changed, 168 insertions(+), 87 deletions(-)

diff --git a/src/views/dry/dataDefine/DryHerbFormula.data.ts b/src/views/dry/dataDefine/DryHerbFormula.data.ts
index 2cd5ccd..6ff3611 100644
--- a/src/views/dry/dataDefine/DryHerbFormula.data.ts
+++ b/src/views/dry/dataDefine/DryHerbFormula.data.ts
@@ -1,4 +1,8 @@
 import { BasicColumn, FormSchema } from '/@/components/Table'
+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[] = [
 	{
@@ -6,16 +10,48 @@
 		align: 'center',
 		dataIndex: 'herbId_dictText',
 	},
-	// {
-	// 	title: '鑽潗鍚嶇О',
-	// 	align: 'center',
-	// 	dataIndex: 'herbName',
-	// },
+	{
+		title: '閰嶆柟鍚嶇О',
+		align: 'center',
+		dataIndex: 'name',
+	},
 	{
 		title: '閫傜敤璁惧',
 		align: 'center',
 		dataIndex: 'eqpType_dictText',
 	},
+  {
+    title: '缂╁啓',
+    align: 'center',
+    dataIndex: 'abbr',
+  },
+  {
+    title: '鐗圭鐗╂枡',
+    align: 'center',
+    dataIndex: 'special',
+    customRender: ({ text }) => {
+      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: '鐩爣鍚按鐜�',
 		align: 'center',
@@ -36,31 +72,30 @@
 		align: 'center',
 		dataIndex: 'windTemp',
 	},
+  {
+    title: '椋庢満鍒濆棰戠巼',
+    align: 'center',
+    dataIndex: 'fanSpeed',
+  },
+
 	{
-		title: '鐜娓╁害',
+		title: '鍚敤缈绘枡绛栫暐',
 		align: 'center',
-		dataIndex: 'envTemp',
+		dataIndex: 'strategy',
+    customRender: ({ text }) => {
+      return render.renderSwitch(text, [
+        { text: '鏄�', value: 'true' },
+        { text: '鍚�', value: 'false' },
+      ])
+    },
 	},
-	{
-		title: '鐜婀垮害',
-		align: 'center',
-		dataIndex: 'envHum',
-	},
-	{
-		title: '鑽℃枡寤舵椂ms',
-		align: 'center',
-		dataIndex: 'delay',
-	},
-	{
-		title: '缈绘枡娆℃暟',
-		align: 'center',
-		dataIndex: 'turn',
-	},
-	// {
-	// 	title: '绉熸埛id',
-	// 	align: 'center',
-	// 	dataIndex: 'tenantId',
-	// },
+
+  {
+    title: '鍐烽鏃堕暱',
+    align: 'center',
+    dataIndex: 'coolingDuration',
+  },
+
 ]
 //鏌ヨ鏁版嵁
 export const searchFormSchema: FormSchema[] = [
@@ -69,7 +104,7 @@
 		field: 'herbId',
 		component: 'JSearchSelect',
 		componentProps: {
-			dict: 'dry_herb,name,id',
+			dict: 'dry_herb_info,name,id',
 		},
 		colProps: { span: 6 },
 	},
@@ -80,29 +115,94 @@
 		label: '鑽潗',
 		field: 'herbId',
 		component: 'JSearchSelect',
-		componentProps: {
-			dict: 'dry_herb,name,id',
+		componentProps: ({formModel})=>{
+      return {
+        dict: 'dry_herb_info,name,id',
+        onChange: e => {
+          let param = {
+            id: e,
+          }
+          queryById(param).then(res => {
+            formModel.name = res.name
+            if (res.name) {
+              const abbr = getFirstWordSpell(res.name);
+              formModel.abbr = abbr.toUpperCase();
+            } else {
+              formModel.abbr = '';
+            }
+          })
+        },
+      }
 		},
 		dynamicRules: ({ model, schema }) => {
 			return [{ required: true, message: '璇烽�夋嫨鑽潗!' }]
 		},
 	},
-	// {
-	// 	label: '鑽潗鍚嶇О',
-	// 	field: 'herbName',
-	// 	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: '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: () => '%',
+      }
+    },
+  },
 	{
 		label: '鐩爣鍚按鐜�',
 		field: 'target',
@@ -155,58 +255,39 @@
 			}
 		},
 	},
+  {
+    label: '椋庢満鍒濆棰戠巼',
+    field: 'fanSpeed',
+    component: 'Input',
+    dynamicRules: ({ model, schema }) => {
+      return [{ required: false }, { pattern: /^-?\d+\.?\d*$/, message: '璇疯緭鍏ユ暟瀛�!' }]
+    },
+    renderComponentContent: () => {
+      return {
+        suffix: () => 'Hz',
+      }
+    },
+  },
+
 	{
-		label: '鐜娓╁害',
-		field: 'envTemp',
-		component: 'Input',
-		dynamicRules: ({ model, schema }) => {
-			return [{ required: false }, { pattern: /^-?\d+\.?\d*$/, message: '璇疯緭鍏ユ暟瀛�!' }]
-		},
-		renderComponentContent: () => {
-			return {
-				suffix: () => '鈩�',
-			}
-		},
+		label: '鍚敤缈绘枡绛栫暐',
+		field: 'strategy',
+    component: 'Switch',
+    defaultValue: false,
 	},
-	{
-		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: 'turn',
-		component: 'Input',
-		dynamicRules: ({ model, schema }) => {
-			return [{ required: false }, { pattern: /^-?\d+\.?\d*$/, message: '璇疯緭鍏ユ暟瀛�!' }]
-		},
-		renderComponentContent: () => {
-			return {
-				suffix: () => '娆�',
-			}
-		},
-	},
+  {
+    label: '鍐烽鏃堕暱',
+    field: 'coolingDuration',
+    component: 'Input',
+    dynamicRules: ({ model, schema }) => {
+      return [{ required: false }, { pattern: /^-?\d+\.?\d*$/, message: '璇疯緭鍏ユ暟瀛�!' }]
+    },
+    renderComponentContent: () => {
+      return {
+        suffix: () => 'min',
+      }
+    },
+  },
 	// TODO 涓婚敭闅愯棌瀛楁锛岀洰鍓嶅啓姝讳负ID
 	{
 		label: '',

--
Gitblit v1.9.3