Browse Source

fix: 溶液列表分页; 添加溶液回显

master
guoapeng 2 months ago
parent
commit
50872e002b
  1. 2
      src/apis/solution.ts
  2. 14
      src/components/container/Item/index.vue
  3. 4
      src/components/home/AddLiquid/index.vue
  4. 24
      src/stores/systemStore.ts
  5. 3
      src/views/container/index.vue

2
src/apis/solution.ts

@ -1,6 +1,6 @@
import http from 'libs/http'
export const getSolsList = (): Promise<System.PageResponse<Solution.SolutionItem>> => http.get(`/sols/list`)
export const getSolsList = (params: System.Page = { pageNum: 1, pageSize: 999 }): Promise<System.PageResponse<Solution.SolutionItem>> => http.get(`/sols/list`, { params })
export const saveSols = (params: { name: string }): Promise<null> => http.post(`/sols`, params)

14
src/components/container/Item/index.vue

@ -1,9 +1,8 @@
<script lang="ts" setup>
import { updateContainer } from '@/apis/container'
import { useSolutionStore } from '@/stores/useSolutionStore'
import { Plus } from '@element-plus/icons-vue'
import { FtMessage } from 'libs/message'
import { computed, ref } from 'vue'
import { computed, inject, ref } from 'vue'
import { useRouter } from 'vue-router'
const props = defineProps({
@ -21,9 +20,10 @@ const emits = defineEmits<{
(e: 'ok'): void
}>()
const solutionList = inject<Solution.SolutionItem[]>('solutionList')
const router = useRouter()
const visible = ref(false)
const solutionStore = useSolutionStore()
const solutionId = ref()
const selectedSolutionItem = ref()
const solutionInfo = ref(props.solutionItem)
@ -75,7 +75,7 @@ const onSolutionChange = (value: number) => {
if (value) {
solutionId.value = value
solutionInfo.value.solutionId = value
selectedSolutionItem.value = solutionStore.solutionList.filter(item => item.id === value)[0]
selectedSolutionItem.value = solutionList.value?.filter(item => item.id === value)[0]
}
}
const onClose = () => {
@ -83,7 +83,7 @@ const onClose = () => {
visible.value = false
}
const onSubmitSolution = () => {
if (!solutionStore.solutionList.length) {
if (solutionList.value?.length) {
//
router.push('/solution')
return
@ -131,9 +131,9 @@ const onSubmitSolution = () => {
</div>
</div>
<FtDialog v-model="visible" title="选择酸液" :ok-handle="onSubmitSolution" @cancel="onClose">
<div v-if="solutionStore.solutionList.length">
<div v-if="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-button v-for="item in solutionList" :key="item.id" :label="item.name" :value="item.id" class="radio-marge" />
</el-radio-group>
</div>
<div v-else>

4
src/components/home/AddLiquid/index.vue

@ -193,7 +193,9 @@ const delHandle = (index: number) => {
<span>{{ item.tubeNum. split(',').length === 16 ? '全部' : item.tubeNum }}</span>
<span>]</span>
<span>-</span>
<span>{{ solsList.find(i => i.id === item.solutionList[0].solutionId)!.name }}</span>
<span>{{
solsList.find(sol => sol.id === containerList.find(container => container.id === item.solutionList[0].solutionId)?.solutionId)?.name
}}</span>
<span>添加{{ item.solutionList[0].volume }}ml</span>
</div>
<el-icon @click="() => delHandle(key)">

24
src/stores/systemStore.ts

@ -85,8 +85,8 @@ export const useSystemStore = defineStore('system', {
moduleCode: 'heat_module_01',
trayUp: 1,
trayStatus: 1,
heatingType: 'stop',
fanOpen: true,
heatingType: 'warm_up',
fanOpen: false,
capExist: false,
temperature: 0,
targetTemperature: 0,
@ -95,7 +95,7 @@ export const useSystemStore = defineStore('system', {
moduleCode: 'heat_module_02',
trayUp: 1,
trayStatus: 1,
heatingType: 'stop',
heatingType: 'constant',
fanOpen: false,
capExist: false,
temperature: 100,
@ -155,14 +155,14 @@ export const useSystemStore = defineStore('system', {
exists: true,
},
],
crafts: {
craft: {
id: 1,
name: '菱锌矿硫酸溶解法',
steps: '',
},
state: 'READY',
},
// crafts: {
// craft: {
// id: 1,
// name: '菱锌矿硫酸溶解法',
// steps: '',
// },
// state: 'READY',
// },
},
{
uuid: '',
@ -257,5 +257,5 @@ export const useSystemStore = defineStore('system', {
})
},
},
persist: true,
persist: import.meta.env.FT_NODE_ENV === 'prod',
})

3
src/views/container/index.vue

@ -3,7 +3,7 @@ import { getContainerList } from '@/apis/container'
import { getSolsList } from '@/apis/solution'
import { useSolutionStore } from '@/stores/useSolutionStore'
import liquidItem from 'components/container/Item/index.vue'
import { onMounted, ref } from 'vue'
import { onMounted, provide, ref } from 'vue'
const chemicalList = ref<Container.ContainerItem[]>([])
onMounted(async () => {
@ -11,6 +11,7 @@ onMounted(async () => {
queryContainerList()
})
const solutionList = ref<Solution.SolutionItem[]>([])
provide('solutionList', solutionList)
const solutionMap = ref<Record<string | number, string>>({})
const solutionStore = useSolutionStore()
const querySolutionList = async () => {

Loading…
Cancel
Save