|  |  |  | 
|---|
|  |  |  | :withFooter="false" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <el-form ref="searchForm" :model="searchForm" label-width="100px" inline> | 
|---|
|  |  |  | <el-form-item label="钥匙" prop="keyCode"> | 
|---|
|  |  |  | <el-input v-model="searchForm.keyCode" placeholder="请输入钥匙编码或名称" @keypress.enter.native="getList"></el-input> | 
|---|
|  |  |  | <el-form-item label="钥匙编码" prop="keyCode"> | 
|---|
|  |  |  | <el-input v-model="searchForm.keyCode" placeholder="请输入钥匙编码" @keypress.enter.native="getList"></el-input> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | <el-form-item label="状态" prop="status"> | 
|---|
|  |  |  | <el-select v-model="searchForm.status" placeholder="请选择" @change="getList"> | 
|---|
|  |  |  | 
|---|
|  |  |  | v-loading="loading" | 
|---|
|  |  |  | :data="list" | 
|---|
|  |  |  | stripe | 
|---|
|  |  |  | @selection-change="handleSelectionChange" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <el-table-column type="selection" width="55"></el-table-column> | 
|---|
|  |  |  | <el-table-column prop="code" label="柜格编码" min-width="100px"></el-table-column> | 
|---|
|  |  |  | <el-table-column prop="cabinetName" label="所属钥匙柜" min-width="100px"></el-table-column> | 
|---|
|  |  |  | <el-table-column prop="keyId" label="绑定钥匙" min-width="100px"> | 
|---|
|  |  |  | 
|---|
|  |  |  | return { | 
|---|
|  |  |  | id: null, | 
|---|
|  |  |  | info: null, | 
|---|
|  |  |  | ids: [], | 
|---|
|  |  |  | searchForm: { | 
|---|
|  |  |  | keyCode: '', | 
|---|
|  |  |  | status: '', | 
|---|
|  |  |  | 
|---|
|  |  |  | open (title, id) { | 
|---|
|  |  |  | this.title = title | 
|---|
|  |  |  | this.id = id | 
|---|
|  |  |  | this.searchForm = { | 
|---|
|  |  |  | keyCode: '', | 
|---|
|  |  |  | status: '', | 
|---|
|  |  |  | bindStatus: '' | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.getList() | 
|---|
|  |  |  | this.getKeysAll() | 
|---|
|  |  |  | this.visible = true | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | handleSelectionChange(e) { | 
|---|
|  |  |  | this.ids = e.map(item => item.id) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | getKeysAll() { | 
|---|
|  |  |  | list({  }) | 
|---|
|  |  |  | 
|---|
|  |  |  | if (type === 1) { | 
|---|
|  |  |  | obj.keyId = row.keyId | 
|---|
|  |  |  | } else if (type === 2) { | 
|---|
|  |  |  | if (!row.boardCode) return | 
|---|
|  |  |  | if (!/^[1-9]\d*$/.test(row.boardCode)) { | 
|---|
|  |  |  | this.$message.warning('只能输入正整数') | 
|---|
|  |  |  | row.boardCode = '' | 
|---|
|  |  |  | return | 
|---|
|  |  |  | } | 
|---|
|  |  |  | obj.boardCode = row.boardCode | 
|---|
|  |  |  | } else if (type === 3) { | 
|---|
|  |  |  | if (!row.channelCode) return | 
|---|
|  |  |  | if (!/^[1-9]\d*$/.test(row.channelCode)) { | 
|---|
|  |  |  | this.$message.warning('只能输入正整数') | 
|---|
|  |  |  | row.channelCode = '' | 
|---|
|  |  |  | return | 
|---|
|  |  |  | } | 
|---|
|  |  |  | obj.channelCode = row.channelCode | 
|---|
|  |  |  | } | 
|---|
|  |  |  | updateById(obj) | 
|---|
|  |  |  | 
|---|
|  |  |  | cancelButtonText: '取消', | 
|---|
|  |  |  | type: 'warning' | 
|---|
|  |  |  | }).then(() => { | 
|---|
|  |  |  | unBindKeys(this.list.map(item => item.id)) | 
|---|
|  |  |  | unBindKeys(this.ids) | 
|---|
|  |  |  | .then(res => { | 
|---|
|  |  |  | this.getList() | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | 
|---|
|  |  |  | this.getList() | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | reset() { | 
|---|
|  |  |  | this.searchForm.keyId = '' | 
|---|
|  |  |  | this.searchForm.keyCode = '' | 
|---|
|  |  |  | this.searchForm.status = '' | 
|---|
|  |  |  | this.searchForm.workingStatus = '' | 
|---|
|  |  |  | this.searchForm.bindStatus = '' | 
|---|
|  |  |  | this.getList() | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | getList() { | 
|---|
|  |  |  | 
|---|
|  |  |  | cabinetId: this.id, | 
|---|
|  |  |  | keyId: this.searchForm.keyId, | 
|---|
|  |  |  | status: this.searchForm.status, | 
|---|
|  |  |  | bindStatus: this.searchForm.bindStatus, | 
|---|
|  |  |  | workingStatus: this.searchForm.workingStatus | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }).then(res => { | 
|---|