| | |
| | | <template #default="scope"> |
| | | <el-button link type="primary" size="small" :icon="View" @click="openInspectTaskDialog('查看', scope.row)">查看</el-button> |
| | | <el-button link type="primary" size="small" :icon="Edit" @click="openInspectTaskDialog('修改', scope.row)">修改</el-button> |
| | | <el-switch v-model="scope.row.status" inline-prompt active-text="开" inactive-text="关" active-value="开启" inactive-value="关闭" style="margin: 0 10px" /> |
| | | <el-button link type="danger" size="small" :icon="Delete" @click="deleteInspectTask(scope.$index)">删除</el-button> |
| | | <el-button link type="danger" size="small" :icon="Delete" v-if="scope.row.taskUnitStatus === 2" @click="deleteInspectTask(scope.row)">删除</el-button> |
| | | <div @click="changeStatus(scope.row)"> |
| | | <el-switch v-model="scope.row.taskUnitStatus" inline-prompt active-text="开" inactive-text="关" :active-value="1" :inactive-value="2" style="margin: 0 10px" /> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | <script lang="ts"> |
| | | import { toRefs, reactive, ref, onMounted } from 'vue'; |
| | | import { Edit, View, Plus, Delete, Refresh, Search, Download } from '@element-plus/icons-vue'; |
| | | import { ElTable, ElMessage } from 'element-plus'; |
| | | import { ElTable, ElMessage, ElMessageBox } from 'element-plus'; |
| | | import { inspectTaskApi } from '/@/api/intellectInspectSystem/inspectTask'; |
| | | import inspectTaskDialog from './components/inspectTaskDialog.vue'; |
| | | import { departmentApi } from '/@/api/systemManage/department'; |
| | | import { teamManageApi } from '/@/api/systemManage/personShiftManage/teamManage'; |
| | | import { inspectPointApi } from '/@/api/intellectInspectSystem/inspectPointManage'; |
| | | import { facilityAreaApi } from '/@/api/intellectInspectSystem/facilityAreaManage'; |
| | | import { RFIDApi } from '/@/api/intellectInspectSystem/RFID'; |
| | | let global: any = { |
| | | homeChartOne: null, |
| | | homeChartTwo: null, |
| | |
| | | departmentList: []; |
| | | classGroupList: Array<classGroup>; |
| | | inspectPointAllList: []; |
| | | regionNameList: []; |
| | | RFIDList: []; |
| | | timeType: Array<type>; |
| | | } |
| | | interface type { |
| | |
| | | departmentList: [], |
| | | classGroupList: [], |
| | | inspectPointAllList: [], |
| | | regionNameList: [], |
| | | RFIDList: [], |
| | | timeType: [ |
| | | { id: 1, name: '分' }, |
| | | { id: 2, name: '小时' }, |
| | |
| | | } |
| | | }; |
| | | |
| | | //获取所有设施区域名称 |
| | | const initFacilityAreaType = async () => { |
| | | let res = await facilityAreaApi().getAllFacilityAreaList(); |
| | | if (res.data.code === '200') { |
| | | state.regionNameList = JSON.parse(JSON.stringify(res.data.data)); |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | //获取所有RFID名称 |
| | | const initRFIDList = async () => { |
| | | let res = await RFIDApi().getAllRFIDList(); |
| | | if (res.data.code === '200') { |
| | | state.RFIDList = JSON.parse(JSON.stringify(res.data.data)); |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | //获取班组 |
| | | const getClassGroupData = async () => { |
| | | let res = await teamManageApi().getRecord({ depIp: null, groupName: null, containGroupMemberEnable: null }); |
| | |
| | | } |
| | | }; |
| | | |
| | | const changeStatus = async (value: { taskUnitStatus: number; id: number }) => { |
| | | if (value.taskUnitStatus === 2) { |
| | | ElMessageBox.confirm(`此操作将关闭该巡检任务”,是否继续?`, '提示', { |
| | | confirmButtonText: '确认', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }) |
| | | .then(async () => { |
| | | let res = await inspectTaskApi().openOrCloseInspectTask({ id: value.id, taskUnitStatus: 2 }); |
| | | if (res.data.code === '200') { |
| | | await getInspectionTask(); |
| | | ElMessage({ |
| | | type: 'success', |
| | | duration: 2000, |
| | | message: '关闭成功' |
| | | }); |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | }) |
| | | .catch((error) => {}); |
| | | } else { |
| | | ElMessageBox.confirm(`此操作将开启该巡检任务”,是否继续?`, '提示', { |
| | | confirmButtonText: '确认', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }) |
| | | .then(async () => { |
| | | let res = await inspectTaskApi().openOrCloseInspectTask({ id: value.id, taskUnitStatus: 1 }); |
| | | if (res.data.code === '200') { |
| | | await getInspectionTask(); |
| | | ElMessage({ |
| | | type: 'success', |
| | | duration: 2000, |
| | | message: '开启成功' |
| | | }); |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | }) |
| | | .catch((error) => {}); |
| | | } |
| | | await getInspectionTask(); |
| | | }; |
| | | |
| | | // 删除 |
| | | const deleteInspectTask = (row: any) => { |
| | | ElMessageBox.confirm(`此操作将永久删除该任务:“${row.unitName}”,是否继续?`, '提示', { |
| | | confirmButtonText: '确认', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }) |
| | | .then(async () => { |
| | | let res = await inspectTaskApi().deleteInspectTask({ id: row.id }); |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: 'success', |
| | | duration: 2000, |
| | | message: '删除成功' |
| | | }); |
| | | await getInspectionTask(); |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | }) |
| | | .catch(() => {}); |
| | | }; |
| | | |
| | | const openInspectTaskDialog = (type: string, value: {}) => { |
| | | inspectTaskDialogRef.value.showInspectTaskDialog(type, value, state.workTypeList, state.departmentList, state.timeType, state.classGroupList, state.quotaList, state.inspectPointAllList); |
| | | inspectTaskDialogRef.value.showInspectTaskDialog(type, value, state.workTypeList, state.departmentList, state.timeType, state.classGroupList, state.quotaList, state.inspectPointAllList, state.regionNameList, state.RFIDList); |
| | | }; |
| | | |
| | | const parseNumber = (value: number, type: string) => { |
| | |
| | | getDepartmentData(); |
| | | getClassGroupData(); |
| | | getInspectTaskPoint(); |
| | | initFacilityAreaType(); |
| | | initRFIDList(); |
| | | }); |
| | | |
| | | return { |
| | |
| | | Refresh, |
| | | Plus, |
| | | reset, |
| | | changeStatus, |
| | | parseNumber, |
| | | deleteInspectTask, |
| | | getInspectionTask, |
| | | onHandleSizeChange, |
| | | onHandleCurrentChange, |
| | |
| | | <style scoped lang="scss"> |
| | | $homeNavLengh: 8; |
| | | .home-container { |
| | | height: calc(100vh - 114px); |
| | | height: calc(100vh - 144px); |
| | | box-sizing: border-box; |
| | | overflow: hidden; |
| | | .homeCard { |