empsign.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  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!=null&&cur!="") {
  73. date = new Date(cur)
  74. } else {
  75. var now = new Date()
  76. date = now;
  77. }
  78. this.currentYear = date.getFullYear()
  79. this.currentMonth = date.getMonth() + 1
  80. var str = this.formatDate(
  81. this.currentYear,
  82. this.currentMonth,
  83. )
  84. },
  85. pickPre: function(year, month) {
  86. var d = new Date(this.formatDate(year, month, 1))
  87. d.setDate(0)
  88. this.initData(this.formatDate(d.getFullYear(), d.getMonth() + 1, 1))
  89. this.querys(this.name);
  90. },
  91. pickNext: function(year, month) {
  92. var d = new Date(this.formatDate(year, month, 1))
  93. var ds=this.formatDate(year, month, null);
  94. var nowDate = new Date();
  95. var dt=this.formatDate(nowDate.getFullYear(),nowDate.getMonth(),null);
  96. if(ds<=dt){
  97. d.setDate(35)
  98. this.initData(this.formatDate(d.getFullYear(), d.getMonth() + 1, 1))
  99. this.querys(this.name);
  100. }
  101. },
  102. // 返回 类似 2016-01-02 格式的字符串
  103. formatDate: function(year, month, day) {
  104. var y = year
  105. if(month>12){
  106. month=1;
  107. y=year+1;
  108. }
  109. var m = month
  110. if (m < 10) m = '0' + m
  111. var d = day
  112. if(day!=null &&day !=""){
  113. if (d < 10) d = '0' + d
  114. return y + '-' + m + '-' + d
  115. }else{
  116. return y + '-' + m
  117. }
  118. },
  119. details(item){
  120. var date=this.formatDate(this.currentYear,this.currentMonth,1);
  121. uni.setStorageSync("status",2);
  122. uni.setStorageSync("date",date);
  123. uni.setStorageSync("id",item);
  124. this.$Router.push({name:'usersign'})
  125. },
  126. query(){
  127. this.data=[];
  128. var date=this.formatDate(this.currentYear,this.currentMonth,1);
  129. this.$http.get(this.userUrl,{params:{username:this.name,date:date}}).then(res=>{
  130. if(res.data.length>0){
  131. for(var i=0;i<res.data.length;i++){
  132. var s={
  133. id:res.data[i].id,
  134. realname:res.data[i].realname,
  135. post:res.data[i].post,
  136. avatar:(res.data[i].avatar && res.data[i].avatar.length > 0)? api.getFileAccessHttpUrl(res.data[i].avatar):'/static/avatar_boy.png',
  137. orgCodeTxt:res.data[i].orgCodeTxt,
  138. del:res.data[i].del
  139. }
  140. this.data.push(s)
  141. }
  142. }
  143. }).catch(err => {
  144. console.log(err);
  145. });
  146. },
  147. querys(s){
  148. this.data=[];
  149. var date=this.formatDate(this.currentYear,this.currentMonth,1);
  150. this.$http.get(this.userUrl,{params:{username:s,date:date,depid:this.$store.getters.departId}}).then(res=>{
  151. if(res.data.length>0){
  152. for(var i=0;i<res.data.length;i++){
  153. var s={
  154. id:res.data[i].id,
  155. realname:res.data[i].realname,
  156. post:res.data[i].post,
  157. avatar:(res.data[i].avatar && res.data[i].avatar.length > 0)? api.getFileAccessHttpUrl(res.data[i].avatar):'/static/avatar_boy.png',
  158. orgCodeTxt:res.data[i].orgCodeTxt,
  159. del:res.data[i].del
  160. }
  161. this.data.push(s)
  162. }
  163. }
  164. }).catch(err => {
  165. console.log(err);
  166. });
  167. },
  168. }
  169. }
  170. </script>
  171. <style lang="scss" scoped>
  172. .month ul {
  173. margin: 0;
  174. padding: 0;
  175. display: flex;
  176. justify-content: space-between;
  177. height: 35px;
  178. }
  179. .year-month {
  180. display: flex;
  181. align-items: center;
  182. justify-content: space-around;
  183. margin-top: 10px;
  184. }
  185. .choose-month {
  186. text-align: center;
  187. font-size: 12px;
  188. }
  189. .arrow {
  190. padding: 15px;
  191. color: #999999;
  192. }
  193. .month ul li {
  194. font-size: 12px;
  195. text-transform: uppercase;
  196. letter-spacing: 3px;
  197. }
  198. #calendar {
  199. font-size: 12px;
  200. width: 100%;
  201. margin: 0 auto;
  202. box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.1),
  203. 0 1px 5px 0 rgba(0, 0, 0, 0.12);
  204. }
  205. .month {
  206. width: 100%;
  207. color: #333333;
  208. background: #ffffff;
  209. }
  210. .imgs{
  211. width: 40px;
  212. height: 40px;
  213. border-radius:5px 5px 5px 5px;
  214. margin-left: 1%;
  215. }
  216. .filterBox {
  217. padding: 15rpx 32rpx;
  218. background-color: #fff;
  219. .filter-input {
  220. height: 80rpx;
  221. background-color: #eeeff0;
  222. border-radius: 40rpx;
  223. display: flex;
  224. align-items: center;
  225. padding-left: 40rpx;
  226. .filterImg {
  227. width: 32rpx;
  228. height: 32rpx;
  229. margin-right: 20rpx;
  230. margin-bottom: 5rpx;
  231. }
  232. .filterImgs {
  233. width: 32rpx;
  234. height: 32rpx;
  235. }
  236. .text {
  237. width: 84%;
  238. background-color: #eeeff0;
  239. font-size: 32rpx;
  240. color: #000;
  241. }
  242. }
  243. }
  244. .flex_between_center {
  245. display: flex;
  246. justify-content: space-between;
  247. align-items: center;
  248. }
  249. .checkbox {
  250. position: relative;
  251. margin-left: 10rpx;
  252. margin-right: 0px;
  253. .color {
  254. color: #00aaff;
  255. background-color: #00aaff;
  256. }
  257. .txt {
  258. font-size: 44rpx;
  259. width: 100%;
  260. height: 100%;
  261. display: flex;
  262. }
  263. }
  264. .checkBorder {
  265. border: 1px solid #ecdee4;
  266. }
  267. .header {
  268. width: 100%;
  269. position: fixed;
  270. background-color: #fff;
  271. z-index: 9999;
  272. .title {
  273. height: 90rpx;
  274. padding: 0 32rpx;
  275. line-height: 90rpx;
  276. font-size: 30rpx;
  277. background-color: #f5f5f5;
  278. color: #606064;
  279. }
  280. }
  281. .iconclass {
  282. display: inline-block;
  283. margin: 0 12rpx;
  284. color: #D0D4DB;
  285. font-size: 28rpx;
  286. }
  287. .container-list {
  288. overflow-y: scroll;
  289. overflow-x: hidden;
  290. padding-bottom: 160rpx;
  291. padding-top: 15rpx;
  292. .common {
  293. background-color: #fff;
  294. border-bottom: 1rpx solid #f4f4f4;
  295. padding-left: 10rpx;
  296. .content {
  297. display: flex;
  298. align-items: center;
  299. height: 70rpx;
  300. width: 100%;
  301. padding: 15rpx 0;
  302. position: relative;
  303. font-size: 32rpx;
  304. .lable-text{
  305. margin-left: 5%;
  306. font-size: 30rpx;
  307. color: #5b5757;
  308. width: 500rpx;
  309. word-break: break-all;
  310. }
  311. .right {
  312. position: absolute;
  313. right: 30rpx;
  314. color: #babdc3;
  315. font-size: 32rpx;
  316. }
  317. }
  318. }
  319. }
  320. .active {
  321. color: #4297ED !important;
  322. }
  323. .none {
  324. color: #666666;
  325. }
  326. .icon-selected{
  327. color: #0095F2!important;
  328. font-size: 40rpx!important;
  329. }
  330. .icons{
  331. color: #0095F2!important;
  332. font-size: 40rpx!important;
  333. }
  334. .inline-item {
  335. display: inline-block
  336. }
  337. .content-item{
  338. display: flex;
  339. position: relative;
  340. align-items: center;
  341. }
  342. .box_sizing {
  343. -webkit-box-sizing: border-box;
  344. -moz-box-sizing: border-box;
  345. box-sizing: border-box;
  346. }
  347. .btn {
  348. position: fixed;
  349. bottom: 0;
  350. padding: 10px;
  351. background-color: #fff;
  352. width: 100%;
  353. .sureBtn {
  354. background-color: #0095F2;
  355. color: #fff;
  356. }
  357. }
  358. // @import '@/components/xiaolu-tree/css/style.scss';
  359. @import url("@/components/xiaolu-tree/css/icon.css");
  360. </style>