siontion 4 months ago
commit 95e82bee2f

@ -234,7 +234,9 @@
<template #footer>
<el-button type="primary" @click="submitForm('SAVE')" :loading="formLoading"> </el-button>
<el-button type="success" @click="submitForm('SUBMIT')" :loading="formLoading"> </el-button>
<el-button type="success" @click="submitForm('SUBMIT')" :loading="formLoading"
> </el-button
>
</template>
</Dialog>
<UserDialog ref="userDialogref" @success="handleuserClick" />
@ -336,8 +338,9 @@ const onAddItem = () => {
amount: undefined,
summary: undefined,
status: 1,
procedureStatus: 0
procedureStatus: 0,
// dailyCapacity:undefined
ratioSettings: []
}
formData.value.taskDispatchDetails.push(row)
}

@ -1,10 +1,10 @@
<script setup lang="ts">
import { onMounted, computed, ref } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app'
import { getListAPI, getDictAPI } from '@/services/productionReport'
import { getListAPI, postOperateDatchAPI } from '@/services/productionReport'
import { useLoginStore } from '@/stores/modules/login'
import { formatDate } from '@/utils/index'
const popup = ref<UniHelper.UniPopupInstance>()
const userStore = useLoginStore()
const userId = userStore.userInfo.userId
@ -31,9 +31,10 @@ const queryParams: Required<any> = {
procedureStatusList: props.orderState, //
dispatchType: 'PRODUCTION', //
isReport: 1, //
dispatchStatus:2
dispatchStatus: 2
}
const dataList = ref([])
const total = ref()
const getListData = async () => {
// 退
if (isLoading.value) return
@ -43,6 +44,9 @@ const getListData = async () => {
isLoading.value = true
//
const data = await getListAPI(queryParams)
total.value = data.total
isLoading.value = false
data.list.forEach((e) => {
e.orderTime = formatDate(e.orderTime, 'YYYY-MM-DD')
@ -51,6 +55,13 @@ const getListData = async () => {
})
//
dataList.value.push(...data.list)
console.log(data, '00909009', '展示的条数', dataList.value.length)
//
isChooseAll.value = false
// selectedItemId.value = []
// dataList.value.forEach((item) => {
// item.checked = false //
// })
//
if (queryParams.pageNo < data.totalPages) {
//
@ -74,8 +85,10 @@ onShow(async () => {
})
const handleDetail = (item) => {
if (flag.value) {
const url = `/pages/productionReport/productionReport-detail?id=${item.id}`
uni.navigateTo({ url })
}
}
//
@ -91,28 +104,128 @@ const onRefresherrefresh = async () => {
//
isTriggered.value = false
}
// const searchVal = ref('')
const searchVal = ref('')
// const dataListDefault = ref([])
// const handleSearch = async () => {
// const code = searchVal.value
// if (code) {
// dataListDefault.value = dataList.value
// dataList.value = dataList.value.filter((e) => {
// return e.code == code
// })
// } else {
// dataList.value = dataListDefault.value
// }
// }
const handleSearch = async () => {
console.log(searchVal)
// const code = searchVal.value
// if (code) {
// dataListDefault.value = dataList.value
// dataList.value = dataList.value.filter((e) => {
// return e.code == code
// })
// } else {
// dataList.value = dataListDefault.value
// }
}
const flag = ref(true)
const selectedItemId = ref([])
const CHooseItem = (item: any) => {
const valueToRemove = item.id //
const index = selectedItemId.value.findIndex((item) => item === valueToRemove)
if (index !== -1) {
selectedItemId.value.splice(index, 1)
// isChooseAll.value = false //
} else {
selectedItemId.value.push(valueToRemove)
item.checked = true
}
// console.log(selectedItemId.value)
}
//
const workTime = ref('') //
const isChooseAll = ref(false)
const chooseAll = () => {
isChooseAll.value = !isChooseAll.value //
selectedItemId.value = isChooseAll.value ? dataList.value.map((item) => item.id) : [] // ID
dataList.value.forEach((item) => {
item.checked = isChooseAll.value //
})
// console.log(selectedItemId.value)
}
const handleStop = () => {
popup.value?.open()
}
const handleClose = () => {
popup.value?.close()
workTime.value = ''
}
const handleOk = async () => {
// popup.value?.close()
// workTime.value = undefined
console.log(workTime.value)
if (isLoading.value) {
return
}
if (workTime.value == '') {
uni.showToast({
title: '请输入工时',
icon: 'error',
duration: 2000
})
return
}
isLoading.value = true
const params = {
dispatchIds: selectedItemId.value,
workTime: workTime.value
}
try {
const data = await postOperateDatchAPI(params)
uni.showToast({
title: '批量报工完成',
icon: 'none',
duration: 2000
})
popup.value?.close()
flag.value = false
isFinish.value = false
isLoading.value = false
queryParams.pageNo = 1
dataList.value = []
await getListData()
} catch (error) {
console.log(error)
uni.showToast({
title: '批量报工失败',
icon: 'none',
duration: 2000
})
isLoading.value = false
}
}
</script>
<template>
<view class="cont">
<!-- <view class="search" v-if="dataList.length > 5">
<view class="title"></view>
<input class="uni-input" v-model="searchVal" @change="handleSearch" placeholder="根据编号搜索" />
<view class="search" v-if="total > 5">
<input class="uni-input" v-model="searchVal" @change="handleSearch" placeholder="根据产品编码/名称搜索" />
<uni-icons type="search" size="30" class="icons" @click="handleSearch"></uni-icons>
</view>
<view class="selects" v-if="props.orderState == '0,1'">
<!-- 多选-->
<view style="display: flex" @click="flag = !flag">
<!-- <view class="radio" v-if="!flag">
<label class="list" color="#FFCC33" style="transform: scale(0.7)">
<checkbox @click="chooseAll()" :checked="isChooseAll" />
</label>
</view> -->
<text style="color: #2eace6">{{ flag ? '多选' : '取消多选' }}</text>
</view>
<text style="font-size: 10px; color: #999">展示条数:{{ dataList.length }} / 总条数:{{ total }}</text>
</view>
<scroll-view enable-back-to-top scroll-y class="data-list" refresher-enabled :refresher-triggered="isTriggered" @refresherrefresh="onRefresherrefresh" @scrolltolower="getListData">
<view class="item" v-for="item in dataList" :key="item.id" @click="handleDetail(item)">
<view class="item" v-for="item in dataList" :key="item.id" @click="handleDetail(item)" style="display: flex">
<view class="stop" v-if="item.isUnion == 1"></view>
<!-- 单选 -->
<view class="" v-if="!flag" style="margin: auto 5px">
<checkbox @click="CHooseItem(item)" :checked="item.checked" color="#FFCC33" style="transform: scale(0.7)" />
</view>
<view>
<view class="hd">
<view class="num">派工单</view>
<view class="statusLabel"> 单号{{ item.dispatchCode }} </view>
@ -153,30 +266,74 @@ const onRefresherrefresh = async () => {
<view class="product-item">预计生产日期{{ item.startTime }} {{ item.endTime }}</view>
<view class="product-item">工序要点{{ item.summary }} </view>
</view>
<view class="statusText">{{ statusText }}</view>
<view class="statusText" v-if="flag">{{ statusText }}</view>
</view>
</view>
<!-- 底部提示文字 -->
<view class="loading-text" :style="{ paddingBottom: safeAreaInsets?.bottom + 'px' }">
{{ isFinish ? '没有更多数据~' : '正在加载...' }}
</view>
</scroll-view>
<view class="action" v-if="props.orderState == '0,1' && !flag">
<!-- <view class="action-item start" @click="handleStart"></view> -->
<view v-if="!flag">
<label class="list" color="#FFCC33" style="transform: scale(0.7)">
<checkbox @click="chooseAll()" :checked="isChooseAll" />
</label>
<!-- 全选(10) -->
<text>{{ !isChooseAll ? '全选' : '取消全选' }}({{ selectedItemId.length }})</text>
</view>
<view class="action-item start" @click="handleStop"></view>
</view>
</view>
<uni-popup class="popup" ref="popup" :mask-click="false" type="bottom" background-color="#fff">
<view class="title">
<view class="text">填写信息</view>
<view class="close" @click="handleClose">X</view>
</view>
<view class="cont">
<view class="item">
<view class="label"><span class="star">*</span>批量报工工时</view>
<uni-easyinput class="val" type="digit" v-model="workTime" placeholder="请输入本次报工工时"></uni-easyinput>
<view class="unit">小时</view>
</view>
</view>
<view class="ok" @click="handleOk"></view>
</uni-popup>
</template>
<style lang="scss">
// @font-face {
// font-family: CustomFont;
// src: url('./iconfont.ttf');
// }
//
.selects {
display: flex;
margin: 10rpx 10px;
justify-content: space-between;
align-items: center;
}
.search {
padding: 4rpx;
width: 80%;
margin: 30rpx auto;
padding: 0rpx;
width: 90%;
margin: auto;
margin-top: 20rpx;
position: relative;
.uni-input {
border: 1px solid #d1d6db;
height: 60rpx;
line-height: 60rpx;
padding: 4rpx 10rpx;
font-size: 32rpx;
border-radius: 6rpx;
border-radius: 10rpx;
}
.icons {
width: 30rpx;
position: absolute;
right: 40rpx;
top: 0rpx;
}
}
@ -184,8 +341,8 @@ const onRefresherrefresh = async () => {
height: 90vh;
.item {
position: relative;
padding: 20rpx 0;
margin: 20rpx 20rpx;
padding: 15rpx 0;
margin: 10rpx 20rpx;
border-radius: 10rpx;
background-color: #fff;
@ -202,19 +359,20 @@ const onRefresherrefresh = async () => {
.md {
position: relative;
padding: 10rpx;
padding: 5rpx;
padding-left: 10rpx;
min-height: 100rpx;
font-size: 28rpx;
border-top: 2rpx solid #f2f2f2;
.product-item {
margin: 20rpx 0;
margin: 5rpx 0;
display: flex;
align-items: center;
color: #737d88;
}
.product-row {
margin: 20rpx 0;
margin: 5rpx 0;
display: flex;
flex-direction: row;
justify-content: space-between;
@ -222,7 +380,7 @@ const onRefresherrefresh = async () => {
.row-item {
flex: 1;
.label {
margin-bottom: 10rpx;
margin-bottom: 0rpx;
}
.val {
@ -406,5 +564,121 @@ const onRefresherrefresh = async () => {
padding: 20rpx 0;
}
}
.action {
display: flex;
justify-content: space-between;
align-items: center;
position: fixed;
bottom: 0rpx;
border-radius: 18rpx;
padding: 30rpx 30rpx;
background: #ffffff;
margin: 0 auto;
width: 100vw;
box-shadow: 0px -4px 10px 0px rgba(121, 153, 183, 0.2);
.action-item {
width: 272rpx;
height: 86rpx;
display: flex;
justify-content: center;
align-items: center;
margin: 0 20rpx;
font-size: 40rpx;
color: #fff;
width: 272rpx;
height: 86rpx;
border-radius: 24rpx;
&.start {
background: linear-gradient(157deg, #2eace6 -3%, #356899 90%);
}
&.stop {
background: linear-gradient(167deg, #fea97b -2%, #f75e40 87%);
}
&.finish {
background: linear-gradient(142deg, #feb34a 14%, #fe9b12 83%);
}
}
}
.stop {
color: #feb34a;
border-radius: 10rpx;
top: 17rpx;
// background: linear-gradient(142deg, #feb34a 14%, #fe9b12 83%);
position: absolute;
right: 180rpx;
padding: 5rpx 10rpx;
border-radius: 10rpx;
font-size: 24rpx;
border: 1px solid #feb34a;
}
.popup {
.title {
line-height: 1;
padding: 40rpx;
font-size: 32rpx;
font-weight: normal;
border-bottom: 1rpx solid #ddd;
color: #444;
.close {
position: absolute;
right: 24rpx;
top: 40rpx;
height: 60rpx;
width: 60rpx;
text-align: center;
}
}
.cont {
display: flex;
flex-direction: column;
align-items: center;
margin: 40rpx;
height: 40vh;
.item {
display: flex;
align-items: center;
margin: 20rpx 0;
color: #737d88;
width: 94%;
.label {
font-size: 32rpx;
width: 260rpx;
.star {
color: red;
}
}
.val {
flex: 1;
font-size: 32rpx;
}
.unit {
width: 100rpx;
margin-left: 4rpx;
text-align: center;
}
}
}
.ok {
font-size: 32rpx;
margin: 20rpx auto 80rpx;
text-align: center;
width: 300rpx;
border-radius: 20rpx;
padding: 14rpx 0;
background-color: #3c8af7;
color: #fff;
}
}
</style>
import type { stringify } from 'querystring';

@ -42,3 +42,11 @@ export const postOperateAPI = (data: Object) => {
data,
})
}
//批量报工工时
export const postOperateDatchAPI = (data: Object) => {
return http<any[]>({
method: 'POST',
url: '/biz/task-dispatch/task-dispatch-detail/operate-batch',
data,
})
}
Loading…
Cancel
Save