lxp_Maxcess/pages/putInProd/material.vue

234 lines
6.0 KiB
Vue

<template>
<view class="app status-bar-gap">
<view class="page">
<l-header :title="state.FBillNo" sticky #right></l-header>
<view class="material-listBox">
<scroll-view id="scroll-box" class="scroll-box" scroll-y="true"
:style="{'height':state.scrollHeight+'px'}">
<view class="list-box-list" v-if="state.dataList.length > 0">
<view class="data-item" v-for="(item, index) in state.dataList"
:style="[{'background-color':'#ffffff'},{'margin-bottom':index + 1 === state.dataList.length ? '80px' : '20px'}]"
:key="index" @click="toDetails(item.Id)">
<view class="text" style="margin-bottom: 20px;display: flex;">
<view>{{ item.MaterialName }}</view>
</view>
<view class="itemBox">
<view>{{t('receive.djbh')}}</view>
<view class="zongjian"></view>
<view>{{ state.FBillNo }}</view>
</view>
<view class="itemBox">
<view>{{t('receive.wlbm')}}</view>
<view class="zongjian"></view>
<view>{{ item.MaterialNo }}</view>
</view>
<view class="itemBox">
<view>{{t('receive.ph')}}</view>
<view class="zongjian"></view>
<view>{{ item.Lot }}</view>
</view>
<view class="itemBox">
<view>{{ t('index.ck') }}</view>
<view class="zongjian"></view>
<view>{{ item.MultiLanguageText }}</view>
</view>
<view class="itemBox">
<view>{{ t('index.hgrksl') }}</view>
<view class="zongjian"></view>
<view>{{ item.StockInQuaAuxQty }}</view>
</view>
<view class="itemBox">
<view>{{ t('pubilc.qty') }}</view>
<view class="zongjian"></view>
<view>{{ item.CheckQty }}</view>
</view>
</view>
<view style="text-align: center;color: #F5F5F5;height: 20px;"></view>
</view>
<view v-if="state.dataList.length==0">
<up-empty mode="list"></up-empty>
</view>
</scroll-view>
</view>
</view>
</view>
</template>
<script lang="ts" setup>
import { reactive, nextTick, onMounted, ref, computed, watch } from 'vue';
import { onLoad, onShow, onReachBottom, } from '@dcloudio/uni-app'
import { useI18n } from 'vue-i18n'
import { parseTime } from '../../utils/tools.js';
import { PRD_MOViewIntoPro } from '../../common/request/api/api';
import scanFrame from '../../components/scan-frame/scan-frame.vue'
import tools from '../../components/tools/tools.vue'
import shortcut from '../../components/tools/shortcut.vue'
import { sqlite } from '../../stores/sqlite'
const DB = sqlite()
const inputRef = ref()
const scanFrameRef = ref()
const shortcutRef = ref()
const getI18n = useI18n()
const { t, locale } = getI18n
const state = reactive({
queryString: '',
dataList: [],
scrollHeight: 0,
page: {
pageIndex: 1,
pageSize: 200,
totalCount: 0
},
FBillNo: '',
materialId: '',
supplierName: '',
inputFocus: true,
scanFrameDataFeedback: {},
shortcutDataFeedback: {},
})
onLoad((pageData : any) => {
console.log(pageData);
state.materialId = pageData.id
state.FBillNo = pageData.fBillNo
fnDataList(state.materialId);
})
onMounted(() => {
const query = uni.createSelectorQuery().in(this);
query.select(".material-listBox").boundingClientRect((data) => {
state.scrollHeight = data.height
}).exec();
// scanFrameRef.value.stateShow(true)
})
const toDetails = (topId:any) => {
toPages('/pages/putInProd/details',{
id:state.materialId,
EntryId:topId,
FBillNo:state.FBillNo
})
}
/**
* 数据请求
*/
const fnDataList = (FBillNo : any, statesItem : boolean = false) => {
let param = {
id: FBillNo,
};
uni.showLoading({ mask: true });
PRD_MOViewIntoPro(param).then(res => {
uni.hideLoading();
if (res.code == 200) {
state.dataList = []
let dataListArray = res.data.Entry;
if (dataListArray.length > 0) {
dataListArray.forEach((p : any) => {
let item = {
Id: p.Id,
MaterialNo: p.MaterialNumber, //物料编码
MaterialName: formatLangTextValue(p.MaterialName), //物料名称
Lot: p.FLot_Text, //批号
CheckQty: p.Qty, //应扫数量
MultiLanguageText:Object.keys(p.StockId).length ? formatLangTextValue(p.StockId.Name) : t('index.zwck'),
StockInQuaAuxQty:p.StockInQuaAuxQty
};
state.dataList.push(item);
});
}
}
});
}
//中英切换
const formatLangTextValue = (val : any) => {
let lang_Id = uni.getStorageSync('locale')
let item = val.find(p => p.Key == (lang_Id == 'cn' ? 2052 : 1033));
if (item != null) {
return item.Value;
}
return val[0].Value;
}
const toPages = (url : string, data : any = {}) => {
uni.$u.route({
url: url,
params: data
})
}
</script>
<style lang="scss">
.app {
background-color: #F5F5F5;
.page {
padding: 18px 32rpx;
display: flex;
flex-direction: column;
height: 100%;
flex: 1;
.input-box {
background-color: white;
box-sizing: border-box;
padding: 0 16rpx;
border-radius: 24rpx;
margin: 0 0 32rpx 0;
.u-textarea {
padding: 0 !important;
font-size: 24rpx !important;
color: #999999 !important;
}
.input-item {
box-sizing: border-box;
padding: 16rpx 0;
color: #222222;
font-size: 28rpx;
font-weight: 400;
.item-title {
//font-weight: 500;
font-size: 32rpx;
color: #333333;
}
.item-text {
font-weight: 400;
font-size: 27rpx;
color: #999999;
}
}
}
.material-listBox {
flex: 1;
.list-box-list {
width: 100%;
.data-item {
border: 1px solid #efeaea;
border-radius: 20rpx;
box-shadow: 0rpx 15rpx 15rpx #efeaea;
padding: 20rpx 22rpx;
margin-bottom: 16rpx;
background-color: #ffffff;
.itemBox {
line-height: 50rpx;
display: flex;
justify-content: space-between;
align-items: center;
.zongjian {
height: 1px;
flex: 1;
background-color: #f0f0f0;
margin: 0 16rpx;
}
}
}
}
}
}
}
</style>