mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 11:19:56 +00:00
feat: 支持使用%发送工作报告
This commit is contained in:
parent
021c09e426
commit
7ca0bc5960
@ -6,6 +6,7 @@ use App\Exceptions\ApiException;
|
||||
use App\Models\AbstractModel;
|
||||
use App\Models\ProjectTask;
|
||||
use App\Models\Report;
|
||||
use App\Models\ReportLink;
|
||||
use App\Models\ReportReceive;
|
||||
use App\Models\User;
|
||||
use App\Module\Base;
|
||||
@ -441,7 +442,8 @@ class ReportController extends AbstractController
|
||||
* @apiGroup report
|
||||
* @apiName detail
|
||||
*
|
||||
* @apiParam {Number} [id] 报告id
|
||||
* @apiParam {Number} [id] 报告ID
|
||||
* @apiParam {String} [code] 报告分享代码,与ID二选一,优先ID
|
||||
*
|
||||
* @apiSuccess {Number} ret 返回状态码(1正确、0错误)
|
||||
* @apiSuccess {String} msg 返回信息(错误描述)
|
||||
@ -450,13 +452,17 @@ class ReportController extends AbstractController
|
||||
public function detail(): array
|
||||
{
|
||||
$user = User::auth();
|
||||
//
|
||||
$id = intval(trim(Request::input("id")));
|
||||
if (empty($id))
|
||||
$code = trim(Request::input("code"));
|
||||
//
|
||||
if (empty($id) && empty($code)) {
|
||||
return Base::retError("缺少ID参数");
|
||||
|
||||
}
|
||||
//
|
||||
if (!empty($id)) {
|
||||
$one = Report::getOne($id);
|
||||
$one->type_val = $one->getRawOriginal("type");
|
||||
|
||||
// 标记为已读
|
||||
if (!empty($one->receivesUser)) {
|
||||
foreach ($one->receivesUser as $item) {
|
||||
@ -467,7 +473,14 @@ class ReportController extends AbstractController
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
$link = ReportLink::whereCode($code)->first();
|
||||
if (empty($link)) {
|
||||
return Base::retError("报告不存在或已被删除");
|
||||
}
|
||||
$one = Report::getOne($link->rid);
|
||||
$one->report_link = $link;
|
||||
}
|
||||
return Base::retSuccess("success", $one);
|
||||
}
|
||||
|
||||
|
||||
@ -4,43 +4,43 @@
|
||||
{{ data.title }}
|
||||
<Icon v-if="loadIng > 0" type="ios-loading" class="icon-loading"></Icon>
|
||||
</div>
|
||||
<div v-if="formOptions.labelWidth === 'auto'" class="report-detail-context">
|
||||
<Form class="report-form auto-form" label-width="auto" inline>
|
||||
<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>
|
||||
</Form>
|
||||
<Form class="report-form auto-form" label-width="auto">
|
||||
<FormItem :label="$L('汇报内容')">
|
||||
<div class="report-content" v-html="data.content"></div>
|
||||
</FormItem>
|
||||
</Form>
|
||||
<div class="report-detail-context">
|
||||
<ul>
|
||||
<li>
|
||||
<div class="report-label">
|
||||
{{ $L("汇报人") }}
|
||||
</div>
|
||||
<div v-else class="report-detail-context">
|
||||
<Form class="report-form" v-bind="formOptions">
|
||||
<template v-if="formOptions.labelWidth !== 'auto'">
|
||||
<FormItem :label="$L('汇报人')">
|
||||
<div class="report-value">
|
||||
<UserAvatar :userid="data.userid" :size="28"/>
|
||||
</FormItem>
|
||||
<FormItem :label="$L('提交时间')">
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="report-label">
|
||||
{{ $L("提交时间") }}
|
||||
</div>
|
||||
<div class="report-value">
|
||||
{{ data.created_at }}
|
||||
</FormItem>
|
||||
<FormItem :label="$L('汇报对象')">
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="report-label">
|
||||
{{ $L("汇报对象") }}
|
||||
</div>
|
||||
<div class="report-value">
|
||||
<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('汇报内容')">
|
||||
</div>
|
||||
</li>
|
||||
<li v-if="data.report_link" :title="$L('分享时间') + ':' + data.report_link.created_at">
|
||||
<div class="report-label">
|
||||
{{ $L("分享人") }}
|
||||
</div>
|
||||
<div class="report-value">
|
||||
<UserAvatar :userid="data.report_link.userid" :size="28"/>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="report-content" v-html="data.content"></div>
|
||||
</FormItem>
|
||||
</Form>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -53,7 +53,10 @@ export default {
|
||||
props: {
|
||||
data: {
|
||||
default: {},
|
||||
}
|
||||
},
|
||||
type: {
|
||||
default: 'view',
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -66,7 +69,9 @@ export default {
|
||||
watch: {
|
||||
'data.id': {
|
||||
handler(id) {
|
||||
if (id > 0) this.sendRead();
|
||||
if (id > 0 && this.type === 'view') {
|
||||
this.sendRead();
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="electron-report">
|
||||
<PageTitle :title="$L('报告详情')"/>
|
||||
<ReportDetail :data="detailData"/>
|
||||
<ReportDetail :data="detailData" :type="type"/>
|
||||
</div>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
@ -19,17 +19,18 @@ export default {
|
||||
components: {ReportDetail},
|
||||
data() {
|
||||
return {
|
||||
type: 'view',
|
||||
detailData: {},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
reportDetailId() {
|
||||
reportId() {
|
||||
const {reportDetailId} = this.$route.params;
|
||||
return parseInt(/^\d+$/.test(reportDetailId) ? reportDetailId : 0);
|
||||
return reportDetailId;
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
reportDetailId: {
|
||||
reportId: {
|
||||
handler() {
|
||||
this.getDetail();
|
||||
},
|
||||
@ -38,14 +39,20 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
getDetail() {
|
||||
if (this.reportDetailId <= 0) {
|
||||
if (!this.reportId) {
|
||||
return;
|
||||
}
|
||||
const data = {}
|
||||
if (/^\d+$/.test(this.reportId)) {
|
||||
data.id = this.reportId;
|
||||
this.type = 'view';
|
||||
} else {
|
||||
data.code = this.reportId;
|
||||
this.type = 'share';
|
||||
}
|
||||
this.$store.dispatch("call", {
|
||||
url: 'report/detail',
|
||||
data: {
|
||||
id: this.reportDetailId,
|
||||
},
|
||||
data,
|
||||
}).then(({data}) => {
|
||||
this.detailData = data;
|
||||
}).catch(({msg}) => {
|
||||
|
||||
49
resources/assets/sass/components/report.scss
vendored
49
resources/assets/sass/components/report.scss
vendored
@ -80,41 +80,40 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.report-form {
|
||||
&.auto-form {
|
||||
> ul {
|
||||
display: flex;
|
||||
margin-bottom: 12px;
|
||||
|
||||
.ivu-form-item {
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
row-gap: 12px;
|
||||
column-gap: 48px;
|
||||
@media (max-width: 768px) {
|
||||
flex-direction: column;
|
||||
column-gap: 0;
|
||||
}
|
||||
> li {
|
||||
flex: 1;
|
||||
flex-shrink: 0;
|
||||
|
||||
.ivu-form-item-label {
|
||||
padding-top: 8px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.ivu-form-item {
|
||||
.ivu-form-item-label {
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.ivu-form-item-content {
|
||||
line-height: 30px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.common-avatar {
|
||||
margin-right: 6px;
|
||||
white-space: nowrap;
|
||||
.report-label {
|
||||
flex-shrink: 0;
|
||||
padding-right: 12px;
|
||||
opacity: .8;
|
||||
}
|
||||
.report-value {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
column-gap: 6px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.report-content {
|
||||
border-top: 1px solid #eeeeee;
|
||||
padding-top: 24px;
|
||||
margin-top: 24px;
|
||||
width: 100%;
|
||||
|
||||
h2 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user