ny
昨天 282fbc6488f4e8ceb5fda759f963ee88fbf7b999
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
<script lang="ts" setup>
import { computed, onMounted, reactive, toRefs } from 'vue';
 
import { DoubleLeftOutlined, DoubleRightOutlined } from '@ant-design/icons-vue';
 
import { $t } from '#/locales';
 
import DataLogList from './DataLogList.vue';
 
interface State {
  isAdvanced: boolean;
  activeKey: number;
  tooltipKey: number;
}
 
const props = defineProps({
  showLog: { type: Boolean, default: false },
  modelId: { type: String, default: '' },
  formDataId: { type: [String, Number], default: '' },
});
 
const state = reactive<State>({
  isAdvanced: true,
  activeKey: 1,
  tooltipKey: Date.now(),
});
const { isAdvanced, activeKey, tooltipKey } = toRefs(state);
 
const getBindValue = computed(() => ({ ...props }));
 
function toggleAdvanced() {
  state.isAdvanced = !state.isAdvanced;
  state.tooltipKey = Date.now();
}
 
onMounted(() => {
  state.activeKey = 1;
});
</script>
<template>
  <div class="form-extra-panel" :class="{ 'form-extra-panel-unfold': !isAdvanced }">
    <a-tooltip placement="left" :title="isAdvanced ? $t('component.form.fold') : $t('component.form.unfold')" :key="tooltipKey">
      <div class="trigger-btn" @click="toggleAdvanced">
        <DoubleRightOutlined v-if="isAdvanced" />
        <DoubleLeftOutlined v-else />
      </div>
    </a-tooltip>
    <a-tabs v-model:active-key="activeKey" :tab-bar-gutter="10" size="small" class="average-tabs" :class="{ 'average-tabs-single': showLog }">
      <a-tab-pane :key="1" tab="修改记录" v-if="showLog" />
    </a-tabs>
    <div class="form-extra-panel-main">
      <DataLogList v-bind="getBindValue" v-if="activeKey == 1" />
    </div>
  </div>
</template>