audit-form-top-banner.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <template>
  2. <a-layout ref="formLayout" :class="$style.page">
  3. <a-layout-header :class="$style.header">
  4. <!-- <div :class="$style.headerTitle"></div> -->
  5. <div v-show="showtitle">
  6. <span v-show="showtitle">
  7. <div :class="$style.titlepoint"></div>
  8. <span :class="['toptitle', $style.toptitle]"></span>
  9. </span>
  10. <a-button type="default" :class="$style.closeBtn" @click="close">关闭</a-button>
  11. <slot name="afterbtn"></slot>
  12. <a-button
  13. v-if="handelSaveForm && formData !== 'VIEW'"
  14. type="primary"
  15. :class="$style.saveBtn"
  16. :loading="loading['save']"
  17. @click="saveForm"
  18. >保存
  19. </a-button>
  20. <a-button
  21. v-if="handelRollback && formData !== 'VIEW'"
  22. type="primary"
  23. :class="$style.rollbackBtn"
  24. @click="reject"
  25. >驳回
  26. </a-button>
  27. <a-button
  28. v-if="handelSubmitForm && formData !== 'VIEW'"
  29. type="primary"
  30. :class="$style.submitBtn"
  31. :loading="loading['submit']"
  32. @click="submit"
  33. >提交
  34. </a-button>
  35. <a-button
  36. v-if="handelPublish && formData !== 'VIEW' && hidenOrShow"
  37. type="primary"
  38. :class="$style.publishBtn"
  39. :loading="loading['publish']"
  40. @click="publish"
  41. >发布
  42. </a-button>
  43. <slot name="beforebtn"></slot>
  44. </div>
  45. </a-layout-header>
  46. <a-layout style="padding:20px">
  47. <a-layout
  48. style="height: 100%;padding:20px;overflow-y: auto;background: #fff"
  49. class="sd-has-table"
  50. >
  51. <div v-sd-watermark="waterMark" :class="$style.formDiv">
  52. <slot></slot>
  53. </div>
  54. </a-layout>
  55. </a-layout>
  56. </a-layout>
  57. </template>
  58. <script>
  59. import crossWindowWatcher from '@/common/services/cross-window-watcher'
  60. import systemManage from '@/system-manage/system-manage'
  61. import components from './_import-components/audit-form-top-banner-import'
  62. // 带顶部Banner按钮表单
  63. export default {
  64. name: 'AuditFormTopBanner',
  65. components,
  66. props: {
  67. handelSubmitForm: {
  68. type: Function,
  69. default: null,
  70. },
  71. handelSaveForm: {
  72. type: Function,
  73. default: null,
  74. },
  75. handelPublish: {
  76. type: Function,
  77. default: null,
  78. },
  79. handelRollback: {
  80. type: Function,
  81. default: null,
  82. },
  83. formData: {
  84. type: String,
  85. default: '',
  86. },
  87. hidenOrShow: {
  88. type: Boolean,
  89. default: true,
  90. },
  91. },
  92. data() {
  93. return {
  94. waterMark: systemManage.getFormWaterMark(),
  95. showtitle: false,
  96. loading: { publish: false, save: false, submit: false },
  97. }
  98. },
  99. watch: {
  100. loading(val) {
  101. // 加载中状态,3秒之后重置
  102. if (val === true) {
  103. setTimeout(() => {
  104. this.loading = false
  105. }, 3000)
  106. }
  107. },
  108. },
  109. mounted() {
  110. let nums = 0
  111. const setTitle = setInterval(() => {
  112. nums++
  113. if (document.querySelector('.title_sd-detail-form_common') && nums < 1000) {
  114. document.querySelector('.toptitle').innerHTML = document.querySelector(
  115. '.title_sd-detail-form_common'
  116. ).innerHTML
  117. this.showtitle = true
  118. clearInterval(setTitle)
  119. }
  120. }, 10)
  121. },
  122. methods: {
  123. close(flag) {
  124. crossWindowWatcher.notifyChange(this.$route.fullPath, flag)
  125. window.close()
  126. },
  127. submit() {
  128. this.setLoading('submit')
  129. this.$emit('handelSubmitForm')
  130. },
  131. saveForm() {
  132. this.setLoading('save')
  133. this.$emit('handelSaveForm')
  134. },
  135. publish() {
  136. this.setLoading('publish')
  137. this.$emit('handelPublish')
  138. },
  139. reject() {
  140. this.$emit('handelRollback')
  141. },
  142. setLoading(type) {
  143. this.loading[type] = true
  144. setTimeout(() => {
  145. this.loading[type] = false
  146. }, 3000)
  147. },
  148. },
  149. }
  150. </script>
  151. <style module lang="scss">
  152. @import '@/webflow/sd-flow-form.scss';
  153. .toptitle {
  154. position: fixed;
  155. top: 9px;
  156. left: 40px;
  157. font-size: 22px;
  158. font-weight: bold;
  159. color: #404040;
  160. }
  161. .formDiv {
  162. margin: -8px 22px 22px 22px;
  163. :global(.buttons_sd-detail-form_common) {
  164. :global(.ant-form-item-control-wrapper) {
  165. padding-top: 4%;
  166. padding-left: 24%;
  167. }
  168. }
  169. .tr_border {
  170. box-sizing: border-box;
  171. border-right: 1px solid #e8e8e8;
  172. border-left: 1px solid #e8e8e8;
  173. }
  174. :global(.title_sd-detail-form_common) {
  175. font-size: 1.5em;
  176. text-align: center;
  177. }
  178. :global(.buttons_sd-detail-form_common) {
  179. display: none;
  180. }
  181. }
  182. .close-btn,
  183. .submitBtn,
  184. .save-btn,
  185. .rollbackBtn,
  186. .publishBtn {
  187. top: 8px;
  188. float: right;
  189. margin-right: 10px;
  190. font-size: 16px;
  191. font-weight: 400;
  192. cursor: pointer;
  193. }
  194. .close-btn {
  195. margin-right: 0;
  196. }
  197. // .save-btn {
  198. // right: 80px;
  199. // }
  200. // .submitBtn {
  201. // right: 145px;
  202. // }
  203. // .rollbackBtn {
  204. // right: 210px;
  205. // }
  206. .page {
  207. height: 100%;
  208. :global(.sd-frame-main) {
  209. height: 100%;
  210. padding: 10px;
  211. overflow: auto;
  212. }
  213. }
  214. .header {
  215. height: 30px;
  216. padding: 0;
  217. line-height: 30px;
  218. // background: linear-gradient(to right, #3f9bff, #0e7df6);
  219. // background-image: linear-gradient(90deg, #1890ff 0%, #0162eb 100%);
  220. background: transparent;
  221. .header-title {
  222. display: inline-block;
  223. width: 256px;
  224. height: 100%;
  225. background: url('~@custom/images/logo.png') no-repeat center;
  226. }
  227. .titlepoint {
  228. position: fixed;
  229. top: 12px;
  230. left: 20px;
  231. width: 8px;
  232. height: 27px;
  233. background: #1890ff;
  234. border-radius: 8px;
  235. }
  236. }
  237. .header > div:last-child {
  238. width: calc(100% - 20px);
  239. }
  240. </style>