|
@@ -1,20 +1,15 @@
|
|
|
<template>
|
|
|
- <view class="page-container uni-column" >
|
|
|
+ <view class="page-container uni-column">
|
|
|
<!-- 零存库部分 -->
|
|
|
<view class="title unfit-title uni-row">
|
|
|
<view class="title">零取</view>
|
|
|
</view>
|
|
|
<view class="consultation-container uni-column" style="margin-bottom: 200rpx;padding-bottom: 140rpx">
|
|
|
-
|
|
|
- <view >
|
|
|
- <zb-table
|
|
|
- :columns="column1"
|
|
|
- :stripe="true"
|
|
|
- :fit="true"
|
|
|
- @toggleRowSelection="selectionChange"
|
|
|
- @toggleAllSelection="toggleAllSelection"
|
|
|
- :data="listData"></zb-table>
|
|
|
-<!-- <uni-table ref="table" :loading="loading" border stripe type="selection" emptyText="暂无更多数据"
|
|
|
+
|
|
|
+ <view>
|
|
|
+ <zb-table :columns="column1" :stripe="true" :fit="true" @toggleRowSelection="selectionChange"
|
|
|
+ @toggleAllSelection="toggleAllSelection" :data="listData"></zb-table>
|
|
|
+ <!-- <uni-table ref="table" :loading="loading" border stripe type="selection" emptyText="暂无更多数据"
|
|
|
@selection-change="selectionChange">
|
|
|
<uni-tr>
|
|
|
<uni-th style="font-size: 25rpx;" width="100" align="center">批次号</uni-th>
|
|
@@ -28,14 +23,14 @@
|
|
|
|
|
|
</uni-tr>
|
|
|
</uni-table> -->
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class="bottom uni-row">
|
|
|
- <button class="start-batch-btn" style="margin-right: 10rpx;" type="primary"
|
|
|
- :disabled="selections.length == 0" @click="handleAdd">确认取出</button>
|
|
|
- </view>
|
|
|
</view>
|
|
|
-
|
|
|
+ </view>
|
|
|
+ <view class="bottom uni-row">
|
|
|
+ <button class="start-batch-btn" style="margin-right: 10rpx;" type="primary"
|
|
|
+ :disabled="selections.length == 0" @click="handleAdd">确认取出</button>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
@@ -59,60 +54,105 @@
|
|
|
import {
|
|
|
store
|
|
|
} from '@/store/index.js'
|
|
|
+ import {
|
|
|
+ getDictInfoByType
|
|
|
+ } from '@/api/dict/dict.js'
|
|
|
|
|
|
const selections = ref([])
|
|
|
+ const selectTypeList = ref([])
|
|
|
const listData = ref([])
|
|
|
- const column1 = [
|
|
|
- { type:'selection', width:50 },
|
|
|
- { name: 'lotCode', label: '批次号',align:'center'},
|
|
|
- { name: 'storagerName', label: '操作者',align:'center' },
|
|
|
-{ name: 'storageNum', label: '数量',align:'center' },
|
|
|
+ const column1 = [{
|
|
|
+ type: 'selection',
|
|
|
+ width: 50
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'lotCode',
|
|
|
+ label: '批次号',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'storagerName',
|
|
|
+ label: '操作者',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'storageNum',
|
|
|
+ label: '数量',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'typeLabel',
|
|
|
+ label: '选别类型',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
]
|
|
|
|
|
|
/***************************** 页面生命周期函数 *****************************/
|
|
|
|
|
|
onLoad((options) => {
|
|
|
- const data = decodeURIComponent(options.data);
|
|
|
-
|
|
|
- // 将解码后的字符串转换回对象
|
|
|
- const lotInfo = JSON.parse(data);
|
|
|
+ const data = decodeURIComponent(options.data);
|
|
|
+
|
|
|
+ // 将解码后的字符串转换回对象
|
|
|
+ const lotInfo = JSON.parse(data);
|
|
|
+ //获取选别类型
|
|
|
+ getDictInfoByType("select_type").then(res => {
|
|
|
+ console.log(res.data && res.data.length > 0)
|
|
|
+ selectTypeList.value = res.data.map(v => {
|
|
|
+ return {
|
|
|
+ value: v.dictValue,
|
|
|
+ text: v.dictLabel
|
|
|
+ };
|
|
|
+ });
|
|
|
+ })
|
|
|
console.log(lotInfo)
|
|
|
init(lotInfo)
|
|
|
- })
|
|
|
+ })
|
|
|
|
|
|
/***************************** 定义了一些方法 *****************************/
|
|
|
const init = (data) => {
|
|
|
console.log(data)
|
|
|
- getStorageRetrievalList(data).then(res =>{
|
|
|
- listData.value = res.rows
|
|
|
- })
|
|
|
+ getStorageRetrievalList(data).then(res => {
|
|
|
+ const processedRows = res.rows.map(item => {
|
|
|
+ // 查找匹配的 typeLabel
|
|
|
+ const typeLabelItem = selectTypeList.value.find(v => v.value == item.type);
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ typeLabel: typeLabelItem.text
|
|
|
+ };
|
|
|
+ });
|
|
|
+ listData.value = processedRows;
|
|
|
+ });
|
|
|
}
|
|
|
- function selectionChange(checked,arr) {
|
|
|
- console.log(checked,arr)
|
|
|
- getSelectionList(arr)
|
|
|
+
|
|
|
+ function selectionChange(checked, arr) {
|
|
|
+ console.log(checked, arr)
|
|
|
+ getSelectionList(arr)
|
|
|
}
|
|
|
+
|
|
|
function getSelectionList(data) {
|
|
|
selections.value = data
|
|
|
console.log(selections.value)
|
|
|
}
|
|
|
- function toggleAllSelection(checked,arr) {
|
|
|
+
|
|
|
+ function toggleAllSelection(checked, arr) {
|
|
|
getSelectionList(arr)
|
|
|
}
|
|
|
//选择带回
|
|
|
function handleAdd() {
|
|
|
uni.$emit('addInfoEvent', {
|
|
|
- data:selections.value
|
|
|
+ data: selections.value
|
|
|
})
|
|
|
uni.navigateBack()
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
|
- .unfit-title{
|
|
|
+ .unfit-title {
|
|
|
height: 30rpx;
|
|
|
position: fixed;
|
|
|
top: 30rpx;
|
|
|
}
|
|
|
+
|
|
|
.page-container {
|
|
|
height: 90%;
|
|
|
background-color: #ffffff;
|
|
@@ -161,13 +201,15 @@
|
|
|
font-size: 28rpx;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
.consultation-container {
|
|
|
margin: 0 16rpx;
|
|
|
padding: 24rpx;
|
|
|
background-color: #ffffff;
|
|
|
border-radius: 8rpx;
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
.zb-table .item-tr {
|
|
|
flex-direction: row;
|
|
|
}
|