leaveDetails.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <template>
  2. <view>
  3. <u-navbar title="请假条详情"></u-navbar>
  4. <view class="head">
  5. <view class="photo">
  6. <u-avatar class="avatar" mode="square"
  7. :src="leaveDetail.headPhoto != null ? leaveDetail.headPhoto : '../../assets/img/head.png'" size="84">
  8. </u-avatar>
  9. </view>
  10. <view class="title">
  11. {{leaveDetail.studentName}}的请假条
  12. </view>
  13. <view class="state1" v-if="leaveDetail.status == 0">
  14. 待处理
  15. </view>
  16. <view class="state2" v-if="leaveDetail.status == 1">
  17. 已审核
  18. </view>
  19. <view class="state3" v-if="leaveDetail.status == -1">
  20. 已取消
  21. </view>
  22. </view>
  23. <view class="main">
  24. <view class="item">
  25. <view class="title">
  26. 所属班级
  27. </view>
  28. <view class="value">
  29. {{leaveDetail.className}}
  30. </view>
  31. </view>
  32. <view class="item">
  33. <view class="title">
  34. 请假日期
  35. </view>
  36. <view class="value">
  37. {{leaveDetail.courseDate}}
  38. </view>
  39. </view>
  40. <view class="item">
  41. <view class="title">
  42. 请假课次
  43. </view>
  44. <view class="value">
  45. {{leaveDetail.coursePeriods}}
  46. </view>
  47. </view>
  48. <view class="item">
  49. <view class="title">
  50. 授课老师
  51. </view>
  52. <view class="value">
  53. {{leaveDetail.teacherName}}
  54. </view>
  55. </view>
  56. <view class="reason">
  57. <view class="title">
  58. 请假事由
  59. </view>
  60. <view class="value">
  61. {{leaveDetail.leaveReason}}
  62. </view>
  63. </view>
  64. <view class="accessory">
  65. <view class="title">
  66. 老师签字
  67. </view>
  68. <view class="value">
  69. <img :src="leaveDetail.signUrl" alt="">
  70. </view>
  71. </view>
  72. <view class="item">
  73. <view class="title">
  74. 老师回复
  75. </view>
  76. <view class="value">
  77. {{leaveDetail.auditComm}}
  78. </view>
  79. </view>
  80. <view class="item">
  81. <view class="title">
  82. 提交时间
  83. </view>
  84. <view class="value">
  85. {{leaveDetail.createTime}}
  86. </view>
  87. </view>
  88. </view>
  89. <view class="btn" v-if="leaveDetail.status == 0">
  90. <button @click="leaveCancel">撤销</button>
  91. </view>
  92. <view class="btn" v-if="leaveDetail.status == -1">
  93. <button style="background-color: #DBDBDB" disabled>已撤销</button>
  94. </view>
  95. </view>
  96. </template>
  97. <script>
  98. import * as sickNoteApi from '@/apis/youth/sickNote.js'
  99. export default {
  100. data() {
  101. return {
  102. leaveId: '',
  103. leaveDetail: {}
  104. }
  105. },
  106. onLoad(op) {
  107. if (op.id) {
  108. this.leaveId = op.id;
  109. this.getLeaveDetail();
  110. }
  111. },
  112. methods: {
  113. leaveCancel() {
  114. uni.showLoading({
  115. title: "加载中",
  116. mask: true,
  117. })
  118. sickNoteApi.cancelStudentLeaveLog({
  119. leaveId: this.leaveId
  120. }).then((res) => {
  121. uni.hideLoading();
  122. uni.navigateBack({
  123. })
  124. }).catch(error => {
  125. uni.showToast({
  126. title: error,
  127. icon: "none"
  128. })
  129. })
  130. },
  131. getLeaveDetail() {
  132. uni.showLoading({
  133. title: "加载中",
  134. mask: true,
  135. })
  136. sickNoteApi.getStudentLeaveLog({
  137. leaveId: this.leaveId
  138. }).then((res) => {
  139. uni.hideLoading();
  140. this.leaveDetail = res.data;
  141. this.leaveDetail.createTime = this.getFormatDate(res.data.createTime);
  142. }).catch(error => {
  143. uni.showToast({
  144. title: error,
  145. icon: "none"
  146. })
  147. })
  148. },
  149. getFormatDate(val) {
  150. let date = new Date(val);
  151. let myyear = date.getFullYear();
  152. let mymonth = date.getMonth() + 1;
  153. let myweekday = date.getDate();
  154. let hour = date.getHours();
  155. let minute = date.getMinutes();
  156. let second = date.getSeconds();
  157. if (mymonth < 10) {
  158. mymonth = '0' + mymonth;
  159. }
  160. if (myweekday < 10) {
  161. myweekday = '0' + myweekday;
  162. }
  163. if(hour < 10) {
  164. hour = '0' + hour;
  165. }
  166. if(minute < 10) {
  167. minute = '0' + minute;
  168. }
  169. if(second < 10) {
  170. second = '0' + second;
  171. }
  172. return (myyear + '-' + mymonth + '-' + myweekday + ' ' + hour + ':' + minute + ':' + second);
  173. },
  174. }
  175. }
  176. </script>
  177. <style lang="scss" scoped>
  178. .head {
  179. margin: 12px 16px;
  180. padding: 12px;
  181. border-radius: 12px;
  182. background-color: rgba(255, 255, 255, 1);
  183. display: flex;
  184. align-items: center;
  185. .photo {
  186. width: 84rpx;
  187. height: 84rpx;
  188. border-radius: 4px;
  189. overflow: hidden;
  190. img {
  191. width: 100%;
  192. height: 100%;
  193. }
  194. }
  195. .title {
  196. color: rgba(51, 51, 51, 1);
  197. font-size: 16px;
  198. font-weight: bold;
  199. margin-left: 24rpx;
  200. }
  201. .state1 {
  202. margin-left: auto;
  203. border-radius: 50px;
  204. background-color: rgba(255, 255, 255, 1);
  205. color: rgba(22, 119, 255, 1);
  206. font-size: 12px;
  207. text-align: center;
  208. border: 1px solid 1px solid rgba(22, 119, 255, 1);
  209. padding: 7rpx 26rpx;
  210. }
  211. .state2 {
  212. margin-left: auto;
  213. border-radius: 50px;
  214. background-color: rgba(255, 255, 255, 1);
  215. color: rgba(0, 187, 170, 1);
  216. font-size: 12px;
  217. text-align: center;
  218. border: 1px solid rgba(0, 187, 170, 1);
  219. padding: 7rpx 26rpx;
  220. }
  221. .state3 {
  222. margin-left: auto;
  223. border-radius: 50px;
  224. background-color: rgba(255, 255, 255, 1);
  225. color: rgba(153, 153, 153, 1);
  226. font-size: 12px;
  227. text-align: center;
  228. border: 1px solid 1px solid rgba(153, 153, 153, 1);
  229. padding: 7rpx 26rpx;
  230. }
  231. }
  232. .main {
  233. border-radius: 12px;
  234. background-color: #fff;
  235. margin: 0 16px;
  236. .item {
  237. padding: 11px 15px 14px 15px;
  238. border-bottom: 1px solid rgba(244, 244, 244, 1);
  239. display: flex;
  240. justify-content: space-between;
  241. align-items: center;
  242. .title {
  243. color: rgba(119, 119, 119, 1);
  244. }
  245. .value {
  246. color: rgba(51, 51, 51, 1);
  247. }
  248. }
  249. .reason,
  250. .accessory {
  251. padding: 11px 15px;
  252. border-bottom: 1px solid rgba(244, 244, 244, 1);
  253. .title {
  254. color: rgba(119, 119, 119, 1);
  255. }
  256. .value {
  257. margin-top: 8px;
  258. color: rgba(51, 51, 51, 1);
  259. img {
  260. width: 240rpx;
  261. height: 120rpx;
  262. }
  263. }
  264. }
  265. .accessory {
  266. .value {
  267. margin-top: 12px;
  268. }
  269. }
  270. }
  271. .btn {
  272. position: fixed;
  273. left: 0;
  274. right: 0;
  275. bottom: 0;
  276. padding: 10px 12px;
  277. background-color: #fff;
  278. button {
  279. border-radius: 50px;
  280. background-color: rgba(13, 186, 199, 1);
  281. color: rgba(255, 255, 255, 1);
  282. font-size: 16px;
  283. line-height: 40px;
  284. }
  285. }
  286. </style>