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