zhangwencui
17 小时以前 b7754a0723ec899af5afc99a6be90c4a6d1dea4e
户籍地址、现住址残余展示删除
已修改6个文件
753 ■■■■ 文件已修改
src/views/officeProcessAutomation/HrManage/resign-apply/components/formDia.vue 167 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/officeProcessAutomation/HrManage/resign-apply/index.vue 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/officeProcessAutomation/HrManage/staff-contract/index.vue 124 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/personnelManagement/contractManagement/index.vue 142 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/personnelManagement/dimission/components/formDia.vue 167 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/personnelManagement/dimission/index.vue 81 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/officeProcessAutomation/HrManage/resign-apply/components/formDia.vue
@@ -1,29 +1,31 @@
<template>
  <div>
    <el-dialog
        v-model="dialogFormVisible"
    <el-dialog v-model="dialogFormVisible"
        :title="operationType === 'add' ? '新增离职' : '编辑离职'"
        width="70%"
        @close="closeDia"
    >
               @close="closeDia">
      <!-- 员工信息展示区域 -->
      <div class="info-section">
        <div class="info-title">员工信息</div>
        <el-form :model="form" label-width="200px" label-position="left" :rules="rules" ref="formRef" style="margin-top: 20px">
        <el-form :model="form"
                 label-width="200px"
                 label-position="left"
                 :rules="rules"
                 ref="formRef"
                 style="margin-top: 20px">
          <el-row :gutter="30">
            <el-col :span="12">
              <el-form-item label="姓名:" prop="staffOnJobId">
              <el-form-item label="姓名:"
                            prop="staffOnJobId">
                <el-select v-model="form.staffOnJobId"
                           placeholder="请选择人员"
                           style="width: 100%"
                           :disabled="operationType === 'edit'"
                           @change="handleSelect">
                  <el-option
                      v-for="item in personList"
                  <el-option v-for="item in personList"
                      :key="item.id"
                      :label="item.staffName"
                      :value="item.id"
                  />
                             :value="item.id" />
                </el-select>
              </el-form-item>
            </el-col>
@@ -39,21 +41,11 @@
                {{ currentStaffRecord.sex || '-' }}
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="户籍住址:">
                {{ currentStaffRecord.nativePlace || '-' }}
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="30">
            <el-col :span="12">
              <el-form-item label="岗位:">
                {{ currentStaffRecord.postName || '-' }}
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="现住址:">
                {{ currentStaffRecord.adress || '-' }}
              </el-form-item>
            </el-col>
          </el-row>
@@ -97,48 +89,48 @@
          </el-row>
          <el-row :gutter="30">
            <el-col :span="12">
              <el-form-item label="离职日期:" prop="leaveDate">
                <el-date-picker
                    v-model="form.leaveDate"
              <el-form-item label="离职日期:"
                            prop="leaveDate">
                <el-date-picker v-model="form.leaveDate"
                    type="date"
                    :disabled="operationType === 'edit'"
                    :disabled-date="disabledFutureDate"
                    placeholder="请选择离职日期"
                    value-format="YYYY-MM-DD"
                    format="YYYY-MM-DD"
                    style="width: 100%"
                />
                                style="width: 100%" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="离职原因:" prop="reason">
                <el-select v-model="form.reason" placeholder="请选择离职原因" style="width: 100%" @change="handleSelectDimissionReason">
                  <el-option
                      v-for="(item, index) in dimissionReasonOptions"
              <el-form-item label="离职原因:"
                            prop="reason">
                <el-select v-model="form.reason"
                           placeholder="请选择离职原因"
                           style="width: 100%"
                           @change="handleSelectDimissionReason">
                  <el-option v-for="(item, index) in dimissionReasonOptions"
                      :key="index"
                      :label="item.label"
                      :value="item.value"
                  />
                             :value="item.value" />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="30">
            <el-col :span="12">
              <el-form-item label="备注:" prop="remark" v-if="form.reason === 'other'">
                <el-input
                    v-model="form.remark"
              <el-form-item label="备注:"
                            prop="remark"
                            v-if="form.reason === 'other'">
                <el-input v-model="form.remark"
                    type="textarea"
                    :rows="3"
                    placeholder="备注"
                    maxlength="500"
                    show-word-limit
                />
                          show-word-limit />
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
<!--        <el-row :gutter="30">-->
<!--          <el-col :span="12">-->
<!--            <div class="info-item">-->
@@ -161,10 +153,10 @@
<!--          </el-col>-->
<!--        </el-row>-->
      </div>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary" @click="submitForm">确认</el-button>
          <el-button type="primary"
                     @click="submitForm">确认</el-button>
          <el-button @click="closeDia">取消</el-button>
        </div>
      </template>
@@ -175,21 +167,24 @@
<script setup>
import {ref, reactive, toRefs, getCurrentInstance} from "vue";
import {staffOnJobListPage} from "@/api/personnelManagement/staffOnJob.js";
import {createStaffLeave, updateStaffLeave} from "@/api/personnelManagement/staffLeave.js";
const { proxy } = getCurrentInstance()
const emit = defineEmits(['close'])
  import {
    createStaffLeave,
    updateStaffLeave,
  } from "@/api/personnelManagement/staffLeave.js";
  const { proxy } = getCurrentInstance();
  const emit = defineEmits(["close"]);
const dialogFormVisible = ref(false);
const operationType = ref('')
  const operationType = ref("");
