perf: 移动端显示工作报告

This commit is contained in:
kuaifan 2023-04-17 11:59:41 +08:00
parent 247b9ee0c1
commit 8e76493cc6
9 changed files with 90 additions and 16 deletions

View File

@ -227,6 +227,8 @@ export default {
this.$store.state.windowHeight = $A(window).height() this.$store.state.windowHeight = $A(window).height()
this.$store.state.windowLarge = this.$store.state.windowWidth > 768 this.$store.state.windowLarge = this.$store.state.windowWidth > 768
this.$store.state.windowSmall = this.$store.state.windowWidth <= 768 this.$store.state.windowSmall = this.$store.state.windowWidth <= 768
this.$store.state.formLabelPosition = this.$store.state.windowWidth > 576 ? 'right' : 'top'
this.$store.state.formLabelWidth = this.$store.state.windowWidth > 576 ? 'auto' : ''
}, },
windowScrollListener() { windowScrollListener() {

View File

@ -12,6 +12,7 @@
<div class="more-item"> <div class="more-item">
<i class="taskfont" v-html="item.icon"></i> <i class="taskfont" v-html="item.icon"></i>
<div class="tabbar-title">{{$L(item.label)}}</div> <div class="tabbar-title">{{$L(item.label)}}</div>
<Badge v-if="item.name === 'workReport'" class="tabbar-badge" :overflow-count="999" :count="reportUnreadNumber"/>
</div> </div>
</li> </li>
</ul> </ul>
@ -29,6 +30,9 @@
<template v-else-if="item.name === 'dialog'"> <template v-else-if="item.name === 'dialog'">
<Badge class="tabbar-badge" :overflow-count="999" :text="msgUnreadMention"/> <Badge class="tabbar-badge" :overflow-count="999" :text="msgUnreadMention"/>
</template> </template>
<template v-else-if="item.name === 'more'">
<Badge class="tabbar-badge" :overflow-count="999" :count="reportUnreadNumber"/>
</template>
</li> </li>
</ul> </ul>
<Modal <Modal
@ -77,6 +81,9 @@ export default {
{icon: '&#xe7b8;', name: 'addTask', label: '添加任务'}, {icon: '&#xe7b8;', name: 'addTask', label: '添加任务'},
{icon: '&#xe7c1;', name: 'createMeeting', label: '新会议'}, {icon: '&#xe7c1;', name: 'createMeeting', label: '新会议'},
{icon: '&#xe794;', name: 'joinMeeting', label: '加入会议'}, {icon: '&#xe794;', name: 'joinMeeting', label: '加入会议'},
],
[
{icon: '&#xe7c0;', name: 'workReport', label: '工作报告'},
] ]
], ],
@ -90,6 +97,9 @@ export default {
if ($A.isEEUiApp) { if ($A.isEEUiApp) {
this.navMore[0].splice(2, 0, {icon: '&#xe602;', name: 'scan', label: '扫一扫'}) this.navMore[0].splice(2, 0, {icon: '&#xe602;', name: 'scan', label: '扫一扫'})
} }
if (this.userIsAdmin) {
this.navMore[2].splice(0, 0, {icon: '&#xe63f;', name: 'allUser', label: '团队管理'})
}
}, },
mounted() { mounted() {
@ -101,7 +111,7 @@ export default {
}, },
computed: { computed: {
...mapState(['cacheDialogs']), ...mapState(['userIsAdmin', 'cacheDialogs', 'reportUnreadNumber']),
...mapGetters(['dashboardTask']), ...mapGetters(['dashboardTask']),
routeName() { routeName() {
@ -241,6 +251,8 @@ export default {
case 'addTask': case 'addTask':
case 'addProject': case 'addProject':
case 'allUser':
case 'workReport':
return; return;
case 'createMeeting': case 'createMeeting':

View File

@ -254,7 +254,7 @@
v-model="workReportShow" v-model="workReportShow"
placement="right" placement="right"
:size="1200"> :size="1200">
<Report v-if="workReportShow" :reportType="reportTabs" @on-read="$store.dispatch('getReportUnread', 1000)" /> <Report v-if="workReportShow" v-model="reportTabs" @on-read="$store.dispatch('getReportUnread', 1000)" />
</DrawerOverlay> </DrawerOverlay>
<!--查看所有团队--> <!--查看所有团队-->
@ -1048,6 +1048,10 @@ export default {
case 'addProject': case 'addProject':
this.onAddShow() this.onAddShow()
break; break;
case 'allUser':
case 'workReport':
this.settingRoute(act)
break;
} }
}, },

View File

@ -41,7 +41,7 @@ export default {
}, },
props: { props: {
reportType: { value: {
default: "my" default: "my"
} }
}, },
@ -57,7 +57,7 @@ export default {
}, },
mounted() { mounted() {
this.reportTabs = this.reportType; this.reportTabs = this.value;
// //
if (this.$isMainElectron) { if (this.$isMainElectron) {
this.$Electron.listenerOnly('reportSaveSuccess', ({data, msg}) => { this.$Electron.listenerOnly('reportSaveSuccess', ({data, msg}) => {
@ -73,6 +73,12 @@ export default {
]) ])
}, },
watch: {
reportTabs(val) {
this.$emit("input", val)
}
},
methods: { methods: {
tabRebder(num) { tabRebder(num) {
return h => { return h => {

View File

@ -4,8 +4,8 @@
{{ data.title }} {{ data.title }}
<Icon v-if="loadIng > 0" type="ios-loading" class="icon-loading"></Icon> <Icon v-if="loadIng > 0" type="ios-loading" class="icon-loading"></Icon>
</div> </div>
<div class="report-detail-context"> <div v-if="formLabelWidth === 'auto'" class="report-detail-context">
<Form class="report-form" label-width="auto" inline> <Form class="report-form auto-form" label-width="auto" inline>
<FormItem :label="$L('汇报人')"> <FormItem :label="$L('汇报人')">
<UserAvatar :userid="data.userid" :size="28"/> <UserAvatar :userid="data.userid" :size="28"/>
</FormItem> </FormItem>
@ -17,7 +17,26 @@
<UserAvatar v-else v-for="(item, key) in data.receives_user" :key="key" :userid="item.userid" :size="28"/> <UserAvatar v-else v-for="(item, key) in data.receives_user" :key="key" :userid="item.userid" :size="28"/>
</FormItem> </FormItem>
</Form> </Form>
<Form class="report-form" label-width="auto"> <Form class="report-form auto-form" label-width="auto">
<FormItem :label="$L('汇报内容')">
<div class="report-content" v-html="data.content"></div>
</FormItem>
</Form>
</div>
<div v-else class="report-detail-context">
<Form class="report-form" :labelPosition="formLabelPosition" :labelWidth="formLabelWidth">
<template v-if="formLabelWidth !== 'auto'">
<FormItem :label="$L('汇报人')">
<UserAvatar :userid="data.userid" :size="28"/>
</FormItem>
<FormItem :label="$L('提交时间')">
{{ data.created_at }}
</FormItem>
<FormItem :label="$L('汇报对象')">
<template v-if="data.receives_user.length === 0">-</template>
<UserAvatar v-else v-for="(item, key) in data.receives_user" :key="key" :userid="item.userid" :size="28"/>
</FormItem>
</template>
<FormItem :label="$L('汇报内容')"> <FormItem :label="$L('汇报内容')">
<div class="report-content" v-html="data.content"></div> <div class="report-content" v-html="data.content"></div>
</FormItem> </FormItem>
@ -27,6 +46,8 @@
</template> </template>
<script> <script>
import {mapState} from "vuex";
export default { export default {
name: "ReportDetail", name: "ReportDetail",
props: { props: {
@ -39,6 +60,9 @@ export default {
loadIng: 0, loadIng: 0,
} }
}, },
computed: {
...mapState(['formLabelPosition', 'formLabelWidth']),
},
watch: { watch: {
'data.id': { 'data.id': {
handler(id) { handler(id) {

View File

@ -80,6 +80,9 @@ export default {
title: this.$L("名称"), title: this.$L("名称"),
key: 'title', key: 'title',
minWidth: 120, minWidth: 120,
render: (h, {row}) => {
return h('AutoTip', row.title);
}
}, { }, {
title: this.$L("类型"), title: this.$L("类型"),
key: 'type', key: 'type',

View File

@ -108,16 +108,24 @@ export default {
h('Tag', { h('Tag', {
props: { // props: { //
color: "orange", color: "orange",
},
style: {
flexShrink: 0,
} }
}, this.$L("未读")), }, this.$L("未读")),
h('span', row.title) h('AutoTip', row.title)
) )
} else { } else {
arr.push( arr.push(
h('span', row.title) h('AutoTip', row.title)
) )
} }
return h('div', arr) return h('div', {
style: {
display: 'flex',
alignItems: 'center',
}
}, arr)
} }
}, { }, {
title: this.$L("类型"), title: this.$L("类型"),

View File

@ -124,6 +124,7 @@
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
position: relative;
.taskfont { .taskfont {
display: flex; display: flex;
@ -145,6 +146,12 @@
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.tabbar-badge {
position: absolute;
top: -4px;
right: 12px;
}
} }
} }
} }

View File

@ -81,15 +81,22 @@
} }
.report-form { .report-form {
display: flex; &.auto-form {
margin-bottom: 12px; display: flex;
margin-bottom: 12px;
.ivu-form-item {
flex: 1;
flex-shrink: 0;
.ivu-form-item-label {
padding-top: 8px;
}
}
}
.ivu-form-item { .ivu-form-item {
flex: 1;
flex-shrink: 0;
.ivu-form-item-label { .ivu-form-item-label {
padding-top: 8px;
opacity: 0.8; opacity: 0.8;
} }
@ -97,6 +104,7 @@
line-height: 30px; line-height: 30px;
display: flex; display: flex;
align-items: center; align-items: center;
.common-avatar { .common-avatar {
margin-right: 6px; margin-right: 6px;
} }