mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-14 04:32:49 +00:00
feat: 客户端登录,新增工作报告、修改工作报告、查看工作报告,全部直接在新窗口打开
This commit is contained in:
parent
e301abe9e3
commit
a4b69c3911
@ -362,6 +362,7 @@ class ReportController extends AbstractController
|
||||
*/
|
||||
public function detail(): array
|
||||
{
|
||||
$user = User::auth();
|
||||
$id = intval(trim(Request::input("id")));
|
||||
if (empty($id))
|
||||
return Base::retError("缺少ID参数");
|
||||
@ -369,7 +370,6 @@ class ReportController extends AbstractController
|
||||
$one = Report::getOne($id);
|
||||
$one->type_val = $one->getRawOriginal("type");
|
||||
|
||||
$user = User::auth();
|
||||
// 标记为已读
|
||||
if (!empty($one->receivesUser)) {
|
||||
foreach ($one->receivesUser as $item) {
|
||||
|
||||
@ -101,15 +101,13 @@ class Report extends AbstractModel
|
||||
/**
|
||||
* 获取单条记录
|
||||
* @param $id
|
||||
* @param User|null $user
|
||||
* @return Report|Builder|Model|object|null
|
||||
* @throw ApiException
|
||||
*/
|
||||
public static function getOne($id, User $user = null)
|
||||
public static function getOne($id)
|
||||
{
|
||||
$user === null && $user = User::auth();
|
||||
$one = self::whereUserid($user->userid)->whereId($id)->first();
|
||||
if ( empty($one) )
|
||||
$one = self::whereId($id)->first();
|
||||
if (empty($one))
|
||||
throw new ApiException("记录不存在");
|
||||
return $one;
|
||||
}
|
||||
|
||||
@ -85,14 +85,59 @@ export default {
|
||||
},
|
||||
|
||||
onView(row) {
|
||||
this.showDetailDrawer = true;
|
||||
this.detailData = row;
|
||||
this.$emit("on-read");
|
||||
if (this.$Electron) {
|
||||
let config = {
|
||||
title: row.title,
|
||||
titleFixed: true,
|
||||
parent: null,
|
||||
width: Math.min(window.screen.availWidth, this.$el.clientWidth + 72),
|
||||
height: Math.min(window.screen.availHeight, this.$el.clientHeight + 72),
|
||||
minWidth: 600,
|
||||
minHeight: 450,
|
||||
};
|
||||
if (this.hasOpenDialog) {
|
||||
config.minWidth = 800;
|
||||
config.minHeight = 600;
|
||||
}
|
||||
this.$Electron.sendMessage('windowRouter', {
|
||||
name: 'report-' + row.id,
|
||||
path: "/single/report/detail/" + row.id,
|
||||
force: false,
|
||||
config
|
||||
});
|
||||
}else{
|
||||
this.showDetailDrawer = true;
|
||||
}
|
||||
},
|
||||
|
||||
onEditReport(id) {
|
||||
onEditReport(id,title) {
|
||||
this.reportId = id;
|
||||
this.showEditDrawer = true;
|
||||
if (this.$Electron) {
|
||||
let config = {
|
||||
title: title,
|
||||
titleFixed: true,
|
||||
parent: null,
|
||||
width: Math.min(window.screen.availWidth, this.$el.clientWidth + 72),
|
||||
height: Math.min(window.screen.availHeight, this.$el.clientHeight + 72),
|
||||
minWidth: 600,
|
||||
minHeight: 450,
|
||||
};
|
||||
if (this.hasOpenDialog) {
|
||||
config.minWidth = 800;
|
||||
config.minHeight = 600;
|
||||
}
|
||||
this.$Electron.sendMessage('windowRouter', {
|
||||
name: 'report-' + id,
|
||||
path: "/single/report/edit/" + id,
|
||||
force: false,
|
||||
config
|
||||
});
|
||||
} else {
|
||||
this.showEditDrawer = true;
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
saveSuccess() {
|
||||
|
||||
@ -140,7 +140,7 @@ export default {
|
||||
},
|
||||
on: {
|
||||
action: (name) => {
|
||||
if (name === 'edit') this.$emit("on-edit", row.id);
|
||||
if (name === 'edit') this.$emit("on-edit", row.id, row.title);
|
||||
if (name === 'view') this.$emit("on-view", row);
|
||||
}
|
||||
}
|
||||
@ -197,7 +197,7 @@ export default {
|
||||
},
|
||||
|
||||
addReport() {
|
||||
this.$emit("on-edit", 0);
|
||||
this.$emit("on-edit", 0, this.$L('新增报告'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
53
resources/assets/js/pages/single/reportDetail.vue
Normal file
53
resources/assets/js/pages/single/reportDetail.vue
Normal file
@ -0,0 +1,53 @@
|
||||
<template>
|
||||
<div class="electron-report">
|
||||
<PageTitle :title="$L('报告详情')"/>
|
||||
<ReportDetail :data="detailData"/>
|
||||
</div>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
.electron-report {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: auto;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
import ReportDetail from "../manage/components/ReportDetail";
|
||||
|
||||
export default {
|
||||
components: {ReportDetail},
|
||||
name: "reportDetail",
|
||||
data() {
|
||||
return {
|
||||
detailData: {},
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
'$route': {
|
||||
handler() {
|
||||
this.getDetail();
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
getDetail() {
|
||||
this.$store.dispatch("call", {
|
||||
url: 'report/detail',
|
||||
data: {
|
||||
id: $A.runNum(this.$route.params.id),
|
||||
},
|
||||
}).then(({data}) => {
|
||||
this.detailData = data;
|
||||
}).catch(({msg}) => {
|
||||
$A.messageError(msg);
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
26
resources/assets/js/pages/single/reportEdit.vue
Normal file
26
resources/assets/js/pages/single/reportEdit.vue
Normal file
@ -0,0 +1,26 @@
|
||||
<template>
|
||||
<div class="electron-report">
|
||||
<PageTitle :title="$L('添加/编辑报告')"/>
|
||||
<ReportEdit :id="$A.runNum(this.$route.params.id)"/>
|
||||
</div>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
.electron-report {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: auto;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
import ReportEdit from "../manage/components/ReportEdit"
|
||||
|
||||
export default {
|
||||
components: {ReportEdit},
|
||||
name: "reportEdit"
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
10
resources/assets/js/routes.js
vendored
10
resources/assets/js/routes.js
vendored
@ -96,6 +96,16 @@ export default [
|
||||
meta: {title: '验证绑定邮箱'},
|
||||
component: () => import('./pages/single/validEmail.vue')
|
||||
},
|
||||
{
|
||||
name: 'report-edit',
|
||||
path: '/single/report/edit/:id',
|
||||
component: () => import('./pages/single/reportEdit.vue')
|
||||
},
|
||||
{
|
||||
name: 'report-detail',
|
||||
path: '/single/report/detail/:id',
|
||||
component: () => import('./pages/single/reportDetail.vue')
|
||||
},
|
||||
{
|
||||
name: 'login',
|
||||
path: '/login',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user