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">
@@ -19,17 +31,20 @@
        </div>
      </template>
    </el-dialog>
    <Files ref="filesDia"></Files>
  </div>
</template>
<script setup>
import {ref} from "vue";
import {staffOnJobInfo} from "@/api/personnelManagement/employeeRecord.js";
import {findStaffContractListPage} from "@/api/personnelManagement/staffContract.js";
const Files = defineAsyncComponent(() => import( "@/views/personnelManagement/contractManagement/filesDia.vue"));
const { proxy } = getCurrentInstance()
const emit = defineEmits(['confirm'])
const emit = defineEmits(['close'])
const filesDia = ref()
const dialogFormVisible = ref(false);
const operationType = ref('')
const currentRow = ref({})
const tableColumn = ref([
  {
    label: "合同年限",
@@ -43,21 +58,59 @@
    label: "合同结束日期",
    prop: "contractEndTime",
  },
  {
    dataType: "action",
    label: "操作",
    align: "center",
    fixed: 'right',
    width: 120,
    operation: [
      {
        name: "上传附件",
        type: "text",
        clickFun: (row) => {
          filesDia.value.openDialog( row,'合同')
        },
      }
    ],
  },
]);
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') {
    staffOnJobInfo({staffNo: row.staffNo}).then(res => {
      tableData.value = res.data
    findStaffContractListPage({staffOnJobId: row.id}).then(res => {
      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;
       })
    })
  }
}
const openUploadFile = (row) => {
  filesDia.value.open = true
  filesDia.value.row = row
}
// 关闭弹框
const closeDia = () => {
  dialogFormVisible.value = false;