userwork.vue 6.7 KB

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