|
@ -1,34 +1,89 @@ |
|
|
<script lang="ts" setup> |
|
|
<script lang="ts" setup> |
|
|
|
|
|
import { updateContainer } from '@/apis/container' |
|
|
import { useSolutionStore } from '@/stores/useSolutionStore' |
|
|
import { useSolutionStore } from '@/stores/useSolutionStore' |
|
|
import { Edit } from '@element-plus/icons-vue' |
|
|
|
|
|
import { ref } from 'vue' |
|
|
|
|
|
|
|
|
import { Edit, Plus } from '@element-plus/icons-vue' |
|
|
|
|
|
import { ElMessage } from 'element-plus' |
|
|
|
|
|
import { computed, ref } from 'vue' |
|
|
|
|
|
import { useRouter } from 'vue-router' |
|
|
|
|
|
|
|
|
defineProps({ |
|
|
|
|
|
|
|
|
const props = defineProps({ |
|
|
itemIndex: { |
|
|
itemIndex: { |
|
|
type: Number, |
|
|
type: Number, |
|
|
required: true, |
|
|
required: true, |
|
|
}, |
|
|
}, |
|
|
itemName: { |
|
|
|
|
|
type: String, |
|
|
|
|
|
required: true, |
|
|
|
|
|
}, |
|
|
|
|
|
itemVolume: { |
|
|
|
|
|
type: Number, |
|
|
|
|
|
required: true, |
|
|
|
|
|
}, |
|
|
|
|
|
itemChecked: { |
|
|
|
|
|
type: Boolean, |
|
|
|
|
|
required: true, |
|
|
|
|
|
|
|
|
solutionItem: { |
|
|
|
|
|
type: Object, |
|
|
|
|
|
default: () => {}, |
|
|
}, |
|
|
}, |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
const solutionType = ref() |
|
|
|
|
|
|
|
|
const emits = defineEmits<{ |
|
|
|
|
|
(e: 'ok'): void |
|
|
|
|
|
}>() |
|
|
|
|
|
|
|
|
|
|
|
const router = useRouter() |
|
|
|
|
|
const visible = ref(false) |
|
|
const solutionStore = useSolutionStore() |
|
|
const solutionStore = useSolutionStore() |
|
|
const liquidTotal = ref() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const solutionId = ref() |
|
|
|
|
|
const selectedSolutionItem = ref() |
|
|
|
|
|
const solutionInfo = ref(props.solutionItem) |
|
|
|
|
|
const solutionProcess = computed(() => { |
|
|
|
|
|
const difference = solutionInfo.value.capacityUsed / solutionInfo.value.capacityTotal |
|
|
|
|
|
const percent = 100 - (difference * 100) |
|
|
|
|
|
return percent |
|
|
|
|
|
}) |
|
|
const onInputBlur = (e: any) => { |
|
|
const onInputBlur = (e: any) => { |
|
|
console.log('ee====', e.targe.value) |
|
|
|
|
|
|
|
|
solutionInfo.value.capacityUsed = e.target.value |
|
|
|
|
|
saveContainer() |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const onSelectSolution = () => { |
|
|
|
|
|
visible.value = true |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const saveContainer = () => { |
|
|
|
|
|
if (!solutionInfo.value.capacityUsed) { |
|
|
|
|
|
ElMessage.warning('请输入酸液体积') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
if (!solutionInfo.value.solutionId) { |
|
|
|
|
|
ElMessage.warning('请选择酸液') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
const params: Container.ContainerItem = { |
|
|
|
|
|
id: solutionInfo.value.id, |
|
|
|
|
|
type: 0, |
|
|
|
|
|
solutionId: solutionInfo.value.solutionId, |
|
|
|
|
|
pumpId: solutionInfo.value.pumpId, |
|
|
|
|
|
capacityTotal: solutionInfo.value.capacityTotal, |
|
|
|
|
|
capacityUsed: solutionInfo.value.capacityUsed, |
|
|
|
|
|
} |
|
|
|
|
|
updateContainer(params).then(() => { |
|
|
|
|
|
ElMessage.success('保存成功') |
|
|
|
|
|
emits('ok') |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
const onSolutionChange = (value: number) => { |
|
|
|
|
|
if (value) { |
|
|
|
|
|
solutionId.value = value |
|
|
|
|
|
solutionInfo.value.solutionId = value |
|
|
|
|
|
selectedSolutionItem.value = solutionStore.solutionList.filter(item => item.id === value)[0] |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
const onClose = () => { |
|
|
|
|
|
solutionId.value = null |
|
|
|
|
|
visible.value = false |
|
|
|
|
|
} |
|
|
|
|
|
const onSubmitSolution = () => { |
|
|
|
|
|
if (!solutionStore.solutionList.length) { |
|
|
|
|
|
// 跳转至配置酸液页面 |
|
|
|
|
|
router.push('/solution') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
solutionInfo.value.solutionName = selectedSolutionItem.value.name |
|
|
|
|
|
solutionInfo.value.solutionId = selectedSolutionItem.value.id |
|
|
|
|
|
saveContainer() |
|
|
|
|
|
onClose() |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
@ -36,10 +91,14 @@ const onInputBlur = (e: any) => { |
|
|
<div class="liquied-item"> |
|
|
<div class="liquied-item"> |
|
|
<div class="header"> |
|
|
<div class="header"> |
|
|
<div>{{ itemIndex + 1 }}</div> |
|
|
<div>{{ itemIndex + 1 }}</div> |
|
|
<div style="margin-left: 5px;"> |
|
|
|
|
|
<el-select v-model="solutionType" size="small" placeholder="请选择" style="width: 100px; " class="right-base"> |
|
|
|
|
|
<el-option v-for="item in solutionStore.solutionList" :key="item.id" :label="item.name" :value="item.id" /> |
|
|
|
|
|
</el-select> |
|
|
|
|
|
|
|
|
<div class="solution-select"> |
|
|
|
|
|
<div class="solution-name"> |
|
|
|
|
|
<span v-if="solutionInfo.solutionName">{{ solutionInfo.solutionName }}</span> |
|
|
|
|
|
<span v-else style="color:#d2d2d2">选择酸液</span> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="add-icon"> |
|
|
|
|
|
<el-button :icon="Plus" class="button-icon" @click="onSelectSolution" /> |
|
|
|
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div style="height:9.5rem"> |
|
|
<div style="height:9.5rem"> |
|
@ -48,7 +107,7 @@ const onInputBlur = (e: any) => { |
|
|
<div class="bottle_base"> |
|
|
<div class="bottle_base"> |
|
|
<img class="content-img" src="@/assets/images/liquied/liquied_bottle.svg" alt="chemical-bottle"> |
|
|
<img class="content-img" src="@/assets/images/liquied/liquied_bottle.svg" alt="chemical-bottle"> |
|
|
</div> |
|
|
</div> |
|
|
<div class="bottle"> |
|
|
|
|
|
|
|
|
<div class="bottle" :style="{ mask: `linear-gradient(to bottom, transparent ${solutionProcess}%, rgb(38, 219, 50))` }"> |
|
|
<img class="content-img" src="@/assets/images/liquied/liquied_bottle.svg" alt="chemical-bottle"> |
|
|
<img class="content-img" src="@/assets/images/liquied/liquied_bottle.svg" alt="chemical-bottle"> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
@ -56,12 +115,36 @@ const onInputBlur = (e: any) => { |
|
|
</div> |
|
|
</div> |
|
|
<div class="footer"> |
|
|
<div class="footer"> |
|
|
<div class="footer-content"> |
|
|
<div class="footer-content"> |
|
|
<span>{{ itemVolume }}ml</span> |
|
|
|
|
|
|
|
|
<span>{{ solutionInfo.capacityTotal }}ml</span> |
|
|
</div> |
|
|
</div> |
|
|
<div class="footer-edit"> |
|
|
<div class="footer-edit"> |
|
|
<el-input :prefix-icon="Edit" @blur="onInputBlur" v-model="liquidTotal" style="width: 100px;" size="small" />ml |
|
|
|
|
|
|
|
|
<el-input v-model="solutionInfo.capacityUsed" style="width: 100px;" size="small" :prefix-icon="Edit" @blur="onInputBlur" />ml |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<FtDialog v-model="visible" title="选择酸液"> |
|
|
|
|
|
<div v-if="solutionStore.solutionList.length"> |
|
|
|
|
|
<el-radio-group v-model="solutionId" size="large" class="radio-group" @change="onSolutionChange"> |
|
|
|
|
|
<el-radio-button v-for="item in solutionStore.solutionList" :key="item.id" :label="item.name" :value="item.id" class="radio-marge" /> |
|
|
|
|
|
</el-radio-group> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div v-else> |
|
|
|
|
|
<el-empty description="description"> |
|
|
|
|
|
<template #description> |
|
|
|
|
|
未添加酸液,请在溶液管理中配置 |
|
|
|
|
|
</template> |
|
|
|
|
|
</el-empty> |
|
|
|
|
|
</div> |
|
|
|
|
|
<template #footer> |
|
|
|
|
|
<div> |
|
|
|
|
|
<FtButton @click="onClose"> |
|
|
|
|
|
取消 |
|
|
|
|
|
</FtButton> |
|
|
|
|
|
<FtButton @click="onSubmitSolution"> |
|
|
|
|
|
确认 |
|
|
|
|
|
</FtButton> |
|
|
|
|
|
</div> |
|
|
|
|
|
</template> |
|
|
|
|
|
</FtDialog> |
|
|
</div> |
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
@ -70,7 +153,7 @@ const onInputBlur = (e: any) => { |
|
|
border: 1px solid #ccc; |
|
|
border: 1px solid #ccc; |
|
|
border-radius: 5px; |
|
|
border-radius: 5px; |
|
|
margin: 10px; |
|
|
margin: 10px; |
|
|
width: 150px; |
|
|
|
|
|
|
|
|
width: 17vw; |
|
|
text-align: center; |
|
|
text-align: center; |
|
|
border-radius: 1rem; |
|
|
border-radius: 1rem; |
|
|
} |
|
|
} |
|
@ -88,7 +171,6 @@ const onInputBlur = (e: any) => { |
|
|
} |
|
|
} |
|
|
.bottle { |
|
|
.bottle { |
|
|
filter:hue-rotate(217deg) saturate(36); |
|
|
filter:hue-rotate(217deg) saturate(36); |
|
|
mask: linear-gradient(to bottom, transparent 70%, rgb(38, 219, 50)); /* 仅显示底部 30% */ |
|
|
|
|
|
position: absolute; |
|
|
position: absolute; |
|
|
} |
|
|
} |
|
|
.liquied-ml{ |
|
|
.liquied-ml{ |
|
@ -111,11 +193,11 @@ const onInputBlur = (e: any) => { |
|
|
height:2.5rem; |
|
|
height:2.5rem; |
|
|
} |
|
|
} |
|
|
.content-img{ |
|
|
.content-img{ |
|
|
width: 80%; |
|
|
|
|
|
height: 20vh; |
|
|
|
|
|
|
|
|
height: 23vh; |
|
|
|
|
|
width: 15vw; |
|
|
} |
|
|
} |
|
|
.footer { |
|
|
.footer { |
|
|
margin-top: 5px; |
|
|
|
|
|
|
|
|
margin-top: 4rem; |
|
|
line-height: 20px; |
|
|
line-height: 20px; |
|
|
} |
|
|
} |
|
|
.footer-content{ |
|
|
.footer-content{ |
|
@ -130,4 +212,33 @@ const onInputBlur = (e: any) => { |
|
|
.checked { |
|
|
.checked { |
|
|
text-decoration: line-through; |
|
|
text-decoration: line-through; |
|
|
} |
|
|
} |
|
|
|
|
|
.solution-select{ |
|
|
|
|
|
display:flex; |
|
|
|
|
|
width: 120px; |
|
|
|
|
|
height: 25px; |
|
|
|
|
|
text-align: center; |
|
|
|
|
|
margin-left: 5px; |
|
|
|
|
|
align-items: center; |
|
|
|
|
|
background: white; |
|
|
|
|
|
border-radius: 5px; |
|
|
|
|
|
} |
|
|
|
|
|
.solution-name{ |
|
|
|
|
|
width: 100px; |
|
|
|
|
|
height: 25px; |
|
|
|
|
|
display: flex; |
|
|
|
|
|
align-items: center; |
|
|
|
|
|
justify-content: center; |
|
|
|
|
|
} |
|
|
|
|
|
.add-icon{ |
|
|
|
|
|
margin-right: -4px; |
|
|
|
|
|
} |
|
|
|
|
|
.button-icon{ |
|
|
|
|
|
height: 25px; |
|
|
|
|
|
width: 25px; |
|
|
|
|
|
margin: 3px; |
|
|
|
|
|
} |
|
|
|
|
|
.radio-marge{ |
|
|
|
|
|
margin: 10px; |
|
|
|
|
|
border: 1px solid #e0e0e0; |
|
|
|
|
|
} |
|
|
</style> |
|
|
</style> |