leaveemp.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <template>
  2. <div style="background-color: #FFFFFF;">
  3. <cu-custom bgColor="bg-gradual-pink" :isBack="true">
  4. <block slot="backText">返回</block>
  5. <block slot="content" >假期列表</block>
  6. </cu-custom>
  7. <div class="ins">
  8. <div style="height: 3px;"></div>
  9. <input placeholder="🔍 搜索" style="text-align: center;" v-model="name" />
  10. </div>
  11. <br>
  12. <div style="width: 100%;height: 10px;background-color:#F1F1F1 ;"></div>
  13. <view class="cu-list menu radius" >
  14. <view class="cu-item "v-for='(item,index) in data'>
  15. <navigator class="content" @click="details(item.id)" hover-class="none">
  16. <div style="margin-top: -10px;">
  17. <span class="imgs">
  18. <image :src="item.avatar" class="imgs"></image>
  19. </span>
  20. </div>
  21. <div style="margin-top: -40px;">
  22. <text style="margin-left: 15%;">{{item.realname}}</text>
  23. </div>
  24. <div style="margin-top: -25px;">
  25. <text class="text-grey" style="margin-left: 35%;">{{item.orgCodeTxt}}</text>
  26. <!-- <text class="text-grey" >总假期:{{item.del/24}}(天)</text> -->
  27. <!-- <text class="text-grey" style="margin-left: 15%;">剩余:{{item.del2/24}}(天)</text> -->
  28. </div>
  29. </navigator>
  30. </view>
  31. </view>
  32. </div>
  33. </template>
  34. <script>
  35. import api from '@/api/api'
  36. export default {
  37. data() {
  38. return {
  39. name:'',
  40. data:[],
  41. userUrl:'/sys/user/queryLeaveList'
  42. }
  43. },
  44. watch:{
  45. name:{
  46. handler(newVal, objVal) {
  47. this.querys(newVal);
  48. },
  49. }
  50. },
  51. created(){
  52. this.querys(this.name)
  53. },
  54. methods:{
  55. // 返回 类似 2016-01-02 格式的字符串
  56. formatDate: function(year, month, day) {
  57. var y = year
  58. var m = month
  59. if (m < 10) m = '0' + m
  60. var d = day
  61. if(day!=null &&day !=""){
  62. if (d < 10) d = '0' + d
  63. return y + '-' + m + '-' + d
  64. }else{
  65. return y + '-' + m
  66. }
  67. },
  68. details(item){
  69. this.$store.commit('SET_LEAVE',item);
  70. this.$Router.push({name:'leaves'})
  71. },
  72. query(){
  73. this.data=[];
  74. this.$http.get(this.userUrl,{params:{username:this.name}}).then(res=>{
  75. if(res.data.length>0){
  76. for(var i=0;i<res.data.length;i++){
  77. var s={
  78. id:res.data[i].id,
  79. realname:res.data[i].realname,
  80. avatar:(res.data[i].avatar && res.data[i].avatar.length > 0)? api.getFileAccessHttpUrl(res.data[i].avatar):'/static/avatar_boy.png',
  81. orgCodeTxt:res.data[i].orgCodeTxt,
  82. del:res.data[i].del2,
  83. del2:res.data[i].del3
  84. }
  85. this.data.push(s)
  86. }
  87. }
  88. }).catch(err => {
  89. console.log(err);
  90. });
  91. },
  92. querys(s){
  93. this.data=[];
  94. this.$http.get(this.userUrl,{params:{username:s,depid:this.$store.getters.departId}}).then(res=>{
  95. if(res.data.length>0){
  96. for(var i=0;i<res.data.length;i++){
  97. var s={
  98. id:res.data[i].id,
  99. realname:res.data[i].realname,
  100. avatar:(res.data[i].avatar && res.data[i].avatar.length > 0)? api.getFileAccessHttpUrl(res.data[i].avatar):'/static/avatar_boy.png',
  101. orgCodeTxt:res.data[i].orgCodeTxt,
  102. del:res.data[i].del2,
  103. del2:res.data[i].del3
  104. }
  105. this.data.push(s)
  106. }
  107. }
  108. }).catch(err => {
  109. console.log(err);
  110. });
  111. },
  112. ret(){
  113. this.$Router.push({name:'index'})
  114. }
  115. }
  116. }
  117. </script>
  118. <style>
  119. .month ul {
  120. margin: 0;
  121. padding: 0;
  122. display: flex;
  123. justify-content: space-between;
  124. height: 35px;
  125. }
  126. .year-month {
  127. display: flex;
  128. align-items: center;
  129. justify-content: space-around;
  130. margin-top: 10px;
  131. }
  132. .choose-month {
  133. text-align: center;
  134. font-size: 12px;
  135. }
  136. .arrow {
  137. padding: 15px;
  138. color: #999999;
  139. }
  140. .month ul li {
  141. font-size: 12px;
  142. text-transform: uppercase;
  143. letter-spacing: 3px;
  144. }
  145. #calendar {
  146. font-size: 12px;
  147. width: 100%;
  148. margin: 0 auto;
  149. box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.1),
  150. 0 1px 5px 0 rgba(0, 0, 0, 0.12);
  151. }
  152. .month {
  153. width: 100%;
  154. color: #333333;
  155. background: #ffffff;
  156. }
  157. .ins{
  158. background-color: #F1F1F1;
  159. width: 90%;
  160. height: 30px;
  161. margin:0 auto;
  162. border-radius:5px 5px 5px 5px;
  163. margin-top: 10px;
  164. }
  165. .s{
  166. list-style-type:none;
  167. margin-left: -40px;
  168. }
  169. .imgs{
  170. width: 40px;
  171. height: 40px;
  172. border-radius:5px 5px 5px 5px;
  173. }
  174. .top{
  175. background-color: #5677AC;
  176. width: 100%;
  177. height: 40px;
  178. }
  179. </style>