Merge branch 'develop' of ssh://git.gezi.vip:6006/gx/dootask into develop

# Conflicts:
#	resources/assets/js/pages/manage/components/ReportDetail.vue
#	resources/assets/js/pages/manage/components/ReportEdit.vue
This commit is contained in:
kuaifan 2022-01-21 21:04:28 +08:00
commit c33be22057
5 changed files with 41 additions and 18 deletions

View File

@ -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);
} }
/** /**

2
public/js/app.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -31,7 +31,7 @@
</Col> </Col>
<Col span="6"> <Col span="6">
<div class="report-submitter"> <div class="report-submitter">
<UserAvatar v-for="item in data.receives_user" :key="item.userid" :userid="item.userid" :size="28"/> <UserAvatar v-for="(item, key) in data.receives_user" :key="key" :userid="item.userid" :size="28"/>
</div> </div>
</Col> </Col>
</Row> </Row>

View File

@ -6,18 +6,18 @@
</Col> </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-vertical"></div> <div class="report-buttongroup-vertical"></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>
@ -103,6 +103,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();
} }
}, },
}, },
@ -120,6 +125,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: '覆盖提交',
@ -144,6 +153,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();
@ -151,6 +162,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);
}); });
@ -161,14 +173,22 @@ 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.reportData.id = data.id;
if(this.id > 0){
this.getDetail(data.id); this.getDetail(data.id);
}else{
this.reportData.title = data.title;
this.reportData.content = data.content;
}
} else { } else {
this.reportData.id = 0;
this.reportData.title = data.title; this.reportData.title = data.title;
this.reportData.content = data.content; this.reportData.content = data.content;
} }
@ -189,8 +209,6 @@ export default {
this.prevCycleText = this.$L("上一天"); this.prevCycleText = this.$L("上一天");
this.nextCycleText = this.$L("下一天"); this.nextCycleText = this.$L("下一天");
} }
if (this.id <= 0)
this.getTemplate(); this.getTemplate();
}, },