duty_information.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489
  1. <template>
  2. <view>
  3. <!-- header -->
  4. <view class="header">
  5. <view class="header_title" :class="active===2?'active':''" @click="click_item(2)">
  6. <view class="title">单位值班表</view>
  7. <view class="line"></view>
  8. </view>
  9. <view class="header_title" :class="active===1?'active':''" @click="click_item(1)">
  10. <view class="title">我的值班</view>
  11. <view class="line"></view>
  12. </view>
  13. <!-- <view class="header_title" :class="active===3?'active':''" @click="click_item(3)">
  14. <view class="title">全公司值班</view>
  15. <view class="line"></view>
  16. </view> -->
  17. </view>
  18. <!-- content -->
  19. <view class="content" v-if="active === 1">
  20. <scroll-view scroll-x>
  21. <!-- 月份 -->
  22. <view class="month">
  23. <view class="month_list">
  24. <view class="month_item" v-for="(item,index) in month_list" :key="index"
  25. :class="month_item_active===index?'month_item_active':''"
  26. @click="click_month_item(index,item)">
  27. <view class="text">{{item.month}}</view>
  28. </view>
  29. </view>
  30. </view>
  31. </scroll-view>
  32. <!-- 内容 -->
  33. <view class="inner" v-if="month_list.length > 0">
  34. <view class="inner_title">
  35. <view class="time">时间</view>
  36. <view class="name">值班人</view>
  37. </view>
  38. <view class="inner_box">
  39. <view class="inner_item" v-for="item in list" :key="item.id">
  40. <view class="item_left">
  41. <view class="month_day">{{item.date}}</view>
  42. <view class="week">{{item.week}}</view>
  43. </view>
  44. <view class="item_right">
  45. <view class="inner_info">
  46. <text>
  47. {{item.content}}
  48. </text>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. <view v-if="month_list.length == 0"
  55. style="text-align: center;line-height: 90rpx;font-size: 28rpx;color:#666; ">当前没有你值班的排期!</view>
  56. </view>
  57. <!-- content -->
  58. <view class="content" v-if="active === 2">
  59. <scroll-view scroll-x>
  60. <!-- 月份 -->
  61. <view class="month">
  62. <view class="month_list">
  63. <view class="month_item" v-for="(item,index) in month_all_list" :key="index"
  64. :class="month_all_item_active===index?'month_item_active':''"
  65. @click="click_month_all_item(index,item)">
  66. <view class="text">{{item}}</view>
  67. </view>
  68. </view>
  69. </view>
  70. </scroll-view>
  71. <!-- 内容 -->
  72. <view class="inner">
  73. <view class="inner_title">
  74. <view class="time">时间</view>
  75. <view class="name">值班人</view>
  76. </view>
  77. <view class="inner_box">
  78. <view class="inner_item" v-for="item in all_list" :key="item.id">
  79. <view class="item_left">
  80. <view class="month_day">{{item.date}}</view>
  81. <view class="week">{{item.week}}</view>
  82. </view>
  83. <view class="item_right">
  84. <view class="inner_info">
  85. <text>
  86. {{item.content}}
  87. </text>
  88. </view>
  89. </view>
  90. </view>
  91. </view>
  92. </view>
  93. </view>
  94. <view class="content" v-if="active === 3">
  95. <view class="section_name">
  96. <view>
  97. <picker mode="multiSelector" @columnchange="columnchange" @change="change_section" :value="array" :range="array" range-key="title">
  98. <view class="uni-input">{{section_name}}</view>
  99. </picker>
  100. </view>
  101. <view>
  102. <uni-icons type="right"></uni-icons>
  103. </view>
  104. </view>
  105. </view>
  106. </view>
  107. </template>
  108. <script>
  109. const user = uni.getStorageSync('user')
  110. // console.log(user.name)
  111. export default {
  112. data() {
  113. return {
  114. // 默认选中表
  115. active: 2,
  116. // 我的值班
  117. // 当前选中的月份
  118. month_item_active: 0,
  119. // 值班月份-个人
  120. month_list: [],
  121. // 值班信息
  122. list: [],
  123. // 值班表
  124. // 当前选中的月份
  125. month_all_item_active: 0,
  126. // 值班月份-所有人
  127. month_all_list: [],
  128. // 值班信息
  129. all_list: [],
  130. // 全公司值班
  131. section_name: "部门名称",
  132. array: [
  133. [],
  134. []
  135. ],
  136. index: [0, 0],
  137. };
  138. },
  139. onLoad() {
  140. // 获取值班月份-所有人
  141. this.getMonthAll()
  142. // 获取值班月份-个人
  143. this.getMonth()
  144. // 全公司值班
  145. this.get_section_get_tree_structure(285)
  146. },
  147. methods: {
  148. // 当前选中的表
  149. click_item(item) {
  150. this.active = item
  151. },
  152. click_month_item(index) {
  153. this.month_item_active = index
  154. },
  155. // 值班月份-所有人
  156. click_month_all_item(index, item) {
  157. // 当前点击的月份
  158. this.month_all_item_active = index
  159. // 获取值班列表-所有人
  160. this.getAllList(item)
  161. },
  162. // 值班月份-个人
  163. click_month_item(index, item) {
  164. // 当前点击的月份
  165. this.month_item_active = index
  166. // 获取值班列表-所有人
  167. this.getList(item.month)
  168. },
  169. // 获取值班月份-所有人
  170. getMonthAll() {
  171. this.$api.notice_all_list_month({
  172. }).then((res) => {
  173. const data = res.data.data
  174. this.month_all_list = data
  175. // 获取值班列表-所有人
  176. this.getAllList(this.month_all_list[0])
  177. })
  178. },
  179. // 获取值班信息-所有人
  180. getAllList(month) {
  181. this.$api.notice_all_list_list({
  182. month: month
  183. }).then((res) => {
  184. // console.log(res.data)
  185. const data = res.data.data
  186. this.all_list = data
  187. })
  188. },
  189. // 获取值班月份-个人
  190. getMonth() {
  191. this.$api.notice_my_list_month({
  192. name: user.name
  193. }).then((res) => {
  194. console.log(res.data.data)
  195. const data = res.data.data
  196. this.month_list = data
  197. // 获取值班列表-个人
  198. this.getList(this.month_list[0].month)
  199. // console.log(this.month_list[0].month)
  200. })
  201. },
  202. // 获取值班信息-个人
  203. getList(month) {
  204. this.$api.notice_my_list_list({
  205. month: month,
  206. name: user.name
  207. }).then((res) => {
  208. console.log(res)
  209. const data = res.data.data
  210. this.list = data
  211. })
  212. },
  213. // 全公司值班
  214. get_section_get_tree_structure(section_id) {
  215. this.$api.section_get_tree_structure({
  216. section_id: section_id
  217. }).then((res) => {
  218. this.array[0] = res.data.content.data.children
  219. this.$api.section_get_tree_structure({
  220. section_id: res.data.content.data.children[0].id
  221. }).then((res) => {
  222. this.array[1] = res.data.content.data.children
  223. this.section_name = this.array[0][0].title+ '-' +this.array[1][0].title
  224. })
  225. })
  226. },
  227. change_section(e) {
  228. console.log('picker发送选择改变,携带值为', e.detail.value)
  229. this.index = e.detail.value
  230. this.section_name = this.array[0][this.index[0]].title+ '-' +this.array[1][this.index[1]].title
  231. },
  232. columnchange(e) {
  233. let column = e.detail.column
  234. let value = e.detail.value
  235. if (column == 0) {
  236. uni.showLoading({
  237. mask: true
  238. })
  239. this.array[1] = []
  240. this.$api.section_get_tree_structure({
  241. section_id: this.array[0][value].id
  242. }).then((res) => {
  243. uni.hideLoading()
  244. this.array[1] = res.data.content.data.children
  245. this.$forceUpdate()
  246. })
  247. }
  248. }
  249. }
  250. }
  251. </script>
  252. <style lang="scss">
  253. page {
  254. background-color: #f0f0f0;
  255. }
  256. .header {
  257. background-color: #fff;
  258. width: 100%;
  259. height: 97rpx;
  260. box-sizing: border-box;
  261. padding-top: 21rpx;
  262. display: flex;
  263. .header_title {
  264. // width: 250rpx;
  265. width: 50%;
  266. .title {
  267. text-align: center;
  268. height: 47rpx;
  269. font-size: 32rpx;
  270. font-weight: 500;
  271. color: #BDC3C7;
  272. line-height: 47rpx;
  273. }
  274. }
  275. .active {
  276. .title {
  277. color: #009FE8;
  278. }
  279. .line {
  280. margin-top: 28rpx;
  281. background-color: #009FE8;
  282. height: 4rpx;
  283. }
  284. }
  285. }
  286. .content {
  287. .month {
  288. height: 100rpx;
  289. box-sizing: border-box;
  290. padding-left: 13rpx;
  291. padding-top: 24rpx;
  292. .month_list {
  293. display: flex;
  294. .month_item {
  295. box-sizing: border-box;
  296. border: 1rpx solid #009FE8;
  297. background-color: transparent;
  298. height: 60rpx;
  299. border-radius: 10rpx;
  300. text-align: center;
  301. margin-right: 21rpx;
  302. .text {
  303. width: 210rpx;
  304. font-size: 32rpx;
  305. font-weight: 400;
  306. color: #009FE8;
  307. line-height: 60rpx;
  308. }
  309. }
  310. .month_item_active {
  311. background-color: #009FE8;
  312. .text {
  313. color: #FFF;
  314. }
  315. }
  316. }
  317. }
  318. .inner {
  319. .inner_title {
  320. width: 750rpx;
  321. height: 94rpx;
  322. background: #FFFFFF;
  323. box-sizing: border-box;
  324. padding: 0 21rpx;
  325. border-bottom: 4rpx solid #009FE8;
  326. display: flex;
  327. .time {
  328. width: 194rpx;
  329. font-size: 32rpx;
  330. font-weight: 500;
  331. color: #009FE8;
  332. line-height: 94rpx;
  333. text-align: center;
  334. }
  335. .name {
  336. margin-left: 45rpx;
  337. width: 469rpx;
  338. font-size: 32rpx;
  339. font-weight: 500;
  340. color: #009FE8;
  341. line-height: 94rpx;
  342. text-align: center;
  343. }
  344. }
  345. .inner_box {
  346. .inner_item {
  347. margin-bottom: 2rpx;
  348. background-color: #fff;
  349. box-sizing: border-box;
  350. padding: 21rpx;
  351. display: flex;
  352. align-items: center;
  353. .item_left {
  354. width: 194rpx;
  355. .month_day {
  356. text-align: center;
  357. height: 39rpx;
  358. font-size: 30rpx;
  359. font-weight: 400;
  360. color: #232627;
  361. line-height: 39rpx;
  362. }
  363. .week {
  364. text-align: center;
  365. height: 30rpx;
  366. font-size: 27rpx;
  367. font-weight: 400;
  368. color: #6C6F74;
  369. line-height: 39rpx;
  370. }
  371. }
  372. .item_right {
  373. width: 469rpx;
  374. .inner_info {
  375. margin-left: 45rpx;
  376. text {
  377. font-size: 30rpx;
  378. font-weight: 500;
  379. color: #232627;
  380. line-height: 39rpx;
  381. }
  382. }
  383. }
  384. }
  385. }
  386. }
  387. .section_name {
  388. width: 750rpx;
  389. box-sizing: border-box;
  390. padding: 25rpx;
  391. background-color: #FFFFFF;
  392. font-size: 30rpx;
  393. color: #545454;
  394. display: flex;
  395. align-items: center;
  396. justify-content: space-between;
  397. .uni-input {
  398. width: 600rpx;
  399. }
  400. }
  401. }
  402. </style>