区域锁定需求

This commit is contained in:
蔡玲
2024-09-24 15:15:04 +08:00
parent f586ef5ed3
commit 1158f09676
4 changed files with 114 additions and 13 deletions

View File

@@ -490,4 +490,36 @@ uni-button[disabled]:not([type]), uni-button[disabled][type=default] {
.flow_icon_item_2 {
width: 46rpx;
height: 26rpx;
}
.checkbox-text {
font-size: 28rpx;
line-height: 28rpx;
color: #303133;
}
.point-wraper {
flex-wrap: wrap;
justify-content: flex-start;
}
.point-item {
width: 32.5%;
font-size: 28rpx;
line-height: 28rpx;
height: 84rpx;
padding: 14rpx 4rpx;
color: #303133;
text-align: center;
background: #fff;
border: 2rpx solid #DCDFE6;
border-radius: 10rpx;
overflow: hidden;
}
.point-item:nth-child(3n+2) {
margin-left: 1.25%
margin-right: 1.25%
}
.point-item:nth-child(n+4) {
margin-top: 16rpx
}
.point-item.checked {
background: #DCDFE6;
}

View File

@@ -8,20 +8,42 @@
<span class="filter_label">区域</span>
</view>
<view class="zd-col-19 filter_select">
<zxz-uni-data-select
<!-- <zxz-uni-data-select
v-model="index"
:localdata="options"
:multiple="true"
:collapseTags="true"
/>
/> -->
<uni-data-select v-model="index" :localdata="options" @change="selectChange"></uni-data-select>
</view>
</view>
</view>
<!-- <view v-show="dataList.length > 0" class="zd_wrapper grid-wraper">
<view class="slide_new">
<table>
<tbody>
<tr v-for="(e, i) in dataList" :key="i" @click="toCheck(e)">
<td><uni-icons :type="e.checked ? 'checkbox-filled' : 'circle'" size="26" color="#4e6ef2"></uni-icons></td>
<td>{{e.point_name}}</td>
</tr>
</tbody>
</table>
</view>
</view> -->
<view v-show="dataList.length > 0" class="zd_wrapper grid-wraper">
<view class="zd-row point-wraper">
<view class="zd-row point-item" v-for="(e, i) in dataList" :key="i" @click="toCheck(e)" :class="{'checked': e.checked}">{{e.point_name}}</view>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<view class="zd-col-4 zd-row flexcol" @tap="allCheck">
<uni-icons :type="allChecked ? 'checkbox-filled' : 'circle'" size="26" color="#4e6ef2"></uni-icons>
<view class="checkbox-text">全选</view>
</view>
<button class="zd-col-5 button-default" @tap="clearUp">清空</button>
<button class="zd-col-8 button-primary" :class="{'button-info': index.length === 0}" :disabled="disabled" @tap="_handheldLock('1')">锁定</button>
<button class="zd-col-8 button-primary" :class="{'button-info': index.length === 0}" :disabled="disabled" @tap="_handheldLock('0')">释放</button>
<button class="zd-col-7 button-primary" :class="{'button-info': !index}" :disabled="disabled" @tap="_handheldLock('1')">锁定</button>
<button class="zd-col-7 button-primary" :class="{'button-info': !index}" :disabled="disabled" @tap="_handheldLock('0')">释放</button>
</view>
</view>
</template>
@@ -29,8 +51,8 @@
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
// import {regionList} from '@/utils/mork2.js'
import {regionList, handheldLock} from '@/utils/getData2.js'
// import {regionList, selectPointByRegion} from '@/utils/mork2.js'
import {regionList, selectPointByRegion, handheldLock} from '@/utils/getData2.js'
export default {
components: {
NavBar,
@@ -40,9 +62,13 @@
return {
title: '',
options: [],
index: [],
index: '',
multiple: true,
disabled: false
disabled: false,
dataList: [],
pkId: '',
pkObj: {},
allChecked: false
};
},
onLoad (options) {
@@ -57,14 +83,46 @@
this.$set(el, 'text', el.label)
})
},
selectChange (e) {
if (e) {
this._selectPointByRegion(e)
}
},
async _selectPointByRegion (e) {
let res = await selectPointByRegion(e)
this.dataList = [...res]
this.dataList.map(el => {
this.$set(el, 'checked', false)
})
},
toCheck (e) {
e.checked = !e.checked
let arr = this.dataList.filter(el => el.checked === true)
if (arr.length === this.dataList.length) {
this.allChecked = true
} else {
this.allChecked = false
}
},
allCheck () {
if (!this.dataList.length) return
this.allChecked = !this.allChecked
this.dataList.map(el => {
el.checked = this.allChecked
})
},
async _handheldLock (type) {
this.disabled = true
if (this.index.length === 0) {
if (!this.index) {
this.disabled = false
return
}
try {
let res = await handheldLock(this.index, type)
let arr = null
if (type === '0') {
arr = this.dataList.filter(el => el.checked === true)
}
let res = await handheldLock(this.index, type, arr)
this.clearUp()
uni.showToast({
title: res.message,
@@ -75,8 +133,11 @@
}
},
clearUp () {
this.index = []
this.index = ''
this.disabled = false
this.dataList = []
this.pkId = ''
this.pkObj = {}
}
}
}

View File

@@ -26,9 +26,9 @@ export const regionList = () => request({
method: 'GET'
})
// 区域锁定
export const handheldLock = (code, status) => request({
export const handheldLock = (code, status, data) => request({
url:'api/handheld/lock',
data: {region_code: code, status: status}
data: {region_code: code, status: status, pointCodes: data}
})
// 外协区空料架送回
export const handheldRack = (code, vcode) => request({
@@ -90,4 +90,8 @@ export const fabMaterial = (code) => request({
export const callMater = (mater, code, vcode) => request({
url:'api/fab/callMater',
data: {mater: mater, device_code: code, vehicle_code: vcode}
})
export const selectPointByRegion = (code) => request({
url:'api/handheld/selectPointByRegion?regionCode=' + code,
method: 'GET'
})

View File

@@ -35,4 +35,8 @@ export const selectOrderByRegion = (code, code1) => {
export const fabMaterial = (code, code1) => {
let res = [{ vehicle_code: '123', order_code: '800034202869', region_code: '111-07', material_id: 'A7E0019008760_00', material_type: 'S39_SA01', custom: 'BBC支撑板后上', material_qty: '120', plan_date: '2024/8/11' }, { vehicle_code: '123', order_code: '800034202869', region_code: '111-07', material_id: 'A7E0019008760_00', material_type: 'S39_SA01', custom: 'BBC支撑板后上', material_qty: '120', plan_date: '2024/8/11' }, { vehicle_code: '123', order_code: '800034202869', region_code: '111-07', material_id: 'A7E0019008760_00', material_type: 'S39_SA01', custom: 'BBC支撑板后上', material_qty: '120', plan_date: '2024/8/11' }, { vehicle_code: '123', order_code: '800034202869', region_code: '111-07', material_id: 'A7E0019008760_00', material_type: 'S39_SA01', custom: 'BBC支撑板后上', material_qty: '120', plan_date: '2024/8/11' }]
return res
}
export const selectPointByRegion = (code) => {
let res = [{point_code: '1', point_name: 'Amada 80T冲床07-01-06-01'}, {point_code: '2', point_name: 'Amada 80T冲床07-01-06-01'}, {point_code: '3', point_name: 'Amada 80T冲床07-01-06-01'}, {point_code: '4', point_name: 'Amada 80T冲床07-01-06-01'}, {point_code: '5', point_name: 'Amada 80T冲床07-01-06-01'}]
return res
}