Browse Source

fix: 小问题修复

master
guoapeng 1 month ago
parent
commit
3c9705d4f2
  1. 2
      src/apis/system.ts
  2. 7
      src/components/common/FTTable/index.vue
  3. 33
      src/components/craft/AddCraft/index.vue
  4. 29
      src/components/home/ExtractLiquid/index.vue
  5. 30
      src/components/home/SetTemperature/index.vue
  6. 9
      src/layouts/default.vue
  7. 1
      src/types/system.d.ts
  8. 5
      src/views/craft/index.vue
  9. 97
      src/views/home/index.vue
  10. 4
      src/views/taskLog/index.vue

2
src/apis/system.ts

@ -8,5 +8,5 @@ export const requireOutTray = (): Promise<{ moduleCode: string }[]> => http.get(
export const setIgnoreItem = (params: { ignoreSelfTestType: string, ignore: boolean }): Promise<null> => http.post('/self-test/set-ignore-item', params)
export const getTime = (): Promise<number> => http.get('/sys/datetime')
export const setTime = (params: { datetime?: string }): Promise<number> => http.post('/sys/datetime', params)
export const configList = (): Promise<number> => http.get('/sys/config-list')
export const configList = (): Promise<any[]> => http.get('/sys/config-list')
export const updateConfig = (params: System.SystemConfig): Promise<number> => http.post('/sys/update-config', params)

7
src/components/common/FTTable/index.vue

@ -30,6 +30,7 @@ const emits = defineEmits([
'editTreeNode',
'delTreeNode',
'rowClick',
'rowDblclick',
])
enum ColumnType {
index = 'index',
@ -107,10 +108,6 @@ function initData() {
const handleSelectionChange = (val: any) => {
state.selectedRows = val
}
const rowClickHandle = (data: any) => {
emits('rowClick', data)
}
defineExpose({
initData,
})
@ -155,8 +152,8 @@ defineExpose({
:highlight-current-row="true"
class="container-table"
header-row-class-name="header-row-class"
v-on="$attrs"
@selection-change="handleSelectionChange"
@row-click="rowClickHandle"
>
<template v-for="(column, index) in columns" :key="column.key">
<el-table-column

33
src/components/craft/AddCraft/index.vue

@ -2,11 +2,12 @@
import { getContainerList } from 'apis/container'
import { createCraft, updateCraft } from 'apis/crafts'
import { getSolsList } from 'apis/solution'
import { configList } from 'apis/system'
import emptyIcon from 'assets/images/empty.svg'
import { FtMessage } from 'libs/message'
import { allPropertiesDefined } from 'libs/utils'
import { cloneDeep } from 'lodash'
import { onMounted, ref } from 'vue'
import { computed, onMounted, ref } from 'vue'
const props = defineProps({
sourceData: {
@ -18,9 +19,12 @@ const emits = defineEmits(['ok', 'cancel'])
const containerList = ref<Container.ContainerItem[]>([])
const solutionList = ref<Solution.SolutionItem[]>([])
const configData = ref<any[]>([])
onMounted(async () => {
containerList.value = await getContainerList()
solutionList.value = (await getSolsList()).list
configData.value = await configList()
if (props.sourceData) {
form.value = { ...props.sourceData, stepList: JSON.parse(props.sourceData.steps || '[]') }
form.value.stepList.forEach((step: any) => {
@ -32,6 +36,20 @@ onMounted(async () => {
}
})
const heatMax = computed(() => {
return configData.value.find(item => item.code === 'heat_temperature')?.value || 0
})
const dryMax = computed(() => {
return configData.value.find(item => item.code === 'dry_temperature')?.value || 0
})
const annealMax = computed(() => {
return configData.value.find(item => item.code === 'anneal_temperature')?.value || 0
})
const heightMax = computed(() => {
return configData.value.find(item => item.code === 'needle_drop_height')?.value || 0
})
const form = ref({
stepList: [],
})
@ -57,14 +75,19 @@ const okHandle = async () => {
else {
step.params.time = undefined
}
if (step.params.temperature > 400 && step.method === 'anneal') {
errorMsg.push(`步骤${index + 1}: 退火温度不能超过400度`)
if (step.params.temperature > heatMax.value && step.method === 'anneal') {
errorMsg.push(`步骤${index + 1}: 退火温度不能超过${annealMax.value}`)
}
if (step.params.temperature > 200 && step.method === 'heat') {
errorMsg.push(`步骤${index + 1}: 加热温度不能超过200度`)
errorMsg.push(`步骤${index + 1}: 加热温度不能超过${heatMax.value}`)
}
if (step.params.temperature > 200 && step.method === 'dry') {
errorMsg.push(`步骤${index + 1}: 烘干温度不能超过200度`)
errorMsg.push(`步骤${index + 1}: 烘干温度不能超过${dryMax.value}`)
}
}
if (['clean', 'reduceLiquid'].includes(step.method)) {
if (step.params.height > heightMax.value) {
errorMsg.push(`步骤${index + 1}: 针头高度不能超过${heightMax.value}mm`)
}
}
step.params.description = `${index + 1}.`

29
src/components/home/ExtractLiquid/index.vue

@ -1,17 +1,21 @@
<script setup lang="ts">
import { getSolsList } from 'apis/solution'
import { configList } from 'apis/system'
import { socket } from 'libs/socket'
import { useHomeStore } from 'stores/homeStore'
import { useSystemStore } from 'stores/systemStore'
import { onMounted, onUnmounted, ref } from 'vue'
import { computed, onMounted, onUnmounted, ref } from 'vue'
const emits = defineEmits(['ok', 'cancel'])
const homeStore = useHomeStore()
const systemStore = useSystemStore()
onMounted(() => {
getSols()
const configData = ref<any[]>([])
onMounted(async () => {
await getSols()
configData.value = await configList()
socket.init(receiveMessage, 'cmd_debug')
socket.init(receiveMessage, 'cmd_response')
})
@ -21,6 +25,10 @@ onUnmounted(() => {
socket.unregisterCallback(receiveMessage, 'cmd_response')
})
const heightMax = computed(() => {
return configData.value.find(item => item.code === 'needle_drop_height')?.value || 0
})
let currentCommandId = ''
const receiveMessage = (data: Socket.cmdData) => {
data.commandId === currentCommandId && systemStore.pushSystemList(data)
@ -41,12 +49,25 @@ const validateHandle = (rule: any, value: any, callback: any) => {
}
}
const validateHandle1 = (rule: any, value: any, callback: any) => {
if (!value) {
callback(new Error('请输入高度'))
}
else
if (value && (value < 0 || value > heightMax.value)) {
callback(new Error(`针头高度范围0-${heightMax.value}mm`))
}
else {
callback()
}
}
const rules = {
columns: [
{ required: true, message: '请选择试管', trigger: 'change', validator: validateHandle },
],
height: [
{ required: true, message: '请输入下降高度', trigger: 'blur' },
{ required: true, trigger: 'blur', validator: validateHandle1 },
],
}

30
src/components/home/SetTemperature/index.vue

@ -1,13 +1,27 @@
<script setup lang="ts">
import { setTargetTemperature } from 'apis/home'
import { configList } from 'apis/system'
import { FtMessage } from 'libs/message'
import { useSystemStore } from 'stores/systemStore'
import { computed, inject, ref } from 'vue'
import { computed, inject, onMounted, ref } from 'vue'
const emits = defineEmits(['ok', 'cancel'])
const data = inject('currentTemperatureData')
console.log(data)
const configData = ref<any[]>([])
onMounted(async () => {
configData.value = await configList()
})
const heatMax = computed(() => {
return configData.value.find(item => item.code === 'heat_temperature')?.value || 0
})
const dryMax = computed(() => {
return configData.value.find(item => item.code === 'dry_temperature')?.value || 0
})
const annealMax = computed(() => {
return configData.value.find(item => item.code === 'anneal_temperature')?.value || 0
})
const heatModule = computed(() => {
return useSystemStore().systemStatus.heatModule.find(item => item.moduleCode === data.value.id)
@ -21,24 +35,24 @@ const form = ref({
const formRef = ref()
const validateHandle1 = (rule: any, value: any, callback: any) => {
if (value && (value < 50 || value > 120)) {
callback(new Error('加热温度设置范围50℃-120℃'))
if (value && (value < 0 || value > heatMax.value)) {
callback(new Error(`加热温度设置范围0℃-${heatMax.value}`))
}
else {
callback()
}
}
const validateHandle2 = (rule: any, value: any, callback: any) => {
if (value && (value < 50 || value > 135)) {
callback(new Error('烘干温度设置范围50℃-135℃'))
if (value && (value < 0 || value > dryMax.value)) {
callback(new Error(`烘干温度设置范围0℃-${dryMax.value}`))
}
else {
callback()
}
}
const validateHandle3 = (rule: any, value: any, callback: any) => {
if (value && (value < 200 || value > 400)) {
callback(new Error('退火温度设置范围200℃-400℃'))
if (value && (value < 0 || value > annealMax.value)) {
callback(new Error(`退火温度设置范围0℃-${annealMax.value}`))
}
else {
callback()

9
src/layouts/default.vue

@ -11,6 +11,7 @@ import Stop from 'components/system/Stop/index.vue'
import { ElMessageBox } from 'element-plus'
import { useActivateDebug } from 'hooks/useActivateDebug'
import { useServerTime } from 'hooks/useServerTime'
import { FtMessage } from 'libs/message'
import { isClose, socket } from 'libs/socket'
import { authRoutes } from 'router/routes'
import { useDebugStore } from 'stores/debugStore'
@ -26,14 +27,20 @@ const router = useRouter()
onMounted(() => {
socket.init(receiveMessage, 'alarm')
socket.init(receiveMessage1, 'warn')
})
onUnmounted(() => {
socket.unregisterCallback(receiveMessage, 'alarm')
socket.unregisterCallback(receiveMessage, 'warn')
})
let flag = false
const receiveMessage1 = (data: any) => {
FtMessage.warning(data)
}
const receiveMessage = async (data: any) => {
if (flag) {
return
@ -364,9 +371,11 @@ const containerStatus = computed(() => {
.time {
margin:0 10px;
height: 100%;
width: 170px;
padding: 0 10px;
display: flex;
align-items: center;
justify-content: center;
background: #fff;
border-radius: 5px;
}

1
src/types/system.d.ts

@ -27,6 +27,7 @@ declare namespace System {
currentTasks: Task.Task[] | null
doorModule: {
open: boolean
actionable?: boolean
}
transferModule: {
idle: boolean

5
src/views/craft/index.vue

@ -68,11 +68,14 @@ const add = () => {
sourceData.value = {}
addVisible.value = true
}
const a = (selectedRows: any) => {
console.log(selectedRows)
}
</script>
<template>
<div>
<FtTable ref="tableRef" has-header has-page :columns="columns" :btn-list="btnList" :get-data-fn="getCraftList" @add="add" @edit="edit" @del="del" />
<FtTable ref="tableRef" has-header has-page :columns="columns" :btn-list="btnList" :get-data-fn="getCraftList" @row-click="a" @add="add" @edit="edit" @del="del" />
<AddCraft v-if="addVisible" :source-data @ok="addVisible = false;tableRef?.initData()" @cancel="addVisible = false" />
</div>
</template>

97
src/views/home/index.vue

@ -155,6 +155,54 @@ const trayInHandle = async () => {
const checkCraftVisible = ref(false)
const moreVisible = ref(false)
const cleanHandle = async () => {
await ElMessageBox.confirm(
'请确认已把托盘放至上料位或移至加液位? ',
'提示',
{
confirmButtonText: '确认',
showClose: false,
closeOnClickModal: false,
closeOnPressEscape: false,
type: 'warning',
customClass: 'init-message',
},
)
cleanVisible.value = true
}
const addLiquidHandle = async () => {
await ElMessageBox.confirm(
'请确认已把托盘放至上料位或移至加液位? ',
'提示',
{
confirmButtonText: '确认',
showClose: false,
closeOnClickModal: false,
closeOnPressEscape: false,
type: 'warning',
customClass: 'init-message',
},
)
addLiquidVisible.value = true
}
const extractLiquidHandle = async () => {
await ElMessageBox.confirm(
'请确认已把托盘放至上料位或移至加液位? ',
'提示',
{
confirmButtonText: '确认',
showClose: false,
closeOnClickModal: false,
closeOnPressEscape: false,
type: 'warning',
customClass: 'init-message',
},
)
extractLiquidVisible.value = true
}
</script>
<template>
@ -173,13 +221,22 @@ const moreVisible = ref(false)
<el-col :span="24">
<div style="padding: 30px 0;display: grid; gap: 20px; grid-template-columns: repeat(4, 1fr);grid-template-rows: repeat(1, 1fr);height: 100%">
<el-card>
<ft-button type="primary" size="large" :click-handle="() => commandHandle('door_open')">
<ft-button type="primary" size="large" :disabled="!systemStore.systemStatus.doorModule.actionable" :click-handle="() => commandHandle('door_open')">
开门
</ft-button>
<ft-button type="primary" size="large" :click-handle="() => commandHandle('door_close')">
<ft-button type="primary" size="large" :disabled="systemStore.systemStatus.doorModule.actionable" :click-handle="() => commandHandle('door_close')">
关门
</ft-button>
</el-card>
<el-card>
<ft-button type="primary" size="large" :click-handle="trayInHandle">
放入托盘
</ft-button>
<ft-button type="primary" size="large" :click-handle="() => commandHandle('out_tray', { heatModuleCode: selectedHeatArea!.value })" :disabled="!selectedHeatArea">
取出托盘
</ft-button>
</el-card>
<el-card>
<ft-button type="primary" style="margin: auto 0;" class="manual-button" size="large" :click-handle="executeCraftHandle">
执行工艺
@ -192,14 +249,6 @@ const moreVisible = ref(false)
<!-- </ft-button> -->
</el-card>
<el-card>
<ft-button type="primary" size="large" :click-handle="trayInHandle">
放入托盘
</ft-button>
<ft-button type="primary" size="large" :click-handle="() => commandHandle('out_tray', { heatModuleCode: selectedHeatArea!.value })" :disabled="!selectedHeatArea">
取出托盘
</ft-button>
</el-card>
<el-card>
<el-popover
:visible="moreVisible"
placement="left-start"
@ -216,6 +265,13 @@ const moreVisible = ref(false)
<ft-button type="primary" size="large" :disabled="!selectedHeatArea" :click-handle="() => commandHandle('heater_start', { heatModuleCode: selectedHeatArea!.value })">
开始加热
</ft-button>
<ft-button type="primary" size="large" :disabled="!selectedHeatArea || selectedHeatArea?.label === '退火区'" :click-handle="() => commandHandle('dry_start', { heatModuleCode: selectedHeatArea!.value })">
开始烘干
</ft-button>
<ft-button type="primary" size="large" :disabled="!selectedHeatArea || selectedHeatArea?.label !== '退火区'" :click-handle="() => commandHandle('anneal_start', { heatModuleCode: selectedHeatArea!.value })">
开始退火
</ft-button>
<ft-button type="primary" size="large" :disabled="!selectedHeatArea" :click-handle="() => commandHandle('heater_stop', { heatModuleCode: selectedHeatArea!.value })">
停止加热
@ -229,21 +285,6 @@ const moreVisible = ref(false)
停止降温
</ft-button>
<ft-button type="primary" size="large" :disabled="!selectedHeatArea || selectedHeatArea?.label === '退火区'" :click-handle="() => commandHandle('dry_start', { heatModuleCode: selectedHeatArea!.value })">
开始烘干
</ft-button>
<ft-button type="primary" size="large" :disabled="!selectedHeatArea || selectedHeatArea?.label === '退火区'" :click-handle="() => commandHandle('dry_stop', { heatModuleCode: selectedHeatArea!.value })">
停止烘干
</ft-button>
<ft-button type="primary" size="large" :disabled="!selectedHeatArea || selectedHeatArea?.label !== '退火区'" :click-handle="() => commandHandle('anneal_start', { heatModuleCode: selectedHeatArea!.value })">
开始退火
</ft-button>
<ft-button type="primary" size="large" :disabled="!selectedHeatArea || selectedHeatArea?.label !== '退火区'" :click-handle="() => commandHandle('anneal_stop', { heatModuleCode: selectedHeatArea!.value })">
停止退火
</ft-button>
<ft-button type="primary" size="large" :click-handle="() => commandHandle('move_to_heat_area', { heatModuleCode: selectedHeatArea!.value })" :disabled="!selectedHeatArea">
移至加热位
</ft-button>
@ -257,7 +298,7 @@ const moreVisible = ref(false)
<ft-button type="primary" size="large" :click-handle="move_to_anneal_area">
移至退火位
</ft-button>
<ft-button type="primary" size="large" @click="cleanVisible = true">
<ft-button type="primary" size="large" @click="cleanHandle">
开始清洗
</ft-button>
@ -265,11 +306,11 @@ const moreVisible = ref(false)
预充管路
</ft-button>
<ft-button type="primary" size="large" @click="addLiquidVisible = true">
<ft-button type="primary" size="large" @click="addLiquidHandle">
添加溶液
</ft-button>
<ft-button type="primary" size="large" @click="extractLiquidVisible = true">
<ft-button type="primary" size="large" @click="extractLiquidHandle">
抽取溶液
</ft-button>
<ft-button type="primary" size="large" :click-handle="() => commandHandle('drain_liquid')">

4
src/views/taskLog/index.vue

@ -63,10 +63,6 @@ const del = async (selectedRows: any) => {
FtMessage.success('删除成功')
tableRef.value?.initData()
}
const rowClickHandle = (data: Task.Task) => {
console.log(data)
}
</script>
<template>

Loading…
Cancel
Save