From 1f4e7d0f73a73e7350cf5a1df279d5f30904c5d5 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期三, 06 十二月 2023 08:41:32 +0800
Subject: [PATCH] bug

---
 h5_standard/src/views/needToBeDealtWith/addWarehousing.vue |  597 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 588 insertions(+), 9 deletions(-)

diff --git a/h5_standard/src/views/needToBeDealtWith/addWarehousing.vue b/h5_standard/src/views/needToBeDealtWith/addWarehousing.vue
index d8e4816..1d9ab0b 100644
--- a/h5_standard/src/views/needToBeDealtWith/addWarehousing.vue
+++ b/h5_standard/src/views/needToBeDealtWith/addWarehousing.vue
@@ -1,18 +1,597 @@
 <template>
-    <div class="page">
-        鏂板鍏ュ簱
+    <div class="rework">
+        <div class="rework_list">
+            <div class="rework_list_item" @click="typeShow = true">
+                <span><b>*</b>鍗曟嵁绫诲瀷</span>
+                <div class="rework_list_item_right">
+                    <span :class="form.typeName ? 'black' : ''">{{form.typeName ? form.typeName : '璇烽�夋嫨'}}</span>
+                    <van-icon name="arrow" size="20" color="#999999" />
+                </div>
+            </div>
+            <div class="rework_list_item" @click="warehouseShow = true">
+                <span><b>*</b>鍏ュ簱浠撳簱</span>
+                <div class="rework_list_item_right">
+                    <span :class="form.warehouseName ? 'black' : ''">{{form.warehouseName ? form.warehouseName : '璇烽�夋嫨'}}</span>
+                    <van-icon name="arrow" size="20" color="#999999" />
+                </div>
+            </div>
+        </div>
+        <div class="rework_qd">
+            <div class="rework_qd_title">
+                <div class="rework_qd_title_left">
+                    <div class="x"></div>
+                    <span>{{`鍏ュ簱鐗╂枡娓呭崟${list.length}`}}</span>
+                </div>
+                <div class="rework_qd_title_right" @click="addItem">
+                    <img src="@/assets/icon/gongdan_ic_shoudong@2x.png" alt="" />
+                    <span>澧炲姞鍏ュ簱</span>
+                </div>
+            </div>
+            <van-swipe-cell v-for="(item, index) in list" :key="index">
+                <div class="rework_qd_list">
+                    <div class="rework_qd_item" @click="openL(index)" v-if="location">
+                        <span><b>*</b>鍏ュ簱璐т綅</span>
+                        <div class="rework_qd_item_right">
+                            <span :class="item.locationName ? 'black' : ''">{{item.locationName ? item.locationName : '璇烽�夋嫨'}}</span>
+                            <van-icon name="arrow" size="20" color="#999999" />
+                        </div>
+                    </div>
+                    <div class="rework_qd_item" @click="openMaterial(index)">
+                        <span><b>*</b>鍏ュ簱鐗╂枡</span>
+                        <div class="rework_qd_item_right">
+                            <span :class="item.materialName ? 'black' : ''">{{item.materialName ? item.materialName : '璇烽�夋嫨'}}</span>
+                            <van-icon name="arrow" size="20" color="#999999" />
+                        </div>
+                    </div>
+                    <template v-if="form.type !== 25">
+                        <div class="rework_qd_item" v-if="item.hasBom !== 0" @click="openGX(index)">
+                            <span>鐢熶骇宸ュ簭</span>
+                            <div class="rework_qd_item_right">
+                                <span :class="item.procedureName ? 'black' : ''">{{item.procedureName ? item.procedureName : '璇烽�夋嫨'}}</span>
+                                <van-icon name="arrow" size="20" color="#999999" />
+                            </div>
+                        </div>
+                    </template>
+                    <div class="rework_qd_item" @click="openQ(index)">
+                        <span><b>*</b>璐ㄩ噺灞炴��</span>
+                        <div class="rework_qd_item_right">
+                            <span :class="item.qualityTypeName ? 'black' : ''">{{item.qualityTypeName ? item.qualityTypeName : '璇烽�夋嫨'}}</span>
+                            <van-icon name="arrow" size="20" color="#999999" />
+                        </div>
+                    </div>
+                    <div class="rework_qd_item">
+                        <span>鎵规鍙�</span>
+                        <div class="rework_qd_item_right">
+                            <input type="text" v-model="item.batch" placeholder="璇疯緭鍏�" />
+                        </div>
+                    </div>
+                    <div class="rework_qd_item">
+                        <span><b>*</b>鍏ュ簱鏁伴噺<template v-if="item.unitName">({{ item.unitName }})</template></span>
+                        <div class="rework_qd_item_right">
+                            <input type="text" v-model="item.num" placeholder="0" />
+                        </div>
+                    </div>
+                </div>
+                <template #right>
+                    <van-button style="height: 100%;" square type="danger" text="鍒犻櫎" @click="dele(index)" />
+                </template>
+            </van-swipe-cell>
+        </div>
+        <div class="rework_zw"></div>
+        <div class="rework_footer">
+            <button class="rework_footer_submit" @click="onConfirm">鎻愪氦</button>
+        </div>
+        <!-- 浠撳簱 -->
+        <Warehouse :show="warehouseShow" @close="close" @value="getValue" />
+        <!-- 鐗╂枡 -->
+        <Material :show="materialsShow" @close="close1" @value="getValue1" />
+        <!-- 璐ㄩ噺灞炴�� -->
+        <Quality :show="qualityShow" @close="close2" @value="getValue2" />
+        <!-- 閫夋嫨璐т綅 -->
+        <Location :show="locationShow" :list="locationList" @close="close3" @value="getValue3" />
+        <!-- 宸ュ簭 -->
+        <ProductionProcess :show="productionShow" :list="productionList" @close="close4" @value="getValue4" />
+        <!-- 鍗曟嵁绫诲瀷 -->
+        <van-popup v-model:show="typeShow" round position="bottom" :style="{ height: '50%' }">
+            <van-picker
+                :columns="columns"
+                @confirm="onConfirm1"
+                @cancel="onCancel"
+                :columns-field-names="customFieldName"
+            />
+        </van-popup>
     </div>
 </template>
 
 <script setup lang="ts">
