|
|
@ -1,9 +1,11 @@ |
|
|
<template> |
|
|
<template> |
|
|
<view class="bg-white flex flex-col px-2"> |
|
|
<view class="flex flex-col"> |
|
|
<view class="flex flex-nowrap mt-3"> |
|
|
<view class="flex flex-nowrap my-3 px-4" @click="openBinding"> |
|
|
<view class="flex-1"></view> |
|
|
<view class="flex-1">添加WiFi</view> |
|
|
<u-button type="primary" text="添加WiFi" size="mini" :plain="true" @click="openBinding">添加WiFi</u-button> |
|
|
<u-icon name="arrow-right"></u-icon> |
|
|
|
|
|
<!-- <u-button type="primary" text="添加WiFi" size="mini" :plain="true" @click="openBinding">添加WiFi</u-button> --> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
<view class="w-full h-3" style="background: #f8f8f8"></view> |
|
|
<!-- <view class="flex flex-nowrap text-xs text-gray-400 my-2"> |
|
|
<!-- <view class="flex flex-nowrap text-xs text-gray-400 my-2"> |
|
|
提示: |
|
|
提示: |
|
|
<view v-for="(tip, tipIndex) in tips" :key="tipIndex" class="flex flex-nowrap items-center ml-3"> |
|
|
<view v-for="(tip, tipIndex) in tips" :key="tipIndex" class="flex flex-nowrap items-center ml-3"> |
|
|
@ -11,51 +13,29 @@ |
|
|
{{ tip.value }} |
|
|
{{ tip.value }} |
|
|
</view> |
|
|
</view> |
|
|
</view> --> |
|
|
</view> --> |
|
|
<view v-if="lists && lists.length"> |
|
|
<view v-if="lists && lists.length" class="px-2"> |
|
|
<view v-for="item in lists" :key="item.toolId"> |
|
|
<view v-for="item in lists" :key="item.toolId"> |
|
|
<view class="flex justify-between items-center py-3 border-b"> |
|
|
<view class="flex justify-between items-center py-3 px-2 border-b"> |
|
|
<view class="flex flex-row items-center"> |
|
|
<view class="flex flex-row items-center"> |
|
|
<!-- :class=" |
|
|
|
|
|
item.equipmentStatus === 0 |
|
|
|
|
|
? 'text-gray-500' |
|
|
|
|
|
: item.equipmentStatus === 1 |
|
|
|
|
|
? 'text-green-500' |
|
|
|
|
|
: item.equipmentStatus === 2 |
|
|
|
|
|
? 'text-yellow-500' |
|
|
|
|
|
: 'text-red-500' |
|
|
|
|
|
" --> |
|
|
|
|
|
<view class="mr-2"> |
|
|
<view class="mr-2"> |
|
|
{{ item.code }} |
|
|
{{ item.code }} |
|
|
</view> |
|
|
</view> |
|
|
<view class="flex items-center text-gray-400" @click="getUserName(item.equipmentId)"> |
|
|
|
|
|
<!-- :class=" |
|
|
|
|
|
item.equipmentStatus === 0 |
|
|
|
|
|
? 'text-gray-500' |
|
|
|
|
|
: item.equipmentStatus === 1 |
|
|
|
|
|
? 'text-green-500' |
|
|
|
|
|
: item.equipmentStatus === 2 |
|
|
|
|
|
? 'text-yellow-500' |
|
|
|
|
|
: 'text-red-500' |
|
|
|
|
|
" --> |
|
|
|
|
|
<u-icon name="error-circle" size="36"></u-icon> |
|
|
|
|
|
</view> |
|
|
|
|
|
</view> |
|
|
</view> |
|
|
<view class="flex flex-nowrap items-center"> |
|
|
<view class="flex flex-nowrap items-center"> |
|
|
<view class="flex items-center text-gray-400"> |
|
|
<view class="flex items-center text-gray-400" v-show="show"> |
|
|
<u-icon v-if="item.wifiStatus === 1" name="wifi" color="#1890FF" size="36"></u-icon> |
|
|
{{ content }} |
|
|
<u-icon v-else name="wifi" color="#999999" size="36"></u-icon> |
|
|
|
|
|
</view> |
|
|
</view> |
|
|
<view class="battery-box ml-3"> |
|
|
<view class=""> |
|
|
<view class="battery-text u-font-10 font-light">{{ item.electricQuantity }}</view> |
|
|
<u-button v-if="!show" type="primary" text="查询使用者" size="mini" :plain="true" @click="getUserName(item.equipmentId)"> |
|
|
<view class="battery" :style="{ width: setWidth(item.electricQuantity) }"></view> |
|
|
查询使用者 |
|
|
|
|
|
</u-button> |
|
|
|
|
|
<u-icon v-else bold name="reload" color="#1890FF" size="32" class="ml-2" @click="getUserName(item.equipmentId)"></u-icon> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
<u-empty v-else text="列表为空" mode="list" class="mt-10"></u-empty> |
|
|
<u-empty v-else text="列表为空" mode="list" class="mt-10"></u-empty> |
|
|
|
|
|
|
|
|
<u-modal v-model="show" :content="content"></u-modal> |
|
|
|
|
|
</view> |
|
|
</view> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
@ -127,8 +107,10 @@ export default { |
|
|
*/ |
|
|
*/ |
|
|
async getUserName(equipmentId) { |
|
|
async getUserName(equipmentId) { |
|
|
try { |
|
|
try { |
|
|
|
|
|
this.$t.ui.showLoading(); |
|
|
const params = { equipmentId }; |
|
|
const params = { equipmentId }; |
|
|
const data = await this.$u.api.getUserName(params); |
|
|
const data = await this.$u.api.getUserName(params); |
|
|
|
|
|
this.$t.ui.hideLoading(); |
|
|
if (data.status === -2) { |
|
|
if (data.status === -2) { |
|
|
this.show = true; |
|
|
this.show = true; |
|
|
this.content = '使用前请先选择长者!'; |
|
|
this.content = '使用前请先选择长者!'; |
|
|
@ -139,9 +121,10 @@ export default { |
|
|
} |
|
|
} |
|
|
if (data.status === 0) { |
|
|
if (data.status === 0) { |
|
|
this.show = true; |
|
|
this.show = true; |
|
|
this.content = `绑定者为 ${data.userName},性别 ${data.sex === 1 ? '男' : '女'}`; |
|
|
this.content = `使用者为 ${data.userName}(${data.sex === 1 ? '男' : '女'})`; |
|
|
} |
|
|
} |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
|
|
|
this.$t.ui.hideLoading(); |
|
|
console.error('error: ', error); |
|
|
console.error('error: ', error); |
|
|
this.$t.ui.showToast(error.msg || '工具箱的使用者查询失败'); |
|
|
this.$t.ui.showToast(error.msg || '工具箱的使用者查询失败'); |
|
|
} |
|
|
} |
|
|
|