123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447 |
- <template>
- <view class="uni-column" style="padding: 24rpx;position: fixed;left: 0;right: 0;">
- <view class="box-bg uni-row">
- <view class="input-view uni-row">
- <uni-icons class="input-uni-icon" type="search" size="18" color="#999" />
- <input class="nav-bar-input" type="text" v-model="keywords" placeholder="输入搜索关键词" />
- </view>
- <view class="search" @click="handleSearch">搜索</view>
- </view>
- <view v-if="listData.length == 0" style="color: #999;margin: 50% auto;">
- <text>暂无生产计划</text>
- </view>
- <view v-else style="height: calc(100% - 100rpx); overflow: auto;margin-bottom: 100px;">
- <view v-for="(item, index) in listData" :key="index" @click="handleToBatchReporting(item)"
- class="list-item">
- <view class="title-container uni-row">
- <view class="title uni-row">
- <text class="label">生产计划单号</text>
- <text class="label code">{{ item['productionPlanNo'] }}</text>
- <text class="label" style="margin-left: 20px;">序号</text>
- <text class="label code">{{ item['lineNumber'] }}</text>
- </view>
- <view v-if="item['dayWorkList'].length > 0" class="tag"><text class="label">进行中</text></view>
- <view v-else type="default" class="tag not-start"><text class="label">未开始</text></view>
- </view>
- <view class="item-info uni-row">
- <text class="label">产品描述</text>
- <text class="label right">{{ item['productDescription'] }}</text>
- </view>
- <view class="item-info uni-row">
- <text class="label">总批数</text>
- <text class="label right">{{ item['totalLotNumber'] }}</text>
- </view>
- <!-- <view class="item-info uni-row">
- <text class="label">完成批数</text>
- <text class="label right">{{ item['equiment'] }}</text>
- </view> -->
- <view class="item-info uni-row">
- <text class="label">投产数</text>
- <text class="label right">{{ item['productionQuantity'] }}</text>
- </view>
- <view class="item-info uni-row">
- <text class="label">单批量</text>
- <text class="label right">{{ item['oneLotQuantity'] }}</text>
- </view>
- </view>
- </view>
- <view class="bottom uni-row">
- <button class="start-batch-btn" style="margin-right: 10rpx;background-color: #67c337;"
- @click="handleScanCode">扫码报工</button>
- <button class="start-batch-btn" type="primary" @click="handleSearchCode">查箱号</button>
- </view>
- <dialog-selectDaywork ref='selectDaywork' @handleSelectDaywork='handleSelectDaywork'></dialog-selectDaywork>
- <QrScanner v-if="showQrCodeReader" @decode="onDecodeHandler" @close="qrReaderClose" />
- </view>
- </template>
- <script setup>
- import {
- getPlanDetailsList,
- selectByCarrierCode,
- selectInfoByLotCode
- } from '@/api/business/planDetails.js'
- import {
- ref
- } from 'vue'
- import {
- onReady,
- onLoad,
- onUnload,
- onPullDownRefresh,
- onShow
- } from '@dcloudio/uni-app'
- import QrScanner from '../vueQrCode/index.vue'
- import {
- getToken
- } from '@/utils/auth'
- import {
- store
- } from '@/store/index.js'
- import {
- getUserProcess
- } from '@/api/process/process.js'
- const listData = ref([])
- const keywords = ref('')
- const selectDaywork = ref(null)
- const carrierCode = ref(null)
- const showQrCodeReader = ref(false);
- onLoad(() => {
- // dayworkItem数据更改后刷新数据
- // uni.$on('dayworkItemUpdate', reflush);
- })
- onShow(() => {
- reflush();
- })
- onUnload(() => {
- console.log(store.curDeptDetails)
- // uni.$off('dayworkItemUpdate', reflush)
- })
- /**
- * 监听下拉刷新
- */
- onPullDownRefresh(() => {
- uni.stopPullDownRefresh();
- reflush();
- // getPlanDetailsList({
- // deptId: Number(store.curDeptDetails.deptId),
- // keywords: keywords.value
- // }).then(res => {
- // if (res.code == 200) {
- // listData.value = res.data;
- // uni.stopPullDownRefresh();
- // }
- // uni.stopPullDownRefresh();
- // })
- })
- function reflush() {
- keywords.value = ''
- init();
- }
- function init(data) {
- uni.showLoading({
- title: '加载中'
- });
- getPlanDetailsList({
- deptId: Number(store.curDeptDetails.deptId),
- keywords: keywords.value
- }).then(res => {
- if (res.code == 200) {
- listData.value = res.data;
- uni.hideLoading();
- }
- uni.hideLoading();
- })
- }
- function handleToBatchReporting(item) {
- store.planDetails = item
- uni.navigateTo({
- url: '/pages/sortBatchReporting/index'
- })
- }
- //查箱号
- function handleSearchCode() {
- uni.navigateTo({
- url: '/pages/sortProductionPlan/details'
- })
- }
- //带回
- function handleSelectDaywork(data) {
- console.log(data)
- //查询计划单信息跳转
- selectInfoByLotCode({
- lotCode: data
- }).then(res => {
- store.planDetails = res.data
- var code = encodeURIComponent(carrierCode.value);
- // 构建查询参数字符串
- var queryParam =
- `param1=${code}`;
- // 使用模板字符串构建完整的URL
- var navigateUrl = `/pages/sortBatchReporting/index?${queryParam}`;
- uni.navigateTo({
- url: navigateUrl
- });
- })
- }
- function handleSearch() {
- let reqParam = {
- keywords: keywords.value
- }
- reqParam.tenantId = !store.tenantId ? store.userInfo.tenantId : store.tenantId;
- init(reqParam)
- }
- //H5扫码器回调
- function onDecodeHandler(data) {
- showQrCodeReader.value = false;
- let vehicleObj = {
- carrierCode: data
- };
- if (!vehicleObj.carrierCode || vehicleObj.carrierCode == "") {
- uni.showToast({
- icon: "none",
- title: "请扫载具码",
- duration: 1000
- })
- return;
- }
- selectByCarrierCode({
- carrierCode: vehicleObj.carrierCode,
- deptId: Number(store.curDeptDetails.deptId)
- }).then(response => {
- carrierCode.value = vehicleObj.carrierCode
- if (response.code == 200) {
- if (response.data.length > 1) {
- selectDaywork.value.open(response.data)
- } else {
- handleSelectDaywork(response.data[0].lotCode)
- }
- } else {
- uni.showToast({
- icon: 'none',
- title: response.msg,
- duration: 2000
- })
- }
- })
- }
- //H5扫码器关闭
- function qrReaderClose() {
- showQrCodeReader.value = false;
- }
- function handleScanCode() {
- showQrCodeReader.value = true;
- // 引入原生插件
- // const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
- // // const mpaasScanModule = null
- // if (mpaasScanModule) {
- // // 调用插件的 mpaasScan 方法
- // mpaasScanModule.mpaasScan({
- // // 扫码识别类型,参数可多选,qrCode、barCode,
- // // 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
- // scanType: ["qrCode", "barCode"],
- // // 是否隐藏相册,默认false不隐藏
- // hideAlbum: false,
- // },
- // (ret) => {
- // console.log(ret);
- // let vehicleObj = {
- // carrierCode: ret.resp_result
- // };
- // if (!vehicleObj.carrierCode || vehicleObj.carrierCode == "") {
- // uni.showToast({
- // icon: "none",
- // title: "请扫载具码",
- // duration: 1000
- // })
- // return;
- // }
- // selectByCarrierCode({
- // carrierCode: vehicleObj.carrierCode,
- // deptId:Number(store.curDeptDetails.deptId)
- // }).then(response => {
- // carrierCode.value = vehicleObj.carrierCode
- // if (response.code == 200) {
- // if (response.data.length > 1) {
- // selectDaywork.value.open(response.data)
- // } else {
- // handleSelectDaywork(response.data[0].lotCode)
- // }
- // } else {
- // uni.showToast({
- // icon: 'none',
- // title: response.msg,
- // duration: 2000
- // })
- // }
- // })
- // }
- // );
- // } else {
- // // 测试时用
- // selectByCarrierCode({
- // carrierCode: '000745',
- // deptId:Number(store.curDeptDetails.deptId)
- // }).then(response => {
- // if (response.code == 200) {
- // carrierCode.value = '000745'
- // if (response.data.length > 1) {
- // selectDaywork.value.open(response.data)
- // } else {
- // handleSelectDaywork(response.data[0].lotCode)
- // }
- // } else {
- // uni.showToast({
- // icon: 'none',
- // title: response.msg,
- // duration: 2000
- // })
- // }
- // })
- // }
- }
- </script>
- <style lang="scss">
- $nav-height: 60rpx;
- .box-bg {
- width: 100%;
- background-color: #F5F5F5;
- padding: 5rpx 0;
- justify-content: space-around;
- align-items: center;
- .input-view {
- width: 100%;
- flex: 4;
- background-color: #f8f8f8;
- height: $nav-height;
- border: 1rpx solid #999;
- border-radius: 15rpx;
- padding: 0 15rpx;
- flex-wrap: nowrap;
- margin: 0 10rpx 20rpx;
- line-height: $nav-height;
- .input-uni-icon {
- line-height: $nav-height;
- }
- .nav-bar-input {
- width: 80%;
- height: $nav-height;
- line-height: $nav-height;
- padding: 0 5rpx;
- background-color: #f8f8f8;
- }
- }
- .search {
- width: 20%;
- text-align: center;
- color: #808080;
- margin-top: -20rpx;
- }
- }
- .uni-column {
- background-color: rgba(245, 245, 245, 1);
- height: calc(100% - 40rpx);
- }
- .list-item {
- background-color: #fff;
- position: relative;
- padding: 16rpx;
- padding-bottom: 24rpx;
- border-radius: 24rpx;
- margin-bottom: 24rpx;
- .title-container {
- justify-content: space-between;
- margin-top: 8rpx;
- margin-bottom: 16rpx;
- .title {
- height: 48rpx;
- align-items: center;
- .label {
- font-size: 32rpx;
- font-weight: bold;
- &.code {
- margin-left: 8rpx;
- }
- }
- }
- .tag {
- border: 1px solid #1ce5b0;
- background-color: #f6fffd;
- padding: 8rpx;
- border-radius: 8rpx;
- .label {
- color: #1ce5b0;
- font-size: 24rpx;
- }
- &.not-start {
- border: 1px solid #bbbbbb;
- background-color: #f5f5f5;
- .label {
- color: #bbbbbb;
- }
- }
- }
- }
- .item-info {
- margin-bottom: 8rpx;
- .label {
- font-size: 28rpx;
- width: 220rpx;
- color: #808080;
- &.right {
- flex: 1;
- color: #000000;
- }
- }
- }
- }
- .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;
- .start-batch-btn {
- flex: 1;
- height: 80rpx;
- line-height: 80rpx;
- border-radius: 8rpx;
- color: #FFFFFF;
- font-size: 28rpx;
- }
- .view-end-btn {
- flex: 1;
- height: 80rpx;
- line-height: 80rpx;
- border-radius: 8rpx;
- color: #FFFFFF;
- font-size: 28rpx;
- }
- }
- </style>
|