zmc
2023-12-21 635e1b3c0d48c2db884794cb8bc26d6ff1591ffa
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
<template>
  <CompPunishmentList :table-data="tableInfo" @newly-add="add" @look="look"></CompPunishmentList>
  <CompPunishmentDrawer v-model="drawer" :form-info="formInfo"></CompPunishmentDrawer>
</template>
 
<script>
import CompPunishmentList from './CompPunishmentList.vue';
import CompPunishmentDrawer from './CompPunishmentDrawer.vue';
import dayjs from 'dayjs';
import { useDrawer } from '@/composables/drawer.js';
export default {
  props: {
    //基本信息
    tableInfo: {
      type: Array,
      default() {
        return [];
      }
    },
    isEdit: Boolean,
    create: {
      type: Boolean,
      default: false
    },
    active: {
      type: Boolean,
      default: false
    }
  },
  components: {
    CompPunishmentList,
    CompPunishmentDrawer
  },
  data() {
    return {
      formInfo: null
    };
  },
  setup() {
    const { drawer, openDrawer, closeDrawer } = useDrawer();
    return { drawer, openDrawer, closeDrawer };
  },
  watch: {},
  mounted() {},
  methods: {
    timeFormatter(row, column, cellValue) {
      return dayjs(cellValue).format('YYYY-MM-DD HH:mm:ss');
    },
    /**
     * 新增按钮
     * @param:
     * @returns:
     */
    add() {
      this.formInfo = {};
      this.openDrawer();
    },
    /**
     * 查看按钮
     * @param:
     * @returns:
     */
    look(value) {
      this.formInfo = value;
      this.openDrawer();
    }
  }
};
</script>
 
<style scoped></style>