From d91fd1557ebed3e9bcb8c051c71b9d41c0e36eef Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: Tue, 02 Apr 2024 16:50:07 +0800
Subject: [PATCH] Default Changelist
---
src/views/intellectInspect/inspectTaskManage/inspectTask/index.vue | 161 +++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 130 insertions(+), 31 deletions(-)
diff --git a/src/views/intellectInspect/inspectTaskManage/inspectTask/index.vue b/src/views/intellectInspect/inspectTaskManage/inspectTask/index.vue
index 9dc80c7..bb6a6fd 100644
--- a/src/views/intellectInspect/inspectTaskManage/inspectTask/index.vue
+++ b/src/views/intellectInspect/inspectTaskManage/inspectTask/index.vue
@@ -1,12 +1,19 @@
<template>
<div class="home-container">
- <div style="height: 100%">
+ <div style="height: 100%;display: flex;flex-direction: column;align-items: stretch;">
<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-cascader class="input-box" :options="departmentList" :props="{ emitPath: false, checkStrictly: true, value: 'depId', label: 'depName' }"
+ placeholder="请选择部门" clearable v-model="tableData.params.execDepId"
+ @change="changeGroup"
+ > </el-cascader>
</div>
<div class="basic-line">
<span>执行班组:</span>
@@ -23,13 +30,14 @@
<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="primary" :icon="Plus" size="default" @click="openInspectTaskDialog('新增', {})">新增</el-button>
+ <el-button type="primary" :icon="Upload" size="default" @click="openUploadDialog('任务')">导入</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 type="selection" width="55" />-->
<el-table-column property="unitName" label="任务名称" />
<el-table-column property="workType" label="任务类型">
<template #default="scope">
@@ -80,12 +88,27 @@
<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="status" label="状态" width="60" />
+ <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" @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>
@@ -99,15 +122,17 @@
</div>
</div>
<inspect-task-dialog ref="inspectTaskDialogRef" @refreshInspectTask="getInspectionTask"></inspect-task-dialog>
+ <upload-dialog ref="uploadRef" @refresh="getInspectionTask"></upload-dialog>
</div>
</template>
<script lang="ts">
import { toRefs, reactive, ref, onMounted } from 'vue';
-import { Edit, View, Plus, Delete, Refresh, Search, Download } from '@element-plus/icons-vue';
+import { Edit, View, Plus, Delete, Refresh, Search, Download, Upload } 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 inspectTaskDialog from './components/inspectTaskDialog.vue'
+import uploadDialog from './components/upload.vue'
import { departmentApi } from '/@/api/systemManage/department';
import { teamManageApi } from '/@/api/systemManage/personShiftManage/teamManage';
import { inspectPointApi } from '/@/api/intellectInspectSystem/inspectPointManage';
@@ -128,6 +153,7 @@
params: {
pageIndex: number | null;
pageSize: number | null;
+ execDepId: number | null;
unitName: string | null;
workType: number | null;
createUserId: number | null;
@@ -155,9 +181,10 @@
}
export default {
name: 'index',
- components: { inspectTaskDialog },
+ components: { inspectTaskDialog, uploadDialog },
setup() {
const inspectTaskDialogRef = ref();
+ const uploadRef = ref()
const state = reactive<stateType>({
tableData: {
inspectTaskData: [],
@@ -167,6 +194,7 @@
pageIndex: 1,
pageSize: 10,
unitName: null,
+ execDepId: null,
workType: null,
createUserId: null,
execClassgroupId: null,
@@ -175,8 +203,8 @@
}
},
workTypeList: [
- { id: 1, name: '日常任务' },
- { id: 2, name: '周期任务' }
+ { id: 1, name: '周期任务' },
+ { id: 2, name: '单次任务' }
],
quotaList: [],
departmentList: [],
@@ -190,7 +218,7 @@
{ id: 3, name: '日' },
{ id: 4, name: '月' },
{ id: 5, name: '年' }
- ]
+ ],
});
//获取巡检任务数据
@@ -221,17 +249,29 @@
};
//获取部门
- 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 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 getQuotaList = async () => {
+ let res = await inspectTaskApi().getAllQuotaList();
+ if (res.data.code === '200') {
+ state.quotaList = res.data.data;
+ } else {
+ ElMessage({
+ type: 'warning',
+ message: res.data.msg
+ });
+ }
+ };
//获取巡检点
const getInspectTaskPoint = async () => {
@@ -285,6 +325,19 @@
}
};
+ const changeGroup = async () => {
+ if(state.tableData.params.execDepId === null) {
+ state.classGroupList = []
+ }else{
+ let res = await departmentApi().getByDepId({depId:state.tableData.params.execDepId})
+ if(res.data.code === '200'){
+ state.classGroupList = res.data.data
+ }else{
+
+ }
+ }
+ };
+
const changeStatus = async (value: { taskUnitStatus: number; id: number }) => {
if (value.taskUnitStatus === 2) {
ElMessageBox.confirm(`此操作将关闭该巡检任务”,是否继续?`, '提示', {
@@ -295,6 +348,7 @@
.then(async () => {
let res = await inspectTaskApi().openOrCloseInspectTask({ id: value.id, taskUnitStatus: 2 });
if (res.data.code === '200') {
+ await getInspectionTask();
ElMessage({
type: 'success',
duration: 2000,
@@ -307,9 +361,7 @@
});
}
})
- .catch((error) => {
- debugger;
- });
+ .catch((error) => {});
} else {
ElMessageBox.confirm(`此操作将开启该巡检任务”,是否继续?`, '提示', {
confirmButtonText: '确认',
@@ -319,6 +371,7 @@
.then(async () => {
let res = await inspectTaskApi().openOrCloseInspectTask({ id: value.id, taskUnitStatus: 1 });
if (res.data.code === '200') {
+ await getInspectionTask();
ElMessage({
type: 'success',
duration: 2000,
@@ -336,6 +389,32 @@
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);
};
@@ -349,6 +428,10 @@
return state.classGroupList.find((item) => item.id == value)?.groupName;
}
};
+
+ const openUploadDialog = (type: string)=>{
+ uploadRef.value.open(type)
+ }
// 分页改变
const onHandleSizeChange = (val: number) => {
@@ -366,6 +449,7 @@
pageIndex: 1,
pageSize: 10,
unitName: null,
+ execDepId: null,
workType: null,
createUserId: null,
execClassgroupId: null,
@@ -391,13 +475,18 @@
Delete,
Refresh,
Plus,
+ Upload,
reset,
+ openUploadDialog,
changeStatus,
+ changeGroup,
parseNumber,
+ deleteInspectTask,
getInspectionTask,
onHandleSizeChange,
onHandleCurrentChange,
inspectTaskDialogRef,
+ uploadRef,
openInspectTaskDialog,
...toRefs(state)
};
@@ -408,15 +497,17 @@
<style scoped lang="scss">
$homeNavLengh: 8;
.home-container {
- height: calc(100vh - 114px);
+ height: calc(100vh - 144px);
box-sizing: border-box;
overflow: hidden;
+ position: relative;
.homeCard {
width: 100%;
padding: 20px;
box-sizing: border-box;
background: #fff;
border-radius: 4px;
+ flex: 0 auto;
.main-card {
width: 100%;
@@ -431,10 +522,18 @@
}
}
.pageBtn {
- height: 60px;
- display: flex;
- align-items: center;
- justify-content: right;
+ position: absolute;
+ width: 100%;
+ z-index: 99;
+ bottom: 0;
+ right: 0;
+ height: 60px;
+ border-radius: 0 0 4px 4px;
+ padding-right: 20px;
+ background: #fff;
+ display: flex;
+ align-items: center;
+ justify-content: right;
.demo-pagination-block + .demo-pagination-block {
margin-top: 10px;
@@ -445,7 +544,7 @@
}
}
&:last-of-type {
- height: calc(100% - 100px);
+ flex: 1;
}
}
.el-row {
--
Gitblit v1.9.2