| | |
| | | <div class="main-card"> |
| | | <el-row class="cardTop"> |
| | | <el-col :span="12" class="mainCardBtn"> |
| | | <el-button type="primary" :icon="Plus" size="default" @click="openunitDialog('新增', {})">新增</el-button> |
| | | <el-button type="primary" :icon="Plus" size="default" @click="openUnitDialog('新增', {})">新增</el-button> |
| | | <!-- <el-button type="danger" :icon="Delete" size="default" plain>删除</el-button>--> |
| | | </el-col> |
| | | <!-- <el-button type="primary" :icon="Refresh" size="default" />--> |
| | |
| | | <el-table-column prop="updateByUserName" label="最后修改人" show-overflow-tooltip></el-table-column> |
| | | <el-table-column label="操作" width="150"> |
| | | <template #default="scope"> |
| | | <el-button size="small" text type="primary" :icon="Edit" @click="openUnitDialog('修改', scope.row)">修改</el-button> |
| | | <el-button size="small" text type="primary" :icon="Edit" @click="openUnitDialog('修改', scope.row)">编辑</el-button> |
| | | <el-button size="small" text type="danger" :icon="Delete" @click="onDelUnit(scope.row)">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | import {unitApi} from "/@/api/basic/unit"; |
| | | import {ElMessage, ElMessageBox} from "element-plus"; |
| | | import { Edit, View, Plus, Delete } from '@element-plus/icons-vue'; |
| | | import {roomApi} from "/@/api/basic/room"; |
| | | import {equipmentApi} from "/@/api/basic/equipement"; |
| | | import {personApi} from "/@/api/basic/person"; |
| | | |
| | | const UnitDialog = defineAsyncComponent(() => import('./components/unitDialog.vue')); |
| | | |
| | |
| | | evaluateStatusList: [ |
| | | {id: 1, name: '未评价'}, |
| | | {id:2, name: '已评价'}, |
| | | ] |
| | | ], |
| | | allRoomList: [], |
| | | allEquipmentList: [], |
| | | allPersonList: [], |
| | | }) |
| | | |
| | | const getUnitData = async () => { |
| | |
| | | } |
| | | }; |
| | | |
| | | const getRoomData = async () => { |
| | | let res = await roomApi().getAllRoom(); |
| | | if(res.data.code === 100){ |
| | | unitState.allRoomList = JSON.parse(JSON.stringify(res.data.data)); |
| | | }else{ |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | const getAllEquipmentList = async () => { |
| | | let res = await equipmentApi().getAllEquipment(); |
| | | if(res.data.code === 100){ |
| | | unitState.allEquipmentList = JSON.parse(JSON.stringify(res.data.data)); |
| | | }else{ |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }) |
| | | } |
| | | }; |
| | | |
| | | const getAllPersonList = async () => { |
| | | let res = await personApi().getAllPerson(); |
| | | if(res.data.code === 100){ |
| | | unitState.allPersonList = JSON.parse(JSON.stringify(res.data.data)); |
| | | }else{ |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }) |
| | | } |
| | | }; |
| | | |
| | | const openUnitDialog = (title: string, value: UnitType) => { |
| | | unitDialogRef.value.showUnitDialog(title, value); |
| | | unitDialogRef.value.showUnitDialog(title, value, unitState.allEquipmentList, unitState.allRoomList, unitState.allPersonList); |
| | | }; |
| | | |
| | | const onDelUnit = (val: UnitType) => { |
| | | ElMessageBox.confirm(`此操作将永久删除该设备:“${val.deviceName}”,是否继续?`, '提示', { |
| | | ElMessageBox.confirm(`此操作将永久删除该单元:“${val.riskName}”,是否继续?`, '提示', { |
| | | confirmButtonText: '确认', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getUnitData() |
| | | getUnitData(); |
| | | getRoomData(); |
| | | getAllEquipmentList(); |
| | | getAllPersonList(); |
| | | }) |
| | | |
| | | </script> |