<template>
  <el-dialog
    title="详情"
    :visible.sync="open"
    width="80%"
    :close-on-click-modal="false"
    @close="handleClose"
  >
    <div class="formContent">
      <Com-table
        ref="table"
        :tableFormat="tableFormat"
        :tableData="tableData"
      ></Com-table>
    </div>
    <span slot="footer">
      <el-button @click="open = false">关 闭</el-button>
    </span>
  </el-dialog>
</template>

<script>
import { detailTableFormat } from "../utils/index.json";
import { adsMatPoiseOrderDqueryInfo } from "@/api/home";
export default {
  data() {
    return {
      open: false,
      tableFormat: detailTableFormat,
      tableData: [],
      currentRow: {},
    };
  },
  methods: {
    handleInit({ data }) {
      this.currentRow = data;
      this.getDetail();
      this.open = true;
    },
    getDetail() {
      let params = {
        id: this.currentRow.id,
      };
      adsMatPoiseOrderDqueryInfo(params).then((res) => {
        if (res && res.code == 200) {
          this.tableData = res.data || [];
        } else {
          this.$message.warning(res.msg || "操作失败");
        }
      });
    },
    handleClose() {
      this.open = false;
    },
  },
};
</script>

<style lang="scss" scoped>
.formContent {
  height: 600px;
}

::v-deep {
  .el-dialog__footer {
    text-align: center;
  }
}
</style>
