123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256 |
- <template>
- <a-layout ref="formLayout" :class="$style.page">
- <a-layout-header :class="$style.header">
- <!-- <div :class="$style.headerTitle"></div> -->
- <div v-show="showtitle">
- <span v-show="showtitle">
- <div :class="$style.titlepoint"></div>
- <span :class="['toptitle', $style.toptitle]"></span>
- </span>
- <a-button type="default" :class="$style.closeBtn" @click="close">关闭</a-button>
- <slot name="afterbtn"></slot>
- <a-button
- v-if="handelSaveForm && formData !== 'VIEW'"
- type="primary"
- :class="$style.saveBtn"
- :loading="loading['save']"
- @click="saveForm"
- >保存
- </a-button>
- <a-button
- v-if="handelRollback && formData !== 'VIEW'"
- type="primary"
- :class="$style.rollbackBtn"
- @click="reject"
- >驳回
- </a-button>
- <a-button
- v-if="handelSubmitForm && formData !== 'VIEW'"
- type="primary"
- :class="$style.submitBtn"
- :loading="loading['submit']"
- @click="submit"
- >提交
- </a-button>
- <a-button
- v-if="handelPublish && formData !== 'VIEW' && hidenOrShow"
- type="primary"
- :class="$style.publishBtn"
- :loading="loading['publish']"
- @click="publish"
- >发布
- </a-button>
- <slot name="beforebtn"></slot>
- </div>
- </a-layout-header>
- <a-layout style="padding:20px">
- <a-layout
- style="height: 100%;padding:20px;overflow-y: auto;background: #fff"
- class="sd-has-table"
- >
- <div v-sd-watermark="waterMark" :class="$style.formDiv">
- <slot></slot>
- </div>
- </a-layout>
- </a-layout>
- </a-layout>
- </template>
- <script>
- import crossWindowWatcher from '@/common/services/cross-window-watcher'
- import systemManage from '@/system-manage/system-manage'
- import components from './_import-components/audit-form-top-banner-import'
- // 带顶部Banner按钮表单
- export default {
- name: 'AuditFormTopBanner',
- components,
- props: {
- handelSubmitForm: {
- type: Function,
- default: null,
- },
- handelSaveForm: {
- type: Function,
- default: null,
- },
- handelPublish: {
- type: Function,
- default: null,
- },
- handelRollback: {
- type: Function,
- default: null,
- },
- formData: {
- type: String,
- default: '',
- },
- hidenOrShow: {
- type: Boolean,
- default: true,
- },
- },
- data() {
- return {
- waterMark: systemManage.getFormWaterMark(),
- showtitle: false,
- loading: { publish: false, save: false, submit: false },
- }
- },
- watch: {
- loading(val) {
- // 加载中状态,3秒之后重置
- if (val === true) {
- setTimeout(() => {
- this.loading = false
- }, 3000)
- }
- },
- },
- mounted() {
- let nums = 0
- const setTitle = setInterval(() => {
- nums++
- if (document.querySelector('.title_sd-detail-form_common') && nums < 1000) {
- document.querySelector('.toptitle').innerHTML = document.querySelector(
- '.title_sd-detail-form_common'
- ).innerHTML
- this.showtitle = true
- clearInterval(setTitle)
- }
- }, 10)
- },
- methods: {
- close(flag) {
- crossWindowWatcher.notifyChange(this.$route.fullPath, flag)
- window.close()
- },
- submit() {
- this.setLoading('submit')
- this.$emit('handelSubmitForm')
- },
- saveForm() {
- this.setLoading('save')
- this.$emit('handelSaveForm')
- },
- publish() {
- this.setLoading('publish')
- this.$emit('handelPublish')
- },
- reject() {
- this.$emit('handelRollback')
- },
- setLoading(type) {
- this.loading[type] = true
- setTimeout(() => {
- this.loading[type] = false
- }, 3000)
- },
- },
- }
- </script>
- <style module lang="scss">
- @import '@/webflow/sd-flow-form.scss';
- .toptitle {
- position: fixed;
- top: 9px;
- left: 40px;
- font-size: 22px;
- font-weight: bold;
- color: #404040;
- }
- .formDiv {
- margin: -8px 22px 22px 22px;
- :global(.buttons_sd-detail-form_common) {
- :global(.ant-form-item-control-wrapper) {
- padding-top: 4%;
- padding-left: 24%;
- }
- }
- .tr_border {
- box-sizing: border-box;
- border-right: 1px solid #e8e8e8;
- border-left: 1px solid #e8e8e8;
- }
- :global(.title_sd-detail-form_common) {
- font-size: 1.5em;
- text-align: center;
- }
- :global(.buttons_sd-detail-form_common) {
- display: none;
- }
- }
- .close-btn,
- .submitBtn,
- .save-btn,
- .rollbackBtn,
- .publishBtn {
- top: 8px;
- float: right;
- margin-right: 10px;
- font-size: 16px;
- font-weight: 400;
- cursor: pointer;
- }
- .close-btn {
- margin-right: 0;
- }
- // .save-btn {
- // right: 80px;
- // }
- // .submitBtn {
- // right: 145px;
- // }
- // .rollbackBtn {
- // right: 210px;
- // }
- .page {
- height: 100%;
- :global(.sd-frame-main) {
- height: 100%;
- padding: 10px;
- overflow: auto;
- }
- }
- .header {
- height: 30px;
- padding: 0;
- line-height: 30px;
- // background: linear-gradient(to right, #3f9bff, #0e7df6);
- // background-image: linear-gradient(90deg, #1890ff 0%, #0162eb 100%);
- background: transparent;
- .header-title {
- display: inline-block;
- width: 256px;
- height: 100%;
- background: url('~@custom/images/logo.png') no-repeat center;
- }
- .titlepoint {
- position: fixed;
- top: 12px;
- left: 20px;
- width: 8px;
- height: 27px;
- background: #1890ff;
- border-radius: 8px;
- }
- }
- .header > div:last-child {
- width: calc(100% - 20px);
- }
- </style>
|