From 64b432916af9c9218ab3f3eca614e26c542142ae Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期二, 07 十一月 2023 15:47:13 +0800
Subject: [PATCH] bug
---
minipro_standard/pages_adjust/pages/manualFeed/manualFeed.vue | 701 ++++++++++++++++++++++++++++++++-------------------------
1 files changed, 392 insertions(+), 309 deletions(-)
diff --git a/minipro_standard/pages_adjust/pages/manualFeed/manualFeed.vue b/minipro_standard/pages_adjust/pages/manualFeed/manualFeed.vue
index e0e9a8d..c59ac58 100644
--- a/minipro_standard/pages_adjust/pages/manualFeed/manualFeed.vue
+++ b/minipro_standard/pages_adjust/pages/manualFeed/manualFeed.vue
@@ -1,320 +1,403 @@
-<template>
- <view class="tl">
- <workOrderInfo :orederMessage="{proUserList:[]}" />
- <div class="tl_title">
- <div class="tl_title_left">
- <div class="tl_title_left_x"></div>
- <span>鎶曟枡淇℃伅</span>
+<template>
+ <view class="tl">
+ <workOrderInfo :orederMessage="info" />
+ <div class="tl_title">
+ <div class="tl_title_left">
+ <div class="tl_title_left_x"></div>
+ <span>鎶曟枡淇℃伅</span>
<!-- <span>{{total == 0 ? '' : total}}{{formList[formList.length - 1].dw ? formList[formList.length - 1].dw : ''}}</span> -->
- <!-- <span>{{total == 0 ? '' : total}}{{formList[formList.length - 1].dw ? formList[formList.length - 1].dw : ''}}</span> -->
- </div>
- <div class="tl_title_right" @click="add">
- <image src="../../static/gongdan_ic_shoudong@2x.png" class="add-img" mode=""></image>
- <span>澧炲姞鎶曟枡</span>
- </div>
- </div>
- <u-swipe-action>
- <u-swipe-action-item v-for="(item, index) in materialList" :key="index" :options="options"
- @click="deleItem(index)">
- <div class="tl_list">
- <div class="tl_list_item" @click="open1(index)">
- <div class="tl_list_item_label">閫夋嫨鐗╂枡</div>
- <div class="tl_list_item_go" v-if="!item.materialName">
- <span>鐐瑰嚮璺宠浆鍒扮墿鏂欏垪琛�</span>
- <u-icon name="arrow-right"></u-icon>
- </div>
- <div class="tl_list_item_wl" v-else>
- <div class="tl_list_item_wl_top">
- <span>{{ item.materialName }}</span>
- <span> | {{ item.materialCode }}</span>
- </div>
- <div class="tl_list_item_wl_bottom">
- <span class="green" v-if="item.qualityType == 0">鍚堟牸</span>
- <span class="yellow" v-else-if="item.qualityType == 1">涓嶈壇</span>
- <span class="red" v-else-if="item.qualityType == 2">鎶ュ簾</span>
- <span>{{ item.procedureName ? ` / ${item.procedureName}` : ' / -' }}</span>
- <span>{{ item.locationName ? ` / ${item.locationName}` : ' / -' }}</span>
- <span>{{ item.batch ? ` / ${item.batch}` : ' / -' }}</span>
- </div>
- </div>
- </div>
- <div class="tl_list_item">
- <div class="tl_list_item_label">鎶曟枡鏁伴噺{{ item.unitAttribute }}</div>
- <div class="tl_list_item_go">
- <input type="text" @blur="changeNumber(item.num, index, item.unitAttribute)"
- v-model="item.num" />
- </div>
- </div>
- </div>
- </u-swipe-action-item>
+ <!-- <span>{{total == 0 ? '' : total}}{{formList[formList.length - 1].dw ? formList[formList.length - 1].dw : ''}}</span> -->
+ </div>
+ <div class="tl_title_right" @click="add">
+ <image src="../../static/gongdan_ic_shoudong@2x.png" class="add-img" mode=""></image>
+ <span>澧炲姞鎶曟枡</span>
+ </div>
+ </div>
+ <u-swipe-action>
+ <u-swipe-action-item v-for="(item, index) in materialList" :key="index" :options="options"
+ @click="deleItem(index)">
+ <div class="tl_list">
+ <div class="tl_list_item" @click="open1(index)">
+ <div class="tl_list_item_label">閫夋嫨鐗╂枡</div>
+ <div class="tl_list_item_go" v-if="!item.materialName">
+ <span>鐐瑰嚮璺宠浆鍒扮墿鏂欏垪琛�</span>
+ <u-icon name="arrow-right"></u-icon>
+ </div>
+ <div class="tl_list_item_wl" v-else>
+ <div class="tl_list_item_wl_top">
+ <span>{{ item.materialName }}</span>
+ <span> | {{ item.materialCode }}</span>
+ </div>
+ <div class="tl_list_item_wl_bottom">
+ <span class="green" v-if="item.qualityType == 0">鍚堟牸</span>
+ <span class="yellow" v-else-if="item.qualityType == 1">涓嶈壇</span>
+ <span class="red" v-else-if="item.qualityType == 2">鎶ュ簾</span>
+ <span>{{ item.procedureName ? ` / ${item.procedureName}` : ' / -' }}</span>
+ <span>{{ item.locationName ? ` / ${item.locationName}` : ' / -' }}</span>
+ <span>{{ item.batch ? ` / ${item.batch}` : ' / -' }}</span>
+ </div>
+ </div>
+ </div>
+ <div class="tl_list_item">
+ <div class="tl_list_item_label">鎶曟枡鏁伴噺{{ item.unitAttribute }}</div>
+ <div class="tl_list_item_go">
+ <input type="text" @blur="changeNumber(item.num, index, item.unitAttribute)"
+ v-model="item.num" />
+ </div>
+ </div>
+ </div>
+ </u-swipe-action-item>
</u-swipe-action>
- <SelectMaterial ref="selectMaterial" @selectAction="getValue"/>
- </view>
-</template>
-
-<script>
+ <view class="" style="height: 88rpx;"></view>
+ <u-safe-bottom></u-safe-bottom>
+ <div class="tl_footer">
+ <button class="tl_footer_submit" v-preventReClick @click="submit">鎻愪氦</button>
+ </div>
+ <SelectMaterial ref="selectMaterial" @selectAction="getValue" />
+ <!-- <SelectMultipleMaterial ref="selectMultipleMaterial" @selected="getMaterails"/> -->
+ </view>
+</template>
+
+<script>
import workOrderInfo from '@/components/workOrderInfo.vue'
import SelectMaterial from '@/components/selectMaterial.vue'
-
- import {
- positiveInteger,
- number
- } from '@/common/config'
- export default {
- components: {
+ // import SelectMultipleMaterial from '@/components/SelectMultipleMaterial.vue'
+ import {
+ queryById,
+ createMaterial,
+ createMaterialStandard
+ } from '@/util/api/WorkOrderAPI'
+ import {
+ positiveInteger,
+ number
+ } from '@/common/config'
+ export default {
+ components: {
workOrderInfo,
- SelectMaterial
- },
- data() {
- return {
- // formList: [{
- // id: Date.now(),
- // toolingTypeId: '', // 宸ヨ绫诲瀷
- // toolingTypeName: '', // 宸ヨ绫诲瀷鍚嶇О
- // workClothesId: '', // 宸ヨ
- // workClothesName: '', // 宸ヨ鍚嶇О
- // num: '', // 鏁伴噺
- // attribute: '', // 宸ヨ灞炴��
- // attributeType: '', // 宸ヨ灞炴�х被鍨�
- // dw: '', // 鐗╂枡鍗曚綅
- // unitAttribute: ''
- // }],
- materialList: [{
- id: '',
- materialName: '',
- materialCode: '',
- qualityType: '',
- procedureName: '',
- locationName: '',
- batch: '',
- num: '',
- unitAttribute: ''
- }],
- options: [{
- text: '鍒犻櫎',
- style: {
- backgroundColor: 'red',
- }
- }],
- };
+ SelectMaterial,
+ // SelectMultipleMaterial
},
- methods: {
+ data() {
+ return {
+ deviceId: '',
+ workorderId: '',
+ // formList: [{
+ // id: Date.now(),
+ // toolingTypeId: '', // 宸ヨ绫诲瀷
+ // toolingTypeName: '', // 宸ヨ绫诲瀷鍚嶇О
+ // workClothesId: '', // 宸ヨ
+ // workClothesName: '', // 宸ヨ鍚嶇О
+ // num: '', // 鏁伴噺
+ // attribute: '', // 宸ヨ灞炴��
+ // attributeType: '', // 宸ヨ灞炴�х被鍨�
+ // dw: '', // 鐗╂枡鍗曚綅
+ // unitAttribute: ''
+ // }],
+ info: {},
+ materialList: [{
+ id: '',
+ materialName: '',
+ materialCode: '',
+ qualityType: '',
+ procedureName: '',
+ locationName: '',
+ batch: '',
+ num: '',
+ unitAttribute: ''
+ }],
+ options: [{
+ text: '鍒犻櫎',
+ style: {
+ backgroundColor: 'red',
+ }
+ }],
+ };
+ },
+ onLoad(obj) {
+ this.workorderId = obj.id
+ queryById(this.workorderId)
+ .then(res => {
+ if (res.code === 200) {
+ this.info = res.data
+ this.deviceId = res.data.pgmodel.id
+ }
+ })
+ },
+ methods: {
open1(index) {
- this.$refs.selectMaterial.open({})
- },
- deleItem(index) {
- if (this.materialList.length === 1) {
- uni.$u.toast('鑷冲皯淇濈暀涓�鏉℃姇鏂欎俊鎭�')
- return
- }
- this.materialList.splice(index, 1)
- },
+ // this.$refs.selectMaterial.open({})
+ this.index = index
+ this.$refs.selectMaterial.open({
+ workorderId: this.workorderId,
+ deviceId: this.deviceId
+ })
+ },
+ deleItem(index) {
+ if (this.materialList.length === 1) {
+ uni.$u.toast('鑷冲皯淇濈暀涓�鏉℃姇鏂欎俊鎭�')
+ return
+ }
+ this.materialList.splice(index, 1)
+ },
add() {
- this.total += 1
- this.materialList.unshift({
- id: '',
- materialName: '',
- materialCode: '',
- qualityType: '',
- procedureName: '',
- locationName: '',
- batch: '',
- num: '',
- unitAttribute: ''
- })
- },
- changeNumber(num, index, unitAttribute) {
- if (unitAttribute === 0 && num !== '') {
- if (!positiveInteger.test(num)) {
- uni.$u.toast({
- message: '鍙兘杈撳叆姝f暣鏁�'
- })
- this.materialList[index].num = ''
- }
- } else if (unitAttribute === 1 && num !== '') {
- if (!number.test(num)) {
- uni.$u.toast({
- message: '鍙兘杈撳叆姝f暣鏁版垨灏忔暟锛堟渶澶氬洓浣嶏級'
- })
- this.materialList[index].num = ''
- }
- }
- if (num <= 0) {
- uni.$u.toast({
- message: '鎶曟枡鏁伴噺涓嶈兘灏忎簬绛変簬0'
- })
- this.materialList[index].num = ''
- }
+ this.total += 1
+ this.materialList.unshift({
+ id: '',
+ materialName: '',
+ materialCode: '',
+ qualityType: '',
+ procedureName: '',
+ locationName: '',
+ batch: '',
+ num: '',
+ unitAttribute: ''
+ })
+ },
+ changeNumber(num, index, unitAttribute) {
+ if (unitAttribute === 0 && num !== '') {
+ if (!positiveInteger.test(num)) {
+ uni.$u.toast({
+ message: '鍙兘杈撳叆姝f暣鏁�'
+ })
+ this.materialList[index].num = ''
+ }
+ } else if (unitAttribute === 1 && num !== '') {
+ if (!number.test(num)) {
+ uni.$u.toast({
+ message: '鍙兘杈撳叆姝f暣鏁版垨灏忔暟锛堟渶澶氬洓浣嶏級'
+ })
+ this.materialList[index].num = ''
+ }
+ }
+ if (num <= 0) {
+ uni.$u.toast({
+ message: '鎶曟枡鏁伴噺涓嶈兘灏忎簬绛変簬0'
+ })
+ this.materialList[index].num = ''
+ }
},
getValue(item) {
- console.log(item);
- }
- }
- }
-</script>
-
-<style lang="scss">
- .tl {
- width: 100%;
- height: 100%;
- position: absolute;
- background: #F7F7F7;
-
- .tl_title {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 30rpx;
-
- .tl_title_left {
- display: flex;
- align-items: center;
-
- .tl_title_left_x {
- width: 8rpx;
- height: 30rpx;
- background: $nav-color;
- border-radius: 2rpx;
- margin-right: 12rpx;
- }
-
- span {
- font-size: 32rpx;
- font-weight: 500;
- color: #222222;
-
- &:nth-child(3) {
- font-size: 28rpx;
- font-weight: 500;
- color: $nav-color;
- margin-left: 10rpx;
- }
- }
- }
-
- .tl_title_right {
- display: flex;
- align-items: center;
-
- .add-img {
- width: 28rpx;
- height: 28rpx;
- margin-right: 12rpx;
- }
-
- span {
- font-size: 28rpx;
- font-weight: 400;
- // color: $nav-color;
- }
- }
- }
-
- .tl_list {
- display: flex;
- flex-direction: column;
- background: white;
- padding: 0 30rpx;
- margin-bottom: 20rpx;
-
- .tl_list_item {
- min-height: 98rpx;
- // padding: 20rpx 0;
- box-sizing: border-box;
- display: flex;
- align-items: center;
- justify-content: space-between;
- border-bottom: 1rpx solid #E5E5E5;
-
- &:last-child {
- border: none !important;
- }
-
- .tl_list_item_label {
- font-size: 30rpx;
- font-weight: 400;
- color: #222222;
- }
-
- .tl_list_item_wl {
- display: flex;
- flex-direction: column;
- align-items: end;
-
- .tl_list_item_wl_top {
- display: flex;
- align-items: center;
-
- span {
- font-size: 28rpx;
- color: #222222;
- }
- }
-
- .tl_list_item_wl_bottom {
- display: flex;
- align-items: center;
-
- span {
- font-size: 28rpx;
- color: #222222;
- }
- }
- }
-
- .tl_list_item_go {
- display: flex;
- align-items: center;
-
- input {
- text-align: right;
- width: 180rpx;
- height: 60rpx;
- border-radius: 8rpx;
- border: 1rpx solid #E5E5E5;
- padding: 0 30rpx;
- box-sizing: border-box;
- font-size: 28rpx;
- font-weight: 400;
- color: #333333;
- }
-
- span {
- font-size: 28rpx;
- font-weight: 400;
- color: #999999;
- margin-right: 10rpx;
- }
- }
- }
- }
-
- .tl_zw {
- height: 160rpx;
- }
-
- .tl_footer {
- width: 100%;
- position: fixed;
- bottom: 0;
- left: 0;
- padding: 0 30rpx 68rpx 30rpx;
- box-sizing: border-box;
-
- .tl_footer_submit {
- width: 690rpx;
- height: 88rpx;
- border: none;
- background: #4275FC;
- box-shadow: 0 0 12rpx 0 rgba(0, 0, 0, 0.08);
- border-radius: 8rpx;
- font-size: 30rpx;
- font-weight: 500;
- color: #FFFFFF;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- }
- }
+ for (let i = 0; i < this.materialList.length; i++) {
+ if (item.id === this.materialList[i].id) {
+ uni.$u.toast({
+ message: '涓嶈兘閲嶅閫夋嫨鐩稿悓鐗╂枡'
+ })
+ return
+ }
+ }
+ this.materialList[this.index].id = item.id
+ this.materialList[this.index].materialName = item.materialName
+ this.materialList[this.index].num = item.num
+ this.materialList[this.index].batch = item.batch
+ this.materialList[this.index].locationName = item.locationName
+ this.materialList[this.index].materialCode = item.materialCode
+ this.materialList[this.index].procedureName = item.procedureName
+ this.materialList[this.index].qualityType = item.qualityType
+ this.materialList[this.index].unitAttribute = item.unitAttribute
+ },
+ submit() {
+ let temp = this.materialList.findIndex(item => !item.id || !item.num)
+ if (temp != -1) {
+ uni.$u.toast(`璇峰厛瀹屽杽绗�${temp + 1}鏉℃姇鏂欎俊鎭痐)
+ return
+ }
+ let total = this.materialList.reduce((accumulator, currentValue) => accumulator + Number(currentValue.num),
+ 0)
+ console.log(total);
+ if (this.info.bomType != 1 && this.info.hasBom != 1) {
+ if (total > this.info.planNum) {
+ uni.$u.toast(`鎶曟枡鏁伴噺涓嶈兘澶т簬璁″垝鏁伴噺`)
+ return
+ }
+ }
+ let recordList = this.materialList.map(item => {
+ return {
+ wstockId: item.id,
+ num: item.num
+ }
+ })
+ createMaterialStandard({
+ id: this.workorderId,
+ recordList
+ }).then(res => {
+ if (res.code === 200) {
+ // Toast.success({ message: '鎶曟枡鎴愬姛', duration: 2000, forbidClick: true })
+ // setTimeout(() => {
+ // router.go(-1)
+ // }, 2000)
+ uni.$u.toast(`鎶曟枡鎴愬姛`)
+ uni.$emit('addMaterial')
+ uni.navigateBack()
+ }
+ })
+ }
+ }
+ }
+</script>
+
+<style lang="scss">
+ .tl {
+ width: 100%;
+ height: 100%;
+ position: absolute;
+ background: #F7F7F7;
+
+ .tl_title {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 30rpx;
+
+ .tl_title_left {
+ display: flex;
+ align-items: center;
+
+ .tl_title_left_x {
+ width: 8rpx;
+ height: 30rpx;
+ background: $nav-color;
+ border-radius: 2rpx;
+ margin-right: 12rpx;
+ }
+
+ span {
+ font-size: 32rpx;
+ font-weight: 500;
+ color: #222222;
+
+ &:nth-child(3) {
+ font-size: 28rpx;
+ font-weight: 500;
+ color: $nav-color;
+ margin-left: 10rpx;
+ }
+ }
+ }
+
+ .tl_title_right {
+ display: flex;
+ align-items: center;
+
+ .add-img {
+ width: 28rpx;
+ height: 28rpx;
+ margin-right: 12rpx;
+ }
+
+ span {
+ font-size: 28rpx;
+ font-weight: 400;
+ // color: $nav-color;
+ }
+ }
+ }
+
+ .tl_list {
+ display: flex;
+ flex-direction: column;
+ background: white;
+ padding: 0 30rpx;
+ margin-bottom: 20rpx;
+
+ .tl_list_item {
+ min-height: 98rpx;
+ // padding: 20rpx 0;
+ box-sizing: border-box;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ border-bottom: 1rpx solid #E5E5E5;
+
+ &:last-child {
+ border: none !important;
+ }
+
+ .tl_list_item_label {
+ font-size: 30rpx;
+ font-weight: 400;
+ color: #222222;
+ }
+
+ .tl_list_item_wl {
+ display: flex;
+ flex-direction: column;
+ align-items: end;
+
+ .tl_list_item_wl_top {
+ display: flex;
+ align-items: center;
+
+ span {
+ font-size: 28rpx;
+ color: #222222;
+ }
+ }
+
+ .tl_list_item_wl_bottom {
+ display: flex;
+ align-items: center;
+
+ span {
+ font-size: 28rpx;
+ color: #222222;
+ }
+ }
+ }
+
+ .tl_list_item_go {
+ display: flex;
+ align-items: center;
+
+ input {
+ text-align: right;
+ width: 180rpx;
+ height: 60rpx;
+ border-radius: 8rpx;
+ border: 1rpx solid #E5E5E5;
+ padding: 0 30rpx;
+ box-sizing: border-box;
+ font-size: 28rpx;
+ font-weight: 400;
+ color: #333333;
+ }
+
+ span {
+ font-size: 28rpx;
+ font-weight: 400;
+ color: #999999;
+ margin-right: 10rpx;
+ }
+ }
+ }
+ }
+
+ .tl_zw {
+ height: 160rpx;
+ }
+
+ .tl_footer {
+ width: 100%;
+ position: fixed;
+ bottom: 0;
+ padding: 0 30rpx calc(env(safe-area-inset-bottom) + 20rpx);
+ box-sizing: border-box;
+ z-index: 999;
+ background-color: #fff;
+
+ .tl_footer_submit {
+ width: 690rpx;
+ height: 88rpx;
+ border: none;
+ background: #4275FC;
+ box-shadow: 0 0 12rpx 0 rgba(0, 0, 0, 0.08);
+ border-radius: 8rpx;
+ font-size: 30rpx;
+ font-weight: 500;
+ color: #FFFFFF;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+ }
+ }
</style>
--
Gitblit v1.9.3