老产品前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

932 lines
25 KiB

3 years ago
<template>
3 years ago
<div>
3 years ago
<div v-if="showType === 'list'"
class="g-cnt">
3 years ago
<el-row :gutter="15">
<el-col :span="6">
<div class="m-sizer">
<div class="item">
3 years ago
<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>
3 years ago
</div>
<div class="item">
3 years ago
<el-radio v-model="fmData.isSelf"
label="1">本人创建的活动</el-radio>
<el-radio v-model="fmData.isSelf"
label="0">本组织所有活动</el-radio>
3 years ago
</div>
3 years ago
</div>
3 years ago
3 years ago
<div class="m-date">
<div class="date-top">
{{ currentDate.year }}{{ currentDate.month + 1 }}
</div>
<div class="date-big">{{ currentDate.date }}</div>
<div class="date-week">{{ currentDate.dayFormat }}</div>
3 years ago
</div>
3 years ago
3 years ago
<div class="m-list"
v-if="
3 years ago
currentDateData.activityList.length > 0 ||
currentDateData.scheduleList.length > 0
3 years ago
">
3 years ago
<div class="list-title">今日活动/日程</div>
<div class="list">
3 years ago
<div class="item"
:key="item.activityId"
v-for="item in currentDateData.activityList">
3 years ago
<div class="item-title">
{{ item.theme }}
</div>
<div class="item-prop">
<span>活动类型</span>
3 years ago
<span>{{ item.actTypeName }}</span>
3 years ago
</div>
<div class="item-prop">
<span>开始时间</span>
<span>{{ item.holdTime }}</span>
</div>
<div class="item-prop">
<span>活动地点</span>
<span>{{ item.address }}</span>
</div>
<div class="item-prop">
<span>参加组织</span>
<span>{{ item.joinOrgs.join("、") }}</span>
</div>
3 years ago
<div v-if="item.isMe"
class="item-ope">
<el-button type="primary"
size="mini"
@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>
3 years ago
</div>
3 years ago
</div>
3 years ago
3 years ago
<div class="item"
:key="item.scheduleId"
v-for="item in currentDateData.scheduleList">
3 years ago
<div class="item-title">
{{ item.title }}
</div>
<div class="item-prop">
<span>提醒时间</span>
<span>{{ item.remindTime }}</span>
</div>
<div class="item-prop">
<span>备注说明</span>
<span>{{ item.remark }}</span>
</div>
<div class="item-ope">
3 years ago
<el-button type="success"
size="mini"
@click="handleClickRicheng('edit', item)">编辑</el-button>
<el-button size="mini"
@click="handleClickRicheng('del', item)">删除</el-button>
3 years ago
</div>
3 years ago
</div>
</div>
3 years ago
</div>
3 years ago
3 years ago
<div class="m-ope">
3 years ago
<el-button type="warning"
style="width: 48%"
@click="addHudong">添加活动计划</el-button>
<el-button style="width: 48%"
@click="addRicheng">添加日程</el-button>
3 years ago
</div>
</el-col>
<el-col :span="18">
<div class="m-cal">
<div class="hd">
<div class="hd-year">
3 years ago
<el-date-picker v-model="currentYearStr"
value-format="yyyy"
type="year"
placeholder="选择年"
size="small"
style="width: 150px">
3 years ago
</el-date-picker>
3 years ago
</div>
3 years ago
<div class="hd-month">
3 years ago
<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]"
:hidden="monthData[m-1] == 0"
class="item">
3 years ago
<div class="month-text">{{ m }}</div>
</el-badge>
</div>
3 years ago
</div>
3 years ago
<div class="hd-btn">
3 years ago
<el-button type="primary"
size="small"
@click="handleAddYearPlan">批量生成年度报表</el-button>
3 years ago
</div>
3 years ago
</div>
3 years ago
<calendar :currentYear="currentYear"
:currentMonth="currentMonth"
@rangeChange="handleRangeChange"
@clickDate="handleChangeDate">
3 years ago
<template v-slot:date-item="{ item, index }">
3 years ago
<div class="tip"
v-if="
3 years ago
rangeData[item.dateId] &&
rangeData[item.dateId].activityList.length > 0
3 years ago
">
<div class="tip-num"
v-if="rangeData[item.dateId].activityList.length > 1">
3 years ago
{{ rangeData[item.dateId].activityList.length }}
</div>
3 years ago
3 years ago
<div class="tip-text">
<span class="z-on">
3 years ago
{{ rangeData[item.dateId].activityList[0].actTypeName }}</span>
3 years ago
{{
3 years ago
rangeData[item.dateId].activityList[0].isPublish==='0'
? "(未发布)"
: "(已发布)"
3 years ago
}}
3 years ago
</div>
<div class="tip-cnt">
{{ rangeData[item.dateId].activityList[0].topic }}
</div>
3 years ago
<div class="all-list"
:class="computeAllListClass(index)">
<div class="item"
:key="item.activityId"
v-for="item in rangeData[item.dateId].activityList">
3 years ago
<div class="item-title">
{{ item.theme }}
</div>
<div class="item-prop">
<span>活动类型</span>
3 years ago
<span>{{ item.actTypeName }}</span>
3 years ago
</div>
<div class="item-prop">
<span>开始时间</span>
<span>{{ item.holdTime }}</span>
</div>
<div class="item-prop">
<span>活动地点</span>
<span>{{ item.address }}</span>
</div>
<div class="item-prop">
<span>参加组织</span>
<span>{{ item.joinOrgs.join("、") }}</span>
</div>
</div>
</div>
</div>
3 years ago
<div class="corn"
v-if="
3 years ago
rangeData[item.dateId] &&
rangeData[item.dateId].scheduleList.length > 0
3 years ago
">
3 years ago
<div class="corn-num">
{{ rangeData[item.dateId].scheduleList.length }}
</div>
<div class="corn-text">日程</div>
3 years ago
<div class="all-list"
:class="computeAllListClass(index)">
<div class="item"
:key="item.scheduleId"
v-for="item in rangeData[item.dateId].scheduleList">
3 years ago
<div class="item-title">
{{ item.title }}
</div>
<div class="item-prop">
<span>提醒时间</span>
<span>{{ item.remindTime }}</span>
</div>
<div class="item-prop">
<span>备注说明</span>
<span>{{ item.remark }}</span>
</div>
</div>
</div>
</div>
3 years ago
</template>
</calendar>
</div>
</el-col>
</el-row>
</div>
3 years ago
<div v-if="showType === 'yearplan'">
3 years ago
<yearplan-list @handleOk="handleAddPlanOk"
@handleClose="handleAddPlanClose"></yearplan-list>
3 years ago
</div>
3 years ago
<el-dialog v-if="showAdd"
:visible.sync="showAdd"
:close-on-click-modal="false"
:close-on-press-escape="false"
:title="addDiaTitle"
width="850px"
top="5vh"
class="dialog-h"
@closed="showAdd = false">
<add-activity ref="ref_add_form"
:formType="formType"
:icPartyActId="icPartyActId"
@handleOk="handleOk"
@handleClose="handleClose"></add-activity>
3 years ago
</el-dialog>
3 years ago
<el-dialog v-if="showSchedule"
:visible.sync="showSchedule"
:close-on-click-modal="false"
:close-on-press-escape="false"
:title="scheduleDiaTitle"
width="850px"
top="5vh"
class="dialog-h"
@closed="showSchedule = false">
<schedule-form ref="ref_schedule_form"
:formType="formType"
:scheduleId="scheduleId"
@handleOk="handleOk"
@handleClose="handleClose">
3 years ago
</schedule-form>
</el-dialog>
3 years ago
</div>
</template>
<script>
import { requestPost, requestGet } from "@/js/dai/request";
import nextTick from "dai-js/tools/nextTick";
import calendar from "./cpts/calendar";
3 years ago
import yearplanList from "../orgActivity/activivityList/yearplanList";
import addActivity from "../orgActivity/activivityList/addActivity";
import scheduleForm from "../orgActivity/activivityList/scheduleForm";
3 years ago
3 years ago
function doAfter (fn) {
return new Promise(async (resolve) => {
while (!fn()) {
await nextTick(100);
}
resolve();
});
}
3 years ago
export default {
name: "party-calendar",
components: {
calendar,
3 years ago
yearplanList,
addActivity,
scheduleForm,
3 years ago
},
3 years ago
data () {
3 years ago
let todayObj = new Date();
return {
currentYearStr: todayObj.getFullYear() + "",
currentMonth: todayObj.getMonth(),
3 years ago
currentDate: {
year: "",
month: "",
date: "",
day: "",
},
currentDateData: {
scheduleList: [],
activityList: [],
},
monthData: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
rangeDateList: [],
3 years ago
rangeData: {},
3 years ago
partyOptions: [],
3 years ago
partyOptionsProps: {
multiple: false,
value: "id",
label: "partyOrgName",
children: "children",
checkStrictly: true,
emitPath: false,
},
3 years ago
fmData: {
3 years ago
orgId: "",
isSelf: "1",
yearId: "",
3 years ago
},
3 years ago
showAdd: false,
3 years ago
formType: "add",
addDiaTitle: "添加活动计划",
3 years ago
showSchedule: false,
3 years ago
scheduleDiaTitle: "添加日程提醒",
showType: "list",
3 years ago
3 years ago
icPartyActId: "",
scheduleId: "",
3 years ago
};
},
computed: {
3 years ago
currentYear () {
3 years ago
return parseInt(this.currentYearStr);
},
3 years ago
apiParams () {
3 years ago
const { currentYear, fmData } = this;
return {
yearId: currentYear,
orgId: fmData.orgId,
isSelf: fmData.isSelf,
};
},
},
watch: {
"fmData.orgId": function (val) {
console.log("orgId", val);
this.getCurrentDateData();
this.getRangeData();
3 years ago
},
"fmData.isSelf": function (val) {
console.log("isSelf", val);
this.getCurrentDateData();
this.getRangeData();
3 years ago
},
currentYear: function (val) {
console.log("watch--currentYear", val);
this.getMonthData();
},
3 years ago
},
3 years ago
async mounted () {
await this.getPartyOptions();
3 years ago
this.getMonthData();
3 years ago
},
methods: {
3 years ago
// 添加活动
3 years ago
addHudong () {
3 years ago
this.icPartyActId = "";
this.addDiaTitle = "新增活动计划";
this.formType = "add";
3 years ago
this.showAdd = true;
},
3 years ago
// 添加日程
3 years ago
addRicheng () {
3 years ago
this.formType = "schedule";
3 years ago
this.scheduleId = ''
3 years ago
this.showSchedule = true;
},
3 years ago
// 点击活动操作
3 years ago
handleClickHuodong (type, item) {
3 years ago
console.log(type, item);
3 years ago
this.icPartyActId = item.activityId;
3 years ago
3 years ago
if (type == "publish") {
// 发布
3 years ago
this.$confirm("确认发布活动?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
3 years ago
type: "warning",
3 years ago
})
.then(() => {
3 years ago
this.publishActivity();
3 years ago
})
3 years ago
.catch((err) => {
3 years ago
if (err == "cancel") {
// this.$message({
// type: "info",
// message: "已取消发布"
// });
}
});
3 years ago
} else if (type == "edit") {
// 编辑
3 years ago
this.addDiaTitle = "修改活动计划";
this.formType = "edit";
this.showAdd = true;
3 years ago
} else if (type == "del") {
// 删除
3 years ago
this.$confirm("活动删除后不可恢复,您确定要删除吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
3 years ago
type: "warning",
3 years ago
})
.then(() => {
3 years ago
this.cancelActivity();
3 years ago
})
3 years ago
.catch((err) => {
if (err == "cancel") {
}
3 years ago
});
}
},
3 years ago
async publishActivity () {
3 years ago
const url = `/resi/partymember/icPartyAct/publish/${this.icPartyActId}`;
const { data, code, msg } = await requestPost(url, {});
if (code === 0) {
this.$message.success("发布成功!");
this.refreshData();
} else {
this.$message.error("操作失败!");
}
},
3 years ago
async cancelActivity () {
3 years ago
const url = "/resi/partymember/icPartyAct/del";
3 years ago
let params = [];
params.push(this.icPartyActId);
3 years ago
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {
this.$message.success("删除成功!");
this.refreshData();
} else {
this.$message.error("操作失败!");
3 years ago
}
},
3 years ago
3 years ago
// 点击日程操作
3 years ago
handleClickRicheng (type, item) {
3 years ago
console.log(type, item);
3 years ago
this.scheduleId = item.scheduleId;
3 years ago
if (type == "edit") {
// 编辑
3 years ago
this.scheduleDiaTitle = "修改日程提醒";
this.formType = "schedule";
3 years ago
this.showSchedule = true;
3 years ago
} else if (type == "del") {
// 删除
3 years ago
this.$confirm("日程提醒删除后不可恢复,您确定要删除吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
3 years ago
type: "warning",
3 years ago
})
.then(() => {
3 years ago
this.cancelSchedule();
3 years ago
})
3 years ago
.catch((err) => {
if (err == "cancel") {
}
3 years ago
});
}
},
3 years ago
async cancelSchedule () {
3 years ago
const url = "/resi/partymember/icSchedule/del";
3 years ago
let params = [];
params.push(this.scheduleId);
3 years ago
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {
this.$message.success("删除成功!");
this.refreshData();
} else {
this.$message.error("操作失败!");
3 years ago
}
},
3 years ago
//刷新日历
3 years ago
refreshData () {
3 years ago
this.getMonthData();
this.getRangeData();
this.getCurrentDateData();
3 years ago
},
3 years ago
handleChangeParty () { },
3 years ago
3 years ago
handleChangeDate (item) {
3 years ago
console.log("handleChangeDate");
this.currentYearStr = item.year + "";
this.currentMonth = item.month;
3 years ago
this.currentDate = { ...item };
this.getCurrentDateData();
},
3 years ago
computeAllListClass (index) {
let x = index % 7;
let y = Math.floor(index / 7);
if (x < 3) {
if (y < 3) {
return "z-top-left";
} else {
return "z-bottom-left";
}
} else {
if (y < 3) {
return "z-top-right";
} else {
return "z-bottom-right";
}
}
},
3 years ago
handleRangeChange (arr) {
this.rangeDateList = arr;
this.getRangeData();
3 years ago
},
3 years ago
async getRangeData () {
const arr = this.rangeDateList;
const url = "/resi/partymember/icPartyAct/homeSearch";
if (!this.apiParams.orgId || arr.length == 0) return;
3 years ago
const { data, code, msg } = await requestPost(url, {
...this.apiParams,
startDate: arr[0].dateId,
endDate: arr[arr.length - 1].dateId,
});
if (code === 0) {
if (Array.isArray(data)) {
let rangeData = {};
3 years ago
arr.forEach((item) => {
rangeData[item.dateId] = {
3 years ago
...item,
scheduleTotal: 0,
activityTotal: 0,
scheduleList: [],
activityList: [],
};
let curr = data.find((val) => val.dateId == item.dateId);
if (curr) {
rangeData[item.dateId].scheduleList = curr.scheduleList;
rangeData[item.dateId].activityList = curr.activityList;
rangeData[item.dateId].scheduleTotal = curr.scheduleTotal;
rangeData[item.dateId].activityTotal = curr.activityTotal;
3 years ago
}
});
this.rangeData = rangeData;
3 years ago
console.log("rangeData", this.rangeData);
}
} else {
this.$message.error(msg);
}
3 years ago
},
3 years ago
async getMonthData () {
const url = "/resi/partymember/icPartyAct/homeMonthTotal";
if (!this.apiParams.orgId) return;
3 years ago
const { data, code, msg } = await requestPost(url, {
...this.apiParams,
});
if (code === 0) {
if (Array.isArray(data)) {
3 years ago
data.forEach((item, index) => {
this.monthData[index] = parseInt(item.count);
3 years ago
});
3 years ago
console.log("--------------monthData", this.monthData);
3 years ago
}
} else {
this.$message.error(msg);
}
},
3 years ago
async getCurrentDateData () {
const url = "/resi/partymember/icPartyAct/actAndScheduleList";
if (!this.apiParams.orgId) return;
3 years ago
const { data, code, msg } = await requestPost(url, {
...this.apiParams,
dateId: this.currentDate.dateId,
});
if (code === 0) {
this.currentDateData.scheduleList = data.scheduleList || [];
this.currentDateData.activityList = data.activityList || [];
} else {
this.$message.error(msg);
}
},
3 years ago
async getPartyOptions () {
3 years ago
const url = "/resi/partymember/icPartyOrg/getSearchTreelist";
let params = {
3 years ago
customerId: localStorage.getItem("customerId"),
agencyId: localStorage.getItem("agencyId"),
3 years ago
};
3 years ago
3 years ago
const { data, code, msg } = await requestGet(url, params);
if (code === 0) {
3 years ago
if (Array.isArray(data) && data.length > 0) {
this.partyOptions = data;
this.fmData.orgId = data[0].id;
}
3 years ago
} else {
}
},
3 years ago
3 years ago
handleAddYearPlan () {
3 years ago
this.showType = "yearplan";
3 years ago
},
3 years ago
handleAddPlanOk () {
3 years ago
this.showType = "list";
this.refreshData();
3 years ago
},
3 years ago
handleAddPlanClose () {
3 years ago
this.showType = "list";
3 years ago
},
3 years ago
handleClose () {
3 years ago
this.formType = "";
this.showAdd = false;
this.showSchedule = false;
3 years ago
},
3 years ago
handleOk () {
3 years ago
this.handleClose();
this.refreshData();
3 years ago
},
3 years ago
},
};
</script>
<style lang="scss" scoped>
3 years ago
@import "@/assets/scss/c/config.scss";
@import "@/assets/scss/c/function.scss";
3 years ago
$blue: #3e8ef7;
$red: #f33;
3 years ago
.g-cnt {
background-color: #ffffff;
padding: 20px;
}
3 years ago
.m-cal {
3 years ago
.hd {
3 years ago
display: flex;
margin-bottom: 20px;
3 years ago
.hd-month {
3 years ago
display: flex;
.month-item {
position: relative;
margin-left: 10px;
/deep/ .el-badge__content {
z-index: 1;
}
&.z-on {
.month-text {
3 years ago
background-color: $blue;
3 years ago
color: #ffffff;
}
}
.month-text {
position: relative;
z-index: 0;
width: 40px;
height: 30px;
text-align: center;
background-color: #eeeeee;
border-radius: 8px;
line-height: 30px;
font-size: 14px;
cursor: pointer;
}
}
}
3 years ago
.hd-btn {
margin-left: auto;
}
3 years ago
}
.all-list {
position: absolute;
z-index: 100;
padding: 0 10px;
width: 300px;
max-height: 200px;
overflow-y: auto;
background-color: rgba(#ffffff, 0.9);
3 years ago
box-shadow: 0 0 10px 3px rgba(#000, 0.1);
text-align: left;
color: #999;
transition: all ease 0.13s;
transform: scale(0);
&.z-top-left {
right: -300px;
top: 0;
}
&.z-top-right {
left: -300px;
top: 0;
}
&.z-bottom-left {
right: -300px;
bottom: 0;
}
&.z-bottom-right {
left: -300px;
bottom: 0;
}
.item {
padding: 10px 0;
border-top: 1px dashed rgba(#000, 0.2);
&:first-child {
border-top: none;
}
}
}
3 years ago
.tip {
position: relative;
margin: 0 3px;
padding: 3px 2px 3px 12px;
line-height: 16px;
box-shadow: 0 0 5px 1px #eee;
background-color: #ffffff;
font-size: 12px;
border-radius: 4px;
cursor: pointer;
color: #999999;
&:hover {
.all-list {
transform: scale(1);
}
}
3 years ago
.tip-num {
position: absolute;
z-index: 10;
top: -7px;
right: -7px;
border-radius: 100%;
width: 14px;
height: 14px;
line-height: 14px;
text-align: center;
font-size: 10px;
text-align: center;
color: #ffffff;
background-color: #f1ba06;
}
3 years ago
.z-on {
3 years ago
color: $red;
3 years ago
}
.tip-text {
@include toe;
text-align: left;
}
.tip-cnt {
@include toe;
text-align: left;
font-size: 10px;
}
&::before {
position: absolute;
content: "";
left: 4px;
top: 0;
bottom: 0;
margin: auto;
display: block;
width: 4px;
height: 4px;
border-radius: 100%;
3 years ago
background-color: $red;
3 years ago
}
}
.corn {
position: absolute;
right: 0;
top: 0;
color: #ffffff;
cursor: pointer;
&:hover {
.all-list {
transform: scale(1);
}
}
3 years ago
.corn-num {
position: absolute;
z-index: 10;
top: -7px;
right: -7px;
border-radius: 100%;
width: 14px;
height: 14px;
line-height: 14px;
text-align: center;
font-size: 10px;
text-align: center;
color: #ffffff;
background-color: #f1ba06;
}
.corn-text {
position: relative;
z-index: 1;
font-size: 12px;
line-height: 18px;
padding-right: 3px;
}
&::before {
content: "";
display: block;
position: absolute;
z-index: 0;
top: 0;
right: 0;
width: 0px;
height: 0;
border-top: 17px solid #f33;
border-right: 25px solid #f33;
border-bottom: 17px solid transparent;
border-left: 25px solid transparent;
}
}
}
3 years ago
.m-sizer {
.item {
margin-bottom: 10px;
}
}
.m-date {
text-align: center;
color: $blue;
line-height: 1.5;
background-color: #f3f4f5;
padding: 20px;
.date-top {
font-size: 24px;
}
.date-big {
font-size: 100px;
}
.date-week {
font-size: 24px;
}
}
.m-list {
margin-top: 20px;
.list-title {
width: 100px;
text-align: center;
line-height: 24px;
background-color: $red;
color: #ffffff;
}
.list {
.item {
border-top: 1px solid #eee;
padding: 10px 0;
line-height: 1.5;
overflow: hidden;
.item-title {
font-weight: bold;
}
.item-prop {
margin: 4px 0;
}
.item-ope {
margin-top: 10px;
float: right;
}
}
}
}
.m-ope {
margin-top: 40px;
display: flex;
justify-content: space-between;
}
3 years ago
</style>