| <template> | 
|   <TableLayout :permissions="['business:ywpatroltask:query']"> | 
|     <!-- 搜索表单 --> | 
|     <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline> | 
|       <el-form-item label="计划名称" prop="planTitle"> | 
|         <el-input v-model="searchForm.planTitle" placeholder="请输入计划名称" @keypress.enter.native="search"></el-input> | 
|       </el-form-item> | 
|       <el-form-item label="任务状态"> | 
|         <el-select v-model="searchForm.status" label="任务状态" filterable clearable> | 
|           <el-option value="0" label="待开始"></el-option> | 
|           <el-option value="1" label="进行中"></el-option> | 
|           <el-option value="2" label="已超期"></el-option> | 
|           <el-option value="3" label="已完成"></el-option> | 
|           <el-option value="4" label="已取消"></el-option> | 
|         </el-select> | 
|       </el-form-item> | 
|       <section> | 
|         <el-button type="primary" @click="search">搜索</el-button> | 
|   | 
|         <el-button @click="reset">重置</el-button> | 
|       </section> | 
|     </el-form> | 
|     <!-- 表格和分页 --> | 
|     <template v-slot:table-wrap> | 
|       <div> | 
|         <el-button type="primary" plain :loading="isWorking.export" | 
|           v-permissions="['business:ywpatroltask:exportExcel']" @click="exportExcel">导出</el-button> | 
|       </div> | 
|       <el-table v-loading="isWorking.search" :data="tableData.list" stripe @selection-change="handleSelectionChange"> | 
|         <el-table-column type="selection" width="55"></el-table-column> | 
|         <el-table-column prop="planTitle" label="计划名称" min-width="100px"></el-table-column> | 
|         <el-table-column prop="planCode" label="计划编号" min-width="100px"></el-table-column> | 
|         <el-table-column prop="code" label="任务编号" min-width="100px"></el-table-column> | 
|         <el-table-column prop="dealDate" label="任务时间" min-width="140px"> | 
|           <template v-slot="scope"> | 
|             <span v-if="scope.row.startDate && scope.row.endDate">{{ scope.row.startDate.slice(0, 16) }} - {{ | 
|               scope.row.endDate.slice(11, 16) }}</span> | 
|           </template> | 
|         </el-table-column> | 
|         <el-table-column prop="dealDate" label="实际完成时间" min-width="100px"></el-table-column> | 
|         <el-table-column prop="userName" label="执行人" min-width="100px"></el-table-column> | 
|         <el-table-column prop="dealStatus" label="任务状态" min-width="100px"> | 
|           <template v-slot="scope"> | 
|             <span class="primaryColor" v-if="scope.row.status == 0">待开始</span> | 
|             <span class="green" v-if="scope.row.status == 1">进行中</span> | 
|             <span class="red" v-if="scope.row.status == 2">已超期</span> | 
|             <span class="gray" v-if="scope.row.status == 3">已完成</span> | 
|             <span class="gray" v-if="scope.row.status == 4">已取消</span> | 
|           </template> | 
|         </el-table-column> | 
|         <el-table-column v-if="containPermissions(['business:ywpatroltask:update', 'business:ywpatroltask:delete'])" | 
|           label="操作" min-width="120" fixed="right"> | 
|           <template slot-scope="{row}"> | 
|             <el-button type="text" @click="handleDetail(row)">查看详情</el-button> | 
|             <el-button v-if="row.status == 0" type="text" class="red" @click="cancelById(row)" | 
|               v-permissions="['business:ywpatroltask:delete']">取消</el-button> | 
|           </template> | 
|         </el-table-column> | 
|       </el-table> | 
|       <pagination @size-change="handleSizeChange" @current-change="handlePageChange" :pagination="tableData.pagination"> | 
|       </pagination> | 
|     </template> | 
|     <!--  --> | 
|     <TaskDetail ref="TaskDetailRef" /> | 
|   </TableLayout> | 
| </template> | 
|   | 
| <script> | 
| import BaseTable from '@/components/base/BaseTable' | 
| import TableLayout from '@/layouts/TableLayout' | 
| import Pagination from '@/components/common/Pagination' | 
| import TaskDetail from './components/taskDetail' | 
| import { cancelById } from '@/api/Inspection/ywPatrolTask' | 
| import { Message } from 'element-ui' | 
| export default { | 
|   name: 'YwPatrolTask', | 
|   extends: BaseTable, | 
|   components: { TableLayout, Pagination, TaskDetail }, | 
|   data() { | 
|     return { | 
|       // 搜索 | 
|       searchForm: { | 
|         title: '', | 
|         status: '' | 
|       } | 
|     } | 
|   }, | 
|   created() { | 
|     this.config({ | 
|       module: '运维巡检任务信息表', | 
|       api: '/Inspection/ywPatrolTask', | 
|       'field.id': 'id', | 
|       'field.main': 'id' | 
|     }) | 
|     this.search() | 
|   }, | 
|   methods: { | 
|     handleDetail(row) { | 
|       this.$refs.TaskDetailRef.isShowModal = true | 
|       this.$refs.TaskDetailRef.id = row.id | 
|       this.$refs.TaskDetailRef.getDetail() | 
|     }, | 
|     cancelById(row) { | 
|       this.$confirm('确定取消当前任务, 是否继续?', '提示', { | 
|         confirmButtonText: '确定', | 
|         cancelButtonText: '取消', | 
|         type: 'warning' | 
|       }).then(() => { | 
|         cancelById(row.id).then(res => { | 
|           Message.success('取消成功') | 
|           this.search() | 
|         }) | 
|       }) | 
|       //  | 
|     }, | 
|   } | 
| } | 
| </script> |