|
|
@ -1,8 +1,26 @@ |
|
|
|
<template> |
|
|
|
<view class="container"> |
|
|
|
<u-navbar back-icon-color='#fff' :background="{ background: '#409eff'}" back-text="" title-color='#fff' |
|
|
|
title="工序报工"> |
|
|
|
<!-- <template v-slot:right v-if="isEngineer"> --> |
|
|
|
<template v-slot:right v-if="isLeader"> |
|
|
|
<u-icon name="plus" color="#fff" size="36" style="padding-right: 30rpx;"></u-icon> |
|
|
|
</template> |
|
|
|
</u-navbar> |
|
|
|
<view> |
|
|
|
<form @submit="formSubmit"> |
|
|
|
<scroll-view scroll-y="true" class="scroll-Y"> |
|
|
|
<scroll-view scroll-y="true" class="scroll-Y" style="height: calc(100vh - 80rpx)"> |
|
|
|
<view class="list"> |
|
|
|
<view class="item"> |
|
|
|
<view class="dec"> |
|
|
|
<view><span style="color: red">*</span>报工日期:</view> |
|
|
|
<view > |
|
|
|
<u-input v-model="dataInput" @click="show = true" style="width:100%;margin-left: 12px" placeholder="请选择时间" /> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view v-for="item in list" class="list"> |
|
|
|
<view class="item"> |
|
|
|
<view class="dec"> |
|
|
@ -11,18 +29,21 @@ |
|
|
|
</view> |
|
|
|
<view class="dec"> |
|
|
|
<view><span style="color: red">*</span>报工数量:</view> |
|
|
|
<view><input class="uni-input" placeholder="请输入报工数量" v-model="item.reportCount" /></view> |
|
|
|
<view><input class="uni-input" type="number" inputmode="numeric" placeholder="请输入报工数量" v-model="item.reportCount" /></view> |
|
|
|
</view> |
|
|
|
<view class="dec"> |
|
|
|
<view><span style="color: red">*</span>报工工时:</view> |
|
|
|
<view><input class="uni-input" type="number" inputmode="numeric" placeholder="请输入报工工时" v-model="item.workTerm" /></view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</scroll-view> |
|
|
|
<u-button size="default" type="default" form-type="submit" |
|
|
|
style="color:#3C9CFF;backgroundColor:#1AAD19;borderColor:#1AAD19" |
|
|
|
hover-class="is-hover">提交 |
|
|
|
</u-button> |
|
|
|
|
|
|
|
<u-button form-type="submit" style="color:#ffffff;backgroundColor:#3C9CFF;position: fixed;bottom: 0px;width: 100%">提交</u-button> |
|
|
|
</form> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<u-picker mode="time" v-model="show" :params="params" @confirm="selectReworkTime"></u-picker> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
@ -33,30 +54,33 @@ import { getCurrentInstance, ref } from "vue" |
|
|
|
import * as workSchedulingApi from "@/api/mes/workScheduling" |
|
|
|
|
|
|
|
const { proxy } = getCurrentInstance() |
|
|
|
let show = false |
|
|
|
|
|
|
|
/* 是否显示"没有更多了" */ |
|
|
|
const status = ref("loadmore") |
|
|
|
let show = ref(false) |
|
|
|
let dataInput = ref() |
|
|
|
function selectReworkTime(datetime){ |
|
|
|
dataInput.value = `${datetime.year}-${datetime.month}-${datetime.day} ${datetime.hour}:${datetime.minute}:${datetime.second}` |
|
|
|
show.value = false |
|
|
|
} |
|
|
|
const isLeader = uni.getStorageSync("isLeader") |
|
|
|
let params = { |
|
|
|
year: true, |
|
|
|
month: true, |
|
|
|
day: true, |
|
|
|
hour: true, |
|
|
|
minute: true, |
|
|
|
second: true |
|
|
|
} |
|
|
|
/* 列表数据集 */ |
|
|
|
const list = ref([]) |
|
|
|
function checkChange(checkedArray: string | any[]) { |
|
|
|
if (checkedArray.length == 0){ |
|
|
|
show = true |
|
|
|
} |
|
|
|
} |
|
|
|
/* 列表调用API方法 */ |
|
|
|
async function formSubmit() { |
|
|
|
if (status.value === "nomore") return |
|
|
|
status.value = "loading" |
|
|
|
proxy.$modal.loading("提交中") |
|
|
|
await workSchedulingApi |
|
|
|
.reportWorkByProcess(list) |
|
|
|
.then((res) => { |
|
|
|
proxy.$modal.closeLoading() |
|
|
|
await workSchedulingApi.reportWorkByProcess({ |
|
|
|
reportDate : dataInput.value, |
|
|
|
schedulingCode : list.value[0].schedulingCode, |
|
|
|
processCode: list.value[0].processCode, |
|
|
|
list : list.value |
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
|
proxy.$modal.closeLoading() |
|
|
|
}) |
|
|
|
} |
|
|
|
/* 打开详情页 */ |
|
|
|
function openDetail(item: any) { |
|
|
@ -67,8 +91,33 @@ function openDetail(item: any) { |
|
|
|
/* 通用方法 */ |
|
|
|
onShow(() => { |
|
|
|
list.value = uni.getStorageSync("processReportList") |
|
|
|
debugger |
|
|
|
}) |
|
|
|
function getDate(type) { |
|
|
|
const date = new Date(); |
|
|
|
|
|
|
|
let year = date.getFullYear(); |
|
|
|
let month = date.getMonth() + 1; |
|
|
|
let day = date.getDate(); |
|
|
|
let hour = date.getHours() |
|
|
|
let minute = date.getMinutes() |
|
|
|
let second = date.getSeconds() |
|
|
|
|
|
|
|
if (type === 'start') { |
|
|
|
year = year - 10; |
|
|
|
} else if (type === 'end') { |
|
|
|
year = year + 10; |
|
|
|
} |
|
|
|
month = month > 9 ? month : '0' + month; |
|
|
|
day = day > 9 ? day : '0' + day; |
|
|
|
|
|
|
|
return `${year}-${month}-${day} ${hour}:${minute}:${second}`; |
|
|
|
} |
|
|
|
let date = getDate({ |
|
|
|
format: true |
|
|
|
}) |
|
|
|
function bindDateChange(e){ |
|
|
|
date = e.detail.value |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
<style lang="scss" scoped> |
|
|
@ -110,7 +159,6 @@ onShow(() => { |
|
|
|
padding-bottom: 20rpx; |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
|
|
|
|
view { |
|
|
|
&:nth-child(1) { |
|
|
|
width: 160rpx; |
|
|
|