|  |  | 
 |  |  | <template> | 
 |  |  |   <div class="main_app"> | 
 |  |  |     <div class="table_btns"> | 
 |  |  |       <el-button icon="el-icon-plus" @click="handleEdit()" type="primary" | 
 |  |  |         >新建</el-button | 
 |  |  |   <TableLayout :permissions="['business:member:query']"> | 
 |  |  |     <!-- 搜索表单 --> | 
 |  |  |     <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="120px" inline> | 
 |  |  |       <el-form-item label="拜访事由" prop="name"> | 
 |  |  |         <el-input v-model="searchForm.title" clearable placeholder="请输入拜访事由" @keypress.enter.native="search"></el-input> | 
 |  |  |       </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> | 
 |  |  |       <ul class="toolbar" v-permissions="['business:visitreason:create','business:visitreason:delete']"> | 
 |  |  |         <li><el-button type="primary" @click="$refs.OperaVisitreasonWindow.open('新建拜访事由',null,searchForm.type)" icon="el-icon-plus" v-permissions="['business:visitreason:create']">新建</el-button></li> | 
 |  |  |         <li><el-button type="danger" @click="deleteByIdInBatch" icon="el-icon-delete" v-permissions="['business:visitreason:delete']">批量删除</el-button></li> | 
 |  |  |       </ul> | 
 |  |  |       <el-table | 
 |  |  |           v-loading="isWorking.search" | 
 |  |  |           :data="tableData.list" | 
 |  |  |           stripe | 
 |  |  |           @selection-change="handleSelectionChange" | 
 |  |  |       > | 
 |  |  |     </div> | 
 |  |  |     <el-table v-loading="loading" :data="list" stripe> | 
 |  |  |       <el-table-column | 
 |  |  |         prop="name" | 
 |  |  |         label="拜访事由" | 
 |  |  |         min-width="100" | 
 |  |  |       ></el-table-column> | 
 |  |  |       <el-table-column | 
 |  |  |         prop="name" | 
 |  |  |         label="排序码" | 
 |  |  |         min-width="80" | 
 |  |  |       ></el-table-column> | 
 |  |  |       <el-table-column label="操作" width="230" fixed="right"> | 
 |  |  |         <!-- v-permissions="['business:company:update']" --> | 
 |  |  |         <template slot-scope="{ row }"> | 
 |  |  |           <el-button type="text" icon="el-icon-edit" @click="handleEdit(row)" | 
 |  |  |             >编辑</el-button | 
 |  |  |           > | 
 |  |  |           <el-button | 
 |  |  |             type="text" | 
 |  |  |             icon="el-icon-delete" | 
 |  |  |             @click="handleDetail(row)" | 
 |  |  |             class="red" | 
 |  |  |             >删除</el-button | 
 |  |  |           > | 
 |  |  |         </template> | 
 |  |  |       </el-table-column> | 
 |  |  |     </el-table> | 
 |  |  |     <pagination | 
 |  |  |       @size-change="handleSizeChange" | 
 |  |  |       @current-change="getList" | 
 |  |  |       :pagination="pagination" | 
 |  |  |     /> | 
 |  |  |     <!--  --> | 
 |  |  |     <el-dialog title="拜访事由" :visible.sync="isShowEdit" width="480px"> | 
 |  |  |       <el-form :model="param" :rules="rules" ref="ruleForm" label-width="100px"> | 
 |  |  |         <el-form-item label="拜访事由"> | 
 |  |  |           <el-input type="text" placeholder="请输入" v-model="param.explain" /> | 
 |  |  |         </el-form-item> | 
 |  |  |         <el-form-item label="排序码"> | 
 |  |  |           <el-input | 
 |  |  |             type="text" | 
 |  |  |             placeholder="请输入" | 
 |  |  |             oninput="value=value.replace(/^(0+)|[^\d]+/g, '').slice(0, 6)" | 
 |  |  |             v-model="param.sortNum" | 
 |  |  |           /> | 
 |  |  |         </el-form-item> | 
 |  |  |       </el-form> | 
 |  |  |       <span slot="footer" class="dialog-footer"> | 
 |  |  |         <el-button @click="isShowEdit = false">取消</el-button> | 
 |  |  |         <el-button type="primary" @click="handleSub">确定</el-button> | 
 |  |  |       </span> | 
 |  |  |     </el-dialog> | 
 |  |  |   </div> | 
 |  |  |         <el-table-column type="selection" width="55"></el-table-column> | 
 |  |  |         <el-table-column prop="title" label="拜访事由" min-width="200px"></el-table-column> | 
 |  |  |         <el-table-column prop="sortnum" label="排序码"  min-width="100px"></el-table-column> | 
 |  |  |         <el-table-column prop="editDate" label="操作时间" min-width="200px"></el-table-column> | 
 |  |  |         <el-table-column | 
 |  |  |             v-if="containPermissions(['business:visitreason:update', 'business:visitreason:delete' ])" | 
 |  |  |             label="操作" | 
 |  |  |             min-width="250" | 
 |  |  |             fixed="right" | 
 |  |  |         > | 
 |  |  |           <template slot-scope="{row}"> | 
 |  |  |             <el-button type="text" icon="el-icon-edit" @click="$refs.OperaVisitreasonWindow.open('编辑拜访事由',row,searchForm.type)" v-permissions="['business:visitreason:update']">编辑</el-button> | 
 |  |  |             <el-button  type="text"  icon="el-icon-delete" @click="deleteById(row)" style="color: red" v-permissions="['business:visitreason:delete']">删除</el-button> | 
 |  |  |           </template> | 
 |  |  |         </el-table-column> | 
 |  |  |       </el-table> | 
 |  |  |       <pagination | 
 |  |  |           @size-change="handleSizeChange" | 
 |  |  |           @current-change="handlePageChange" | 
 |  |  |           :pagination="tableData.pagination" | 
 |  |  |       > | 
 |  |  |       </pagination> | 
 |  |  |     </template> | 
 |  |  |     <!-- 新建/修改 --> | 
 |  |  |     <OperaVisitreasonWindow ref="OperaVisitreasonWindow" @success="handlePageChange"/> | 
 |  |  |   </TableLayout> | 
 |  |  | </template> | 
 |  |  |  | 
 |  |  | <script> | 
 |  |  | import BaseTable from '@/components/base/BaseTable' | 
 |  |  | import TableLayout from '@/layouts/TableLayout' | 
 |  |  | import Pagination from '@/components/common/Pagination' | 
 |  |  | import OperaVisitreasonWindow from '@/components/business/OperaVisitreasonWindow' | 
 |  |  | export default { | 
 |  |  |   components: { | 
 |  |  |     Pagination | 
 |  |  |   }, | 
 |  |  |   data() { | 
 |  |  |   name: 'areaSet', | 
 |  |  |   extends: BaseTable, | 
 |  |  |   components: { TableLayout, Pagination, OperaVisitreasonWindow }, | 
 |  |  |   data () { | 
 |  |  |     return { | 
 |  |  |       loading: false, | 
 |  |  |       pagination: { | 
 |  |  |         capacity: 10, | 
 |  |  |         page: 1 | 
 |  |  |       }, | 
 |  |  |       list: [{}], | 
 |  |  |       total: 0, | 
 |  |  |  | 
 |  |  |       isShowEdit: false, | 
 |  |  |       param: {}, | 
 |  |  |       rules: {} | 
 |  |  |       // 搜索 | 
 |  |  |       searchForm: { | 
 |  |  |         title: '' | 
 |  |  |       } | 
 |  |  |     } | 
 |  |  |   }, | 
 |  |  |   created () { | 
 |  |  |     this.config({ | 
 |  |  |       module: '拜访事由配置', | 
 |  |  |       api: '/business/visitReason', | 
 |  |  |       'field.id': 'id', | 
 |  |  |       'field.main': 'id' | 
 |  |  |     }) | 
 |  |  |     this.search() | 
 |  |  |   }, | 
 |  |  |   methods: { | 
 |  |  |     handleSub() { | 
 |  |  |       this.$refs.ruleForm.validate((valid) => { | 
 |  |  |         if (valid) { | 
 |  |  |           alert('submit!') | 
 |  |  |         } | 
 |  |  |       }) | 
 |  |  |     }, | 
 |  |  |     handleEdit() { | 
 |  |  |       this.isShowEdit = true | 
 |  |  |     }, | 
 |  |  |     getList(page) { }, | 
 |  |  |     clear() { }, | 
 |  |  |     handleSizeChange(capacity) { | 
 |  |  |       this.pagination.capacity = capacity | 
 |  |  |     } | 
 |  |  |   } | 
 |  |  | } | 
 |  |  | </script> | 
 |  |  |  | 
 |  |  | <style> | 
 |  |  | </style> |