优化工作报告前端

This commit is contained in:
kuaifan 2022-01-21 21:49:27 +08:00
parent c33be22057
commit da39739fb5
4 changed files with 43 additions and 47 deletions

View File

@ -11,7 +11,7 @@
<UserAvatar :userid="userId" :size="36" tooltipDisabled/> <UserAvatar :userid="userId" :size="36" tooltipDisabled/>
</div> </div>
<span>{{userInfo.nickname}}</span> <span>{{userInfo.nickname}}</span>
<Badge v-if="reportUnreadNumber > 0" class="manage-box-top-report" :count="reportUnreadNumber"/> <Badge class="manage-box-top-report" :count="reportUnreadNumber"/>
<div class="manage-box-arrow"> <div class="manage-box-arrow">
<Icon type="ios-arrow-up" /> <Icon type="ios-arrow-up" />
<Icon type="ios-arrow-down" /> <Icon type="ios-arrow-down" />
@ -24,7 +24,7 @@
:divided="!!item.divided" :divided="!!item.divided"
:name="item.path"> :name="item.path">
{{$L(item.name)}} {{$L(item.name)}}
<Badge v-if="item.path === 'workReport'" @click.native="openReceiveReport" class="manage-menu-report-badge" :count="reportUnreadNumber"/> <Badge v-if="item.path === 'workReport'" class="manage-menu-report-badge" :count="reportUnreadNumber"/>
</DropdownItem> </DropdownItem>
<Dropdown placement="right-start" @on-click="setTheme"> <Dropdown placement="right-start" @on-click="setTheme">
<DropdownItem divided> <DropdownItem divided>
@ -528,6 +528,9 @@ export default {
this.archivedProjectShow = true; this.archivedProjectShow = true;
return; return;
case 'workReport': case 'workReport':
if (this.reportUnreadNumber > 0) {
this.reportTabs = "receive";
}
this.workReportShow = true; this.workReportShow = true;
return; return;
case 'clearCache': case 'clearCache':
@ -742,7 +745,6 @@ export default {
}, },
getReportUnread() { getReportUnread() {
this.reportTabs = "my";
this.$store.dispatch("call", { this.$store.dispatch("call", {
url: 'report/unread', url: 'report/unread',
method: 'get', method: 'get',
@ -750,10 +752,6 @@ export default {
this.reportUnreadNumber = data.total ? data.total : 0; this.reportUnreadNumber = data.total ? data.total : 0;
}).catch(() => {}); }).catch(() => {});
}, },
openReceiveReport(){
this.reportTabs = "receive";
}
} }
} }
</script> </script>

View File

@ -10,17 +10,17 @@
<Radio label="daily" :disabled="id > 0 && reportData.type =='weekly'">{{ $L("日报") }}</Radio> <Radio label="daily" :disabled="id > 0 && reportData.type =='weekly'">{{ $L("日报") }}</Radio>
</RadioGroup> </RadioGroup>
<ButtonGroup class="report-buttongroup" v-if="id === 0"> <ButtonGroup class="report-buttongroup" v-if="id === 0">
<Tooltip class="report-poptip" trigger="hover" :content="prevCycleText" placement="bottom"> <ETooltip class="report-poptip" :content="prevCycleText" placement="bottom">
<Button type="primary" @click="prevCycle"> <Button type="primary" @click="prevCycle">
<Icon type="ios-arrow-back" /> <Icon type="ios-arrow-back" />
</Button> </Button>
</Tooltip> </ETooltip>
<div class="report-buttongroup-vertical"></div> <div class="report-buttongroup-vertical"></div>
<Tooltip class="report-poptip" trigger="hover" :disabled="reportData.offset >= 0" :content="nextCycleText" placement="bottom"> <ETooltip class="report-poptip" :disabled="reportData.offset >= 0" :content="nextCycleText" placement="bottom">
<Button type="primary" @click="nextCycle" :disabled="reportData.offset >= 0"> <Button type="primary" @click="nextCycle" :disabled="reportData.offset >= 0">
<Icon type="ios-arrow-forward" /> <Icon type="ios-arrow-forward" />
</Button> </Button>
</Tooltip> </ETooltip>
</ButtonGroup> </ButtonGroup>
</Col> </Col>
</Row> </Row>
@ -62,7 +62,7 @@
<Row class="report-row report-row-foot"> <Row class="report-row report-row-foot">
<Col span="2"></Col> <Col span="2"></Col>
<Col span="4"> <Col span="4">
<Button type="primary" @click="handleSubmit" class="report-bottom">提交</Button> <Button type="primary" @click="handleSubmit" class="report-bottom">{{$L(id > 0 ? '修改' : '提交')}}</Button>
</Col> </Col>
</Row> </Row>
</Form> </Form>
@ -124,15 +124,14 @@ export default {
}, },
handleSubmit: function () { handleSubmit: function () {
let id = this.reportData.id;
if (this.reportData.receive.length === 0) { if (this.reportData.receive.length === 0) {
$A.messageError(this.$L("请选择接收人")); $A.messageError(this.$L("请选择接收人"));
return false; return false;
} }
if (this.id === 0 && id > 1) { if (this.id === 0 && this.reportData.id > 1) {
$A.modalConfirm({ $A.modalConfirm({
title: '覆盖提交', title: '覆盖提交',
content: '是否覆盖提交', content: '你已提交过此日期的报告,是否覆盖提交',
loading: true, loading: true,
zIndex: 2000, zIndex: 2000,
onOk: () => { onOk: () => {
@ -142,7 +141,6 @@ export default {
} else { } else {
this.doSubmit(); this.doSubmit();
} }
}, },
doSubmit() { doSubmit() {

View File

@ -114,8 +114,8 @@ export default {
align: 'center', align: 'center',
width: 100, width: 100,
minWidth: 100, minWidth: 100,
render: (h, params) => { render: (h, {column, row}) => {
if (!params.row.id) { if (!row.id) {
return null; return null;
} }
const vNodes = [ const vNodes = [
@ -126,7 +126,7 @@ export default {
style: {margin: '0 3px', cursor: 'pointer'}, style: {margin: '0 3px', cursor: 'pointer'},
on: { on: {
click: () => { click: () => {
this.$emit("edit", params.row.id); this.$emit("edit", row.id);
} }
} }
})]), })]),
@ -138,14 +138,14 @@ export default {
style: {margin: '0 3px', cursor: 'pointer'}, style: {margin: '0 3px', cursor: 'pointer'},
on: { on: {
click: () => { click: () => {
this.$emit("detail", params.row); this.$emit("detail", row);
} }
} }
})]), })]),
]; ];
return h('TableAction', { return h('TableAction', {
props: { props: {
column: params.column column
} }
}, vNodes); }, vNodes);
}, },

