<template>
  <div v-if="visible" @click.stop="() => false" class="feedBack-box">
    <el-dialog
      :visible.sync="visible"
      v-dialogDrag
      width="1200px"
      :close-on-click-modal="false"
      @close="cancel"
      :fullscreen="true"
    >
      <div slot="title">
        {{ title }}
      </div>
      <feedBackTable :trialId="trialId" @success="success" />
    </el-dialog>
  </div>
</template>
<script>
import feedBackTable from "@/views/feedBack/index.vue";
export default {
  name: "FBT",
  components: { feedBackTable },
  data() {
    return {
      title: null,
      visible: false,
      trialId: null,
    };
  },
  computed: {},
  methods: {
    open(data) {
      let { code, name, trialId } = data;
      this.title = this.setTitle(code, name);
      this.trialId = trialId;
      this.visible = true;
    },
    cancel() {
      this.visible = false;
      this.$emit("closed");
    },
    setTitle(code, name) {
      if (this.hasPermi(["role:pm"])) {
        return `${this.$t("feedBack:table:title:pm")}(${code},${name})`;
      }
      if (this.hasPermi(["role:ir", "role:crc"])) {
        return `${this.$t("feedBack:table:title")}`;
      }
    },
    success() {
      this.$emit("success");
    },
  },
};
</script>
// <style lang="scss" scoped>
// ::v-deep .el-dialog__body {
//   padding-bottom: 0;
//   height: 500px;
// }
//
</style>