|  |  |  | 
|---|
|  |  |  | <ul class="toolbar" v-permissions="['business:ywpatrolline:create', 'business:ywpatrolline:delete']"> | 
|---|
|  |  |  | <li><el-button type="primary" @click="editClick()" icon="el-icon-plus" | 
|---|
|  |  |  | v-permissions="['business:ywpatrolline:create']">新建</el-button></li> | 
|---|
|  |  |  | <li><el-button @click="deleteByIdInBatch" icon="el-icon-delete" | 
|---|
|  |  |  | v-permissions="['business:ywpatrolline:delete']">删除</el-button></li> | 
|---|
|  |  |  | <!-- <li><el-button @click="deleteByIdInBatch" icon="el-icon-delete" | 
|---|
|  |  |  | v-permissions="['business:ywpatrolline:delete']">删除</el-button></li> --> | 
|---|
|  |  |  | </ul> | 
|---|
|  |  |  | <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="lineAmount" label="巡检点数量" min-width="100px"></el-table-column> | 
|---|
|  |  |  | <el-table-column prop="status" label="状态" min-width="100px"> | 
|---|
|  |  |  | <template v-slot="scope"> | 
|---|
|  |  |  | <el-switch v-model="scope.row.status" @change="changeStatus" active-value="0" inactive-value="1"> | 
|---|
|  |  |  | <el-switch v-model="scope.row.status" @change="e => changeStatus(scope.row)" :active-value="0" :inactive-value="1"> | 
|---|
|  |  |  | </el-switch> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  | </el-table-column> | 
|---|
|  |  |  | 
|---|
|  |  |  | import TableLayout from '@/layouts/TableLayout' | 
|---|
|  |  |  | import Pagination from '@/components/common/Pagination' | 
|---|
|  |  |  | import OperaYwPatrolLineWindow from './components/OperaYwPatrolLineWindow' | 
|---|
|  |  |  | import { updateStatusById } from '@/api/Inspection/ywPatrolLine' | 
|---|
|  |  |  | import { Message } from 'element-ui' | 
|---|
|  |  |  | export default { | 
|---|
|  |  |  | name: 'YwPatrolLine', | 
|---|
|  |  |  | extends: BaseTable, | 
|---|
|  |  |  | 
|---|
|  |  |  | this.search() | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | methods: { | 
|---|
|  |  |  | changeStatus() { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | changeStatus(row) { | 
|---|
|  |  |  | updateStatusById({ | 
|---|
|  |  |  | id: row.id, | 
|---|
|  |  |  | status: row.status | 
|---|
|  |  |  | }).then(res => { | 
|---|
|  |  |  | Message.success('更新成功') | 
|---|
|  |  |  | this.search() | 
|---|
|  |  |  | }, () => { | 
|---|
|  |  |  | this.search() | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | editClick(row) { | 
|---|
|  |  |  | if (row && row.id) { | 
|---|
|  |  |  | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | this.$refs.operaYwPatrolLineWindow.open('新建巡检线路') | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.$refs.operaYwPatrolLineWindow.list = [] | 
|---|
|  |  |  | this.$refs.operaYwPatrolLineWindow.initData() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }, | 
|---|