标准版政企呼叫中心业务系统

index.vue 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <div class="app_msg_modal" v-if="msg !== 'null'">
  3. <div class="title">{{ msg?.title }}</div>
  4. <div class="content">
  5. 有新工单<span style="color:rgb(50, 104, 243);cursor: pointer;" @click="toPageFn(msg , '消息')">{{msg?.workorderid}}</span>,请及时查收处理
  6. </div>
  7. <div class="butt">
  8. <el-button type="primary" size="small" @click="returnData(msg)">确认</el-button>
  9. </div>
  10. </div>
  11. </template>
  12. <script setup>
  13. import { ref } from 'vue';
  14. import { getPageListData, deletePageData, createPageData, editPageData } from '@/api/main/system/system'
  15. import { useRoute, useRouter } from 'vue-router';
  16. const { back, push, go } = useRouter();
  17. const router = useRoute();
  18. const msg = ref('null');
  19. const msgData = ref([]);
  20. // 获取消息
  21. const getMsg = function _f (){
  22. getPageListData('/sms/getmsg' ).then(({data})=>{
  23. msg.value = data[0] || 'null';
  24. msgData.value = data.slice(1);
  25. })
  26. return _f;
  27. }();
  28. setInterval( getMsg , 1000 * 30 )
  29. // 循环调用
  30. function forFn (){
  31. const forData = function *() {
  32. for (const val of msgData.value) {
  33. yield val
  34. }
  35. }();
  36. return function _fn () {
  37. const data = forData.next();
  38. console.log(data)
  39. if(!data.done){
  40. msg.value = data.value;
  41. }else{
  42. msg.value = 'null'
  43. }
  44. }
  45. }
  46. // 获取数据
  47. let returnData = forFn();
  48. // 方法重构
  49. let newFn = returnData.bind();
  50. returnData = (data)=>{
  51. editPageData(`/sms/updatestate/${data.smsId}`);
  52. return newFn(data)
  53. }
  54. // 页面跳转
  55. function toPageFn(v , type){
  56. editPageData(`/sms/updatestate/${v.smsId}`).then(()=>{
  57. newFn()
  58. let query = {
  59. workordercode : v.workorderid,
  60. type : type
  61. }
  62. sessionStorage.setItem('workQuery', JSON.stringify(query))
  63. if(router.path === '/workHandle'){
  64. go(0)
  65. }else{
  66. push({ path : '/workHandle' })
  67. }
  68. })
  69. }
  70. </script>
  71. <style lang="scss" scoped>
  72. .app_msg_modal{
  73. position: absolute;
  74. bottom: 5px;
  75. right: 5px;
  76. width: 300px;
  77. height: 170px;
  78. background-color: #fff;
  79. border: 1px solid #ccc;
  80. border-radius: 5px;
  81. box-shadow: -1px -1px 15px -10px;
  82. display: grid;
  83. grid-template-rows: 33px 1fr 33px;
  84. grid-template-columns: 1fr;
  85. >div{
  86. padding: 5px;
  87. }
  88. .title{
  89. line-height: 21px;
  90. font-size: 16px;
  91. border-bottom: 1px solid #ccc;
  92. background-color: #ddedf3;
  93. }
  94. .content{
  95. font-size: 14px;
  96. text-indent: 30px;
  97. border-bottom: 1px solid #ccc;
  98. }
  99. .butt{
  100. justify-self: end;
  101. align-self: center;
  102. }
  103. }
  104. </style>