jhprjv2/ruoyi-ui/src/views/project/attendanceWorker/index.vue

259 lines
9.5 KiB
Vue
Raw Normal View History

2023-09-24 18:35:52 +08:00
<template>
<div class="app-container">
2024-04-14 23:32:00 +08:00
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px"
2024-04-09 22:22:23 +08:00
style="position: relative;">
2023-09-29 00:24:15 +08:00
<el-form-item label="项目名称" prop="projectId">
2024-04-09 22:22:23 +08:00
<el-select :disabled="prjDisabled" v-model="queryParams.projectId" placeholder="请选择项目" clearable
@change="doQuerySub()">
2023-09-29 00:24:15 +08:00
<el-option v-for="(item, index) in projectOptions" :key="index" :label="item.projectName" :value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="总包单位" prop="subDeptId">
<el-select v-model="queryParams.subDeptId" placeholder="请选择总包单位" clearable>
<el-option v-for="(item, index) in depts" :key="index" :label="item.deptName" :value="item.deptId">
</el-option>
</el-select>
</el-form-item>
2024-05-13 22:13:20 +08:00
<el-form-item label="分包单位类型" prop="companyTypeId">
<el-select v-model="queryParams.companyTypeId" placeholder="请选择分包单位类型" clearable style="width: 100px;">
2024-04-09 22:22:23 +08:00
<el-option value="" label="所有"></el-option>
<el-option value="101" label="总包人员"></el-option>
<el-option value="102" label="监理人员"></el-option>
<el-option value="103" label="劳务人员"></el-option>
</el-select>
</el-form-item>
2024-04-11 00:18:16 +08:00
<el-form-item label="姓名" prop="name">
2024-04-14 23:32:00 +08:00
<el-input v-model="queryParams.name" placeholder="请输入姓名" style="width: 120px;"></el-input>
2024-04-11 00:18:16 +08:00
</el-form-item>
2023-09-29 00:24:15 +08:00
<el-form-item label="" prop="state">
<el-radio-group v-model="queryParams.state" size="mini">
2024-04-09 22:22:23 +08:00
<el-radio-button label="">全部人员</el-radio-button>
<el-radio-button label="0">在岗</el-radio-button>
<el-radio-button label="1">已退场</el-radio-button>
</el-radio-group>
2023-09-26 00:01:20 +08:00
</el-form-item>
2023-09-29 00:24:15 +08:00
2024-04-09 22:22:23 +08:00
<el-form-item style="position: absolute;right:0px;">
2023-09-24 18:35:52 +08:00
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
2024-06-11 23:54:41 +08:00
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
v-hasPermi="['project:attendanceWorker:export']">导出</el-button>
2023-09-24 18:35:52 +08:00
</el-form-item>
</el-form>
2024-04-09 22:22:23 +08:00
<el-row :gutter="10" class="mb8" v-if="1 == 2">
2023-09-24 18:35:52 +08:00
<el-col :span="1.5">
2023-09-26 00:01:20 +08:00
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['project:attendanceWorker:add']">新增</el-button>
2023-09-24 18:35:52 +08:00
</el-col>
<el-col :span="1.5">
2023-09-26 00:01:20 +08:00
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
v-hasPermi="['project:attendanceWorker:edit']">修改</el-button>
2023-09-24 18:35:52 +08:00
</el-col>
<el-col :span="1.5">
2023-09-26 00:01:20 +08:00
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
v-hasPermi="['project:attendanceWorker:remove']">删除</el-button>
2023-09-24 18:35:52 +08:00
</el-col>
<el-col :span="1.5">
2023-09-26 00:01:20 +08:00
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
v-hasPermi="['project:attendanceWorker:export']">导出</el-button>
2023-09-24 18:35:52 +08:00
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="attendanceWorkerList" @selection-change="handleSelectionChange">
2024-04-09 22:22:23 +08:00
2023-09-29 00:24:15 +08:00
<el-table-column label="照片" align="center" prop="id">
<template slot-scope="{row}">
2024-04-09 22:22:23 +08:00
<el-image :src="row.recentPhoto" :preview-src-list="[row.recentPhoto]" style="height:60px" />
2023-09-29 00:24:15 +08:00
</template>
</el-table-column>
2023-09-24 18:35:52 +08:00
<el-table-column label="姓名" align="center" prop="name" />
<el-table-column label="籍贯" align="center" prop="nativePlace" />
2024-04-09 22:22:23 +08:00
<el-table-column label="性别" align="center" prop="attendanceType">
<template slot-scope="{row}">{{ row.gender == 1 ? '女' : '男' }}</template>
2023-09-24 18:35:52 +08:00
</el-table-column>
2024-04-09 22:22:23 +08:00
<el-table-column label="进场时间" align="center" prop="inTime" v-if="1 == 2">
<template slot-scope="{row}">{{ row.enterDate | formatDate }}</template>
2023-09-29 00:24:15 +08:00
</el-table-column>
<el-table-column label="状态" align="center" prop="status">
2024-04-09 22:22:23 +08:00
<template slot-scope="{row}">{{ row.state == 1 ? '已退场' : '进场' }}</template>
</el-table-column>
2024-05-13 22:13:20 +08:00
<el-table-column label="分包单位名称" align="center" prop="companyName">
2024-04-09 22:22:23 +08:00
<template slot-scope="{row}">{{ row.companyName || row.remark }}</template>
2023-09-29 00:24:15 +08:00
</el-table-column>
<el-table-column label="所属班组" align="center" prop="groupName" />
<el-table-column label="岗位/工种" align="center" prop="workTypeName" />
2023-09-24 18:35:52 +08:00
</el-table>
2023-09-26 00:01:20 +08:00
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
@pagination="getList" />
2023-09-24 18:35:52 +08:00
2024-04-09 22:22:23 +08:00
2023-09-24 18:35:52 +08:00
</div>
</template>
<script>
2024-04-14 23:25:20 +08:00
import { queryAttendanceWorker, listJgwAttendanceWorker, getAttendanceWorker, delAttendanceWorker, addAttendanceWorker, updateAttendanceWorker, queryAttendanceData } from "@/api/project/attendanceWorker";
2023-09-24 18:35:52 +08:00
export default {
name: "AttendanceWorker",
data() {
return {
// 遮罩层
2023-09-29 00:24:15 +08:00
loading: false,
2023-09-24 18:35:52 +08:00
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 考勤人员基本属性表格数据
attendanceWorkerList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
2024-04-09 22:22:23 +08:00
companyTypeId:"",
2023-09-24 18:35:52 +08:00
pageNum: 1,
pageSize: 10,
2024-04-09 22:22:23 +08:00
projectId: null,
subDeptId: null,
2024-04-11 00:18:16 +08:00
name:null,
2024-04-09 22:22:23 +08:00
state: '',
2023-09-24 18:35:52 +08:00
},
// 表单参数
form: {},
// 表单校验
2024-04-09 22:22:23 +08:00
rules: {
2023-09-29 00:24:15 +08:00
},
projectOptions: [],
depts: [],
2024-04-09 22:22:23 +08:00
prjDisabled: false,
cfgList: [],
2023-09-24 18:35:52 +08:00
};
},
created() {
2023-09-29 00:24:15 +08:00
this.$api.publics.getMyProjectList({}).then((response) => {
this.projectOptions = response.rows;
2024-04-09 22:22:23 +08:00
});
2024-04-19 22:07:42 +08:00
this.$api.publics.findAttendanceCfgList({}).then((response) => {
this.cfgList = response.data||[];
});
2023-09-24 18:35:52 +08:00
},
methods: {
2024-04-09 22:22:23 +08:00
initMe(prj) {
this.queryParams.projectId = prj.id;
this.prjDisabled = true;
2023-09-29 00:24:15 +08:00
this.doQuerySub(true);
},
doQuerySub(init) {
2024-04-09 22:22:23 +08:00
this.queryParams.state = "";
2023-09-29 00:24:15 +08:00
let tmps = this.prjDept2 && this.prjDept2[this.queryParams.projectId] ? this.prjDept2[this.queryParams.projectId] || [] : [];
if (tmps.length > 0) {
this.depts = tmps;
if (tmps.length == 1) {
this.queryParams.subDeptId = tmps[0].deptId;
} else {
this.queryParams.subDeptId = '';
}
2024-04-09 22:22:23 +08:00
if (init) {
2023-09-29 00:24:15 +08:00
this.getList();
}
return;
}
this.$api.publics.queryUnitList({
projectId: this.queryParams.projectId,
unitTypes: "2".split(","),
}).then((d) => {
let objs = d.rows || [];
if (!this.prjDept2) {
this.prjDept2 = {};
}
this.prjDept2[this.queryParams.projectId] = objs;
this.depts = objs;
if (objs.length == 1) {
this.queryParams.subDeptId = objs[0].deptId;
} else {
this.queryParams.subDeptId = '';
}
2024-04-09 22:22:23 +08:00
if (init) {
2023-09-29 00:24:15 +08:00
this.getList();
}
});
},
2023-09-24 18:35:52 +08:00
/** 查询考勤人员基本属性列表 */
2024-04-11 00:26:45 +08:00
getList() {
2023-09-24 18:35:52 +08:00
this.loading = true;
2024-04-09 22:22:23 +08:00
let tmps = this.cfgList.filter(d => d.projectId == this.queryParams.projectId && d.subDeptId == this.queryParams.subDeptId);
2024-04-14 23:25:20 +08:00
let ajax = queryAttendanceWorker;
2024-04-09 22:22:23 +08:00
if (tmps.length > 0 && tmps[0].vendorsCode == 'jgw') {
2024-04-11 00:26:45 +08:00
ajax = listJgwAttendanceWorker;
2024-04-09 22:22:23 +08:00
}
2024-04-11 00:26:45 +08:00
ajax(this.queryParams).then(response => {
2024-04-09 22:22:23 +08:00
this.attendanceWorkerList = (response.rows || []).map(it => {
it.enterDate = it.enterDate ? new Date(it.enterDate * 1) : null;
2023-09-29 00:24:15 +08:00
return it;
});
2023-09-24 18:35:52 +08:00
this.total = response.total;
this.loading = false;
});
},
2024-04-09 22:22:23 +08:00
2023-09-24 18:35:52 +08:00
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
2023-09-26 00:01:20 +08:00
this.single = selection.length !== 1
2023-09-24 18:35:52 +08:00
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.open = true;
this.title = "添加考勤人员基本属性";
},
/** 修改按钮操作 */
handleUpdate(row) {
const id = row.id || this.ids
getAttendanceWorker(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改考勤人员基本属性";
});
2024-04-09 22:22:23 +08:00
},
2023-09-24 18:35:52 +08:00
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
2023-09-26 00:01:20 +08:00
this.$modal.confirm('是否确认删除考勤人员基本属性编号为"' + ids + '"的数据项?').then(function () {
2023-09-24 18:35:52 +08:00
return delAttendanceWorker(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
2023-09-26 00:01:20 +08:00
}).catch(() => { });
2023-09-24 18:35:52 +08:00
},
/** 导出按钮操作 */
handleExport() {
this.download('project/attendanceWorker/export', {
...this.queryParams
}, `attendanceWorker_${new Date().getTime()}.xlsx`)
}
}
};
</script>