diff --git a/src/api/admin/enum-contracts.ts b/src/api/admin/enum-contracts.ts
index 3203534..ee16265 100644
--- a/src/api/admin/enum-contracts.ts
+++ b/src/api/admin/enum-contracts.ts
@@ -136,3 +136,13 @@ export const EnumFeedingType = {
Percentage: { name: 'Percentage', value: 1, desc: '百分比' },
Volume: { name: 'Volume', value: 2, desc: '体积' },
}
+
+export const EnumFeedingOperator = {
+ LessThan: { name: '<', value: 1, desc: '<' },
+ GreaterThan: { name: '<=', value: 2, desc: '<=' },
+}
+
+export const EnumFeedingCalculationMode = {
+ Add: { name: '残糖', value: 1, desc: '残糖' },
+ Subtract: { name: '残糖和乳酸', value: 3, desc: '残糖和乳酸' },
+}
diff --git a/src/views/admin/template/components/culture-protocol-form.vue b/src/views/admin/template/components/culture-protocol-form.vue
index c0a15b5..1ed6ec4 100644
--- a/src/views/admin/template/components/culture-protocol-form.vue
+++ b/src/views/admin/template/components/culture-protocol-form.vue
@@ -116,17 +116,24 @@
:label="`${pump.feedingPumpName}${pump.mediumName ? ' / ' + pump.mediumName : ''}`"
:name="String(pump.feedingPumpNo)">
- 添加任务
+ 添加任务
-
-
-
-
+
@@ -135,10 +142,15 @@
header-align="center">
-
+
-
-
+
+
+
+
@@ -150,12 +162,16 @@
-
+
-
-
+
+
+
+
@@ -166,12 +182,15 @@
header-align="center">
-
-
-
+
+
+
+
@@ -197,41 +216,74 @@
@@ -258,7 +310,7 @@ import { UspFeedingConfigApi } from '/@/api/admin/UspFeedingConfigApi'
import type { CultureProtocolDto } from '/@/api/types/cultureprotocol'
import { ElMessageBox, ElMessage } from 'element-plus'
import { toOptionsByValue } from '/@/utils/enum'
-import { EnumFeedingType } from '/@/api/admin/enum-contracts'
+import { EnumFeedingType, EnumFeedingOperator, EnumFeedingCalculationMode } from '/@/api/admin/enum-contracts'
import { DocumentCopy, Plus } from '@element-plus/icons-vue'
const { proxy } = getCurrentInstance() as any
@@ -303,7 +355,9 @@ const state = reactive({
cellTypeOptions: [],
configOptions: [] as Array<{ id: number; name: string; isTwo: number; }>,
selectedReactor: null as any,
- feedingTypeOptions: toOptionsByValue(EnumFeedingType)
+ feedingTypeOptions: toOptionsByValue(EnumFeedingType),
+ feedingOperatorOptions: toOptionsByValue(EnumFeedingOperator),
+ feedingCalculationModeOptions: toOptionsByValue(EnumFeedingCalculationMode)
})
const { form } = toRefs(state)
@@ -325,6 +379,11 @@ const feedingPumpTabs = computed(() => {
})
})
+// 添加判断是否存在糖补料的计算属性
+const hasGlucosePump = computed(() => {
+ return state.form.fixedFeedingPumps.some(pump => pump.isGlucose)
+})
+
watch(
() => feedingPumpTabs.value,
(tabs) => {
@@ -481,7 +540,7 @@ const addRule = () => {
lowerLimit: 0,
feedingTo: 0,
lowerLimitOperator: '',
- calculationMode: 0
+ calculationMode: 1
})
}
@@ -499,11 +558,14 @@ const handleTabClick = async (tab: any, event: any) => {
activeTab.value = lastActiveTab.value
return
}
-
- // 检查液体选择是否正确
-
lastActiveTab.value = tab.paneName
-
+ }
+ else if (lastActiveTab.value == 'glucose') {
+ if (!checkGlucose()) {
+ await nextTick()
+ activeTab.value = lastActiveTab.value
+ return
+ }
}
else {
lastActiveTab.value = tab.paneName
@@ -539,6 +601,29 @@ const checkPumps = () => {
return valid
}
+const checkGlucose = () => {
+ let valid = true
+ state.form.autoGlucoseFeedingRules.forEach(rule => {
+ if (rule.cultureDayStarting > rule.cultureDayEnding) {
+ valid = false
+ proxy.$modal.msgError('培养天数(开始)不能大于培养天数(结束)')
+ }
+ })
+
+ // 校验培养天数 (开始)和培养天数 (结束)是否存在重叠
+ const rules = state.form.autoGlucoseFeedingRules
+ for (let i = 0; i < rules.length; i++) {
+ for (let j = i + 1; j < rules.length; j++) {
+ if (rules[i].cultureDayStarting < rules[j].cultureDayEnding && rules[i].cultureDayEnding > rules[j].cultureDayStarting) {
+ valid = false
+ proxy.$modal.msgError('培养天数(开始)和培养天数(结束)存在重叠')
+ }
+ return valid
+ }
+ }
+ return valid
+}
+
// 提交表单
const onSure = async () => {
if (!formRef.value) return
diff --git a/页面开发数据模板.md b/页面开发数据模板.md
deleted file mode 100644
index 889fb6d..0000000
--- a/页面开发数据模板.md
+++ /dev/null
@@ -1,207 +0,0 @@
-# 页面开发指南
-
-## 路由配置
-1. 路由参数
- ```typescript
- // 路由定义
- {
- path: '/admin/device',
- name: 'admin/device',
- component: () => import('/@/views/admin/device/index.vue'),
- meta: {
- title: '设备管理',
- icon: 'ele-Setting',
- roles: ['admin']
- }
- }
- ```
-
-2. 权限控制
- ```typescript
- // 按钮权限
- v-auth="'api:admin:device:add'" // 新增权限
- v-auth="'api:admin:device:update'" // 修改权限
- v-auth="'api:admin:device:soft-delete'" // 删除权限
- ```
-
-## 数据结构
-1. 列表查询参数
- ```typescript
- interface PageInput {
- currentPage: number
- pageSize: number
- filter: {
- keyWord?: string
- startTime?: string
- endTime?: string
- }
- }
- ```
-
-2. 表单数据结构
- ```typescript
- interface FormData {
- id?: number
- deviceNo: string
- assetNo?: string
- ip: string
- port: string
- serviceName?: string
- status: boolean
- }
- ```
-
-3. API 接口
- ```typescript
- // 列表接口
- GET /api/admin/device/get-page
-
- // 详情接口
- GET /api/admin/device/get
-
- // 新增接口
- POST /api/admin/device/add
-
- // 修改接口
- PUT /api/admin/device/update
-
- // 删除接口
- DELETE /api/admin/device/soft-delete
- ```
-
-## 页面结构
-1. 列表页面
- - 搜索区域:关键词搜索
- - 操作按钮:新增、查询
- - 表格区域:基础字段展示
- - 分页区域:标准分页组件
-
-2. 编辑页面
- - 基本信息模块
- - 网络配置模块
- - 设备配置模块
-
-## 样式规范
-1. 对话框配置
- ```html
-
- ```
-
-2. 表单布局
- ```html
-
-
-
- ```
-
-3. 样式定义
- ```scss
- .form-section {
- margin-bottom: 24px;
- &:last-child { margin-bottom: 0; }
- }
-
- .section-title {
- font-size: 16px;
- font-weight: 600;
- color: #303133;
- margin-bottom: 16px;
- padding-bottom: 8px;
- border-bottom: 2px solid #f0f0f0;
- position: relative;
- &:before {
- content: '';
- position: absolute;
- left: 0;
- bottom: -2px;
- width: 40px;
- height: 2px;
- background: #409eff;
- }
- }
- ```
-
-## 开发规范
-1. 组件命名
- - 目录:小写字母,用横线分隔
- - 组件:PascalCase
- - 组合函数:camelCase
-
-2. 代码组织
- ```typescript
- // 1. 导入声明
- import { reactive, ref } from 'vue'
-
- // 2. 类型定义
- interface State {
- showDialog: boolean
- form: FormData
- }
-
- // 3. 组件定义
- const props = defineProps({
- title: String
- })
-
- // 4. 状态定义
- const state = reactive({
- showDialog: false,
- form: {}
- })
-
- // 5. 方法定义
- const handleSubmit = async () => {
- // 处理逻辑
- }
- ```
-
-3. 表单验证
- ```typescript
- const rules = {
- fieldName: [
- { required: true, message: '请输入', trigger: ['blur', 'change'] }
- ]
- }
- ```
-
-4. API 调用
- ```typescript
- const handleSave = async () => {
- try {
- const res = await api.save(state.form)
- if (res.success) {
- ElMessage.success('保存成功')
- emit('refresh')
- state.showDialog = false
- }
- } catch (error) {
- console.error(error)
- }
- }
- ```
-
-## 注意事项
-1. 保持与 uspscale 页面风格一致
-2. 使用响应式布局适配不同屏幕
-3. 统一表单验证规则和错误提示
-4. 优化用户交互体验
-5. 保持代码风格统一
-6. 注意性能优化
-7. 遵循 TypeScript 类型规范
\ No newline at end of file