From dd6a43fdbadaaf6d646b3eb2ca0a63f58ed77ea4 Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期三, 29 十月 2025 15:56:22 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/wuhuyancao' into wuhuyancao
---
admin/src/components/business/cabinetDetails.vue | 141 +++++++++++++++++++++++++++++++++++-----------
1 files changed, 106 insertions(+), 35 deletions(-)
diff --git a/admin/src/components/business/cabinetDetails.vue b/admin/src/components/business/cabinetDetails.vue
index e858232..f1bb5d4 100644
--- a/admin/src/components/business/cabinetDetails.vue
+++ b/admin/src/components/business/cabinetDetails.vue
@@ -6,8 +6,8 @@
:withFooter="false"
>
<el-form ref="searchForm" :model="searchForm" label-width="100px" inline>
- <el-form-item label="閽ュ寵" prop="keyId">
- <el-input v-model="searchForm.keyId" 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">
@@ -31,19 +31,44 @@
</el-form-item>
</el-form>
<ul class="toolbar">
- <li><el-button type="primary">鎵归噺瑙g粦</el-button></li>
+ <li><el-button type="primary" @click="bathUnBindKeys">鎵归噺瑙g粦</el-button></li>
</ul>
<el-table
v-loading="loading"
:data="list"
stripe
+ @selection-change="handleSelectionChange"
>
- <el-table-column prop="code" label="鏌滄牸缂栧彿" min-width="100px"></el-table-column>
+ <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"></el-table-column>
+ <el-table-column prop="keyId" label="缁戝畾閽ュ寵" min-width="100px">
+ <template slot-scope="{row}">
+ <el-select v-model="row.keyId" placeholder="璇烽�夋嫨" @change="blurFunc($event, row, 1)">
+ <el-option
+ v-for="item in keysAll"
+ :key="item.id"
+ :label="item.code"
+ :value="item.id"
+ :disabled="item.status !== 0">
+ </el-option>
+ </el-select>
+ </template>
+ </el-table-column>
+ <el-table-column label="鏉垮彿" min-width="100px">
+ <template slot-scope="{row}">
+ <el-input v-model="row.boardCode" @blur="blurFunc($event, row, 2)" placeholder="璇疯緭鍏ユ澘鍙�"></el-input>
+ </template>
+ </el-table-column>
+ <el-table-column label="閫氶亾鍙�" min-width="100px">
+ <template slot-scope="{row}">
+ <el-input v-model="row.channelCode" @blur="blurFunc($event, row, 3)" placeholder="璇疯緭鍏ラ�氶亾鍙�"></el-input>
+ </template>
+ </el-table-column>
<el-table-column label="鐘舵��" min-width="100px">
<template slot-scope="{row}">
<el-switch
+ @change="changeStatus($event, row.id)"
v-model="row.status"
active-color="#13ce66"
inactive-color="#ff4949"
@@ -64,33 +89,15 @@
<el-link type="success" v-if="row.bindStatus === 1">宸茬粦瀹�</el-link>
</template>
</el-table-column>
- <el-table-column
- label="鎿嶄綔"
- min-width="100"
- fixed="right"
- >
- <template slot-scope="{row}">
- <el-button type="text" v-if="row.bindStatus === 0">缁戝畾</el-button>
- <el-button type="text" v-if="row.bindStatus === 1">瑙g粦</el-button>
- </template>
- </el-table-column>
</el-table>
- <div style="width: 100%; text-align: right; margin-top: 20px">
- <el-pagination
- @current-change="handleCurrentChange"
- :current-page="page"
- :page-size="10"
- layout="total, prev, pager, next, jumper"
- :total="total">
- </el-pagination>
- </div>
</GlobalWindow>
</template>
<script>
import BaseOpera from '@/components/base/BaseOpera'
import GlobalWindow from '@/components/common/GlobalWindow'
- import { fetchList } from '@/api/business/jkCabinetGrid'
+ import { fetchList, updateStatusById, unBindKeys, updateById } from '@/api/business/jkCabinetGrid'
+ import { list } from '@/api/business/jkKeys'
export default {
name: 'cabinetDetails',
extends: BaseOpera,
@@ -99,14 +106,14 @@
return {
id: null,
info: null,
+ ids: [],
searchForm: {
- keyId: '',
+ keyCode: '',
status: '',
bindStatus: ''
},
list: [],
- page: 1,
- total: 0,
+ keysAll: [],
loading: false
}
},
@@ -114,35 +121,99 @@
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({ })
+ .then(res => {
+ this.keysAll = res
+ })
+ },
+ blurFunc(e, row, type) {
+ let obj = {
+ id: row.id
+ }
+ 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('鍙兘杈撳叆姝f暣鏁�')
+ 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('鍙兘杈撳叆姝f暣鏁�')
+ row.channelCode = ''
+ return
+ }
+ obj.channelCode = row.channelCode
+ }
+ updateById(obj)
+ .then(res => {
+ this.getList()
+ if (type === 1) {
+ this.getKeysAll()
+ }
+ })
+ },
+ bathUnBindKeys() {
+ this.$confirm('纭鎵归噺瑙g粦鍚�?', '鎻愮ず', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ unBindKeys(this.ids)
+ .then(res => {
+ this.getList()
+ })
+ }).catch(() => {
+
+ });
+ },
+ changeStatus(status, id) {
+ updateStatusById({ id, status })
+ .then(res => {
+ this.getList()
+ })
},
handleCurrentChange(e) {
this.page = e
this.getList()
},
reset() {
- this.searchForm.keyId = ''
+ this.searchForm.keyCode = ''
this.searchForm.status = ''
- this.searchForm.workingStatus = ''
- this.page = 1
+ this.searchForm.bindStatus = ''
this.getList()
},
getList() {
this.loading = true
fetchList({
- capacity: 10,
- page: this.page,
+ capacity: 99999,
+ page: 1,
model: {
cabinetId: this.id,
keyId: this.searchForm.keyId,
status: this.searchForm.status,
+ bindStatus: this.searchForm.bindStatus,
workingStatus: this.searchForm.workingStatus
}
}).then(res => {
- console.log(res)
this.list = res.records
- this.total = res.total
}).finally(() => {
this.loading = false
})
--
Gitblit v1.9.3