| <template> | 
|   <TableLayout :permissions="['business:ddnoticeconfig:query']"> | 
|   | 
|     <!-- 表格和分页 --> | 
|     <template v-slot:table-wrap> | 
|       <ul class="toolbar"> | 
|         <li><el-button type="primary" @click="batchStatus(0)">批量启用</el-button></li> | 
|         <li><el-button @click="batchStatus(1)">批量禁用</el-button></li> | 
|       </ul> | 
|       <el-table | 
|         :height="tableHeightNew" | 
|         v-loading="isWorking.search" | 
|         :data="tableData.list" | 
|         stripe | 
|         @selection-change="handleSelectionChange" | 
|       > | 
|         <el-table-column align="center" type="selection" width="55"></el-table-column> | 
|         <el-table-column prop="titile" label="标题"></el-table-column> | 
|         <el-table-column prop="status" label="状态" width="150px"> | 
|           <template slot-scope="{row}"> | 
|             <el-switch | 
|               v-model="row.status" | 
|               @change="changeStatus(row)" | 
|               active-color="#13ce66" | 
|               inactive-color="#ff4949" | 
|               :active-value="0" | 
|               :inactive-value="1"> | 
|             </el-switch> | 
|           </template> | 
|         </el-table-column> | 
|       </el-table> | 
|       <pagination | 
|         @size-change="handleSizeChange" | 
|         @current-change="handlePageChange" | 
|         :pagination="tableData.pagination" | 
|       > | 
|       </pagination> | 
|     </template> | 
|   </TableLayout> | 
| </template> | 
|   | 
| <script> | 
| import BaseTable from '@/components/base/BaseTable' | 
| import TableLayout from '@/layouts/TableLayout' | 
| import Pagination from '@/components/common/Pagination' | 
| import { H5ddNoticeConfig } from '@/api/business/ddNoticeConfig' | 
| import { Message } from 'element-ui' | 
| export default { | 
|   name: 'DdNoticeConfig', | 
|   extends: BaseTable, | 
|   components: { TableLayout, Pagination }, | 
|   data () { | 
|     return { | 
|       // 搜索 | 
|       searchForm: {}, | 
|       ids: [] | 
|     } | 
|   }, | 
|   created () { | 
|     this.config({ | 
|       module: '钉钉公众号通知配置', | 
|       api: '/business/ddNoticeConfig', | 
|       'field.id': 'id', | 
|       'field.main': 'id' | 
|     }) | 
|     this.search() | 
|   }, | 
|   methods: { | 
|     handleSelectionChange(val) { | 
|       this.ids = val.map(i => i.id) | 
|     }, | 
|     batchStatus(status) { | 
|       const { ids } = this | 
|       if (ids.length == 0) return Message.error('请先选择要更改的通知') | 
|       this.$confirm(`确定${status == 0 ? '启用' : '禁用'}选中的所有通知吗?`, '提示', { | 
|         confirmButtonText: '确定', | 
|         cancelButtonText: '取消', | 
|         type: 'warning' | 
|       }).then(() => { | 
|         H5ddNoticeConfig({ | 
|           ids: ids.join(','), | 
|           status | 
|         }).then(res => { | 
|           Message.success('批量更新成功') | 
|           this.search() | 
|         }, () => { | 
|           this.search() | 
|         }) | 
|       }) | 
|     }, | 
|     changeStatus(row) { | 
|       H5ddNoticeConfig({ | 
|         ids: row.id, | 
|         status: row.status | 
|       }).then(res => { | 
|         Message.success('状态更新成功') | 
|       }, () => { | 
|         this.search() | 
|       }) | 
|     }, | 
|   } | 
| } | 
| </script> |