From 2bff5e788d4f7e505961270f0624aa3e78280e25 Mon Sep 17 00:00:00 2001
From: Your Name <123456>
Date: 星期四, 13 十月 2022 14:31:29 +0800
Subject: [PATCH] 目录
---
src/views/intellectInspect/inspectTaskManage/inspectTask/index.vue | 592 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 588 insertions(+), 4 deletions(-)
diff --git a/src/views/intellectInspect/inspectTaskManage/inspectTask/index.vue b/src/views/intellectInspect/inspectTaskManage/inspectTask/index.vue
index fe95193..d897b89 100644
--- a/src/views/intellectInspect/inspectTaskManage/inspectTask/index.vue
+++ b/src/views/intellectInspect/inspectTaskManage/inspectTask/index.vue
@@ -1,11 +1,595 @@
<template>
- <div>1235</div>
+ <div class="home-container">
+ <div style="height: 100%">
+ <el-row class="homeCard">
+ <div class="basic-line">
+ <span>任务类型:</span>
+ <el-select v-model="tableData.params.workType" clearable filterable class="input-box" placeholder="任务类型">
+ <el-option v-for="item in workTypeList" :key="item.id" :label="item.name" :value="item.id"></el-option>
+ </el-select>
+ </div>
+ <div class="basic-line">
+ <span>执行班组:</span>
+ <el-select v-model="tableData.params.execClassgroupId" clearable filterable class="input-box" placeholder="执行班组">
+ <el-option v-for="item in classGroupList" :key="item.id" :label="item.groupName" :value="item.id"></el-option>
+ </el-select>
+ </div>
+ <div style="padding-bottom: 10px">
+ <el-button type="primary" @click="getInspectionTask">查询</el-button>
+ <el-button plain @click="reset">重置</el-button>
+ </div>
+ </el-row>
+ <div class="homeCard">
+ <div class="main-card">
+ <el-row class="cardTop">
+ <el-col :span="12" class="mainCardBtn">
+ <el-button type="primary" :icon="Plus" size="default" @click="openInspectTaskDialog('新增', {})">新增</el-button>
+ <!-- <el-button type="danger" :icon="Delete" size="default" plain>删除</el-button>-->
+ </el-col>
+ <el-button type="primary" :icon="Refresh" size="default" />
+ </el-row>
+ <el-table ref="multipleTableRef" :data="tableData.inspectTaskData" style="width: 100%" height="calc(100% - 100px)" :header-cell-style="{ background: '#fafafa' }" @selection-change="handleSelectionChange">
+ <el-table-column type="selection" width="55" />
+ <el-table-column property="unitName" label="任务名称" />
+ <el-table-column property="workType" label="任务类型">
+ <template #default="scope">
+ <span>
+ {{ parseNumber(scope.row.workType, '任务类型') }}
+ </span>
+ </template>
+ </el-table-column>
+ <el-table-column property="execClassgroupId" label="巡检班组">
+ <template #default="scope">
+ <span>
+ {{ parseNumber(scope.row.execClassgroupId, '巡检班组') }}
+ </span>
+ </template>
+ </el-table-column>
+ <el-table-column property="frequency" label="检查频次">
+ <template #default="scope">
+ <span>
+ {{ scope.row.checkCycle }}
+ </span>
+ <span>
+ {{ scope.row.checkCycleUnit }}
+ </span>
+ </template>
+ </el-table-column>
+ <!-- <el-table-column prop="validTime" label="有效时间" show-overflow-tooltip>-->
+ <!-- <template #default="scope">-->
+ <!-- <span>-->
+ <!-- {{ scope.row.validTime }}-->
+ <!-- </span>-->
+ <!-- <span>-->
+ <!-- {{ parseNumber(scope.row.validTimeUnit, '检查频次') }}-->
+ <!-- </span>-->
+ <!-- </template>-->
+ <!-- </el-table-column>-->
+ <!-- <el-table-column prop="validTime" label="提醒时间" show-overflow-tooltip>-->
+ <!-- <template #default="scope">-->
+ <!-- <span>-->
+ <!-- {{ scope.row.noticeTime }}-->
+ <!-- </span>-->
+ <!-- <span>-->
+ <!-- {{ parseNumber(scope.row.noticeTimeUnit, '检查频次') }}-->
+ <!-- </span>-->
+ <!-- </template>-->
+ <!-- </el-table-column>-->
+ <el-table-column property="firstStartTime" label="任务开始时间" />
+ <el-table-column prop="createUserName" label="创建人" show-overflow-tooltip></el-table-column>
+ <el-table-column prop="gmtCreate" label="创建时间" show-overflow-tooltip></el-table-column>
+ <el-table-column prop="lastEditUserName" label="最后修改人" show-overflow-tooltip></el-table-column>
+ <el-table-column prop="gmtModitify" label="最后修改时间" show-overflow-tooltip></el-table-column>
+ <el-table-column property="taskUnitStatus" label="状态" width="60">
+ <template #default="scope">
+ <div>
+ <div v-if="scope.row.taskUnitStatus === 1">
+ <el-tag :type="''">
+ {{ '开启' }}
+ </el-tag>
+ </div>
+ <div v-if="scope.row.taskUnitStatus === 2">
+ <el-tag :type="'danger'">
+ {{ '关闭' }}
+ </el-tag>
+ </div>
+ </div>
+ </template>
+ </el-table-column>
+ <el-table-column fixed="right" label="操作" align="center" width="300">
+ <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-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>
+ <div class="pageBtn">
+ <el-pagination @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange" :pager-count="5" :page-sizes="[10, 20, 30]" v-model:current-page="tableData.params.pageIndex" background v-model:page-size="tableData.params.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="tableData.total" class="page-position"> </el-pagination>
+ </div>
+ </div>
+ </div>
+ </div>
+ <inspect-task-dialog ref="inspectTaskDialogRef" @refreshInspectTask="getInspectionTask"></inspect-task-dialog>
+ </div>
</template>
-<script>
+<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, 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,
+ homeCharThree: null,
+ dispose: [null, '', undefined]
+};
+
+interface stateType {
+ tableData: {
+ inspectTaskData: [];
+ total: number;
+ loading: boolean;
+ params: {
+ pageIndex: number | null;
+ pageSize: number | null;
+ unitName: string | null;
+ workType: number | null;
+ createUserId: number | null;
+ execClassgroupId: number | null;
+ checkCycle: number | null;
+ checkCycleUnit: number | null;
+ };
+ };
+ workTypeList: Array<type>;
+ quotaList: [];
+ departmentList: [];
+ classGroupList: Array<classGroup>;
+ inspectPointAllList: [];
+ regionNameList: [];
+ RFIDList: [];
+ timeType: Array<type>;
+}
+interface type {
+ id: number;
+ name: string;
+}
+interface classGroup {
+ id: number;
+ groupName: string;
+}
export default {
- name: 'index'
+ name: 'index',
+ components: { inspectTaskDialog },
+ setup() {
+ const inspectTaskDialogRef = ref();
+ const state = reactive<stateType>({
+ tableData: {
+ inspectTaskData: [],
+ total: 0,
+ loading: false,
+ params: {
+ pageIndex: 1,
+ pageSize: 10,
+ unitName: null,
+ workType: null,
+ createUserId: null,
+ execClassgroupId: null,
+ checkCycle: null,
+ checkCycleUnit: null
+ }
+ },
+ workTypeList: [
+ { id: 1, name: '周期任务' },
+ { id: 2, name: '单次任务' }
+ ],
+ quotaList: [],
+ departmentList: [],
+ classGroupList: [],
+ inspectPointAllList: [],
+ regionNameList: [],
+ RFIDList: [],
+ timeType: [
+ { id: 1, name: '分' },
+ { id: 2, name: '小时' },
+ { id: 3, name: '日' },
+ { id: 4, name: '月' },
+ { id: 5, name: '年' }
+ ]
+ });
+
+ //获取巡检任务数据
+ const getInspectionTask = async () => {
+ let res = await inspectTaskApi().getInspectTaskList(state.tableData.params);
+ if (res.data.code === '200') {
+ state.tableData.inspectTaskData = res.data.data.records;
+ state.tableData.total = res.data.data.total;
+ } else {
+ ElMessage({
+ type: 'warning',
+ message: res.data.msg
+ });
+ }
+ };
+
+ //获取部门
+ const getDepartmentData = async () => {
+ let res = await departmentApi().getDepartmentList();
+ if (res.data.code === '200') {
+ state.departmentList = res.data.data;
+ } else {
+ ElMessage({
+ type: 'warning',
+ message: res.data.msg
+ });
+ }
+ };
+
+ //获取部门
+ const getQuotaList = async () => {
+ let res = await inspectTaskApi().getQuotaList();
+ if (res.data.code === '200') {
+ state.quotaList = res.data.data;
+ } else {
+ ElMessage({
+ type: 'warning',
+ message: res.data.msg
+ });
+ }
+ };
+
+ //获取巡检点
+ const getInspectTaskPoint = async () => {
+ let res = await inspectPointApi().getInspectPointAll();
+ if (res.data.code === '200') {
+ state.inspectPointAllList = res.data.data;
+ } else {
+ ElMessage({
+ type: 'warning',
+ message: res.data.msg
+ });
+ }
+ };
+
+ //获取所有设施区域名称
+ 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 });
+ if (res.data.code === '200') {
+ state.classGroupList = res.data.data;
+ } else {
+ ElMessage({
+ type: 'warning',
+ message: res.data.msg
+ });
+ }
+ };
+
+ 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, state.regionNameList, state.RFIDList);
+ };
+
+ const parseNumber = (value: number, type: string) => {
+ if (type === '任务类型') {
+ return state.workTypeList.find((item) => item.id === value)?.name;
+ } else if (type === '检查频次') {
+ return state.timeType.find((item) => item.id == value)?.name;
+ } else {
+ return state.classGroupList.find((item) => item.id == value)?.groupName;
+ }
+ };
+
+ // 分页改变
+ const onHandleSizeChange = (val: number) => {
+ state.tableData.params.pageSize = val;
+ getInspectionTask();
+ };
+ // 分页改变
+ const onHandleCurrentChange = (val: number) => {
+ state.tableData.params.pageIndex = val;
+ getInspectionTask();
+ };
+
+ const reset = () => {
+ state.tableData.params = {
+ pageIndex: 1,
+ pageSize: 10,
+ unitName: null,
+ workType: null,
+ createUserId: null,
+ execClassgroupId: null,
+ checkCycle: null,
+ checkCycleUnit: null
+ };
+ };
+
+ // 页面加载时
+ onMounted(() => {
+ getInspectionTask();
+ getQuotaList();
+ getDepartmentData();
+ getClassGroupData();
+ getInspectTaskPoint();
+ initFacilityAreaType();
+ initRFIDList();
+ });
+
+ return {
+ View,
+ Edit,
+ Delete,
+ Refresh,
+ Plus,
+ reset,
+ changeStatus,
+ parseNumber,
+ deleteInspectTask,
+ getInspectionTask,
+ onHandleSizeChange,
+ onHandleCurrentChange,
+ inspectTaskDialogRef,
+ openInspectTaskDialog,
+ ...toRefs(state)
+ };
+ }
};
</script>
-<style scoped></style>
+<style scoped lang="scss">
+$homeNavLengh: 8;
+.home-container {
+ height: calc(100vh - 144px);
+ box-sizing: border-box;
+ overflow: hidden;
+ .homeCard {
+ width: 100%;
+ padding: 20px;
+ box-sizing: border-box;
+ background: #fff;
+ border-radius: 4px;
+
+ .main-card {
+ width: 100%;
+ height: 100%;
+ .cardTop {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ margin-bottom: 20px;
+ .mainCardBtn {
+ margin: 0;
+ }
+ }
+ .pageBtn {
+ height: 60px;
+ display: flex;
+ align-items: center;
+ justify-content: right;
+
+ .demo-pagination-block + .demo-pagination-block {
+ margin-top: 10px;
+ }
+ .demo-pagination-block .demonstration {
+ margin-bottom: 16px;
+ }
+ }
+ }
+ &:last-of-type {
+ height: calc(100% - 100px);
+ }
+ }
+ .el-row {
+ display: flex;
+ align-items: center;
+ margin-bottom: 20px;
+ &:last-child {
+ margin-bottom: 0;
+ }
+ .grid-content {
+ align-items: center;
+ min-height: 36px;
+ }
+
+ .topInfo {
+ display: flex;
+ align-items: center;
+ font-size: 16px;
+ font-weight: bold;
+
+ & > div {
+ white-space: nowrap;
+ margin-right: 20px;
+ }
+ }
+ }
+}
+.stepItem {
+ width: 100%;
+ display: flex;
+ align-items: flex-start;
+ margin-bottom: 30px;
+ margin-left: 30px;
+ padding-bottom: 30px;
+ border-left: 2px solid #ccc;
+ &:first-of-type {
+ margin-top: 30px;
+ }
+ &:last-of-type {
+ margin-bottom: 0;
+ border-left: none;
+ }
+ .stepNum {
+ width: 30px;
+ height: 30px;
+ border-radius: 15px;
+ box-sizing: border-box;
+ color: #333;
+ border: 1px solid #999;
+ line-height: 28px;
+ text-align: center;
+ margin-right: 10px;
+ margin-left: -16px;
+ margin-top: -30px;
+ }
+ .stepCard {
+ width: 100%;
+ margin-top: -30px;
+
+ .box-card {
+ width: 100%;
+ &:deep(.el-card__header) {
+ padding: 10px 15px;
+ }
+ .card-header {
+ width: 100%;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ & > div:first-of-type {
+ margin-right: 80px;
+ font-size: 18px;
+ font-weight: bold;
+ }
+ }
+ }
+ }
+ &:hover .card-header {
+ color: #0098f5;
+ }
+ &:hover .stepNum {
+ border: 2px solid #0098f5;
+ color: #0098f5;
+ }
+}
+.el-input {
+ width: 100% !important;
+}
+:deep(.el-date-editor) {
+ width: 100%;
+}
+.el-select {
+ width: 100%;
+}
+:deep(.el-textarea.is-disabled .el-textarea__inner) {
+ background-color: var(--el-card-bg-color);
+ color: var(--el-input-text-color, var(--el-text-color-regular));
+}
+:deep(.el-input.is-disabled .el-input__inner) {
+ color: var(--el-input-text-color, var(--el-text-color-regular));
+}
+:deep(.el-input.is-disabled .el-input__wrapper) {
+ background-color: var(--el-card-bg-color);
+}
+</style>
--
Gitblit v1.9.2