const getTodayDate = () => {
  const now = new Date();
  const year = now.getFullYear();
  const month = `${now.getMonth() + 1}`.padStart(2, '0');
  const day = `${now.getDate()}`.padStart(2, '0');
    const month = `${now.getMonth() + 1}`.padStart(2, "0");
    const day = `${now.getDate()}`.padStart(2, "0");
  return `${year}-${month}-${day}`;
};
const disabledFutureDate = (time) => {
  const disabledFutureDate = time => {
  const todayEnd = new Date();
  todayEnd.setHours(23, 59, 59, 999);
  return time.getTime() > todayEnd.getTime();
@@ -203,52 +198,55 @@
  },
  rules: {
    staffName: [{ required: true, message: "请选择人员" }],
    leaveDate: [{ required: true, message: "请选择离职日期", trigger: "change" }],
      leaveDate: [
        { required: true, message: "请选择离职日期", trigger: "change" },
      ],
    reason: [{ required: true, message: "请选择离职原因"}],
  },
  dimissionReasonOptions: [
      {label: '薪资待遇', value: 'salary'},
      {label: '职业发展', value: 'career_development'},
      {label: '工作环境', value: 'work_environment'},
      {label: '个人原因', value: 'personal_reason'},
      {label: '其他', value: 'other'},
      { label: "薪资待遇", value: "salary" },
      { label: "职业发展", value: "career_development" },
      { label: "工作环境", value: "work_environment" },
      { label: "个人原因", value: "personal_reason" },
      { label: "其他", value: "other" },
  ],
  currentStaffRecord: {},
});
const { form, rules, dimissionReasonOptions, currentStaffRecord } = toRefs(data);
  const { form, rules, dimissionReasonOptions, currentStaffRecord } =
    toRefs(data);
// 打开弹框
const openDialog = (type, row) => {
  operationType.value = type;
  dialogFormVisible.value = true;
  if (operationType.value === 'edit') {
    currentStaffRecord.value = row
    form.value.staffOnJobId = row.staffOnJobId
    form.value.leaveDate = row.leaveDate
    form.value.reason = row.reason
    form.value.remark = row.remark
    if (operationType.value === "edit") {
      currentStaffRecord.value = row;
      form.value.staffOnJobId = row.staffOnJobId;
      form.value.leaveDate = row.leaveDate;
      form.value.reason = row.reason;
      form.value.remark = row.remark;
    personList.value = [
      {
        staffName: row.staffName,
        id: row.staffOnJobId,
      }
    ]
        },
      ];
  } else {
    form.value.leaveDate = getTodayDate()
    getList()
      form.value.leaveDate = getTodayDate();
      getList();
  }
}
  };
const handleSelectDimissionReason = (val) => {
  if (val === 'other') {
    form.value.remark = ''
  const handleSelectDimissionReason = val => {
    if (val === "other") {
      form.value.remark = "";
  }
}
  };
// 提交产品表单
const submitForm = () => {
  form.value.staffState = 0
  if (form.value.reason !== 'other') {
    form.value.remark = ''
    form.value.staffState = 0;
    if (form.value.reason !== "other") {
      form.value.remark = "";
  }
  proxy.$refs["formRef"].validate(valid => {
    if (valid) {
@@ -256,17 +254,16 @@
        createStaffLeave(form.value).then(res => {
          proxy.$modal.msgSuccess("提交成功");
          closeDia();
        })
          });
      } else {
        updateStaffLeave(currentStaffRecord.value.id, form.value).then(res => {
          proxy.$modal.msgSuccess("提交成功");
          closeDia();
        })
          });
      }
    }
  })
}
    });
  };
// 关闭弹框
const closeDia = () => {
  // 表单已注释,手动重置表单数据
@@ -277,7 +274,7 @@
    remark: "",
  };
  dialogFormVisible.value = false;
  emit('close')
    emit("close");
};
const personList = ref([]);
@@ -289,20 +286,20 @@
  staffOnJobListPage({
    current: -1,
    size: -1,
        staffState: 1
      staffState: 1,
  }).then(res => {
    personList.value = res.data.records || []
  })
      personList.value = res.data.records || [];
    });
};
const handleSelect = (val) => {
  let obj = personList.value.find(item => item.id === val)
  currentStaffRecord.value = {}
  const handleSelect = val => {
    let obj = personList.value.find(item => item.id === val);
    currentStaffRecord.value = {};
  if (obj) {
    // 保留离职日期和离职原因,只更新员工信息
    currentStaffRecord.value = obj
      currentStaffRecord.value = obj;
  }
}
  };
defineExpose({
  openDialog,
});
src/views/officeProcessAutomation/HrManage/resign-apply/index.vue
@@ -4,26 +4,24 @@
    <div class="search_form mb20">
      <div>
        <span class="search_title">姓名:</span>
        <el-input
            v-model="searchForm.staffName"
        <el-input v-model="searchForm.staffName"
            style="width: 240px"
            placeholder="请输入姓名搜索"
            @change="handleQuery"
            clearable
            :prefix-icon="Search"
        />
        <el-button type="primary" @click="handleQuery" style="margin-left: 10px"
        >搜索</el-button
        >
                  :prefix-icon="Search" />
        <el-button type="primary"
                   @click="handleQuery"
                   style="margin-left: 10px">搜索</el-button>
      </div>
      <div>
        <el-button type="primary" @click="openForm('add')">新增离职</el-button>
        <el-button type="primary"
                   @click="openForm('add')">新增离职</el-button>
        <el-button @click="handleOut">导出</el-button>
      </div>
    </div>
    <div class="table_list">
      <PIMTable
          rowKey="id"
      <PIMTable rowKey="id"
          :column="tableColumn"
          :tableData="tableData"
          :page="page"
@@ -31,10 +29,10 @@
          @selection-change="handleSelectionChange"
          :tableLoading="tableLoading"
          @pagination="pagination"
          :total="page.total"
      ></PIMTable>
                :total="page.total"></PIMTable>
    </div>
    <form-dia ref="formDia" @close="handleQuery"></form-dia>
    <form-dia ref="formDia"
              @close="handleQuery"></form-dia>
  </div>
