| | |
| | | <!-- 基本信息 --> |
| | | <view class="form-section"> |
| | | <u-form-item label="待生产数量" |
| | | prop="remainingQuantity" |
| | | prop="planQuantity" |
| | | required> |
| | | <u-input v-model="form.remainingQuantity" |
| | | <u-input v-model="form.planQuantity" |
| | | placeholder="自动填充" |
| | | disabled /> |
| | | </u-form-item> |
| | | <u-form-item label="本次生产数量" |
| | | prop="quantity" |
| | | required> |
| | | <u-number-box v-model="form.quantity" |
| | | <u-input v-model="form.quantity" |
| | | placeholder="请输入" |
| | | type="number" /> |
| | | <!-- <u-number-box v-model="form.quantity" |
| | | step="0.1" |
| | | bgColor="#fff" |
| | | decimal-length="1" |
| | | :min="0"></u-number-box> |
| | | :min="0"></u-number-box> --> |
| | | </u-form-item> |
| | | <u-form-item label="班组信息" |
| | | prop="schedulingUserId" |
| | |
| | | |
| | | <script setup> |
| | | import { ref, onMounted } from "vue"; |
| | | import { onLoad } from "@dcloudio/uni-app"; |
| | | import FooterButtons from "@/components/FooterButtons.vue"; |
| | | |
| | | const showToast = message => { |
| | |
| | | icon: "none", |
| | | }); |
| | | }; |
| | | |
| | | import { formatDateToYMD } from "@/utils/ruoyi"; |
| | | import { userListNoPageByTenantId } from "@/api/system/user"; |
| | | import { productionReport } from "@/api/productionManagement/productionReporting"; |
| | | import { addProductMain } from "@/api/productionManagement/productionReporting"; |
| | | import { getInfo } from "@/api/login"; |
| | | |
| | | // 表单引用 |
| | |
| | | |
| | | // 表单数据 |
| | | let form = ref({ |
| | | remainingQuantity: 0, |
| | | planQuantity: 0, |
| | | quantity: 0, |
| | | userName: "", |
| | | workOrderId: "", |
| | |
| | | const goBack = () => { |
| | | uni.navigateBack(); |
| | | }; |
| | | const parsedOrderRow = ref({}); |
| | | // 提交表单 |
| | | const submitForm = async () => { |
| | | submitting.value = true; |
| | |
| | | showToast("请输入本次生产数量"); |
| | | return; |
| | | } |
| | | if (form.value.quantity > form.value.remainingQuantity) { |
| | | if (form.value.quantity > form.value.planQuantity) { |
| | | submitting.value = false; |
| | | showToast("本次生产数量不能大于待生产数量"); |
| | | return; |
| | | } |
| | | console.log(form.value, "form.value"); |
| | | |
| | | addProductMain(reportForm).then(res => { |
| | | addProductMain(form.value).then(res => { |
| | | if (res.code === 200) { |
| | | showToast("报工成功"); |
| | | submitting.value = false; |
| | | goBack(); |
| | | setTimeout(() => { |
| | | goBack(); |
| | | }, 1000); |
| | | } else { |
| | | showToast(res.msg || "报工失败"); |
| | | submitting.value = false; |
| | |
| | | }; |
| | | |
| | | // 页面加载时初始化数据 |
| | | onMounted(() => { |
| | | // 获取传递过来的orderRow参数 |
| | | const pages = getCurrentPages(); |
| | | const currentPage = pages[pages.length - 1]; |
| | | const orderRow = currentPage.options.orderRow; |
| | | form.value.remainingQuantity = 1; |
| | | if (orderRow) { |
| | | parsedOrderRow.value = JSON.parse(orderRow); |
| | | |
| | | form.value.quantity = parsedOrderRow.value.quantity; |
| | | form.value.productProcessRouteItemId = |
| | | parsedOrderRow.value.productProcessRouteItemId; |
| | | form.value.workOrderId = parsedOrderRow.value.id; |
| | | form.value.reportWork = parsedOrderRow.value.reportWork; |
| | | form.value.productMainId = parsedOrderRow.value.productMainId; |
| | | onLoad(options => { |
| | | console.log(options, "options"); |
| | | try { |
| | | const orderRow = JSON.parse(options.orderRow); |
| | | console.log(orderRow, "orderRow======########"); |
| | | form.value.planQuantity = orderRow.planQuantity; |
| | | form.value.quantity = orderRow.quantity; |
| | | form.value.productProcessRouteItemId = orderRow.productProcessRouteItemId; |
| | | form.value.workOrderId = orderRow.id; |
| | | form.value.reportWork = orderRow.reportWork; |
| | | form.value.productMainId = orderRow.productMainId; |
| | | getInfo().then(res => { |
| | | form.value.userId = res.user.userId; |
| | | form.value.userName = res.user.userName; |
| | | }); |
| | | } catch (error) { |
| | | modal.msgError("订单解析失败"); |
| | | goBack(); |
| | | return; |
| | | } |
| | | getInfo().then(res => { |
| | | form.value.userId = res.user.userId; |
| | | form.value.userName = res.user.userName; |
| | | }); |
| | | }); |
| | | </script> |
| | | |