!14 fix: 新增后页面没有刷新bug以及投料页面详情不显示bug。

Merge pull request !14 from guopeiyu/guopeiyu
main
guopeiyu 2 years ago committed by Gitee
commit 4974f02a8d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

@ -138,13 +138,12 @@ export default {
create(this.formData).then(response => { create(this.formData).then(response => {
modal.msgSuccess("保存成功") modal.msgSuccess("保存成功")
tab.navigateBack() tab.navigateBack()
uni.$emit('saveDraft', true)
}) })
} }
}) })
} }
}).catch(err => { }).catch(err => {})
console.log('err', err);
})
}, },
handleTypeChange(e){ handleTypeChange(e){
this.formData.feedingType =e.detail.value; this.formData.feedingType =e.detail.value;

@ -41,10 +41,12 @@
</uni-td> </uni-td>
<uni-td align="center"> <uni-td align="center">
<u-line-progress <u-line-progress
:percentage="Number((item.totalQualityNumber/planDo.planNumber)*100).toFixed(2)" :percentage="Number((item.totalQualityNumber / planDo.planNumber) * 100).toFixed(2)"
active-color="#50E0C1" active-color="#50E0C1"
inactive-color="rgba(139, 237, 215, 0.47)" inactive-color="rgba(139, 237, 215, 0.47)"
/> >
<text class="u-percentage-slot">{{Number((item.totalQualityNumber / planDo.planNumber) * 100).toFixed(2)}}%</text>
</u-line-progress>
</uni-td> </uni-td>
<uni-td> <uni-td>
<view class="name">{{ item.totalWasteNumber }}</view> <view class="name">{{ item.totalWasteNumber }}</view>
@ -103,4 +105,9 @@ export default {
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);
} }
.u-percentage-slot {
font-size: 10px;
margin-left: 30px;
}
</style> </style>

@ -230,6 +230,8 @@ export default {
createReport(this.customFormData).then(response => { createReport(this.customFormData).then(response => {
modal.msgSuccess("保存成功") modal.msgSuccess("保存成功")
tab.navigateBack() tab.navigateBack()
//
uni.$emit('success', true)
}) })
} }
} }

@ -227,6 +227,8 @@ export default {
createReport(this.customFormData).then(response => { createReport(this.customFormData).then(response => {
modal.msgSuccess("保存成功") modal.msgSuccess("保存成功")
tab.switchTab('/pages/report') tab.switchTab('/pages/report')
//
uni.$emit('handleSuccess', true)
}) })
} }
} }

