LayoutHeader_20240320145850.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <template>
  2. <div>
  3. <div class="header">
  4. <el-menu :default-active="value" active-text-color="#409eff" class="el-menu-demo" mode="horizontal"
  5. @select="handleSelect">
  6. <el-menu-item index="baseSetting" @click="to('baseSetting')">① 基础信息</el-menu-item>
  7. <el-menu-item index="formSetting" @click="to('formSetting')">② 审批表单</el-menu-item>
  8. <el-menu-item index="processDesign" @click="to('processDesign')">③ 审批流程
  9. </el-menu-item>
  10. <el-menu-item index="proSetting" @click="to('proSetting')">④ 扩展设置</el-menu-item>
  11. </el-menu>
  12. <div class="publish">
  13. <el-button size="mini" @click="preview"><i class="el-icon-view"></i>预览</el-button>
  14. <el-button size="mini" type="primary" @click="publish"><i class="el-icon-s-promotion"></i>发布</el-button>
  15. </div>
  16. <div class="back">
  17. <el-button @click="exit" size="medium" icon="el-icon-arrow-left" circle></el-button>
  18. <span>
  19. <i :class="setup.logo.icon" :style="'background:' + setup.logo.background"></i>
  20. <span>{{ setup.formName }}</span>
  21. </span>
  22. </div>
  23. </div>
  24. <el-dialog title="请使用手机扫码预览" :visible.sync="viewCode" width="300px" :close-on-click-modal="false" center>
  25. <!-- <img src="../../assets/image/code.png" width="250" height="250"> -->
  26. <span>请使用手机扫码预览</span>
  27. </el-dialog>
  28. </div>
  29. </template>
  30. <script>
  31. export default {
  32. name: "LayoutHeader",
  33. props:{
  34. value: {
  35. type: String,
  36. default: 'baseSetup'
  37. }
  38. },
  39. data() {
  40. return {
  41. viewCode: false,
  42. };
  43. },
  44. computed: {
  45. setup() {
  46. return this.$store.state.design
  47. }
  48. },
  49. created() {
  50. this.check()
  51. },
  52. mounted() {
  53. console.log(document.body.offsetWidth)
  54. if (document.body.offsetWidth <= 970) {
  55. this.$msgbox.alert("本设计器未适配中小屏幕,建议您在PC电脑端浏览器进行操作")
  56. }
  57. this.listener()
  58. },
  59. methods: {
  60. publish() {
  61. this.$emit('publish')
  62. },
  63. preview() {
  64. this.$emit('preview')
  65. //this.
  66. this.viewCode = true;
  67. },
  68. valid() {
  69. if (!this.$isNotEmpty(this.setup.group)) {
  70. this.$message.warning('请选择分组')
  71. this.$router.push('/layout/baseSetup')
  72. return false;
  73. }
  74. return true;
  75. },
  76. exit() {
  77. this.$confirm('未发布的内容将不会被保存,是否直接退出 ?', '提示', {
  78. confirmButtonText: '退出',
  79. cancelButtonText: '取消',
  80. type: 'warning'
  81. }).then(() => {
  82. //window.location.reload()
  83. //this.$store.commit('clearTemplate')
  84. this.$router.push('/formsPanel')
  85. })
  86. },
  87. to(path) {
  88. this.$emit('input', path)
  89. },
  90. handleSelect(key, keyPath) {
  91. console.log(key, keyPath);
  92. },
  93. listener() {
  94. window.onunload = this.closeBefore()
  95. window.onbeforeunload = this.closeBefore()
  96. //window.on('beforeunload',this.closeBefore())
  97. },
  98. closeBefore() {
  99. //alert("您将要离开本页")
  100. return false
  101. },
  102. check() {
  103. if (this.$store.state.isEdit === null) {
  104. //this.$router.push("/workPanel");
  105. }
  106. }
  107. }
  108. }
  109. </script>
  110. <style lang="sass" scoped>
  111. /deep/ .header {
  112. min-width: 980px;
  113. position: relative;
  114. .el-menu {
  115. top: 0;
  116. z-index: 999;
  117. display: flex;
  118. justify-content: center;
  119. width: 100%;
  120. }
  121. .publish {
  122. position: absolute;
  123. top: 15px;
  124. right: 20px;
  125. z-index: 1000;
  126. i {
  127. margin-right: 6px;
  128. }
  129. button {
  130. border-radius: 15px;
  131. }
  132. }
  133. .back {
  134. position: absolute;
  135. z-index: 1000;
  136. top: 10px;
  137. left: 20px;
  138. font-size: small;
  139. span {
  140. i {
  141. border-radius: 10px;
  142. padding: 7.8px;
  143. font-size: 20px;
  144. color: #ffffff;
  145. margin: 0 10px;
  146. }
  147. }
  148. }
  149. }
  150. </style>