</template>
@@ -56,7 +54,7 @@
    label: "状态",
    prop: "staffState",
    dataType: "tag",
    formatData: (params) => {
      formatData: params => {
      if (params == 0) {
        return "离职";
      } else if (params == 1) {
@@ -65,7 +63,7 @@
        return null;
      }
    },
    formatType: (params) => {
      formatType: params => {
      if (params == 0) {
        return "danger";
      } else if (params == 1) {
@@ -92,10 +90,6 @@
    prop: "sex",
  },
  {
    label: "户籍住址",
    prop: "nativePlace",
  },
  {
    label: "部门",
    prop: "deptName",
  },
@@ -104,18 +98,13 @@
    prop: "postName",
  },
  {
    label: "现住址",
    prop: "adress",
    width:200
  },
  {
    label: "第一学历",
    prop: "firstStudy",
  },
  {
    label: "专业",
    prop: "profession",
    width:100
      width: 100,
  },
  {
    label: "年龄",
@@ -124,28 +113,28 @@
  {
    label: "联系电话",
    prop: "phone",
    width:150
      width: 150,
  },
  {
    label: "紧急联系人",
    prop: "emergencyContact",
    width: 120
      width: 120,
  },
  {
    label: "紧急联系人电话",
    prop: "emergencyContactPhone",
    width:150
      width: 150,
  },
  {
    dataType: "action",
    label: "操作",
    align: "center",
    fixed: 'right',
      fixed: "right",
    operation: [
      {
        name: "编辑",
        type: "text",
        clickFun: (row) => {
          clickFun: row => {
          openForm("edit", row);
        },
      },
@@ -160,9 +149,8 @@
  size: 100,
  total: 0,
});
const formDia = ref()
const { proxy } = getCurrentInstance()
  const formDia = ref();
  const { proxy } = getCurrentInstance();
// 查询列表
/** 搜索按钮操作 */
@@ -170,31 +158,33 @@
  page.current = 1;
  getList();
};
const pagination = (obj) => {
  const pagination = obj => {
  page.current = obj.page;
  page.size = obj.limit;
  getList();
};
const getList = () => {
  tableLoading.value = true;
  findStaffLeaveListPage({...page, ...searchForm.value}).then(res => {
    findStaffLeaveListPage({ ...page, ...searchForm.value })
      .then(res => {
    tableLoading.value = false;
    tableData.value = res.data.records
        tableData.value = res.data.records;
    page.total = res.data.total;
  }).catch(err => {
    tableLoading.value = false;
  })
      .catch(err => {
        tableLoading.value = false;
      });
};
// 表格选择数据
const handleSelectionChange = (selection) => {
  const handleSelectionChange = selection => {
  selectedRows.value = selection;
};
// 打开弹框
const openForm = (type, row) => {
  nextTick(() => {
    formDia.value?.openDialog(type, row)
  })
      formDia.value?.openDialog(type, row);
    });
};
// 导出
src/views/officeProcessAutomation/HrManage/staff-contract/index.vue
@@ -4,33 +4,48 @@
    <div class="search_form mb20">
      <div>
        <span class="search_title">姓名:</span>
        <el-input v-model="searchForm.staffName" style="width: 240px" placeholder="请输入姓名搜索" @change="handleQuery"
          clearable :prefix-icon="Search" />
        <span style="margin-left: 10px" class="search_title">合同结束日期:</span>
        <el-date-picker v-model="searchForm.entryDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD" type="daterange"
          placeholder="请选择" clearable @change="changeDaterange" />
        <el-button type="primary" @click="handleQuery" style="margin-left: 10px">搜索</el-button>
        <el-input v-model="searchForm.staffName"
                  style="width: 240px"
                  placeholder="请输入姓名搜索"
                  @change="handleQuery"
                  clearable
                  :prefix-icon="Search" />
        <span style="margin-left: 10px"
              class="search_title">合同结束日期:</span>
        <el-date-picker v-model="searchForm.entryDate"
                        value-format="YYYY-MM-DD"
                        format="YYYY-MM-DD"
                        type="daterange"
                        placeholder="请选择"
                        clearable
                        @change="changeDaterange" />
        <el-button type="primary"
                   @click="handleQuery"
                   style="margin-left: 10px">搜索</el-button>
      </div>
      <div>
        <el-button @click="handleOut">导出</el-button>
      </div>
    </div>
    <div class="table_list">
      <PIMTable rowKey="id" :column="tableColumn" :tableData="tableData" :page="page" :isSelection="true"
        @selection-change="handleSelectionChange" :tableLoading="tableLoading" @pagination="pagination"
      <PIMTable rowKey="id"
                :column="tableColumn"
                :tableData="tableData"
                :page="page"
                :isSelection="true"
                @selection-change="handleSelectionChange"
                :tableLoading="tableLoading"
                @pagination="pagination"
        :total="page.total"></PIMTable>
    </div>
    <form-dia ref="formDia" @close="handleQuery"></form-dia>
    <form-dia ref="formDia"
              @close="handleQuery"></form-dia>
    <!-- 合同导入对话框 -->
    <el-dialog
      :title="upload.title"
    <el-dialog :title="upload.title"
      v-model="upload.open"
      width="400px"
      append-to-body
    >
      <el-upload
        ref="uploadRef"
               append-to-body>
      <el-upload ref="uploadRef"
        :limit="1"
        accept=".xlsx, .xls"
        :headers="upload.headers"
@@ -39,8 +54,7 @@
        :on-progress="handleFileUploadProgress"
        :on-success="handleFileSuccess"
        :auto-upload="false"
        drag
      >
                 drag>
        <el-icon class="el-icon--upload"><upload-filled /></el-icon>
        <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
        <template #tip>
@@ -51,7 +65,8 @@
      </el-upload>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary" @click="submitFileForm">确 定</el-button>
          <el-button type="primary"
                     @click="submitFileForm">确 定</el-button>
          <el-button @click="upload.open = false">取 消</el-button>
        </div>
      </template>
@@ -83,7 +98,7 @@
    label: "状态",
    prop: "staffState",
    dataType: "tag",
    formatData: (params) => {
      formatData: params => {
      if (params == 0) {
        return "离职";
      } else if (params == 1) {
@@ -92,7 +107,7 @@
        return null;
      }
    },
    formatType: (params) => {
      formatType: params => {
      if (params == 0) {
        return "danger";
      } else if (params == 1) {
@@ -115,17 +130,8 @@
    prop: "sex",
  },
  {
    label: "户籍住址",
    prop: "nativePlace",
  },
  {
    label: "岗位",
    prop: "postName",
  },
  {
    label: "现住址",
    prop: "adress",
    width: 200
  },
  {
    label: "第一学历",
@@ -134,7 +140,7 @@
  {
    label: "专业",
    prop: "profession",
    width: 100
      width: 100,
  },
  {
    label: "年龄",
@@ -143,41 +149,41 @@
  {
    label: "联系电话",
    prop: "phone",
    width: 150
      width: 150,
  },
  {
    label: "紧急联系人",
    prop: "emergencyContact",
    width: 120
      width: 120,
  },
  {
    label: "紧急联系人电话",
    prop: "emergencyContactPhone",
    width: 150
      width: 150,
  },
  {
    label: "合同结束日期",
    prop: "contractExpireTime",
    width: 120
      width: 120,
  },
  {
    dataType: "action",
    label: "操作",
    align: "center",
    fixed: 'right',
      fixed: "right",
    width: 120,
    operation: [
      {
        name: "详情",
        type: "text",
        clickFun: (row) => {
          clickFun: row => {
          openForm("edit", row);
        },
      }
        },
    ],
  },
]);
const filesDia = ref()
  const filesDia = ref();
const tableData = ref([]);
const selectedRows = ref([]);
const tableLoading = ref(false);
@@ -186,10 +192,10 @@
  size: 100,
  total: 0,
});
const formDia = ref()
const { proxy } = getCurrentInstance()
  const formDia = ref();
  const { proxy } = getCurrentInstance();
const changeDaterange = (value) => {
  const changeDaterange = value => {
  searchForm.value.entryDateStart = undefined;
  searchForm.value.entryDateEnd = undefined;
  if (value) {
@@ -199,10 +205,10 @@
  getList();
};
// 打开附件弹框
const openFilesFormDia = (row) => {
  const openFilesFormDia = row => {
  nextTick(() => {
    filesDia.value?.openDialog( row,'合同')
  })
      filesDia.value?.openDialog(row, "合同");
    });
};
// 查询列表
/** 搜索按钮操作 */
@@ -210,7 +216,7 @@
  page.current = 1;
  getList();
};
const pagination = (obj) => {
  const pagination = obj => {
  page.current = obj.page;
  page.size = obj.limit;
  getList();
@@ -218,26 +224,28 @@
const getList = () => {
  tableLoading.value = true;
  const params = { ...searchForm.value, ...page };
  params.entryDate = undefined
  params.staffState = 1
  staffOnJobListPage(params).then(res => {
    params.entryDate = undefined;
    params.staffState = 1;
    staffOnJobListPage(params)
      .then(res => {
    tableLoading.value = false;
    tableData.value = res.data.records
        tableData.value = res.data.records;
    page.total = res.data.total;
  }).catch(err => {
    tableLoading.value = false;
  })
      .catch(err => {
        tableLoading.value = false;
      });
};
// 表格选择数据
const handleSelectionChange = (selection) => {
  const handleSelectionChange = selection => {
  selectedRows.value = selection;
};
// 打开弹框
const openForm = (type, row) => {
  nextTick(() => {
    formDia.value?.openDialog(type, row)
  })
      formDia.value?.openDialog(type, row);
    });
};
// 导出
const handleOut = () => {
@@ -247,7 +255,11 @@
    type: "warning",
  })
    .then(() => {
      proxy.download("/staff/staffOnJob/export", {staffState: 1}, "合同管理.xlsx");
        proxy.download(
          "/staff/staffOnJob/export",
          { staffState: 1 },
          "合同管理.xlsx"
        );
    })
    .catch(() => {
      proxy.$modal.msg("已取消");
src/views/personnelManagement/contractManagement/index.vue
@@ -3,12 +3,24 @@
    <div class="search_form mb20">
      <div>
        <span class="search_title">姓名:</span>
        <el-input v-model="searchForm.staffName" style="width: 240px" placeholder="请输入姓名搜索" @change="handleQuery"
          clearable :prefix-icon="Search" />
        <span style="margin-left: 10px" class="search_title">合同结束日期:</span>
        <el-date-picker v-model="searchForm.entryDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD" type="daterange"
          placeholder="请选择" clearable @change="changeDaterange" />
        <el-button type="primary" @click="handleQuery" style="margin-left: 10px">搜索</el-button>
        <el-input v-model="searchForm.staffName"
                  style="width: 240px"
                  placeholder="请输入姓名搜索"
                  @change="handleQuery"
                  clearable
                  :prefix-icon="Search" />
        <span style="margin-left: 10px"
              class="search_title">合同结束日期:</span>
        <el-date-picker v-model="searchForm.entryDate"
                        value-format="YYYY-MM-DD"
                        format="YYYY-MM-DD"
                        type="daterange"
                        placeholder="请选择"
                        clearable
                        @change="changeDaterange" />
        <el-button type="primary"
                   @click="handleQuery"
                   style="margin-left: 10px">搜索</el-button>
      </div>
      <div>
        <!--        <el-button type="primary" @click="openForm('add')">新增入职</el-button>-->
@@ -18,27 +30,28 @@
      </div>
    </div>
    <div class="table_list">
      <PIMTable rowKey="id" :column="tableColumn" :tableData="tableData" :page="page" :isSelection="true"
        @selection-change="handleSelectionChange" :tableLoading="tableLoading" @pagination="pagination"
      <PIMTable rowKey="id"
                :column="tableColumn"
                :tableData="tableData"
                :page="page"
                :isSelection="true"
                @selection-change="handleSelectionChange"
                :tableLoading="tableLoading"
                @pagination="pagination"
        :total="page.total"></PIMTable>
    </div>
    <form-dia ref="formDia" @close="handleQuery"></form-dia>
    <renew-contract
        v-if="isShowRenewContractModal"
    <form-dia ref="formDia"
              @close="handleQuery"></form-dia>
    <renew-contract v-if="isShowRenewContractModal"
        v-model:visible="isShowRenewContractModal"
        :id="id"
        @completed="handleQuery"
    />
                    @completed="handleQuery" />
    <!-- 合同导入对话框 -->
    <el-dialog
      :title="upload.title"
    <el-dialog :title="upload.title"
      v-model="upload.open"
      width="400px"
      append-to-body
    >
      <el-upload
        ref="uploadRef"
               append-to-body>
      <el-upload ref="uploadRef"
        :limit="1"
        accept=".xlsx, .xls"
        :headers="upload.headers"
@@ -47,8 +60,7 @@
        :on-progress="handleFileUploadProgress"
        :on-success="handleFileSuccess"
        :auto-upload="false"
        drag
      >
                 drag>
        <el-icon class="el-icon--upload"><upload-filled /></el-icon>
        <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
        <template #tip>
@@ -66,7 +78,8 @@
      </el-upload>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary" @click="submitFileForm">确 定</el-button>
          <el-button type="primary"
                     @click="submitFileForm">确 定</el-button>
          <el-button @click="upload.open = false">取 消</el-button>
        </div>
      </template>
@@ -79,7 +92,11 @@
import { Search } from "@element-plus/icons-vue";
import { onMounted, ref, defineAsyncComponent } from "vue";
import FormDia from "@/views/personnelManagement/contractManagement/components/formDia.vue";
const RenewContract = defineAsyncComponent(() => import("@/views/personnelManagement/employeeRecord/components/RenewContract.vue"));
  const RenewContract = defineAsyncComponent(() =>
    import(
      "@/views/personnelManagement/employeeRecord/components/RenewContract.vue"
    )
  );
import { ElMessageBox } from "element-plus";
import { staffOnJobListPage } from "@/api/personnelManagement/staffOnJob.js";
import dayjs from "dayjs";
@@ -99,7 +116,7 @@
    label: "状态",
    prop: "staffState",
    dataType: "tag",
    formatData: (params) => {
      formatData: params => {
      if (params == 0) {
        return "离职";
      } else if (params == 1) {
@@ -108,7 +125,7 @@
        return null;
      }
    },
    formatType: (params) => {
      formatType: params => {
      if (params == 0) {
        return "danger";
      } else if (params == 1) {
@@ -131,17 +148,8 @@
    prop: "sex",
  },
  {
    label: "户籍住址",
    prop: "nativePlace",
  },
  {
    label: "岗位",
    prop: "postName",
  },
  {
    label: "现住址",
    prop: "adress",
    width: 200
  },
  {
    label: "第一学历",
@@ -150,7 +158,7 @@
  {
    label: "专业",
    prop: "profession",
    width: 100
      width: 100,
  },
  {
    label: "年龄",
@@ -159,17 +167,17 @@
  {
    label: "联系电话",
    prop: "phone",
    width: 150
      width: 150,
  },
  {
    label: "紧急联系人",
    prop: "emergencyContact",
    width: 120
      width: 120,
  },
  {
    label: "紧急联系人电话",
    prop: "emergencyContactPhone",
    width: 150
      width: 150,
  },
  // {
  //   label: "合同年限",
@@ -183,19 +191,19 @@
  {
    label: "合同结束日期",
    prop: "contractExpireTime",
    width: 120
      width: 120,
  },
  {
    dataType: "action",
    label: "操作",
    align: "center",
    fixed: 'right',
      fixed: "right",
    width: 160,
    operation: [
      {
        name: "详情",
        type: "text",
        clickFun: (row) => {
          clickFun: row => {
          openForm("edit", row);
        },
      },
@@ -203,15 +211,15 @@
        name: "续签合同",
        type: "text",
        showHide: row => row.staffState === 1,
        clickFun: (row) => {
          clickFun: row => {
          isShowRenewContractModal.value = true;
          id.value = row.id;
        },
      }
        },
    ],
  },
]);
const filesDia = ref()
  const filesDia = ref();
const isShowRenewContractModal = ref(false);
const id = ref(0);
const tableData = ref([]);
@@ -222,10 +230,10 @@
  size: 100,
  total: 0,
});
const formDia = ref()
const { proxy } = getCurrentInstance()
  const formDia = ref();
  const { proxy } = getCurrentInstance();
const changeDaterange = (value) => {
  const changeDaterange = value => {
  searchForm.value.entryDateStart = undefined;
  searchForm.value.entryDateEnd = undefined;
  if (value) {
@@ -235,11 +243,11 @@
  getList();
};
// 打开附件弹框
const openFilesFormDia = (row) => {
  console.log(row)
  const openFilesFormDia = row => {
    console.log(row);
  nextTick(() => {
    filesDia.value?.openDialog( row,'合同')
  })
      filesDia.value?.openDialog(row, "合同");
    });
};
// 查询列表
/** 搜索按钮操作 */
@@ -247,7 +255,7 @@
  page.current = 1;
  getList();
};
const pagination = (obj) => {
  const pagination = obj => {
  page.current = obj.page;
  page.size = obj.limit;
  getList();
@@ -255,26 +263,28 @@
const getList = () => {
  tableLoading.value = true;
  const params = { ...searchForm.value, ...page };
  params.entryDate = undefined
  params.staffState = 1
  staffOnJobListPage(params).then(res => {
    params.entryDate = undefined;
    params.staffState = 1;
    staffOnJobListPage(params)
      .then(res => {
    tableLoading.value = false;
    tableData.value = res.data.records
        tableData.value = res.data.records;
    page.total = res.data.total;
  }).catch(err => {
    tableLoading.value = false;
  })
      .catch(err => {
        tableLoading.value = false;
      });
};
// 表格选择数据
const handleSelectionChange = (selection) => {
  const handleSelectionChange = selection => {
  selectedRows.value = selection;
};
// 打开弹框
const openForm = (type, row) => {
  nextTick(() => {
    formDia.value?.openDialog(type, row)
  })
      formDia.value?.openDialog(type, row);
    });
};
// 导出
const handleOut = () => {
@@ -284,7 +294,11 @@
    type: "warning",
  })
    .then(() => {
      proxy.download("/staff/staffOnJob/export", {staffState: 1}, "合同管理.xlsx");
        proxy.download(
          "/staff/staffOnJob/export",
          { staffState: 1 },
          "合同管理.xlsx"
        );
    })
    .catch(() => {
      proxy.$modal.msg("已取消");
@@ -311,7 +325,7 @@
}
/** 提交上传文件 */
function submitFileForm() {
  console.log(upload.url + '?updateSupport=' + upload.updateSupport)
    console.log(upload.url + "?updateSupport=" + upload.updateSupport);
  proxy.$refs["uploadRef"].submit();
}
/**文件上传中处理 */
src/views/personnelManagement/dimission/components/formDia.vue
@@ -1,29 +1,31 @@
<template>
  <div>
    <el-dialog
        v-model="dialogFormVisible"
    <el-dialog v-model="dialogFormVisible"
        :title="operationType === 'add' ? '新增离职' : '编辑离职'"
        width="70%"
        @close="closeDia"
    >
               @close="closeDia">
      <!-- 员工信息展示区域 -->
      <div class="info-section">
        <div class="info-title">员工信息</div>
        <el-form :model="form" label-width="200px" label-position="left" :rules="rules" ref="formRef" style="margin-top: 20px">
        <el-form :model="form"
                 label-width="200px"
                 label-position="left"
                 :rules="rules"
                 ref="formRef"
                 style="margin-top: 20px">
          <el-row :gutter="30">
            <el-col :span="12">
              <el-form-item label="姓名:" prop="staffOnJobId">
              <el-form-item label="姓名:"
                            prop="staffOnJobId">
                <el-select v-model="form.staffOnJobId"
                           placeholder="请选择人员"
                           style="width: 100%"
                           :disabled="operationType === 'edit'"
                           @change="handleSelect">
                  <el-option
                      v-for="item in personList"
                  <el-option v-for="item in personList"
                      :key="item.id"
                      :label="item.staffName"
                      :value="item.id"
                  />
                             :value="item.id" />
                </el-select>
              </el-form-item>
            </el-col>
@@ -39,21 +41,11 @@
                {{ currentStaffRecord.sex || '-' }}
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="户籍住址:">
                {{ currentStaffRecord.nativePlace || '-' }}
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="30">
            <el-col :span="12">
              <el-form-item label="岗位:">
                {{ currentStaffRecord.postName || '-' }}
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="现住址:">
                {{ currentStaffRecord.adress || '-' }}
              </el-form-item>
            </el-col>
          </el-row>
@@ -97,48 +89,48 @@
          </el-row>
          <el-row :gutter="30">
            <el-col :span="12">
              <el-form-item label="离职日期:" prop="leaveDate">
                <el-date-picker
                    v-model="form.leaveDate"
              <el-form-item label="离职日期:"
                            prop="leaveDate">
                <el-date-picker v-model="form.leaveDate"
                    type="date"
                    :disabled="operationType === 'edit'"
                    :disabled-date="disabledFutureDate"
                    placeholder="请选择离职日期"
                    value-format="YYYY-MM-DD"
                    format="YYYY-MM-DD"
                    style="width: 100%"
                />
                                style="width: 100%" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="离职原因:" prop="reason">
                <el-select v-model="form.reason" placeholder="请选择离职原因" style="width: 100%" @change="handleSelectDimissionReason">
                  <el-option
                      v-for="(item, index) in dimissionReasonOptions"
              <el-form-item label="离职原因:"
                            prop="reason">
                <el-select v-model="form.reason"
                           placeholder="请选择离职原因"
                           style="width: 100%"
                           @change="handleSelectDimissionReason">
                  <el-option v-for="(item, index) in dimissionReasonOptions"
                      :key="index"
                      :label="item.label"
                      :value="item.value"
                  />
                             :value="item.value" />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="30">
            <el-col :span="12">
              <el-form-item label="备注:" prop="remark" v-if="form.reason === 'other'">
                <el-input
                    v-model="form.remark"
              <el-form-item label="备注:"
                            prop="remark"
                            v-if="form.reason === 'other'">
                <el-input v-model="form.remark"
                    type="textarea"
                    :rows="3"
                    placeholder="备注"
                    maxlength="500"
                    show-word-limit
                />
                          show-word-limit />
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
<!--        <el-row :gutter="30">-->
<!--          <el-col :span="12">-->
<!--            <div class="info-item">-->
@@ -161,10 +153,10 @@
<!--          </el-col>-->
<!--        </el-row>-->
      </div>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary" @click="submitForm">确认</el-button>
          <el-button type="primary"
                     @click="submitForm">确认</el-button>
          <el-button @click="closeDia">取消</el-button>
        </div>
      </template>
@@ -175,21 +167,24 @@
<script setup>
import {ref, reactive, toRefs, getCurrentInstance} from "vue";
import {staffOnJobListPage} from "@/api/personnelManagement/staffOnJob.js";
import {createStaffLeave, updateStaffLeave} from "@/api/personnelManagement/staffLeave.js";
const { proxy } = getCurrentInstance()
const emit = defineEmits(['close'])
  import {
    createStaffLeave,
    updateStaffLeave,
  } from "@/api/personnelManagement/staffLeave.js";
  const { proxy } = getCurrentInstance();
  const emit = defineEmits(["close"]);
const dialogFormVisible = ref(false);
const operationType = ref('')
  const operationType = ref("");
const getTodayDate = () => {
  const now = new Date();
  const year = now.getFullYear();
  const month = `${now.getMonth() + 1}`.padStart(2, '0');
  const day = `${now.getDate()}`.padStart(2, '0');
    const month = `${now.getMonth() + 1}`.padStart(2, "0");
    const day = `${now.getDate()}`.padStart(2, "0");
  return `${year}-${month}-${day}`;
};
const disabledFutureDate = (time) => {
  const disabledFutureDate = time => {
  const todayEnd = new Date();
  todayEnd.setHours(23, 59, 59, 999);
  return time.getTime() > todayEnd.getTime();
@@ -203,52 +198,55 @@
  },
  rules: {
    staffName: [{ required: true, message: "请选择人员" }],
    leaveDate: [{ required: true, message: "请选择离职日期", trigger: "change" }],
      leaveDate: [
        { required: true, message: "请选择离职日期", trigger: "change" },
      ],
    reason: [{ required: true, message: "请选择离职原因"}],
  },
  dimissionReasonOptions: [
      {label: '薪资待遇', value: 'salary'},
      {label: '职业发展', value: 'career_development'},
      {label: '工作环境', value: 'work_environment'},
      {label: '个人原因', value: 'personal_reason'},
      {label: '其他', value: 'other'},
      { label: "薪资待遇", value: "salary" },
      { label: "职业发展", value: "career_development" },
      { label: "工作环境", value: "work_environment" },
      { label: "个人原因", value: "personal_reason" },
      { label: "其他", value: "other" },
  ],
  currentStaffRecord: {},
});
const { form, rules, dimissionReasonOptions, currentStaffRecord } = toRefs(data);
  const { form, rules, dimissionReasonOptions, currentStaffRecord } =
    toRefs(data);
// 打开弹框
const openDialog = (type, row) => {
  operationType.value = type;
  dialogFormVisible.value = true;
  if (operationType.value === 'edit') {
    currentStaffRecord.value = row
    form.value.staffOnJobId = row.staffOnJobId
    form.value.leaveDate = row.leaveDate
    form.value.reason = row.reason
    form.value.remark = row.remark
    if (operationType.value === "edit") {
      currentStaffRecord.value = row;
      form.value.staffOnJobId = row.staffOnJobId;
      form.value.leaveDate = row.leaveDate;
      form.value.reason = row.reason;
      form.value.remark = row.remark;
    personList.value = [
      {
        staffName: row.staffName,
        id: row.staffOnJobId,
      }
    ]
        },
      ];
  } else {
    form.value.leaveDate = getTodayDate()
    getList()
      form.value.leaveDate = getTodayDate();
      getList();
  }
}
  };
const handleSelectDimissionReason = (val) => {
  if (val === 'other') {
    form.value.remark = ''
  const handleSelectDimissionReason = val => {
    if (val === "other") {
      form.value.remark = "";
  }
}
  };
// 提交产品表单
const submitForm = () => {
  form.value.staffState = 0
  if (form.value.reason !== 'other') {
    form.value.remark = ''
    form.value.staffState = 0;
    if (form.value.reason !== "other") {
      form.value.remark = "";
  }
  proxy.$refs["formRef"].validate(valid => {
    if (valid) {
@@ -256,17 +254,16 @@
        createStaffLeave(form.value).then(res => {
          proxy.$modal.msgSuccess("提交成功");
          closeDia();
        })
          });
      } else {
        updateStaffLeave(currentStaffRecord.value.id, form.value).then(res => {
          proxy.$modal.msgSuccess("提交成功");
          closeDia();
        })
          });
      }
    }
  })
}
    });
  };
// 关闭弹框
const closeDia = () => {
  // 表单已注释,手动重置表单数据
@@ -277,7 +274,7 @@
    remark: "",
  };
  dialogFormVisible.value = false;
  emit('close')
    emit("close");
};
const personList = ref([]);
@@ -289,20 +286,20 @@
  staffOnJobListPage({
    current: -1,
    size: -1,
        staffState: 1
      staffState: 1,
  }).then(res => {
    personList.value = res.data.records || []
  })
      personList.value = res.data.records || [];
    });
};
const handleSelect = (val) => {
  let obj = personList.value.find(item => item.id === val)
  currentStaffRecord.value = {}
  const handleSelect = val => {
    let obj = personList.value.find(item => item.id === val);
    currentStaffRecord.value = {};
  if (obj) {
    // 保留离职日期和离职原因,只更新员工信息
    currentStaffRecord.value = obj
      currentStaffRecord.value = obj;
  }
}
  };
defineExpose({
  openDialog,
});
src/views/personnelManagement/dimission/index.vue
@@ -3,27 +3,25 @@
    <div class="search_form mb20">
      <div>
        <span class="search_title">姓名:</span>
        <el-input
            v-model="searchForm.staffName"
        <el-input v-model="searchForm.staffName"
            style="width: 240px"
            placeholder="请输入姓名搜索"
            @change="handleQuery"
            clearable
            :prefix-icon="Search"
        />
        <el-button type="primary" @click="handleQuery" style="margin-left: 10px"
        >搜索</el-button
        >
                  :prefix-icon="Search" />
        <el-button type="primary"
                   @click="handleQuery"
                   style="margin-left: 10px">搜索</el-button>
      </div>
      <div>
        <el-button type="primary" @click="openForm('add')">新增离职</el-button>
        <el-button type="primary"
                   @click="openForm('add')">新增离职</el-button>
        <el-button @click="handleOut">导出</el-button>
        <!-- <el-button type="danger" plain @click="handleDelete">删除</el-button> -->
      </div>
    </div>
    <div class="table_list">
      <PIMTable
          rowKey="id"
      <PIMTable rowKey="id"
          :column="tableColumn"
          :tableData="tableData"
          :page="page"
@@ -31,10 +29,10 @@
          @selection-change="handleSelectionChange"
          :tableLoading="tableLoading"
          @pagination="pagination"
          :total="page.total"
      ></PIMTable>
                :total="page.total"></PIMTable>
    </div>
    <form-dia ref="formDia" @close="handleQuery"></form-dia>
    <form-dia ref="formDia"
              @close="handleQuery"></form-dia>
  </div>
</template>
@@ -42,7 +40,10 @@
import { Search } from "@element-plus/icons-vue";
import {onMounted, ref} from "vue";
import FormDia from "@/views/personnelManagement/dimission/components/formDia.vue";
import {findStaffLeaveListPage, batchDeleteStaffLeaves} from "@/api/personnelManagement/staffLeave.js";
  import {
    findStaffLeaveListPage,
    batchDeleteStaffLeaves,
  } from "@/api/personnelManagement/staffLeave.js";
import {ElMessageBox} from "element-plus";
const data = reactive({
@@ -56,7 +57,7 @@
    label: "状态",
    prop: "staffState",
    dataType: "tag",
    formatData: (params) => {
      formatData: params => {
      if (params == 0) {
        return "离职";
      } else if (params == 1) {
@@ -65,7 +66,7 @@
        return null;
      }
    },
    formatType: (params) => {
      formatType: params => {
      if (params == 0) {
        return "danger";
      } else if (params == 1) {
@@ -92,10 +93,6 @@
    prop: "sex",
  },
  {
    label: "户籍住址",
    prop: "nativePlace",
  },
  {
    label: "部门",
    prop: "deptName",
  },
@@ -104,18 +101,13 @@
    prop: "postName",
  },
  {
    label: "现住址",
    prop: "adress",
    width:200
  },
  {
    label: "第一学历",
    prop: "firstStudy",
  },
  {
    label: "专业",
    prop: "profession",
    width:100
      width: 100,
  },
  {
    label: "年龄",
@@ -124,28 +116,28 @@
  {
    label: "联系电话",
    prop: "phone",
    width:150
      width: 150,
  },
  {
    label: "紧急联系人",
    prop: "emergencyContact",
    width: 120
      width: 120,
  },
  {
    label: "紧急联系人电话",
    prop: "emergencyContactPhone",
    width:150
      width: 150,
  },
  {
    dataType: "action",
    label: "操作",
    align: "center",
    fixed: 'right',
      fixed: "right",
    operation: [
      {
        name: "编辑",
        type: "text",
        clickFun: (row) => {
          clickFun: row => {
          openForm("edit", row);
        },
      },
@@ -160,9 +152,8 @@
  size: 100,
  total: 0,
});
const formDia = ref()
const { proxy } = getCurrentInstance()
  const formDia = ref();
  const { proxy } = getCurrentInstance();
// 查询列表
/** 搜索按钮操作 */
@@ -170,38 +161,40 @@
  page.current = 1;
  getList();
};
const pagination = (obj) => {
  const pagination = obj => {
  page.current = obj.page;
  page.size = obj.limit;
  getList();
};
const getList = () => {
  tableLoading.value = true;
  findStaffLeaveListPage({...page, ...searchForm.value}).then(res => {
    findStaffLeaveListPage({ ...page, ...searchForm.value })
      .then(res => {
    tableLoading.value = false;
    tableData.value = res.data.records
        tableData.value = res.data.records;
    page.total = res.data.total;
  }).catch(err => {
    tableLoading.value = false;
  })
      .catch(err => {
        tableLoading.value = false;
      });
};
// 表格选择数据
const handleSelectionChange = (selection) => {
  const handleSelectionChange = selection => {
  selectedRows.value = selection;
};
// 打开弹框
const openForm = (type, row) => {
  nextTick(() => {
    formDia.value?.openDialog(type, row)
  })
      formDia.value?.openDialog(type, row);
    });
};
// 删除
const handleDelete = () => {
  let ids = [];
  if (selectedRows.value.length > 0) {
    ids = selectedRows.value.map((item) => item.id);
      ids = selectedRows.value.map(item => item.id);
  } else {
    proxy.$modal.msgWarning("请选择数据");
    return;
@@ -212,7 +205,7 @@
    type: "warning",
  })
      .then(() => {
        batchDeleteStaffLeaves(ids).then((res) => {
        batchDeleteStaffLeaves(ids).then(res => {
          proxy.$modal.msgSuccess("删除成功");
          getList();
        });