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>
</el-col>
<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 :span="4">
<u-button type="info" plain @click="planProgress(item)"></u-button>

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

Loading…
Cancel
Save