zhuoyuan.wang
2024-06-19 15ebe96f28cadec6a726c5324593a40bbf56205f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<template>
  <div class="app-page-form" :style="`height : ${height}px`">
    <div class="content">
      <slot/>
    </div>
    <div class="footer">
      <div>
        <el-button v-if="closeDom" @click="onClose()" icon="Close">{{ $t('components.page.PageForm.cancel') }}</el-button>
        <el-button v-if="resetDom"  @click="onReset()" icon="RefreshRight">{{ $t('components.page.PageForm.reset') }}</el-button>
        <el-button v-if="submitDom"  v-loading="submitLoading" type="primary" @click="onSubmit()" icon="DocumentAdd">
          {{ $t('components.page.PageForm.save') }}
        </el-button>
      </div>
    </div>
  </div>
</template>
 
<script setup>
 
const props = defineProps({
  subSubmit: {
    type: Function,
    default: () => {
    }
  },
  subReset: {
    type: Function,
    default: () => {
    }
  },
  subClose: {
    type: Function,
    default: () => {
    }
  },
  submitDom:{
    type: Boolean,
    default: true
  },
  resetDom:{
    type: Boolean,
    default: true
  },
  closeDom:{
    type: Boolean,
    default: true
  }
});
 
import {useSettingStore} from '@/store/modules';
 
const settingsStore = useSettingStore();
 
const submitLoading = ref(false);
 
const height = computed(() => window.innerHeight - 115 - (settingsStore.tagsView ? 39 : 0));
 
const onReset = async () => {
  await props.subReset();
}
 
const onSubmit = async () => {
  submitLoading.value = true;
  await props.subSubmit();
  submitLoading.value = false;
}
 
const onClose = async () => {
  await props.subClose();
}
 
</script>
 
<style lang="scss">
.app-page-form {
  width: 100%;
  height: 100%;
  position: relative;
 
  > .content {
    height: 100%;
    overflow: auto;
    padding:0 10px 40px 10px;
    box-sizing: border-box;
  }
 
  > .footer {
    position: absolute;
    left: 0;
    bottom: 0;
    padding: 8px 0;
    //padding: 8px 15px;
    //background: rgba(255, 255, 255, 0.8);
    background: #fff;
    overflow: hidden;
    display: flex;
    flex-direction: row-reverse;
    z-index: 5;
    box-sizing: border-box;
    width: 100%;
    border-top: 1px solid #d8dce5;
    //box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.12), 0 0 3px 0 rgba(0, 0, 0, 0.04);
  }
}
</style>