|
|
<script setup lang="ts"> import type { logQuery } from 'apis/log' import { del, list } from 'apis/log' import { list as matrixList } from 'apis/matrix' import { list as matrixCraftList } from 'apis/matrixCraft' import route3 from 'assets/images/route.png' import route2 from 'assets/images/route_horizontal.png' import route1 from 'assets/images/route_vertical.png' import FtButton from 'components/common/FTButton/index.vue' import { ElMessageBox } from 'element-plus' import { FtMessage } from 'libs/message' import { onMounted, ref } from 'vue'
onMounted(() => { getList() })
const selectedData = ref<any[]>([]) const handleSelectionChange = (val: any[]) => { console.log(val) selectedData.value = val }
const tableData = ref([]) const total = ref(0) const query = ref<logQuery>({ pageNum: 1, pageSize: 10, })
const loading = ref(false)
const MatrixList = ref([]) const MatrixCraftList = ref([]) const getList = async () => { loading.value = true const res = await list(query.value) tableData.value = res.list tableData.value = tableData.value.map((item: any) => { return { ...item, ...JSON.parse(item.matrixInfo), } }) const res1 = await matrixList({ pageNum: 1, pageSize: 1000 }) MatrixList.value = res1.list const res2 = await matrixCraftList({ pageNum: 1, pageSize: 1000 }) MatrixCraftList.value = res2.list console.log(tableData.value) total.value = res.total loading.value = false }
const pageChange = (pageNum: number, pageSize: number) => { query.value.pageNum = pageNum query.value.pageSize = pageSize getList() }
const delHandle = async () => { const ids = selectedData.value.map((item: any) => item.id) ElMessageBox.confirm('确认删除?', '提示', { type: 'warning', confirmButtonText: '确定', cancelButtonText: '取消', showCancelButton: true, showClose: false, closeOnClickModal: false, closeOnPressEscape: false, closeOnHashChange: false, }).then(async () => { await del(ids.join(',')) FtMessage.success('删除成功') await getList() }) } </script>
<template> <div> <el-row class="search-box"> <el-col :span="12"> <!-- <el-input v-model="query.matrixName" class="my-input" placeholder="请输入基质名称" clearable @input="inputChange" /> --> </el-col> <el-col :span="12"> <div style="float: right"> <!-- <FtButton type="primary" @click="addHandle"> --> <!-- 新增 --> <!-- </FtButton> --> <!-- <FtButton :disabled="selectedData.length !== 1" @click="editHandle"> --> <!-- 编辑 --> <!-- </FtButton> --> <FtButton :disabled="selectedData.length === 0" @click="delHandle"> 删除 </FtButton> </div> </el-col> </el-row> <div class="table-box"> <el-table v-loading="loading" :data="tableData" header-row-class-name="table-header" height="100%" @selection-change="handleSelectionChange"> <el-table-column type="selection" width="55" /> <el-table-column prop="matrixName" label="基质名称"> <template #default="scope"> <div class="scope-box"> <div> {{ MatrixList.find(item => item.id === scope.row.matrixId)?.name }} </div> </div> </template> </el-table-column> <el-table-column prop="name" label="工艺名称"> <template #default="scope"> <div class="scope-box"> <div> {{ MatrixCraftList.find(item => item.id === scope.row.matrixCraftId)?.name }} </div> </div> </template> </el-table-column> <el-table-column prop="matrixPathType" label="喷涂路线"> <template #default="scope"> <div class="scope-box"> <img v-show="scope.row.matrixPathType === 'horizontal'" :src="route1" width="20px" height="20px" alt="icon"> <img v-show="scope.row.matrixPathType === 'vertical'" :src="route2" width="20px" height="20px" alt="icon"> <img v-show="scope.row.matrixPathType === 'grid'" :src="route3" width="20px" height="20px" alt="icon"> </div> </template> </el-table-column> <el-table-column prop="motorZHeight" label="喷涂高度"> <template #default="scope"> <div class="scope-box"> {{ scope.row.motorZHeight }}mm </div> </template> </el-table-column> <el-table-column prop="gasPressure" label="氮气气压"> <template #default="scope"> <div class="scope-box"> {{ scope.row.gasPressure }}Mpa </div> </template> </el-table-column> <el-table-column prop="volume" label="基质流速"> <template #default="scope"> <div class="scope-box"> {{ scope.row.volume }}uL/min </div> </template> </el-table-column> <el-table-column prop="highVoltageValue" label="电压"> <template #default="scope"> <div class="scope-box"> {{ scope.row.highVoltageValue }}V </div> </template> </el-table-column> <el-table-column prop="movingSpeed" label="移速"> <template #default="scope"> <div class="scope-box"> {{ scope.row.movingSpeed }}mm/s </div> </template> </el-table-column> <el-table-column prop="spacing" label="行间距"> <template #default="scope"> <div class="scope-box"> {{ scope.row.spacing }}mm </div> </template> </el-table-column> <el-table-column prop="times" label="喷涂次数"> <template #default="scope"> <div class="scope-box"> {{ scope.row.times }}次 </div> </template> </el-table-column> <el-table-column prop="createTime" label="创建时间" width="150" /> </el-table> </div>
<div class="table-footer"> <el-pagination size="large" background layout="prev, pager, next, total" :total @change="pageChange" /> </div> </div> </template>
<style scoped lang="scss"> .table-header { background: #E8ECF7; } .my-input { height: 100px; width: 400px; margin-right: 20px; background: #E8ECF7; border: 0; .el-input__wrapper { background: #E8ECF7; border: 0; .el-input__inner { height: calc(100% - 2px); } } }
:deep(.el-input__inner)::placeholder { color: #a8abb2; font-size: 40px; }
.my-select { width: 400px; .el-select__input { height: 80px !important; } .el-select__wrapper { min-height: 80px; background: #E8ECF7; border: 0; font-size: 40px; line-height:40px; } .el-select__placeholder { color: #0349A8; font-weight: 500; } .el-select-dropdown__item { height: 80px; line-height: 40px; padding: 20px; font-size: 40px; } .el-select-dropdown__empty { font-size: 40px; line-height: 40px; padding: 20px; } } .search-box { height: 120px; } .table-footer { height: 100px; display: flex; justify-content: flex-end; } .table-box { height: calc(100% - 100px - 120px); } </style>
|