w-Onduty.vue 8.5 KB

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