Browse Source

添加农历

feature
dai 3 years ago
parent
commit
53da81fe2f
  1. 1102
      src/js/dai/nongli.js
  2. 41
      src/views/modules/communityParty/calendar/cpts/calendar.vue
  3. 196
      src/views/modules/communityParty/calendar/index.vue

1102
src/js/dai/nongli.js

File diff suppressed because it is too large

41
src/views/modules/communityParty/calendar/cpts/calendar.vue

@ -1,16 +1,19 @@
<template>
<div class="m-calendar">
<div class="top-list">
<div class="top"
<div
class="top"
v-for="(item, index) in top"
:class="{ 'z-weekend': index > 4 }"
:key="item">
:key="item"
>
{{ item }}
</div>
</div>
<!-- 日历号 -->
<div class="date-list">
<div class="date-item"
<div
class="date-item"
:class="{
'z-on': item.format == currentDate,
'z-this-month': item.thisMonth,
@ -20,17 +23,21 @@
}"
v-for="(item, index) in visibleCalendar"
:key="index"
@click="handleClickDate(item)">
@click="handleClickDate(item)"
>
<div class="date">{{ item.date }}</div>
<slot name="date-item"
v-bind:item="item"
v-bind:index="index"></slot>
<div class="nongli">
{{ computeNongliText(item.year, item.month, item.date) }}
</div>
<slot name="date-item" v-bind:item="item" v-bind:index="index"> </slot>
</div>
</div>
</div>
</template>
<script>
import nongli from "@/js/dai/nongli";
export default {
props: {
currentYear: {
@ -120,6 +127,11 @@ export default {
this.init();
},
methods: {
computeNongliText(y, m, d) {
let item = nongli.solar2lunar(y, m, d);
return item.festival || item.lunarFestival || item.Term || item.IDayCn;
},
init() {
if (!this.currentDate) {
this.handleClickDate(
@ -166,7 +178,7 @@ export default {
padding: 20px 0;
font-size: 20px;
font-weight: bold;
background-color: #E6A23C;
background-color: #e6a23c;
text-align: center;
&::after {
@ -223,16 +235,27 @@ export default {
color: #3e8ef7;
}
.nongli{
position: absolute;
z-index: 0;
left: 0;
right: 0;
text-align: center;
}
&.z-on {
z-index: 21;
box-shadow: 0 0 15px 5px #a8cee0;
background:#3E8EF7;
background: #3e8ef7;
.date {
font-size: 30px;
color: #ffffff;
font-weight: bold;
}
.nongli {
color: #ffffff;
}
}
&.z-this-month {

196
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="big"
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>
@ -60,23 +67,33 @@
<span>参加组织</span>
<span>{{ item.joinOrgs.join("、") }}</span>
</div>
<div v-if="item.isMe"
class="item-ope">
<el-button type="primary"
<div v-if="item.isMe" class="item-ope">
<el-button
type="primary"
v-if="item.isPublish === '0'"
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>
@ -93,22 +110,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>
@ -116,54 +140,74 @@
<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="big"
style="width: 100px;">
style="width: 100px"
:editable="false"
:clearable="false"
>
</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="big"
@click="handleAddYearPlan"
style="padding-left:10px; padding-right:10px;">生成年度活动计划</el-button>
style="padding-left: 10px; padding-right: 10px"
>生成年度活动计划</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].actTypeName }}</span>
{{
rangeData[item.dateId].activityList[0].isPublish==='0'
rangeData[item.dateId].activityList[0].actTypeName
}}</span
>
{{
rangeData[item.dateId].activityList[0].isPublish === "0"
? "(未发布)"
: "(已发布)"
}}
@ -172,11 +216,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>
@ -199,21 +244,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>
@ -240,12 +288,15 @@
</div>
<div v-if="showType === 'yearplan'">
<yearplan-list :currentYearStr="currentYearStr"
<yearplan-list
:currentYearStr="currentYearStr"
@handleOk="handleAddPlanOk"
@handleClose="handleAddPlanClose"></yearplan-list>
@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"
@ -253,16 +304,20 @@
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"
:defaultTime="currentDate.dateId"
@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"
@ -270,12 +325,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>
@ -403,7 +461,7 @@ export default {
//
addRicheng() {
this.formType = "schedule";
this.scheduleId = ''
this.scheduleId = "";
this.showSchedule = true;
},
@ -616,7 +674,7 @@ export default {
this.monthData[index] = parseInt(item.count);
});
console.log("--------------monthData", this.monthData);
this.$forceUpdate()
this.$forceUpdate();
}
} else {
this.$message.error(msg);

Loading…
Cancel
Save