userwork.vue 7.3 KB

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