8 changed files with 613 additions and 79 deletions
-
2src/apis/point.ts
-
128src/components/home/AddLiquid/index.vue
-
120src/components/home/CleanSolution/index.vue
-
120src/components/home/DrainSolution/index.vue
-
54src/components/home/DrainWasteSolution/index.vue
-
63src/components/home/FillSolution/index.vue
-
106src/components/home/SetTemperature/index.vue
-
99src/views/home/index.vue
@ -1,4 +1,4 @@ |
|||
import http from 'libs/http' |
|||
|
|||
export const getPointList = (): Promise<Point.Point[]> => http.get('/device-point/list') |
|||
export const getPointList = (): Promise<Point.Point[]> => http.post('/position/list') |
|||
export const updatePoint = (params: Point.UpdateParams): Promise<null> => http.put('/device-point', params) |
@ -0,0 +1,120 @@ |
|||
<script setup lang="ts"> |
|||
import { getSolsList } from 'apis/solution' |
|||
import { FtMessage } from 'libs/message' |
|||
import { useHomeStore } from 'stores/homeStore' |
|||
import { useSolutionStore } from 'stores/useSolutionStore' |
|||
import { onMounted, ref } from 'vue' |
|||
|
|||
const emits = defineEmits(['ok', 'close']) |
|||
|
|||
const homeStore = useHomeStore() |
|||
let currentCommandId = '' |
|||
onMounted(() => { |
|||
querySolutionList() |
|||
}) |
|||
const cancel = async () => { |
|||
currentCommandId = Date.now().toString() |
|||
// const params = { |
|||
// commandId: currentCommandId, |
|||
// command: 'liquid_motor_origin', |
|||
// params: {}, |
|||
// } |
|||
// await homeStore.sendControl(params) |
|||
emits('close') |
|||
} |
|||
|
|||
const solutionList = ref<Solution.SolutionItem[]>([]) |
|||
const solutionMap = ref<Record<string | number, string>>({}) |
|||
const solutionStore = useSolutionStore() |
|||
const querySolutionList = async () => { |
|||
const res = await getSolsList() |
|||
if (res && res.list) { |
|||
solutionList.value = res.list |
|||
solutionList.value.forEach((item) => { |
|||
if (item.id) { |
|||
solutionMap.value[item.id] = item.name |
|||
} |
|||
}) |
|||
solutionStore.updateSolution(res.list) |
|||
} |
|||
} |
|||
|
|||
const clean_solution_start = async () => { |
|||
if (!checked.value) { |
|||
FtMessage.warning('请选择清洗的管道') |
|||
return |
|||
} |
|||
currentCommandId = Date.now().toString() |
|||
const params = { |
|||
commandId: currentCommandId, |
|||
command: 'solution_clean_start', |
|||
params: { |
|||
solutionId: checked.value, |
|||
titrationModuleCode: titrationModuleCode.value, |
|||
}, |
|||
} |
|||
await homeStore.sendControl(params) |
|||
} |
|||
|
|||
const clean_solution_stop = async () => { |
|||
currentCommandId = Date.now().toString() |
|||
const params = { |
|||
commandId: currentCommandId, |
|||
command: 'solution_clean_stop', |
|||
params: { |
|||
solutionId: checked.value, |
|||
titrationModuleCode: titrationModuleCode.value, |
|||
}, |
|||
} |
|||
await homeStore.sendControl(params) |
|||
} |
|||
const titrationModuleCode = ref<string>('') |
|||
const checked = ref<number>() |
|||
</script> |
|||
|
|||
<template> |
|||
<FtDialog visible title="清洗管路" width="50%" :show-close="true" @cancel="cancel"> |
|||
<div class="module-box"> |
|||
<el-radio v-model="titrationModuleCode" label="滴定位1" size="large" value="MODULE_1" border /> |
|||
<el-radio v-model="titrationModuleCode" label="滴定位2" size="large" value="MODULE_2" border /> |
|||
</div> |
|||
<div class="item-box"> |
|||
<el-radio-group v-model="checked"> |
|||
<el-radio v-for="item in solutionList" :key="item.id" border :label="solutionMap[item.id]" :value="item.id" /> |
|||
</el-radio-group> |
|||
</div> |
|||
|
|||
<template #footer> |
|||
<ft-button type="primary" :click-handle="clean_solution_start"> |
|||
开始清洗 |
|||
</ft-button> |
|||
<ft-button type="default" :click-handle="clean_solution_stop"> |
|||
停止清洗 |
|||
</ft-button> |
|||
</template> |
|||
</FtDialog> |
|||
</template> |
|||
|
|||
<style scoped lang="scss"> |
|||
.module-box { |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: flex-start; |
|||
padding: 5px; |
|||
} |
|||
.item-box { |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: space-between; |
|||
padding: 5px; |
|||
} |
|||
.el-checkbox { |
|||
margin: 10px 5px; |
|||
min-width: 100px; |
|||
} |
|||
.button-box { |
|||
margin-top: 10px; |
|||
display: flex; |
|||
justify-content: center; |
|||
} |
|||
</style> |
@ -0,0 +1,120 @@ |
|||
<script setup lang="ts"> |
|||
import { getSolsList } from 'apis/solution' |
|||
import { FtMessage } from 'libs/message' |
|||
import { useHomeStore } from 'stores/homeStore' |
|||
import { useSolutionStore } from 'stores/useSolutionStore' |
|||
import { onMounted, ref } from 'vue' |
|||
|
|||
const emits = defineEmits(['ok', 'close']) |
|||
|
|||
const homeStore = useHomeStore() |
|||
let currentCommandId = '' |
|||
onMounted(() => { |
|||
querySolutionList() |
|||
}) |
|||
const cancel = async () => { |
|||
currentCommandId = Date.now().toString() |
|||
// const params = { |
|||
// commandId: currentCommandId, |
|||
// command: 'liquid_motor_origin', |
|||
// params: {}, |
|||
// } |
|||
// await homeStore.sendControl(params) |
|||
emits('close') |
|||
} |
|||
|
|||
const solutionList = ref<Solution.SolutionItem[]>([]) |
|||
const solutionMap = ref<Record<string | number, string>>({}) |
|||
const solutionStore = useSolutionStore() |
|||
const querySolutionList = async () => { |
|||
const res = await getSolsList() |
|||
if (res && res.list) { |
|||
solutionList.value = res.list |
|||
solutionList.value.forEach((item) => { |
|||
if (item.id) { |
|||
solutionMap.value[item.id] = item.name |
|||
} |
|||
}) |
|||
solutionStore.updateSolution(res.list) |
|||
} |
|||
} |
|||
|
|||
const filled_solution_start = async () => { |
|||
if (!checked.value) { |
|||
FtMessage.warning('请选择要排空的管道') |
|||
return |
|||
} |
|||
currentCommandId = Date.now().toString() |
|||
const params = { |
|||
commandId: currentCommandId, |
|||
command: 'solution_drain_start', |
|||
params: { |
|||
solutionId: checked.value, |
|||
titrationModuleCode: titrationModuleCode.value, |
|||
}, |
|||
} |
|||
await homeStore.sendControl(params) |
|||
} |
|||
|
|||
const filled_solution_stop = async () => { |
|||
currentCommandId = Date.now().toString() |
|||
const params = { |
|||
commandId: currentCommandId, |
|||
command: 'solution_drain_stop', |
|||
params: { |
|||
solutionId: checked.value, |
|||
titrationModuleCode: titrationModuleCode.value, |
|||
}, |
|||
} |
|||
await homeStore.sendControl(params) |
|||
} |
|||
const titrationModuleCode = ref<string>('') |
|||
const checked = ref<number>() |
|||
</script> |
|||
|
|||
<template> |
|||
<FtDialog visible title="排空管路" width="50%" :show-close="true" @cancel="cancel"> |
|||
<div class="module-box"> |
|||
<el-radio v-model="titrationModuleCode" label="滴定位1" size="large" value="MODULE_1" border /> |
|||
<el-radio v-model="titrationModuleCode" label="滴定位2" size="large" value="MODULE_2" border /> |
|||
</div> |
|||
<div class="item-box"> |
|||
<el-radio-group v-model="checked"> |
|||
<el-radio v-for="item in solutionList" :key="item.id" border :label="solutionMap[item.id]" :value="item.id" /> |
|||
</el-radio-group> |
|||
</div> |
|||
|
|||
<template #footer> |
|||
<ft-button type="primary" :click-handle="filled_solution_start"> |
|||
开始排空 |
|||
</ft-button> |
|||
<ft-button type="default" :click-handle="filled_solution_stop"> |
|||
停止排空 |
|||
</ft-button> |
|||
</template> |
|||
</FtDialog> |
|||
</template> |
|||
|
|||
<style scoped lang="scss"> |
|||
.module-box { |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: flex-start; |
|||
padding: 5px; |
|||
} |
|||
.item-box { |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: space-between; |
|||
padding: 5px; |
|||
} |
|||
.el-checkbox { |
|||
margin: 10px 5px; |
|||
min-width: 100px; |
|||
} |
|||
.button-box { |
|||
margin-top: 10px; |
|||
display: flex; |
|||
justify-content: center; |
|||
} |
|||
</style> |
@ -0,0 +1,54 @@ |
|||
<script setup lang="ts"> |
|||
import { getSolsList } from 'apis/solution' |
|||
import { FtMessage } from 'libs/message' |
|||
import { useHomeStore } from 'stores/homeStore' |
|||
import { useSolutionStore } from 'stores/useSolutionStore' |
|||
import { onMounted, ref } from 'vue' |
|||
|
|||
const emits = defineEmits(['ok', 'close']) |
|||
|
|||
const homeStore = useHomeStore() |
|||
let currentCommandId = '' |
|||
onMounted(() => { |
|||
}) |
|||
const cancel = async () => { |
|||
emits('close') |
|||
} |
|||
const drain_waste_solution_start = async () => { |
|||
currentCommandId = Date.now().toString() |
|||
const params = { |
|||
commandId: currentCommandId, |
|||
command: 'solution_waste_drain_start', |
|||
params: { |
|||
}, |
|||
} |
|||
await homeStore.sendControl(params) |
|||
} |
|||
|
|||
const drain_waste_solution_stop = async () => { |
|||
currentCommandId = Date.now().toString() |
|||
const params = { |
|||
commandId: currentCommandId, |
|||
command: 'solution_waste_drain_stop', |
|||
params: { |
|||
}, |
|||
} |
|||
await homeStore.sendControl(params) |
|||
} |
|||
</script> |
|||
|
|||
<template> |
|||
<FtDialog visible title="抽取废液" width="50%" :show-close="true" @cancel="cancel"> |
|||
<template #footer> |
|||
<ft-button type="primary" :click-handle="drain_waste_solution_start"> |
|||
开始抽液 |
|||
</ft-button> |
|||
<ft-button type="default" :click-handle="drain_waste_solution_stop"> |
|||
停止抽液 |
|||
</ft-button> |
|||
</template> |
|||
</FtDialog> |
|||
</template> |
|||
|
|||
<style scoped lang="scss"> |
|||
</style> |
@ -0,0 +1,106 @@ |
|||
<script setup lang="ts"> |
|||
import { configList } from 'apis/system' |
|||
import { FtMessage } from 'libs/message' |
|||
import { useHomeStore } from 'stores/homeStore' |
|||
import { useSystemStore } from 'stores/systemStore' |
|||
import { computed, onMounted, ref } from 'vue' |
|||
|
|||
const props = defineProps({ |
|||
heatModuleCode: { |
|||
type: String, |
|||
required: true, |
|||
}, |
|||
}) |
|||
const emits = defineEmits(['ok', 'cancel']) |
|||
const homeStore = useHomeStore() |
|||
const configData = ref<any[]>([]) |
|||
onMounted(async () => { |
|||
configData.value = await configList() |
|||
}) |
|||
|
|||
const heatMax = computed(() => { |
|||
return configData.value.find(item => item.code === 'heat_temperature')?.value || 100 |
|||
}) |
|||
const heatModule = computed(() => { |
|||
return useSystemStore().systemStatus.heatModule.find(item => item.moduleCode === props.heatModuleCode) |
|||
}) |
|||
|
|||
const form = ref({ |
|||
heatTemperature: heatModule.value?.heatTemperature, |
|||
}) |
|||
const formRef = ref() |
|||
|
|||
const validateHandle = (rule: any, value: any, callback: any) => { |
|||
if (value && (value < 0 || +value > +heatMax.value)) { |
|||
callback(new Error(`加热温度设置范围0℃-${heatMax.value}℃`)) |
|||
} |
|||
else { |
|||
callback() |
|||
} |
|||
} |
|||
|
|||
const rules = { |
|||
heatTemperature: [ |
|||
{ required: false, trigger: 'blur', validator: validateHandle }, |
|||
], |
|||
} |
|||
let currentCommandId = '' |
|||
const heatStart = async () => { |
|||
const valid = await formRef.value.validate() |
|||
if (!valid) { |
|||
return |
|||
} |
|||
currentCommandId = Date.now().toString() |
|||
const params = { |
|||
commandId: currentCommandId, |
|||
command: 'heater_start', |
|||
params: { |
|||
heatModuleCode: props.heatModuleCode, |
|||
temperature: form.value.heatTemperature, |
|||
}, |
|||
} |
|||
await homeStore.sendControl(params) |
|||
} |
|||
const heatStop = async () => { |
|||
currentCommandId = Date.now().toString() |
|||
const params = { |
|||
commandId: currentCommandId, |
|||
command: 'heater_stop', |
|||
params: { |
|||
heatModuleCode: props.heatModuleCode, |
|||
}, |
|||
} |
|||
await homeStore.sendControl(params) |
|||
} |
|||
const cancel = () => { |
|||
emits('cancel') |
|||
} |
|||
</script> |
|||
|
|||
<template> |
|||
<FtDialog visible :title="`${props.heatModuleCode === 'MODULE_1' ? '加热区1' : '加热区2'}设置目标温度`" width="40%" :show-close="true" @cancel="cancel"> |
|||
<el-form ref="formRef" label-width="auto" :model="form" :rules="rules"> |
|||
<el-form-item label="加热温度" prop="heatTemperature"> |
|||
<el-input v-model="form.heatTemperature" type="number" placeholder="请输入加热温度"> |
|||
<template #append> |
|||
℃ |
|||
</template> |
|||
</el-input> |
|||
</el-form-item> |
|||
</el-form> |
|||
<template #footer> |
|||
<el-button type="primary" @click="heatStart"> |
|||
开始加热 |
|||
</el-button> |
|||
<el-button @click="heatStop"> |
|||
停止加热 |
|||
</el-button> |
|||
</template> |
|||
</FtDialog> |
|||
</template> |
|||
|
|||
<style scoped lang="scss"> |
|||
.el-tag { |
|||
margin-right: 5px; |
|||
} |
|||
</style> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue