ludc
2023-07-20 ffd0af47ee31a9592cfab56a907e9841a9113c52
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
113
<template>
  <basic-container>
    <avue-crud v-model="form" :option="option" :data="data" ref="crud"  @on-load="onLoad" @row-save="rowSave" @row-update="rowUpdate" @row-del="rowDel" :page.sync="page">
    </avue-crud>
  </basic-container>
</template>
 
<script>
import {
  getadd,
  getupdata,
  getremove,
  getPage
} from "@/api/system/passwordresultant";
 
export default {
  name: "passwords.vue",
  data() {
    return {
      form:{},
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 100
      },
 
      data: [],
      option:{
        headerAlign: 'center',
        align: 'center',
        border: true,
        index: true,
        rowKey:'id',
        column:[
          {
            label: '名称',
            prop: 'name',
            align: 'left',
                      },
          {
            label: '描述',
            prop: 'desc',
          }
        ]
      }
      }
    },
 
 
  created() {
   this.onLoad()
  },
  methods:{
    rowDel(row){
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          return getremove(row.id);
        })
        .then(() => {
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          this.onLoad();
        });
    },
    rowSave(row,done){
      getadd(row).then(()=>{
        this.$message({
          type: "success",
          message: "操作成功!"
        });
        done(row)
        this.onLoad()
      }).catch((res)=>{
        this.$message({
          type: "success",
          message:res
        });
      })
    },
    rowUpdate(row,index,done){
      getupdata(row).then(()=>{
        this.onLoad()
        this.$message({
          type: "success",
          message: "修改成功!"
        });
        done(row)
      })
    },
    onLoad(page, params = {}) {
      // this.loading = true;
      getPage(this.page.currentPage, this.page.pageSize, Object.assign(params, this.query)).then(res => {
        // const data = res.data.data;
        // this.page.total = data.total;
        // this.data = data.records;
        // this.loading = false;
        // this.selectionClear();
        this.data=res.data.data.records
      });
    }
  }
 
}
</script>
 
<style lang="scss">
</style>