当前位置:   article > 正文

ruoyi-nbcio-plus基于vue3的flowable的websocket消息组件的升级修改(二)

ruoyi-nbcio-plus基于vue3的flowable的websocket消息组件的升级修改(二)

更多ruoyi-nbcio功能请看演示系统

gitee源代码地址

前后端代码: https://gitee.com/nbacheng/ruoyi-nbcio

演示地址:RuoYi-Nbcio后台管理系统 http://122.227.135.243:9666/

更多nbcio-boot功能请看演示系统 

gitee源代码地址

后端代码: https://gitee.com/nbacheng/nbcio-boot

前端代码:https://gitee.com/nbacheng/nbcio-vue.git

在线演示(包括H5) : http://122.227.135.243:9888

接上一节

4、NModal.vue文件vue3修改如下:

  1. <template>
  2. <a-modal
  3. :visible="visible"
  4. destroyOnClose
  5. >
  6. <slot></slot>
  7. <!--有设置标题-->
  8. <template v-if="!isNoTitle" #title>
  9. <a-row class="j-modal-title-row" type="flex">
  10. <a-col class="left">
  11. <slot name="title">{{ title }}</slot>
  12. </a-col>
  13. </a-row>
  14. </template>
  15. <!--没有设置标题-->
  16. <template v-else #title>
  17. <a-row class="j-modal-title-row" type="flex">
  18. <a-col v-if="switchFullscreen" class="right" @click="toggleFullscreen">
  19. <a-button class="ant-modal-close ant-modal-close-x" ghost type="link" :icon="fullscreenButtonIcon"/>
  20. </a-col>
  21. </a-row>
  22. </template>
  23. <!-- 处理 scopedSlots -->
  24. <template v-for="slotName of scopedSlotsKeys" :slot="slotName">
  25. <slot :name="slotName"></slot>
  26. </template>
  27. <!-- 处理 slots -->
  28. <template v-for="slotName of slotsKeys" v-slot:[slotName]>
  29. <slot :name="slotName"></slot>
  30. </template>
  31. </a-modal>
  32. </template>
  33. <script setup lang="ts" name="NModal">
  34. const props = defineProps({
  35. title: String,
  36. // 可使用 .sync 修饰符
  37. visible: Boolean,
  38. // 是否全屏弹窗,当全屏时无论如何都会禁止 body 滚动。可使用 .sync 修饰符
  39. fullscreen: {
  40. type: Boolean,
  41. default: false
  42. },
  43. // 是否允许切换全屏(允许后右上角会出现一个按钮)
  44. switchFullscreen: {
  45. type: Boolean,
  46. default: false
  47. },
  48. // 点击确定按钮的时候是否关闭弹窗
  49. okClose: {
  50. type: Boolean,
  51. default: true
  52. }
  53. })
  54. const instance = getCurrentInstance();
  55. // 内部使用的 slots ,不再处理
  56. const usedSlots = ref('title')
  57. const isNoTitle = computed(() => {
  58. return !props.title && !allSlotsKeys.includes('title')
  59. })
  60. const slotsKeys = computed(() => {
  61. return Object.keys(instance.slots).filter(key => !usedSlots.value.includes(key))
  62. })
  63. const scopedSlotsKeys = computed(() => {
  64. return Object.keys(instance.slots).filter(key => !usedSlots.value.includes(key))
  65. })
  66. const allSlotsKeys = computed(() => {
  67. return Object.keys(instance.slots).concat(Object.keys(instance.slots))
  68. })
  69. </script>
  70. <style lang="less">
  71. .j-modal-box {
  72. &.fullscreen {
  73. top: 0;
  74. left: 0;
  75. padding: 0;
  76. // 兼容1.6.2版本的antdv
  77. & .ant-modal {
  78. top: 0;
  79. padding: 0;
  80. height: 100vh;
  81. }
  82. & .ant-modal-content {
  83. height: 100vh;
  84. border-radius: 0;
  85. & .ant-modal-body {
  86. /* title 和 footer 各占 55px */
  87. height: calc(100% - 55px - 55px);
  88. overflow: auto;
  89. }
  90. }
  91. &.no-title, &.no-footer {
  92. .ant-modal-body {
  93. height: calc(100% - 55px);
  94. }
  95. }
  96. &.no-title.no-footer {
  97. .ant-modal-body {
  98. height: 100%;
  99. }
  100. }
  101. }
  102. .j-modal-title-row {
  103. .left {
  104. width: calc(100% - 56px - 56px);
  105. }
  106. .right {
  107. width: 56px;
  108. position: inherit;
  109. .ant-modal-close {
  110. right: 56px;
  111. color: rgba(0, 0, 0, 0.45);
  112. &:hover {
  113. color: rgba(0, 0, 0, 0.75);
  114. }
  115. }
  116. }
  117. }
  118. &.no-title{
  119. .ant-modal-header {
  120. padding: 0px 24px;
  121. border-bottom: 0px !important;
  122. }
  123. }
  124. }
  125. @media (max-width: 767px) {
  126. .j-modal-box.fullscreen {
  127. margin: 0;
  128. max-width: 100vw;
  129. }
  130. }
  131. </style>

5、DynamicNotice.vue文件vue3

  1. <template>
  2. <component
  3. :is="comp"
  4. :formData="formData"
  5. ref="compModelRef"
  6. v-if="comp">
  7. </component>
  8. </template>
  9. <script setup lang="ts" name="DynamicNotice">
  10. const props = defineProps({
  11. path : {
  12. type: String,
  13. },
  14. formData : {
  15. type: Object,
  16. default: {},
  17. }
  18. })
  19. const compName = ref(props.path)
  20. const compModelRef = ref(null)
  21. const DyDetail = () => {
  22. setTimeout(() => {
  23. if(props.path){
  24. compModelRef.value?.view(props.formData);
  25. }
  26. }, 200)
  27. }
  28. const comp = computed(() => {
  29. if(!props.path){
  30. return null;
  31. }
  32. //去掉这个编译警告Critical dependency: the request of a dependency is an expression
  33. //return () => Promise.resolve(require(`@/views/${props.path}.vue`).default)
  34. return markRaw(defineAsyncComponent( () => import(/* @vite-ignore */`@/views/${props.path}.vue`).default));
  35. })
  36. //暴露detail方法
  37. defineExpose({
  38. DyDetail
  39. });
  40. </script>

6、效果图如下:

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/花生_TL007/article/detail/468702
推荐阅读
相关标签
  

闽ICP备14008679号