jiangping
2023-08-18 40609a1bd11ce79445562ac23f16af23a48c3933
h5_standard/src/views/workOrder/reportingForWork.vue
@@ -55,7 +55,7 @@
                        <span>新增投料</span>
                    </div>
                </div>
                <template v-if="wuList.length > 0">
                <template v-if="wuList.length > 0 && !(hasBom == 1 && bomType == 1)">
                    <van-swipe-cell v-for="(item, index) in wuList" :key="index">
                        <div class="bg_list_item_h">
                            <div class="bg_list_item_num">
@@ -82,7 +82,7 @@
                        </template>
                    </van-swipe-cell>
                </template>
                <template v-else>
                <template v-else-if="wuList.length == 0 && !(hasBom == 1 && bomType == 1)">
                    <div class="kong">
                        <span>暂无数据</span>
                    </div>
@@ -104,7 +104,7 @@
                            <span><b>*</b>良品数</span>
                            <div class="bg_list_item_num_item_sr">
                                <input type="number" v-model="from.qualified" @input="changeNum(1)" placeholder="请输入" />
                                <span>块</span>
                                <span v-if="from.processPlan">{{from.processPlan.unitName}}</span>
                            </div>
                        </div>
                    </div>
@@ -113,7 +113,7 @@
                            <span>不良数</span>
                            <div class="bg_list_item_num_item_sr">
                                <input type="number" v-model="from.undesirable" @input="changeNum(2)" placeholder="请输入" />
                                <span>块</span>
                                <span v-if="from.processPlan">{{from.processPlan.unitName}}</span>
                            </div>
                        </div>
                    </div>
@@ -158,7 +158,7 @@
                        <div class="bg_list_item_num_item">
                            <span>工资单价</span>
                            <div class="bg_list_item_num_item_sr">
                                <span class="color1">{{infoBox.salary}}元/{{infoBox.type == 0 ? '件' : '时'}}</span>
                                <span class="color1">{{(infoBox.salary / 10 / 10).toFixed(2)}}元/{{infoBox.type == 0 ? '件' : '时'}}</span>
                            </div>
                        </div>
                    </div>
@@ -188,7 +188,7 @@
            <div class="bg_footer_submit" @click="submit">提交</div>
        </div>
        <!-- 选择不良项 -->
        <van-popup v-model:show="show" round position="bottom" :style="{ height: '53%' }">
        <van-popup v-model:show="show" round position="bottom">
            <div class="bl">
                <div class="bl_head">
                    <img src="@/assets/icon/ic_close@2x.png" style="opacity: 0;" alt="" />
@@ -280,8 +280,7 @@
        text: 'name'
    };
    let userShow = ref(false)
    let userList = ref([])
    let wuList: any = ref([])
    let wuList = ref<Array<any>>([])
    // 产出数量验证
    const changeNum = (type: number) => {
@@ -348,7 +347,10 @@
        } else {
            if (!wuList.value.length === 0) return Toast('投料不能为空')
        }
        if (!from.qualified) return Toast('良品数不能为空')
        if (!from.qualified && !from.undesirable) {
            return Toast('良品数与不良数不能同时为空')
        }
        // if (!from.qualified) return Toast('良品数不能为空')
        // 有不良数
        if (from.undesirable > 0) {
            if (from.defective.length === 0) return Toast('不良项不能为空')
@@ -357,8 +359,8 @@
        autoWorkReport({
            createWorkorderRecordDTO: {
                duration: from.duration,
                qualifiedNum: from.qualified,
                unQualifiedNum: from.undesirable
                qualifiedNum: from.qualified ? from.qualified : 0,
                unQualifiedNum: from.undesirable ? from.undesirable : 0
            },
            plansId: from.processPlan.id,
            proGroupId: deviceId.value,
@@ -387,43 +389,46 @@
    // 预计工资
    const expectedSalary = computed(() => {
        if (!infoBox.value) return 0
        if (!infoBox.value) return 0;
        // 按件计算
        if (infoBox.value.type == 0) {
            console.log('计件')
            if (!from.qualified) return 0
            if (infoBox.value.unqualified == 1) {   // 是否计入不良品
                let total = Number(from.qualified) + Number(from.undesirable)
                return total * infoBox.value.salary
                return (total * (infoBox.value.salary / 10 / 10)).toFixed(2) || 0
            } else {
                return Number(from.qualified) * infoBox.value.salary
                return (Number(from.qualified) * (infoBox.value.salary / 10 / 10)).toFixed(2) || 0
            }
        } else {
            console.log('计时')
            if (!from.duration) return 0;
            let h = (from.duration / 60 / 60).toFixed(2)
            return Number(h) * infoBox.value.salary
            return (Number(h) * (infoBox.value.salary / 10 / 10)).toFixed(2) || 0
        }
    })
    // 达标率
    const complianceRate = computed(() => {
        if (!infoBox.value) return 0;
        if (!from.qualified) return 0;
        if (!from.qualified && !from.undesirable) return 0;
        if (!from.duration) return 0;
        // 按件计算
        // if (infoBox.value.type == 0) {
            // if (infoBox.value.unqualified == 1) {   // 是否计入不良品
            if (infoBox.value.unqualified == 1) {   // 是否计入不良品
                let a = ((Number(from.qualified) + Number(from.undesirable)) / (from.duration / 60 / 60)).toFixed(2)
                let b = (infoBox.value.num / (infoBox.value.times / 60 / 60)).toFixed(2)
                console.log(a)
                console.log(b)
                return (Number(a) / Number(b)).toFixed(2)
                return ((Number(a) / Number(b)) * 100).toFixed(2) || 0
                // let total = (Number(from.qualified) + Number(from.undesirable)) / ((from.duration * 60 * 60) * infoBox.value.num / )
                // return total * infoBox.value.salary;
            // } else {
            //     return Number(from.qualified) * infoBox.value.salary;
            // }
            } else {
                let a = (from.qualified / (from.duration / 60 / 60)).toFixed(2)
                let b = (infoBox.value.num / (infoBox.value.times / 60 / 60)).toFixed(2)
                console.log(a)
                console.log(b)
                return ((Number(a) / Number(b)) * 100).toFixed(2) || 0
                // return Number(from.qualified) * infoBox.value.salary;
            }
        // } else {
        //     console.log('按时长')
        // }
@@ -544,7 +549,7 @@
            // 获取类型
            getIdPlansExt(res.id)
                .then(res2 => {
                    if (res.code === 200) {
                    if (res2.code === 200) {
                        bomType.value = res2.data.bomType
                        hasBom.value = res2.data.hasBom
                    }
@@ -843,7 +848,7 @@
                                    font-size: 28px;
                                    font-weight: 400;
                                    color: #333333;
                                    padding: 0 30px
                                    padding: 0 30px;
                                }
                                .wulll {
                                    width: 400px;
@@ -906,12 +911,15 @@
            }
        }
        .bl {
            width: 100%;
            height: 800px;
            padding: 30px;
            box-sizing: border-box;
            display: flex;
            flex-direction: column;
            .bl_head {
                width: 100%;
                height: 50px;
                display: flex;
                align-items: center;
                justify-content: space-between;
@@ -942,7 +950,7 @@
            }
            .bl_list {
                width: 100%;
                height: 550px;
                height: calc(100% - 168px);
                overflow-y: scroll;
                margin-top: 30px;
                .bl_list_item {