mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 03:01:12 +00:00
fix: 【工作报告】新增报告初始化数据不导入已有时间点数据
This commit is contained in:
parent
53ed4d4072
commit
a1aaf90d2e
@ -230,6 +230,7 @@ class ReportController extends AbstractController
|
|||||||
$user = User::auth();
|
$user = User::auth();
|
||||||
$type = trim(Request::input("type"));
|
$type = trim(Request::input("type"));
|
||||||
$offset = abs(intval(Request::input("offset", 0)));
|
$offset = abs(intval(Request::input("offset", 0)));
|
||||||
|
$id = intval(Request::input("offset", 0));
|
||||||
$now_dt = trim(Request::input("date")) ? Carbon::parse(Request::input("date")) : Carbon::now();
|
$now_dt = trim(Request::input("date")) ? Carbon::parse(Request::input("date")) : Carbon::now();
|
||||||
// 获取开始时间
|
// 获取开始时间
|
||||||
if ($type === Report::DAILY) {
|
if ($type === Report::DAILY) {
|
||||||
@ -256,7 +257,7 @@ class ReportController extends AbstractController
|
|||||||
$sign = Report::generateSign($type, 0, Carbon::instance($start_time));
|
$sign = Report::generateSign($type, 0, Carbon::instance($start_time));
|
||||||
$one = Report::query()->whereSign($sign)->first();
|
$one = Report::query()->whereSign($sign)->first();
|
||||||
// 如果已经提交了相关汇报
|
// 如果已经提交了相关汇报
|
||||||
if ($one) {
|
if ($one && $id > 0) {
|
||||||
return Base::retSuccess('success', [
|
return Base::retSuccess('success', [
|
||||||
"content" => $one->content,
|
"content" => $one->content,
|
||||||
"title" => $one->title,
|
"title" => $one->title,
|
||||||
@ -312,7 +313,7 @@ class ReportController extends AbstractController
|
|||||||
} else {
|
} else {
|
||||||
$title = $user->nickname . "的日报[" . $start_time->format("Y/m/d") . "]";
|
$title = $user->nickname . "的日报[" . $start_time->format("Y/m/d") . "]";
|
||||||
}
|
}
|
||||||
return Base::retSuccess('success', [
|
$data = [
|
||||||
"time" => $start_time->toDateTimeString(),
|
"time" => $start_time->toDateTimeString(),
|
||||||
"complete_task" => $complete_task,
|
"complete_task" => $complete_task,
|
||||||
"unfinished_task" => $unfinished_task,
|
"unfinished_task" => $unfinished_task,
|
||||||
@ -321,7 +322,11 @@ class ReportController extends AbstractController
|
|||||||
Base::Lang('未完成的工作') . '</h2><ol>' .
|
Base::Lang('未完成的工作') . '</h2><ol>' .
|
||||||
$unfinishedContent . '</ol>',
|
$unfinishedContent . '</ol>',
|
||||||
"title" => $title,
|
"title" => $title,
|
||||||
]);
|
];
|
||||||
|
if ($one) {
|
||||||
|
$data['id'] = $one->id;
|
||||||
|
}
|
||||||
|
return Base::retSuccess('success', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -4,18 +4,18 @@
|
|||||||
<Col span="2"><p class="report-titles">{{ $L("汇报类型") }}</p></Col>
|
<Col span="2"><p class="report-titles">{{ $L("汇报类型") }}</p></Col>
|
||||||
<Col span="12">
|
<Col span="12">
|
||||||
<RadioGroup type="button" button-style="solid" v-model="reportData.type" @on-change="typeChange" class="report-radiogroup" :readonly="id > 0">
|
<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="weekly" :disabled="id > 0 && reportData.type =='daily'">{{ $L("周报") }}</Radio>
|
||||||
<Radio label="daily" :disabled="id > 0">{{ $L("日报") }}</Radio>
|
<Radio label="daily" :disabled="id > 0 && reportData.type =='weekly'">{{ $L("日报") }}</Radio>
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
<ButtonGroup class="report-buttongroup">
|
<ButtonGroup class="report-buttongroup" v-if="id === 0">
|
||||||
<Tooltip class="report-poptip" trigger="hover" :disabled="id > 0" :content="prevCycleText" placement="bottom">
|
<Tooltip class="report-poptip" trigger="hover" :content="prevCycleText" placement="bottom">
|
||||||
<Button type="primary" @click="prevCycle" :disabled="id > 0">
|
<Button type="primary" @click="prevCycle">
|
||||||
<Icon type="ios-arrow-back" />
|
<Icon type="ios-arrow-back" />
|
||||||
</Button>
|
</Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<div class="report-buttongroup-shu"></div>
|
<div class="report-buttongroup-shu"></div>
|
||||||
<Tooltip class="report-poptip" trigger="hover" :disabled="reportData.offset >= 0 || id > 0" :content="nextCycleText" placement="bottom">
|
<Tooltip class="report-poptip" trigger="hover" :disabled="reportData.offset >= 0" :content="nextCycleText" placement="bottom">
|
||||||
<Button type="primary" @click="nextCycle" :disabled="reportData.offset >= 0 || id > 0">
|
<Button type="primary" @click="nextCycle" :disabled="reportData.offset >= 0">
|
||||||
<Icon type="ios-arrow-forward" />
|
<Icon type="ios-arrow-forward" />
|
||||||
</Button>
|
</Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
@ -95,6 +95,11 @@ export default {
|
|||||||
id(val) {
|
id(val) {
|
||||||
if (this.id > 0) {
|
if (this.id > 0) {
|
||||||
this.getDetail(val);
|
this.getDetail(val);
|
||||||
|
}else{
|
||||||
|
this.reportData.offset = 0;
|
||||||
|
this.reportData.type = "weekly";
|
||||||
|
this.reportData.receive = [];
|
||||||
|
this.getTemplate();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -111,6 +116,10 @@ export default {
|
|||||||
},
|
},
|
||||||
handleSubmit: function () {
|
handleSubmit: function () {
|
||||||
let id = this.reportData.id;
|
let id = this.reportData.id;
|
||||||
|
if (this.reportData.receive.length === 0) {
|
||||||
|
$A.messageError(this.$L("请选择接收人"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (this.id === 0 && id > 1) {
|
if (this.id === 0 && id > 1) {
|
||||||
$A.modalConfirm({
|
$A.modalConfirm({
|
||||||
title: '覆盖提交',
|
title: '覆盖提交',
|
||||||
@ -133,6 +142,8 @@ export default {
|
|||||||
}).then(({data, msg}) => {
|
}).then(({data, msg}) => {
|
||||||
// data 结果数据
|
// data 结果数据
|
||||||
this.reportData.offset = 0;
|
this.reportData.offset = 0;
|
||||||
|
this.reportData.type = "weekly";
|
||||||
|
this.reportData.receive = [];
|
||||||
this.getTemplate();
|
this.getTemplate();
|
||||||
this.disabledType = false;
|
this.disabledType = false;
|
||||||
this.$Modal.remove();
|
this.$Modal.remove();
|
||||||
@ -140,6 +151,7 @@ export default {
|
|||||||
$A.messageSuccess(msg);
|
$A.messageSuccess(msg);
|
||||||
this.$emit("saveSuccess");
|
this.$emit("saveSuccess");
|
||||||
}).catch(({msg}) => {
|
}).catch(({msg}) => {
|
||||||
|
this.$Modal.remove();
|
||||||
// msg 错误原因
|
// msg 错误原因
|
||||||
$A.messageError(msg);
|
$A.messageError(msg);
|
||||||
});
|
});
|
||||||
@ -149,13 +161,20 @@ export default {
|
|||||||
url: 'report/template',
|
url: 'report/template',
|
||||||
data: {
|
data: {
|
||||||
type: this.reportData.type,
|
type: this.reportData.type,
|
||||||
offset: this.reportData.offset
|
offset: this.reportData.offset,
|
||||||
|
id: this.id
|
||||||
},
|
},
|
||||||
method: 'get',
|
method: 'get',
|
||||||
}).then(({data, msg}) => {
|
}).then(({data, msg}) => {
|
||||||
// data 结果数据
|
// data 结果数据
|
||||||
if (data.id) {
|
if (data.id) {
|
||||||
this.getDetail(data.id);
|
this.reportData.id = data.id;
|
||||||
|
if(this.id > 0){
|
||||||
|
this.getDetail(data.id);
|
||||||
|
}else{
|
||||||
|
this.reportData.title = data.title;
|
||||||
|
this.reportData.content = data.content;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.reportData.id = 0;
|
this.reportData.id = 0;
|
||||||
this.reportData.title = data.title;
|
this.reportData.title = data.title;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user