gaoluyang
9 天以前 293a46e85cff3af59633cff50a2514cdbd7e8c0b
src/views/personnelManagement/contractManagement/components/formDia.vue
@@ -6,12 +6,24 @@
        width="70%"
        @close="closeDia"
    >
      <el-descriptions title="基本信息" :column="3" border style="margin-bottom: 16px;">
        <el-descriptions-item label="姓名">{{ currentRow.staffName }}</el-descriptions-item>
        <el-descriptions-item label="员工编号">{{ currentRow.staffNo }}</el-descriptions-item>
        <el-descriptions-item label="性别">{{ currentRow.sex }}</el-descriptions-item>
        <el-descriptions-item label="年龄">{{ currentRow.age }}</el-descriptions-item>
        <el-descriptions-item label="联系电话">{{ currentRow.phone }}</el-descriptions-item>
        <el-descriptions-item label="状态">{{ formatStaffState(currentRow.staffState) }}</el-descriptions-item>
        <el-descriptions-item label="户籍住址" :span="2">{{ currentRow.nativePlace }}</el-descriptions-item>
        <el-descriptions-item label="紧急联系人">{{ currentRow.emergencyContact }}</el-descriptions-item>
        <el-descriptions-item label="紧急联系人电话">{{ currentRow.emergencyContactPhone }}</el-descriptions-item>
        <el-descriptions-item label="合同结束日期">{{ currentRow.contractExpireTime }}</el-descriptions-item>
      </el-descriptions>
      <PIMTable
          rowKey="id"
          :column="tableColumn"
          :tableData="tableData"
          :tableLoading="tableLoading"
          height="600"
          height="360"
      ></PIMTable>
      <template #footer>
        <div class="dialog-footer">
@@ -32,6 +44,7 @@
const filesDia = ref()
const dialogFormVisible = ref(false);
const operationType = ref('')
const currentRow = ref({})
const tableColumn = ref([
  {
    label: "合同年限",
@@ -65,13 +78,30 @@
const tableData = ref([]);
const tableLoading = ref(false);
// 状态格式化
const formatStaffState = (state) => {
  if (state == 0) return "离职";
  if (state == 1) return "在职";
  return "-";
};
// 打开弹框
const openDialog = (type, row) => {
  operationType.value = type;
  currentRow.value = row || {};
  dialogFormVisible.value = true;
  if (operationType.value === 'edit') {
    findStaffContractListPage({staffOnJobId: row.id}).then(res => {
      tableData.value = res.data.records
      tableData.value = res.data.records.map(item => {
         if (item.contractStartTime && item.contractEndTime) {
           const startDate = new Date(item.contractStartTime);
           const endDate = new Date(item.contractEndTime);
           if (!isNaN(startDate.getTime()) && !isNaN(endDate.getTime())) {
             item.contractTerm = endDate.getFullYear() - startDate.getFullYear()+"年";
           }
         }
         return item;
       })
    })
  }
}