From c8b6ed5823fbe8e7eeef2e733859b4406b2ba4c5 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期五, 15 一月 2021 13:22:07 +0800 Subject: [PATCH] Merge pull request #38 from lawrencehj/wvp-28181-2.0 --- web_src/src/components/videoList.vue | 48 ++++++++++++++++++++++++++++++++---------------- 1 files changed, 32 insertions(+), 16 deletions(-) diff --git a/web_src/src/components/videoList.vue b/web_src/src/components/videoList.vue index ebf3ad0..01dae2c 100644 --- a/web_src/src/components/videoList.vue +++ b/web_src/src/components/videoList.vue @@ -8,7 +8,7 @@ <div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;"> <span style="font-size: 1rem; font-weight: bold;">璁惧鍒楄〃</span> <div style="position: absolute; right: 1rem; top: 0.3rem;"> - <el-button icon="el-icon-refresh-right" circle size="mini" @click="getDeviceList()"></el-button> + <el-button icon="el-icon-refresh-right" circle size="mini" :loading="getDeviceListLoading" @click="getDeviceList()"></el-button> </div> </div> <devicePlayer ref="devicePlayer"></devicePlayer> @@ -21,7 +21,7 @@ <el-table-column label="鍦板潃" width="180" align="center"> <template slot-scope="scope"> <div slot="reference" class="name-wrapper"> - <el-tag size="medium">{{ scope.row.host.address }}</el-tag> + <el-tag size="medium">{{ scope.row.hostAddress }}</el-tag> </div> </template> </el-table-column> @@ -51,8 +51,8 @@ <el-table-column label="鎿嶄綔" width="240" align="center" fixed="right"> <template slot-scope="scope"> - <el-button size="mini" icon="el-icon-refresh" @click="refDevice(scope.row)">鍒锋柊閫氶亾</el-button> - <el-button size="mini" icon="el-icon-s-open" type="primary" @click="showChannelList(scope.row)">鏌ョ湅閫氶亾</el-button> + <el-button size="mini" :ref="scope.row.deviceId + 'refbtn' " icon="el-icon-refresh" @click="refDevice(scope.row)">鍒锋柊閫氶亾</el-button> + <el-button size="mini" icon="el-icon-s-open" v-bind:disabled="scope.row.online==0" type="primary" @click="showChannelList(scope.row)">鏌ョ湅閫氶亾</el-button> </template> </el-table-column> </el-table> @@ -73,12 +73,10 @@ </template> <script> - import devicePlayer from './gb28181/devicePlayer.vue' import uiHeader from './UiHeader.vue' export default { name: 'app', components: { - devicePlayer, uiHeader }, data() { @@ -92,7 +90,8 @@ winHeight: window.innerHeight - 200, currentPage:1, count:15, - total:0 + total:0, + getDeviceListLoading: false }; }, computed: { @@ -132,20 +131,23 @@ }, getDeviceList: function() { let that = this; - + this.getDeviceListLoading = true; this.$axios.get(`/api/devices`,{ params: { - page: that.currentPage - 1, + page: that.currentPage, count: that.count } } ) .then(function (res) { console.log(res); + console.log(res.data.list); that.total = res.data.total; - that.deviceList = res.data.data; + that.deviceList = res.data.list; + that.getDeviceListLoading = false; }) .catch(function (error) { console.log(error); + that.getDeviceListLoading = false; }); }, @@ -160,17 +162,31 @@ refDevice: function(itemData) { ///api/devices/{deviceId}/sync console.log("鍒锋柊瀵瑰簲璁惧:" + itemData.deviceId); + var that = this; + that.$refs[itemData.deviceId + 'refbtn' ].loading = true; this.$axios({ method: 'post', url: '/api/devices/' + itemData.deviceId + '/sync' }).then(function(res) { - // console.log("鍒锋柊璁惧缁撴灉锛�"+JSON.stringify(res)); + console.log("鍒锋柊璁惧缁撴灉锛�"+JSON.stringify(res)); + if (!res.data.deviceId) { + that.$message({ + showClose: true, + message: res.data, + type: 'error' + }); + }else{ + that.$message({ + showClose: true, + message: '璇锋眰鎴愬姛', + type: 'success' + }); + } + that.initData() + that.$refs[itemData.deviceId + 'refbtn' ].loading = false; }).catch(function(e) { - that.$message({ - showClose: true, - message: '璇锋眰鎴愬姛', - type: 'success' - }); + console.error(e) + that.$refs[itemData.deviceId + 'refbtn' ].loading = false; });; }, //閫氱煡璁惧涓婁紶濯掍綋娴� -- Gitblit v1.8.0