duty_information.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. <template>
  2. <view>
  3. <!-- header -->
  4. <view class="header">
  5. <view class="header_title" :class="active===1?'active':''" @click="click_item(1)">
  6. <view class="title">我的值班</view>
  7. <view class="line"></view>
  8. </view>
  9. <view class="header_title" :class="active===2?'active':''" @click="click_item(2)">
  10. <view class="title">值班表</view>
  11. <view class="line"></view>
  12. </view>
  13. </view>
  14. <!-- content -->
  15. <view class="content" v-if="active === 1">
  16. <scroll-view scroll-x>
  17. <!-- 月份 -->
  18. <view class="month">
  19. <view class="month_list">
  20. <view class="month_item" v-for="(item,index) in month_list" :key="index" :class="month_item_active===index?'month_item_active':''" @click="click_month_item(index,item)">
  21. <view class="text">{{item.month}}</view>
  22. </view>
  23. </view>
  24. </view>
  25. </scroll-view>
  26. <!-- 内容 -->
  27. <view class="inner" v-if="month_list.length > 0">
  28. <view class="inner_title">
  29. <view class="time">时间</view>
  30. <view class="name">值班人</view>
  31. </view>
  32. <view class="inner_box">
  33. <view class="inner_item" v-for="item in list" :key="item.id">
  34. <view class="item_left">
  35. <view class="month_day">{{item.date}}</view>
  36. <view class="week">{{item.week}}</view>
  37. </view>
  38. <view class="item_right">
  39. <view class="inner_info">
  40. <text>
  41. {{item.content}}
  42. </text>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <view v-if="month_list.length == 0" style="text-align: center;line-height: 90rpx;font-size: 28rpx;color:#666; ">当前没有你值班的排期!</view>
  49. </view>
  50. <!-- content -->
  51. <view class="content" v-if="active === 2">
  52. <scroll-view scroll-x>
  53. <!-- 月份 -->
  54. <view class="month">
  55. <view class="month_list">
  56. <view class="month_item" v-for="(item,index) in month_all_list" :key="index" :class="month_all_item_active===index?'month_item_active':''" @click="click_month_all_item(index,item)">
  57. <view class="text">{{item}}</view>
  58. </view>
  59. </view>
  60. </view>
  61. </scroll-view>
  62. <!-- 内容 -->
  63. <view class="inner">
  64. <view class="inner_title">
  65. <view class="time">时间</view>
  66. <view class="name">值班人</view>
  67. </view>
  68. <view class="inner_box">
  69. <view class="inner_item" v-for="item in all_list" :key="item.id">
  70. <view class="item_left">
  71. <view class="month_day">{{item.date}}</view>
  72. <view class="week">{{item.week}}</view>
  73. </view>
  74. <view class="item_right">
  75. <view class="inner_info">
  76. <text>
  77. {{item.content}}
  78. </text>
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. </view>
  86. </template>
  87. <script>
  88. const user = uni.getStorageSync('user')
  89. // console.log(user.name)
  90. export default {
  91. data() {
  92. return {
  93. // 默认选中表
  94. active:1,
  95. // 我的值班
  96. // 当前选中的月份
  97. month_item_active:0,
  98. // 值班月份-个人
  99. month_list:[],
  100. // 值班信息
  101. list:[],
  102. // 值班表
  103. // 当前选中的月份
  104. month_all_item_active:0,
  105. // 值班月份-所有人
  106. month_all_list:[],
  107. // 值班信息
  108. all_list:[]
  109. };
  110. },
  111. onLoad() {
  112. // 获取值班月份-所有人
  113. this.getMonthAll()
  114. // 获取值班月份-个人
  115. this.getMonth()
  116. },
  117. methods:{
  118. // 当前选中的表
  119. click_item(item){
  120. this.active = item
  121. },
  122. click_month_item(index){
  123. this.month_item_active = index
  124. },
  125. // 值班月份-所有人
  126. click_month_all_item(index,item){
  127. // 当前点击的月份
  128. this.month_all_item_active = index
  129. // 获取值班列表-所有人
  130. this.getAllList(item)
  131. },
  132. // 值班月份-个人
  133. click_month_item(index,item){
  134. // 当前点击的月份
  135. this.month_item_active = index
  136. // 获取值班列表-所有人
  137. this.getList(item.month)
  138. },
  139. // 获取值班月份-所有人
  140. getMonthAll(){
  141. this.$api.notice_all_list_month({
  142. }).then((res)=>{
  143. const data = res.data.data
  144. this.month_all_list = data
  145. // 获取值班列表-所有人
  146. this.getAllList(this.month_all_list[0])
  147. })
  148. },
  149. // 获取值班信息-所有人
  150. getAllList(month){
  151. this.$api.notice_all_list_list({
  152. month:month
  153. }).then((res)=>{
  154. // console.log(res.data)
  155. const data = res.data.data
  156. this.all_list = data
  157. })
  158. },
  159. // 获取值班月份-个人
  160. getMonth(){
  161. this.$api.notice_my_list_month({
  162. name:user.name
  163. }).then((res)=>{
  164. console.log(res.data.data)
  165. const data = res.data.data
  166. this.month_list = data
  167. // 获取值班列表-个人
  168. this.getList(this.month_list[0].month)
  169. // console.log(this.month_list[0].month)
  170. })
  171. },
  172. // 获取值班信息-个人
  173. getList(month){
  174. this.$api.notice_my_list_list({
  175. month:month,
  176. name:user.name
  177. }).then((res)=>{
  178. console.log(res)
  179. const data = res.data.data
  180. this.list = data
  181. })
  182. },
  183. }
  184. }
  185. </script>
  186. <style lang="scss">
  187. page{
  188. background-color: #f0f0f0;
  189. }
  190. .header{
  191. background-color: #fff;
  192. width: 100%;
  193. height: 97rpx;
  194. box-sizing: border-box;
  195. padding-top: 21rpx;
  196. display: flex;
  197. .header_title{
  198. width: 50%;
  199. .title{
  200. text-align: center;
  201. height: 47rpx;
  202. font-size: 36rpx;
  203. font-weight: 500;
  204. color: #BDC3C7;
  205. line-height: 47rpx;
  206. }
  207. }
  208. .active{
  209. .title{
  210. color: #009FE8;
  211. }
  212. .line{
  213. margin-top: 21rpx;
  214. background-color: #009FE8;
  215. height: 8rpx;
  216. }
  217. }
  218. }
  219. .content{
  220. .month{
  221. height: 100rpx;
  222. box-sizing: border-box;
  223. padding-left: 13rpx;
  224. padding-top: 24rpx;
  225. .month_list{
  226. display: flex;
  227. .month_item{
  228. box-sizing: border-box;
  229. border: 1rpx solid #009FE8;
  230. background-color: transparent;
  231. height: 60rpx;
  232. border-radius: 10rpx;
  233. text-align: center;
  234. margin-right: 21rpx;
  235. .text{
  236. width: 210rpx;
  237. font-size: 32rpx;
  238. font-weight: 400;
  239. color: #009FE8;
  240. line-height: 60rpx;
  241. }
  242. }
  243. .month_item_active{
  244. background-color: #009FE8;
  245. .text{
  246. color: #FFF;
  247. }
  248. }
  249. }
  250. }
  251. .inner{
  252. .inner_title{
  253. width: 750rpx;
  254. height: 94rpx;
  255. background: #FFFFFF;
  256. box-sizing: border-box;
  257. padding: 0 21rpx;
  258. border-bottom: 4rpx solid #009FE8;
  259. display: flex;
  260. .time{
  261. width: 194rpx;
  262. font-size: 32rpx;
  263. font-weight: 500;
  264. color: #009FE8;
  265. line-height: 94rpx;
  266. text-align: center;
  267. }
  268. .name{
  269. margin-left: 45rpx;
  270. width: 469rpx;
  271. font-size: 32rpx;
  272. font-weight: 500;
  273. color: #009FE8;
  274. line-height: 94rpx;
  275. text-align: center;
  276. }
  277. }
  278. .inner_box{
  279. .inner_item{
  280. margin-bottom: 2rpx;
  281. background-color: #fff;
  282. box-sizing: border-box;
  283. padding: 21rpx;
  284. display: flex;
  285. align-items: center;
  286. .item_left{
  287. width: 194rpx;
  288. .month_day{
  289. text-align: center;
  290. height: 39rpx;
  291. font-size: 30rpx;
  292. font-weight: 400;
  293. color: #232627;
  294. line-height: 39rpx;
  295. }
  296. .week{
  297. text-align: center;
  298. height: 30rpx;
  299. font-size: 27rpx;
  300. font-weight: 400;
  301. color: #6C6F74;
  302. line-height: 39rpx;
  303. }
  304. }
  305. .item_right{
  306. width: 469rpx;
  307. .inner_info{
  308. margin-left: 45rpx;
  309. text{
  310. font-size: 30rpx;
  311. font-weight: 500;
  312. color: #232627;
  313. line-height: 39rpx;
  314. }
  315. }
  316. }
  317. }
  318. }
  319. }
  320. }
  321. </style>