二次确认

This commit is contained in:
2025-10-14 10:52:52 +08:00
parent 2deaf048e7
commit 734fe88f14
9 changed files with 153 additions and 72 deletions

View File

@@ -78,8 +78,8 @@
<button class="zd-col-8 button-primary" :class="{'button-info': !checkedArr.length}" :disabled="disabled" @tap="_lock">锁定</button>
<button class="zd-col-8 button-primary" :class="{'button-info': !checkedArr.length}" :disabled="disabled2" @tap="_unlock">解锁</button> -->
<button class="zd-col-8 button-primary" @tap="searchList">{{$t('button.search')}}</button>
<button class="zd-col-8 button-primary" :class="{'button-info': !checkedArr.length}" :disabled="disabled" @tap="_lock">{{$t('button.lock')}}</button>
<button class="zd-col-6 button-primary" :class="{'button-info': !checkedArr.length}" :disabled="disabled2" @tap="_unlock">{{$t('button.unlock')}}</button>
<button class="zd-col-8 button-primary" :class="{'button-info': !checkedArr.length}" :disabled="disabled" @tap="handleConfirm">{{$t('button.lock')}}</button>
<button class="zd-col-6 button-primary" :class="{'button-info': !checkedArr.length}" :disabled="disabled2" @tap="handleConfirm2">{{$t('button.unlock')}}</button>
</view>
</view>
</template>
@@ -87,6 +87,7 @@
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import { confirmAction } from '@/utils/utils.js'
import {getRegions, getPointInfo, lock, unlock} from '@/utils/getData4.js'
export default {
components: {
@@ -181,12 +182,17 @@
this.disabled = false
this.disabled2 = false
},
async _lock () {
this.disabled = true
async handleConfirm() {
if (!this.checkedArr.length) {
this.disabled = false
return
}
const isConfirmed = await confirmAction("确认操作", "确定要执行此操作吗?")
if (isConfirmed) {
this._lock()
}
},
async _lock () {
this.disabled = true
try {
let res = await lock(this.checkedArr)
if (res.code === '200') {
@@ -200,18 +206,23 @@
title: res.message,
icon: 'none'
})
this.disabled = false
}
this.disabled = false
} catch (e) {
this.disabled = false
}
},
async _unlock () {
this.disabled2 = true
async handleConfirm2() {
if (!this.checkedArr.length) {
this.disabled2 = false
return
}
const isConfirmed = await confirmAction("确认操作", "确定要执行此操作吗?")
if (isConfirmed) {
this._unlock()
}
},
async _unlock () {
this.disabled2 = true
try {
let res = await unlock(this.checkedArr)
if (res.code === '200') {
@@ -225,8 +236,8 @@
title: res.message,
icon: 'none'
})
this.disabled2 = false
}
this.disabled = false
} catch (e) {
this.disabled2 = false
}