huibing.xie | 1f1606f | 2018-08-20 15:46:55 +0800 | [diff] [blame^] | 1 | <template> |
| 2 | <div class="app-container"> |
| 3 | <div class="filter-container"> |
| 4 | <el-input @keyup.enter.native="handleFilter" style="width: 200px;" class="filter-item" placeholder="代码" v-model="listQuery.dm"> |
| 5 | </el-input> |
| 6 | <el-input @keyup.enter.native="handleFilter" style="width: 200px;" class="filter-item" placeholder="名称" v-model="listQuery.mc"> |
| 7 | </el-input> |
| 8 | <el-input @keyup.enter.native="handleFilter" style="width: 200px;" class="filter-item" placeholder="条件" v-model="listQuery.tj"> |
| 9 | </el-input> |
| 10 | <el-input @keyup.enter.native="handleFilter" style="width: 200px;" class="filter-item" placeholder="排序" v-model="listQuery.px"> |
| 11 | </el-input> |
| 12 | <el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">查询</el-button> |
| 13 | <el-button class="filter-item" style="margin-left: 10px;" @click="handleCreate(null, 'create')" type="primary" icon="el-icon-edit">添加</el-button> |
| 14 | <el-button class="filter-item" style="margin-left: 10px;" @click="handleReset" type="primary" icon="el-icon-edit">重置</el-button> |
| 15 | </div> |
| 16 | <el-table :height="height" :data="items" v-loading="listLoading" element-loading-text="Loading" border fit highlight-current-row> |
| 17 | <el-table-column align="center" label='代码' width="195"> |
| 18 | <template slot-scope="scope"> |
| 19 | {{scope.row.dm}} |
| 20 | </template> |
| 21 | </el-table-column> |
| 22 | <el-table-column label="名称" align="center"> |
| 23 | <template slot-scope="scope"> |
| 24 | {{scope.row.mc}} |
| 25 | </template> |
| 26 | </el-table-column> |
| 27 | <el-table-column label="条件" align="center"> |
| 28 | <template slot-scope="scope"> |
| 29 | <span>{{scope.row.tj}}</span> |
| 30 | </template> |
| 31 | </el-table-column> |
| 32 | <el-table-column label="排序" align="center"> |
| 33 | <template slot-scope="scope"> |
| 34 | <span>{{scope.row.px}}</span> |
| 35 | </template> |
| 36 | </el-table-column> |
| 37 | <el-table-column |
| 38 | fixed="right" |
| 39 | header-align="center" |
| 40 | align="center" |
| 41 | width="150" |
| 42 | label="操作"> |
| 43 | <template slot-scope="scope"> |
| 44 | <el-button type="text" size="small" @click="handleCreate(scope.row.id, 'update')">修改</el-button> |
| 45 | <el-button type="text" size="small" @click="handleDelete(scope.row.id)">删除</el-button> |
| 46 | </template> |
| 47 | </el-table-column> |
| 48 | </el-table> |
| 49 | <div class="pagination-container"> |
| 50 | <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="listQuery.pageIndex" :page-sizes="[10,20,30, 50]" :page-size="listQuery.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="recordCount"> |
| 51 | </el-pagination> |
| 52 | </div> |
| 53 | |
| 54 | <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible"> |
| 55 | <el-form :rules="rules" ref="dataForm" :model="temp" label-position="left" label-width="150px" style='width: 400px; margin-left:50px;'> |
| 56 | <el-form-item label="代码" prop="dm"> |
| 57 | <el-input v-model="temp.dm"></el-input> |
| 58 | <input type="hidden" v-model="temp.id" /> |
| 59 | </el-form-item> |
| 60 | <el-form-item label="名称" prop="mc"> |
| 61 | <el-input v-model="temp.mc"></el-input> |
| 62 | </el-form-item> |
| 63 | <el-form-item label="条件" prop="tj"> |
| 64 | <el-input type="textarea" :rows="2" v-model="temp.tj"></el-input> |
| 65 | </el-form-item> |
| 66 | <el-form-item label="排序" prop="px"> |
| 67 | <el-input v-model="temp.px"></el-input> |
| 68 | </el-form-item> |
| 69 | </el-form> |
| 70 | <div slot="footer" class="dialog-footer"> |
| 71 | <el-button @click="dialogFormVisible = false">返回</el-button> |
| 72 | <el-button type="primary" @click="createData">提交</el-button> |
| 73 | </div> |
| 74 | </el-dialog> |
| 75 | </div> |
| 76 | </template> |
| 77 | |
| 78 | <script> |
| 79 | import { getList, getItem, createRosterSyncInterface, deleteRosterSyncInterface } from '@/api/rostersyncinterface-api' |
| 80 | import waves from '@/directive/waves' // 水波纹指令 |
| 81 | import { resetForm } from '@/utils' |
| 82 | import { crudPageList, crudGetItem, crudCreate, crudDelete } from '@/utils/crud' |
| 83 | import mixindata from '@/utils/crud' |
| 84 | |
| 85 | const initData = { sfky: '1' } |
| 86 | export default { |
| 87 | name: 'rostersyncinterface', |
| 88 | directives: { |
| 89 | waves |
| 90 | }, |
| 91 | mixins: [mixindata], |
| 92 | data() { |
| 93 | return { |
| 94 | ssyxList: [], |
| 95 | sszygbList: [], |
| 96 | rules: { |
| 97 | zdshlxmc: [{ required: true, message: '自动审核类型名称必填', trigger: 'blur' }], |
| 98 | zdshlxsxl: [{ required: true, message: '自动审核类型实现类必填', trigger: 'blur' }] |
| 99 | } |
| 100 | } |
| 101 | }, |
| 102 | filters: { |
| 103 | statusFilter(status) { |
| 104 | const statusMap = { |
| 105 | '1': 'success', |
| 106 | '0': 'danger' |
| 107 | } |
| 108 | return statusMap[status] |
| 109 | } |
| 110 | }, |
| 111 | created() { |
| 112 | this.handlePageList() |
| 113 | this.height = window.innerHeight - 216 |
| 114 | }, |
| 115 | methods: { |
| 116 | handlePageList() { |
| 117 | crudPageList(this, getList) |
| 118 | }, |
| 119 | handleCreate(rowid, dialogStatus) { |
| 120 | this.dialogStatus = dialogStatus |
| 121 | crudGetItem(this, getItem, rowid, initData) |
| 122 | }, |
| 123 | handleReset() { |
| 124 | resetForm(this.listQuery) |
| 125 | }, |
| 126 | handleFilter() { |
| 127 | this.listQuery.pageIndex = 1 |
| 128 | this.handlePageList() |
| 129 | }, |
| 130 | handleSizeChange(val) { |
| 131 | this.listQuery.pageSize = val |
| 132 | this.handlePageList() |
| 133 | }, |
| 134 | handleCurrentChange(val) { |
| 135 | this.listQuery.pageIndex = val |
| 136 | this.handlePageList() |
| 137 | }, |
| 138 | createData() { |
| 139 | crudCreate(this, createRosterSyncInterface, this.handlePageList) |
| 140 | }, |
| 141 | handleDelete(rowid) { |
| 142 | crudDelete(this, deleteRosterSyncInterface, rowid, this.handlePageList) |
| 143 | } |
| 144 | } |
| 145 | } |
| 146 | </script> |