View File

@ -103,13 +103,13 @@ export default {
initLanguage() { initLanguage() {
this.noDataText = this.noDataText || "数据加载中....."; this.noDataText = this.noDataText || "数据加载中.....";
this.columns = [{ this.columns = [{
"title": this.$L("标题"), title: this.$L("标题"),
"key": 'title', key: 'title',
"sortable": true, sortable: true,
"minWidth": 120, minWidth: 120,
render: (h, params) => { render: (h, {row}) => {
let arr = [] let arr = []
const myUser = params.row.receives_user.find(({userid}) => userid == this.userId) const myUser = row.receives_user.find(({userid}) => userid == this.userId)
if (myUser && myUser.pivot.read == 0) { if (myUser && myUser.pivot.read == 0) {
arr.push( arr.push(
h('Tag', { h('Tag', {
@ -117,35 +117,35 @@ export default {
color: "orange", color: "orange",
} }
}, this.$L("未读")), }, this.$L("未读")),
h('span', params.row.title) h('span', row.title)
) )
} else { } else {
arr.push( arr.push(
h('span', params.row.title) h('span', row.title)
) )
} }
return h('div', arr) return h('div', arr)
} }
}, { }, {
"title": this.$L("类型"), title: this.$L("类型"),
"key": 'type', key: 'type',
"align": 'center', align: 'center',
"sortable": true, sortable: true,
"maxWidth": 80, maxWidth: 80,
}, { }, {
"title": this.$L("接收时间"), title: this.$L("接收时间"),
"key": 'receive_time', key: 'receive_time',
"align": 'center', align: 'center',
"sortable": true, sortable: true,
"maxWidth": 180, maxWidth: 180,
}, { }, {
title: this.$L("操作"), title: this.$L("操作"),
align: 'center', align: 'center',
width: 100, width: 100,
minWidth: 100, minWidth: 100,
render: (h, params) => { render: (h, {column, row}) => {
if (!params.row.id) { if (!row.id) {
return null; return null;
} }
const vNodes = [ const vNodes = [
@ -157,10 +157,10 @@ export default {
style: {margin: '0 3px', cursor: 'pointer'}, style: {margin: '0 3px', cursor: 'pointer'},
on: { on: {
click: () => { click: () => {
this.$emit("detail", params.row) this.$emit("detail", row)
const myUser = params.row.receives_user.find(({userid}) => userid == this.userId) const myUser = row.receives_user.find(({userid}) => userid == this.userId)
if (myUser) { if (myUser) {
this.$set(myUser, 'pivot.read', 1) this.$set(myUser.pivot, 'read', 1)
} }
} }
} }
@ -168,7 +168,7 @@ export default {
]; ];
return h('TableAction', { return h('TableAction', {
props: { props: {
column: params.column column: column
} }
}, vNodes); }, vNodes);
}, },