田源
2025-01-09 d7e3c8a813f8f85c89c06782f1e36e8089ffc31b
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
106
107
108
109
110
111
112
<template>
 <basic-container>
   <avue-crud ref="crud"
              v-model="form"
              :data="data"
              :option="option"
              @on-load="getList"
              @row-update="rowUpdate"
              @row-save="rowSave"
              @row-del="rowDel"
              >
   </avue-crud>
 </basic-container>
</template>
 
<script>
export default {
  name: "enupackage.vue",
  data(){
    return {
 
      data:[
        {
          enuName:"测试1",
          desc:"测试1",
          enuItem:"测试1"
        },
        {
          enuName:"测试2",
          desc:"测试2",
          enuItem:"测试2"
        },
        {
          enuName:"测试3",
          desc:"测试3",
          enuItem:"测试3"
        },
        {
          enuName:"测试4",
          desc:"测试4",
          enuItem:"测试4"
        },
      ],
      form:{},
      option:{
        height:300,
        headerAlign:'center',
        align: 'center',
        border: true,
        index: true,
        indexFixed:false,
        menuFixed:false,
        column:[
          {
            label:"枚举项名称",
            prop:"enuName",
          },
          {
            label:"枚举项值",
            prop:"enuItem",
          },
          {
            label:"描述",
            prop:"desc",
            type:"textarea"
          },
        ]
      }
    }
  },
  methods:{
    rowSave(row, done, loading) {
      add(Object.assign({
        createUser: this.userInfo.name
      }, row)).then(() => {
        this.$message.success('新增成功')
        done();
        this.getList();
      }).catch(() => {
        loading()
      })
    },
    rowUpdate(row, index, done, loading) {
      update(Object.assign({
        updateUser: this.userInfo.name
      }, row)).then(() => {
        this.$message.success('修改成功')
        done()
        this.getList();
      }).catch(() => {
        loading()
      })
    },
    rowDel(row) {
      this.$confirm('此操作将永久删除, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        return del(row.id)
      }).then(() => {
        this.$message.success('删除成功')
        this.getList();
      })
    },
  }
}
</script>
 
<style scoped>
 
</style>