Merge branch 'master' of http://yun.pashanhoo.com:9090/bdc/bdcdj-web
Showing
32 changed files
with
574 additions
and
1926 deletions
... | @@ -67,3 +67,12 @@ export function getSlsqBdcqzList (params) { | ... | @@ -67,3 +67,12 @@ export function getSlsqBdcqzList (params) { |
67 | params | 67 | params |
68 | }) | 68 | }) |
69 | } | 69 | } |
70 | |||
71 | // 证书预览 | ||
72 | export function bdcqzPreview (data) { | ||
73 | return request({ | ||
74 | url: SERVER.SERVERAPI + '/rest/ywbl/bdcqz/bdcqzPreview', | ||
75 | method: 'post', | ||
76 | data | ||
77 | }) | ||
78 | } | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -97,7 +97,7 @@ export function stepExpandInfo (data) { | ... | @@ -97,7 +97,7 @@ export function stepExpandInfo (data) { |
97 | // 获取审批意见 | 97 | // 获取审批意见 |
98 | export function getSpyjList (data) { | 98 | export function getSpyjList (data) { |
99 | return request({ | 99 | return request({ |
100 | url: SERVER.SERVERAPI + '/rest/business/workFlow/getSpyjList', | 100 | url: SERVER.SERVERAPI + '/rest/ywbl/opinion/getSpyjList', |
101 | method: 'post', | 101 | method: 'post', |
102 | data | 102 | data |
103 | }) | 103 | }) |
... | @@ -106,7 +106,7 @@ export function getSpyjList (data) { | ... | @@ -106,7 +106,7 @@ export function getSpyjList (data) { |
106 | // 保存审批意见 | 106 | // 保存审批意见 |
107 | export function saveSpyj (data) { | 107 | export function saveSpyj (data) { |
108 | return request({ | 108 | return request({ |
109 | url: SERVER.SERVERAPI + '/rest/business/workFlow/saveSpyj', | 109 | url: SERVER.SERVERAPI + '/rest/ywbl/opinion/saveSpyj', |
110 | method: 'post', | 110 | method: 'post', |
111 | data | 111 | data |
112 | }) | 112 | }) |
... | @@ -114,7 +114,7 @@ export function saveSpyj (data) { | ... | @@ -114,7 +114,7 @@ export function saveSpyj (data) { |
114 | // 根据受理申请保存审批意见 | 114 | // 根据受理申请保存审批意见 |
115 | export function saveSpyjBySlsq (data) { | 115 | export function saveSpyjBySlsq (data) { |
116 | return request({ | 116 | return request({ |
117 | url: SERVER.SERVERAPI + '/rest/business/workFlow/saveSpyjBySlsq', | 117 | url: SERVER.SERVERAPI + '/rest/ywbl/opinion/saveSpyjBySlsq', |
118 | method: 'post', | 118 | method: 'post', |
119 | data | 119 | data |
120 | }) | 120 | }) |
... | @@ -127,62 +127,7 @@ export function record (data) { | ... | @@ -127,62 +127,7 @@ export function record (data) { |
127 | data | 127 | data |
128 | }) | 128 | }) |
129 | } | 129 | } |
130 | // 获取不动产权证列表 | 130 | |
131 | export function getBdcqzList (params) { | ||
132 | return request({ | ||
133 | url: SERVER.SERVERAPI + '/rest/business/workFlow/getBdcqzList', | ||
134 | method: 'get', | ||
135 | params: params | ||
136 | }) | ||
137 | } | ||
138 | // 获取印刷序列号 | ||
139 | export function readYsxlh (params) { | ||
140 | return request({ | ||
141 | url: SERVER.SERVERAPI + '/rest/business/workFlow/readYsxlh', | ||
142 | method: 'get', | ||
143 | params: params | ||
144 | }) | ||
145 | } | ||
146 | // 缮证 | ||
147 | export function certificate (data) { | ||
148 | return request({ | ||
149 | url: SERVER.SERVERAPI + '/rest/business/workFlow/certificate', | ||
150 | method: 'post', | ||
151 | data | ||
152 | }) | ||
153 | } | ||
154 | // 作废缮证信息 | ||
155 | export function invalidCertificate (data) { | ||
156 | return request({ | ||
157 | url: SERVER.SERVERAPI + '/rest/business/workFlow/invalidCertificate', | ||
158 | method: 'post', | ||
159 | data | ||
160 | }) | ||
161 | } | ||
162 | // 缮证列表 | ||
163 | export function getCertificateList (data) { | ||
164 | return request({ | ||
165 | url: SERVER.SERVERAPI + '/rest/business/workFlow/getCertificateList', | ||
166 | method: 'post', | ||
167 | data | ||
168 | }) | ||
169 | } | ||
170 | // 发证 | ||
171 | export function issueCertificate (data) { | ||
172 | return request({ | ||
173 | url: SERVER.SERVERAPI + '/rest/business/workFlow/issueCertificate', | ||
174 | method: 'post', | ||
175 | data | ||
176 | }) | ||
177 | } | ||
178 | // 获取受理申请下全部不动产权证 | ||
179 | export function getSlsqBdcqzList (params) { | ||
180 | return request({ | ||
181 | url: SERVER.SERVERAPI + '/rest/business/workFlow/getSlsqBdcqzList', | ||
182 | method: 'get', | ||
183 | params | ||
184 | }) | ||
185 | } | ||
186 | // 终止任务 | 131 | // 终止任务 |
187 | export function stopTask (data) { | 132 | export function stopTask (data) { |
188 | return request({ | 133 | return request({ | ... | ... |
... | @@ -24,3 +24,20 @@ export function getHomeDoneList () { | ... | @@ -24,3 +24,20 @@ export function getHomeDoneList () { |
24 | method: 'get' | 24 | method: 'get' |
25 | }) | 25 | }) |
26 | } | 26 | } |
27 | |||
28 | //获取首页常办项目 | ||
29 | export function getHomeFrequentProjects () { | ||
30 | return request({ | ||
31 | url: SERVER.SERVERAPI + '/rest/workBench/getHomeFrequentProjects', | ||
32 | method: 'get' | ||
33 | }) | ||
34 | } | ||
35 | |||
36 | //保存常办项目 | ||
37 | export function saveFrequentProjectsList (data) { | ||
38 | return request({ | ||
39 | url: SERVER.SERVERAPI + '/rest/workBench/saveFrequentProjectsList', | ||
40 | method: 'post', | ||
41 | data | ||
42 | }) | ||
43 | } | ... | ... |
... | @@ -72,3 +72,11 @@ export function setReadStatus (params) { | ... | @@ -72,3 +72,11 @@ export function setReadStatus (params) { |
72 | params: params | 72 | params: params |
73 | }) | 73 | }) |
74 | } | 74 | } |
75 | |||
76 | //一键设置已读 | ||
77 | export function setAllRead () { | ||
78 | return request({ | ||
79 | url: SERVER.SERVERAPI + '/rest/system/sysNotice/setAllRead', | ||
80 | method: 'get' | ||
81 | }) | ||
82 | } | ... | ... |
... | @@ -2,18 +2,6 @@ import request from '@/utils/request' | ... | @@ -2,18 +2,6 @@ import request from '@/utils/request' |
2 | import SERVER from './config' | 2 | import SERVER from './config' |
3 | 3 | ||
4 | /* | 4 | /* |
5 | 业务办理-选择单元-查询宗地基本信息 | ||
6 | */ | ||
7 | export function selectZdjbxx (data) { | ||
8 | return request({ | ||
9 | url: SERVER.SERVERAPI + '/rest/ywbl/ywsq/selectZdjbxx', | ||
10 | method: 'post', | ||
11 | data | ||
12 | }) | ||
13 | } | ||
14 | |||
15 | |||
16 | /* | ||
17 | 业务办理-选择单元-查询建设用地、宅基地信息 | 5 | 业务办理-选择单元-查询建设用地、宅基地信息 |
18 | */ | 6 | */ |
19 | export function selectJsydQlxx (data) { | 7 | export function selectJsydQlxx (data) { |
... | @@ -24,29 +12,6 @@ export function selectJsydQlxx (data) { | ... | @@ -24,29 +12,6 @@ export function selectJsydQlxx (data) { |
24 | }) | 12 | }) |
25 | } | 13 | } |
26 | 14 | ||
27 | /* | ||
28 | 业务办理-选择单元-查询自然幢信息 | ||
29 | */ | ||
30 | export function selectZrz (data) { | ||
31 | return request({ | ||
32 | url: SERVER.SERVERAPI + '/rest/ywbl/ywsq/selectZrz', | ||
33 | method: 'post', | ||
34 | data | ||
35 | }) | ||
36 | } | ||
37 | |||
38 | /* | ||
39 | 业务办理-选择单元-查询户信息 | ||
40 | */ | ||
41 | export function selectH (data) { | ||
42 | return request({ | ||
43 | url: SERVER.SERVERAPI + '/rest/ywbl/ywsq/selectH', | ||
44 | method: 'post', | ||
45 | data | ||
46 | }) | ||
47 | } | ||
48 | |||
49 | |||
50 | // 获取自然幢下其他户 | 15 | // 获取自然幢下其他户 |
51 | export function selectOtherH (data) { | 16 | export function selectOtherH (data) { |
52 | return request({ | 17 | return request({ |
... | @@ -67,17 +32,6 @@ export function selectOtherH (data) { | ... | @@ -67,17 +32,6 @@ export function selectOtherH (data) { |
67 | // showLoading: true | 32 | // showLoading: true |
68 | // }) | 33 | // }) |
69 | // } | 34 | // } |
70 | |||
71 | /* | ||
72 | 业务办理-选择权利信息-根据条件进行列表查询 | ||
73 | */ | ||
74 | export function selectQlxx (data) { | ||
75 | return request({ | ||
76 | url: SERVER.SERVERAPI + '/rest/ywbl/ywsq/selectQlxx', | ||
77 | method: 'post', | ||
78 | data | ||
79 | }) | ||
80 | } | ||
81 | /* | 35 | /* |
82 | 业务办理-选择抵押权信息-根据条件进行列表查询 | 36 | 业务办理-选择抵押权信息-根据条件进行列表查询 |
83 | */ | 37 | */ |
... | @@ -117,11 +71,3 @@ export function choiceBdcdy (data) { | ... | @@ -117,11 +71,3 @@ export function choiceBdcdy (data) { |
117 | }) | 71 | }) |
118 | } | 72 | } |
119 | 73 | ||
120 | // 业务办理-选择农用地信息-根据条件进行列表查询 | ||
121 | export function selectNydsyqQlxx (data) { | ||
122 | return request({ | ||
123 | url: SERVER.SERVERAPI + '/rest/ywbl/ywsq/selectNydsyqQlxx', | ||
124 | method: 'post', | ||
125 | data | ||
126 | }) | ||
127 | } | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -164,7 +164,7 @@ export function selectOtherH (data) { | ... | @@ -164,7 +164,7 @@ export function selectOtherH (data) { |
164 | } | 164 | } |
165 | 165 | ||
166 | // 认领任务 | 166 | // 认领任务 |
167 | export function claimTask (bsmSlsq,bestepid) { | 167 | export function claimTask (bsmSlsq, bestepid) { |
168 | return request({ | 168 | return request({ |
169 | url: SERVER.SERVERAPI + '/rest/business/workFlow/claimTask?bsmSlsq=' + bsmSlsq + '&bestepid=' + bestepid, | 169 | url: SERVER.SERVERAPI + '/rest/business/workFlow/claimTask?bsmSlsq=' + bsmSlsq + '&bestepid=' + bestepid, |
170 | method: 'get', | 170 | method: 'get', |
... | @@ -172,9 +172,50 @@ export function claimTask (bsmSlsq,bestepid) { | ... | @@ -172,9 +172,50 @@ export function claimTask (bsmSlsq,bestepid) { |
172 | } | 172 | } |
173 | 173 | ||
174 | // 取消认领任务 | 174 | // 取消认领任务 |
175 | export function unClaimTask (bsmSlsq,bestepid) { | 175 | export function unClaimTask (bsmSlsq, bestepid) { |
176 | return request({ | 176 | return request({ |
177 | url: SERVER.SERVERAPI + '/rest/business/workFlow/unClaimTask?bsmSlsq=' + bsmSlsq + '&bestepid=' + bestepid, | 177 | url: SERVER.SERVERAPI + '/rest/business/workFlow/unClaimTask?bsmSlsq=' + bsmSlsq + '&bestepid=' + bestepid, |
178 | method: 'get', | 178 | method: 'get', |
179 | }) | 179 | }) |
180 | } | 180 | } |
181 | |||
182 | // 业务办理-选择农用地信息-根据条件进行列表查询 | ||
183 | export function selectNydsyqQlxx (data) { | ||
184 | return request({ | ||
185 | url: SERVER.SERVERAPI + '/rest/ywbl/ywsq/selectNydsyqQlxx', | ||
186 | method: 'post', | ||
187 | data | ||
188 | }) | ||
189 | } | ||
190 | |||
191 | /* | ||
192 | 业务办理-选择单元-查询宗地基本信息 | ||
193 | */ | ||
194 | export function selectZdjbxx (data) { | ||
195 | return request({ | ||
196 | url: SERVER.SERVERAPI + '/rest/ywbl/ywsq/selectZdjbxx', | ||
197 | method: 'post', | ||
198 | data | ||
199 | }) | ||
200 | } | ||
201 | /* | ||
202 | 业务办理-选择单元-查询自然幢信息 | ||
203 | */ | ||
204 | export function selectZrz (data) { | ||
205 | return request({ | ||
206 | url: SERVER.SERVERAPI + '/rest/ywbl/ywsq/selectZrz', | ||
207 | method: 'post', | ||
208 | data | ||
209 | }) | ||
210 | } | ||
211 | |||
212 | /* | ||
213 | 业务办理-选择单元-查询户信息 | ||
214 | */ | ||
215 | export function selectH (data) { | ||
216 | return request({ | ||
217 | url: SERVER.SERVERAPI + '/rest/ywbl/ywsq/selectH', | ||
218 | method: 'post', | ||
219 | data | ||
220 | }) | ||
221 | } | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
src/components/Calendar/calendar.js
deleted
100644 → 0
1 | /** | ||
2 | * @1900-2100区间内的公历、农历互转 | ||
3 | * @charset UTF-8 | ||
4 | * @Author Jea杨(JJonline@JJonline.Cn) | ||
5 | * @Time 2014-7-21 | ||
6 | * @Time 2016-8-13 Fixed 2033hex、Attribution Annals | ||
7 | * @Time 2016-9-25 Fixed lunar LeapMonth Param Bug | ||
8 | * @Time 2017-7-24 Fixed use getTerm Func Param Error.use solar year,NOT lunar year | ||
9 | * @Version 1.0.3 | ||
10 | * @公历转农历:calendar.solar2lunar(1987,11,01); //[you can ignore params of prefix 0] | ||
11 | * @农历转公历:calendar.lunar2solar(1987,09,10); //[you can ignore params of prefix 0] | ||
12 | */ | ||
13 | const calendar = { | ||
14 | |||
15 | /** | ||
16 | * 农历1900-2100的润大小信息表 | ||
17 | * @Array Of Property | ||
18 | * @return Hex | ||
19 | */ | ||
20 | lunarInfo: [0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0, 0x055d2,//1900-1909 | ||
21 | 0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x095b0, 0x14977,//1910-1919 | ||
22 | 0x04970, 0x0a4b0, 0x0b4b5, 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970,//1920-1929 | ||
23 | 0x06566, 0x0d4a0, 0x0ea50, 0x16a95, 0x05ad0, 0x02b60, 0x186e3, 0x092e0, 0x1c8d7, 0x0c950,//1930-1939 | ||
24 | 0x0d4a0, 0x1d8a6, 0x0b550, 0x056a0, 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, 0x0b557,//1940-1949 | ||
25 | 0x06ca0, 0x0b550, 0x15355, 0x04da0, 0x0a5b0, 0x14573, 0x052b0, 0x0a9a8, 0x0e950, 0x06aa0,//1950-1959 | ||
26 | 0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570, 0x05260, 0x0f263, 0x0d950, 0x05b57, 0x056a0,//1960-1969 | ||
27 | 0x096d0, 0x04dd5, 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b6a0, 0x195a6,//1970-1979 | ||
28 | 0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, 0x06d40, 0x0af46, 0x0ab60, 0x09570,//1980-1989 | ||
29 | 0x04af5, 0x04970, 0x064b0, 0x074a3, 0x0ea50, 0x06b58, 0x05ac0, 0x0ab60, 0x096d5, 0x092e0,//1990-1999 | ||
30 | 0x0c960, 0x0d954, 0x0d4a0, 0x0da50, 0x07552, 0x056a0, 0x0abb7, 0x025d0, 0x092d0, 0x0cab5,//2000-2009 | ||
31 | 0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50, 0x055d9, 0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930,//2010-2019 | ||
32 | 0x07954, 0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0, 0x0d260, 0x0ea65, 0x0d530,//2020-2029 | ||
33 | 0x05aa0, 0x076a3, 0x096d0, 0x04afb, 0x04ad0, 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520, 0x0dd45,//2030-2039 | ||
34 | 0x0b5a0, 0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, 0x0ada0,//2040-2049 | ||
35 | /**Add By JJonline@JJonline.Cn**/ | ||
36 | 0x14b63, 0x09370, 0x049f8, 0x04970, 0x064b0, 0x168a6, 0x0ea50, 0x06b20, 0x1a6c4, 0x0aae0,//2050-2059 | ||
37 | 0x092e0, 0x0d2e3, 0x0c960, 0x0d557, 0x0d4a0, 0x0da50, 0x05d55, 0x056a0, 0x0a6d0, 0x055d4,//2060-2069 | ||
38 | 0x052d0, 0x0a9b8, 0x0a950, 0x0b4a0, 0x0b6a6, 0x0ad50, 0x055a0, 0x0aba4, 0x0a5b0, 0x052b0,//2070-2079 | ||
39 | 0x0b273, 0x06930, 0x07337, 0x06aa0, 0x0ad50, 0x14b55, 0x04b60, 0x0a570, 0x054e4, 0x0d160,//2080-2089 | ||
40 | 0x0e968, 0x0d520, 0x0daa0, 0x16aa6, 0x056d0, 0x04ae0, 0x0a9d4, 0x0a2d0, 0x0d150, 0x0f252,//2090-2099 | ||
41 | 0x0d520],//2100 | ||
42 | |||
43 | /** | ||
44 | * 公历每个月份的天数普通表 | ||
45 | * @Array Of Property | ||
46 | * @return Number | ||
47 | */ | ||
48 | solarMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], | ||
49 | |||
50 | /** | ||
51 | * 天干地支之天干速查表 | ||
52 | * @Array Of Property trans["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"] | ||
53 | * @return Cn string | ||
54 | */ | ||
55 | Gan: ["\u7532", "\u4e59", "\u4e19", "\u4e01", "\u620a", "\u5df1", "\u5e9a", "\u8f9b", "\u58ec", "\u7678"], | ||
56 | |||
57 | /** | ||
58 | * 天干地支之地支速查表 | ||
59 | * @Array Of Property | ||
60 | * @trans["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"] | ||
61 | * @return Cn string | ||
62 | */ | ||
63 | Zhi: ["\u5b50", "\u4e11", "\u5bc5", "\u536f", "\u8fb0", "\u5df3", "\u5348", "\u672a", "\u7533", "\u9149", "\u620c", "\u4ea5"], | ||
64 | |||
65 | /** | ||
66 | * 天干地支之地支速查表<=>生肖 | ||
67 | * @Array Of Property | ||
68 | * @trans["鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪"] | ||
69 | * @return Cn string | ||
70 | */ | ||
71 | Animals: ["\u9f20", "\u725b", "\u864e", "\u5154", "\u9f99", "\u86c7", "\u9a6c", "\u7f8a", "\u7334", "\u9e21", "\u72d7", "\u732a"], | ||
72 | |||
73 | /** | ||
74 | * 阳历节日 | ||
75 | */ | ||
76 | festival: { | ||
77 | '1-1': { title: '元旦节' }, | ||
78 | '2-14': { title: '情人节' }, | ||
79 | '5-1': { title: '劳动节' }, | ||
80 | '5-4': { title: '青年节' }, | ||
81 | '6-1': { title: '儿童节' }, | ||
82 | '9-10': { title: '教师节' }, | ||
83 | '10-1': { title: '国庆节' }, | ||
84 | '12-25': { title: '圣诞节' }, | ||
85 | |||
86 | '3-8': { title: '妇女节' }, | ||
87 | '3-12': { title: '植树节' }, | ||
88 | '4-1': { title: '愚人节' }, | ||
89 | '5-12': { title: '护士节' }, | ||
90 | '7-1': { title: '建党节' }, | ||
91 | '8-1': { title: '建军节' }, | ||
92 | '12-24': { title: '平安夜' }, | ||
93 | }, | ||
94 | |||
95 | /** | ||
96 | * 农历节日 | ||
97 | */ | ||
98 | lFestival: { | ||
99 | '12-30': { title: '除夕' }, | ||
100 | '1-1': { title: '春节' }, | ||
101 | '1-15': { title: '元宵节' }, | ||
102 | '2-2': { title: '龙抬头' }, | ||
103 | '5-5': { title: '端午节' }, | ||
104 | '7-7': { title: '七夕节' }, | ||
105 | '7-15': { title: '中元节' }, | ||
106 | '8-15': { title: '中秋节' }, | ||
107 | '9-9': { title: '重阳节' }, | ||
108 | '10-1': { title: '寒衣节' }, | ||
109 | '10-15': { title: '下元节' }, | ||
110 | '12-8': { title: '腊八节' }, | ||
111 | '12-23': { title: '北方小年' }, | ||
112 | '12-24': { title: '南方小年' }, | ||
113 | }, | ||
114 | |||
115 | /** | ||
116 | * 返回默认定义的阳历节日 | ||
117 | */ | ||
118 | getFestival () { | ||
119 | return this.festival | ||
120 | }, | ||
121 | |||
122 | /** | ||
123 | * 返回默认定义的内容里节日 | ||
124 | */ | ||
125 | getLunarFestival () { | ||
126 | return this.lFestival | ||
127 | }, | ||
128 | |||
129 | /** | ||
130 | * | ||
131 | * @param param {Object} 按照festival的格式输入数据,设置阳历节日 | ||
132 | */ | ||
133 | setFestival (param = {}) { | ||
134 | this.festival = param | ||
135 | }, | ||
136 | |||
137 | /** | ||
138 | * | ||
139 | * @param param {Object} 按照lFestival的格式输入数据,设置农历节日 | ||
140 | */ | ||
141 | setLunarFestival (param = {}) { | ||
142 | this.lFestival = param | ||
143 | }, | ||
144 | |||
145 | /** | ||
146 | * 24节气速查表 | ||
147 | * @Array Of Property | ||
148 | * @trans["小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至"] | ||
149 | * @return Cn string | ||
150 | */ | ||
151 | solarTerm: ["\u5c0f\u5bd2", "\u5927\u5bd2", "\u7acb\u6625", "\u96e8\u6c34", "\u60ca\u86f0", "\u6625\u5206", "\u6e05\u660e", "\u8c37\u96e8", "\u7acb\u590f", "\u5c0f\u6ee1", "\u8292\u79cd", "\u590f\u81f3", "\u5c0f\u6691", "\u5927\u6691", "\u7acb\u79cb", "\u5904\u6691", "\u767d\u9732", "\u79cb\u5206", "\u5bd2\u9732", "\u971c\u964d", "\u7acb\u51ac", "\u5c0f\u96ea", "\u5927\u96ea", "\u51ac\u81f3"], | ||
152 | |||
153 | /** | ||
154 | * 1900-2100各年的24节气日期速查表 | ||
155 | * @Array Of Property | ||
156 | * @return 0x string For splice | ||
157 | */ | ||
158 | sTermInfo: ['9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c3598082c95f8c965cc920f', | ||
159 | '97bd0b06bdb0722c965ce1cfcc920f', 'b027097bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', | ||
160 | '97bcf97c359801ec95f8c965cc920f', '97bd0b06bdb0722c965ce1cfcc920f', 'b027097bd097c36b0b6fc9274c91aa', | ||
161 | '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd0b06bdb0722c965ce1cfcc920f', | ||
162 | 'b027097bd097c36b0b6fc9274c91aa', '9778397bd19801ec9210c965cc920e', '97b6b97bd19801ec95f8c965cc920f', | ||
163 | '97bd09801d98082c95f8e1cfcc920f', '97bd097bd097c36b0b6fc9210c8dc2', '9778397bd197c36c9210c9274c91aa', | ||
164 | '97b6b97bd19801ec95f8c965cc920e', '97bd09801d98082c95f8e1cfcc920f', '97bd097bd097c36b0b6fc9210c8dc2', | ||
165 | '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec95f8c965cc920e', '97bcf97c3598082c95f8e1cfcc920f', | ||
166 | '97bd097bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec9210c965cc920e', | ||
167 | '97bcf97c3598082c95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', | ||
168 | '97b6b97bd19801ec9210c965cc920e', '97bcf97c3598082c95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', | ||
169 | '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', | ||
170 | '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', | ||
171 | '97bcf97c359801ec95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', | ||
172 | '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd097bd07f595b0b6fc920fb0722', | ||
173 | '9778397bd097c36b0b6fc9210c8dc2', '9778397bd19801ec9210c9274c920e', '97b6b97bd19801ec95f8c965cc920f', | ||
174 | '97bd07f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c920e', | ||
175 | '97b6b97bd19801ec95f8c965cc920f', '97bd07f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', | ||
176 | '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bd07f1487f595b0b0bc920fb0722', | ||
177 | '7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', | ||
178 | '97bcf7f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', | ||
179 | '97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', | ||
180 | '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f531b0b0bb0b6fb0722', | ||
181 | '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', | ||
182 | '97bcf7f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', | ||
183 | '97b6b97bd19801ec9210c9274c920e', '97bcf7f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', | ||
184 | '9778397bd097c36b0b6fc9210c91aa', '97b6b97bd197c36c9210c9274c920e', '97bcf7f0e47f531b0b0bb0b6fb0722', | ||
185 | '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c920e', | ||
186 | '97b6b7f0e47f531b0723b0b6fb0722', '7f0e37f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', | ||
187 | '9778397bd097c36b0b70c9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e37f1487f595b0b0bb0b6fb0722', | ||
188 | '7f0e397bd097c35b0b6fc9210c8dc2', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', | ||
189 | '7f0e27f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', | ||
190 | '97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', | ||
191 | '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', | ||
192 | '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', | ||
193 | '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9274c91aa', | ||
194 | '97b6b7f0e47f531b0723b0787b0721', '7f0e27f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', | ||
195 | '9778397bd097c36b0b6fc9210c91aa', '97b6b7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', | ||
196 | '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c8dc2', '977837f0e37f149b0723b0787b0721', | ||
197 | '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f5307f595b0b0bc920fb0722', '7f0e397bd097c35b0b6fc9210c8dc2', | ||
198 | '977837f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e37f1487f595b0b0bb0b6fb0722', | ||
199 | '7f0e397bd097c35b0b6fc9210c8dc2', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', | ||
200 | '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '977837f0e37f14998082b0787b06bd', | ||
201 | '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', | ||
202 | '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', | ||
203 | '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', | ||
204 | '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14998082b0787b06bd', | ||
205 | '7f07e7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', | ||
206 | '977837f0e37f14998082b0723b06bd', '7f07e7f0e37f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', | ||
207 | '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b0721', | ||
208 | '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f1487f595b0b0bb0b6fb0722', '7f0e37f0e37f14898082b0723b02d5', | ||
209 | '7ec967f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f1487f531b0b0bb0b6fb0722', | ||
210 | '7f0e37f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', | ||
211 | '7f0e37f1487f531b0b0bb0b6fb0722', '7f0e37f0e37f14898082b072297c35', '7ec967f0e37f14998082b0787b06bd', | ||
212 | '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e37f0e37f14898082b072297c35', | ||
213 | '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', | ||
214 | '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f149b0723b0787b0721', | ||
215 | '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14998082b0723b06bd', | ||
216 | '7f07e7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', '7f0e37f0e366aa89801eb072297c35', | ||
217 | '7ec967f0e37f14998082b0723b06bd', '7f07e7f0e37f14998083b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', | ||
218 | '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14898082b0723b02d5', '7f07e7f0e37f14998082b0787b0721', | ||
219 | '7f07e7f0e47f531b0723b0b6fb0722', '7f0e36665b66aa89801e9808297c35', '665f67f0e37f14898082b0723b02d5', | ||
220 | '7ec967f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e36665b66a449801e9808297c35', | ||
221 | '665f67f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', | ||
222 | '7f0e36665b66a449801e9808297c35', '665f67f0e37f14898082b072297c35', '7ec967f0e37f14998082b0787b06bd', | ||
223 | '7f07e7f0e47f531b0723b0b6fb0721', '7f0e26665b66a449801e9808297c35', '665f67f0e37f1489801eb072297c35', | ||
224 | '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722'], | ||
225 | |||
226 | /** | ||
227 | * 数字转中文速查表 | ||
228 | * @Array Of Property | ||
229 | * @trans ['日','一','二','三','四','五','六','七','八','九','十'] | ||
230 | * @return Cn string | ||
231 | */ | ||
232 | nStr1: ["\u65e5", "\u4e00", "\u4e8c", "\u4e09", "\u56db", "\u4e94", "\u516d", "\u4e03", "\u516b", "\u4e5d", "\u5341"], | ||
233 | |||
234 | /** | ||
235 | * 日期转农历称呼速查表 | ||
236 | * @Array Of Property | ||
237 | * @trans ['初','十','廿','卅'] | ||
238 | * @return Cn string | ||
239 | */ | ||
240 | nStr2: ["\u521d", "\u5341", "\u5eff", "\u5345"], | ||
241 | |||
242 | /** | ||
243 | * 月份转农历称呼速查表 | ||
244 | * @Array Of Property | ||
245 | * @trans ['正','一','二','三','四','五','六','七','八','九','十','冬','腊'] | ||
246 | * @return Cn string | ||
247 | */ | ||
248 | nStr3: ["\u6b63", "\u4e8c", "\u4e09", "\u56db", "\u4e94", "\u516d", "\u4e03", "\u516b", "\u4e5d", "\u5341", "\u51ac", "\u814a"], | ||
249 | |||
250 | /** | ||
251 | * 返回农历y年一整年的总天数 | ||
252 | * @param y lunar Year | ||
253 | * @return Number | ||
254 | * @eg:var count = calendar.lYearDays(1987) ;//count=387 | ||
255 | */ | ||
256 | lYearDays: function (y) { | ||
257 | let i, sum = 348; | ||
258 | for (i = 0x8000; i > 0x8; i >>= 1) { | ||
259 | sum += (this.lunarInfo[y - 1900] & i) ? 1 : 0; | ||
260 | } | ||
261 | return (sum + this.leapDays(y)); | ||
262 | }, | ||
263 | |||
264 | /** | ||
265 | * 返回农历y年闰月是哪个月;若y年没有闰月 则返回0 | ||
266 | * @param y lunar Year | ||
267 | * @return Number (0-12) | ||
268 | * @eg:var leapMonth = calendar.leapMonth(1987) ;//leapMonth=6 | ||
269 | */ | ||
270 | leapMonth: function (y) { //闰字编码 \u95f0 | ||
271 | return (this.lunarInfo[y - 1900] & 0xf); | ||
272 | }, | ||
273 | |||
274 | /** | ||
275 | * 返回农历y年闰月的天数 若该年没有闰月则返回0 | ||
276 | * @param y lunar Year | ||
277 | * @return Number (0、29、30) | ||
278 | * @eg:var leapMonthDay = calendar.leapDays(1987) ;//leapMonthDay=29 | ||
279 | */ | ||
280 | leapDays: function (y) { | ||
281 | if (this.leapMonth(y)) { | ||
282 | return ((this.lunarInfo[y - 1900] & 0x10000) ? 30 : 29); | ||
283 | } | ||
284 | return (0); | ||
285 | }, | ||
286 | |||
287 | /** | ||
288 | * 返回农历y年m月(非闰月)的总天数,计算m为闰月时的天数请使用leapDays方法 | ||
289 | * @param y lunar Year | ||
290 | * @param m lunar Month | ||
291 | * @return Number (-1、29、30) | ||
292 | * @eg:var MonthDay = calendar.monthDays(1987,9) ;//MonthDay=29 | ||
293 | */ | ||
294 | monthDays: function (y, m) { | ||
295 | if (m > 12 || m < 1) { | ||
296 | return -1 | ||
297 | }//月份参数从1至12,参数错误返回-1 | ||
298 | return ((this.lunarInfo[y - 1900] & (0x10000 >> m)) ? 30 : 29); | ||
299 | }, | ||
300 | |||
301 | /** | ||
302 | * 返回公历(!)y年m月的天数 | ||
303 | * @param y solar Year | ||
304 | * @param m solar Month | ||
305 | * @return Number (-1、28、29、30、31) | ||
306 | * @eg:var solarMonthDay = calendar.leapDays(1987) ;//solarMonthDay=30 | ||
307 | */ | ||
308 | solarDays: function (y, m) { | ||
309 | if (m > 12 || m < 1) { | ||
310 | return -1 | ||
311 | } //若参数错误 返回-1 | ||
312 | const ms = m - 1; | ||
313 | if (ms === 1) { //2月份的闰平规律测算后确认返回28或29 | ||
314 | return (((y % 4 === 0) && (y % 100 !== 0) || (y % 400 === 0)) ? 29 : 28); | ||
315 | } else { | ||
316 | return (this.solarMonth[ms]); | ||
317 | } | ||
318 | }, | ||
319 | |||
320 | /** | ||
321 | * 农历年份转换为干支纪年 | ||
322 | * @param lYear 农历年的年份数 | ||
323 | * @return Cn string | ||
324 | */ | ||
325 | toGanZhiYear: function (lYear) { | ||
326 | var ganKey = (lYear - 3) % 10; | ||
327 | var zhiKey = (lYear - 3) % 12; | ||
328 | if (ganKey === 0) ganKey = 10;//如果余数为0则为最后一个天干 | ||
329 | if (zhiKey === 0) zhiKey = 12;//如果余数为0则为最后一个地支 | ||
330 | return this.Gan[ganKey - 1] + this.Zhi[zhiKey - 1]; | ||
331 | |||
332 | }, | ||
333 | |||
334 | /** | ||
335 | * 公历月、日判断所属星座 | ||
336 | * @param cMonth [description] | ||
337 | * @param cDay [description] | ||
338 | * @return Cn string | ||
339 | */ | ||
340 | toAstro: function (cMonth, cDay) { | ||
341 | const s = "\u9b54\u7faf\u6c34\u74f6\u53cc\u9c7c\u767d\u7f8a\u91d1\u725b\u53cc\u5b50\u5de8\u87f9\u72ee\u5b50\u5904\u5973\u5929\u79e4\u5929\u874e\u5c04\u624b\u9b54\u7faf"; | ||
342 | const arr = [20, 19, 21, 21, 21, 22, 23, 23, 23, 23, 22, 22]; | ||
343 | return s.substr(cMonth * 2 - (cDay < arr[cMonth - 1] ? 2 : 0), 2) + "\u5ea7";//座 | ||
344 | }, | ||
345 | |||
346 | /** | ||
347 | * 传入offset偏移量返回干支 | ||
348 | * @param offset 相对甲子的偏移量 | ||
349 | * @return Cn string | ||
350 | */ | ||
351 | toGanZhi: function (offset) { | ||
352 | return this.Gan[offset % 10] + this.Zhi[offset % 12]; | ||
353 | }, | ||
354 | |||
355 | /** | ||
356 | * 传入公历(!)y年获得该年第n个节气的公历日期 | ||
357 | * @param y y公历年(1900-2100) | ||
358 | * @param n n二十四节气中的第几个节气(1~24);从n=1(小寒)算起 | ||
359 | * @return day Number | ||
360 | * @eg:var _24 = calendar.getTerm(1987,3) ;//_24=4;意即1987年2月4日立春 | ||
361 | */ | ||
362 | getTerm: function (y, n) { | ||
363 | if (y < 1900 || y > 2100) { | ||
364 | return -1; | ||
365 | } | ||
366 | if (n < 1 || n > 24) { | ||
367 | return -1; | ||
368 | } | ||
369 | const _table = this.sTermInfo[y - 1900]; | ||
370 | const _info = [ | ||
371 | parseInt('0x' + _table.substr(0, 5)).toString(), | ||
372 | parseInt('0x' + _table.substr(5, 5)).toString(), | ||
373 | parseInt('0x' + _table.substr(10, 5)).toString(), | ||
374 | parseInt('0x' + _table.substr(15, 5)).toString(), | ||
375 | parseInt('0x' + _table.substr(20, 5)).toString(), | ||
376 | parseInt('0x' + _table.substr(25, 5)).toString() | ||
377 | ]; | ||
378 | const _calcDay = [ | ||
379 | _info[0].substr(0, 1), | ||
380 | _info[0].substr(1, 2), | ||
381 | _info[0].substr(3, 1), | ||
382 | _info[0].substr(4, 2), | ||
383 | |||
384 | _info[1].substr(0, 1), | ||
385 | _info[1].substr(1, 2), | ||
386 | _info[1].substr(3, 1), | ||
387 | _info[1].substr(4, 2), | ||
388 | |||
389 | _info[2].substr(0, 1), | ||
390 | _info[2].substr(1, 2), | ||
391 | _info[2].substr(3, 1), | ||
392 | _info[2].substr(4, 2), | ||
393 | |||
394 | _info[3].substr(0, 1), | ||
395 | _info[3].substr(1, 2), | ||
396 | _info[3].substr(3, 1), | ||
397 | _info[3].substr(4, 2), | ||
398 | |||
399 | _info[4].substr(0, 1), | ||
400 | _info[4].substr(1, 2), | ||
401 | _info[4].substr(3, 1), | ||
402 | _info[4].substr(4, 2), | ||
403 | |||
404 | _info[5].substr(0, 1), | ||
405 | _info[5].substr(1, 2), | ||
406 | _info[5].substr(3, 1), | ||
407 | _info[5].substr(4, 2), | ||
408 | ]; | ||
409 | return parseInt(_calcDay[n - 1]); | ||
410 | }, | ||
411 | |||
412 | /** | ||
413 | * 传入农历数字月份返回汉语通俗表示法 | ||
414 | * @param m lunar month | ||
415 | * @return Cn string | ||
416 | * @eg:var cnMonth = calendar.toChinaMonth(12) ;//cnMonth='腊月' | ||
417 | */ | ||
418 | toChinaMonth: function (m) { // 月 => \u6708 | ||
419 | if (m > 12 || m < 1) { | ||
420 | return -1 | ||
421 | } //若参数错误 返回-1 | ||
422 | let s = this.nStr3[m - 1]; | ||
423 | s += "\u6708";//加上月字 | ||
424 | return s; | ||
425 | }, | ||
426 | |||
427 | /** | ||
428 | * 传入农历日期数字返回汉字表示法 | ||
429 | * @param d lunar day | ||
430 | * @return Cn string | ||
431 | * @eg:var cnDay = calendar.toChinaDay(21) ;//cnMonth='廿一' | ||
432 | */ | ||
433 | toChinaDay: function (d) { //日 => \u65e5 | ||
434 | let s; | ||
435 | switch (d) { | ||
436 | case 10: | ||
437 | s = '\u521d\u5341'; | ||
438 | break; | ||
439 | case 20: | ||
440 | s = '\u4e8c\u5341'; | ||
441 | break; | ||
442 | case 30: | ||
443 | s = '\u4e09\u5341'; | ||
444 | break; | ||
445 | default: | ||
446 | s = this.nStr2[Math.floor(d / 10)]; | ||
447 | s += this.nStr1[d % 10]; | ||
448 | } | ||
449 | return (s); | ||
450 | }, | ||
451 | |||
452 | /** | ||
453 | * 年份转生肖[!仅能大致转换] => 精确划分生肖分界线是“立春” | ||
454 | * @param y year | ||
455 | * @return Cn string | ||
456 | * @eg:var animal = calendar.getAnimal(1987) ;//animal='兔' | ||
457 | */ | ||
458 | getAnimal: function (y) { | ||
459 | return this.Animals[(y - 4) % 12] | ||
460 | }, | ||
461 | |||
462 | /** | ||
463 | * 传入阳历年月日获得详细的公历、农历object信息 <=>JSON | ||
464 | * !important! 公历参数区间1900.1.31~2100.12.31 | ||
465 | * @param yPara solar year | ||
466 | * @param mPara solar month | ||
467 | * @param dPara solar day | ||
468 | * @return JSON object | ||
469 | * @eg:console.log(calendar.solar2lunar(1987,11,01)); | ||
470 | */ | ||
471 | solar2lunar: function (yPara, mPara, dPara) { | ||
472 | let y = parseInt(yPara); | ||
473 | let m = parseInt(mPara); | ||
474 | let d = parseInt(dPara); | ||
475 | //年份限定、上限 | ||
476 | if (y < 1900 || y > 2100) { | ||
477 | return -1;// undefined转换为数字变为NaN | ||
478 | } | ||
479 | //公历传参最下限 | ||
480 | if (y === 1900 && m === 1 && d < 31) { | ||
481 | return -1; | ||
482 | } | ||
483 | |||
484 | //未传参 获得当天 | ||
485 | let objDate; | ||
486 | if (!y) { | ||
487 | objDate = new Date(); | ||
488 | } else { | ||
489 | objDate = new Date(y, parseInt(m) - 1, d); | ||
490 | } | ||
491 | let i, leap = 0, temp = 0; | ||
492 | //修正ymd参数 | ||
493 | y = objDate.getFullYear(); | ||
494 | m = objDate.getMonth() + 1; | ||
495 | d = objDate.getDate(); | ||
496 | let offset = (Date.UTC(objDate.getFullYear(), objDate.getMonth(), objDate.getDate()) - Date.UTC(1900, 0, 31)) / 86400000; | ||
497 | for (i = 1900; i < 2101 && offset > 0; i++) { | ||
498 | temp = this.lYearDays(i); | ||
499 | offset -= temp; | ||
500 | } | ||
501 | if (offset < 0) { | ||
502 | offset += temp; | ||
503 | i--; | ||
504 | } | ||
505 | |||
506 | //是否今天 | ||
507 | let isTodayObj = new Date(), | ||
508 | isToday = false; | ||
509 | if (isTodayObj.getFullYear() === y && isTodayObj.getMonth() + 1 === m && isTodayObj.getDate() === d) { | ||
510 | isToday = true; | ||
511 | } | ||
512 | //星期几 | ||
513 | let nWeek = objDate.getDay(), | ||
514 | cWeek = this.nStr1[nWeek]; | ||
515 | //数字表示周几顺应天朝周一开始的惯例 | ||
516 | if (nWeek === 0) { | ||
517 | nWeek = 7; | ||
518 | } | ||
519 | //农历年 | ||
520 | const year = i; | ||
521 | leap = this.leapMonth(i); //闰哪个月 | ||
522 | let isLeap = false; | ||
523 | |||
524 | //效验闰月 | ||
525 | for (i = 1; i < 13 && offset > 0; i++) { | ||
526 | //闰月 | ||
527 | if (leap > 0 && i === (leap + 1) && isLeap === false) { | ||
528 | --i; | ||
529 | isLeap = true; | ||
530 | temp = this.leapDays(year); //计算农历闰月天数 | ||
531 | } else { | ||
532 | temp = this.monthDays(year, i);//计算农历普通月天数 | ||
533 | } | ||
534 | //解除闰月 | ||
535 | if (isLeap === true && i === (leap + 1)) { | ||
536 | isLeap = false; | ||
537 | } | ||
538 | offset -= temp; | ||
539 | } | ||
540 | // 闰月导致数组下标重叠取反 | ||
541 | if (offset === 0 && leap > 0 && i === leap + 1) { | ||
542 | if (isLeap) { | ||
543 | isLeap = false; | ||
544 | } else { | ||
545 | isLeap = true; | ||
546 | --i; | ||
547 | } | ||
548 | } | ||
549 | if (offset < 0) { | ||
550 | offset += temp; | ||
551 | --i; | ||
552 | } | ||
553 | //农历月 | ||
554 | const month = i; | ||
555 | //农历日 | ||
556 | const day = offset + 1; | ||
557 | //天干地支处理 | ||
558 | const sm = m - 1; | ||
559 | const gzY = this.toGanZhiYear(year); | ||
560 | |||
561 | // 当月的两个节气 | ||
562 | // bugfix-2017-7-24 11:03:38 use lunar Year Param `y` Not `year` | ||
563 | const firstNode = this.getTerm(y, (m * 2 - 1));//返回当月「节」为几日开始 | ||
564 | const secondNode = this.getTerm(y, (m * 2));//返回当月「节」为几日开始 | ||
565 | |||
566 | // 依据12节气修正干支月 | ||
567 | let gzM = this.toGanZhi((y - 1900) * 12 + m + 11); | ||
568 | if (d >= firstNode) { | ||
569 | gzM = this.toGanZhi((y - 1900) * 12 + m + 12); | ||
570 | } | ||
571 | |||
572 | //传入的日期的节气与否 | ||
573 | let isTerm = false; | ||
574 | let Term = null; | ||
575 | if (firstNode === d) { | ||
576 | isTerm = true; | ||
577 | Term = this.solarTerm[m * 2 - 2]; | ||
578 | } | ||
579 | if (secondNode === d) { | ||
580 | isTerm = true; | ||
581 | Term = this.solarTerm[m * 2 - 1]; | ||
582 | } | ||
583 | //日柱 当月一日与 1900/1/1 相差天数 | ||
584 | const dayCyclical = Date.UTC(y, sm, 1, 0, 0, 0, 0) / 86400000 + 25567 + 10; | ||
585 | const gzD = this.toGanZhi(dayCyclical + d - 1); | ||
586 | //该日期所属的星座 | ||
587 | const astro = this.toAstro(m, d); | ||
588 | |||
589 | const solarDate = y + '-' + m + '-' + d; | ||
590 | const lunarDate = year + '-' + month + '-' + day; | ||
591 | |||
592 | const festival = this.festival; | ||
593 | const lFestival = this.lFestival; | ||
594 | |||
595 | const festivalDate = m + '-' + d; | ||
596 | const lunarFestivalDate = month + '-' + day; | ||
597 | |||
598 | return { | ||
599 | date: solarDate, | ||
600 | lunarDate: lunarDate, | ||
601 | festival: festival[festivalDate] ? festival[festivalDate].title : null, | ||
602 | lunarFestival: lFestival[lunarFestivalDate] ? lFestival[lunarFestivalDate].title : null, | ||
603 | 'lYear': year, | ||
604 | 'lMonth': month, | ||
605 | 'lDay': day, | ||
606 | 'Animal': this.getAnimal(year), | ||
607 | 'IMonthCn': (isLeap ? "\u95f0" : '') + this.toChinaMonth(month), | ||
608 | 'IDayCn': this.toChinaDay(day), | ||
609 | 'cYear': y, | ||
610 | 'cMonth': m, | ||
611 | 'cDay': d, | ||
612 | 'gzYear': gzY, | ||
613 | 'gzMonth': gzM, | ||
614 | 'gzDay': gzD, | ||
615 | 'isToday': isToday, | ||
616 | 'isLeap': isLeap, | ||
617 | 'nWeek': nWeek, | ||
618 | 'ncWeek': "\u661f\u671f" + cWeek, | ||
619 | 'isTerm': isTerm, | ||
620 | 'Term': Term, | ||
621 | 'astro': astro | ||
622 | }; | ||
623 | }, | ||
624 | |||
625 | /** | ||
626 | * 传入农历年月日以及传入的月份是否闰月获得详细的公历、农历object信息 <=>JSON | ||
627 | * !important! 参数区间1900.1.31~2100.12.1 | ||
628 | * @param y lunar year | ||
629 | * @param m lunar month | ||
630 | * @param d lunar day | ||
631 | * @param isLeapMonth lunar month is leap or not.[如果是农历闰月第四个参数赋值true即可] | ||
632 | * @return JSON object | ||
633 | * @eg:console.log(calendar.lunar2solar(1987,9,10)); | ||
634 | */ | ||
635 | lunar2solar: function (y, m, d, isLeapMonth) { | ||
636 | y = parseInt(y) | ||
637 | m = parseInt(m) | ||
638 | d = parseInt(d) | ||
639 | isLeapMonth = !!isLeapMonth; | ||
640 | const leapOffset = 0; | ||
641 | const leapMonth = this.leapMonth(y); | ||
642 | const leapDay = this.leapDays(y); | ||
643 | if (isLeapMonth && (leapMonth !== m)) { | ||
644 | return -1; | ||
645 | }//传参要求计算该闰月公历 但该年得出的闰月与传参的月份并不同 | ||
646 | if (y === 2100 && m === 12 && d > 1 || y === 1900 && m === 1 && d < 31) { | ||
647 | return -1; | ||
648 | }//超出了最大极限值 | ||
649 | const day = this.monthDays(y, m); | ||
650 | let _day = day; | ||
651 | //bugFix 2016-9-25 | ||
652 | //if month is leap, _day use leapDays method | ||
653 | if (isLeapMonth) { | ||
654 | _day = this.leapDays(y, m); | ||
655 | } | ||
656 | if (y < 1900 || y > 2100 || d > _day) { | ||
657 | return -1; | ||
658 | }//参数合法性效验 | ||
659 | |||
660 | //计算农历的时间差 | ||
661 | let offset = 0; | ||
662 | let i; | ||
663 | for (i = 1900; i < y; i++) { | ||
664 | offset += this.lYearDays(i); | ||
665 | } | ||
666 | let leap = 0, isAdd = false; | ||
667 | for (i = 1; i < m; i++) { | ||
668 | leap = this.leapMonth(y); | ||
669 | if (!isAdd) {//处理闰月 | ||
670 | if (leap <= i && leap > 0) { | ||
671 | offset += this.leapDays(y); | ||
672 | isAdd = true; | ||
673 | } | ||
674 | } | ||
675 | offset += this.monthDays(y, i); | ||
676 | } | ||
677 | //转换闰月农历 需补充该年闰月的前一个月的时差 | ||
678 | if (isLeapMonth) { | ||
679 | offset += day; | ||
680 | } | ||
681 | //1900年农历正月一日的公历时间为1900年1月30日0时0分0秒(该时间也是本农历的最开始起始点) | ||
682 | const strap = Date.UTC(1900, 1, 30, 0, 0, 0); | ||
683 | const calObj = new Date((offset + d - 31) * 86400000 + strap); | ||
684 | const cY = calObj.getUTCFullYear(); | ||
685 | const cM = calObj.getUTCMonth() + 1; | ||
686 | const cD = calObj.getUTCDate(); | ||
687 | |||
688 | return this.solar2lunar(cY, cM, cD); | ||
689 | } | ||
690 | }; | ||
691 | |||
692 | export default calendar | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
src/components/Calendar/index.vue
deleted
100644 → 0
1 | |||
2 | <template> | ||
3 | <el-calendar v-model="date"> | ||
4 | <template slot="dateCell" slot-scope="{date, data}"> | ||
5 | <div :class="{ selected: isSelected(date, data) }"> | ||
6 | <div class="solar">{{ data.day.split('-')[2] }}</div> | ||
7 | <div class="lunar" :class="{ festival: isFestival(date, data) }">{{ solarToLunar(date, data) }}</div> | ||
8 | </div> | ||
9 | </template> | ||
10 | </el-calendar> | ||
11 | </template> | ||
12 | |||
13 | <script> | ||
14 | import calendar from './calendar' | ||
15 | export default { | ||
16 | name: 'calendar', | ||
17 | data () { | ||
18 | return { | ||
19 | date: new Date(), | ||
20 | // 根据selectedDates设置选中日期 | ||
21 | selectedDates: [] | ||
22 | } | ||
23 | }, | ||
24 | methods: { | ||
25 | // 是否选中日期 | ||
26 | isSelected: function (slotDate, slotData) { | ||
27 | return this.selectedDates.includes(slotData.day) | ||
28 | }, | ||
29 | // 是否节假日 | ||
30 | isFestival (slotDate, slotData) { | ||
31 | let solarDayArr = slotData.day.split('-'); | ||
32 | let lunarDay = calendar.solar2lunar(solarDayArr[0], solarDayArr[1], solarDayArr[2]) | ||
33 | |||
34 | // 公历节日\农历节日\农历节气 | ||
35 | let festAndTerm = []; | ||
36 | festAndTerm.push(lunarDay.festival == null ? '' : ' ' + lunarDay.festival) | ||
37 | festAndTerm.push(lunarDay.lunarFestival == null ? '' : '' + lunarDay.lunarFestival) | ||
38 | festAndTerm.push(lunarDay.Term == null ? '' : '' + lunarDay.Term) | ||
39 | festAndTerm = festAndTerm.join('') | ||
40 | |||
41 | return festAndTerm != '' | ||
42 | }, | ||
43 | // 公历转农历 | ||
44 | solarToLunar (slotDate, slotData) { | ||
45 | let solarDayArr = slotData.day.split('-'); | ||
46 | let lunarDay = calendar.solar2lunar(solarDayArr[0], solarDayArr[1], solarDayArr[2]) | ||
47 | |||
48 | // 农历日期 | ||
49 | let lunarMD = lunarDay.IMonthCn + lunarDay.IDayCn | ||
50 | |||
51 | // 公历节日\农历节日\农历节气 | ||
52 | let festAndTerm = []; | ||
53 | festAndTerm.push(lunarDay.festival == null ? '' : ' ' + lunarDay.festival) | ||
54 | festAndTerm.push(lunarDay.lunarFestival == null ? '' : '' + lunarDay.lunarFestival) | ||
55 | festAndTerm.push(lunarDay.Term == null ? '' : '' + lunarDay.Term) | ||
56 | festAndTerm = festAndTerm.join('') | ||
57 | |||
58 | return festAndTerm == '' ? lunarMD : festAndTerm | ||
59 | } | ||
60 | } | ||
61 | } | ||
62 | </script> | ||
63 | |||
64 | <style scoped> | ||
65 | /**隐藏上一月、本月、下一月*/ | ||
66 | .el-calendar__button-group { | ||
67 | display: none; | ||
68 | } | ||
69 | |||
70 | /deep/.el-calendar__body { | ||
71 | padding: 8px; | ||
72 | } | ||
73 | |||
74 | /deep/.el-calendar-table .el-calendar-day { | ||
75 | height: auto; | ||
76 | padding: 5px; | ||
77 | } | ||
78 | |||
79 | /**月份居中*/ | ||
80 | .el-calendar__title { | ||
81 | width: 100%; | ||
82 | text-align: center; | ||
83 | } | ||
84 | |||
85 | /deep/.el-calendar-table thead th { | ||
86 | padding: 0 0 6px 0 !important; | ||
87 | } | ||
88 | |||
89 | /deep/.el-calendar-day { | ||
90 | padding: 3px !important; | ||
91 | } | ||
92 | |||
93 | /deep/.el-calendar-table td.is-today { | ||
94 | font-weight: 700; | ||
95 | } | ||
96 | |||
97 | /deep/.el-calendar-table td.is-selected { | ||
98 | background-color: rgb(179, 216, 255); | ||
99 | } | ||
100 | |||
101 | /deep/.el-calendar__header { | ||
102 | padding: 8px 15px; | ||
103 | } | ||
104 | |||
105 | /**日期div的样式*/ | ||
106 | .el-calendar-table tr td:first-child { | ||
107 | border-left: 0px; | ||
108 | } | ||
109 | |||
110 | .el-calendar-table td { | ||
111 | min-height: 110px; | ||
112 | min-width: 110px; | ||
113 | border-right: 0px; | ||
114 | } | ||
115 | |||
116 | .el-calendar-table td.is-selected { | ||
117 | background-color: white; | ||
118 | } | ||
119 | |||
120 | .el-calendar-table .el-calendar-day { | ||
121 | padding: 0px; | ||
122 | text-align: center; | ||
123 | } | ||
124 | |||
125 | .el-calendar-table .el-calendar-day>div { | ||
126 | text-align: center | ||
127 | } | ||
128 | |||
129 | /**日期div的样式-公历*/ | ||
130 | .el-calendar-table .el-calendar-day>div .solar { | ||
131 | text-align: center; | ||
132 | margin-top: 3px; | ||
133 | } | ||
134 | |||
135 | /**日期div的样式-农历*/ | ||
136 | .el-calendar-table .el-calendar-day>div .lunar { | ||
137 | padding-top: 5px; | ||
138 | font-size: 12px; | ||
139 | text-align: center; | ||
140 | margin-bottom: 5px; | ||
141 | } | ||
142 | |||
143 | /**日期div的样式-选中*/ | ||
144 | .el-calendar-table .el-calendar-day>div.selected { | ||
145 | background-color: #fef2f2; | ||
146 | border: 3px solid #fb0; | ||
147 | border-radius: 20px; | ||
148 | text-align: center | ||
149 | } | ||
150 | |||
151 | /**本月周末设置为红色*/ | ||
152 | /* .el-calendar-table .current:nth-last-child(-n+2) .solar { | ||
153 | color: red; | ||
154 | } */ | ||
155 | |||
156 | /**本月农历设置为灰色*/ | ||
157 | .el-calendar-table .current .lunar { | ||
158 | color: #606266; | ||
159 | font-size: 12px; | ||
160 | } | ||
161 | |||
162 | /**本月农历节日设置为红色*/ | ||
163 | .el-calendar-table .current .lunar.festival { | ||
164 | color: red; | ||
165 | } | ||
166 | |||
167 | .el-calendar-table td { | ||
168 | border-right: none !important; | ||
169 | } | ||
170 | |||
171 | /**禁用点击效果*/ | ||
172 | /*.el-calendar-table td {*/ | ||
173 | /*pointer-events: none;*/ | ||
174 | /*}*/ | ||
175 | </style> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
src/components/calendar/calendar.js
deleted
100644 → 0
1 | /** | ||
2 | * @1900-2100区间内的公历、农历互转 | ||
3 | * @charset UTF-8 | ||
4 | * @Author Jea杨(JJonline@JJonline.Cn) | ||
5 | * @Time 2014-7-21 | ||
6 | * @Time 2016-8-13 Fixed 2033hex、Attribution Annals | ||
7 | * @Time 2016-9-25 Fixed lunar LeapMonth Param Bug | ||
8 | * @Time 2017-7-24 Fixed use getTerm Func Param Error.use solar year,NOT lunar year | ||
9 | * @Version 1.0.3 | ||
10 | * @公历转农历:calendar.solar2lunar(1987,11,01); //[you can ignore params of prefix 0] | ||
11 | * @农历转公历:calendar.lunar2solar(1987,09,10); //[you can ignore params of prefix 0] | ||
12 | */ | ||
13 | const calendar = { | ||
14 | |||
15 | /** | ||
16 | * 农历1900-2100的润大小信息表 | ||
17 | * @Array Of Property | ||
18 | * @return Hex | ||
19 | */ | ||
20 | lunarInfo: [0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0, 0x055d2,//1900-1909 | ||
21 | 0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x095b0, 0x14977,//1910-1919 | ||
22 | 0x04970, 0x0a4b0, 0x0b4b5, 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970,//1920-1929 | ||
23 | 0x06566, 0x0d4a0, 0x0ea50, 0x16a95, 0x05ad0, 0x02b60, 0x186e3, 0x092e0, 0x1c8d7, 0x0c950,//1930-1939 | ||
24 | 0x0d4a0, 0x1d8a6, 0x0b550, 0x056a0, 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, 0x0b557,//1940-1949 | ||
25 | 0x06ca0, 0x0b550, 0x15355, 0x04da0, 0x0a5b0, 0x14573, 0x052b0, 0x0a9a8, 0x0e950, 0x06aa0,//1950-1959 | ||
26 | 0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570, 0x05260, 0x0f263, 0x0d950, 0x05b57, 0x056a0,//1960-1969 | ||
27 | 0x096d0, 0x04dd5, 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b6a0, 0x195a6,//1970-1979 | ||
28 | 0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, 0x06d40, 0x0af46, 0x0ab60, 0x09570,//1980-1989 | ||
29 | 0x04af5, 0x04970, 0x064b0, 0x074a3, 0x0ea50, 0x06b58, 0x05ac0, 0x0ab60, 0x096d5, 0x092e0,//1990-1999 | ||
30 | 0x0c960, 0x0d954, 0x0d4a0, 0x0da50, 0x07552, 0x056a0, 0x0abb7, 0x025d0, 0x092d0, 0x0cab5,//2000-2009 | ||
31 | 0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50, 0x055d9, 0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930,//2010-2019 | ||
32 | 0x07954, 0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0, 0x0d260, 0x0ea65, 0x0d530,//2020-2029 | ||
33 | 0x05aa0, 0x076a3, 0x096d0, 0x04afb, 0x04ad0, 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520, 0x0dd45,//2030-2039 | ||
34 | 0x0b5a0, 0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, 0x0ada0,//2040-2049 | ||
35 | /**Add By JJonline@JJonline.Cn**/ | ||
36 | 0x14b63, 0x09370, 0x049f8, 0x04970, 0x064b0, 0x168a6, 0x0ea50, 0x06b20, 0x1a6c4, 0x0aae0,//2050-2059 | ||
37 | 0x092e0, 0x0d2e3, 0x0c960, 0x0d557, 0x0d4a0, 0x0da50, 0x05d55, 0x056a0, 0x0a6d0, 0x055d4,//2060-2069 | ||
38 | 0x052d0, 0x0a9b8, 0x0a950, 0x0b4a0, 0x0b6a6, 0x0ad50, 0x055a0, 0x0aba4, 0x0a5b0, 0x052b0,//2070-2079 | ||
39 | 0x0b273, 0x06930, 0x07337, 0x06aa0, 0x0ad50, 0x14b55, 0x04b60, 0x0a570, 0x054e4, 0x0d160,//2080-2089 | ||
40 | 0x0e968, 0x0d520, 0x0daa0, 0x16aa6, 0x056d0, 0x04ae0, 0x0a9d4, 0x0a2d0, 0x0d150, 0x0f252,//2090-2099 | ||
41 | 0x0d520],//2100 | ||
42 | |||
43 | /** | ||
44 | * 公历每个月份的天数普通表 | ||
45 | * @Array Of Property | ||
46 | * @return Number | ||
47 | */ | ||
48 | solarMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], | ||
49 | |||
50 | /** | ||
51 | * 天干地支之天干速查表 | ||
52 | * @Array Of Property trans["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"] | ||
53 | * @return Cn string | ||
54 | */ | ||
55 | Gan: ["\u7532", "\u4e59", "\u4e19", "\u4e01", "\u620a", "\u5df1", "\u5e9a", "\u8f9b", "\u58ec", "\u7678"], | ||
56 | |||
57 | /** | ||
58 | * 天干地支之地支速查表 | ||
59 | * @Array Of Property | ||
60 | * @trans["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"] | ||
61 | * @return Cn string | ||
62 | */ | ||
63 | Zhi: ["\u5b50", "\u4e11", "\u5bc5", "\u536f", "\u8fb0", "\u5df3", "\u5348", "\u672a", "\u7533", "\u9149", "\u620c", "\u4ea5"], | ||
64 | |||
65 | /** | ||
66 | * 天干地支之地支速查表<=>生肖 | ||
67 | * @Array Of Property | ||
68 | * @trans["鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪"] | ||
69 | * @return Cn string | ||
70 | */ | ||
71 | Animals: ["\u9f20", "\u725b", "\u864e", "\u5154", "\u9f99", "\u86c7", "\u9a6c", "\u7f8a", "\u7334", "\u9e21", "\u72d7", "\u732a"], | ||
72 | |||
73 | /** | ||
74 | * 阳历节日 | ||
75 | */ | ||
76 | festival: { | ||
77 | '1-1': { title: '元旦节' }, | ||
78 | '2-14': { title: '情人节' }, | ||
79 | '5-1': { title: '劳动节' }, | ||
80 | '5-4': { title: '青年节' }, | ||
81 | '6-1': { title: '儿童节' }, | ||
82 | '9-10': { title: '教师节' }, | ||
83 | '10-1': { title: '国庆节' }, | ||
84 | '12-25': { title: '圣诞节' }, | ||
85 | |||
86 | '3-8': { title: '妇女节' }, | ||
87 | '3-12': { title: '植树节' }, | ||
88 | '4-1': { title: '愚人节' }, | ||
89 | '5-12': { title: '护士节' }, | ||
90 | '7-1': { title: '建党节' }, | ||
91 | '8-1': { title: '建军节' }, | ||
92 | '12-24': { title: '平安夜' }, | ||
93 | }, | ||
94 | |||
95 | /** | ||
96 | * 农历节日 | ||
97 | */ | ||
98 | lFestival: { | ||
99 | '12-30': { title: '除夕' }, | ||
100 | '1-1': { title: '春节' }, | ||
101 | '1-15': { title: '元宵节' }, | ||
102 | '2-2': { title: '龙抬头' }, | ||
103 | '5-5': { title: '端午节' }, | ||
104 | '7-7': { title: '七夕节' }, | ||
105 | '7-15': { title: '中元节' }, | ||
106 | '8-15': { title: '中秋节' }, | ||
107 | '9-9': { title: '重阳节' }, | ||
108 | '10-1': { title: '寒衣节' }, | ||
109 | '10-15': { title: '下元节' }, | ||
110 | '12-8': { title: '腊八节' }, | ||
111 | '12-23': { title: '北方小年' }, | ||
112 | '12-24': { title: '南方小年' }, | ||
113 | }, | ||
114 | |||
115 | /** | ||
116 | * 返回默认定义的阳历节日 | ||
117 | */ | ||
118 | getFestival () { | ||
119 | return this.festival | ||
120 | }, | ||
121 | |||
122 | /** | ||
123 | * 返回默认定义的内容里节日 | ||
124 | */ | ||
125 | getLunarFestival () { | ||
126 | return this.lFestival | ||
127 | }, | ||
128 | |||
129 | /** | ||
130 | * | ||
131 | * @param param {Object} 按照festival的格式输入数据,设置阳历节日 | ||
132 | */ | ||
133 | setFestival (param = {}) { | ||
134 | this.festival = param | ||
135 | }, | ||
136 | |||
137 | /** | ||
138 | * | ||
139 | * @param param {Object} 按照lFestival的格式输入数据,设置农历节日 | ||
140 | */ | ||
141 | setLunarFestival (param = {}) { | ||
142 | this.lFestival = param | ||
143 | }, | ||
144 | |||
145 | /** | ||
146 | * 24节气速查表 | ||
147 | * @Array Of Property | ||
148 | * @trans["小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至"] | ||
149 | * @return Cn string | ||
150 | */ | ||
151 | solarTerm: ["\u5c0f\u5bd2", "\u5927\u5bd2", "\u7acb\u6625", "\u96e8\u6c34", "\u60ca\u86f0", "\u6625\u5206", "\u6e05\u660e", "\u8c37\u96e8", "\u7acb\u590f", "\u5c0f\u6ee1", "\u8292\u79cd", "\u590f\u81f3", "\u5c0f\u6691", "\u5927\u6691", "\u7acb\u79cb", "\u5904\u6691", "\u767d\u9732", "\u79cb\u5206", "\u5bd2\u9732", "\u971c\u964d", "\u7acb\u51ac", "\u5c0f\u96ea", "\u5927\u96ea", "\u51ac\u81f3"], | ||
152 | |||
153 | /** | ||
154 | * 1900-2100各年的24节气日期速查表 | ||
155 | * @Array Of Property | ||
156 | * @return 0x string For splice | ||
157 | */ | ||
158 | sTermInfo: ['9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c3598082c95f8c965cc920f', | ||
159 | '97bd0b06bdb0722c965ce1cfcc920f', 'b027097bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', | ||
160 | '97bcf97c359801ec95f8c965cc920f', '97bd0b06bdb0722c965ce1cfcc920f', 'b027097bd097c36b0b6fc9274c91aa', | ||
161 | '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd0b06bdb0722c965ce1cfcc920f', | ||
162 | 'b027097bd097c36b0b6fc9274c91aa', '9778397bd19801ec9210c965cc920e', '97b6b97bd19801ec95f8c965cc920f', | ||
163 | '97bd09801d98082c95f8e1cfcc920f', '97bd097bd097c36b0b6fc9210c8dc2', '9778397bd197c36c9210c9274c91aa', | ||
164 | '97b6b97bd19801ec95f8c965cc920e', '97bd09801d98082c95f8e1cfcc920f', '97bd097bd097c36b0b6fc9210c8dc2', | ||
165 | '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec95f8c965cc920e', '97bcf97c3598082c95f8e1cfcc920f', | ||
166 | '97bd097bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec9210c965cc920e', | ||
167 | '97bcf97c3598082c95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', | ||
168 | '97b6b97bd19801ec9210c965cc920e', '97bcf97c3598082c95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', | ||
169 | '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', | ||
170 | '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', | ||
171 | '97bcf97c359801ec95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', | ||
172 | '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd097bd07f595b0b6fc920fb0722', | ||
173 | '9778397bd097c36b0b6fc9210c8dc2', '9778397bd19801ec9210c9274c920e', '97b6b97bd19801ec95f8c965cc920f', | ||
174 | '97bd07f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c920e', | ||
175 | '97b6b97bd19801ec95f8c965cc920f', '97bd07f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', | ||
176 | '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bd07f1487f595b0b0bc920fb0722', | ||
177 | '7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', | ||
178 | '97bcf7f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', | ||
179 | '97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', | ||
180 | '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f531b0b0bb0b6fb0722', | ||
181 | '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', | ||
182 | '97bcf7f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', | ||
183 | '97b6b97bd19801ec9210c9274c920e', '97bcf7f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', | ||
184 | '9778397bd097c36b0b6fc9210c91aa', '97b6b97bd197c36c9210c9274c920e', '97bcf7f0e47f531b0b0bb0b6fb0722', | ||
185 | '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c920e', | ||
186 | '97b6b7f0e47f531b0723b0b6fb0722', '7f0e37f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', | ||
187 | '9778397bd097c36b0b70c9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e37f1487f595b0b0bb0b6fb0722', | ||
188 | '7f0e397bd097c35b0b6fc9210c8dc2', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', | ||
189 | '7f0e27f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', | ||
190 | '97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', | ||
191 | '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', | ||
192 | '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', | ||
193 | '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9274c91aa', | ||
194 | '97b6b7f0e47f531b0723b0787b0721', '7f0e27f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', | ||
195 | '9778397bd097c36b0b6fc9210c91aa', '97b6b7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', | ||
196 | '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c8dc2', '977837f0e37f149b0723b0787b0721', | ||
197 | '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f5307f595b0b0bc920fb0722', '7f0e397bd097c35b0b6fc9210c8dc2', | ||
198 | '977837f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e37f1487f595b0b0bb0b6fb0722', | ||
199 | '7f0e397bd097c35b0b6fc9210c8dc2', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', | ||
200 | '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '977837f0e37f14998082b0787b06bd', | ||
201 | '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', | ||
202 | '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', | ||
203 | '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', | ||
204 | '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14998082b0787b06bd', | ||
205 | '7f07e7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', | ||
206 | '977837f0e37f14998082b0723b06bd', '7f07e7f0e37f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', | ||
207 | '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b0721', | ||
208 | '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f1487f595b0b0bb0b6fb0722', '7f0e37f0e37f14898082b0723b02d5', | ||
209 | '7ec967f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f1487f531b0b0bb0b6fb0722', | ||
210 | '7f0e37f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', | ||
211 | '7f0e37f1487f531b0b0bb0b6fb0722', '7f0e37f0e37f14898082b072297c35', '7ec967f0e37f14998082b0787b06bd', | ||
212 | '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e37f0e37f14898082b072297c35', | ||
213 | '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', | ||
214 | '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f149b0723b0787b0721', | ||
215 | '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14998082b0723b06bd', | ||
216 | '7f07e7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', '7f0e37f0e366aa89801eb072297c35', | ||
217 | '7ec967f0e37f14998082b0723b06bd', '7f07e7f0e37f14998083b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', | ||
218 | '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14898082b0723b02d5', '7f07e7f0e37f14998082b0787b0721', | ||
219 | '7f07e7f0e47f531b0723b0b6fb0722', '7f0e36665b66aa89801e9808297c35', '665f67f0e37f14898082b0723b02d5', | ||
220 | '7ec967f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e36665b66a449801e9808297c35', | ||
221 | '665f67f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', | ||
222 | '7f0e36665b66a449801e9808297c35', '665f67f0e37f14898082b072297c35', '7ec967f0e37f14998082b0787b06bd', | ||
223 | '7f07e7f0e47f531b0723b0b6fb0721', '7f0e26665b66a449801e9808297c35', '665f67f0e37f1489801eb072297c35', | ||
224 | '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722'], | ||
225 | |||
226 | /** | ||
227 | * 数字转中文速查表 | ||
228 | * @Array Of Property | ||
229 | * @trans ['日','一','二','三','四','五','六','七','八','九','十'] | ||
230 | * @return Cn string | ||
231 | */ | ||
232 | nStr1: ["\u65e5", "\u4e00", "\u4e8c", "\u4e09", "\u56db", "\u4e94", "\u516d", "\u4e03", "\u516b", "\u4e5d", "\u5341"], | ||
233 | |||
234 | /** | ||
235 | * 日期转农历称呼速查表 | ||
236 | * @Array Of Property | ||
237 | * @trans ['初','十','廿','卅'] | ||
238 | * @return Cn string | ||
239 | */ | ||
240 | nStr2: ["\u521d", "\u5341", "\u5eff", "\u5345"], | ||
241 | |||
242 | /** | ||
243 | * 月份转农历称呼速查表 | ||
244 | * @Array Of Property | ||
245 | * @trans ['正','一','二','三','四','五','六','七','八','九','十','冬','腊'] | ||
246 | * @return Cn string | ||
247 | */ | ||
248 | nStr3: ["\u6b63", "\u4e8c", "\u4e09", "\u56db", "\u4e94", "\u516d", "\u4e03", "\u516b", "\u4e5d", "\u5341", "\u51ac", "\u814a"], | ||
249 | |||
250 | /** | ||
251 | * 返回农历y年一整年的总天数 | ||
252 | * @param y lunar Year | ||
253 | * @return Number | ||
254 | * @eg:var count = calendar.lYearDays(1987) ;//count=387 | ||
255 | */ | ||
256 | lYearDays: function (y) { | ||
257 | let i, sum = 348; | ||
258 | for (i = 0x8000; i > 0x8; i >>= 1) { | ||
259 | sum += (this.lunarInfo[y - 1900] & i) ? 1 : 0; | ||
260 | } | ||
261 | return (sum + this.leapDays(y)); | ||
262 | }, | ||
263 | |||
264 | /** | ||
265 | * 返回农历y年闰月是哪个月;若y年没有闰月 则返回0 | ||
266 | * @param y lunar Year | ||
267 | * @return Number (0-12) | ||
268 | * @eg:var leapMonth = calendar.leapMonth(1987) ;//leapMonth=6 | ||
269 | */ | ||
270 | leapMonth: function (y) { //闰字编码 \u95f0 | ||
271 | return (this.lunarInfo[y - 1900] & 0xf); | ||
272 | }, | ||
273 | |||
274 | /** | ||
275 | * 返回农历y年闰月的天数 若该年没有闰月则返回0 | ||
276 | * @param y lunar Year | ||
277 | * @return Number (0、29、30) | ||
278 | * @eg:var leapMonthDay = calendar.leapDays(1987) ;//leapMonthDay=29 | ||
279 | */ | ||
280 | leapDays: function (y) { | ||
281 | if (this.leapMonth(y)) { | ||
282 | return ((this.lunarInfo[y - 1900] & 0x10000) ? 30 : 29); | ||
283 | } | ||
284 | return (0); | ||
285 | }, | ||
286 | |||
287 | /** | ||
288 | * 返回农历y年m月(非闰月)的总天数,计算m为闰月时的天数请使用leapDays方法 | ||
289 | * @param y lunar Year | ||
290 | * @param m lunar Month | ||
291 | * @return Number (-1、29、30) | ||
292 | * @eg:var MonthDay = calendar.monthDays(1987,9) ;//MonthDay=29 | ||
293 | */ | ||
294 | monthDays: function (y, m) { | ||
295 | if (m > 12 || m < 1) { | ||
296 | return -1 | ||
297 | }//月份参数从1至12,参数错误返回-1 | ||
298 | return ((this.lunarInfo[y - 1900] & (0x10000 >> m)) ? 30 : 29); | ||
299 | }, | ||
300 | |||
301 | /** | ||
302 | * 返回公历(!)y年m月的天数 | ||
303 | * @param y solar Year | ||
304 | * @param m solar Month | ||
305 | * @return Number (-1、28、29、30、31) | ||
306 | * @eg:var solarMonthDay = calendar.leapDays(1987) ;//solarMonthDay=30 | ||
307 | */ | ||
308 | solarDays: function (y, m) { | ||
309 | if (m > 12 || m < 1) { | ||
310 | return -1 | ||
311 | } //若参数错误 返回-1 | ||
312 | const ms = m - 1; | ||
313 | if (ms === 1) { //2月份的闰平规律测算后确认返回28或29 | ||
314 | return (((y % 4 === 0) && (y % 100 !== 0) || (y % 400 === 0)) ? 29 : 28); | ||
315 | } else { | ||
316 | return (this.solarMonth[ms]); | ||
317 | } | ||
318 | }, | ||
319 | |||
320 | /** | ||
321 | * 农历年份转换为干支纪年 | ||
322 | * @param lYear 农历年的年份数 | ||
323 | * @return Cn string | ||
324 | */ | ||
325 | toGanZhiYear: function (lYear) { | ||
326 | var ganKey = (lYear - 3) % 10; | ||
327 | var zhiKey = (lYear - 3) % 12; | ||
328 | if (ganKey === 0) ganKey = 10;//如果余数为0则为最后一个天干 | ||
329 | if (zhiKey === 0) zhiKey = 12;//如果余数为0则为最后一个地支 | ||
330 | return this.Gan[ganKey - 1] + this.Zhi[zhiKey - 1]; | ||
331 | |||
332 | }, | ||
333 | |||
334 | /** | ||
335 | * 公历月、日判断所属星座 | ||
336 | * @param cMonth [description] | ||
337 | * @param cDay [description] | ||
338 | * @return Cn string | ||
339 | */ | ||
340 | toAstro: function (cMonth, cDay) { | ||
341 | const s = "\u9b54\u7faf\u6c34\u74f6\u53cc\u9c7c\u767d\u7f8a\u91d1\u725b\u53cc\u5b50\u5de8\u87f9\u72ee\u5b50\u5904\u5973\u5929\u79e4\u5929\u874e\u5c04\u624b\u9b54\u7faf"; | ||
342 | const arr = [20, 19, 21, 21, 21, 22, 23, 23, 23, 23, 22, 22]; | ||
343 | return s.substr(cMonth * 2 - (cDay < arr[cMonth - 1] ? 2 : 0), 2) + "\u5ea7";//座 | ||
344 | }, | ||
345 | |||
346 | /** | ||
347 | * 传入offset偏移量返回干支 | ||
348 | * @param offset 相对甲子的偏移量 | ||
349 | * @return Cn string | ||
350 | */ | ||
351 | toGanZhi: function (offset) { | ||
352 | return this.Gan[offset % 10] + this.Zhi[offset % 12]; | ||
353 | }, | ||
354 | |||
355 | /** | ||
356 | * 传入公历(!)y年获得该年第n个节气的公历日期 | ||
357 | * @param y y公历年(1900-2100) | ||
358 | * @param n n二十四节气中的第几个节气(1~24);从n=1(小寒)算起 | ||
359 | * @return day Number | ||
360 | * @eg:var _24 = calendar.getTerm(1987,3) ;//_24=4;意即1987年2月4日立春 | ||
361 | */ | ||
362 | getTerm: function (y, n) { | ||
363 | if (y < 1900 || y > 2100) { | ||
364 | return -1; | ||
365 | } | ||
366 | if (n < 1 || n > 24) { | ||
367 | return -1; | ||
368 | } | ||
369 | const _table = this.sTermInfo[y - 1900]; | ||
370 | const _info = [ | ||
371 | parseInt('0x' + _table.substr(0, 5)).toString(), | ||
372 | parseInt('0x' + _table.substr(5, 5)).toString(), | ||
373 | parseInt('0x' + _table.substr(10, 5)).toString(), | ||
374 | parseInt('0x' + _table.substr(15, 5)).toString(), | ||
375 | parseInt('0x' + _table.substr(20, 5)).toString(), | ||
376 | parseInt('0x' + _table.substr(25, 5)).toString() | ||
377 | ]; | ||
378 | const _calcDay = [ | ||
379 | _info[0].substr(0, 1), | ||
380 | _info[0].substr(1, 2), | ||
381 | _info[0].substr(3, 1), | ||
382 | _info[0].substr(4, 2), | ||
383 | |||
384 | _info[1].substr(0, 1), | ||
385 | _info[1].substr(1, 2), | ||
386 | _info[1].substr(3, 1), | ||
387 | _info[1].substr(4, 2), | ||
388 | |||
389 | _info[2].substr(0, 1), | ||
390 | _info[2].substr(1, 2), | ||
391 | _info[2].substr(3, 1), | ||
392 | _info[2].substr(4, 2), | ||
393 | |||
394 | _info[3].substr(0, 1), | ||
395 | _info[3].substr(1, 2), | ||
396 | _info[3].substr(3, 1), | ||
397 | _info[3].substr(4, 2), | ||
398 | |||
399 | _info[4].substr(0, 1), | ||
400 | _info[4].substr(1, 2), | ||
401 | _info[4].substr(3, 1), | ||
402 | _info[4].substr(4, 2), | ||
403 | |||
404 | _info[5].substr(0, 1), | ||
405 | _info[5].substr(1, 2), | ||
406 | _info[5].substr(3, 1), | ||
407 | _info[5].substr(4, 2), | ||
408 | ]; | ||
409 | return parseInt(_calcDay[n - 1]); | ||
410 | }, | ||
411 | |||
412 | /** | ||
413 | * 传入农历数字月份返回汉语通俗表示法 | ||
414 | * @param m lunar month | ||
415 | * @return Cn string | ||
416 | * @eg:var cnMonth = calendar.toChinaMonth(12) ;//cnMonth='腊月' | ||
417 | */ | ||
418 | toChinaMonth: function (m) { // 月 => \u6708 | ||
419 | if (m > 12 || m < 1) { | ||
420 | return -1 | ||
421 | } //若参数错误 返回-1 | ||
422 | let s = this.nStr3[m - 1]; | ||
423 | s += "\u6708";//加上月字 | ||
424 | return s; | ||
425 | }, | ||
426 | |||
427 | /** | ||
428 | * 传入农历日期数字返回汉字表示法 | ||
429 | * @param d lunar day | ||
430 | * @return Cn string | ||
431 | * @eg:var cnDay = calendar.toChinaDay(21) ;//cnMonth='廿一' | ||
432 | */ | ||
433 | toChinaDay: function (d) { //日 => \u65e5 | ||
434 | let s; | ||
435 | switch (d) { | ||
436 | case 10: | ||
437 | s = '\u521d\u5341'; | ||
438 | break; | ||
439 | case 20: | ||
440 | s = '\u4e8c\u5341'; | ||
441 | break; | ||
442 | case 30: | ||
443 | s = '\u4e09\u5341'; | ||
444 | break; | ||
445 | default: | ||
446 | s = this.nStr2[Math.floor(d / 10)]; | ||
447 | s += this.nStr1[d % 10]; | ||
448 | } | ||
449 | return (s); | ||
450 | }, | ||
451 | |||
452 | /** | ||
453 | * 年份转生肖[!仅能大致转换] => 精确划分生肖分界线是“立春” | ||
454 | * @param y year | ||
455 | * @return Cn string | ||
456 | * @eg:var animal = calendar.getAnimal(1987) ;//animal='兔' | ||
457 | */ | ||
458 | getAnimal: function (y) { | ||
459 | return this.Animals[(y - 4) % 12] | ||
460 | }, | ||
461 | |||
462 | /** | ||
463 | * 传入阳历年月日获得详细的公历、农历object信息 <=>JSON | ||
464 | * !important! 公历参数区间1900.1.31~2100.12.31 | ||
465 | * @param yPara solar year | ||
466 | * @param mPara solar month | ||
467 | * @param dPara solar day | ||
468 | * @return JSON object | ||
469 | * @eg:console.log(calendar.solar2lunar(1987,11,01)); | ||
470 | */ | ||
471 | solar2lunar: function (yPara, mPara, dPara) { | ||
472 | let y = parseInt(yPara); | ||
473 | let m = parseInt(mPara); | ||
474 | let d = parseInt(dPara); | ||
475 | //年份限定、上限 | ||
476 | if (y < 1900 || y > 2100) { | ||
477 | return -1;// undefined转换为数字变为NaN | ||
478 | } | ||
479 | //公历传参最下限 | ||
480 | if (y === 1900 && m === 1 && d < 31) { | ||
481 | return -1; | ||
482 | } | ||
483 | |||
484 | //未传参 获得当天 | ||
485 | let objDate; | ||
486 | if (!y) { | ||
487 | objDate = new Date(); | ||
488 | } else { | ||
489 | objDate = new Date(y, parseInt(m) - 1, d); | ||
490 | } | ||
491 | let i, leap = 0, temp = 0; | ||
492 | //修正ymd参数 | ||
493 | y = objDate.getFullYear(); | ||
494 | m = objDate.getMonth() + 1; | ||
495 | d = objDate.getDate(); | ||
496 | let offset = (Date.UTC(objDate.getFullYear(), objDate.getMonth(), objDate.getDate()) - Date.UTC(1900, 0, 31)) / 86400000; | ||
497 | for (i = 1900; i < 2101 && offset > 0; i++) { | ||
498 | temp = this.lYearDays(i); | ||
499 | offset -= temp; | ||
500 | } | ||
501 | if (offset < 0) { | ||
502 | offset += temp; | ||
503 | i--; | ||
504 | } | ||
505 | |||
506 | //是否今天 | ||
507 | let isTodayObj = new Date(), | ||
508 | isToday = false; | ||
509 | if (isTodayObj.getFullYear() === y && isTodayObj.getMonth() + 1 === m && isTodayObj.getDate() === d) { | ||
510 | isToday = true; | ||
511 | } | ||
512 | //星期几 | ||
513 | let nWeek = objDate.getDay(), | ||
514 | cWeek = this.nStr1[nWeek]; | ||
515 | //数字表示周几顺应天朝周一开始的惯例 | ||
516 | if (nWeek === 0) { | ||
517 | nWeek = 7; | ||
518 | } | ||
519 | //农历年 | ||
520 | const year = i; | ||
521 | leap = this.leapMonth(i); //闰哪个月 | ||
522 | let isLeap = false; | ||
523 | |||
524 | //效验闰月 | ||
525 | for (i = 1; i < 13 && offset > 0; i++) { | ||
526 | //闰月 | ||
527 | if (leap > 0 && i === (leap + 1) && isLeap === false) { | ||
528 | --i; | ||
529 | isLeap = true; | ||
530 | temp = this.leapDays(year); //计算农历闰月天数 | ||
531 | } else { | ||
532 | temp = this.monthDays(year, i);//计算农历普通月天数 | ||
533 | } | ||
534 | //解除闰月 | ||
535 | if (isLeap === true && i === (leap + 1)) { | ||
536 | isLeap = false; | ||
537 | } | ||
538 | offset -= temp; | ||
539 | } | ||
540 | // 闰月导致数组下标重叠取反 | ||
541 | if (offset === 0 && leap > 0 && i === leap + 1) { | ||
542 | if (isLeap) { | ||
543 | isLeap = false; | ||
544 | } else { | ||
545 | isLeap = true; | ||
546 | --i; | ||
547 | } | ||
548 | } | ||
549 | if (offset < 0) { | ||
550 | offset += temp; | ||
551 | --i; | ||
552 | } | ||
553 | //农历月 | ||
554 | const month = i; | ||
555 | //农历日 | ||
556 | const day = offset + 1; | ||
557 | //天干地支处理 | ||
558 | const sm = m - 1; | ||
559 | const gzY = this.toGanZhiYear(year); | ||
560 | |||
561 | // 当月的两个节气 | ||
562 | // bugfix-2017-7-24 11:03:38 use lunar Year Param `y` Not `year` | ||
563 | const firstNode = this.getTerm(y, (m * 2 - 1));//返回当月「节」为几日开始 | ||
564 | const secondNode = this.getTerm(y, (m * 2));//返回当月「节」为几日开始 | ||
565 | |||
566 | // 依据12节气修正干支月 | ||
567 | let gzM = this.toGanZhi((y - 1900) * 12 + m + 11); | ||
568 | if (d >= firstNode) { | ||
569 | gzM = this.toGanZhi((y - 1900) * 12 + m + 12); | ||
570 | } | ||
571 | |||
572 | //传入的日期的节气与否 | ||
573 | let isTerm = false; | ||
574 | let Term = null; | ||
575 | if (firstNode === d) { | ||
576 | isTerm = true; | ||
577 | Term = this.solarTerm[m * 2 - 2]; | ||
578 | } | ||
579 | if (secondNode === d) { | ||
580 | isTerm = true; | ||
581 | Term = this.solarTerm[m * 2 - 1]; | ||
582 | } | ||
583 | //日柱 当月一日与 1900/1/1 相差天数 | ||
584 | const dayCyclical = Date.UTC(y, sm, 1, 0, 0, 0, 0) / 86400000 + 25567 + 10; | ||
585 | const gzD = this.toGanZhi(dayCyclical + d - 1); | ||
586 | //该日期所属的星座 | ||
587 | const astro = this.toAstro(m, d); | ||
588 | |||
589 | const solarDate = y + '-' + m + '-' + d; | ||
590 | const lunarDate = year + '-' + month + '-' + day; | ||
591 | |||
592 | const festival = this.festival; | ||
593 | const lFestival = this.lFestival; | ||
594 | |||
595 | const festivalDate = m + '-' + d; | ||
596 | const lunarFestivalDate = month + '-' + day; | ||
597 | |||
598 | return { | ||
599 | date: solarDate, | ||
600 | lunarDate: lunarDate, | ||
601 | festival: festival[festivalDate] ? festival[festivalDate].title : null, | ||
602 | lunarFestival: lFestival[lunarFestivalDate] ? lFestival[lunarFestivalDate].title : null, | ||
603 | 'lYear': year, | ||
604 | 'lMonth': month, | ||
605 | 'lDay': day, | ||
606 | 'Animal': this.getAnimal(year), | ||
607 | 'IMonthCn': (isLeap ? "\u95f0" : '') + this.toChinaMonth(month), | ||
608 | 'IDayCn': this.toChinaDay(day), | ||
609 | 'cYear': y, | ||
610 | 'cMonth': m, | ||
611 | 'cDay': d, | ||
612 | 'gzYear': gzY, | ||
613 | 'gzMonth': gzM, | ||
614 | 'gzDay': gzD, | ||
615 | 'isToday': isToday, | ||
616 | 'isLeap': isLeap, | ||
617 | 'nWeek': nWeek, | ||
618 | 'ncWeek': "\u661f\u671f" + cWeek, | ||
619 | 'isTerm': isTerm, | ||
620 | 'Term': Term, | ||
621 | 'astro': astro | ||
622 | }; | ||
623 | }, | ||
624 | |||
625 | /** | ||
626 | * 传入农历年月日以及传入的月份是否闰月获得详细的公历、农历object信息 <=>JSON | ||
627 | * !important! 参数区间1900.1.31~2100.12.1 | ||
628 | * @param y lunar year | ||
629 | * @param m lunar month | ||
630 | * @param d lunar day | ||
631 | * @param isLeapMonth lunar month is leap or not.[如果是农历闰月第四个参数赋值true即可] | ||
632 | * @return JSON object | ||
633 | * @eg:console.log(calendar.lunar2solar(1987,9,10)); | ||
634 | */ | ||
635 | lunar2solar: function (y, m, d, isLeapMonth) { | ||
636 | y = parseInt(y) | ||
637 | m = parseInt(m) | ||
638 | d = parseInt(d) | ||
639 | isLeapMonth = !!isLeapMonth; | ||
640 | const leapOffset = 0; | ||
641 | const leapMonth = this.leapMonth(y); | ||
642 | const leapDay = this.leapDays(y); | ||
643 | if (isLeapMonth && (leapMonth !== m)) { | ||
644 | return -1; | ||
645 | }//传参要求计算该闰月公历 但该年得出的闰月与传参的月份并不同 | ||
646 | if (y === 2100 && m === 12 && d > 1 || y === 1900 && m === 1 && d < 31) { | ||
647 | return -1; | ||
648 | }//超出了最大极限值 | ||
649 | const day = this.monthDays(y, m); | ||
650 | let _day = day; | ||
651 | //bugFix 2016-9-25 | ||
652 | //if month is leap, _day use leapDays method | ||
653 | if (isLeapMonth) { | ||
654 | _day = this.leapDays(y, m); | ||
655 | } | ||
656 | if (y < 1900 || y > 2100 || d > _day) { | ||
657 | return -1; | ||
658 | }//参数合法性效验 | ||
659 | |||
660 | //计算农历的时间差 | ||
661 | let offset = 0; | ||
662 | let i; | ||
663 | for (i = 1900; i < y; i++) { | ||
664 | offset += this.lYearDays(i); | ||
665 | } | ||
666 | let leap = 0, isAdd = false; | ||
667 | for (i = 1; i < m; i++) { | ||
668 | leap = this.leapMonth(y); | ||
669 | if (!isAdd) {//处理闰月 | ||
670 | if (leap <= i && leap > 0) { | ||
671 | offset += this.leapDays(y); | ||
672 | isAdd = true; | ||
673 | } | ||
674 | } | ||
675 | offset += this.monthDays(y, i); | ||
676 | } | ||
677 | //转换闰月农历 需补充该年闰月的前一个月的时差 | ||
678 | if (isLeapMonth) { | ||
679 | offset += day; | ||
680 | } | ||
681 | //1900年农历正月一日的公历时间为1900年1月30日0时0分0秒(该时间也是本农历的最开始起始点) | ||
682 | const strap = Date.UTC(1900, 1, 30, 0, 0, 0); | ||
683 | const calObj = new Date((offset + d - 31) * 86400000 + strap); | ||
684 | const cY = calObj.getUTCFullYear(); | ||
685 | const cM = calObj.getUTCMonth() + 1; | ||
686 | const cD = calObj.getUTCDate(); | ||
687 | |||
688 | return this.solar2lunar(cY, cM, cD); | ||
689 | } | ||
690 | }; | ||
691 | |||
692 | export default calendar | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
src/components/calendar/index.vue
deleted
100644 → 0
1 | |||
2 | <template> | ||
3 | <el-calendar v-model="date"> | ||
4 | <template slot="dateCell" slot-scope="{date, data}"> | ||
5 | <div :class="{ selected: isSelected(date, data) }"> | ||
6 | <div class="solar">{{ data.day.split('-')[2] }}</div> | ||
7 | <div class="lunar" :class="{ festival: isFestival(date, data) }">{{ solarToLunar(date, data) }}</div> | ||
8 | </div> | ||
9 | </template> | ||
10 | </el-calendar> | ||
11 | </template> | ||
12 | |||
13 | <script> | ||
14 | import calendar from './calendar' | ||
15 | export default { | ||
16 | name: 'calendar', | ||
17 | data () { | ||
18 | return { | ||
19 | date: new Date(), | ||
20 | // 根据selectedDates设置选中日期 | ||
21 | selectedDates: [] | ||
22 | } | ||
23 | }, | ||
24 | methods: { | ||
25 | // 是否选中日期 | ||
26 | isSelected: function (slotDate, slotData) { | ||
27 | return this.selectedDates.includes(slotData.day) | ||
28 | }, | ||
29 | // 是否节假日 | ||
30 | isFestival (slotDate, slotData) { | ||
31 | let solarDayArr = slotData.day.split('-'); | ||
32 | let lunarDay = calendar.solar2lunar(solarDayArr[0], solarDayArr[1], solarDayArr[2]) | ||
33 | |||
34 | // 公历节日\农历节日\农历节气 | ||
35 | let festAndTerm = []; | ||
36 | festAndTerm.push(lunarDay.festival == null ? '' : ' ' + lunarDay.festival) | ||
37 | festAndTerm.push(lunarDay.lunarFestival == null ? '' : '' + lunarDay.lunarFestival) | ||
38 | festAndTerm.push(lunarDay.Term == null ? '' : '' + lunarDay.Term) | ||
39 | festAndTerm = festAndTerm.join('') | ||
40 | |||
41 | return festAndTerm != '' | ||
42 | }, | ||
43 | // 公历转农历 | ||
44 | solarToLunar (slotDate, slotData) { | ||
45 | let solarDayArr = slotData.day.split('-'); | ||
46 | let lunarDay = calendar.solar2lunar(solarDayArr[0], solarDayArr[1], solarDayArr[2]) | ||
47 | |||
48 | // 农历日期 | ||
49 | let lunarMD = lunarDay.IMonthCn + lunarDay.IDayCn | ||
50 | |||
51 | // 公历节日\农历节日\农历节气 | ||
52 | let festAndTerm = []; | ||
53 | festAndTerm.push(lunarDay.festival == null ? '' : ' ' + lunarDay.festival) | ||
54 | festAndTerm.push(lunarDay.lunarFestival == null ? '' : '' + lunarDay.lunarFestival) | ||
55 | festAndTerm.push(lunarDay.Term == null ? '' : '' + lunarDay.Term) | ||
56 | festAndTerm = festAndTerm.join('') | ||
57 | |||
58 | return festAndTerm == '' ? lunarMD : festAndTerm | ||
59 | } | ||
60 | } | ||
61 | } | ||
62 | </script> | ||
63 | |||
64 | <style scoped> | ||
65 | /**隐藏上一月、本月、下一月*/ | ||
66 | .el-calendar__button-group { | ||
67 | display: none; | ||
68 | } | ||
69 | |||
70 | /deep/.el-calendar__body { | ||
71 | padding: 8px; | ||
72 | } | ||
73 | |||
74 | /deep/.el-calendar-table .el-calendar-day { | ||
75 | height: auto; | ||
76 | padding: 5px; | ||
77 | } | ||
78 | |||
79 | /**月份居中*/ | ||
80 | .el-calendar__title { | ||
81 | width: 100%; | ||
82 | text-align: center; | ||
83 | } | ||
84 | |||
85 | /deep/.el-calendar-table thead th { | ||
86 | padding: 0 0 6px 0 !important; | ||
87 | } | ||
88 | |||
89 | /deep/.el-calendar-day { | ||
90 | padding: 3px !important; | ||
91 | } | ||
92 | |||
93 | /deep/.el-calendar-table td.is-today { | ||
94 | font-weight: 700; | ||
95 | } | ||
96 | |||
97 | /deep/.el-calendar-table td.is-selected { | ||
98 | background-color: rgb(179, 216, 255); | ||
99 | } | ||
100 | |||
101 | /deep/.el-calendar__header { | ||
102 | padding: 8px 15px; | ||
103 | } | ||
104 | |||
105 | /**日期div的样式*/ | ||
106 | .el-calendar-table tr td:first-child { | ||
107 | border-left: 0px; | ||
108 | } | ||
109 | |||
110 | .el-calendar-table td { | ||
111 | min-height: 110px; | ||
112 | min-width: 110px; | ||
113 | border-right: 0px; | ||
114 | } | ||
115 | |||
116 | .el-calendar-table td.is-selected { | ||
117 | background-color: white; | ||
118 | } | ||
119 | |||
120 | .el-calendar-table .el-calendar-day { | ||
121 | padding: 0px; | ||
122 | text-align: center; | ||
123 | } | ||
124 | |||
125 | .el-calendar-table .el-calendar-day>div { | ||
126 | text-align: center | ||
127 | } | ||
128 | |||
129 | /**日期div的样式-公历*/ | ||
130 | .el-calendar-table .el-calendar-day>div .solar { | ||
131 | text-align: center; | ||
132 | margin-top: 3px; | ||
133 | } | ||
134 | |||
135 | /**日期div的样式-农历*/ | ||
136 | .el-calendar-table .el-calendar-day>div .lunar { | ||
137 | padding-top: 5px; | ||
138 | font-size: 12px; | ||
139 | text-align: center; | ||
140 | margin-bottom: 5px; | ||
141 | } | ||
142 | |||
143 | /**日期div的样式-选中*/ | ||
144 | .el-calendar-table .el-calendar-day>div.selected { | ||
145 | background-color: #fef2f2; | ||
146 | border: 3px solid #fb0; | ||
147 | border-radius: 20px; | ||
148 | text-align: center | ||
149 | } | ||
150 | |||
151 | /**本月周末设置为红色*/ | ||
152 | /* .el-calendar-table .current:nth-last-child(-n+2) .solar { | ||
153 | color: red; | ||
154 | } */ | ||
155 | |||
156 | /**本月农历设置为灰色*/ | ||
157 | .el-calendar-table .current .lunar { | ||
158 | color: #606266; | ||
159 | font-size: 12px; | ||
160 | } | ||
161 | |||
162 | /**本月农历节日设置为红色*/ | ||
163 | .el-calendar-table .current .lunar.festival { | ||
164 | color: red; | ||
165 | } | ||
166 | |||
167 | .el-calendar-table td { | ||
168 | border-right: none !important; | ||
169 | } | ||
170 | |||
171 | /**禁用点击效果*/ | ||
172 | /*.el-calendar-table td {*/ | ||
173 | /*pointer-events: none;*/ | ||
174 | /*}*/ | ||
175 | </style> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -9,10 +9,17 @@ | ... | @@ -9,10 +9,17 @@ |
9 | </div> | 9 | </div> |
10 | <div class="right-menu"> | 10 | <div class="right-menu"> |
11 | <svg-icon class="function" icon-class='function' /> | 11 | <svg-icon class="function" icon-class='function' /> |
12 | <div class="avatar-wrapper right-menu-item hover-effect"> | 12 | <el-dropdown class="avatar-container right-menu-item hover-effect" trigger="hover" @command="handleCommand"> |
13 | <div class="avatar-wrapper"> | ||
14 | <span style="padding-right:10px">{{ name }}</span> | ||
13 | <img :src="avatar + '?imageView2/1/w/80/h/80'" class="user-avatar" /> | 15 | <img :src="avatar + '?imageView2/1/w/80/h/80'" class="user-avatar" /> |
14 | <span style="margin-left: 10px;">{{ name }}</span> | 16 | <!-- <i class="el-icon-caret-bottom" /> --> |
15 | </div> | 17 | </div> |
18 | <el-dropdown-menu slot="dropdown"> | ||
19 | <el-dropdown-item command="a">个人中心</el-dropdown-item> | ||
20 | </el-dropdown-menu> | ||
21 | </el-dropdown> | ||
22 | |||
16 | 23 | ||
17 | <svg-icon class="shutdown" icon-class='shutdown' /> | 24 | <svg-icon class="shutdown" icon-class='shutdown' /> |
18 | </div> | 25 | </div> |
... | @@ -60,11 +67,6 @@ export default { | ... | @@ -60,11 +67,6 @@ export default { |
60 | if (command == 'a') { | 67 | if (command == 'a') { |
61 | //个人中心 | 68 | //个人中心 |
62 | this.$router.push({ name: 'personal' }) | 69 | this.$router.push({ name: 'personal' }) |
63 | } else if (command == 'f') { | ||
64 | // 退出 | ||
65 | this.$store.dispatch('user/logout') | ||
66 | this.$router.push(`/login?redirect=${this.$route.fullPath}`) | ||
67 | window.sessionStorage.clear() | ||
68 | } | 70 | } |
69 | } | 71 | } |
70 | } | 72 | } | ... | ... |
... | @@ -38,13 +38,7 @@ export const constantRoutes = [ | ... | @@ -38,13 +38,7 @@ export const constantRoutes = [ |
38 | name: 'workFrameView', | 38 | name: 'workFrameView', |
39 | hidden: true, | 39 | hidden: true, |
40 | meta: { title: '发起申请' } | 40 | meta: { title: '发起申请' } |
41 | } | 41 | }, |
42 | ] | ||
43 | /** | ||
44 | * asyncRoutes | ||
45 | * the routes that need to be dynamically loaded based on user roles | ||
46 | */ | ||
47 | export const asyncRoutes = [ | ||
48 | { | 42 | { |
49 | path: '/', | 43 | path: '/', |
50 | component: Layout, | 44 | component: Layout, |
... | @@ -59,6 +53,12 @@ export const asyncRoutes = [ | ... | @@ -59,6 +53,12 @@ export const asyncRoutes = [ |
59 | } | 53 | } |
60 | ] | 54 | ] |
61 | }, | 55 | }, |
56 | ] | ||
57 | /** | ||
58 | * asyncRoutes | ||
59 | * the routes that need to be dynamically loaded based on user roles | ||
60 | */ | ||
61 | export const asyncRoutes = [ | ||
62 | { | 62 | { |
63 | path: '/ywbl', | 63 | path: '/ywbl', |
64 | id: '2', | 64 | id: '2', | ... | ... |
... | @@ -20,7 +20,8 @@ const actions = { | ... | @@ -20,7 +20,8 @@ const actions = { |
20 | return new Promise(resolve => { | 20 | return new Promise(resolve => { |
21 | // 将权限菜单数组转成路由树数据结构 | 21 | // 将权限菜单数组转成路由树数据结构 |
22 | let permission_tree = asyncRouter(getMenuInfo) | 22 | let permission_tree = asyncRouter(getMenuInfo) |
23 | commit('SET_ROUTES', permission_tree) | 23 | const mergeResult = _.cloneDeep(constantRoutes).concat(permission_tree); |
24 | commit('SET_ROUTES', mergeResult) | ||
24 | resolve(permission_tree) | 25 | resolve(permission_tree) |
25 | }) | 26 | }) |
26 | }, | 27 | }, | ... | ... |
... | @@ -6,7 +6,7 @@ export default function filterAsyncRouter (routers) { | ... | @@ -6,7 +6,7 @@ export default function filterAsyncRouter (routers) { |
6 | } else { | 6 | } else { |
7 | item.children = filterAsyncRouter(item.children) | 7 | item.children = filterAsyncRouter(item.children) |
8 | } | 8 | } |
9 | item.path = JSON.parse(item.metadata).path | 9 | item.path = JSON.parse(item.metadata).path ? JSON.parse(item.metadata).path : '/' |
10 | if (!item.parentId) { | 10 | if (!item.parentId) { |
11 | item.component = Layout | 11 | item.component = Layout |
12 | } else { | 12 | } else { | ... | ... |
... | @@ -39,6 +39,13 @@ service.interceptors.response.use( | ... | @@ -39,6 +39,13 @@ service.interceptors.response.use( |
39 | * 如果请求不成功,就在拦截器这里统一处理(组件的代码就不用关注错误的情况了) | 39 | * 如果请求不成功,就在拦截器这里统一处理(组件的代码就不用关注错误的情况了) |
40 | */ | 40 | */ |
41 | if (response.status == 200) { | 41 | if (response.status == 200) { |
42 | if (response.data.code == 500) { | ||
43 | Message({ | ||
44 | message: response.data.message, | ||
45 | type: 'error', | ||
46 | duration: 5 * 1000 | ||
47 | }) | ||
48 | } | ||
42 | return response.data; | 49 | return response.data; |
43 | } else { | 50 | } else { |
44 | handleErrorData(response.data); | 51 | handleErrorData(response.data); | ... | ... |
src/views/home/components/addProject.vue
0 → 100644
1 | <template> | ||
2 | <dialogBox title="配置常办项目" @submitForm="submitForm" saveButton="保存" :isFullscreen="false" width="50%" | ||
3 | @closeDialog="closeDialog" v-model="value"> | ||
4 | <el-form ref="ruleForm" :model="ruleForm" label-width="100px"> | ||
5 | <el-tree :data="projectList" show-checkbox node-key="id" ref="tree" default-expand-all :props="defaultProps" | ||
6 | @check-change="handleClick"></el-tree> | ||
7 | </el-form> | ||
8 | </dialogBox> | ||
9 | </template> | ||
10 | <script> | ||
11 | import { getMenuInfo } from "@/api/user.js"; | ||
12 | import { saveFrequentProjectsList } from "@/api/home.js"; | ||
13 | export default { | ||
14 | props: { | ||
15 | value: { type: Boolean, default: false }, | ||
16 | bindItem: { type: Array, default: [] } | ||
17 | }, | ||
18 | data () { | ||
19 | return { | ||
20 | projectList: [], | ||
21 | ruleForm: { | ||
22 | |||
23 | }, | ||
24 | checkedItem: [], | ||
25 | defaultProps: { | ||
26 | children: "children", | ||
27 | label: "name", | ||
28 | disabled: function (data, node) { | ||
29 | if (data.children && data.children.length > 0) { | ||
30 | return true | ||
31 | } else { | ||
32 | return false | ||
33 | } | ||
34 | } | ||
35 | }, | ||
36 | uniqueValue: ''//最后拿到的唯一选择的moduldCode值,相当于id | ||
37 | } | ||
38 | }, | ||
39 | mounted () { | ||
40 | this.queryClick() | ||
41 | this.dealCheckedItem(); | ||
42 | }, | ||
43 | methods: { | ||
44 | submitForm () { | ||
45 | var checkedNodes = this.$refs.tree.getCheckedNodes(); | ||
46 | if (checkedNodes.length > 6) { | ||
47 | this.$message.error("最多选择6个项目!"); | ||
48 | return | ||
49 | } | ||
50 | saveFrequentProjectsList(checkedNodes).then(res => { | ||
51 | if (res.code == 200) { | ||
52 | this.$parent.queryProjectList(); | ||
53 | this.$message.success("保存成功"); | ||
54 | this.$emit("input", false); | ||
55 | } else { | ||
56 | this.$message.error(res.message); | ||
57 | } | ||
58 | }) | ||
59 | }, | ||
60 | queryClick () { | ||
61 | getMenuInfo().then(res => { | ||
62 | this.projectList = res.result | ||
63 | }) | ||
64 | }, | ||
65 | dealCheckedItem () { | ||
66 | }, | ||
67 | //关闭窗口 | ||
68 | closeDialog () { | ||
69 | this.$emit("input", false); | ||
70 | }, | ||
71 | //节点选择状态发生改变时 | ||
72 | handleClick (data, checked, node) { | ||
73 | var checkedNodes = this.$refs.tree.getCheckedNodes(); | ||
74 | if (checked) { | ||
75 | checkedNodes.push(data); | ||
76 | } | ||
77 | this.$refs.tree.setCheckedNodes(checkedNodes); | ||
78 | console.log(this.$refs.tree.getCheckedNodes()); | ||
79 | }, | ||
80 | } | ||
81 | } | ||
82 | </script> | ||
83 | <style scoped lang='scss'> | ||
84 | /deep/.el-tree-node.is-expanded>.el-tree-node__children { | ||
85 | display: flex; | ||
86 | flex-wrap: wrap; | ||
87 | } | ||
88 | </style> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -14,7 +14,7 @@ | ... | @@ -14,7 +14,7 @@ |
14 | 14 | ||
15 | li { | 15 | li { |
16 | width: 32.5%; | 16 | width: 32.5%; |
17 | height: 118px; | 17 | height: 90px; |
18 | @include flex-center; | 18 | @include flex-center; |
19 | flex-direction: column; | 19 | flex-direction: column; |
20 | color: #fff; | 20 | color: #fff; |
... | @@ -58,6 +58,7 @@ | ... | @@ -58,6 +58,7 @@ |
58 | width: 75%; | 58 | width: 75%; |
59 | } | 59 | } |
60 | 60 | ||
61 | |||
61 | ul { | 62 | ul { |
62 | li { | 63 | li { |
63 | line-height: 36px; | 64 | line-height: 36px; |
... | @@ -71,12 +72,14 @@ | ... | @@ -71,12 +72,14 @@ |
71 | 72 | ||
72 | .box-mountNode { | 73 | .box-mountNode { |
73 | flex: 1; | 74 | flex: 1; |
74 | height: calc(100% - 510px); | 75 | height: calc(100% - 490px); |
75 | } | 76 | } |
76 | 77 | ||
77 | .home-right { | 78 | .home-right { |
78 | padding-left: 4px; | 79 | padding-left: 4px; |
79 | width: 30%; | 80 | width: 30%; |
81 | display: flex; | ||
82 | flex-direction: column; | ||
80 | 83 | ||
81 | .list-title { | 84 | .list-title { |
82 | overflow: hidden; | 85 | overflow: hidden; |
... | @@ -84,6 +87,16 @@ | ... | @@ -84,6 +87,16 @@ |
84 | white-space: nowrap; | 87 | white-space: nowrap; |
85 | } | 88 | } |
86 | 89 | ||
90 | #loginTime { | ||
91 | height: 100%; | ||
92 | padding-bottom: 90px; | ||
93 | } | ||
94 | |||
95 | .dynamicInfo { | ||
96 | flex: 1; | ||
97 | height: 100%; | ||
98 | } | ||
99 | |||
87 | ul { | 100 | ul { |
88 | li { | 101 | li { |
89 | line-height: 36px; | 102 | line-height: 36px; | ... | ... |
... | @@ -3,28 +3,37 @@ | ... | @@ -3,28 +3,37 @@ |
3 | <div class="home-left"> | 3 | <div class="home-left"> |
4 | <el-row :gutter="8"> | 4 | <el-row :gutter="8"> |
5 | <el-col :span="12"> | 5 | <el-col :span="12"> |
6 | <el-card shadow="hover" :body-style="{ padding: '0' }"> | 6 | <el-card shadow="hover" :body-style="{ padding: '0' }" style="height:260px"> |
7 | <div slot="header" class="flexst"> | ||
8 | <h5 class="title">常办项目</h5> | ||
9 | <el-button type="primary" @click="setFrequencyProject()">配置常办</el-button> | ||
10 | </div> | ||
7 | <ul class="workbench flexst"> | 11 | <ul class="workbench flexst"> |
8 | <li v-for="(item, index) in newsListData" class="pointer" :key="index" | 12 | <li v-for="(item, index) in projectList" class="pointer" :key="index" |
9 | :style="{ backgroundColor: item.color }"> | 13 | :style="{ backgroundColor: newsListColor[index] }"> |
10 | <i class="el-icon-s-claim"></i> | 14 | <i class="el-icon-s-claim"></i> |
11 | {{ item.title }} | 15 | {{ item.name }} |
12 | </li> | 16 | </li> |
13 | </ul> | 17 | </ul> |
14 | </el-card> | 18 | </el-card> |
15 | </el-col> | 19 | </el-col> |
16 | <el-col :span="12"> | 20 | <el-col :span="12"> |
17 | <el-card shadow="hover" style="height:247px"> | 21 | <el-card shadow="hover" style="height:260px"> |
18 | <div slot="header" class="flexst"> | 22 | <div slot="header" class="flexst"> |
19 | <h5 class="title">系统通知</h5> | 23 | <h5 class="title">系统通知</h5> |
20 | <i class="el-icon-s-unfold pointer"></i> | 24 | <el-popover placement="right" width="50" trigger="hover"> |
25 | <ul class="pointer"> | ||
26 | <li @click="$store.dispatch('tagsView/addView', moreNotice)">查看更多</li> | ||
27 | </ul> | ||
28 | <i class="el-icon-s-unfold pointer" slot="reference"></i> | ||
29 | </el-popover> | ||
21 | </div> | 30 | </div> |
22 | <ul> | 31 | <ul> |
23 | <li v-for="(item, index) in noticeList" :key="index" @click="handleNotice(item)" class="flexst pointer"> | 32 | <li v-for="(item, index) in noticeList" :key="index" @click="handleNotice(item)" class="flexst pointer"> |
24 | <p class="list-title">{{ item.noticeTitle }}</p> | 33 | <p class="list-title">{{ item.noticeTitle }}</p> |
25 | <p class="marginZL15">{{ item.noticePublishTime.substring(0, 10) }}</p> | 34 | <p class="marginZL15">{{ item.noticePublishTime.substring(0, 10) }}</p> |
26 | <p v-if="item.userBrowse == '1'" style="color:red">未读</p> | 35 | <p v-if="item.userBrowse == '1'" style="color:red">未读</p> |
27 | <p v-else>已读</p> | 36 | <p v-else style="color:green">已读</p> |
28 | </li> | 37 | </li> |
29 | </ul> | 38 | </ul> |
30 | </el-card> | 39 | </el-card> |
... | @@ -32,7 +41,7 @@ | ... | @@ -32,7 +41,7 @@ |
32 | </el-row> | 41 | </el-row> |
33 | <el-row :gutter="8" class="marginTop10"> | 42 | <el-row :gutter="8" class="marginTop10"> |
34 | <el-col :span="12"> | 43 | <el-col :span="12"> |
35 | <el-card shadow="hover" style="height:247px"> | 44 | <el-card shadow="hover" style="height:215px"> |
36 | <div slot="header" class="flexst"> | 45 | <div slot="header" class="flexst"> |
37 | <h5 class="title">待办事项</h5> | 46 | <h5 class="title">待办事项</h5> |
38 | <i class="el-icon-s-unfold pointer"></i> | 47 | <i class="el-icon-s-unfold pointer"></i> |
... | @@ -46,10 +55,15 @@ | ... | @@ -46,10 +55,15 @@ |
46 | </el-card> | 55 | </el-card> |
47 | </el-col> | 56 | </el-col> |
48 | <el-col :span="12"> | 57 | <el-col :span="12"> |
49 | <el-card shadow="hover" style="height:247px"> | 58 | <el-card shadow="hover" style="height:215px"> |
50 | <div slot="header" class="flexst"> | 59 | <div slot="header" class="flexst"> |
51 | <h5 class="title">政策法规</h5> | 60 | <h5 class="title">政策法规</h5> |
52 | <i class="el-icon-s-unfold pointer"></i> | 61 | <el-popover placement="right" width="50" trigger="hover"> |
62 | <ul class="pointer"> | ||
63 | <li @click="$store.dispatch('tagsView/addView', moreNotice)">查看更多</li> | ||
64 | </ul> | ||
65 | <i class="el-icon-s-unfold pointer" slot="reference"></i> | ||
66 | </el-popover> | ||
53 | </div> | 67 | </div> |
54 | <ul> | 68 | <ul> |
55 | <li v-for="(item, index) in policyList" @click="handleView(item.noticeFileUrl)" :key="index" | 69 | <li v-for="(item, index) in policyList" @click="handleView(item.noticeFileUrl)" :key="index" |
... | @@ -67,65 +81,66 @@ | ... | @@ -67,65 +81,66 @@ |
67 | </el-card> | 81 | </el-card> |
68 | </div> | 82 | </div> |
69 | <div class="home-right"> | 83 | <div class="home-right"> |
70 | <calendar /> | 84 | <el-card shadow="hover"> |
71 | <el-card shadow="hover" class="marginTop10" style="height:345px"> | 85 | <div slot="header" class="flexst"> |
86 | <h5 class="title">用户登录时间</h5> | ||
87 | </div> | ||
88 | <div id="loginTime"></div> | ||
89 | </el-card> | ||
90 | <el-card class="marginTop10" shadow="hover"> | ||
72 | <div slot="header" class="flexst"> | 91 | <div slot="header" class="flexst"> |
73 | <h5 class="title">动态信息</h5> | 92 | <h5 class="title">动态信息</h5> |
74 | <i class="el-icon-s-unfold pointer"></i> | 93 | <i class="el-icon-s-unfold pointer"></i> |
75 | </div> | 94 | </div> |
76 | <ul> | 95 | <ul> |
77 | <li v-for="(item, index) in doneList" :key="index" class="flexst"> | 96 | <li v-for="(item, index) in doneList" :key="index" class="flexst dynamicInfo"> |
78 | <p class="right15">{{ item.dealTime.substring(0, 10) }}</p> | 97 | <p class="right15">{{ item.dealTime.substring(0, 10) }}</p> |
79 | <p class="list-title">{{ item.dealBusiness }} ({{ item.dealStep + '环节' }})</p> | 98 | <p class="list-title">{{ item.dealBusiness }} ({{ item.dealStep + '环节' }})</p> |
80 | </li> | 99 | </li> |
81 | </ul> | 100 | </ul> |
82 | </el-card> | 101 | </el-card> |
83 | </div> | 102 | </div> |
103 | <addDialog ref="addProject" v-model="projectDialog" :bindItem="projectList" /> | ||
84 | </div> | 104 | </div> |
85 | </template> | 105 | </template> |
86 | <script> | 106 | <script> |
87 | import * as G2 from '@antv/g2' | 107 | import * as G2 from '@antv/g2' |
88 | import calendar from '@/components/Calendar/index' | ||
89 | import vueSeamlessScroll from "vue-seamless-scroll" | 108 | import vueSeamlessScroll from "vue-seamless-scroll" |
90 | import { getHomeNoticeList, getHomeTodoList, getHomeDoneList } from "@/api/home.js"; | 109 | import { getHomeNoticeList, getHomeTodoList, getHomeDoneList, getHomeFrequentProjects } from "@/api/home.js"; |
91 | import { setReadStatus } from "@/api/notice.js"; | 110 | import { setReadStatus } from "@/api/notice.js"; |
111 | import addDialog from "./components/addProject.vue"; | ||
92 | export default { | 112 | export default { |
93 | name: 'home', | 113 | name: 'home', |
94 | components: { calendar, vueSeamlessScroll }, | 114 | components: { vueSeamlessScroll, addDialog }, |
95 | data () { | 115 | data () { |
96 | return { | 116 | return { |
97 | newsListData: [ | 117 | listData: [ |
98 | { | 118 | { |
99 | icon: '', | 119 | icon: '', |
100 | title: '任务', | 120 | title: '任务' |
101 | color: '#61AEFF' | ||
102 | }, | 121 | }, |
103 | { | 122 | { |
104 | icon: '', | 123 | icon: '', |
105 | title: '邮件', | 124 | title: '邮件' |
106 | color: '#43DEB3' | ||
107 | }, | 125 | }, |
108 | { | 126 | { |
109 | icon: '', | 127 | icon: '', |
110 | title: '消息', | 128 | title: '消息' |
111 | color: '#F3C143' | ||
112 | }, | 129 | }, |
113 | { | 130 | { |
114 | icon: '', | 131 | icon: '', |
115 | title: '日历', | 132 | title: '日历' |
116 | color: '#F09936' | ||
117 | }, | 133 | }, |
118 | { | 134 | { |
119 | icon: '', | 135 | icon: '', |
120 | title: '常用功能', | 136 | title: '常用功能' |
121 | color: '#9C92FF' | ||
122 | }, | 137 | }, |
123 | { | 138 | { |
124 | icon: '', | 139 | icon: '', |
125 | title: '申请', | 140 | title: '申请' |
126 | color: '#589FFF' | ||
127 | } | 141 | } |
128 | ], | 142 | ], |
143 | newsListColor: ['#61AEFF', '#43DEB3', '#F3C143', '#F09936', '#9C92FF', '#589FFF',], | ||
129 | chartData: [{ | 144 | chartData: [{ |
130 | year: '1991', | 145 | year: '1991', |
131 | value: 15468 | 146 | value: 15468 |
... | @@ -149,21 +164,28 @@ export default { | ... | @@ -149,21 +164,28 @@ export default { |
149 | value: 31056 | 164 | value: 31056 |
150 | }], | 165 | }], |
151 | // 系统通知 | 166 | // 系统通知 |
152 | noticeData: { | 167 | noticeData: {}, |
153 | 168 | noticeList: [],//通知列表 | |
169 | todoList: [],//待办列表 | ||
170 | doneList: [],//已办列表 | ||
171 | policyList: [],//法律法规列表 | ||
172 | projectList: [],//常办项目列表 | ||
173 | projectDialog: false, | ||
174 | moreNotice: { | ||
175 | fullPath: '/system/xttz/xttzview', | ||
176 | name: '系统通知', | ||
177 | path: '/system/xttz/xttzview', | ||
178 | meta: { title: '系统通知' } | ||
154 | }, | 179 | }, |
155 | noticeList: [], | ||
156 | todoList: [], | ||
157 | doneList: [], | ||
158 | policyList: [], | ||
159 | |||
160 | } | 180 | } |
161 | }, | 181 | }, |
162 | mounted () { | 182 | mounted () { |
163 | this.buildChart(); | 183 | this.buildChart();//构建图标 |
164 | this.queryTodoList(); | 184 | this.loginTimeChart() |
165 | this.queryDoneList(); | 185 | this.queryTodoList();//获取待办列表 |
166 | this.queryNoticeList(); | 186 | this.queryDoneList();//获取已办列表 |
187 | this.queryNoticeList();//获取通知、法律法规列表 | ||
188 | this.queryProjectList();//获取常办项目列表 | ||
167 | }, | 189 | }, |
168 | methods: { | 190 | methods: { |
169 | handleView (pdfUrl) { | 191 | handleView (pdfUrl) { |
... | @@ -198,6 +220,16 @@ export default { | ... | @@ -198,6 +220,16 @@ export default { |
198 | } | 220 | } |
199 | }) | 221 | }) |
200 | }, | 222 | }, |
223 | //获取常办项目列表 | ||
224 | queryProjectList () { | ||
225 | getHomeFrequentProjects().then(res => { | ||
226 | if (res.result && res.result.length > 0) { | ||
227 | this.projectList = res.result | ||
228 | } else { | ||
229 | this.projectList = this.listData | ||
230 | } | ||
231 | }) | ||
232 | }, | ||
201 | _timedate (d) { | 233 | _timedate (d) { |
202 | var td = new Date(); | 234 | var td = new Date(); |
203 | td = new Date(td.getFullYear(), td.getMonth(), td.getDate()); | 235 | td = new Date(td.getFullYear(), td.getMonth(), td.getDate()); |
... | @@ -242,6 +274,64 @@ export default { | ... | @@ -242,6 +274,64 @@ export default { |
242 | chart.line().position('year*value').size(2).shape('smooth'); | 274 | chart.line().position('year*value').size(2).shape('smooth'); |
243 | chart.render(); | 275 | chart.render(); |
244 | }, | 276 | }, |
277 | loginTimeChart () { | ||
278 | var data = [{ | ||
279 | item: '用户1', | ||
280 | count: 40, | ||
281 | percent: 0.4 | ||
282 | }, { | ||
283 | item: '用户2', | ||
284 | count: 21, | ||
285 | percent: 0.21 | ||
286 | }, { | ||
287 | item: '用户3', | ||
288 | count: 17, | ||
289 | percent: 0.17 | ||
290 | }] | ||
291 | var chart = new G2.Chart({ | ||
292 | container: 'loginTime', | ||
293 | height: 260 | ||
294 | }); | ||
295 | chart.source(data, { | ||
296 | percent: { | ||
297 | formatter: function formatter (val) { | ||
298 | val = val * 100 + '小时'; | ||
299 | return val; | ||
300 | } | ||
301 | } | ||
302 | }); | ||
303 | chart.coord('theta'); | ||
304 | chart.tooltip({ | ||
305 | showTitle: false | ||
306 | }); | ||
307 | chart.interval().position('percent').color('item').label('percent', { | ||
308 | offset: -40, | ||
309 | textStyle: { | ||
310 | textAlign: 'center', | ||
311 | shadowBlur: 2, | ||
312 | shadowColor: 'rgba(0, 0, 0, .45)' | ||
313 | } | ||
314 | }).tooltip('item*percent', function (item, percent) { | ||
315 | percent = percent * 100 + '小时'; | ||
316 | return { | ||
317 | name: item, | ||
318 | value: percent | ||
319 | }; | ||
320 | }).style({ | ||
321 | lineWidth: 1, | ||
322 | stroke: '#fff' | ||
323 | }); | ||
324 | chart.forceFit(); | ||
325 | chart.render(); | ||
326 | }, | ||
327 | //跳转到更多通知列表页面 | ||
328 | jumpToMoreNotice () { | ||
329 | console.log(this.$route); | ||
330 | }, | ||
331 | //配置常办项目 | ||
332 | setFrequencyProject () { | ||
333 | this.projectDialog = true; | ||
334 | }, | ||
245 | handleNotice (item) { | 335 | handleNotice (item) { |
246 | this.$alertMes(item.noticeTitle, item.noticeContent) | 336 | this.$alertMes(item.noticeTitle, item.noticeContent) |
247 | } | 337 | } | ... | ... |
src/views/system/xttz/xttzview.vue
0 → 100644
1 | <template> | ||
2 | <div class="from-clues"> | ||
3 | <!-- 表单部分 --> | ||
4 | <div class="from-clues-header"> | ||
5 | <el-form :model="ruleForm" @submit.native.prevent label-width="80px"> | ||
6 | <el-row> | ||
7 | <el-col :span="5"> | ||
8 | <el-form-item label="通知标题"> | ||
9 | <el-input v-model="ruleForm.noticeTitle" @clear="queryClick()" clearable placeholder="通知标题"></el-input> | ||
10 | </el-form-item> | ||
11 | </el-col> | ||
12 | <el-col :span="19" class="btnColRight"> | ||
13 | <el-form-item> | ||
14 | <el-button type="primary" native-type="submit" @click="queryClick()">查询</el-button> | ||
15 | <el-button type="primary" native-type="submit" @click="toReadAll()">一键已读</el-button> | ||
16 | </el-form-item> | ||
17 | </el-col> | ||
18 | </el-row> | ||
19 | </el-form> | ||
20 | </div> | ||
21 | <!-- 表格 --> | ||
22 | <div class="from-clues-content"> | ||
23 | <lb-table :page-size="pageData.size" border :current-page.sync="pageData.current" :total="tableData.total" | ||
24 | @size-change="handleSizeChange" @p-current-change="handleCurrentChange" :column="tableData.columns" | ||
25 | :data="tableData.data"> | ||
26 | </lb-table> | ||
27 | </div> | ||
28 | <addDialog ref="addDialog" v-model="isDialog" :isButtonFlag="isButtonFlag" :title="dialogTitle"/> | ||
29 | </div> | ||
30 | </template> | ||
31 | <script> | ||
32 | import table from "@/utils/mixin/table"; | ||
33 | import { datas, sendThis } from "./xttzviewdata"; | ||
34 | import { getSysNoticeList,setReadStatus,setAllRead} from "@/api/notice.js" | ||
35 | import addDialog from "./components/addDialog.vue"; | ||
36 | export default { | ||
37 | name: "xttzview", | ||
38 | components: { addDialog }, | ||
39 | mixins: [table], | ||
40 | mounted () { | ||
41 | sendThis(this); | ||
42 | this.queryClick() | ||
43 | }, | ||
44 | data () { | ||
45 | return { | ||
46 | isDialog: false, | ||
47 | isButtonFlag: true, | ||
48 | dialogTitle: '', | ||
49 | ruleForm: { | ||
50 | noticeTitle: '', | ||
51 | noticeStatus: '2' | ||
52 | }, | ||
53 | tableData: { | ||
54 | total: 0, | ||
55 | columns: datas.columns(), | ||
56 | data: [], | ||
57 | }, | ||
58 | isDiglog: false | ||
59 | } | ||
60 | }, | ||
61 | methods: { | ||
62 | // 列表渲染接口 | ||
63 | queryClick () { | ||
64 | this.$startLoading() | ||
65 | getSysNoticeList({ ...this.ruleForm, ...this.pageData }, { 'target': '#xttzLoading' }).then(res => { | ||
66 | if (res.code === 200) { | ||
67 | this.$endLoading() | ||
68 | let { total, records } = res.result | ||
69 | this.tableData.total = total; | ||
70 | this.tableData.data = records | ||
71 | } | ||
72 | }) | ||
73 | }, | ||
74 | //打开新增弹窗 | ||
75 | openDialog (item) { | ||
76 | this.$nextTick(() => { | ||
77 | this.isButtonFlag = false; | ||
78 | this.$refs.addDialog.getDetailInfo(item); | ||
79 | this.dialogTitle = '系统通知详情' | ||
80 | this.isDialog = true; | ||
81 | }) | ||
82 | let that = this; | ||
83 | if(item.isRead == 1){ | ||
84 | setReadStatus({bsmNotice: item.bsmNotice}).then(res => { | ||
85 | if(res.code == 200){ | ||
86 | that.$nextTick(()=> { | ||
87 | item.isRead = 2 | ||
88 | }) | ||
89 | } | ||
90 | }) | ||
91 | } | ||
92 | }, | ||
93 | //一键已读 | ||
94 | toReadAll(){ | ||
95 | setAllRead().then(res => { | ||
96 | if(res.code == 200){ | ||
97 | this.$message.success('设置成功') | ||
98 | this.queryClick(); | ||
99 | }else{ | ||
100 | this.$message.error("设置失败") | ||
101 | } | ||
102 | }) | ||
103 | }, | ||
104 | downloadFile (item) { | ||
105 | const href = item.noticeFileUrl | ||
106 | window.open(href, '_blank'); | ||
107 | } | ||
108 | }, | ||
109 | }; | ||
110 | </script> | ||
111 | <style scoped lang="scss"> | ||
112 | @import "~@/styles/public.scss"; | ||
113 | </style> |
src/views/system/xttz/xttzviewdata.js
0 → 100644
1 | import filter from '@/utils/filter.js' | ||
2 | let vm = null | ||
3 | const sendThis = (_this) => { | ||
4 | vm = _this | ||
5 | } | ||
6 | class data extends filter { | ||
7 | constructor() { | ||
8 | super() | ||
9 | } | ||
10 | columns () { | ||
11 | return [ | ||
12 | { | ||
13 | label: '序号', | ||
14 | type: 'index', | ||
15 | width: '50', | ||
16 | render: (h, scope) => { | ||
17 | return ( | ||
18 | <div> | ||
19 | {(vm.pageData.currentPage - 1) * vm.pageData.pageSize + scope.$index + 1} | ||
20 | </div> | ||
21 | ) | ||
22 | } | ||
23 | }, | ||
24 | { | ||
25 | prop: "noticeTitle", | ||
26 | label: "通知标题", | ||
27 | }, | ||
28 | { | ||
29 | prop: "noticeSource", | ||
30 | label: "通知来源", | ||
31 | }, | ||
32 | { | ||
33 | label: "通知内容", | ||
34 | render: (h, scope) => { | ||
35 | return <div class="item-cwnr" domPropsInnerHTML={scope.row.noticeContent}></div> | ||
36 | } | ||
37 | }, | ||
38 | { | ||
39 | prop: "noticeFileName", | ||
40 | label: "通知附件", | ||
41 | render: (h, scope) => { | ||
42 | return <div class="pointer" onClick={() => { vm.downloadFile(scope.row) }}>{scope.row.noticeFileName}</div> | ||
43 | } | ||
44 | }, | ||
45 | { | ||
46 | prop: "noticePublishTime", | ||
47 | label: "发布时间", | ||
48 | }, | ||
49 | { | ||
50 | prop: "creater", | ||
51 | width: '120', | ||
52 | label: "发布人", | ||
53 | }, | ||
54 | { | ||
55 | prop: "noticePublishTime", | ||
56 | label: "发布时间", | ||
57 | }, | ||
58 | { | ||
59 | label: "是否已读", | ||
60 | width: '80', | ||
61 | render: (h, scope) => { | ||
62 | switch (scope.row.isRead) { | ||
63 | case '1': | ||
64 | return <div class='prohibit'>未读</div> | ||
65 | case '2': | ||
66 | return <div class='allow'>已读</div> | ||
67 | } | ||
68 | } | ||
69 | }, | ||
70 | { | ||
71 | label: '操作', | ||
72 | align: 'center', | ||
73 | fixed: 'right', | ||
74 | render: (h, scope) => { | ||
75 | return <div> | ||
76 | <el-button type="text" icon="el-icon-view" onClick={() => { vm.openDialog(scope.row) }}>查看</el-button> | ||
77 | </div> | ||
78 | } | ||
79 | } | ||
80 | ] | ||
81 | } | ||
82 | |||
83 | ywlys () { | ||
84 | return [ | ||
85 | { value: 1, label: "办事大厅" }, | ||
86 | { value: 2, label: "微信小程序" }, | ||
87 | { value: 3, label: "法院端" }, | ||
88 | { value: 4, label: "银行端" }, | ||
89 | ] | ||
90 | } | ||
91 | |||
92 | } | ||
93 | let datas = new data() | ||
94 | export { | ||
95 | datas, | ||
96 | sendThis | ||
97 | } |
... | @@ -88,7 +88,7 @@ | ... | @@ -88,7 +88,7 @@ |
88 | </div> | 88 | </div> |
89 | </div> | 89 | </div> |
90 | </el-dialog> | 90 | </el-dialog> |
91 | <bdcqzPrint v-model="dialog" :bdcqz="bdcqz" /> | 91 | <bdcqzPrint ref="bdcqzPrint" v-model="dialog" :bdcqz="bdcqz" /> |
92 | <el-empty description="暂无数据" v-if="tableData.length == 0"></el-empty> | 92 | <el-empty description="暂无数据" v-if="tableData.length == 0"></el-empty> |
93 | </div> | 93 | </div> |
94 | </template> | 94 | </template> |
... | @@ -145,8 +145,11 @@ export default { | ... | @@ -145,8 +145,11 @@ export default { |
145 | }, | 145 | }, |
146 | }); | 146 | }); |
147 | } else { | 147 | } else { |
148 | this.$nextTick(() => { | ||
148 | this.dialog = true; | 149 | this.dialog = true; |
149 | this.bdcqz = item; | 150 | this.bdcqz = item; |
151 | this.$refs.bdcqzPrint.getBdcqzPreview(); | ||
152 | }) | ||
150 | //证书打印 | 153 | //证书打印 |
151 | // this.$popup("证书打印", "workflow/components/zsdy", { | 154 | // this.$popup("证书打印", "workflow/components/zsdy", { |
152 | // height: "700px", | 155 | // height: "700px", | ... | ... |
... | @@ -116,7 +116,7 @@ | ... | @@ -116,7 +116,7 @@ |
116 | 116 | ||
117 | <script> | 117 | <script> |
118 | import { datas } from "../javascript/zsyl.js"; | 118 | import { datas } from "../javascript/zsyl.js"; |
119 | import { readYsxlh, certificate, getSlsqBdcqzList } from "@/api/bdcqz.js"; | 119 | import { readYsxlh, certificate, getSlsqBdcqzList,bdcqzPreview } from "@/api/bdcqz.js"; |
120 | export default { | 120 | export default { |
121 | components: {}, | 121 | components: {}, |
122 | props: { | 122 | props: { |
... | @@ -178,6 +178,10 @@ export default { | ... | @@ -178,6 +178,10 @@ export default { |
178 | var value = this.bdcqz[code]; | 178 | var value = this.bdcqz[code]; |
179 | return value; | 179 | return value; |
180 | }, | 180 | }, |
181 | getBdcqzPreview(){ | ||
182 | bdcqzPreview(this.bdcqz).then(res => { | ||
183 | }) | ||
184 | }, | ||
181 | //打印证书 | 185 | //打印证书 |
182 | childFn() { | 186 | childFn() { |
183 | this.ruleForm.bsmBdcqz = this.bdcqz.bsmBdcqz; | 187 | this.ruleForm.bsmBdcqz = this.bdcqz.bsmBdcqz; | ... | ... |
1 | //流程环节操作按钮 | 1 | //流程环节操作按钮 |
2 | export function getForm(tabName, djywbm) { | 2 | export function getForm(tabName, djywbm) { |
3 | console.log("88888888"+tabName); | 3 | console.log("88888888" + tabName); |
4 | let form; | 4 | let form; |
5 | switch (tabName) { | 5 | switch (tabName) { |
6 | case "jsydsyqslxx100": | 6 | case "jsydsyqslxx100": |
... | @@ -42,6 +42,10 @@ export function getForm(tabName, djywbm) { | ... | @@ -42,6 +42,10 @@ export function getForm(tabName, djywbm) { |
42 | case "diyaqSlxx200": | 42 | case "diyaqSlxx200": |
43 | form = require("@/views/ywbl/diyaq/slxx200.vue"); | 43 | form = require("@/views/ywbl/diyaq/slxx200.vue"); |
44 | break; | 44 | break; |
45 | case "diyaqSlxx300": | ||
46 | form = require("@/views/ywbl/diyaq/slxx200.vue"); | ||
47 | break; | ||
48 | |||
45 | case "clxx": | 49 | case "clxx": |
46 | form = require("@/views/workflow/components/clxx.vue"); | 50 | form = require("@/views/workflow/components/clxx.vue"); |
47 | break; | 51 | break; |
... | @@ -52,10 +56,10 @@ export function getForm(tabName, djywbm) { | ... | @@ -52,10 +56,10 @@ export function getForm(tabName, djywbm) { |
52 | form = require("@/views/registerBook/zdjbxx.vue"); | 56 | form = require("@/views/registerBook/zdjbxx.vue"); |
53 | break; | 57 | break; |
54 | case "ygmm100": | 58 | case "ygmm100": |
55 | form=require("@/views/ywbl/ygdj/slxx.vue"); | 59 | form = require("@/views/ywbl/ygdj/slxx.vue"); |
56 | break; | 60 | break; |
57 | case "ygmm300": | 61 | case "ygmm300": |
58 | form=require("@/views/ywbl/ygdj/slxx300.vue"); | 62 | form = require("@/views/ywbl/ygdj/slxx300.vue"); |
59 | break; | 63 | break; |
60 | case "cfdjxx": | 64 | case "cfdjxx": |
61 | form = require("@/views/registerBook/cfdj.vue"); | 65 | form = require("@/views/registerBook/cfdj.vue"); | ... | ... |
... | @@ -73,7 +73,7 @@ import searchBox from '../components/search.vue' | ... | @@ -73,7 +73,7 @@ import searchBox from '../components/search.vue' |
73 | import table from "@/utils/mixin/table" | 73 | import table from "@/utils/mixin/table" |
74 | import searchMin from "../components/mixin/index" | 74 | import searchMin from "../components/mixin/index" |
75 | import { datas, sendThis } from "./dbxdata" | 75 | import { datas, sendThis } from "./dbxdata" |
76 | import { searchTaskToDo, deleteFlow, claimTask } from "@/api/ywbl.js" | 76 | import { searchTaskToDo, deleteFlow, claimTask } from "@/api/ywbl" |
77 | export default { | 77 | export default { |
78 | name: "dbx", | 78 | name: "dbx", |
79 | components: { searchBox }, | 79 | components: { searchBox }, | ... | ... |
... | @@ -11,7 +11,7 @@ | ... | @@ -11,7 +11,7 @@ |
11 | > | 11 | > |
12 | <div class="slxx_con"> | 12 | <div class="slxx_con"> |
13 | <div class="slxx_title title-block"> | 13 | <div class="slxx_title title-block"> |
14 | 受理信息200 | 14 | 受理信息 |
15 | <div class="triangle"></div> | 15 | <div class="triangle"></div> |
16 | </div> | 16 | </div> |
17 | <el-row :gutter="10"> | 17 | <el-row :gutter="10"> | ... | ... |
... | @@ -74,7 +74,7 @@ import { mapGetters } from 'vuex' | ... | @@ -74,7 +74,7 @@ import { mapGetters } from 'vuex' |
74 | import searchMin from "../components/mixin/index" | 74 | import searchMin from "../components/mixin/index" |
75 | import table from "@/utils/mixin/table" | 75 | import table from "@/utils/mixin/table" |
76 | import { datas, sendThis } from "./ybxdata" | 76 | import { datas, sendThis } from "./ybxdata" |
77 | import { searchTaskDone } from "@/api/ywbl.js" | 77 | import { searchTaskDone } from "@/api/ywbl" |
78 | import searchBox from '../components/search.vue' | 78 | import searchBox from '../components/search.vue' |
79 | export default { | 79 | export default { |
80 | name: "ybx", | 80 | name: "ybx", | ... | ... |
... | @@ -72,8 +72,7 @@ | ... | @@ -72,8 +72,7 @@ |
72 | import { datas, sendThis } from "../javascript/fwsyq.js"; | 72 | import { datas, sendThis } from "../javascript/fwsyq.js"; |
73 | import table from "@/utils/mixin/table"; | 73 | import table from "@/utils/mixin/table"; |
74 | import jump from "@/views/ywbl/ywsq/components/mixin/jump"; | 74 | import jump from "@/views/ywbl/ywsq/components/mixin/jump"; |
75 | import { selectScBdcdy, startBusinessFlow, choiceBdcdy, selectOtherH } from "@/api/ywbl.js"; | 75 | import { selectScBdcdy, startBusinessFlow, choiceBdcdy, selectOtherH, selectZrz, selectH } from "@/api/ywbl.js"; |
76 | import { selectZrz, selectH } from "@/api/selectQlxx.js"; | ||
77 | export default { | 76 | export default { |
78 | mixins: [table, jump], | 77 | mixins: [table, jump], |
79 | props: { | 78 | props: { | ... | ... |
... | @@ -44,8 +44,7 @@ import { datas, sendThis } from "../javascript/jsydsyq100.js"; | ... | @@ -44,8 +44,7 @@ import { datas, sendThis } from "../javascript/jsydsyq100.js"; |
44 | import { defaultParameters } from "../javascript/publicDefaultPar.js"; | 44 | import { defaultParameters } from "../javascript/publicDefaultPar.js"; |
45 | import table from "@/utils/mixin/table"; | 45 | import table from "@/utils/mixin/table"; |
46 | import jump from "../components/mixin/jump"; | 46 | import jump from "../components/mixin/jump"; |
47 | import { startBusinessFlow } from "@/api/ywbl.js"; | 47 | import { startBusinessFlow, selectZdjbxx } from "@/api/ywbl.js"; |
48 | import { selectZdjbxx } from "@/api/selectQlxx.js"; | ||
49 | export default { | 48 | export default { |
50 | mixins: [table, jump], | 49 | mixins: [table, jump], |
51 | props: { | 50 | props: { | ... | ... |
... | @@ -58,8 +58,7 @@ import { datas, sendThis } from "../javascript/jsydsyq200.js"; | ... | @@ -58,8 +58,7 @@ import { datas, sendThis } from "../javascript/jsydsyq200.js"; |
58 | import { defaultParameters } from "../javascript/publicDefaultPar.js"; | 58 | import { defaultParameters } from "../javascript/publicDefaultPar.js"; |
59 | import table from "@/utils/mixin/table"; | 59 | import table from "@/utils/mixin/table"; |
60 | import jump from "../components/mixin/jump"; | 60 | import jump from "../components/mixin/jump"; |
61 | import { startBusinessFlow } from "@/api/ywbl.js"; | 61 | import { startBusinessFlow, selectJsydQlxx } from "@/api/ywbl.js"; |
62 | import { selectJsydQlxx } from "@/api/selectQlxx.js"; | ||
63 | export default { | 62 | export default { |
64 | mixins: [table, jump], | 63 | mixins: [table, jump], |
65 | props: { | 64 | props: { | ... | ... |
... | @@ -44,8 +44,7 @@ import { datas, sendThis } from "../javascript/nydsyq100.js"; | ... | @@ -44,8 +44,7 @@ import { datas, sendThis } from "../javascript/nydsyq100.js"; |
44 | import { defaultParameters } from "../javascript/publicDefaultPar.js"; | 44 | import { defaultParameters } from "../javascript/publicDefaultPar.js"; |
45 | import table from "@/utils/mixin/table"; | 45 | import table from "@/utils/mixin/table"; |
46 | import jump from "../components/mixin/jump"; | 46 | import jump from "../components/mixin/jump"; |
47 | import { startBusinessFlow } from "@/api/ywbl.js"; | 47 | import { startBusinessFlow, selectZdjbxx } from "@/api/ywbl.js"; |
48 | import { selectZdjbxx } from "@/api/selectQlxx.js"; | ||
49 | export default { | 48 | export default { |
50 | mixins: [table, jump], | 49 | mixins: [table, jump], |
51 | props: { | 50 | props: { | ... | ... |
... | @@ -44,8 +44,7 @@ import { datas, sendThis } from "../javascript/jsydsyq200.js"; | ... | @@ -44,8 +44,7 @@ import { datas, sendThis } from "../javascript/jsydsyq200.js"; |
44 | import { defaultParameters } from "../javascript/publicDefaultPar.js"; | 44 | import { defaultParameters } from "../javascript/publicDefaultPar.js"; |
45 | import table from "@/utils/mixin/table"; | 45 | import table from "@/utils/mixin/table"; |
46 | import jump from "../components/mixin/jump"; | 46 | import jump from "../components/mixin/jump"; |
47 | import { startBusinessFlow } from "@/api/ywbl.js"; | 47 | import { startBusinessFlow, selectNydsyqQlxx } from "@/api/ywbl.js"; |
48 | import { selectNydsyqQlxx } from "@/api/selectQlxx.js"; | ||
49 | export default { | 48 | export default { |
50 | mixins: [table, jump], | 49 | mixins: [table, jump], |
51 | props: { | 50 | props: { | ... | ... |
-
Please register or sign in to post a comment