列表,列表刷新

<template>
  <el-dialog v-dialogDrag :title="'人员管理'" :visible.sync="visible" append-to-body :close-on-click-modal="false" :close-on-press-escape="false" width="80%">
  </el-dialog>
<!--  <rs-dialog ref="rsDialog">-->
<!--    <div class="viewBox">-->
<!--      <rs-list ref="list" :option="option" />-->
<!--    </div>-->
<!--    <see-dialog ref="seeDialog"></see-dialog>-->
<!--    <form-dialog ref="formDialog" @refreshDataList="refreshDataList" />-->
<!--  </rs-dialog>-->
</template>

<script>

import rsList from '@/components/list/index'
import seeDialog from './personSee'
import formDialog from './personAdd'
import rsDialog from "@/components/dialog/index";


export default {
  name: "personIndex",
  components: {
    rsList,seeDialog,formDialog,rsDialog
  },
  mounted() {},
  data() {
    return {
      visible: false,
      paramRow: {},
      option: {
        listApi: fetchList,
        search: [
        ],
        params: {

        },
        column: [
        ],
        btnList: [
          { name: "查看", type: "success", click: this.see },
          { name: "编辑", type: "primary", click: this.edit },
          { name: "删除", type: "danger", click: this.del },
        ],
        // 下拉按钮
        btnDown: [],
        // 按钮组
        btnGroup: [
          { name: "添加", type: "warning", click: this.add,}
        ],
        // 列操作宽度
        buttonWidth: 260,
        // 格式化
        formatting: null,
        // 条数据
        pageSize: 10,
        selection: false,
        //loadType: true,
      }
    }
  },
  methods: {
    init(row){
      this.paramRow = Object.assign({},row)
      this.option.params = {ranksId: row.id}


      let dialogOption = {
        title: "人员管理",
        size: "大",
        footerShow: false,
      };
      this.$nextTick(() => {
        // this.$refs.rsDialog.init(dialogOption);

        this.visible = true;
        this.$refs.list.init();
      });


      //this.visible = true;

      //this.option.loadType = false;
      //this.$refs.list.init();

      // setTimeout(()=>{
      //   this.$refs.list.init();
      // },100)
    },
    refreshDataList() {
      this.$refs.list.init();
    },
    see(r) {
      this.$refs.seeDialog.init(this.paramRow,r)
    },
    add(){
      this.$refs.formDialog.init(this.paramRow,null);
    },
    edit(r){
      this.$refs.formDialog.init(this.paramRow,r);
    },
    // 删除
    del(r) {
      this.$confirm("是否确认删除吗?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          let id = r.id;
          delObj(id).then((res) => {
            this.$message.success("删除操作成功");
            this.$refs.list.init();
          });
        })
        .catch((e) => {});
    },
  }
}
</script>

<style scoped>

</style>

posted @ 2024-06-25 10:11  寒冷的雨呢  阅读(2)  评论(0编辑  收藏  举报