empsign.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  1. <template>
  2. <div >
  3. <cu-custom bgColor="bg-gradual-pink" :isBack="true">
  4. <block slot="backText">返回</block>
  5. <block slot="content">考勤情况</block>
  6. </cu-custom>
  7. <view class="tmp-box">
  8. <view class='filterBox'>
  9. <view class='filter-input'>
  10. <text style="color: #b8b8b8;" class="iconfont icon-sousuo filterImg"/>
  11. <input class="text" type='text' v-model="name" confirm-type="搜索" placeholder='搜索'></input>
  12. </view>
  13. </view>
  14. </view>
  15. <div>
  16. <div class='month'>
  17. <ul style="list-style-type:none;">
  18. <li class='arrow' @click='pickPre(currentYear,currentMonth)'>上个月</li>
  19. <li class='year-month'>
  20. <span class='choose-year'>{{ currentYear }}年</span>
  21. <span class='choose-month'>{{ currentMonth }}月</span>
  22. </li>
  23. <li class='arrow' @click='pickNext(currentYear,currentMonth)'>下个月</li>
  24. </ul>
  25. <br>
  26. </div>
  27. </div>
  28. <view>
  29. <view class="container-list">
  30. <view class="common cu-item arrow animation-slide-bottom" :style="[{animationDelay: '0.1s'}]" v-for='(item,index) in data' :key="index">
  31. <label class="content" @click="details(item.id)">
  32. <image :src="item.avatar" class="imgs"></image>
  33. <view class="lable-text" >{{item.realname}}</view>
  34. <!-- <text class="text-grey" >{{item.orgCodeTxt}}</text> -->
  35. <view class="right">
  36. <span style="color: #0081FF;font-size: 15px;" v-if='item.del=="2" ||item.del==2'>当月考勤正常</span>
  37. <span style="color: red;font-size: 15px;" v-if='item.del=="1" ||item.del==1'>当月考勤异常</span>
  38. </view>
  39. </label>
  40. </view>
  41. </view>
  42. </view>
  43. </div>
  44. </template>
  45. <script>
  46. import api from '@/api/api'
  47. export default {
  48. data() {
  49. return {
  50. name:'',
  51. currentMonth: 1,
  52. currentYear: 1970,
  53. data:[],
  54. userUrl:'/sys/user/lists'
  55. }
  56. },
  57. watch:{
  58. name:{
  59. handler(newVal, objVal) {
  60. this.querys(newVal);
  61. },
  62. }
  63. },
  64. created(){
  65. this.initData(null)
  66. this.querys(this.name)
  67. },
  68. methods:{
  69. initData: function(cur) {
  70. // var leftcount = 0 // 存放剩余数量
  71. var date
  72. if (cur) {
  73. date = new Date(cur)
  74. } else {
  75. var now = new Date()
  76. var d = new Date(this.formatDate(now.getFullYear(), now.getMonth(), 1))
  77. d.setDate(35)
  78. date = new Date(this.formatDate(d.getFullYear(), d.getMonth() + 1, 1))
  79. }
  80. this.currentYear = date.getFullYear()
  81. this.currentMonth = date.getMonth() + 1
  82. var str = this.formatDate(
  83. this.currentYear,
  84. this.currentMonth,
  85. )
  86. },
  87. pickPre: function(year, month) {
  88. var d = new Date(this.formatDate(year, month, 1))
  89. d.setDate(0)
  90. this.initData(this.formatDate(d.getFullYear(), d.getMonth() + 1, 1))
  91. this.querys(this.name);
  92. },
  93. pickNext: function(year, month) {
  94. var d = new Date(this.formatDate(year, month, 1))
  95. var ds=this.formatDate(year, month, null);
  96. var nowDate = new Date();
  97. var dt=this.formatDate(nowDate.getFullYear(),nowDate.getMonth(),null);
  98. if(ds<=dt){
  99. d.setDate(35)
  100. this.initData(this.formatDate(d.getFullYear(), d.getMonth() + 1, 1))
  101. this.querys(this.name);
  102. }
  103. },
  104. // 返回 类似 2016-01-02 格式的字符串
  105. formatDate: function(year, month, day) {
  106. var y = year
  107. if(month>12){
  108. month=1;
  109. y=year+1;
  110. }
  111. var m = month
  112. if (m < 10) m = '0' + m
  113. var d = day
  114. if(day!=null &&day !=""){
  115. if (d < 10) d = '0' + d
  116. return y + '-' + m + '-' + d
  117. }else{
  118. return y + '-' + m
  119. }
  120. },
  121. details(item){
  122. var date=this.formatDate(this.currentYear,this.currentMonth,1);
  123. uni.setStorageSync("status",2);
  124. uni.setStorageSync("date",date);
  125. uni.setStorageSync("id",item);
  126. this.$Router.push({name:'usersign'})
  127. },
  128. query(){
  129. this.data=[];
  130. var date=this.formatDate(this.currentYear,this.currentMonth,1);
  131. this.$http.get(this.userUrl,{params:{username:this.name,date:date}}).then(res=>{
  132. if(res.data.length>0){
  133. for(var i=0;i<res.data.length;i++){
  134. var s={
  135. id:res.data[i].id,
  136. realname:res.data[i].realname,
  137. post:res.data[i].post,
  138. avatar:(res.data[i].avatar && res.data[i].avatar.length > 0)? api.getFileAccessHttpUrl(res.data[i].avatar):'/static/avatar_boy.png',
  139. orgCodeTxt:res.data[i].orgCodeTxt,
  140. del:res.data[i].del
  141. }
  142. this.data.push(s)
  143. }
  144. }
  145. }).catch(err => {
  146. console.log(err);
  147. });
  148. },
  149. querys(s){
  150. this.data=[];
  151. var date=this.formatDate(this.currentYear,this.currentMonth,1);
  152. this.$http.get(this.userUrl,{params:{username:s,date:date,depid:this.$store.getters.departId}}).then(res=>{
  153. if(res.data.length>0){
  154. for(var i=0;i<res.data.length;i++){
  155. var s={
  156. id:res.data[i].id,
  157. realname:res.data[i].realname,
  158. post:res.data[i].post,
  159. avatar:(res.data[i].avatar && res.data[i].avatar.length > 0)? api.getFileAccessHttpUrl(res.data[i].avatar):'/static/avatar_boy.png',
  160. orgCodeTxt:res.data[i].orgCodeTxt,
  161. del:res.data[i].del
  162. }
  163. this.data.push(s)
  164. }
  165. }
  166. }).catch(err => {
  167. console.log(err);
  168. });
  169. },
  170. }
  171. }
  172. </script>
  173. <style lang="scss" scoped>
  174. .month ul {
  175. margin: 0;
  176. padding: 0;
  177. display: flex;
  178. justify-content: space-between;
  179. height: 35px;
  180. }
  181. .year-month {
  182. display: flex;
  183. align-items: center;
  184. justify-content: space-around;
  185. margin-top: 10px;
  186. }
  187. .choose-month {
  188. text-align: center;
  189. font-size: 12px;
  190. }
  191. .arrow {
  192. padding: 15px;
  193. color: #999999;
  194. }
  195. .month ul li {
  196. font-size: 12px;
  197. text-transform: uppercase;
  198. letter-spacing: 3px;
  199. }
  200. #calendar {
  201. font-size: 12px;
  202. width: 100%;
  203. margin: 0 auto;
  204. box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.1),
  205. 0 1px 5px 0 rgba(0, 0, 0, 0.12);
  206. }
  207. .month {
  208. width: 100%;
  209. color: #333333;
  210. background: #ffffff;
  211. }
  212. .imgs{
  213. width: 40px;
  214. height: 40px;
  215. border-radius:5px 5px 5px 5px;
  216. margin-left: 1%;
  217. }
  218. .filterBox {
  219. padding: 15rpx 32rpx;
  220. background-color: #fff;
  221. .filter-input {
  222. height: 80rpx;
  223. background-color: #eeeff0;
  224. border-radius: 40rpx;
  225. display: flex;
  226. align-items: center;
  227. padding-left: 40rpx;
  228. .filterImg {
  229. width: 32rpx;
  230. height: 32rpx;
  231. margin-right: 20rpx;
  232. margin-bottom: 5rpx;
  233. }
  234. .filterImgs {
  235. width: 32rpx;
  236. height: 32rpx;
  237. }
  238. .text {
  239. width: 84%;
  240. background-color: #eeeff0;
  241. font-size: 32rpx;
  242. color: #000;
  243. }
  244. }
  245. }
  246. .flex_between_center {
  247. display: flex;
  248. justify-content: space-between;
  249. align-items: center;
  250. }
  251. .checkbox {
  252. position: relative;
  253. margin-left: 10rpx;
  254. margin-right: 0px;
  255. .color {
  256. color: #00aaff;
  257. background-color: #00aaff;
  258. }
  259. .txt {
  260. font-size: 44rpx;
  261. width: 100%;
  262. height: 100%;
  263. display: flex;
  264. }
  265. }
  266. .checkBorder {
  267. border: 1px solid #ecdee4;
  268. }
  269. .header {
  270. width: 100%;
  271. position: fixed;
  272. background-color: #fff;
  273. z-index: 9999;
  274. .title {
  275. height: 90rpx;
  276. padding: 0 32rpx;
  277. line-height: 90rpx;
  278. font-size: 30rpx;
  279. background-color: #f5f5f5;
  280. color: #606064;
  281. }
  282. }
  283. .iconclass {
  284. display: inline-block;
  285. margin: 0 12rpx;
  286. color: #D0D4DB;
  287. font-size: 28rpx;
  288. }
  289. .container-list {
  290. overflow-y: scroll;
  291. overflow-x: hidden;
  292. padding-bottom: 160rpx;
  293. padding-top: 15rpx;
  294. .common {
  295. background-color: #fff;
  296. border-bottom: 1rpx solid #f4f4f4;
  297. padding-left: 10rpx;
  298. .content {
  299. display: flex;
  300. align-items: center;
  301. height: 70rpx;
  302. width: 100%;
  303. padding: 15rpx 0;
  304. position: relative;
  305. font-size: 32rpx;
  306. .lable-text{
  307. margin-left: 5%;
  308. font-size: 30rpx;
  309. color: #5b5757;
  310. width: 500rpx;
  311. word-break: break-all;
  312. }
  313. .right {
  314. position: absolute;
  315. right: 30rpx;
  316. color: #babdc3;
  317. font-size: 32rpx;
  318. }
  319. }
  320. }
  321. }
  322. .active {
  323. color: #4297ED !important;
  324. }
  325. .none {
  326. color: #666666;
  327. }
  328. .icon-selected{
  329. color: #0095F2!important;
  330. font-size: 40rpx!important;
  331. }
  332. .icons{
  333. color: #0095F2!important;
  334. font-size: 40rpx!important;
  335. }
  336. .inline-item {
  337. display: inline-block
  338. }
  339. .content-item{
  340. display: flex;
  341. position: relative;
  342. align-items: center;
  343. }
  344. .box_sizing {
  345. -webkit-box-sizing: border-box;
  346. -moz-box-sizing: border-box;
  347. box-sizing: border-box;
  348. }
  349. .btn {
  350. position: fixed;
  351. bottom: 0;
  352. padding: 10px;
  353. background-color: #fff;
  354. width: 100%;
  355. .sureBtn {
  356. background-color: #0095F2;
  357. color: #fff;
  358. }
  359. }
  360. // @import '@/components/xiaolu-tree/css/style.scss';
  361. @import url("@/components/xiaolu-tree/css/icon.css");
  362. </style>