@ -200,7 +200,17 @@ export default {
onLoad() { onLoad() {
this.loading = true this.loading = true
this.getList(); this.getList();
uni.$on('handleSuccess', data => {
if (data) {
this.getList();
}
});
this.getReplaceReportList() this.getReplaceReportList()
uni.$on('success', data => {
if (data) {
this.getReplaceReportList();
}
});
this.getOtherReportList() this.getOtherReportList()
this.getUserList() this.getUserList()
this.loading = false this.loading = false

@ -57,7 +57,7 @@
<el-text>{{ item.weight }} </el-text> <el-text>{{ item.weight }} </el-text>
</el-col> </el-col>
</el-row> </el-row>
<el-row v-for="(item2, index2) in handleDraftClick(item.id,index)" :key="index2" class="u-m-b-30"> <el-row v-for="(item2, index2) in draftList[index].detailList" :key="index2" class="u-m-b-30">
<el-col :span="8">原料: <el-col :span="8">原料:
<el-text type="warning">{{item2.itemName}}</el-text> <el-text type="warning">{{item2.itemName}}</el-text>
</el-col> </el-col>
@ -87,7 +87,6 @@
<u-list-item <u-list-item
v-for="(item, index) in finishList" v-for="(item, index) in finishList"
:key="item" :key="item"
@click="handleFinishClick(item.id,index)"
> >
<view class="content"> <view class="content">
<view class="header"> <view class="header">
@ -113,7 +112,7 @@
<el-text>{{ item.weight }} </el-text> <el-text>{{ item.weight }} </el-text>
</el-col> </el-col>
</el-row> </el-row>
<el-row v-for="(item2, index2) in handleFinishClick(item.id,index)" :key="index2" class="u-m-b-30"> <el-row v-for="(item2, index2) in finishList[index].detailList" :key="index2" class="u-m-b-30">
<el-col :span="8">原料: <el-col :span="8">原料:
<el-text type="warning">{{item2.itemName}}</el-text> <el-text type="warning">{{item2.itemName}}</el-text>
</el-col> </el-col>
@ -133,14 +132,15 @@
</template> </template>
<script setup> <script setup>
import { ref, onMounted } from 'vue'; import { ref } from 'vue';
import { getRecordList, updateStatus, deleteById, getDetailByRecordId } from "@/api/mes/record" import { getRecordList, updateStatus, deleteById, getDetailByRecordId } from "@/api/mes/record"
import { timestampToTime } from "@/utils/dateUtil"; import { timestampToTime } from "@/utils/dateUtil";
import { pipelineTypes,feedingTypes, findTextByValue} from "@/api/system/dict/data"; import { pipelineTypes,feedingTypes, findTextByValue} from "@/api/system/dict/data";
import modal from "@/plugins/modal"; import modal from "@/plugins/modal";
import tab from "@/plugins/tab"; import tab from "@/plugins/tab";
import {showConfirm} from "@/utils/common"; import { showConfirm } from "@/utils/common";
import auth from "@/plugins/auth"; import auth from "@/plugins/auth";
import { onLoad } from "@dcloudio/uni-app";
const menuList = ref([ const menuList = ref([
{ {
@ -154,6 +154,11 @@ const menuList = ref([
const current = ref(0) const current = ref(0)
const change = (index)=>{ const change = (index)=>{
current.value = index.index current.value = index.index
if(current.value === 0) {
getDraftList()
} else {
getFinishList()
}
} }
// //
@ -168,28 +173,28 @@ const pattern = {
iconColor: '#fff' iconColor: '#fff'
} }
onMounted(() => {
getList()
});
// //
function getList() { function getFinishList() {
getRecordList("2").then(response => { getRecordList("2").then(response => {
finishList.value = response.data finishList.value = response.data
finishList.value.forEach((item, index) => {
getDetailByRecordId(item.id).then(response => {
finishList.value[index].detailList = response.data
})
})
}) })
}
function getDraftList(){
getRecordList("1").then(response => { getRecordList("1").then(response => {
draftList.value = response.data draftList.value = response.data
draftList.value.forEach((item,index)=>{
getDetailByRecordId(item.id).then(response => {
draftList.value[index].detailList = response.data
})
})
}) })
} }
function handleFinishClick(id, index){
getDetailByRecordId(id).then(response => {
finishList.value[index].detailList = response.data
})
}
function handleDraftClick(id, index){
getDetailByRecordId(id).then(response => {
draftList.value[index].detailList = response.data
})
}
/** 提交 */ /** 提交 */
function handleUpdate(id){ function handleUpdate(id){
showConfirm("确认提交投料记录吗?").then(res => { showConfirm("确认提交投料记录吗?").then(res => {
@ -207,7 +212,7 @@ function handleDelete(id){
if (res.confirm) { if (res.confirm) {
deleteById(id).then(response => { deleteById(id).then(response => {
modal.msgSuccess("操作成功") modal.msgSuccess("操作成功")
getList() getDraftList()
}) })
} }
}) })
@ -217,6 +222,15 @@ function handleDelete(id){
function handleAdd(){ function handleAdd(){
tab.navigateTo('/page_record/feedingRecordForm') tab.navigateTo('/page_record/feedingRecordForm')
} }
onLoad(() => {
getDraftList()
uni.$on('saveDraft', data => {
if (data) {
getDraftList();
}
});
});
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

@ -8,7 +8,7 @@
<text class="point">.</text> <text class="point">.</text>
<text class="title">报工报表</text> <text class="title">报工报表</text>
</view> </view>
<uni-data-select v-if="auth.hasPermi('mes:produce-report-detail:replace')" class="select" v-model="userId" :localdata="userList" placement="top" @change="handleChange()"> <uni-data-select v-if="auth.hasPermi('mes:produce-report-detail:replace')" class="select" v-model="userId" :localdata="userList" placement="top">
</uni-data-select> </uni-data-select>
<view class="top_desc"> <view class="top_desc">
<view> <view>
@ -104,7 +104,7 @@ import dataOne from '@/pages/json/1.json';
import { getDayReportTime, getLastMonthSum, getReportTime, getSumReportTime, getThisMonthSum } from "@/api/mes/report"; import { getDayReportTime, getLastMonthSum, getReportTime, getSumReportTime, getThisMonthSum } from "@/api/mes/report";
import useUserStore from "@/store/modules/user"; import useUserStore from "@/store/modules/user";
import Config from '@/pages/js/config' import Config from '@/pages/js/config'
import { ref } from 'vue'; import { ref, watch } from 'vue';
import { onLoad } from "@dcloudio/uni-app"; import { onLoad } from "@dcloudio/uni-app";
import auth from "@/plugins/auth"; import auth from "@/plugins/auth";
import {getOtherPersonalUser} from "@/api/mes/organization"; import {getOtherPersonalUser} from "@/api/mes/organization";
@ -117,7 +117,8 @@ const nowTime = {
}; };
const useStore = useUserStore() const useStore = useUserStore()
const userId = ref(useStore.userId) const userId = ref()
userId.value = useStore.userId
const isCanvas2d = ref(Config.ISCANVAS2D) const isCanvas2d = ref(Config.ISCANVAS2D)
let delayload = ref(false); let delayload = ref(false);
@ -161,6 +162,12 @@ const handleChange = ()=>{
getDayReportTimeList() getDayReportTimeList()
} }
watch(()=>userId.value, (newValue)=> {
if (newValue) {
handleChange()
}
})
const changeHistoryBtn = (type) => { const changeHistoryBtn = (type) => {
historyBtn.value.forEach(btn => { historyBtn.value.forEach(btn => {
btn.state = false; btn.state = false;

Loading…
Cancel
Save