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

359 lines
14 KiB
Vue
Raw Normal View History

2023-09-24 18:35:52 +08:00
<template>
<div class="app-container">
2024-03-23 18:32:18 +08:00
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="82px">
2023-09-26 00:01:20 +08:00
<el-form-item label="项目名称" prop="projectId">
2023-09-29 00:24:15 +08:00
<el-select :disabled="prjDisabled" v-model="queryParams.projectId" placeholder="请选择项目" clearable @change="doQuerySub()">
2023-09-26 00:01:20 +08:00
<el-option v-for="(item, index) in projectOptions" :key="index" :label="item.projectName" :value="item.id">
</el-option>
</el-select>
2023-09-24 18:35:52 +08:00
</el-form-item>
2024-03-23 18:32:18 +08:00
<el-form-item label="总包单位" prop="deptId">
<el-select v-model="queryParams.deptId" placeholder="请选择总包单位" clearable>
2023-09-26 00:01:20 +08:00
<el-option v-for="(item, index) in depts" :key="index" :label="item.deptName" :value="item.deptId">
</el-option>
</el-select>
2023-09-24 18:35:52 +08:00
</el-form-item>
2024-03-23 18:32:18 +08:00
<el-form-item label="分包商类型" prop="companyTypeId">
<el-select v-model="queryParams.companyTypeId" placeholder="请选择分包商类型" clearable>
<el-option value="0" 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>
2023-09-26 00:01:20 +08:00
<el-form-item label="日期" prop="createBy">
2024-03-23 00:57:06 +08:00
<el-date-picker v-model="queryParams.attendanceTime" type="date" placeholder="选择日期">
2023-09-26 00:01:20 +08:00
</el-date-picker>
2023-09-24 18:35:52 +08:00
</el-form-item>
<el-form-item>
<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>
2023-09-29 00:24:15 +08:00
<el-button type="warning" plain icon="el-icon-setting" size="mini" @click="handleSetting" v-if="!prjDisabled"
2023-09-26 00:01:20 +08:00
v-hasPermi="['project:attendanceConfig:edit']">设置</el-button>
2023-09-24 18:35:52 +08:00
</el-form-item>
</el-form>
2023-09-26 00:01:20 +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:attendance: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:attendance: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:attendance: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:attendance: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="attendanceList" @selection-change="handleSelectionChange">
2023-09-29 00:24:15 +08:00
2023-09-26 00:01:20 +08:00
<el-table-column label="照片" align="center" prop="id">
<template slot-scope="{row}">
2024-03-23 18:32:18 +08:00
<el-image :src="row.scanPhoto||row.workerPhoto" :preview-src-list="[row.scanPhoto||row.workerPhoto]" style="height:60px"/>
2023-09-26 00:01:20 +08:00
</template>
</el-table-column>
2024-03-23 01:27:13 +08:00
<el-table-column label="姓名" align="center" prop="workerName" />
2023-09-26 00:01:20 +08:00
<el-table-column label="籍贯" align="center" prop="nativePlace" />
<el-table-column label="性别" align="center" prop="attendanceType" >
2024-03-23 01:33:04 +08:00
<template slot-scope="{row}">{{ row.workerGender==1?'女':'男' }}</template>
2023-09-26 00:01:20 +08:00
</el-table-column>
<el-table-column label="进场时间" align="center" prop="inTime">
2024-03-23 01:27:13 +08:00
<template slot-scope="{row}">{{ row.attendanceTime|formatTime }}</template>
2023-09-26 00:01:20 +08:00
</el-table-column>
<el-table-column label="离场时间" align="center" prop="outTime">
2024-03-23 01:27:13 +08:00
<template slot-scope="{row}">{{ row.attendanceOutTime|formatTime }}</template>
</el-table-column>
2023-09-26 00:01:20 +08:00
<el-table-column label="分包商名称" align="center" prop="companyName" />
<el-table-column label="所属班组" align="center" prop="groupName" />
<el-table-column label="工种" align="center" prop="workTypeName" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" v-if="1==2">
2023-09-24 18:35:52 +08:00
<template slot-scope="scope">
2023-09-26 00:01:20 +08:00
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['project:attendance:edit']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['project:attendance:remove']">删除</el-button>
2023-09-24 18:35:52 +08:00
</template>
</el-table-column>
</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-01-16 21:39:51 +08:00
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body :close-on-click-modal="false" :close-on-press-escape="false">
2023-09-24 18:35:52 +08:00
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="厂商编号参考字典attendance_vendors" prop="vendorsCode">
<el-input v-model="form.vendorsCode" placeholder="请输入厂商编号参考字典attendance_vendors" />
</el-form-item>
<el-form-item label="工人Id" prop="workerId">
<el-input v-model="form.workerId" placeholder="请输入工人Id" />
</el-form-item>
<el-form-item label="考勤时间yyyy-MM-dd HH:mm:ss" prop="attendanceTime">
<el-input v-model="form.attendanceTime" placeholder="请输入考勤时间yyyy-MM-dd HH:mm:ss" />
</el-form-item>
<el-form-item label="设备编号" prop="deviceCode">
<el-input v-model="form.deviceCode" placeholder="请输入设备编号" />
</el-form-item>
<el-form-item label="作业面Id" prop="workPointId">
<el-input v-model="form.workPointId" placeholder="请输入作业面Id" />
</el-form-item>
<el-form-item label="服务返回的JSON" prop="other">
<el-input v-model="form.other" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="${comment}" prop="state">
<el-input v-model="form.state" placeholder="请输入${comment}" />
</el-form-item>
<el-form-item label="${comment}" prop="remark">
<el-input v-model="form.remark" placeholder="请输入${comment}" />
</el-form-item>
<el-form-item label="${comment}" prop="isDel">
<el-input v-model="form.isDel" placeholder="请输入${comment}" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
2023-09-26 00:01:20 +08:00
<attConfigDrawer ref="attDrawer"></attConfigDrawer>
2023-09-24 18:35:52 +08:00
</div>
</template>
<script>
import { listAttendance, getAttendance, delAttendance, addAttendance, updateAttendance } from "@/api/project/attendance";
2023-09-26 00:01:20 +08:00
import { listAttendanceWorker, getAttendanceWorker, delAttendanceWorker, addAttendanceWorker, updateAttendanceWorker, queryAttendanceData } from "@/api/project/attendanceWorker";
2024-03-23 22:51:05 +08:00
import {listAttendanceConfig} from '@/api/project/attendanceConfig.js'
2023-09-26 00:01:20 +08:00
import attConfigDrawer from '../attendanceConfig/attendanceConfigDrawer.vue'
2023-09-24 18:35:52 +08:00
export default {
name: "Attendance",
2023-09-26 00:01:20 +08:00
components: {
attConfigDrawer,
},
2023-09-24 18:35:52 +08:00
data() {
return {
// 遮罩层
2023-09-26 00:01:20 +08:00
loading: false,
2023-09-24 18:35:52 +08:00
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 劳务实名制管理表格数据
attendanceList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
2024-01-13 00:03:25 +08:00
vendorsCode:'huazhu',
2023-09-24 18:35:52 +08:00
pageNum: 1,
pageSize: 10,
2023-09-26 00:01:20 +08:00
projectId:null,
2024-03-23 18:32:18 +08:00
deptId:null,
companyTypeId:"0",
2024-03-23 00:57:06 +08:00
attendanceTime:new Date()
2023-09-24 18:35:52 +08:00
},
// 表单参数
form: {},
// 表单校验
rules: {
2023-09-26 00:01:20 +08:00
},
projectOptions: [],
2023-09-29 00:24:15 +08:00
depts: [],
prjDisabled:false,
2024-03-23 22:51:05 +08:00
cfgList:[],
2023-09-24 18:35:52 +08:00
};
},
2023-09-29 00:24:15 +08:00
created() {
2023-09-26 00:01:20 +08:00
this.$api.publics.getMyProjectList({}).then((response) => {
2023-09-29 00:24:15 +08:00
this.projectOptions = response.rows;
});
2024-03-23 22:51:05 +08:00
listAttendanceConfig({}).then(d=>{
this.cfgList=d.rows||[];
});
2023-09-24 18:35:52 +08:00
},
methods: {
2023-09-29 00:24:15 +08:00
init(prj){
this.queryParams.projectId=prj.id;
this.prjDisabled=true;
this.doQuerySub(true);
},
doQuerySub(init) {
2023-09-26 00:01:20 +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) {
2024-03-23 18:32:18 +08:00
this.queryParams.deptId = tmps[0].deptId;
2023-09-26 00:01:20 +08:00
} else {
2024-03-23 18:32:18 +08:00
this.queryParams.deptId = '';
2023-09-26 00:01:20 +08:00
}
2023-09-29 00:24:15 +08:00
if(init){
this.getList();
}
2023-09-26 00:01:20 +08:00
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) {
2024-03-23 18:32:18 +08:00
this.queryParams.deptId = objs[0].deptId;
2023-09-26 00:01:20 +08:00
} else {
2024-03-23 18:32:18 +08:00
this.queryParams.deptId = '';
2023-09-26 00:01:20 +08:00
}
2023-09-29 00:24:15 +08:00
if(init){
this.getList();
}
2023-09-26 00:01:20 +08:00
});
},
handleSetting() {
this.$refs.attDrawer.show();
},
2023-09-24 18:35:52 +08:00
/** 查询劳务实名制管理列表 */
2024-03-23 01:27:13 +08:00
getList() {
2023-09-26 00:01:20 +08:00
this.loading = true;
2024-03-23 01:27:13 +08:00
let postData={};
postData.attendanceTime=this.$dt(this.queryParams.attendanceTime).format("YYYY-MM-DD");
2024-03-23 22:51:05 +08:00
let tmps=this.cfgList.filter(d=>d.projectId==this.queryParams.projectId && d.subDeptId==this.queryParams.deptId);
if(tmps.length>0){
postData.cfgid=tmps[0].id;
}else{
postData.projectId=this.queryParams.projectId;
postData.deptId=this.queryParams.deptId;
}
2024-03-23 09:30:31 +08:00
postData.pageNum=this.queryParams.pageNum;
postData.pageSize=this.queryParams.pageSize;
2024-03-23 18:32:18 +08:00
if(this.queryParams.companyTypeId && this.queryParams.companyTypeId>0){
postData.companyTypeId=this.queryParams.companyTypeId;
}
listAttendance(postData).then(response=>{
this.attendanceList = (response.rows||[]).map(it=>{
2024-03-23 22:51:05 +08:00
it.scanPhoto=it.scanPhoto && it.scanPhoto.indexOf("/profile")==0?"/jhapi"+it.scanPhoto:it.scanPhoto;
2024-03-23 18:32:18 +08:00
return it;
});
2023-09-24 18:35:52 +08:00
this.total = response.total;
this.loading = false;
2023-09-26 00:01:20 +08:00
})
2023-09-24 18:35:52 +08:00
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
vendorsCode: null,
workerId: null,
attendanceType: null,
attendanceTime: null,
deviceCode: null,
workPointId: null,
other: null,
state: null,
remark: null,
isDel: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
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.reset();
this.open = true;
this.title = "添加劳务实名制管理";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getAttendance(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改劳务实名制管理";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateAttendance(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addAttendance(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
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 delAttendance(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/attendance/export', {
...this.queryParams
}, `attendance_${new Date().getTime()}.xlsx`)
}
}
};
</script>