+    import { onMounted, ref, reactive } from 'vue'
+    import { useRouter } from 'vue-router'
+    import { Toast } from 'vant'
+    import { getListByWarehouseId, wOutBoundForStockUp } from '@/apis/WorkOrderAPI'
+    import { getListByMaterialId } from '@/apis/ExWarehouse'
+    import Warehouse from '@/components/common/Warehouse.vue'
+    import Material from '@/components/newCom/Material.vue'
+    import Quality from '@/components/newCom/quality.vue'
+    import Location from '@/components/newCom/location.vue'
+    import ProductionProcess from '@/components/newCom/productionProcess.vue'
 
+    const router = useRouter()
+    // 琛ㄥ崟鏁版嵁
+    let form: any = reactive({
+        warehouseName: '',
+        warehouseId: '',
+        type: '',
+        typeName: ''
+    })
+
+    let locationList: any = ref([])
+    let location: any = ref(true)
+    let productionList: any = ref([])
+
+    let i = ref(0)
+
+    let columns = ref([
+        { name: '閲囪喘鍏ュ簱', id: 25 },
+        { name: '搴撳瓨璋冩暣', id: 28 }
+    ])
+    const customFieldName = {
+      text: 'name'
+    };
+    let list = ref<Array<any>>([
+        {
+            batch: '',
+            locationId: '',
+            locationIdLabel: '',
+            locationName: '',
+            materialId: '',
+            materialName: '',
+            num: '',
+            hasBom: '',
+            procedureId: '',
+            procedureName: '',
+            qualityType: '',
+            qualityTypeName: '',
+            unitId: '',
+            unitName: ''
+        }
+    ])
+    let warehouseShow = ref<boolean>(false)
+    let materialsShow = ref<boolean>(false)
+    let qualityShow = ref<boolean>(false)
+    let locationShow = ref<boolean>(false)
+    let typeShow = ref<boolean>(false)
+    let productionShow = ref<boolean>(false)
+
+    // 鎵撳紑閫夋嫨鐗╂枡
+    const openMaterial = (index: number) => {
+        i.value = index
+        materialsShow.value = true
+    }
+    // 鎵撳紑閫夋嫨鐗╂枡
+    const openQ = (index: number) => {
+        if (list.value[index].locationIdLabel == 'APPLIANCE_ONTEST' || list.value[index].locationIdLabel == 'APPLIANCE_OFFTEST' || list.value[index].locationIdLabel == 'APPLIANCE_USELESS') {
+            return
+        }
+        i.value = index
+        qualityShow.value = true
+    }
+    // 鎵撳紑宸ュ簭
+    const openGX = (index: number) => {
+        if (!list.value[index].materialId) return Toast('璇峰厛閫夋嫨鍏ュ簱鐗╂枡')
+        i.value = index
+        productionShow.value = true
+    }
+    // 鎵撳紑閫夋嫨璐т綅
+    const openL = (index: number) => {
+        if (!form.warehouseId) return Toast('璇烽�夋嫨鍏ュ簱浠撳簱')
+        i.value = index
+        locationShow.value = true
+    }
+    const addItem = () => {
+        if (!form.warehouseId) return Toast('璇烽�夋嫨鍏ュ簱浠撳簱')
+        list.value.push({
+            batch: '',
+            locationId: list.value[list.value.length - 1].locationId,
+            locationName: list.value[list.value.length - 1].locationName,
+            locationIdLabel: list.value[list.value.length - 1].locationIdLabel,
+            materialId: '',
+            materialName: '',
+            num: '',
+            hasBom: '',
+            procedureId: '',
+            procedureName: '',
+            qualityType: list.value[list.value.length - 1].qualityType,
+            qualityTypeName: list.value[list.value.length - 1].qualityTypeName,
+            unitId: '',
+            unitName: ''
+        })
+    }
+
+    const onConfirm1 = (value: any) => {
+        form.typeName = value.name
+        form.type = value.id
+        if (value.id == 25) {
+            list.value.forEach(item => {
+                item.procedureId = ''
+                item.procedureName = ''
+            })
+        }
+        typeShow.value = false
+    };
+    const onCancel = () => {
+        typeShow.value = false
+    }
+    
+    // 鑾峰彇褰撳ぉ骞存湀鏃�
+    const getDay = () => {
+        var date = new Date();
+        var year = date.getFullYear();
+        var month = date.getMonth() + 1;
+        var day = date.getDate();
+        return `${year}-${month <= 9 ? `0${month}` : month}-${day <= 9 ? `0${day}` : day}`
+    }
+
+    // 鎻愪氦
+    const onConfirm = () => {
+        if (!form.type) return Toast('璇烽�夋嫨鍗曟嵁绫诲瀷')
+        if (!form.warehouseId) return Toast('璇烽�夋嫨鍏ュ簱浠撳簱')
+        if (list.value.length === 0) return Toast('璇峰厛娣诲姞鍏ュ簱鐗╂枡')
+        for (let i = 0; i < list.value.length; i++) {
+            if (!list.value[i].locationId) return Toast(`绗�${i+1}椤瑰叆搴撹揣浣嶄笉鑳戒负绌篳)
+            if (!list.value[i].materialId) return Toast(`绗�${i+1}椤瑰叆搴撶墿鏂欎笉鑳戒负绌篳)
+            if (!list.value[i].qualityType) return Toast(`绗�${i+1}椤硅川閲忓睘鎬т笉鑳戒负绌篳)
+            if (list.value[i].num <= 0) {
+                return Toast(`绗�${i + 1}椤瑰叆搴撴暟閲忓繀椤诲ぇ浜�0`)
+            }
+        }
+        wOutBoundForStockUp({
+            type: form.type,
+            planDate: getDay(),
+            validDate: getDay(),
+            warehouseId: form.warehouseId,
+            woutboundInBodyBeanList: list.value
+        }).then(res => {
+            if (res.code === 200) {
+                Toast.success({message: '鍏ュ簱鎴愬姛'})
+                setTimeout(() => {
+                    router.go(-1)
+                }, 2000)
+            }
+        })
+    }
+
+    // 鎵撳紑閫夋嫨鐗╂枡
+    const openMs = () => {
+        if (!form.warehouseId) return Toast('璇峰厛閫夋嫨鍑哄簱浠撳簱')
+        const { selected }: any = Material.value
+        let ids = list.value.map(item => item.id)
+        Material.value.selected = ids
+        materialsShow.value = true
+    }
+
+    // 鍒犻櫎
+    const dele = (index: any) => {
+        if (list.value.length === 1) {
+        //    Toast('鑷冲皯淇濈暀涓�鏉″伐瑁呬俊鎭�')
+            Toast('鑷冲皯淇濈暀涓�鏉$墿娴佹竻鍗曚俊鎭�')
+            return
+        }
+        list.value.splice(index, 1)
+    }
+    // 鍏抽棴浠撳簱閫夋嫨寮规
+    const close = (): void => {
+        warehouseShow.value = false
+    }
+    // 鍏抽棴浠撳簱閫夋嫨寮规
+    const close1 = (): void => {
+        materialsShow.value = false
+    }
+    // 鍏抽棴浠撳簱閫夋嫨寮规
+    const close2 = (): void => {
+        qualityShow.value = false
+    }
+    // 鍏抽棴璐т綅閫夋嫨寮规
+    const close3 = (): void => {
+        locationShow.value = false
+    }
+    // 鍏抽棴璐т綅閫夋嫨寮规
+    const close4 = (): void => {
+        productionShow.value = false
+    }
+    // 閫夋嫨浠撳簱鍥炶皟
+    const getValue = (item: any): void => {
+        form.warehouseName = item.name
+        form.warehouseId = item.id
+        getListByWarehouseId({ wareHouseId: item.id })
+            .then(res => {
+                if (res.code === 200) {
+                    locationList.value = res.data
+                    if (res.data.length === 1) {
+                        location.value = false
+                        list.value.forEach(item => {
+                            item.locationId = res.data[0].id
+                            item.locationName = res.data[0].unionName
+                        })
+                        list.value[i.value].locationIdLabel = res.data[0].label
+                        if (res.data[0].label === 'APPLIANCE_ONTEST') {
+                            list.value[i.value].qualityType = '0'
+                            list.value[i.value].qualityTypeName = '鍚堟牸'
+                        } else if (res.data[0].label === 'APPLIANCE_OFFTEST') {
+                            list.value[i.value].qualityType = '1'
+                            list.value[i.value].qualityTypeName = '涓嶈壇'
+                        } else if (res.data[0].label === 'APPLIANCE_USELESS') {
+                            list.value[i.value].qualityType = '2'
+                            list.value[i.value].qualityTypeName = '鎶ュ簾'
+                        }
+                    } else {
+                        location.value = true
+                        list.value.forEach(item => {
+                            item.locationId = res.data[0].id
+                            item.locationName = res.data[0].unionName
+                        })
+                        // list.value.forEach(item => {
+                        //     item.locationId = ''
+                        //     item.locationName = ''
+                        // })
+                    }
+                }
+            })
+        warehouseShow.value = false
+    }
+    // 閫夋嫨鐗╂枡
+    const getValue1 = (item: any): void => {
+        list.value[i.value].materialName = item.mmodelUnionName
+        list.value[i.value].materialId = item.id
+        list.value[i.value].unitId = item.unitId
+        list.value[i.value].hasBom = item.hasBom
+        list.value[i.value].unitName = item.umodelName
+        // 鑾峰彇鐗╂枡涓嬪伐搴�
+        getListByMaterialId({
+            materialId: item.id
+        }).then(res => {
+            if (res.code === 200) {
+                productionList.value = res.data
+                list.value[i.value].procedureId = ''
+                list.value[i.value].procedureName = ''
+            }
+        })
+        materialsShow.value = false
+    }
+    // 閫夋嫨璐ㄩ噺灞炴��
+    const getValue2 = (item: any): void => {
+        list.value[i.value].qualityType = item.id
+        list.value[i.value].qualityTypeName = item.name
+        qualityShow.value = false
+    }
+    // 閫夋嫨璐т綅
+    const getValue3 = (item: any): void => {
+        list.value[i.value].locationId = item.id
+        list.value[i.value].locationName = item.unionName
+        list.value[i.value].qualityType = ''
+        list.value[i.value].qualityTypeName = ''
+        list.value[i.value].locationIdLabel = item.label
+        if (item.label === 'APPLIANCE_ONTEST') {
+            list.value[i.value].qualityType = '0'
+            list.value[i.value].qualityTypeName = '鍚堟牸'
+        } else if (item.label === 'APPLIANCE_OFFTEST') {
+            list.value[i.value].qualityType = '1'
+            list.value[i.value].qualityTypeName = '涓嶈壇'
+        } else if (item.label === 'APPLIANCE_USELESS') {
+            list.value[i.value].qualityType = '2'
+            list.value[i.value].qualityTypeName = '鎶ュ簾'
+        }
+        locationShow.value = false
+    }
+    // 閫夋嫨宸ュ簭
+    const getValue4 = (item: any): void => {
+        list.value[i.value].procedureId = item.id
+        list.value[i.value].procedureName = item.name
+        productionShow.value = false
+    }
+    onMounted(() => {
+        // 鑾峰彇宸ヨ淇℃伅
+        // getLKInfo(route.query.id as string)
+    })
 </script>
 
 <style lang="scss" scoped>
-.page {
-    width: 100%;
-    height: 100%;
-    position: absolute;
-    background: #F7F7F7;
-}
-</style>
\ No newline at end of file
+    .rework {
+        width: 100%;
+        height: 100%;
+        position: absolute;
+        .rework_list {
+            display: flex;
+            flex-direction: column;
+            background: white;
+            padding: 0 30px;
+            box-sizing: border-box;
+            .rework_list_item {
+                display: flex;
+                align-items: center;
+                justify-content: space-between;
+                height: 98px;
+                border-bottom: 1PX solid #E5E5E5;
+                &:last-child {
+                    border: none;
+                }
+                span {
+                    font-size: 30px;
+                    font-weight: 400;
+                    color: #222222;
+                    flex-shrink: 0;
+                    b {
+                        font-size: 30px;
+                        color: red;
+                        margin-right: 5px;
+                    }
+                }
+                .rework_list_item_right {
+                    flex: 1;
+                    display: flex;
+                    align-items: center;
+                    justify-content: flex-end;
+                    span {
+                        font-size: 28px;
+                        font-weight: 400;
+                        color: #999999;
+                    }
+                    .black {
+                        color: black !important;
+                    }
+                    input {
+                        width: 230px;
+                        height: 60px;
+                        font-size: 28px;
+                        border-radius: 8px;
+                        padding: 0 30px;
+                        text-align: right;
+                        box-sizing: border-box;
+                        border: 1px solid #CCCCCC;
+                    }
+                    input::-webkit-input-placeholder { /* WebKit browsers */
+                        font-size: 28px;
+                        font-weight: 400;
+                        color: #B2B2B2;
+                    }
+                }
+            }
+        }
+        .rework_qd {
+            margin-top: 40px;
+            width: 100%;
+            background: #F7F7F7;
+            .rework_qd_title {
+                display: flex;
+                align-items: center;
+                justify-content: space-between;
+                padding: 0 30px 30px 30px;
+                .rework_qd_title_left {
+                    display: flex;
+                    align-items: center;
+                    span {
+                        font-size: 32px;
+                        font-weight: 500;
+                        color: #222222;
+                    }
+                    .x {
+                        width: 8px;
+                        height: 30px;
+                        background: #4275FC;
+                        border-radius: 2px;
+                        margin-right: 12px;
+                    }
+                }
+                .rework_qd_title_right {
+                    display: flex;
+                    align-items: center;
+                    img {
+                        width: 28px;
+                        height: 28px;
+                        margin-right: 12px;
+                    }
+                    span {
+                        font-size: 28px;
+                        font-family: PingFangSC-Regular, PingFang SC;
+                        font-weight: 400;
+                        color: #4275FC;
+                    }
+                }
+            }
+            .rework_qd_list {
+                display: flex;
+                flex-direction: column;
+                padding: 0 30px;
+                background: #FFFFFF;
+                box-sizing: border-box;
+                margin-bottom: 30px;
+                .rework_qd_item {
+                    display: flex;
+                    align-items: center;
+                    justify-content: space-between;
+                    height: 98px;
+                    border-bottom: 1PX solid #E5E5E5;
+                    &:last-child {
+                        border: none;
+                    }
+                    span {
+                        font-size: 30px;
+                        font-weight: 400;
+                        color: #222222;
+                        flex-shrink: 0;
+                        b {
+                            font-size: 30px;
+                            color: red;
+                            margin-right: 5px;
+                        }
+                    }
+                    .rework_qd_item_right {
+                        display: flex;
+                        align-items: center;
+                        span {
+                            font-size: 28px;
+                            font-weight: 400;
+                            color: #999999;
+                        }
+                        .black {
+                            color: black !important;
+                        }
+                        input {
+                            width: 230px;
+                            height: 60px;
+                            font-size: 28px;
+                            border-radius: 8px;
+                            padding: 0 30px;
+                            text-align: right;
+                            box-sizing: border-box;
+                            border: 1px solid #CCCCCC;
+                        }
+                        input::-webkit-input-placeholder { /* WebKit browsers */
+                            font-size: 28px;
+                            font-weight: 400;
+                            color: #B2B2B2;
+                        }
+                    }
+                }
+            }
+        }
+        .rework_zw {
+            height: 168px;
+        }
+        .rework_footer {
+            width: calc(100% - 60px);
+            position: fixed;
+            bottom: 0;
+            display: flex;
+            align-items: center;
+            justify-content: space-between;
+            padding: 0 30px 68px 30px;
+            .rework_footer_add {
+                flex: 1;
+                height: 88px;
+                font-size: 30px;
+                font-weight: 500;
+                color: $nav-color;
+                background: #FFFFFF;
+                box-shadow: 0 0 12px 0 rgba(0,0,0,0.0800);
+                border-radius: 8px;
+                display: flex;
+                align-items: center;
+                justify-content: center;
+            }
+            .rework_footer_submit {
+                flex: 1;
+                height: 88px;
+                font-size: 30px;
+                font-weight: 500;
+                color: #ffffff;
+                background: $nav-color;
+                box-shadow: 0 0 12px 0 rgba(0,0,0,0.0800);
+                border-radius: 8px;
+                display: flex;
+                align-items: center;
+                justify-content: center;
+                border: none;
+            }
+        }
+    }
+</style>

--
Gitblit v1.9.3