ludc
2023-07-20 ffd0af47ee31a9592cfab56a907e9841a9113c52
Source/UBCS-WEB/dist/src/views/system/PasswordManagement/Passwordresultant.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,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>