wagesuser.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  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 class='month'>
  13. <ul style="list-style-type:none;">
  14. <li class='arrow' @click='pickPre(currentYear,currentMonth)'>上个月</li>
  15. <li class='year-month'>
  16. <span class='choose-year'>{{ currentYear }}年</span>
  17. <span class='choose-month'>{{ currentMonth }}月</span>
  18. </li>
  19. <li class='arrow' @click='pickNext(currentYear,currentMonth)'>下个月</li>
  20. </ul>
  21. <br>
  22. </div> -->
  23. <!-- <div>
  24. <span style="color: #0081FF;margin-left: 20px;font-size: 18px;">工资发放情况</span>
  25. <div style="width: 100%;height: 10px;"></div>
  26. </div> -->
  27. <div style="width: 100%;height: 10px;background-color:#F1F1F1 ;"></div>
  28. <view class="cu-list menu radius" >
  29. <view class="cu-item "v-for='(item,index) in data'>
  30. <navigator class="content" @click="details(item.id)" hover-class="none">
  31. <div style="margin-top: -10px;">
  32. <span class="imgs">
  33. <image :src="item.avatar" class="imgs"></image>
  34. </span>
  35. </div>
  36. <div style="margin-top: -40px;">
  37. <text style="margin-left: 20%;">{{item.realname}}</text>
  38. </div>
  39. <div style="margin-top: -25px;">
  40. <text class="text-grey" style="margin-left: 40%;">{{item.orgCodeTxt}}</text>
  41. <!-- <text class="text-grey" style="margin-left: 10%;color: #0081FF;">8000.00¥</text> -->
  42. </div>
  43. </navigator>
  44. </view>
  45. </view>
  46. </div>
  47. </template>
  48. <script>
  49. import api from '@/api/api'
  50. export default {
  51. data() {
  52. return {
  53. currentMonth: 1,
  54. currentYear: 1970,
  55. name:'',
  56. data:[],
  57. userUrl:'/sys/user/querywagesList'
  58. }
  59. },
  60. watch:{
  61. name:{
  62. handler(newVal, objVal) {
  63. this.querys(newVal);
  64. },
  65. }
  66. },
  67. created(){
  68. this.initData()
  69. this.querys(this.name)
  70. },
  71. methods:{
  72. initData: function(cur) {
  73. // var leftcount = 0 // 存放剩余数量
  74. var date
  75. if (cur) {
  76. date = new Date(cur)
  77. } else {
  78. var now = new Date()
  79. var d = new Date(this.formatDate(now.getFullYear(), now.getMonth(), 1))
  80. d.setDate(35)
  81. date = new Date(this.formatDate(d.getFullYear(), d.getMonth() + 1, 1))
  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. var m = month
  111. if (m < 10) m = '0' + m
  112. var d = day
  113. if(day!=null &&day !=""){
  114. if (d < 10) d = '0' + d
  115. return y + '-' + m + '-' + d
  116. }else{
  117. return y + '-' + m
  118. }
  119. },
  120. details(item){
  121. this.$store.commit('SET_WAGESID',item);
  122. this.$Router.push({name:'wagesdetail2'})
  123. },
  124. query(){
  125. this.data=[];
  126. this.$http.get(this.userUrl,{params:{username:this.name}}).then(res=>{
  127. if(res.data.length>0){
  128. for(var i=0;i<res.data.length;i++){
  129. var s={
  130. id:res.data[i].id,
  131. realname:res.data[i].realname,
  132. post:res.data[i].post,
  133. avatar:(res.data[i].avatar && res.data[i].avatar.length > 0)? api.getFileAccessHttpUrl(res.data[i].avatar):'/static/avatar_boy.png',
  134. orgCodeTxt:res.data[i].orgCodeTxt,
  135. del:res.data[i].del
  136. }
  137. this.data.push(s)
  138. }
  139. }
  140. }).catch(err => {
  141. console.log(err);
  142. });
  143. },
  144. querys(s){
  145. this.data=[];
  146. this.$http.get(this.userUrl,{params:{username:s,depid:this.$store.getters.departId}}).then(res=>{
  147. if(res.data.length>0){
  148. for(var i=0;i<res.data.length;i++){
  149. var s={
  150. id:res.data[i].id,
  151. realname:res.data[i].realname,
  152. post:res.data[i].post,
  153. avatar:(res.data[i].avatar && res.data[i].avatar.length > 0)? api.getFileAccessHttpUrl(res.data[i].avatar):'/static/avatar_boy.png',
  154. orgCodeTxt:res.data[i].orgCodeTxt,
  155. del:res.data[i].del
  156. }
  157. this.data.push(s)
  158. }
  159. }
  160. }).catch(err => {
  161. console.log(err);
  162. });
  163. },
  164. ret(){
  165. this.$Router.push({name:'index'})
  166. }
  167. }
  168. }
  169. </script>
  170. <style>
  171. .month ul {
  172. margin: 0;
  173. padding: 0;
  174. display: flex;
  175. justify-content: space-between;
  176. height: 35px;
  177. }
  178. .year-month {
  179. display: flex;
  180. align-items: center;
  181. justify-content: space-around;
  182. margin-top: 10px;
  183. }
  184. .choose-month {
  185. text-align: center;
  186. font-size: 12px;
  187. }
  188. .arrow {
  189. padding: 15px;
  190. color: #999999;
  191. }
  192. .month ul li {
  193. font-size: 12px;
  194. text-transform: uppercase;
  195. letter-spacing: 3px;
  196. }
  197. #calendar {
  198. font-size: 12px;
  199. width: 100%;
  200. margin: 0 auto;
  201. box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.1),
  202. 0 1px 5px 0 rgba(0, 0, 0, 0.12);
  203. }
  204. .month {
  205. width: 100%;
  206. color: #333333;
  207. background: #ffffff;
  208. }
  209. .ins{
  210. background-color: #F1F1F1;
  211. width: 90%;
  212. height: 30px;
  213. margin:0 auto;
  214. border-radius:5px 5px 5px 5px;
  215. margin-top: 10px;
  216. }
  217. .s{
  218. list-style-type:none;
  219. margin-left: -40px;
  220. }
  221. .imgs{
  222. width: 40px;
  223. height: 40px;
  224. border-radius:5px 5px 5px 5px;
  225. }
  226. .top{
  227. background-color: #5677AC;
  228. width: 100%;
  229. height: 40px;
  230. }
  231. </style>