empsign.vue 8.9 KB

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