123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216 |
- <template>
- <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="暂无更多数据"
- @selection-change="selectionChange">
- <uni-tr>
- <uni-th style="font-size: 25rpx;" width="100" align="center">批次号</uni-th>
- <uni-th style="font-size: 25rpx;" width="100" align="center">操作者</uni-th>
- <uni-th style="font-size: 25rpx;" width="80" align="center">数量</uni-th>
- </uni-tr>
- <uni-tr v-for="(item, index) in listData" :key="index">
- <uni-th style="font-size: 24rpx;" width="100" align="center">{{ item.lotCode }}</uni-th>
- <uni-th style="font-size: 24rpx;" width="100" align="center">{{ item.storagerName }}</uni-th>
- <uni-th style="font-size: 24rpx;" width="80" align="center">{{ item.storageNum }}</uni-th>
- </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>
- </template>
- <script setup>
- import {
- ref
- } from 'vue'
- import {
- onMounted,
- getCurrentInstance
- } from 'vue';
- import {
- getStorageRetrievalList
- } from '@/api/business/storageRetrieval.js'
- import {
- onLoad,
- onReady,
- onUnload,
- onShow
- } from '@dcloudio/uni-app'
- 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'
- },
- {
- name: 'typeLabel',
- label: '选别类型',
- align: 'center'
- },
- ]
- /***************************** 页面生命周期函数 *****************************/
- onLoad((options) => {
- 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 => {
- 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 getSelectionList(data) {
- selections.value = data
- console.log(selections.value)
- }
- function toggleAllSelection(checked, arr) {
- getSelectionList(arr)
- }
- //选择带回
- function handleAdd() {
- uni.$emit('addInfoEvent', {
- data: selections.value
- })
- uni.navigateBack()
- }
- </script>
- <style lang="scss">
- .unfit-title {
- height: 30rpx;
- position: fixed;
- top: 30rpx;
- }
- .page-container {
- height: 90%;
- background-color: #ffffff;
- font-size: 28rpx;
- >.title {
- position: relative;
- top: 0;
- font-weight: 700;
- margin: 24rpx 16rpx;
- }
- }
- .unfit-title {
- margin-bottom: 24rpx;
- justify-content: space-between;
- align-items: center;
- text {
- font-size: 28rpx;
- font-weight: 700;
- }
- }
- .bottom {
- height: 10%;
- position: fixed;
- right: 0;
- bottom: 0;
- left: 0;
- height: 100rpx;
- border-top: 1px solid #999999;
- padding: 16rpx 32rpx;
- align-items: center;
- background-color: #fff;
- justify-content: space-evenly;
- z-index: 99;
- .start-batch-btn {
- flex: 1;
- height: 80rpx;
- line-height: 80rpx;
- border-radius: 8rpx;
- color: #FFFFFF;
- font-size: 28rpx;
- }
- }
- .consultation-container {
- margin: 0 16rpx;
- padding: 24rpx;
- background-color: #ffffff;
- border-radius: 8rpx;
- }
- .zb-table .item-tr {
- flex-direction: row;
- }
- </style>
|