From e705ef7b15c04307d6f37b388564dedfaeef4a55 Mon Sep 17 00:00:00 2001
From: 张诺 <zhang_12370@163.com>
Date: 星期二, 21 四月 2026 15:27:09 +0800
Subject: [PATCH] 阳光彩印web 生产报工的机台展示
---
src/views/personnelManagement/employeeRecord/index.vue | 197 +++++++++++++++++++++++++++++++++++++------------
1 files changed, 149 insertions(+), 48 deletions(-)
diff --git a/src/views/personnelManagement/employeeRecord/index.vue b/src/views/personnelManagement/employeeRecord/index.vue
index f1e04db..c88336a 100644
--- a/src/views/personnelManagement/employeeRecord/index.vue
+++ b/src/views/personnelManagement/employeeRecord/index.vue
@@ -11,14 +11,17 @@
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>-->
+ <el-button type="primary" @click="openFormNewOrEditFormDia('add')">鏂板鍏ヨ亴</el-button>
<el-button @click="handleOut">瀵煎嚭</el-button>
-<!-- <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>-->
+ <!-- <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button> -->
</div>
</div>
<div class="table_list">
@@ -32,25 +35,41 @@
:tableLoading="tableLoading"
@pagination="pagination"
:total="page.total"
+ :rowClassName="rowClassName"
></PIMTable>
</div>
- <form-dia ref="formDia" @close="handleQuery"></form-dia>
+ <show-form-dia ref="formDia" @close="handleQuery"></show-form-dia>
+ <new-or-edit-form-dia ref="formDiaNewOrEditFormDia" @close="handleQuery"></new-or-edit-form-dia>
+ <renew-contract
+ v-if="isShowRenewContractModal"
+ v-model:visible="isShowRenewContractModal"
+ :id="id"
+ @completed="handleQuery"
+ />
</div>
</template>
<script setup>
import { Search } from "@element-plus/icons-vue";
import {onMounted, ref} from "vue";
-import FormDia from "@/views/personnelManagement/employeeRecord/components/formDia.vue";
import {ElMessageBox} from "element-plus";
-import {staffOnJobListPage} from "@/api/personnelManagement/employeeRecord.js";
+import {batchDeleteStaffOnJobs, staffOnJobListPage} from "@/api/personnelManagement/staffOnJob.js";
+import dayjs from "dayjs";
+const NewOrEditFormDia = defineAsyncComponent(() => import("@/views/personnelManagement/employeeRecord/components/NewOrEditFormDia.vue"));
+const ShowFormDia = defineAsyncComponent(() => import( "@/views/personnelManagement/employeeRecord/components/Show.vue"));
+const RenewContract = defineAsyncComponent(() => import( "@/views/personnelManagement/employeeRecord/components/RenewContract.vue"));
const data = reactive({
searchForm: {
staffName: "",
+ entryDate: undefined, // 褰曞叆鏃ユ湡
+ entryDateStart: undefined,
+ entryDateEnd: undefined,
},
});
const { searchForm } = toRefs(data);
+const isShowRenewContractModal = ref(false);
+const id = ref(0);
const tableColumn = ref([
{
label: "鐘舵��",
@@ -84,77 +103,81 @@
prop: "staffName",
},
{
+ label: "鍒悕",
+ prop: "alias",
+ },
+ {
+ label: "鎵嬫満",
+ prop: "phone",
+ width: 150,
+ },
+ {
label: "鎬у埆",
prop: "sex",
},
{
- label: "绫嶈疮",
- prop: "nativePlace",
- },
- {
- label: "宀椾綅",
- prop: "postJob",
- },
- {
- label: "瀹跺涵浣忓潃",
- prop: "adress",
- },
- {
- label: "绗竴瀛﹀巻",
- prop: "firstStudy",
- },
- {
- label: "涓撲笟",
- prop: "profession",
- },
- {
- label: "韬唤璇佸彿",
- prop: "identityCard",
+ label: "鍑虹敓鏃ユ湡",
+ prop: "birthDate",
+ width: 120,
},
{
label: "骞撮緞",
prop: "age",
},
{
- label: "鑱旂郴鐢佃瘽",
- prop: "phone",
+ label: "绫嶈疮",
+ prop: "nativePlace",
},
{
- label: "绱ф�ヨ仈绯讳汉",
- prop: "emergencyContact",
- width: 120
+ label: "姘戞棌",
+ prop: "nation",
+ width: 100,
},
{
- label: "鑱旂郴鐢佃瘽",
- prop: "emergencyContactPhone",
+ label: "濠氬Щ鐘跺喌",
+ prop: "maritalStatus",
+ width: 100,
},
{
- label: "鍚堝悓骞撮檺",
- prop: "contractTerm",
+ label: "鍛樺伐閫氳鍦板潃",
+ prop: "contactAddress",
+ minWidth: 180,
},
- // {
- // label: "鍚堝悓寮�濮嬫棩鏈�",
- // prop: "contractStartTime",
- // width: 120
- // },
{
- label: "鍚堝悓缁撴潫鏃ユ湡",
+ label:"鍚堝悓鍒版湡鏃堕棿",
prop: "contractExpireTime",
- width: 120
+ minWidth: 120,
},
{
dataType: "action",
label: "鎿嶄綔",
align: "center",
fixed: 'right',
+ width: 180,
operation: [
{
- name: "璇︽儏",
+ name: "缂栬緫",
type: "text",
clickFun: (row) => {
- openForm("edit", row);
+ openFormNewOrEditFormDia("edit", row);
},
},
+ {
+ name: "缁鍚堝悓",
+ type: "text",
+ showHide: row => row.staffState === 1,
+ clickFun: (row) => {
+ isShowRenewContractModal.value = true;
+ id.value = row.id;
+ },
+ },
+ // {
+ // name: "璇︽儏",
+ // type: "text",
+ // clickFun: (row) => {
+ // openForm("edit", row);
+ // },
+ // },
],
},
]);
@@ -167,7 +190,44 @@
total: 0
});
const formDia = ref()
+const formDiaNewOrEditFormDia = ref()
const { proxy } = getCurrentInstance()
+
+const changeDaterange = (value) => {
+ searchForm.value.entryDateStart = undefined;
+ searchForm.value.entryDateEnd = undefined;
+ if (value) {
+ searchForm.value.entryDateStart = dayjs(value[0]).format("YYYY-MM-DD");
+ searchForm.value.entryDateEnd = dayjs(value[1]).format("YYYY-MM-DD");
+ }
+ getList();
+};
+
+const rowClassName = ({ row }) => {
+ const dateStr = row.contractExpireTime;
+
+ if (!dateStr) return '';
+
+ const now = new Date();
+ const target = new Date(dateStr.replace(/-/g, '/')); // 鍏煎 Safari
+
+ // 褰掗浂鏃堕棿锛堝叧閿紒锛�
+ now.setHours(0, 0, 0, 0);
+ target.setHours(0, 0, 0, 0);
+
+ const days = Math.ceil((target - now) / (1000 * 60 * 60 * 24));
+
+ console.log('鍓╀綑澶╂暟:', days);
+
+ // 瓒呰繃45澶╋細姝e父
+ if (days > 45) return '';
+
+ // 0~45澶╋細棰勮锛堜綘鍙互鎹㈤鑹诧級
+ if (days >= 0) return 'bg-warning';
+
+ // 宸茶繃鏈�
+ return 'bg-danger';
+};
// 鏌ヨ鍒楄〃
/** 鎼滅储鎸夐挳鎿嶄綔 */
@@ -182,7 +242,9 @@
};
const getList = () => {
tableLoading.value = true;
- staffOnJobListPage({...page, ...searchForm.value, staffState: 1}).then(res => {
+ const params = { ...searchForm.value, ...page };
+ params.entryDate = undefined
+ staffOnJobListPage({...params}).then(res => {
tableLoading.value = false;
tableData.value = res.data.records
page.total = res.data.total;
@@ -201,6 +263,37 @@
formDia.value?.openDialog(type, row)
})
};
+const openFormNewOrEditFormDia = (type, row) => {
+ nextTick(() => {
+ formDiaNewOrEditFormDia.value?.openDialog(type, row)
+ })
+};
+
+// 鍒犻櫎
+const handleDelete = () => {
+ let ids = [];
+ if (selectedRows.value.length > 0) {
+ ids = selectedRows.value.map((item) => item.id);
+ } else {
+ proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
+ return;
+ }
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ batchDeleteStaffOnJobs(ids).then((res) => {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ getList();
+ });
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+};
+
// 瀵煎嚭
const handleOut = () => {
ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
@@ -209,7 +302,7 @@
type: "warning",
})
.then(() => {
- proxy.download("/staff/staffOnJob/export", {staffState: 1}, "鍦ㄨ亴鍛樺伐鍙拌处.xlsx");
+ proxy.download("/staff/staffOnJob/export", {staffState: 1}, "鍛樺伐鍙拌处.xlsx");
})
.catch(() => {
proxy.$modal.msg("宸插彇娑�");
@@ -220,4 +313,12 @@
});
</script>
-<style scoped></style>
+<style scoped>
+:deep(.el-table .bg-warning > td.el-table__cell) {
+ background-color: #fdf2e3;
+}
+
+:deep(.el-table .bg-danger > td.el-table__cell) {
+ background-color: #ffe5e5;
+}
+</style>
--
Gitblit v1.9.3