perf: 工作报告优化

This commit is contained in:
韦荣超 2022-01-21 17:39:10 +08:00
parent 511c19d5aa
commit 2475ee90ee
4 changed files with 47 additions and 14 deletions

View File

@ -1,11 +1,8 @@
<template>
<div class="report">
<Tabs v-model="reportTabs">
<TabPane :label="$L('填写汇报')" name="edit">
<ReportEdit :id="reportId" @saveSuccess="saveSuccess"></ReportEdit>
</TabPane>
<TabPane :label="$L('我的汇报')" name="my">
<ReportMy v-if="reportTabs === 'my'" @detail="showDetail" @edit="editReport"></ReportMy>
<ReportMy ref="report" v-if="reportTabs === 'my'" @detail="showDetail" @edit="editReport"></ReportMy>
</TabPane>
<TabPane :label="tabRebder(reportUnreadNumber)" name="receive">
<ReportReceive v-if="reportTabs === 'receive'" @detail="showDetail"></ReportReceive>
@ -18,6 +15,13 @@
transfer>
<ReportDetail :data="detailData"/>
</DrawerOverlay>
<DrawerOverlay
v-model="showEditDrawer"
placement="right"
:size="1000"
transfer>
<ReportEdit :id="reportId" @saveSuccess="saveSuccess"/>
</DrawerOverlay>
</div>
</template>
@ -47,6 +51,7 @@ export default {
return {
reportTabs: "my",
showDetailDrawer: false,
showEditDrawer: false,
detailData: {},
reportId: 0
}
@ -80,11 +85,13 @@ export default {
},
editReport(id) {
this.reportId = id;
this.reportTabs = "edit";
this.showEditDrawer = true;
},
saveSuccess() {
this.reportId = 0;
this.reportTabs = "my";
this.showEditDrawer = false;
this.$refs.report.getLists();
}
}
}

View File

@ -3,19 +3,19 @@
<Row class="report-row report-row-header" >
<Col span="2"><p class="report-titles">{{ $L("汇报类型") }}</p></Col>
<Col span="12">
<RadioGroup type="button" button-style="solid" v-model="reportData.type" @on-change="typeChange" class="report-radiogroup">
<Radio label="weekly">{{ $L("周报") }}</Radio>
<Radio label="daily">{{ $L("日报") }}</Radio>
<RadioGroup type="button" button-style="solid" v-model="reportData.type" @on-change="typeChange" class="report-radiogroup" :readonly="id > 0">
<Radio label="weekly" :disabled="id > 0">{{ $L("周报") }}</Radio>
<Radio label="daily" :disabled="id > 0">{{ $L("日报") }}</Radio>
</RadioGroup>
<ButtonGroup class="report-buttongroup">
<Tooltip class="report-poptip" trigger="hover" :content="prevCycleText" placement="bottom">
<Button type="primary" @click="prevCycle">
<Tooltip class="report-poptip" trigger="hover" :disabled="id > 0" :content="prevCycleText" placement="bottom">
<Button type="primary" @click="prevCycle" :disabled="id > 0">
<Icon type="ios-arrow-back" />
</Button>
</Tooltip>
<div class="report-buttongroup-shu"></div>
<Tooltip class="report-poptip" trigger="hover" :disabled="reportData.offset >= 0" :content="nextCycleText" placement="bottom">
<Button type="primary" @click="nextCycle" :disabled="reportData.offset >= 0">
<Tooltip class="report-poptip" trigger="hover" :disabled="reportData.offset >= 0 || id > 0" :content="nextCycleText" placement="bottom">
<Button type="primary" @click="nextCycle" :disabled="reportData.offset >= 0 || id > 0">
<Icon type="ios-arrow-forward" />
</Button>
</Tooltip>
@ -93,7 +93,9 @@ export default {
},
watch: {
id(val) {
if (this.id > 0) this.getDetail(val);
if (this.id > 0) {
this.getDetail(val);
}
},
},
computed: {
@ -108,14 +110,32 @@ export default {
this.nextCycleText = this.$L("下一周");
},
handleSubmit: function () {
let id = this.reportData.id;
if (this.id === 0 && id > 1) {
$A.modalConfirm({
title: '覆盖提交',
content: '是否覆盖提交',
loading: true,
onOk: () => {
this.doSubmit();
}
});
} else {
this.doSubmit();
}
},
doSubmit() {
this.$store.dispatch("call", {
url: 'report/store',
data: this.reportData,
method: 'post',
}).then(({data, msg}) => {
// data
this.reportData.offset = 0;
this.getTemplate();
this.disabledType = false;
this.$Modal.remove();
// msg
$A.messageSuccess(msg);
this.$emit("saveSuccess");

View File

@ -1,8 +1,9 @@
<template>
<div class="report-list-wrap">
<Row class="reportmy-row report-row-header">
<Col span="3"><Button type="primary" @click="addReport">{{ $L("新增报告") }}</Button></Col>
<Col span="2"><p class="reportmy-titles">{{ $L("汇报类型") }}</p></Col>
<Col span="6">
<Col span="5">
<Select
v-model="reportType"
style="width:95%"
@ -165,6 +166,10 @@ export default {
searchTab() {
this.getLists();
},
addReport() {
this.$emit("edit", 0);
}
}
}
</script>

View File

@ -153,6 +153,7 @@
display: flex;
flex-direction: column;
height: 100%;
padding: 24px;
.report-row-header, .report-row-foot {
flex: 0 0 auto;