123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278 |
- <template>
- <view class='container'>
- <view class='content'>
- <view>
- <text class='title'>选择批次号</text>
- <view>
- <view class="batchNo uni-row">
- <view :class="{'batchNo-item':true, 'uni-row': true,'check':selected === item}"
- v-for="(item,index) in batchNoList" :key='index' @click="handleCheckBatchNo(item)">
- {{item}}
- </view>
- </view>
- </view>
- </view>
- <view class='middle'>
- <view class='segment'></view>
- <uni-icons type="link" size="30" style="margin: 10rpx; transform: rotate(135deg);"></uni-icons>
- <view class='segment'></view>
- </view>
- <view>
- <text class='title'>绑定载具</text>
- <view class="vehicleList uni-row">
- <view class="vehicleNo uni-row" v-for="(item,index) in vehicleList">
- <text>{{item.carrierCode}}</text>
- <text @click="handleDelVehicleNo(index)">×</text>
- </view>
- </view>
- <view>
- <button style='background-color: rgba(0, 226, 166,1);
- color: white;margin: 20rpx auto;
- width: 80%;' @click='scanCodeHandle()'>扫码</button>
- </view>
- </view>
- <view class='middle'>
- <view class='segment'></view>
- <uni-icons type="paperclip" size="30" style="margin: 10rpx;"></uni-icons>
- <view class='segment'></view>
- </view>
- <view>
- <text class='title' style="margin-bottom: 50rpx;">基础信息</text>
- <view class="uni-row info">
- <label for="HeatNo">炉号</label>
- <!-- <input id="HeatNo" class="uni-input" v-model="basicInfo.heatNo" placeholder="请填写" /> -->
- <text id="HeatNo" class="uni-input">{{basicInfo.heatNo}}</text>
- </view>
- <view class='segment' style="width: 90%;margin: 20rpx auto;"></view>
- <view class="uni-row info">
- <label for="manufacturer">厂家</label>
- <!-- <input id="manufacturer" class="uni-input" v-model="basicInfo.manufacturer" placeholder="请填写" /> -->
- <text id="manufacturer" class="uni-input">{{basicInfo.manufacturer}}</text>
- </view>
- <view class='segment' style="width: 90%;margin: 20rpx auto;"></view>
- <view class="uni-row info">
- <label for="incomingInfo">来料信息</label>
- <!-- <input id="incomingInfo" class="uni-input" v-model="basicInfo.incomingInfo" placeholder="请填写" /> -->
- <text id="incomingInfo" class="uni-input">{{basicInfo.incomingInfo}}</text>
- </view>
- <view class='segment' style="width: 90%;margin: 20rpx auto;"></view>
- </view>
- </view>
- <view class='bottom uni-row'>
- <button class='add' type=primary @click='addHandle'>添加</button>
- </view>
- </view>
- </template>
- <script setup>
- import {
- ref
- } from 'vue'
- import {
- onLoad,
- onReady
- } from '@dcloudio/uni-app'
- import {
- getLotList
- } from "@/api/business/lot.js"
- import {
- saveDayWork
- } from '@/api/business/dayWork.js'
-
- onReady(() => {
- init();
- })
- const batchNoCheck = ref(false)
- const batchNoList = ref([])
- const vehicleList = ref([{
- carrierId: '1731475038666575873',
- carrierCode: '0001'
- },
- {
- carrierId: '1731467623237767169',
- carrierCode: '0002'
- }])
- const basicInfo = ref({
- heatNo: 'cs222',
- manufacturer: 'DMS',
- incomingInfo: 'L123456'
- })
- const selected = ref(null)
- const boxNo = ref(null)
- const productPlanId = ref('0')
- const dayWork = ref({})
- function init() {
- let obj = {}
- obj.productionPlanId = productPlanId.value;
- getLotList(obj).then(res => {
- for (var i = 0; i < res.rows.length; i++) {
- batchNoList.value.push(res.rows[i].lotCode)
- }
- console.log(batchNoList.value)
- })
- // getSubPlanDetailsList().then(res => {
- // console.log(res)
- // })
- }
- function handleCheckBatchNo(item) {
- selected.value = item;
- dayWork.value.lotId = item.id;
- dayWork.value.lotCode = item.lotCode;
- }
- function handleDelVehicleNo(index) {
- vehicleList.value.splice(index, 1);
- }
- function scanCodeHandle() {
- uni.scanCode({
- scanType: ['barCode'], // 条形码扫描
- onlyFromCamera: true, // 只允许相机扫码
- success: function(res) {
- vehicleList.value.push(res.result);
- }
- });
- }
- function addHandle() {
- dayWork.value.dayworkCarriers = vehicleList.value;
- saveDayWork(dayWork.value).then(res => {
- if(res.code === 200){
- uni.showToast({
- icon: 'success',
- title: '添加成功',
- duration: 2000
- });
- uni.navigateTo({
- url:'/pages/batchReporting/index'
- })
- }else{
- uni.showToast({
- icon: 'error',
- title: '添加失败',
- duration: 2000
- });
- }
- })
- }
- </script>
- <style lang="scss">
- .container {
- height: 100%;
- background-color: #f5f5f5;
- }
- .bottom {
- background-color: white;
- width: 100%;
- height: 10%;
- position: fixed;
- bottom: 0;
- align-items: center;
- .add {
- margin: 0 auto;
- width: 80%;
- height: 80rpx;
- line-height: 80rpx;
- padding-left: 0;
- }
- }
- .content {
- width: 90%;
- // height: auto;
- background-color: rgba(255, 255, 255, 1);
- margin: 50rpx auto;
- padding-bottom: 50rpx;
- padding-top: 20rpx;
- border-radius: 12rpx;
- .title {
- margin: 10rpx 39%;
- width: 30%;
- font-size: 36rpx;
- font-weight: bold;
- }
- }
- .batchNo {
- justify-content: flex-start;
- flex-wrap: wrap;
- width: 100%;
- height: 320rpx;
- overflow: auto;
- padding: 0 80rpx;
- margin-bottom: 40rpx;
- border-radius: 6rpx;
- .batchNo-item {
- justify-content: center;
- align-items: center;
- width: 240rpx;
- margin: 10rpx;
- height: 60rpx;
- border: 1px solid rgba(213, 213, 213, 1);
- border-radius: 6rpx;
- }
- .check {
- color: #FFF;
- border: 1 solid rgba(22, 132, 252, 1);
- background-color: rgba(22, 132, 252, 1);
- }
- }
- .vehicleList {
- justify-content: flex-start;
- flex-wrap: wrap;
- width: 100%;
- height: 120rpx;
- overflow: auto;
- padding: 0 80rpx;
- .vehicleNo {
- padding: 0 10rpx;
- margin: 10rpx;
- justify-content: space-between;
- align-items: center;
- width: 230rpx;
- height: 60rpx;
- border: 1px solid rgba(213, 213, 213, 1);
- border-radius: 6rpx;
- }
- }
- .middle {
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: center
- }
- .segment {
- width: 280rpx;
- background-color: rgba(213, 213, 213, 1);
- border: 1rpx solid rgba(213, 213, 213, 1);
- }
- .info {
- width: 100%;
- justify-content: space-around;
- label {
- flex: 3;
- text-combine-upright: all;
- margin: 0 30rpx;
- }
- text {
- flex: 3;
- width: 80%;
- }
- }
- </style>
|