123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- <template>
- <dialog-base ref="baseDialog" title="结束报工">
- <view class="list-container">
- <view class="list-title"><text class="label">合格量</text></view>
- <view class="table-item">
- <input class="input" v-model="workInfo.qualified" placeholder="请输入合格量" />
- </view>
- <view class="list-title">
- <text class="label">废品量</text>
- </view>
- <view class="table-item"><input class="input" v-model="workInfo.rejectNum" placeholder="请输入废品量" /></view>
- <view class="list-title">
- <text class="label">废品原因</text>
- </view>
- <view class="table-item"><input class="input" v-model="workInfo.remark" placeholder="请输入废品原因" /></view>
- <view class="list-title uni-row">
- <text class="label">当前序是否完成</text>
- <switch class="switch" @change="switchChange" color="rgba(255,85,85,1)" style="transform:scale(0.7)" />
- </view>
- <view class="list-title"><text class="label">请选择设备:</text></view>
- <!-- <scroll-view class="scroll-container" scroll-y> -->
- <checkbox-group class="equipment-container uni-row" @change="checkboxChange">
- <checkbox v-for="(item,index) in equiments" class="checkbox" style="transform:scale(0.8)" :key="index"
- :value="item" :checked="item.checked">
- {{item}}
- </checkbox>
- </checkbox-group>
- </view>
- <view class="add-btn-container uni-row">
- <button type="default" class="btn" @click="handleFinishReporting">结束报工</button>
- </view>
- </dialog-base>
- </template>
- <script setup>
- import {
- ref,
- getCurrentInstance
- } from 'vue'
- import {
- updateDayWorkItem,
- saveDayWorkItem
- } from "@/api/business/dayWorkItem.js"
- const baseDialog = ref(null)
- const equiments = ref(['009-21', '009-22', '009-23', '009-24', '009-25', '009-26', '009-27', '009-28', '009-29',
- '009-26', '009-27'
- ])
- const workInfo = ref({})
- const open = (data) => {
- // console.log(dialog.value)
- workInfo.value.dayworkId = data.dayworkId;
- workInfo.value.id = data.id;
- baseDialog.value.open()
- }
- function switchChange(event) {
- if (event.detail.value) {
- workInfo.value.status = "2"
- }
- }
- function checkboxChange(event) {
- console.log(event.detail.value)
- workInfo.value.equiments = event.detail.value
- }
- function handleFinishReporting() {
- console.log(workInfo.value)
- if(workInfo.value.status != 2) {
- workInfo.value.status = '1';
- }
- saveDayWorkItem(workInfo.value).then(res => {
- if(res.code === 200){
- uni.showToast({
- icon: 'success',
- title: '操作成功',
- duration: 2000
- });
- baseDialog.value.close();
- }else{
- uni.showToast({
- icon: 'error',
- title: '操作失败',
- duration: 2000
- });
- }
- })
- }
- defineExpose({
- open
- })
- </script>
- <style lang="scss">
- .dialog-body {
- .list-container {
- width: 100%;
- display: flex;
- align-items: flex-start;
- padding: 0 4rpx;
- .list-title {
- margin-top: 24rpx;
- .label {
- font-size: 32rpx;
- }
- }
- .switch {
- margin-top: -8rpx;
- align-items: center;
- }
- .equipment-container {
- width: 100%;
- height: 120rpx;
- flex-wrap: wrap;
- justify-content: flex-start;
- overflow: auto;
- .checkbox {
- padding: 12rpx 0;
- justify-content: center;
- align-items: center;
- }
- }
- .table-item {
- margin-top: 24rpx;
- .input {
- height: 60rpx;
- border: 1px solid #808080;
- }
- }
- }
- .add-btn-container {
- margin-top: 32rpx;
- .btn {
- flex: 1;
- background-color: rgba(255, 85, 85, 1);
- color: #FFFFFF;
- }
- }
- }
- </style>
|