<template>
  <el-dialog @confirm="handleSubmit" title="合同详情" v-model="show">
    <el-form ref="formRef" :model="formData" label-width="90px" :rules="formRules">
      <el-form-item label="公司" prop="company_id">
        <el-input v-model="formData.company_id" :disabled="true" clearable placeholder="请输入公司" />
      </el-form-item>
      <el-form-item label="合同类型" prop="contract_type">
        <el-input v-model="formData.contract_type" :disabled="true" clearable placeholder="请输入合同类型" />
      </el-form-item>
      <el-form-item label="合同编号" prop="contract_no">
        <el-input v-model="formData.contract_no" :disabled="true" clearable placeholder="暂无合同编号" />
      </el-form-item>
      <el-form-item label="文件" prop="file">
        <el-input v-model="formData.file" :disabled="true" clearable placeholder="暂无文件" />
      </el-form-item>
      <el-form-item label="状态" prop="status">
        <el-input v-model="formData.status" :disabled="true" clearable placeholder="暂无状态" />
      </el-form-item>
      <el-form-item label="甲方" prop="party_a">
        <el-input v-model="formData.party_a" :disabled="true" clearable placeholder="暂无甲方" />
      </el-form-item>
      <el-form-item label="乙方" prop="party_b">
        <el-input v-model="formData.party_b" :disabled="true" clearable placeholder="暂无乙方" />
      </el-form-item>
      <el-form-item label="片区经理" prop="area_manager">
        <el-input v-model="formData.area_manager" :disabled="true" clearable placeholder="暂无经理" />
      </el-form-item>
      <el-form-item label="状态" prop="type">
        <el-input v-model="formData.type" :disabled="true" clearable placeholder="暂无状态" />
      </el-form-item>
    </el-form>
    <div class="btn_men">
      <el-button @click="show=false">取消</el-button>
      <el-button type="primary"  @click="show=false" >确定</el-button>
    </div>
  </el-dialog>
</template>

<script setup>
import { ref, reactive, defineExpose } from "vue";
const formData = reactive({
  id: "",
  company_id: "",
  contract_type: "",
  contract_no: "",
  file: "",
  status: "",
  party_a: "",
  party_b: "",
  area_manager: "",
});
const show = ref(false);
const shoeEditFn = (flag) => {
  show.value = flag;
};
// 传值赋值
const setFormData = async (data) => {
  for (const key in formData) {
    if (data[key] != null && data[key] != undefined) {
      //@ts-ignore
      formData[key] = data[key];
    }
  }
};

defineExpose({
  shoeEditFn,
  setFormData,
});
</script>

<style lang="scss" scoped>
.btn_men {
  text-align: right;
}
</style>