|
|
<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 FtButton from 'components/common/FTButton/index.vue' import SprayParams from 'components/spray/sprayParams/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() }) } const selectCraftVisible = ref(false)
const currentFormData = ref<any>({}) const viewParams = (row: any) => { currentFormData.value = row selectCraftVisible.value = true } </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" show-overflow-tooltip :data="tableData" header-row-class-name="table-header" height="100%" @selection-change="handleSelectionChange"> <el-table-column type="selection" /> <el-table-column prop="createTime" label="创建时间" /> <el-table-column prop="status" label="任务状态"> <template #default="scope"> <el-tag v-if="scope.row.status === 0" type="info"> 进行中 </el-tag> <el-tag v-if="scope.row.status === 1" type="success"> 已完成 </el-tag> <el-tag v-if="scope.row.status === 2" type="warning"> 手动暂停 </el-tag> <el-tag v-if="scope.row.status === 3" type="danger"> 手动停止 </el-tag> </template> </el-table-column> <el-table-column label=""> <template #default="scope"> <div class="scope-box"> <FtButton type="primary" @click="viewParams(scope.row)"> 喷涂参数 </FtButton> </div> </template> </el-table-column> </el-table> </div>
<div class="table-footer"> <el-pagination size="large" background layout="prev, pager, next, total" :total @change="pageChange" /> </div> <SprayParams v-if="selectCraftVisible" disabled :form-data="currentFormData" @cancel="selectCraftVisible = false" /> </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); } :deep(.el-tag) {
} </style>
|