<template>
|
<view style="width: 100%;height: 100%;">
|
<view >
|
<uni-datetime-picker
|
@change='changeTime'
|
v-model="datetimerange"
|
type="daterange"
|
rangeSeparator="/" />
|
</view>
|
<uni-table border stripe style='width:100%;height: 100%;overflow: auto;'>
|
<uni-tr>
|
<uni-th align="center">编辑</uni-th>
|
<uni-th v-for='(item,keys,index) in reportingWorkTitle' align="center">{{item}}</uni-th>
|
</uni-tr>
|
<uni-tr v-for="items in reportingWorkList">
|
<uni-td align="center">
|
<button
|
@click='deleteReportingWorkClick(items.reportingWorkId,items.processId)'
|
class="uni-button"
|
size="mini"
|
type="warn">删除</button>
|
</uni-td>
|
<uni-td align="center" v-for='(item,keys) in reportingWorkTitle'>{{items[keys]}}</uni-td>
|
|
</uni-tr>
|
</uni-table>
|
</view>
|
<view>
|
<!-- 提示信息弹窗 -->
|
<uni-popup ref="message" type="message">
|
<uni-popup-message :type="msgType" :message="messageText" :duration="2000" />
|
</uni-popup>
|
</view>
|
|
<uni-popup ref="popup" type="dialog">
|
<uni-popup-dialog mode="base"
|
:title="'提示'"
|
type='warn'
|
content="确定删除报工!"
|
:before-close="true"
|
@close="close"
|
@confirm="confirm"/>
|
</uni-popup>
|
</template>
|
|
<script setup>
|
import { computed, onMounted,ref, watch } from 'vue'
|
import request from '../../utils/request'
|
import userInfo from '@/stores/userInfo'
|
const message = ref(null)
|
const msgType=ref('success')
|
const messageText=ref('')
|
const popup = ref(null)
|
|
const store=userInfo()
|
const reportingWorkList = ref([])
|
const reportingWorkTitle = ref({
|
reportingWorkId:"报工编号",
|
processId:'流程卡',
|
thisProcess:'工序',
|
thisCompletedQuantity:'完工',
|
thisWornQuantity:'次破',
|
creator:'班组'
|
})
|
|
//点击删除按钮
|
let reportingWorkId = ref(null)
|
let processId = ref(null)
|
|
const datetimerange = ref([null,null])
|
|
onMounted(async() => {
|
await getReportingWorkList()
|
})
|
|
const changeTime = () => {
|
getReportingWorkList()
|
}
|
|
const getReportingWorkList = async () => {
|
const obj = {
|
userId:store.user.userId,//store.user.userId
|
process:store.user.address,//
|
searchDate:datetimerange.value
|
}
|
await request.post("/reportingWork/selectReportingWorkRecordByPhone",obj).then(res => {
|
datetimerange.value = res.data.date
|
reportingWorkList.value = res.data.data
|
}).catch(err => {
|
uni.showModal({
|
title: '提示',
|
content: err,
|
showCancel:false
|
});
|
})
|
}
|
const deleteReportingWorkClick = (reportingWorkId1,processId1) => {
|
reportingWorkId.value = reportingWorkId1
|
processId.value = processId1
|
popup.value.open()
|
}
|
|
const deleteReportingWork = (reportingWorkId,processId) => {
|
processId=processId.split('/')[0];
|
request.post(`/reportingWork/deleteWork/${reportingWorkId}/${processId}/${store.user.address}/${store.user.userId}/${store.user.userName}`).then(async res => {
|
if(res.code==='200' && res.data===true){
|
|
await getReportingWorkList()
|
messageToggle('success','删除成功')
|
}else{
|
messageToggle('error','删除失败,请检查下工序是否已报工或者已补片返工')
|
}
|
}).catch(err => {
|
uni.showModal({
|
title: '提示',
|
content: err,
|
showCancel:false
|
});
|
})
|
}
|
|
//提示打开
|
const messageToggle = (type,msg) =>{
|
msgType.value = type
|
messageText.value = msg
|
message.value.open()
|
}
|
|
const close = async () => {
|
await popup.value.close()
|
reportingWorkId.value = null
|
processId.value = null
|
}
|
|
const confirm = async () => {
|
await popup.value.close()
|
await deleteReportingWork(reportingWorkId.value,processId.value)
|
reportingWorkId.value = null
|
processId.value = null
|
}
|
</script>
|
|
<style>
|
|
</style>
|