leaveOperation.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. <template>
  2. <div class='infoWrap'>
  3. <div class="left">
  4. <div class="unread" @click="onLookMessage('all')">全部</div>
  5. <div class="unread" @click="onLookMessage('0')"> <img :src="img.boxicon"
  6. alt=""> 未读消息
  7. <div class="count" v-if="noReadMessage >= 1">{{ noReadMessage }}</div>
  8. </div>
  9. <div class="read" @click="onLookMessage('1')">
  10. <img :src="img.bookicon"
  11. alt="">
  12. 已读消息</div>
  13. </div>
  14. <div class="middle">
  15. <div class="msgItem" :class="[isCheckMessage == item.id ? 'active' : '']" @click="onClickRead(item)" v-for="(item, index) in dataList" :key="index">
  16. <!-- <h6 class="type"></h6> -->
  17. <h4 class="name">请假处理<span class='time'>{{ item.createOn }}</span>
  18. <div class="dot" v-if="item.readStatus == 0"></div>
  19. </h4>
  20. <p class='msg'>{{ item.content }}</p>
  21. </div>
  22. <el-pagination style="text-align: right"
  23. small v-if="dataList.length > 0"
  24. @current-change="onChange"
  25. :hide-on-single-page="pageInfo.isSinglePage"
  26. layout="prev, pager, next"
  27. :total="pageInfo.total">
  28. </el-pagination>
  29. </div>
  30. <div class="right" v-if="showRight">
  31. <div class="rightWrap">
  32. <img src="@/assets/images/base/placehorder-icon.png"
  33. class="header"
  34. alt="">
  35. <div class="info">
  36. <h2>{{ showMessage.user.username }}
  37. <!-- <span class="phone">【{{ showMessage.user.phone }}】</span> -->
  38. <el-tag v-if="showMessage.status == 'PASS'" type="success" effect="plain">已处理</el-tag>
  39. <el-tag v-if="showMessage.status == 'REJECT'" type="danger" effect="plain">已拒绝</el-tag>
  40. </h2>
  41. <p class="subMsg">发至 <span class='san'></span> <span style="margin-left:30px">我</span></p>
  42. <div class="textWrap">
  43. <p>审批事项: 请假</p>
  44. <p>开始时间: {{ showMessage.startTime }}</p>
  45. <p>结束时间: {{ showMessage.endTime }}</p>
  46. <p>备注: {{ showMessage.remark }}</p>
  47. </div>
  48. <div class="leaverecord">
  49. <el-table :data="showMessage.coursesScheduleJson" style="width: 100%" :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  50. <el-table-column label="类型" width="60px">
  51. <template slot-scope="scope">
  52. {{ scope.row.befor.type == "VIP" ? 'VIP课' : '乐团课' }}
  53. </template>
  54. </el-table-column>
  55. <el-table-column prop="befor.name" label="班名" width="140px">
  56. </el-table-column>
  57. <el-table-column label="调整前日期">
  58. <template slot-scope="scope">
  59. {{ scope.row.befor.classDate | formatTimer }}
  60. </template>
  61. </el-table-column>
  62. <el-table-column label="上课时间">
  63. <template slot-scope="scope">
  64. {{ scope.row.befor.startClassTime | getFormatTime(scope.row.befor.endClassTime) }}
  65. </template>
  66. </el-table-column>
  67. <el-table-column label="调整后日期">
  68. <template slot-scope="scope">
  69. {{ scope.row.after.classDate | formatTimer }}
  70. </template>
  71. </el-table-column>
  72. <el-table-column label="调整后时间">
  73. <template slot-scope="scope">
  74. {{ scope.row.after.startClassTime | getFormatTime(scope.row.after.endClassTime) }}
  75. </template>
  76. </el-table-column>
  77. <!-- <el-table-column label="操作" v-if="showMessage.status == 'ING'">
  78. <template slot-scope="scope">
  79. <el-button @click="onClssTime(scope.row)" type="text">调整</el-button>
  80. </template>
  81. </el-table-column> -->
  82. </el-table>
  83. </div>
  84. </div>
  85. </div>
  86. <div class="infoFoot" v-if="showMessage.status == 'ING'">
  87. <div class="noBtn" @click="onSubmit(showMessage, 'REJECT')">拒绝</div>
  88. <div class="yesBtn" @click="onSubmit(showMessage, 'PASS')">同意</div>
  89. </div>
  90. </div>
  91. <el-dialog title="调整时间"
  92. :visible.sync="dialogVisible"
  93. width="30%">
  94. <el-form ref="form" label-width="80px">
  95. <el-form-item label="调整日期">
  96. <el-date-picker
  97. v-model="changeDate"
  98. value-format="yyyy-MM-dd HH:mm:SS"
  99. type="datetime"
  100. placeholder="选择日期">
  101. </el-date-picker>
  102. </el-form-item>
  103. </el-form>
  104. <span slot="footer" class="dialog-footer">
  105. <el-button @click="dialogVisible = false">取 消</el-button>
  106. <el-button type="primary" @click="onDialogChange">确 定</el-button>
  107. </span>
  108. </el-dialog>
  109. </div>
  110. </template>
  111. <script>
  112. import { queryCountOfUnread, sysMessageList, leaveQueryDetail, setRead, approve } from '@/api/journal'
  113. export default {
  114. data () {
  115. return {
  116. img: {
  117. bookicon: require('@/assets/images/base/bookicon.png'),
  118. Hbookicon: require('@/assets/images/base/bookicon-h.png'),
  119. trashicon: require('@/assets/images/base/trashicon.png'),
  120. Htrashicon: require('@/assets/images/base/trashicon-h.png'),
  121. boxicon: require('@/assets/images/base/boxicon.png'),
  122. Hboxicon: require('@/assets/images/base/boxicon-h.png')
  123. },
  124. pageInfo: {
  125. isSinglePage: false, // 是否只有一页
  126. limit: 10,
  127. page: 1,
  128. readStatus: null,
  129. total: 0,
  130. },
  131. noReadMessage: 0, // 未读消息
  132. dataList: [],
  133. isCheckMessage: null,
  134. showRight: false,
  135. dialogVisible: false,
  136. dialogData: [],
  137. changeDate: null,
  138. showMessage: {}
  139. }
  140. },
  141. mounted() {
  142. this.__init()
  143. this.sysMessageList()
  144. },
  145. methods: {
  146. __init() {
  147. // 未读消息
  148. queryCountOfUnread().then(res => {
  149. if(res.code == 200) {
  150. if(res.data && res.data.LEAVE) {
  151. this.noReadMessage = res.data.LEAVE
  152. }
  153. }
  154. })
  155. },
  156. onSubmit(showMessage, type) {
  157. let params = {
  158. id: showMessage.id,
  159. // remark: null,
  160. status: type,
  161. userId: showMessage.userId
  162. }
  163. approve(params).then(res => {
  164. if(res.code == 200) {
  165. this.$message.success('处理成功')
  166. this.getLeaveItem(JSON.stringify({ leaveRecordId: showMessage.id }))
  167. } else {
  168. this.$message.error(res.msg)
  169. }
  170. })
  171. },
  172. onDialogChange() {
  173. if(!this.changeDate) {
  174. this.$message.error('请选择调整日期')
  175. return
  176. }
  177. let tempDate = new Date(this.changeDate)
  178. let startStr = '2019/10/10 ' + this.getDateInfo(this.dialogData.befor.startClassTime),
  179. endStr = '2019/10/10 ' + this.getDateInfo(this.dialogData.befor.endClassTime)
  180. let startDate = new Date(startStr),
  181. endDate = new Date(endStr)
  182. let m = parseInt(Math.abs(endDate.getTime() - startDate.getTime()) / 1000 / 60)
  183. let tempLastDate = tempDate.setMinutes(tempDate.getMinutes() + m)
  184. this.dialogData.after.classDate = this.getFormatDate(tempDate)
  185. this.dialogData.after.startClassTime = this.getFormatDate(tempDate)
  186. this.dialogData.after.endClassTime = this.getFormatDate(tempLastDate)
  187. this.dialogVisible = false
  188. },
  189. getFormatDate(data) {
  190. let tempDate = new Date(data)
  191. let month = (tempDate.getMonth() + 1) >= 10 ? (tempDate.getMonth() + 1) : '0' + (tempDate.getMonth() + 1)
  192. let day = tempDate.getDate() >= 10 ? tempDate.getDate() : '0' + tempDate.getDate()
  193. let tDate = tempDate.getFullYear() + '-' + month + '-' + day
  194. let hours = tempDate.getHours() >= 10 ? tempDate.getHours() : '0' + tempDate.getHours()
  195. let min = tempDate.getMinutes() >= 10 ? tempDate.getMinutes() : '0' + tempDate.getMinutes()
  196. return tDate + ' ' + hours + ':' + min + ':00'
  197. },
  198. getDateInfo(value) {
  199. let tempValue = value
  200. if(typeof value !== 'object') {
  201. tempValue = value.replace(/-/ig, '/')
  202. }
  203. let d = new Date(tempValue)
  204. let hour = d.getHours() >= 10 ? d.getHours() : '0' + d.getHours()
  205. let minute = d.getMinutes() >= 10 ? d.getMinutes() : '0' + d.getMinutes()
  206. return hour + ':' + minute + ':00'
  207. },
  208. onClssTime(row) {
  209. this.dialogVisible = true
  210. this.dialogData = row
  211. },
  212. sysMessageList() { // 列表
  213. sysMessageList({
  214. group: 'LEAVE',
  215. rows: this.pageInfo.limit,
  216. page: this.pageInfo.page,
  217. readStatus: this.pageInfo.readStatus
  218. }).then(res => {
  219. if(res.code == 200) {
  220. this.dataList = res.data.rows
  221. this.pageInfo.total = res.data.total
  222. }
  223. })
  224. },
  225. onLookMessage(type) { // 查看对应的数据
  226. if(type == "all") {
  227. this.pageInfo.readStatus = null
  228. } else {
  229. this.pageInfo.readStatus = type
  230. }
  231. this.pageInfo.page = 1
  232. this.showRight = false
  233. this.showMessage = {}
  234. this.isCheckMessage = null
  235. this.sysMessageList()
  236. },
  237. onChange(page) { // 分页
  238. this.pageInfo.page = page
  239. this.sysMessageList()
  240. },
  241. onClickRead(item) {
  242. this.isCheckMessage = item.id
  243. if(item.readStatus == 1) {
  244. this.getLeaveItem(item.memo)
  245. } else {
  246. setRead({ id: item.id }).then(res => {
  247. let result = res.data
  248. if(res.code == 200) {
  249. item.readStatus = 1
  250. this.getLeaveItem(item.memo)
  251. this.noReadMessage--
  252. }
  253. })
  254. }
  255. },
  256. getLeaveItem(memo) {
  257. memo = JSON.parse(memo)
  258. leaveQueryDetail({ id: memo.leaveRecordId }).then(res => {
  259. if(res.code == 200) {
  260. this.showRight = true
  261. if(res.data.coursesScheduleJson) {
  262. res.data.coursesScheduleJson = JSON.parse(res.data.coursesScheduleJson)
  263. }
  264. this.showMessage = res.data
  265. this.remark = res.data.reason
  266. } else {
  267. this.$message.error(res.msg)
  268. }
  269. })
  270. }
  271. },
  272. filters: {
  273. getFormatTime(tempA, tempB) {
  274. tempA = new Date(tempA.replace(/-/g, "/")),
  275. tempB = new Date(tempB.replace(/-/g, "/"))
  276. let hours = Number(tempA.getHours()) >= 10 ? tempA.getHours() : '0' + tempA.getHours()
  277. let hours2 = Number(tempB.getHours()) >= 10 ? tempB.getHours() : '0' + tempB.getHours()
  278. let min = Number(tempA.getMinutes()) >= 10 ? tempA.getMinutes() : '0' + tempA.getMinutes()
  279. let min2 = Number(tempB.getMinutes()) >= 10 ? tempB.getMinutes() : '0' + tempB.getMinutes()
  280. return hours + ':' + min + '-' + hours2 + ':' + min2
  281. }
  282. }
  283. }
  284. </script>
  285. <style lang="scss" scoped>
  286. .infoWrap {
  287. display: flex;
  288. flex-direction: row;
  289. justify-content: flex-start;
  290. height: calc(100vh - 266px);
  291. overflow: auto;
  292. .left {
  293. padding-top: 24px;
  294. display: flex;
  295. flex-direction: column;
  296. align-items: left;
  297. > div {
  298. height: 26px;
  299. line-height: 26px;
  300. margin-top: 26px;
  301. img {
  302. position: relative;
  303. top: 6px;
  304. }
  305. }
  306. .unread, .read, .recovery {
  307. cursor: pointer;
  308. }
  309. .unread {
  310. position: relative;
  311. img {
  312. width: 26px;
  313. height: 25px;
  314. }
  315. .count {
  316. position: absolute;
  317. width: 38px;
  318. height: 23px;
  319. background: rgba(20, 146, 138, 0.5);
  320. border-radius: 100px;
  321. font-size: 12px;
  322. line-height: 23px;
  323. text-align: center;
  324. color: #225551;
  325. right: -44px;
  326. top: 8px;
  327. }
  328. }
  329. .read {
  330. img {
  331. width: 20px;
  332. height: 26px;
  333. }
  334. }
  335. .recovery {
  336. img {
  337. width: 19px;
  338. height: 26px;
  339. }
  340. }
  341. }
  342. .middle {
  343. width: 25%;
  344. margin-left: 76px;
  345. padding-top: 50px;
  346. overflow: auto;
  347. .msgItem {
  348. padding: 16px 18px 23px 30px;
  349. border-bottom: 1px solid #ccc;
  350. .type {
  351. font-size: 14px;
  352. color: #777;
  353. font-weight: 400;
  354. padding-bottom: 4px;
  355. }
  356. .name {
  357. position: relative;
  358. color: #444;
  359. font-size: 16px;
  360. padding-bottom: 9px;
  361. clear: both;
  362. .time {
  363. font-weight: 400;
  364. color: #aaa;
  365. float: right;
  366. }
  367. .dot {
  368. width: 7px;
  369. height: 7px;
  370. background-color: #f97215;
  371. border-radius: 50%;
  372. position: absolute;
  373. left: -13px;
  374. top: 4px;
  375. }
  376. }
  377. .msg {
  378. color: #444;
  379. font-size: 14px;
  380. line-height: 24px;
  381. text-overflow: -o-ellipsis-lastline;
  382. overflow: hidden;
  383. text-overflow: ellipsis;
  384. display: -webkit-box;
  385. -webkit-line-clamp: 2;
  386. -webkit-box-orient: vertical;
  387. }
  388. }
  389. .msgItem.active {
  390. background-color: #f3f4f8;
  391. border-radius: 5px;
  392. .msg {
  393. color: #aaa;
  394. }
  395. }
  396. }
  397. .right {
  398. display: flex;
  399. flex-direction: column;
  400. justify-content: space-between;
  401. border: 1px solid #e4e8eb;
  402. margin-left: 25px;
  403. position: relative;
  404. overflow: auto;
  405. width: 50%;
  406. .rightWrap {
  407. // overflow: auto;
  408. padding: 18px 24px;
  409. display: flex;
  410. flex-direction: row;
  411. justify-content: flex-start;
  412. box-sizing: border-box;
  413. .header {
  414. width: 30px;
  415. height: 30px;
  416. position: relative;
  417. top: 7px;
  418. border-radius: 50%;
  419. margin-right: 12px;
  420. }
  421. .info {
  422. position: relative;
  423. width: 100%;
  424. h2 {
  425. color: #212223;
  426. font-size: 16px;
  427. margin-bottom: 0px;
  428. .phone {
  429. font-size: 12px;
  430. color: #444;
  431. }
  432. }
  433. .subMsg {
  434. position: relative;
  435. font-size: 12px;
  436. color: #444;
  437. margin-bottom: 12px;
  438. .san {
  439. // margin-left: 110px;
  440. float: left;
  441. position: absolute;
  442. top: 0px;
  443. width: 0;
  444. height: 0;
  445. border-width: 5px;
  446. border-style: solid;
  447. border-color: transparent #909191 transparent transparent;
  448. transform: rotate(180deg); /*顺时针旋转90°*/
  449. margin: 0 8px;
  450. }
  451. }
  452. .textWrap {
  453. width: 316px;
  454. line-height: 21px;
  455. font-size: 14px;
  456. color: #212223;
  457. margin: 12px 0 34px;
  458. }
  459. .dot {
  460. width: 20px;
  461. height: 20px;
  462. }
  463. .timeMsg {
  464. position: relative;
  465. top: 5px;
  466. margin-left: 20px;
  467. .name {
  468. font-size: #444;
  469. font-size: 16px;
  470. margin-bottom: 3px;
  471. font-weight: 600;
  472. }
  473. .status {
  474. font-size: 14px;
  475. color: #62a070;
  476. }
  477. .status.waring {
  478. color: #f97215;
  479. }
  480. .status.end {
  481. color: #aaaaaa;
  482. }
  483. }
  484. }
  485. }
  486. .infoFoot {
  487. min-height: 60px;
  488. height: 60px;
  489. line-height: 60px;
  490. border-top: 1px solid #e4e8eb;
  491. width: 100%;
  492. display: flex;
  493. flex-direction: row;
  494. justify-content: flex-start;
  495. align-items: center;
  496. .noBtn {
  497. cursor: pointer;
  498. width: 100px;
  499. height: 32px;
  500. line-height: 32px;
  501. color: #444;
  502. border-radius: 3px;
  503. border: 1px solid rgba(228, 232, 235, 1);
  504. text-align: center;
  505. margin-left: 70px;
  506. }
  507. .yesBtn {
  508. cursor: pointer;
  509. margin-left: 15px;
  510. text-align: center;
  511. width: 100px;
  512. height: 32px;
  513. line-height: 32px;
  514. background: rgba(249, 114, 21, 1);
  515. border-radius: 3px;
  516. color: #fff;
  517. }
  518. // width: 570px;
  519. }
  520. }
  521. }
  522. </style>