完善逻辑

This commit is contained in:
李彪 2025-04-28 15:49:30 +08:00
parent ad2d48c4ca
commit 61e0cd0ce7
2 changed files with 26 additions and 21 deletions

View File

@ -9,25 +9,16 @@
<!-- 头部标题和标签 --> <!-- 头部标题和标签 -->
<view class="dialog-header"> <view class="dialog-header">
<text class="title">{{ currentRow.name }}</text> <text class="title">{{ currentRow.name }}</text>
<!-- <u-tag class="tag" text="室内" mode="light" /> --> <u-tag v-if="currentRow.areaType === '室内'" class="tag" text="室内" mode="light" />
<!-- <u-tag <u-tag v-if="currentRow.areaType === '室外'" class="tag" text="室外" mode="light" type="success" />
class="tag" <u-tag v-if="currentRow.areaType === '特殊'" class="tag" text="特殊" mode="light" type="warning" />
:text="areaType"
mode="light"
:type="
areaType === '室外'
? 'success'
: areaType === '特殊'
? 'warning'
: 'primary'
"
/> -->
</view> </view>
<!-- 副标题 - 负责人 --> <!-- 副标题 - 负责人 -->
<!-- <view class="dialog-subtitle"> 区域主负责人张三 </view> --> <!-- <view class="dialog-subtitle"> 区域主负责人张三 </view> -->
<view>传入参数{{ showMsg }}</view> <view>传入参数{{ showMsg }}</view>
<view>接口返回结果{{ resData }}</view> <view>接口返回结果{{ resData }}</view>
<!-- 已存在卡片时显示图片 --> <!-- 已存在卡片时显示图片 -->
<view class="dialog-image-container" v-if="isChange === true"> <view class="dialog-image-container" v-if="isChange === true">
<!-- 替换为实际的图片路径 --> <!-- 替换为实际的图片路径 -->
@ -49,8 +40,6 @@
<view v-if="step === 1">1.请将标签卡贴靠设备NFC识别处</view> <view v-if="step === 1">1.请将标签卡贴靠设备NFC识别处</view>
<view v-if="step === 2">2.如果确定将该卡片写入该区域,请将标签卡贴靠设备xNFC识别处否则请退出</view> <view v-if="step === 2">2.如果确定将该卡片写入该区域,请将标签卡贴靠设备xNFC识别处否则请退出</view>
<view v-if="step === 3">3.请再次将标签卡贴靠设备NFC识别处</view> <view v-if="step === 3">3.请再次将标签卡贴靠设备NFC识别处</view>
<!-- <view v-if="step === 3">{{ lookData }}</view> -->
<!-- <view v-if="step === 4">{{ lookData }}</view> -->
</view> </view>
<!-- 底部按钮 --> <!-- 底部按钮 -->
@ -82,6 +71,7 @@ export default {
return { return {
isChange: false, isChange: false,
step: 0, step: 0,
isAdd: false,
lookData: {}, lookData: {},
resData: {}, resData: {},
showMsg: '' showMsg: ''
@ -124,7 +114,7 @@ export default {
const req = { const req = {
"AreaId": data.areaId, "AreaId": data.areaId,
"pwd": data.pwd, "pwd": data.pwd,
"isAdd": !this.currentRow.state, "isAdd": this.isAdd,
// "isAdd": true, // "isAdd": true,
} }
console.log(req, '重置nfc--req') console.log(req, '重置nfc--req')
@ -168,9 +158,15 @@ export default {
} }
return return
} }
//
if (data.step === 4) { if (data.step === 4) {
uni.showToast({ title: '绑定成功', icon: 'none' })
this.lookData = data this.lookData = data
this.step = 4 this.step = 4
this.$emit('closeRes') // 使 :visible @close
return
this.isAdd = true
this.isChange = true
// uni.showModal({ // uni.showModal({
// title: '', // title: '',
// content: JSON.stringify(data) || ' initFn', // content: JSON.stringify(data) || ' initFn',

View File

@ -33,10 +33,10 @@
<!-- 列表 --> <!-- 列表 -->
<view class="list-box"> <view class="list-box">
<scroll-view :scroll-y="true" class="scroll-Y"> <scroll-view :scroll-y="true" class="scroll-Y">
<view v-for="item in sonList" class="item-box"> <view v-for="item in sonList" class="item-box" @click="dialogShowFn(item)">
<view class="item-title">{{ item.name }}</view> <view class="item-title">{{ item.name }}</view>
<view v-if="item.state === true" class="btn-have btn" @click="dialogShowFn(item)">已绑定</view> <view v-if="item.state === true" class="btn-have btn">已绑定</view>
<view v-if="item.state === false" class="btn-none btn" @click="dialogShowFn(item)">去绑定</view> <view v-if="item.state === false" class="btn-none btn">去绑定</view>
</view> </view>
<view v-if="!sonList.length" style="height:100rpx;"></view> <view v-if="!sonList.length" style="height:100rpx;"></view>
<u-empty v-if="!sonList.length" text="数据为空" mode="list"></u-empty> <u-empty v-if="!sonList.length" text="数据为空" mode="list"></u-empty>
@ -46,7 +46,7 @@
<u-action-sheet :list="options" title="请选择" @click="changeFn" v-model:value="selectShow"></u-action-sheet> <u-action-sheet :list="options" title="请选择" @click="changeFn" v-model:value="selectShow"></u-action-sheet>
<!-- 弹窗 --> <!-- 弹窗 -->
<bind-dialog ref="dialogRef" :visible="showDialog" @close="showDialog = false" :currentRow="currentRow" <bind-dialog ref="dialogRef" :visible="showDialog" @close="showDialog = false" :currentRow="currentRow"
@changeBinding="onChangeBinding" @confirm="onConfirm"></bind-dialog> @changeBinding="onChangeBinding" @confirm="onConfirm" @closeRes="closeResFn"></bind-dialog>
<u-tabbar :list="vuex_tabbar"></u-tabbar> <u-tabbar :list="vuex_tabbar"></u-tabbar>
</view> </view>
@ -151,6 +151,7 @@ export default {
this.$refs.dialogRef.isChange = row.state // this.$refs.dialogRef.isChange = row.state //
this.$refs.dialogRef.resData = '' this.$refs.dialogRef.resData = ''
this.$refs.dialogRef.showMsg = '' this.$refs.dialogRef.showMsg = ''
this.$refs.dialogRef.isAdd = !row.state
this.$refs.dialogRef.step = 0 // this.$refs.dialogRef.step = 0 //
if (row.state === false) { if (row.state === false) {
this.$refs.dialogRef.step = 1 // this.$refs.dialogRef.step = 1 //
@ -172,6 +173,14 @@ export default {
this.getSonAreaFn() this.getSonAreaFn()
} }
}, },
//
closeResFn() {
this.showDialog = false
uni.showToast({ title: '绑定成功', icon: 'none' })
setTimeout(() => {
this.getSonAreaFn()
}, 500)
},
// //
async getSonAreaFn() { async getSonAreaFn() {
const req = { const req = {