| | |
| | | <el-button type="success" icon="Van" @click="addPlan"> |
| | | 新增计划 |
| | | </el-button> |
| | | <el-button @click="handleOut"> |
| | | 导出 |
| | | </el-button> |
| | | <el-button |
| | | type="danger" |
| | | icon="Delete" |
| | |
| | | 编辑 |
| | | </el-button> |
| | | <el-button |
| | | type="primary" |
| | | text |
| | | icon="editPen" |
| | | @click="showImage(row)" |
| | | > |
| | | 附件 |
| | | </el-button> |
| | | <el-button |
| | | type="danger" |
| | | text |
| | | icon="delete" |
| | |
| | | </div> |
| | | <PlanModal ref="planModalRef" @ok="getTableData" /> |
| | | <MaintenanceModal ref="maintainModalRef" @ok="getTableData" /> |
| | | <ImagePreviewDialog v-model:model-value="showImages" :images="imageUrls" /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { usePaginationApi } from "@/hooks/usePaginationApi"; |
| | | import { getUpkeepPage, delUpkeep } from "@/api/equipmentManagement/upkeep"; |
| | | import { onMounted } from "vue"; |
| | | import {getUpkeepPage, delUpkeep, getUpkeepById} from "@/api/equipmentManagement/upkeep"; |
| | | import { onMounted, getCurrentInstance } from "vue"; |
| | | import PlanModal from "./Modal/PlanModal.vue"; |
| | | import MaintenanceModal from "./Modal/MaintenanceModal.vue"; |
| | | import ImagePreviewDialog from "@/components/ImagePreview/ImagePreviewDialog.vue"; |
| | | import dayjs from "dayjs"; |
| | | import { ElMessageBox, ElMessage } from "element-plus"; |
| | | |
| | | defineOptions({ |
| | | name: "设备保养", |
| | | }); |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | |
| | | // 计划弹窗控制器 |
| | | const planModalRef = ref(); |
| | |
| | | |
| | | // 表格多选框选中项 |
| | | const multipleList = ref([]); |
| | | |
| | | const showImages = ref(false) |
| | | const imageUrls = ref([]) |
| | | |
| | | // 多选后做什么 |
| | | const handleSelectionChange = (selectionList) => { |
| | |
| | | getTableData, |
| | | resetFilters, |
| | | onCurrentChange, |
| | | } = usePaginationApi(getUpkeepPage, {}, [ |
| | | } = usePaginationApi(getUpkeepPage, { |
| | | deviceName: undefined, |
| | | maintenancePlanTime: undefined, |
| | | maintenanceActuallyTime: undefined, |
| | | maintenanceActuallyName: undefined, |
| | | }, [ |
| | | { |
| | | label: "设备名称", |
| | | align: "center", |
| | |
| | | align: "center", |
| | | prop: "createUserName", |
| | | }, |
| | | { |
| | | label: "录入日期", |
| | | align: "center", |
| | | prop: "createTime", |
| | | formatData: (cell) => dayjs(cell).format("YYYY-MM-DD HH:mm:ss"), |
| | | width: 200, |
| | | }, |
| | | // { |
| | | // label: "录入日期", |
| | | // align: "center", |
| | | // prop: "createTime", |
| | | // formatData: (cell) => dayjs(cell).format("YYYY-MM-DD HH:mm:ss"), |
| | | // width: 200, |
| | | // }, |
| | | { |
| | | label: "实际保养人", |
| | | align: "center", |
| | |
| | | dataType: "slot", |
| | | slot: "operation", |
| | | align: "center", |
| | | width: "200px", |
| | | width: "300px", |
| | | }, |
| | | ]); |
| | | // type == 1实际保养时间 2计划保养时间 |
| | |
| | | planModalRef.value.openEdit(id); |
| | | }; |
| | | |
| | | const changePage = ({ page }) => { |
| | | pagination.currentPage = page; |
| | | onCurrentChange(page); |
| | | const changePage = ({ page, limit }) => { |
| | | pagination.currentPage = page; |
| | | pagination.pageSize = limit; |
| | | onCurrentChange(page); |
| | | }; |
| | | |
| | | // 单行删除 |
| | |
| | | }); |
| | | }; |
| | | |
| | | // 导出 |
| | | const handleOut = () => { |
| | | ElMessageBox.confirm("选中的内容将被导出,是否确认导出?", "导出", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | proxy.download("/device/maintenance/export", {}, "设备保养.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | ElMessage.info("已取消"); |
| | | }); |
| | | }; |
| | | |
| | | const showImage = async (row) => { |
| | | const {data} = await getUpkeepById(row.id) |
| | | imageUrls.value = data?.files.map((item) => item.url) |
| | | showImages.value = true |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getTableData(); |
| | | }); |