|  |  |  | 
|---|
|  |  |  | <template> | 
|---|
|  |  |  | <div class="main_app"> | 
|---|
|  |  |  | <div class="mb20"> | 
|---|
|  |  |  | <el-button type="primary" @click="handleEdit()">新增</el-button> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <el-table v-loading="loading" :data="list" stripe> | 
|---|
|  |  |  | <el-table-column | 
|---|
|  |  |  | prop="name" | 
|---|
|  |  |  | label="隐患类型" | 
|---|
|  |  |  | min-width="100" | 
|---|
|  |  |  | show-overflow-tooltip | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | <el-table-column | 
|---|
|  |  |  | prop="name" | 
|---|
|  |  |  | label="排序码" | 
|---|
|  |  |  | min-width="100" | 
|---|
|  |  |  | show-overflow-tooltip | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | <el-table-column | 
|---|
|  |  |  | prop="name" | 
|---|
|  |  |  | label="操作" | 
|---|
|  |  |  | min-width="80" | 
|---|
|  |  |  | align="center" | 
|---|
|  |  |  | show-overflow-tooltip | 
|---|
|  |  |  | <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.name" 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:hiddendangerparam:create','business:hiddendangerparam:delete']"> | 
|---|
|  |  |  | <li><el-button type="primary" @click="$refs.OperaHiddenDangerParamWindow.open('新建隐患类型',null,searchForm.type)" icon="el-icon-plus" v-permissions="['business:hiddendangerparam:create']">新建</el-button></li> | 
|---|
|  |  |  | <li><el-button type="danger" @click="deleteByIdInBatch" icon="el-icon-delete" v-permissions="['business:hiddendangerparam:delete']">批量删除</el-button></li> | 
|---|
|  |  |  | </ul> | 
|---|
|  |  |  | <el-table | 
|---|
|  |  |  | v-loading="isWorking.search" | 
|---|
|  |  |  | :data="tableData.list" | 
|---|
|  |  |  | stripe | 
|---|
|  |  |  | @selection-change="handleSelectionChange" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <template v-slot="scope"> | 
|---|
|  |  |  | <el-button type="text" @click="handleEdit(scope.row)">编辑</el-button> | 
|---|
|  |  |  | <el-button type="text" class="red" @click="handleDel(scope.row)" | 
|---|
|  |  |  | >删除</el-button | 
|---|
|  |  |  | > | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  | </el-table-column> | 
|---|
|  |  |  | </el-table> | 
|---|
|  |  |  | <pagination | 
|---|
|  |  |  | @size-change="handleSizeChange" | 
|---|
|  |  |  | @current-change="getList" | 
|---|
|  |  |  | :pagination="pagination" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | <el-dialog | 
|---|
|  |  |  | :title="param.id ? '编辑隐患类型' : '新增隐患类型'" | 
|---|
|  |  |  | :visible.sync="isShowEdit" | 
|---|
|  |  |  | width="480px" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <el-form :model="param" :rules="rules" ref="ruleForm" label-width="100px"> | 
|---|
|  |  |  | <el-form-item label="隐患类型" prop="name"> | 
|---|
|  |  |  | <el-input v-model="param.aaa"></el-input> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | <el-form-item label="排序码(升序)" prop="name"> | 
|---|
|  |  |  | <el-input | 
|---|
|  |  |  | oninput="value=value.replace(/^(0+)|[^\d]+/g, '').slice(0, 7)" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </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="name" 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:hiddendangerparam:update', 'business:hiddendangerparam:delete' ])" | 
|---|
|  |  |  | label="操作" | 
|---|
|  |  |  | min-width="250" | 
|---|
|  |  |  | fixed="right" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <template slot-scope="{row}"> | 
|---|
|  |  |  | <el-button type="text" icon="el-icon-edit" @click="$refs.OperaHiddenDangerParamWindow.open('编辑隐患类型',row,searchForm.type)" v-permissions="['business:hiddendangerparam:update']">编辑</el-button> | 
|---|
|  |  |  | <el-button  type="text"  icon="el-icon-delete" @click="deleteById(row)" style="color: red" v-permissions="['business:hiddendangerparam:delete']">删除</el-button> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  | </el-table-column> | 
|---|
|  |  |  | </el-table> | 
|---|
|  |  |  | <pagination | 
|---|
|  |  |  | @size-change="handleSizeChange" | 
|---|
|  |  |  | @current-change="handlePageChange" | 
|---|
|  |  |  | :pagination="tableData.pagination" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | </pagination> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  | <!-- 新建/修改 --> | 
|---|
|  |  |  | <OperaHiddenDangerParamWindow ref="OperaHiddenDangerParamWindow" @success="handlePageChange"/> | 
|---|
|  |  |  | </TableLayout> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <script> | 
|---|
|  |  |  | import BaseTable from '@/components/base/BaseTable' | 
|---|
|  |  |  | import TableLayout from '@/layouts/TableLayout' | 
|---|
|  |  |  | import Pagination from '@/components/common/Pagination' | 
|---|
|  |  |  | import OperaHiddenDangerParamWindow from '@/components/business/OperaHiddenDangerParamWindow' | 
|---|
|  |  |  | export default { | 
|---|
|  |  |  | components: { | 
|---|
|  |  |  | Pagination | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | name: 'areaSet', | 
|---|
|  |  |  | extends: BaseTable, | 
|---|
|  |  |  | components: { TableLayout, Pagination, OperaHiddenDangerParamWindow }, | 
|---|
|  |  |  | data () { | 
|---|
|  |  |  | return { | 
|---|
|  |  |  | loading: false, | 
|---|
|  |  |  | pagination: { | 
|---|
|  |  |  | capacity: 10, | 
|---|
|  |  |  | page: 1 | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | list: [], | 
|---|
|  |  |  | total: 0, | 
|---|
|  |  |  | isShowEdit: false, | 
|---|
|  |  |  | param: {}, | 
|---|
|  |  |  | rules: {} | 
|---|
|  |  |  | // 搜索 | 
|---|
|  |  |  | searchForm: { | 
|---|
|  |  |  | name: '', | 
|---|
|  |  |  | type:1 | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | created () { | 
|---|
|  |  |  | this.config({ | 
|---|
|  |  |  | module: '隐患随手拍配置类型', | 
|---|
|  |  |  | api: '/business/hiddenDangerParam', | 
|---|
|  |  |  | 'field.id': 'id', | 
|---|
|  |  |  | 'field.main': 'id' | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | this.search() | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | methods: { | 
|---|
|  |  |  | handleSub () { | 
|---|
|  |  |  | this.$refs.ruleForm.validate((valid) => { | 
|---|
|  |  |  | if (valid) { | 
|---|
|  |  |  | alert('submit!') | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | getList (page) { }, | 
|---|
|  |  |  | clear () { }, | 
|---|
|  |  |  | handleEdit (row) { | 
|---|
|  |  |  | this.isShowEdit = true | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | handleDel () { }, | 
|---|
|  |  |  | handleSizeChange (capacity) { | 
|---|
|  |  |  | this.pagination.capacity = capacity | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <style> | 
|---|
|  |  |  | </style> | 
|---|