dialog.vue 2.36 KB
<template>
  <el-dialog :title="title" append-to-body :visible.sync="show" width="800px">
    <div v-loading="loading">

      <div>销售顾问:{{dialogObj.staff_name}}</div>

      <el-table :data="list">
        <el-table-column prop="month_order_rate">

        </el-table-column>
      </el-table>

      <page :total="total" :limit="limit" @pageChange="onPageChange" @sizeChange="onSizeChange"/>

    </div>
  </el-dialog>

</template>

<script>
  import { getVisitedApi,getClassOpenedApi } from "@service/api";
  import page from '@framework/page'

  export default {
    name: "TeamDialog",
    components: {page},
    props: {
      dialogObj: {
        type: Object,
        required: true,
        default: () => {}
      }
    },
    data() {
      return {
        show: false,
        loading: true,
        list: [],
        title: '',
        total: 0,
        nowPage: 1,
        limit: 10,
      }
    },
    mounted() {
      this.initDialog()
    },
    methods: {
      initDialog() {
        console.log(this.dialogObj)
        if (this.dialogObj) {
          this.show = this.dialogObj.show;
          if (this.dialogObj.type == 'callback') {
            this.getVisited();
          } else if (this.dialogObj.type == 'class') {
            this.getClass();
          }
        }
      },
      getVisited() {
        let json = {
          teacher_id: this.dialogObj.teacher_id,
          start_at: this.dialogObj.start_at,
          page: this.nowPage,
          limit: this.limit
        }
        getVisitedApi(json).then(res => {
          this.loading = false;
          console.log(res)
        })
      },
      getClass() {
        let json = {
          teacher_id: this.dialogObj.teacher_id,
          start_at: this.dialogObj.start_at,
          page: this.nowPage,
          limit: this.limit
        }
        getClassOpenedApi(json).then(res => {
          this.loading = false;
          console.log(res)
        })
      },

      onPageChange(val) {
        this.nowPage = val
        this.getData()
      },
      onSizeChange(val) {
        this.limit = val;
        this.nowPage = 1;
        this.getData()
      },
    },
    watch: {
      dialogObj: {
        handler: function () {
          this.loading = true;
          this.initDialog()
        },
        deep: true
      },
      show(value) {
        this.$emit("changeShow", value);
      }
    }
  }
</script>