<template>
  <div>
    <el-dialog
      title="开庭审理"
      :visible="showtrialincourt"
      @close="cancel"
      :destroy-on-close="true"
    >
      <el-form
        ref="form"
        :model="formData"
        label-width="150px"
        :disabled="true"
      >
        <p>案件信息：</p>
        <el-divider></el-divider>
        <el-row>
          <el-col :span="12">
            <el-form-item label="案件编号：" prop="caseNum">
              <el-input
                v-model="formData.caseNum"
                placeholder="请输入案件编号"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="申请人：" prop="applicantName">
              <el-input v-model="adjudicatename.applicantName" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="被申请人：" prop="respondentName">
              <el-input v-model="adjudicatename.respondentName" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="借款开始日期：" prop="loanStartDate">
              <el-date-picker
                v-model="formData.loanStartDate"
                type="datetime"
                placeholder="借款开始日期"
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="借款结束日期：" prop="loanEndDate">
              <el-date-picker
                v-model="formData.loanEndDate"
                type="datetime"
                placeholder="借款结束日期"
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="案件标的：" prop="caseSubjectAmount">
              <el-input
                v-model="formData.caseSubjectAmount"
                placeholder="请输入案件标的"
              />
            </el-form-item>
          </el-col>
          <!-- <el-col :span="12">
          <el-form-item label="逾期天数：" prop="caseSubjectAmount">
            <el-input
              v-model="formData.caseSubjectAmount"
              placeholder="请输入逾期天数"
            />
          </el-form-item>
        </el-col> -->
          <el-col :span="12">
            <el-form-item label="仲裁费用：" prop="feePayable">
              <el-input
                v-model="adjudicatename.feePayable"
                placeholder="请输入仲裁费用"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="申请人主张欠本金：" prop="claimPrinciOwed">
              <el-input
                v-model="formData.claimPrinciOwed"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <!-- <el-col :span="12">
          <el-form-item label="案件顾问：" prop="claimPrinciOwed">
            <el-input v-model="formData.claimPrinciOwed" placeholder="请输入" />
          </el-form-item>
        </el-col> -->
          <el-col :span="12">
            <el-form-item label="案件状态：" prop="caseStatus">
              <el-input
                v-model="formData.caseStatusName"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="仲裁员：" prop="arbitratorName">
              <el-input
                v-model="formData.arbitratorName"
                placeholder="请输入"
              />
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="开庭日期：" prop="hearDate">
              <el-date-picker
                v-model="adjudicatename.hearDate"
                type="datetime"
                placeholder="开庭日期"
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
        <el-col :span="24">
          <el-form-item label="案件资料：" prop="claimPrinciOwed">
            <el-input v-model="formData.claimPrinciOwed" placeholder="请输入" />
          </el-form-item>
        </el-col>
      </el-form>
      <el-button @click="openmeeting" type="primary"
        >发起会议
        <!-- <iframe src="http://47.97.117.253:9005/#/">发起会议</iframe> -->
      </el-button>
      <el-button @click="openArbitrationresults" type="primary">提交仲裁结果</el-button>
      <div slot="footer" class="dialog-footer">
        <!-- <el-button @click="submitForm" class="endbutton"
          ><span>结束审理</span></el-button
        > -->
        <el-button @click="cancel" class="endbutton1"
          ><span>关 闭</span></el-button
        >
      </div>
    </el-dialog>
    <el-dialog
      title="仲裁结果"
      :visible="showArbitrationresults"
      @close="closeArbitrationresults"
    >
      <el-form ref="form2" :model="form2" label-width="150px">
        <el-col :span="24">
          <el-form-item
            label="经庭审质证，对各方提供的证据认定如下："
            prop="evidenDetermi"
            :rules="[
              {
                required: true,
                message: '请输入',
                trigger: 'blur',
              },
            ]"
          >
            <el-input
              type="textarea"
              :autosize="{ minRows: 4 }"
              placeholder="请输入"
              v-model="form2.evidenDetermi"
            >
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item
            label="仲裁庭经审理查明(写明仲裁庭认定的事实)："
            prop="factDetermi"
            :rules="[
              {
                required: true,
                message: '请输入',
                trigger: 'blur',
              },
            ]"
          >
            <el-input
              type="textarea"
              :autosize="{ minRows: 4 }"
              placeholder="请输入"
              v-model="form2.factDetermi"
            >
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item
            label="综上所述："
            prop="caseSketch"
            :rules="[
              {
                required: true,
                message: '请输入',
                trigger: 'blur',
              },
            ]"
          >
            <el-input
              type="textarea"
              autosize
              placeholder="请输入"
              v-model="form2.caseSketch"
            >
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item
            label="本庭认为："
            prop="arbitrateThink"
            :rules="[
              {
                required: true,
                message: '请输入',
                trigger: 'blur',
              },
            ]"
          >
            <el-input
              type="textarea"
              autosize
              placeholder="请输入"
              v-model="form2.arbitrateThink"
            >
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item
            label="裁决如下："
            prop="rulingFollows"
            :rules="[
              {
                required: true,
                message: '请输入',
                trigger: 'blur',
              },
            ]"
          >
            <el-input
              type="textarea"
              autosize
              placeholder="请输入"
              v-model="form2.rulingFollows"
            >
            </el-input>
          </el-form-item>
        </el-col>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="submitForm">提交</el-button>
        <el-button @click="closeArbitrationresults">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { getUserProfile } from "@/api/system/user";
export default {
  props: ["showtrialincourt", "adjudicatename", "form"],
  data() {
    return {
      formData: {},
      user: "",
      showArbitrationresults: false,
      form2: {},
    };
  },
  watch: {
    showtrialincourt: {
      handler(val) {
        if (val) {
          this.formData = this.form;
        }
      },
    },
  },
  created() {
    this.getUser();
  },
  methods: {
    getUser() {
      getUserProfile().then((response) => {
        this.user = response.data.userName;
      });
    },
    // 打开会议
    openmeeting() {
      window.open(`http://47.97.117.253:9005/#/home?name=${this.user}`);
    },
    // 提交仲裁结果
    openArbitrationresults() {
      this.showArbitrationresults = true;
    },
    closeArbitrationresults() {
      this.showArbitrationresults = false;
    },
    submitForm() {
      this.$refs["form2"].validate((valid) => {
        if (valid) {
          console.log(6666666666);
        }
      });
    },
    cancel() {
      this.$emit("canceltrialincourt");
    },
  },
};
</script>

<style lang="scss" scoped>
::v-deep .el-dialog {
  width: 800px;
  background: #ffffff;
  border-radius: 20px;
}
.endbutton {
  width: 154px;
  height: 37px;
  background: #ff5a00;
  border-radius: 19px;
  span {
    width: 65px;
    height: 16px;
    font-size: 16px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #ffffff;
    // line-height: 48px;
  }
}
.endbutton1 {
  width: 154px;
  height: 37px;
  background: #ffffff;
  border-radius: 19px;
  span {
    width: 31px;
    height: 13px;
    font-size: 16px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #959595;
    // line-height: 48px;
  }
}
</style>