fix: 生产报工bug

main
sunshine 2 years ago
parent 4c98ce1cb0
commit 206fd98524

@ -67,7 +67,7 @@
<u-button type="success" plain @click="updatePlan(item.id, item.code,'end')">完工</u-button> <u-button type="success" plain @click="updatePlan(item.id, item.code,'end')">完工</u-button>
</el-col> </el-col>
<el-col v-if="auth.hasPermi('mes:plan:update')" :span="4" class="u-m-r-30"> <el-col v-if="auth.hasPermi('mes:plan:update')" :span="4" class="u-m-r-30">
<u-button type="warning" plain @click="updatePlan(item.id,item.code,'pause')"></u-button> <u-button type="error" plain @click="updatePlan(item.id,item.code,'pause')"></u-button>
</el-col> </el-col>
<el-col :span="4"> <el-col :span="4">
<u-button type="info" plain @click="planProgress(item)"></u-button> <u-button type="info" plain @click="planProgress(item)"></u-button>

@ -1,5 +1,5 @@
<template> <template>
<view class="container"> <view>
<u-sticky <u-sticky
class="sticky" class="sticky"
:custom-nav-height="0" :custom-nav-height="0"
@ -13,12 +13,22 @@
safe-area-inset-top safe-area-inset-top
placeholder placeholder
/> />
<u-tabs
:list="menuList"
:current="current"
key-name="name"
:scrollable="false"
:active-style="{
color: '#0E85FF',
}"
@change="change"
>
</u-tabs>
</u-sticky> </u-sticky>
<view class="example"> <view class="container">
<el-tabs v-loading="loading" v-model="activeName" class="demo-tabs" @tab-click="handleTabClick"> <view v-if="current === 0" >
<el-tab-pane label="个人报工" name="first">
<uni-list :border="true"> <uni-list :border="true">
<uni-list-item v-for="(item, index) in reportList"> <uni-list-item v-for="(item, index) in reportList" :key="index">
<!-- 自定义 header --> <!-- 自定义 header -->
<template v-slot:header> <template v-slot:header>
<div onclick=""> <div onclick="">
@ -42,29 +52,23 @@
</uni-list-item> </uni-list-item>
</uni-list> </uni-list>
<uni-fab ref="fab" @fabClick="editOrAddReport" /> <uni-fab ref="fab" @fabClick="editOrAddReport" />
</el-tab-pane> </view>
<el-tab-pane label="代报工" name="second" v-if="auth('mes:produce-report-detail:replace')"> <view v-if="auth('mes:produce-report-detail:replace') && current === 1">
<uni-fab :pattern="pattern" ref="fabReplace" @fabClick="addReplaceReport" /> <uni-fab :pattern="pattern" ref="fabReplace" @fabClick="addReplaceReport" />
<uni-forms ref="valiReplaceForm" :model="valiFormData"> <uni-forms ref="valiReplaceForm" :model="valiFormData">
<uni-row>
<uni-col :xs="14" :sm="12" :md="6" :lg="3" :xl="1">
<uni-forms-item label-width="50px" label-align="left" label="日期" name="reportDateString"> <uni-forms-item label-width="50px" label-align="left" label="日期" name="reportDateString">
<uni-datetime-picker v-model="valiFormData.reportDateString" type="date" :clear-icon="true" @change="maskClick" /> <uni-datetime-picker v-model="valiFormData.reportDateString" type="date" :clear-icon="true" @change="maskClick" />
</uni-forms-item> </uni-forms-item>
</uni-col>
<uni-col :xs="10" :sm="8" :md="6" :lg="3" :xl="1">
<uni-forms-item label-width="50px" label-align="left" label="工人" name="userId"> <uni-forms-item label-width="50px" label-align="left" label="工人" name="userId">
<uni-data-select v-model="valiFormData.userId" :localdata="userList" placement="top" @change="handleReplaceReportChange()"> <uni-data-select v-model="valiFormData.userId" :localdata="userList" placement="top" @change="handleReplaceReportChange()">
</uni-data-select> </uni-data-select>
</uni-forms-item> </uni-forms-item>
</uni-col>
</uni-row>
<uni-forms-item label="工序" name="orgType"> <uni-forms-item label="工序" name="orgType">
<uni-data-checkbox v-model="valiFormData.orgType" :localdata="processTypes()" @change="handleReplaceReportChange()"/> <uni-data-checkbox v-model="valiFormData.orgType" :localdata="processTypes()" @change="handleReplaceReportChange()"/>
</uni-forms-item> </uni-forms-item>
</uni-forms> </uni-forms>
<uni-list :border="true"> <uni-list :border="true">
<uni-list-item v-for="(item, index) in replaceReportList"> <uni-list-item v-for="(item, index) in replaceReportList" :key="index">
<!-- 自定义 header --> <!-- 自定义 header -->
<template v-slot:header> <template v-slot:header>
<div onclick=""> <div onclick="">
@ -88,29 +92,22 @@
</template> </template>
</uni-list-item> </uni-list-item>
</uni-list> </uni-list>
</el-tab-pane> </view>
<el-tab-pane label="个人报工审核" name="third" v-if="auth('mes:produce-report-detail:replace')"> <view v-if="current === 2 && auth('mes:produce-report-detail:replace')">
<uni-forms ref="valiForm" :model="valiFormData"> <uni-forms ref="valiForm" :model="valiFormData">
<uni-row>
<uni-col :xs="14" :sm="12" :md="6" :lg="3" :xl="1">
<uni-forms-item label-width="50px" label-align="left" label="日期" name="reportDateString"> <uni-forms-item label-width="50px" label-align="left" label="日期" name="reportDateString">
<uni-datetime-picker v-model="valiFormData.reportDateString" type="date" :clear-icon="true" @change="maskClick" /> <uni-datetime-picker v-model="valiFormData.reportDateString" type="date" :clear-icon="true" @change="maskClick" />
</uni-forms-item> </uni-forms-item>
</uni-col>
<uni-col :xs="10" :sm="8" :md="6" :lg="3" :xl="1">
<uni-forms-item label-width="50px" label-align="left" label="工人" name="userId"> <uni-forms-item label-width="50px" label-align="left" label="工人" name="userId">
<uni-data-select v-model="valiFormData.userId" :localdata="userList" placement="top" @change="handleOtherReportChange()"> <uni-data-select v-model="valiFormData.userId" :localdata="userList" placement="top" @change="handleOtherReportChange()">
</uni-data-select> </uni-data-select>
</uni-forms-item> </uni-forms-item>
</uni-col>
</uni-row>
<uni-forms-item label="工序" name="orgType"> <uni-forms-item label="工序" name="orgType">
<uni-data-checkbox v-model="valiFormData.orgType" :localdata="processTypes()" @change="handleOtherReportChange()"/> <uni-data-checkbox v-model="valiFormData.orgType" :localdata="processTypes()" @change="handleOtherReportChange()"/>
</uni-forms-item> </uni-forms-item>
</uni-forms> </uni-forms>
<uni-list :border="true"> <uni-list :border="true">
<uni-list-item v-for="(item, index) in otherReportList"> <uni-list-item v-for="(item, index) in otherReportList" key="index">
<!-- 自定义 header --> <!-- 自定义 header -->
<template v-slot:header> <template v-slot:header>
<div onclick=""> <div onclick="">
@ -134,34 +131,30 @@
</template> </template>
</uni-list-item> </uni-list-item>
</uni-list> </uni-list>
<view>
<div></div>
</view> </view>
</el-tab-pane> <view v-if="current === 3" >报工报表</view>
<el-tab-pane label="报工报表" name="four">报工报表</el-tab-pane>
</el-tabs>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import {getMyList, getOtherList, updateStatus,deleteByReportId } from "@/api/mes/report"; import { getMyList, getOtherList, updateStatus,deleteByReportId } from "@/api/mes/report";
import {Check, Delete, Edit,Promotion,Close,View} from '@element-plus/icons-vue' import { Check, Delete, Edit,Promotion,Close,View } from '@element-plus/icons-vue'
import tab from "@/plugins/tab"; import tab from "@/plugins/tab";
import modal from "@/plugins/modal"; import modal from "@/plugins/modal";
import auth from "@/plugins/auth"; import auth from "@/plugins/auth";
import {showConfirm} from "@/utils/common"; import { showConfirm } from "@/utils/common";
import {getCurrentDate, timestampToTime} from "@/utils/dateUtil"; import { getCurrentDate, timestampToTime } from "@/utils/dateUtil";
import {processTypes} from "@/api/system/dict/data"; import { processTypes } from "@/api/system/dict/data";
import {getOtherPersonalUser} from "@/api/mes/organization"; import { getOtherPersonalUser } from "@/api/mes/organization";
export default { export default {
computed: { computed: {
Delete() {return Delete}, Delete() { return Delete },
Promotion() {return Promotion}, Promotion() { return Promotion },
Close() {return Close}, Close() { return Close },
Edit() {return Edit}, Edit() { return Edit },
Check() {return Check}, Check() { return Check },
View() {return View} View() { return View }
}, },
data() { data() {
return { return {
@ -178,7 +171,6 @@ export default {
buttonColor: '#e66126', buttonColor: '#e66126',
iconColor: '#fff' iconColor: '#fff'
}, },
activeName: 'first',
valiFormData: { valiFormData: {
reportDate: [], reportDate: [],
reportDateString: getCurrentDate(), reportDateString: getCurrentDate(),
@ -186,69 +178,55 @@ export default {
orgType: 'chengxing', orgType: 'chengxing',
reportType: '个人', reportType: '个人',
}, },
menuList: [
{
name: '个人报工'
},
{
name: '代报工'
},
{
name: '个人报工审核'
},
{
name: '报工报表'
}
],
current: 0
}; };
}, },
onLoad() { onLoad() {
this.loading = true this.loading = true
this.getList(); this.getList();
this.getReplaceReportList()
this.getOtherReportList()
this.getUserList() this.getUserList()
this.loading = false this.loading = false
}, },
onPullDownRefresh() {
//
if(this.currentPaneName==='third'){
this.getOtherReportList()
}
//
else if(this.currentPaneName==='second'){
this.getReplaceReportList();
}
else {
//
this.getList();
}
setTimeout(function () {
uni.stopPullDownRefresh();
}, 1000);
},
methods: { methods: {
change(index) {
this.current = index.index
},
auth(permission) { auth(permission) {
return auth.hasPermi(permission) return auth.hasPermi(permission)
}, },
processTypes() { processTypes() {
return processTypes return processTypes
}, },
handleTabClick(tab) {
this.loading = true
this.currentPaneName=tab.paneName
//
if(tab.paneName==='third'){
this.getOtherReportList()
}
//
else if(tab.paneName==='second'){
this.getReplaceReportList();
}
else {
//
this.getList();
}
this.loading = false
},
timestampToTime, timestampToTime,
getOtherReportList(){ getOtherReportList() {
let date = this.valiFormData.reportDateString let date = this.valiFormData.reportDateString
if(date.length<5)date = getCurrentDate() if (date.length < 5) date = getCurrentDate()
this.valiFormData.reportDate = [date+' 00:00:00', date+' 23:59:59'] this.valiFormData.reportDate = [date + ' 00:00:00', date + ' 23:59:59']
this.valiFormData.reportType = '个人' this.valiFormData.reportType = '个人'
getOtherList(this.valiFormData).then(response => { getOtherList(this.valiFormData).then(response => {
this.otherReportList = response.data this.otherReportList = response.data
}) })
}, },
getReplaceReportList(){ getReplaceReportList() {
let date = this.valiFormData.reportDateString let date = this.valiFormData.reportDateString
if(date.length<5)date = getCurrentDate() if (date.length < 5) date = getCurrentDate()
this.valiFormData.reportDate = [date+' 00:00:00', date+' 23:59:59'] this.valiFormData.reportDate = [date + ' 00:00:00', date + ' 23:59:59']
this.valiFormData.reportType = '代报工' this.valiFormData.reportType = '代报工'
getOtherList(this.valiFormData).then(response => { getOtherList(this.valiFormData).then(response => {
this.replaceReportList = response.data this.replaceReportList = response.data
@ -270,56 +248,74 @@ export default {
if (res.confirm) { if (res.confirm) {
deleteByReportId(id).then(response => { deleteByReportId(id).then(response => {
modal.msgSuccess("操作成功") modal.msgSuccess("操作成功")
if(this.activeName==='first')this.getList() if (this.current === 0) {
if(this.activeName==='third')this.getOtherReportList() this.getList()
if(this.activeName==='second')this.getReplaceReportList() }
if (this.current === 1) {
this.getReplaceReportList()
}
if (this.current === 2) {
this.getOtherReportList()
}
}) })
} }
this.loading = false this.loading = false
}) })
}, },
updateReport(id,status,type) { updateReport(id, status, type) {
showConfirm("确认"+type+"该报工信息吗?").then(res => { showConfirm("确认" + type + "该报工信息吗?").then(res => {
this.loading = true this.loading = true
if (res.confirm) { if (res.confirm) {
updateStatus(id,status).then(response => { updateStatus(id, status).then(response => {
modal.msgSuccess("操作成功") modal.msgSuccess("操作成功")
if(this.activeName==='first')this.getList() if (this.current === 0) {
if(this.activeName==='third')this.getOtherReportList() this.getList()
if(this.activeName==='second')this.getReplaceReportList() }
if (this.current === 1) {
this.getReplaceReportList()
}
if (this.current === 2) {
this.getOtherReportList()
}
}) })
} }
this.loading = false this.loading = false
}) })
}, },
editOrAddReport(id){ editOrAddReport(id) {
if(id===null || id===undefined)tab.navigateTo('/page_report/reportForm') if (id === null || id === undefined) tab.navigateTo('/page_report/reportForm')
else tab.navigateTo('/page_report/reportForm',id) else tab.navigateTo('/page_report/reportForm', id)
}, },
addReplaceReport(id){ addReplaceReport(id) {
if(id===null || id===undefined)tab.navigateTo('/page_report/replaceForm') if (id === null || id === undefined) tab.navigateTo('/page_report/replaceForm')
else tab.navigateTo('/page_report/replaceForm',id) else tab.navigateTo('/page_report/replaceForm', id)
}, },
maskClick(e){ maskClick(e) {
this.valiFormData.reportDateString = e this.valiFormData.reportDateString = e
if(this.activeName==='first')this.getList() if (this.current === 0) {
if(this.activeName==='third')this.getOtherReportList() this.getList()
if(this.activeName==='second')this.getReplaceReportList() }
if (this.current === 1) {
this.getReplaceReportList()
}
if (this.current === 2) {
this.getOtherReportList()
}
}, },
handleOtherReportChange(){ handleOtherReportChange() {
this.loading = true this.loading = true
// //
this.getOtherReportList() this.getOtherReportList()
this.loading = false this.loading = false
}, },
handleReplaceReportChange(){ handleReplaceReportChange() {
this.loading = true this.loading = true
// //
this.getReplaceReportList() this.getReplaceReportList()
this.loading = false this.loading = false
}, },
handleView(id){ handleView(id) {
tab.navigateTo('/page_report/ViewForm',id) tab.navigateTo('/page_report/ViewForm', id)
} }
} }
}; };
@ -327,16 +323,18 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.container {
padding: 15px;
background-color: #ffffff;
}
.sticky { .sticky {
background: linear-gradient(180deg, #d4e9ff 0%, #f3f9ff 100%); background: linear-gradient(180deg, #d4e9ff 0%, #f3f9ff 100%);
backdrop-filter: blur(27.18px); backdrop-filter: blur(27.18px);
box-shadow: 0 1px 1px 0 rgba(0, 72, 145, 0.1), box-shadow: 0 1px 1px 0 rgba(0, 72, 145, 0.1),
0 0.5px 0 0 rgba(0, 0, 0, 0.1); 0 0.5px 0 0 rgba(0, 0, 0, 0.1);
} }
.example {
padding: 15px;
background-color: #fff;
}
.addSite { .addSite {
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
@ -348,11 +346,13 @@ export default {
background-color: red; background-color: red;
border-radius: 60rpx; border-radius: 60rpx;
font-size: 30rpx; font-size: 30rpx;
.add{
.add {
display: flex; display: flex;
align-items: center; align-items: center;
color: #ffffff; color: #ffffff;
.icon{
.icon {
margin-right: 10rpx; margin-right: 10rpx;
} }
} }

Loading…
Cancel
Save