Files
hht-ndxy-uni/pages/manage/equip.vue

98 lines
2.2 KiB
Vue
Raw Normal View History

2025-02-19 15:39:46 +08:00
<template>
<view class="zd_container">
<nav-bar :title="title"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper grid-wraper">
<view class="slide_new">
<table>
<thead>
<tr>
<th>选择</th>
<th>点位编码</th>
<th>点位名称</th>
<th>点位状态</th>
<th>是否启用</th>
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in dataList" :key="i" @tap="toCheck(e)">
<td>
<view class="checkbox">
<uni-icons type="checkmarkempty" size="20" :color="e.point_code === pkId ? '#4e6ef2' : '#fff'"></uni-icons>
</view>
</td>
<td>{{ e.point_code }}</td>
<td>{{ e.point_name }}</td>
<td>{{ e.point_status }}</td>
<td>{{ e.is_used }}</td>
</tr>
</tbody>
</table>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-11 button-primary" :disabled="disabled && type === '1'" :class="{'button-info': !pkId}" @tap="toSure('1')">设置有货</button>
<button class="zd-col-11 button-primary" :disabled="disabled && type === '0'" :class="{'button-info': !pkId}" @tap="toSure('0')">设置无货</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import {queryPoints, operation} from '@/utils/getData2.js'
export default {
components: {
NavBar
},
data() {
return {
title: '',
disabled: false,
type: '',
dataList: [],
pkId: ''
}
},
onLoad (options) {
this.title = options.title
this._queryPoints()
},
methods: {
async _queryPoints () {
let res = await queryPoints()
this.dataList = [...res]
},
toCheck (e) {
this.pkId = this.pkId === e.point_code ? '' : e.point_code
},
async toSure (type) {
this.disabled = true
this.type = type
if (!this.pkId) {
this.disabled = false
this.type = ''
return
}
try {
let res = await operation(this.pkId, type)
this._queryPoints()
uni.showToast({
title: res.message,
icon: 'none'
})
this.disabled = false
this.type = ''
} catch (e) {
this.disabled = false
this.type = ''
}
}
}
}
</script>
<style lang="stylus">
</style>