Browse Source

日历

test
dai 3 years ago
parent
commit
5437e0cf56
  1. 282
      src/views/modules/communityParty/calendar/index.vue

282
src/views/modules/communityParty/calendar/index.vue

@ -1,25 +1,28 @@
<template>
<div>
<div v-if="showType==='list'"
class="g-cnt">
<div v-if="showType === 'list'" class="g-cnt">
<el-row :gutter="15">
<el-col :span="6">
<div class="m-sizer">
<div class="item">
<el-cascader class="customer_cascader"
<el-cascader
class="customer_cascader"
ref="myCascader"
size="small"
v-model="fmData.orgId"
:options="partyOptions"
:props="partyOptionsProps"
:show-all-levels="false"
@change="handleChangeParty"></el-cascader>
@change="handleChangeParty"
></el-cascader>
</div>
<div class="item">
<el-radio v-model="fmData.isSelf"
label="1">本人创建的活动</el-radio>
<el-radio v-model="fmData.isSelf"
label="0">本组织所有活动</el-radio>
<el-radio v-model="fmData.isSelf" label="1"
>本人创建的活动</el-radio
>
<el-radio v-model="fmData.isSelf" label="0"
>本组织所有活动</el-radio
>
</div>
</div>
@ -31,16 +34,20 @@
<div class="date-week">{{ currentDate.dayFormat }}</div>
</div>
<div class="m-list"
<div
class="m-list"
v-if="
currentDateData.activityList.length > 0 ||
currentDateData.scheduleList.length > 0
">
"
>
<div class="list-title">今日活动/日程</div>
<div class="list">
<div class="item"
<div
class="item"
:key="item.activityId"
v-for="item in currentDateData.activityList">
v-for="item in currentDateData.activityList"
>
<div class="item-title">
{{ item.theme }}
</div>
@ -61,20 +68,31 @@
<span>{{ item.joinOrgs.join("、") }}</span>
</div>
<div class="item-ope">
<el-button type="primary"
<el-button
type="primary"
size="mini"
@click="handleClickHuodong('publish', item)">发布</el-button>
<el-button type="success"
@click="handleClickHuodong('publish', item)"
>发布</el-button
>
<el-button
type="success"
size="mini"
@click="handleClickHuodong('edit', item)">编辑</el-button>
<el-button size="mini"
@click="handleClickHuodong('del', item)">删除</el-button>
@click="handleClickHuodong('edit', item)"
>编辑</el-button
>
<el-button
size="mini"
@click="handleClickHuodong('del', item)"
>删除</el-button
>
</div>
</div>
<div class="item"
<div
class="item"
:key="item.scheduleId"
v-for="item in currentDateData.scheduleList">
v-for="item in currentDateData.scheduleList"
>
<div class="item-title">
{{ item.title }}
</div>
@ -87,22 +105,29 @@
<span>{{ item.remark }}</span>
</div>
<div class="item-ope">
<el-button type="success"
<el-button
type="success"
size="mini"
@click="handleClickRicheng('edit', item)"
>编辑</el-button
>
<el-button
size="mini"
@click="handleClickRicheng('edit', item)">编辑</el-button>
<el-button size="mini"
@click="handleClickRicheng('del', item)">删除</el-button>
@click="handleClickRicheng('del', item)"
>删除</el-button
>
</div>
</div>
</div>
</div>
<div class="m-ope">
<el-button type="warning"
style="width: 48%"
@click="addHudong">添加活动计划</el-button>
<el-button style="width: 48%"
@click="addRicheng">添加日程</el-button>
<el-button type="warning" style="width: 48%" @click="addHudong"
>添加活动计划</el-button
>
<el-button style="width: 48%" @click="addRicheng"
>添加日程</el-button
>
</div>
</el-col>
@ -110,51 +135,67 @@
<div class="m-cal">
<div class="hd">
<div class="hd-year">
<el-date-picker v-model="currentYearStr"
<el-date-picker
v-model="currentYearStr"
value-format="yyyy"
type="year"
placeholder="选择年"
size="small"
style="width: 150px">
style="width: 150px"
>
</el-date-picker>
</div>
<div class="hd-month">
<div class="month-item"
<div
class="month-item"
:class="{ 'z-on': m - 1 == currentMonth }"
:key="'month' + m"
@click="currentMonth = m - 1"
v-for="m in 12">
<el-badge :value="monthData[m - 1]"
v-for="m in 12"
>
<el-badge
:value="monthData[m-1]"
:hidden="monthData[m-1] == 0"
class="item">
class="item"
>
<div class="month-text">{{ m }}</div>
</el-badge>
</div>
</div>
<div class="hd-btn">
<el-button type="primary"
<el-button
type="primary"
size="small"
@click="handleAddYearPlan">批量生成年度报表</el-button>
@click="handleAddYearPlan"
>批量生成年度报表</el-button
>
</div>
</div>
<calendar :currentYear="currentYear"
<calendar
:currentYear="currentYear"
:currentMonth="currentMonth"
@rangeChange="handleRangeChange"
@clickDate="handleChangeDate">
@clickDate="handleChangeDate"
>
<template v-slot:date-item="{ item, index }">
<div class="tip"
<div
class="tip"
v-if="
rangeData[item.dateId] &&
rangeData[item.dateId].activityList.length > 0
">
<div class="tip-num"
v-if="rangeData[item.dateId].activityList.length > 1">
"
>
<div
class="tip-num"
v-if="rangeData[item.dateId].activityList.length > 1"
>
{{ rangeData[item.dateId].activityList.length }}
</div>
<div class="tip-text">
<span class="z-on">
{{ rangeData[item.dateId].activityList[0].type }}</span>
{{ rangeData[item.dateId].activityList[0].type }}</span
>
{{
rangeData[item.dateId].activityList[0].isPublicValue
? "(已发布)"
@ -165,11 +206,12 @@
{{ rangeData[item.dateId].activityList[0].topic }}
</div>
<div class="all-list"
:class="computeAllListClass(index)">
<div class="item"
<div class="all-list" :class="computeAllListClass(index)">
<div
class="item"
:key="item.activityId"
v-for="item in rangeData[item.dateId].activityList">
v-for="item in rangeData[item.dateId].activityList"
>
<div class="item-title">
{{ item.theme }}
</div>
@ -192,21 +234,24 @@
</div>
</div>
</div>
<div class="corn"
<div
class="corn"
v-if="
rangeData[item.dateId] &&
rangeData[item.dateId].scheduleList.length > 0
">
"
>
<div class="corn-num">
{{ rangeData[item.dateId].scheduleList.length }}
</div>
<div class="corn-text">日程</div>
<div class="all-list"
:class="computeAllListClass(index)">
<div class="item"
<div class="all-list" :class="computeAllListClass(index)">
<div
class="item"
:key="item.scheduleId"
v-for="item in rangeData[item.dateId].scheduleList">
v-for="item in rangeData[item.dateId].scheduleList"
>
<div class="item-title">
{{ item.title }}
</div>
@ -226,15 +271,17 @@
</div>
</el-col>
</el-row>
</div>
<div v-if="showType === 'yearplan'">
<yearplan-list @handleOk="handleAddPlanOk"
@handleClose="handleAddPlanClose"></yearplan-list>
<yearplan-list
@handleOk="handleAddPlanOk"
@handleClose="handleAddPlanClose"
></yearplan-list>
</div>
<el-dialog v-if="showAdd"
<el-dialog
v-if="showAdd"
:visible.sync="showAdd"
:close-on-click-modal="false"
:close-on-press-escape="false"
@ -242,15 +289,19 @@
width="850px"
top="5vh"
class="dialog-h"
@closed="showAdd = false">
<add-activity ref="ref_add_form"
@closed="showAdd = false"
>
<add-activity
ref="ref_add_form"
:formType="formType"
:icPartyActId="icPartyActId"
@handleOk="handleOk"
@handleClose="handleClose"></add-activity>
@handleClose="handleClose"
></add-activity>
</el-dialog>
<el-dialog v-if="showSchedule"
<el-dialog
v-if="showSchedule"
:visible.sync="showSchedule"
:close-on-click-modal="false"
:close-on-press-escape="false"
@ -258,12 +309,15 @@
width="850px"
top="5vh"
class="dialog-h"
@closed="showSchedule = false">
<schedule-form ref="ref_schedule_form"
@closed="showSchedule = false"
>
<schedule-form
ref="ref_schedule_form"
:formType="formType"
:scheduleId="scheduleId"
@handleOk="handleOk"
@handleClose="handleClose">
@handleClose="handleClose"
>
</schedule-form>
</el-dialog>
</div>
@ -334,14 +388,14 @@ export default {
},
showAdd: false,
formType: 'add',
addDiaTitle: '添加活动计划',
formType: "add",
addDiaTitle: "添加活动计划",
showSchedule: false,
scheduleDiaTitle: '添加日程提醒',
showType: 'list',
scheduleDiaTitle: "添加日程提醒",
showType: "list",
icPartyActId: '',
scheduleId: '',
icPartyActId: "",
scheduleId: "",
};
},
computed: {
@ -380,62 +434,60 @@ export default {
methods: {
//
addHudong() {
this.icPartyActId = ''
this.addDiaTitle = '新增活动计划'
this.formType = 'add'
this.icPartyActId = "";
this.addDiaTitle = "新增活动计划";
this.formType = "add";
this.showAdd = true;
},
//
addRicheng() {
this.formType = 'schedule'
this.formType = "schedule";
this.showSchedule = true;
},
//
handleClickHuodong(type, item) {
console.log(type, item);
this.icPartyActId = item.activityId
this.icPartyActId = item.activityId;
if (type == "publish") {
//
this.$confirm("确认发布活动?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
type: "warning",
})
.then(() => {
this.publishActivity()
this.publishActivity();
})
.catch(err => {
.catch((err) => {
if (err == "cancel") {
// this.$message({
// type: "info",
// message: ""
// });
}
});
} else if (type == "edit") {
//
this.addDiaTitle = '修改活动计划'
this.formType = 'edit'
this.showAdd = true
this.addDiaTitle = "修改活动计划";
this.formType = "edit";
this.showAdd = true;
} else if (type == "del") {
//
this.$confirm("活动删除后不可恢复,您确定要删除吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
type: "warning",
})
.then(() => {
this.cancelActivity()
this.cancelActivity();
})
.catch(err => {
if (err == "cancel") { }
.catch((err) => {
if (err == "cancel") {
}
});
}
},
@ -455,8 +507,8 @@ export default {
async cancelActivity() {
const url = "/resi/partymember/icPartyAct/del";
let params = []
params.push(this.icPartyActId)
let params = [];
params.push(this.icPartyActId);
const { data, code, msg } = await requestPost(url, params);
@ -471,34 +523,34 @@ export default {
//
handleClickRicheng(type, item) {
console.log(type, item);
this.scheduleId = item.scheduleId
this.scheduleId = item.scheduleId;
if (type == "edit") {
//
this.scheduleDiaTitle = '修改日程提醒'
this.formType = 'schedule'
this.scheduleDiaTitle = "修改日程提醒";
this.formType = "schedule";
this.showSchedule = true;
} else if (type == "del") {
//
this.$confirm("日程提醒删除后不可恢复,您确定要删除吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
type: "warning",
})
.then(() => {
this.cancelSchedule()
this.cancelSchedule();
})
.catch(err => {
if (err == "cancel") { }
.catch((err) => {
if (err == "cancel") {
}
});
}
},
async cancelSchedule() {
const url = "/resi/partymember/icSchedule/del";
let params = []
params.push(this.scheduleId)
let params = [];
params.push(this.scheduleId);
const { data, code, msg } = await requestPost(url, params);
@ -512,7 +564,9 @@ export default {
//
refreshData() {
this.getMonthData();
this.getRangeData();
this.getCurrentDateData();
},
handleChangeParty() {},
@ -597,10 +651,10 @@ export default {
});
if (code === 0) {
if (Array.isArray(data)) {
data.forEach((item) => {
this.monthData[item.monthId - 1] = item.count;
data.forEach((item, index) => {
this.monthData[index] = parseInt(item.count);
});
console.log(this.monthData);
console.log("--------------monthData", this.monthData);
}
} else {
this.$message.error(msg);
@ -642,26 +696,26 @@ export default {
},
handleAddYearPlan() {
this.showType = 'yearplan'
this.showType = "yearplan";
},
handleAddPlanOk() {
this.showType = 'list'
this.refreshData()
this.showType = "list";
this.refreshData();
},
handleAddPlanClose() {
this.showType = 'list'
this.showType = "list";
},
handleClose() {
this.formType = ''
this.showAdd = false
this.showSchedule = false
this.formType = "";
this.showAdd = false;
this.showSchedule = false;
},
handleOk() {
this.handleClose()
this.refreshData()
this.handleClose();
this.refreshData();
},
},
};

Loading…
Cancel
Save