Browse Source

优化ID卡

dev
LiLongLong 7 months ago
parent
commit
8c785add49
  1. 3
      src/pages/Index/Regular/Running.vue
  2. 38
      src/pages/Index/components/Consumables/IdCardInfo.vue
  3. 2
      src/pages/Index/components/Consumables/MoveLiquidArea.vue

3
src/pages/Index/Regular/Running.vue

@ -1195,6 +1195,9 @@ const updateStartTimes = () => {
// //
const getRemainingTime = (plate: Subtank) => { const getRemainingTime = (plate: Subtank) => {
if(!plate.projId){
return;
}
const startTime = startTimes.value[plate.pos] || Date.now() const startTime = startTimes.value[plate.pos] || Date.now()
const elapsed = (Date.now() - startTime) / 1000 // const elapsed = (Date.now() - startTime) / 1000 //
const remaining = Math.max(0, plate.incubatedTimeSec - elapsed) // 0 const remaining = Math.max(0, plate.incubatedTimeSec - elapsed) // 0

38
src/pages/Index/components/Consumables/IdCardInfo.vue

@ -26,7 +26,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr v-for="(item, index) in currentData" :key="index" :class="{
<tr v-for="(item, index) in tableData" :key="index" :class="{
'odd-row': index % 2 !== 0, 'odd-row': index % 2 !== 0,
'even-row': index % 2 === 0, 'even-row': index % 2 === 0,
}"> }">
@ -57,7 +57,7 @@
:class="{ active: page === currentPage }"> :class="{ active: page === currentPage }">
{{ page === '...' ? '...' : page }} {{ page === '...' ? '...' : page }}
</button> </button>
<button @click="nextPage" :disabled="currentPage === totalPages">
<button @click="nextPage" :disabled="currentPage === totalPage">
下一页 下一页
</button> </button>
</div> </div>
@ -100,6 +100,8 @@ const props = defineProps({
const emit = defineEmits(['update:modelValue']) const emit = defineEmits(['update:modelValue'])
const pageSizeList:number[] = [5,10,20] const pageSizeList:number[] = [5,10,20]
const visible = ref(props.modelValue) const visible = ref(props.modelValue)
//
let totalPage = ref(0)
watch( watch(
() => props.modelValue, () => props.modelValue,
(newVal) => { (newVal) => {
@ -129,6 +131,7 @@ const cancelDelete = () => {
} }
// id // id
const getCardList = async () => { const getCardList = async () => {
const params = { const params = {
pageNum: currentPage.value, pageNum: currentPage.value,
@ -140,13 +143,21 @@ const getCardList = async () => {
} }
tableData.value = res.data.list tableData.value = res.data.list
totalItems.value = res.data.list.length totalItems.value = res.data.list.length
totalPage.value = res.data.totalPage;
console.log('tableData.value===', tableData.value)
} }
// //
onMounted(() => { onMounted(() => {
getCardList() getCardList()
}) })
const handleCancel = () => emit('update:modelValue', false)
const handleCancel = () => {
currentPage.value = 1
tableData.value = []
totalPage.value = 0
totalItems.value = 0
emit('update:modelValue', false)
}
// //
const handleConfirm = () => { const handleConfirm = () => {
@ -168,17 +179,18 @@ const prevPage = () => {
if (currentPage.value > 1) currentPage.value-- if (currentPage.value > 1) currentPage.value--
} }
const nextPage = () => { const nextPage = () => {
if (currentPage.value < totalPages.value) currentPage.value++
if (currentPage.value < totalPage.value) currentPage.value++
} }
const goToPage = (page: any) => { const goToPage = (page: any) => {
if (page !== '...') currentPage.value = page if (page !== '...') currentPage.value = page
} }
const formatDate = (date: any) => new Date(date).toLocaleDateString() const formatDate = (date: any) => new Date(date).toLocaleDateString()
const currentData = computed(() => {
const start = (currentPage.value - 1) * pageSize.value
return tableData.value.slice(start, start + pageSize.value)
})
// const currentData = computed(() => {
// const start = (currentPage.value - 1) * pageSize.value
// return tableData.value.slice(start, start + pageSize.value)
// })
// //
const displayedPages = computed(() => { const displayedPages = computed(() => {
@ -202,7 +214,7 @@ const displayedPages = computed(() => {
// //
const toggleSelectAll = () => { const toggleSelectAll = () => {
if (selectAll.value) { if (selectAll.value) {
selectedItems.value = [...currentData.value]
selectedItems.value = [...tableData.value]
} else { } else {
selectedItems.value = [] selectedItems.value = []
} }
@ -210,7 +222,13 @@ const toggleSelectAll = () => {
// //
watch(selectedItems, (newSelection) => { watch(selectedItems, (newSelection) => {
selectAll.value = newSelection.length === currentData.value.length
selectAll.value = newSelection.length === tableData.value.length
})
//
watch(currentPage, ()=>{
console.log('currentPage---', currentPage)
getCardList()
}) })
// //

2
src/pages/Index/components/Consumables/MoveLiquidArea.vue

@ -170,7 +170,7 @@
</div> </div>
</div> </div>
</div> </div>
<IdCardInfo v-model="visible"></IdCardInfo>
<IdCardInfo v-model="visible" v-if="visible"></IdCardInfo>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">

Loading…
Cancel
Save