Browse Source

日历

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

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

@ -1,25 +1,28 @@
<template> <template>
<div> <div>
<div v-if="showType==='list'" <div v-if="showType === 'list'" class="g-cnt">
class="g-cnt">
<el-row :gutter="15"> <el-row :gutter="15">
<el-col :span="6"> <el-col :span="6">
<div class="m-sizer"> <div class="m-sizer">
<div class="item"> <div class="item">
<el-cascader class="customer_cascader" <el-cascader
ref="myCascader" class="customer_cascader"
size="small" ref="myCascader"
v-model="fmData.orgId" size="small"
:options="partyOptions" v-model="fmData.orgId"
:props="partyOptionsProps" :options="partyOptions"
:show-all-levels="false" :props="partyOptionsProps"
@change="handleChangeParty"></el-cascader> :show-all-levels="false"
@change="handleChangeParty"
></el-cascader>
</div> </div>
<div class="item"> <div class="item">
<el-radio v-model="fmData.isSelf" <el-radio v-model="fmData.isSelf" label="1"
label="1">本人创建的活动</el-radio> >本人创建的活动</el-radio
<el-radio v-model="fmData.isSelf" >
label="0">本组织所有活动</el-radio> <el-radio v-model="fmData.isSelf" label="0"
>本组织所有活动</el-radio
>
</div> </div>
</div> </div>
@ -31,16 +34,20 @@
<div class="date-week">{{ currentDate.dayFormat }}</div> <div class="date-week">{{ currentDate.dayFormat }}</div>
</div> </div>
<div class="m-list" <div
v-if=" class="m-list"
currentDateData.activityList.length > 0 || v-if="
currentDateData.scheduleList.length > 0 currentDateData.activityList.length > 0 ||
"> currentDateData.scheduleList.length > 0
"
>
<div class="list-title">今日活动/日程</div> <div class="list-title">今日活动/日程</div>
<div class="list"> <div class="list">
<div class="item" <div
:key="item.activityId" class="item"
v-for="item in currentDateData.activityList"> :key="item.activityId"
v-for="item in currentDateData.activityList"
>
<div class="item-title"> <div class="item-title">
{{ item.theme }} {{ item.theme }}
</div> </div>
@ -61,20 +68,31 @@
<span>{{ item.joinOrgs.join("、") }}</span> <span>{{ item.joinOrgs.join("、") }}</span>
</div> </div>
<div class="item-ope"> <div class="item-ope">
<el-button type="primary" <el-button
size="mini" type="primary"
@click="handleClickHuodong('publish', item)">发布</el-button> size="mini"
<el-button type="success" @click="handleClickHuodong('publish', item)"
size="mini" >发布</el-button
@click="handleClickHuodong('edit', item)">编辑</el-button> >
<el-button size="mini" <el-button
@click="handleClickHuodong('del', item)">删除</el-button> type="success"
size="mini"
@click="handleClickHuodong('edit', item)"
>编辑</el-button
>
<el-button
size="mini"
@click="handleClickHuodong('del', item)"
>删除</el-button
>
</div> </div>
</div> </div>
<div class="item" <div
:key="item.scheduleId" class="item"
v-for="item in currentDateData.scheduleList"> :key="item.scheduleId"
v-for="item in currentDateData.scheduleList"
>
<div class="item-title"> <div class="item-title">
{{ item.title }} {{ item.title }}
</div> </div>
@ -87,22 +105,29 @@
<span>{{ item.remark }}</span> <span>{{ item.remark }}</span>
</div> </div>
<div class="item-ope"> <div class="item-ope">
<el-button type="success" <el-button
size="mini" type="success"
@click="handleClickRicheng('edit', item)">编辑</el-button> size="mini"
<el-button size="mini" @click="handleClickRicheng('edit', item)"
@click="handleClickRicheng('del', item)">删除</el-button> >编辑</el-button
>
<el-button
size="mini"
@click="handleClickRicheng('del', item)"
>删除</el-button
>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="m-ope"> <div class="m-ope">
<el-button type="warning" <el-button type="warning" style="width: 48%" @click="addHudong"
style="width: 48%" >添加活动计划</el-button
@click="addHudong">添加活动计划</el-button> >
<el-button style="width: 48%" <el-button style="width: 48%" @click="addRicheng"
@click="addRicheng">添加日程</el-button> >添加日程</el-button
>
</div> </div>
</el-col> </el-col>
@ -110,66 +135,83 @@
<div class="m-cal"> <div class="m-cal">
<div class="hd"> <div class="hd">
<div class="hd-year"> <div class="hd-year">
<el-date-picker v-model="currentYearStr" <el-date-picker
value-format="yyyy" v-model="currentYearStr"
type="year" value-format="yyyy"
placeholder="选择年" type="year"
size="small" placeholder="选择年"
style="width: 150px"> size="small"
style="width: 150px"
>
</el-date-picker> </el-date-picker>
</div> </div>
<div class="hd-month"> <div class="hd-month">
<div class="month-item" <div
:class="{ 'z-on': m - 1 == currentMonth }" class="month-item"
:key="'month' + m" :class="{ 'z-on': m - 1 == currentMonth }"
@click="currentMonth = m - 1" :key="'month' + m"
v-for="m in 12"> @click="currentMonth = m - 1"
<el-badge :value="monthData[m - 1]" v-for="m in 12"
:hidden="monthData[m - 1] == 0" >
class="item"> <el-badge
:value="monthData[m-1]"
:hidden="monthData[m-1] == 0"
class="item"
>
<div class="month-text">{{ m }}</div> <div class="month-text">{{ m }}</div>
</el-badge> </el-badge>
</div> </div>
</div> </div>
<div class="hd-btn"> <div class="hd-btn">
<el-button type="primary" <el-button
size="small" type="primary"
@click="handleAddYearPlan">批量生成年度报表</el-button> size="small"
@click="handleAddYearPlan"
>批量生成年度报表</el-button
>
</div> </div>
</div> </div>
<calendar :currentYear="currentYear" <calendar
:currentMonth="currentMonth" :currentYear="currentYear"
@rangeChange="handleRangeChange" :currentMonth="currentMonth"
@clickDate="handleChangeDate"> @rangeChange="handleRangeChange"
@clickDate="handleChangeDate"
>
<template v-slot:date-item="{ item, index }"> <template v-slot:date-item="{ item, index }">
<div class="tip" <div
v-if=" class="tip"
rangeData[item.dateId] && v-if="
rangeData[item.dateId].activityList.length > 0 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 }} {{ rangeData[item.dateId].activityList.length }}
</div> </div>
<div class="tip-text"> <div class="tip-text">
<span class="z-on"> <span class="z-on">
{{ rangeData[item.dateId].activityList[0].type }}</span> {{ rangeData[item.dateId].activityList[0].type }}</span
>
{{ {{
rangeData[item.dateId].activityList[0].isPublicValue rangeData[item.dateId].activityList[0].isPublicValue
? "(已发布)" ? "(已发布)"
: "" : ""
}} }}
</div> </div>
<div class="tip-cnt"> <div class="tip-cnt">
{{ rangeData[item.dateId].activityList[0].topic }} {{ rangeData[item.dateId].activityList[0].topic }}
</div> </div>
<div class="all-list" <div class="all-list" :class="computeAllListClass(index)">
:class="computeAllListClass(index)"> <div
<div class="item" class="item"
:key="item.activityId" :key="item.activityId"
v-for="item in rangeData[item.dateId].activityList"> v-for="item in rangeData[item.dateId].activityList"
>
<div class="item-title"> <div class="item-title">
{{ item.theme }} {{ item.theme }}
</div> </div>
@ -192,21 +234,24 @@
</div> </div>
</div> </div>
</div> </div>
<div class="corn" <div
v-if=" class="corn"
rangeData[item.dateId] && v-if="
rangeData[item.dateId].scheduleList.length > 0 rangeData[item.dateId] &&
"> rangeData[item.dateId].scheduleList.length > 0
"
>
<div class="corn-num"> <div class="corn-num">
{{ rangeData[item.dateId].scheduleList.length }} {{ rangeData[item.dateId].scheduleList.length }}
</div> </div>
<div class="corn-text">日程</div> <div class="corn-text">日程</div>
<div class="all-list" <div class="all-list" :class="computeAllListClass(index)">
:class="computeAllListClass(index)"> <div
<div class="item" class="item"
:key="item.scheduleId" :key="item.scheduleId"
v-for="item in rangeData[item.dateId].scheduleList"> v-for="item in rangeData[item.dateId].scheduleList"
>
<div class="item-title"> <div class="item-title">
{{ item.title }} {{ item.title }}
</div> </div>
@ -226,44 +271,53 @@
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
<div v-if="showType==='yearplan'"> <div v-if="showType === 'yearplan'">
<yearplan-list @handleOk="handleAddPlanOk" <yearplan-list
@handleClose="handleAddPlanClose"></yearplan-list> @handleOk="handleAddPlanOk"
@handleClose="handleAddPlanClose"
></yearplan-list>
</div> </div>
<el-dialog v-if="showAdd" <el-dialog
:visible.sync="showAdd" v-if="showAdd"
:close-on-click-modal="false" :visible.sync="showAdd"
:close-on-press-escape="false" :close-on-click-modal="false"
:title="addDiaTitle" :close-on-press-escape="false"
width="850px" :title="addDiaTitle"
top="5vh" width="850px"
class="dialog-h" top="5vh"
@closed="showAdd = false"> class="dialog-h"
<add-activity ref="ref_add_form" @closed="showAdd = false"
:formType="formType" >
:icPartyActId="icPartyActId" <add-activity
@handleOk="handleOk" ref="ref_add_form"
@handleClose="handleClose"></add-activity> :formType="formType"
:icPartyActId="icPartyActId"
@handleOk="handleOk"
@handleClose="handleClose"
></add-activity>
</el-dialog> </el-dialog>
<el-dialog v-if="showSchedule" <el-dialog
:visible.sync="showSchedule" v-if="showSchedule"
:close-on-click-modal="false" :visible.sync="showSchedule"
:close-on-press-escape="false" :close-on-click-modal="false"
:title="scheduleDiaTitle" :close-on-press-escape="false"
width="850px" :title="scheduleDiaTitle"
top="5vh" width="850px"
class="dialog-h" top="5vh"
@closed="showSchedule = false"> class="dialog-h"
<schedule-form ref="ref_schedule_form" @closed="showSchedule = false"
:formType="formType" >
:scheduleId="scheduleId" <schedule-form
@handleOk="handleOk" ref="ref_schedule_form"
@handleClose="handleClose"> :formType="formType"
:scheduleId="scheduleId"
@handleOk="handleOk"
@handleClose="handleClose"
>
</schedule-form> </schedule-form>
</el-dialog> </el-dialog>
</div> </div>
@ -277,7 +331,7 @@ import yearplanList from "../orgActivity/activivityList/yearplanList";
import addActivity from "../orgActivity/activivityList/addActivity"; import addActivity from "../orgActivity/activivityList/addActivity";
import scheduleForm from "../orgActivity/activivityList/scheduleForm"; import scheduleForm from "../orgActivity/activivityList/scheduleForm";
function doAfter (fn) { function doAfter(fn) {
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
while (!fn()) { while (!fn()) {
await nextTick(100); await nextTick(100);
@ -294,7 +348,7 @@ export default {
addActivity, addActivity,
scheduleForm, scheduleForm,
}, },
data () { data() {
let todayObj = new Date(); let todayObj = new Date();
return { return {
@ -334,21 +388,21 @@ export default {
}, },
showAdd: false, showAdd: false,
formType: 'add', formType: "add",
addDiaTitle: '添加活动计划', addDiaTitle: "添加活动计划",
showSchedule: false, showSchedule: false,
scheduleDiaTitle: '添加日程提醒', scheduleDiaTitle: "添加日程提醒",
showType: 'list', showType: "list",
icPartyActId: '', icPartyActId: "",
scheduleId: '', scheduleId: "",
}; };
}, },
computed: { computed: {
currentYear () { currentYear() {
return parseInt(this.currentYearStr); return parseInt(this.currentYearStr);
}, },
apiParams () { apiParams() {
const { currentYear, fmData } = this; const { currentYear, fmData } = this;
return { return {
yearId: currentYear, yearId: currentYear,
@ -373,73 +427,71 @@ export default {
this.getMonthData(); this.getMonthData();
}, },
}, },
async mounted () { async mounted() {
await this.getPartyOptions(); await this.getPartyOptions();
this.getMonthData(); this.getMonthData();
}, },
methods: { methods: {
// //
addHudong () { addHudong() {
this.icPartyActId = '' this.icPartyActId = "";
this.addDiaTitle = '新增活动计划' this.addDiaTitle = "新增活动计划";
this.formType = 'add' this.formType = "add";
this.showAdd = true; this.showAdd = true;
}, },
// //
addRicheng () { addRicheng() {
this.formType = 'schedule' this.formType = "schedule";
this.showSchedule = true; this.showSchedule = true;
}, },
// //
handleClickHuodong (type, item) { handleClickHuodong(type, item) {
console.log(type, item); console.log(type, item);
this.icPartyActId = item.activityId this.icPartyActId = item.activityId;
if (type == "publish") { if (type == "publish") {
// //
this.$confirm("确认发布活动?", "提示", { this.$confirm("确认发布活动?", "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning",
}) })
.then(() => { .then(() => {
this.publishActivity() this.publishActivity();
}) })
.catch(err => { .catch((err) => {
if (err == "cancel") { if (err == "cancel") {
// this.$message({ // this.$message({
// type: "info", // type: "info",
// message: "" // message: ""
// }); // });
} }
}); });
} else if (type == "edit") { } else if (type == "edit") {
// //
this.addDiaTitle = '修改活动计划' this.addDiaTitle = "修改活动计划";
this.formType = 'edit' this.formType = "edit";
this.showAdd = true this.showAdd = true;
} else if (type == "del") { } else if (type == "del") {
// //
this.$confirm("活动删除后不可恢复,您确定要删除吗?", "提示", { this.$confirm("活动删除后不可恢复,您确定要删除吗?", "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning",
}) })
.then(() => { .then(() => {
this.cancelActivity() this.cancelActivity();
}) })
.catch(err => { .catch((err) => {
if (err == "cancel") { } if (err == "cancel") {
}
}); });
} }
}, },
async publishActivity () { async publishActivity() {
const url = `/resi/partymember/icPartyAct/publish/${this.icPartyActId}`; const url = `/resi/partymember/icPartyAct/publish/${this.icPartyActId}`;
const { data, code, msg } = await requestPost(url, {}); const { data, code, msg } = await requestPost(url, {});
@ -452,11 +504,11 @@ export default {
} }
}, },
async cancelActivity () { async cancelActivity() {
const url = "/resi/partymember/icPartyAct/del"; const url = "/resi/partymember/icPartyAct/del";
let params = [] let params = [];
params.push(this.icPartyActId) params.push(this.icPartyActId);
const { data, code, msg } = await requestPost(url, params); const { data, code, msg } = await requestPost(url, params);
@ -469,36 +521,36 @@ export default {
}, },
// //
handleClickRicheng (type, item) { handleClickRicheng(type, item) {
console.log(type, item); console.log(type, item);
this.scheduleId = item.scheduleId this.scheduleId = item.scheduleId;
if (type == "edit") { if (type == "edit") {
// //
this.scheduleDiaTitle = '修改日程提醒' this.scheduleDiaTitle = "修改日程提醒";
this.formType = 'schedule' this.formType = "schedule";
this.showSchedule = true; this.showSchedule = true;
} else if (type == "del") { } else if (type == "del") {
// //
this.$confirm("日程提醒删除后不可恢复,您确定要删除吗?", "提示", { this.$confirm("日程提醒删除后不可恢复,您确定要删除吗?", "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning",
}) })
.then(() => { .then(() => {
this.cancelSchedule() this.cancelSchedule();
}) })
.catch(err => { .catch((err) => {
if (err == "cancel") { } if (err == "cancel") {
}
}); });
} }
}, },
async cancelSchedule () { async cancelSchedule() {
const url = "/resi/partymember/icSchedule/del"; const url = "/resi/partymember/icSchedule/del";
let params = [] let params = [];
params.push(this.scheduleId) params.push(this.scheduleId);
const { data, code, msg } = await requestPost(url, params); const { data, code, msg } = await requestPost(url, params);
@ -511,13 +563,15 @@ export default {
}, },
// //
refreshData () { refreshData() {
this.getMonthData();
this.getRangeData();
this.getCurrentDateData();
}, },
handleChangeParty () { }, handleChangeParty() {},
handleChangeDate (item) { handleChangeDate(item) {
console.log("handleChangeDate"); console.log("handleChangeDate");
this.currentYearStr = item.year + ""; this.currentYearStr = item.year + "";
this.currentMonth = item.month; this.currentMonth = item.month;
@ -526,7 +580,7 @@ export default {
this.getCurrentDateData(); this.getCurrentDateData();
}, },
computeAllListClass (index) { computeAllListClass(index) {
let x = index % 7; let x = index % 7;
let y = Math.floor(index / 7); let y = Math.floor(index / 7);
if (x < 3) { if (x < 3) {
@ -544,12 +598,12 @@ export default {
} }
}, },
handleRangeChange (arr) { handleRangeChange(arr) {
this.rangeDateList = arr; this.rangeDateList = arr;
this.getRangeData(); this.getRangeData();
}, },
async getRangeData () { async getRangeData() {
const arr = this.rangeDateList; const arr = this.rangeDateList;
const url = "/resi/partymember/icPartyAct/homeSearch"; const url = "/resi/partymember/icPartyAct/homeSearch";
@ -587,7 +641,7 @@ export default {
} }
}, },
async getMonthData () { async getMonthData() {
const url = "/resi/partymember/icPartyAct/homeMonthTotal"; const url = "/resi/partymember/icPartyAct/homeMonthTotal";
if (!this.apiParams.orgId) return; if (!this.apiParams.orgId) return;
@ -597,17 +651,17 @@ export default {
}); });
if (code === 0) { if (code === 0) {
if (Array.isArray(data)) { if (Array.isArray(data)) {
data.forEach((item) => { data.forEach((item, index) => {
this.monthData[item.monthId - 1] = item.count; this.monthData[index] = parseInt(item.count);
}); });
console.log(this.monthData); console.log("--------------monthData", this.monthData);
} }
} else { } else {
this.$message.error(msg); this.$message.error(msg);
} }
}, },
async getCurrentDateData () { async getCurrentDateData() {
const url = "/resi/partymember/icPartyAct/actAndScheduleList"; const url = "/resi/partymember/icPartyAct/actAndScheduleList";
if (!this.apiParams.orgId) return; if (!this.apiParams.orgId) return;
@ -624,7 +678,7 @@ export default {
} }
}, },
async getPartyOptions () { async getPartyOptions() {
const url = "/resi/partymember/icPartyOrg/getSearchTreelist"; const url = "/resi/partymember/icPartyOrg/getSearchTreelist";
let params = { let params = {
customerId: localStorage.getItem("customerId"), customerId: localStorage.getItem("customerId"),
@ -641,27 +695,27 @@ export default {
} }
}, },
handleAddYearPlan () { handleAddYearPlan() {
this.showType = 'yearplan' this.showType = "yearplan";
}, },
handleAddPlanOk () { handleAddPlanOk() {
this.showType = 'list' this.showType = "list";
this.refreshData() this.refreshData();
}, },
handleAddPlanClose () { handleAddPlanClose() {
this.showType = 'list' this.showType = "list";
}, },
handleClose () { handleClose() {
this.formType = '' this.formType = "";
this.showAdd = false this.showAdd = false;
this.showSchedule = false this.showSchedule = false;
}, },
handleOk () { handleOk() {
this.handleClose() this.handleClose();
this.refreshData() this.refreshData();
}, },
}, },
}; };

Loading…
Cancel
Save