diff --git a/src/api/construction-person/attendance-manage/attendance-count.js b/src/api/construction-person/attendance-manage/attendance-count.js index 753ac59..1a944b4 100644 --- a/src/api/construction-person/attendance-manage/attendance-count.js +++ b/src/api/construction-person/attendance-manage/attendance-count.js @@ -27,7 +27,7 @@ export const getSubTeamListAPI = (data) => { // 获取7天未打卡列表 export const getSevenDaysNoAttendanceListAPI = (data) => { return request({ - url: '/bmw/pmAttDevice/list', + url: '/bmw/workerLight/getSevenNotAttListByTeam', method: 'GET', params: data, }) diff --git a/src/api/construction-person/red-green-light-mange/dishonesty-person.js b/src/api/construction-person/red-green-light-mange/dishonesty-person.js index b927e52..77a0157 100644 --- a/src/api/construction-person/red-green-light-mange/dishonesty-person.js +++ b/src/api/construction-person/red-green-light-mange/dishonesty-person.js @@ -1,4 +1,5 @@ import request from '@/utils/request' +import requestFormData from '@/utils/request_formdata' // 红绿灯统计 失信人员列表查询接口 export const getDishonestyPersonListAPI = (data) => { @@ -24,3 +25,20 @@ export const removeDishonestyPersonAPI = (id) => { method: 'POST', }) } + +// 红绿灯统计 导入失信人员 +export const importDishonestyPersonAPI = (data) => { + return requestFormData({ + url: '/bmw/workerBlack/workerBlackImport', + method: 'POST', + data, + }) +} + +// 红绿灯统计 下载模板 +export const downloadDishonestyPersonTemplateAPI = () => { + return request({ + url: '/bmw/download/workerEinTemplate', + method: 'GET', + }) +} diff --git a/src/components/TableModel/index.vue b/src/components/TableModel/index.vue index 8fe4dc1..414928c 100644 --- a/src/components/TableModel/index.vue +++ b/src/components/TableModel/index.vue @@ -84,6 +84,7 @@ v-if="item.f_type === 'dateRange'" v-model="queryParams[item.f_model]" @change="onChangeTime($event, item.dateType)" + :picker-options="pickerOptions" /> [], }, + // 是否显示当天日期 + isCurrentDate: { + type: Boolean, + default: false, + }, + // 是否只可选择一个月的范围 + isOneMonth: { + type: Boolean, + default: false, + }, }, computed: { /* 根据操作栏控制表头是否显示 */ @@ -320,6 +331,9 @@ export default { idCount: 1, // 日期查询条件 字段名称 typeList: [], + + // 日期选择器配置 + pickerOptions: {}, } }, @@ -334,6 +348,26 @@ export default { this.$set(this.queryParams, e.dateType[0], '') this.$set(this.queryParams, e.dateType[1], '') this.typeList = e.dateType + + if (this.isOneMonth) { + this.pickerOptions = { + disabledDate: (time) => { + // 禁用今天之后的日期 + return time.getTime() > Date.now() + }, + onPick: ({ maxDate, minDate }) => { + // 当选择第一个日期后,设置第二个日期的可选范围 + this.pickerOptions.minDate = minDate + if (minDate) { + const maxRangeDate = new Date(minDate) + maxRangeDate.setMonth(minDate.getMonth() + 1) + this.pickerOptions.maxDate = maxRangeDate + } else { + this.pickerOptions.maxDate = null + } + }, + } + } } else { this.$set(this.queryParams, e.f_model, '') } @@ -393,15 +427,27 @@ export default { resetQuery() { this.$refs.queryFormRef.resetFields() if (this.typeList.length > 1) { - this.queryParams[this.typeList[0]] = '' - this.queryParams[this.typeList[1]] = '' - this.queryParams.time = [] + if (this.isCurrentDate) { + this.queryParams[this.typeList[0]] = new Date() + .toISOString() + .split('T')[0] + this.queryParams[this.typeList[1]] = new Date() + .toISOString() + .split('T')[0] + this.queryParams.time = [ + new Date().toISOString().split('T')[0], + new Date().toISOString().split('T')[0], + ] + } else { + this.queryParams[this.typeList[0]] = '' + this.queryParams[this.typeList[1]] = '' + this.queryParams.time = [] + } } else { this.queryParams[this.typeList[0]] = '' } this.queryParams.pageNum = 1 this.queryParams.pageSize = 10 - this.queryParams.time = [] this.getTableList() }, /** 级联选择 */ @@ -475,12 +521,34 @@ export default { /* 时间change事件 */ onChangeTime(e, type) { - console.log(e, '时间', type) - const [_1, _2] = type - const [_time1, _time2] = e - if (e.length > 0) { - this.queryParams[_1] = _time1 - this.queryParams[_2] = _time2 + if (this.isOneMonth) { + if (e && e.length === 2) { + const [start, end] = e + const startDate = new Date(start) + const endDate = new Date(end) + // 计算两个日期之间的天数差 + const diffTime = Math.abs(endDate - startDate) + const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)) + // 如果超过31天,自动调整结束日期 + if (diffDays > 31) { + const newEndDate = new Date(startDate) + newEndDate.setDate(startDate.getDate() + 31) + this.queryParams.time = [ + start, + newEndDate.toISOString().split('T')[0], + ] + this.$message.warning( + '选择的时间范围超过31天,查询将会缓慢,已自动调整', + ) + } + } + } else { + const [_1, _2] = type + const [_time1, _time2] = e + if (e.length > 0) { + this.queryParams[_1] = _time1 + this.queryParams[_2] = _time2 + } } }, }, diff --git a/src/views/construction-person/attendance-manage/attendance-count/attendance-details.vue b/src/views/construction-person/attendance-manage/attendance-count/attendance-details.vue index 89870c1..eb4a23d 100644 --- a/src/views/construction-person/attendance-manage/attendance-count/attendance-details.vue +++ b/src/views/construction-person/attendance-manage/attendance-count/attendance-details.vue @@ -199,7 +199,19 @@ export default { this.getAttendanceDetailsListData() }, // 导出 - onHandleExportAttendanceDetails() {}, + onHandleExportAttendanceDetails() { + this.download( + '/bmw/workerLight/attExportByWorkerMsg', + { + teamId: this.teamId, + proId: this.proId, + idNumber: this.idNumber, + startDate: this.timeRange[0], + endDate: this.timeRange[1], + }, + '考勤详情.xlsx', + ) + }, // 获取考勤详情列表 async getAttendanceDetailsListData() { diff --git a/src/views/construction-person/attendance-manage/attendance-count/config.js b/src/views/construction-person/attendance-manage/attendance-count/config.js index 7d69763..69cdaf2 100644 --- a/src/views/construction-person/attendance-manage/attendance-count/config.js +++ b/src/views/construction-person/attendance-manage/attendance-count/config.js @@ -9,13 +9,13 @@ export const formLabel = [ export const columnsList = [ { t_label: '分公司', t_slot: 'subComName' }, - { t_props: 'buildProNum', t_label: '在建工程数量' }, - { t_props: 'completedProNum', t_label: '完工工程数量' }, - { t_props: 'preProNum', t_label: '筹建工程数量' }, - { t_props: 'subNum', t_label: '分包数量' }, - { t_props: 'teamNum', t_label: '班组数量' }, - { t_props: 'einNum', t_label: '在场人数' }, - { t_props: 'attNum', t_label: '考勤人数' }, + { t_slot: 'buildProNum', t_label: '在建工程数量' }, + { t_slot: 'completedProNum', t_label: '完工工程数量' }, + { t_slot: 'preProNum', t_label: '筹建工程数量' }, + { t_slot: 'subNum', t_label: '分包数量' }, + { t_slot: 'teamNum', t_label: '班组数量' }, + { t_slot: 'einNum', t_label: '在场人数' }, + { t_slot: 'attNum', t_label: '考勤人数' }, ] export const dialogConfig = { @@ -39,16 +39,7 @@ export const projectFormLabel = [ f_model: 'proStatus', f_type: 'sel', isShow: false, // 是否展示label - f_selList: [ - { - label: '在建', - value: 1, - }, - { - label: '完工', - value: 2, - }, - ], + f_selList: [], }, { f_label: '日期', @@ -60,11 +51,11 @@ export const projectFormLabel = [ export const projectColumnsList = [ { t_slot: 'proName', t_label: '工程名称' }, - { t_props: 'orgName', t_label: '工程状态' }, - { t_props: 'subNum', t_label: '分包数量' }, + { t_slot: 'proStatus', t_label: '工程状态' }, + { t_slot: 'subNum', t_label: '分包数量' }, { t_slot: 'teamNum', t_label: '班组数量' }, - { t_props: 'einNum', t_label: '在场人数' }, - { t_props: 'attNum', t_label: '考勤人数' }, + { t_slot: 'einNum', t_label: '在场人数' }, + { t_slot: 'attNum', t_label: '考勤人数' }, ] export const projectDialogConfig = { @@ -99,14 +90,14 @@ export const subTeamFormLabel = [ export const subTeamColumnsList = [ { t_props: 'proName', t_label: '工程名称' }, - { t_props: 'orgName', t_label: '分包名称' }, + { t_props: 'subName', t_label: '分包名称' }, { t_slot: 'teamName', t_label: '班组名称' }, - { t_slot: 'proType', t_label: '班组状态' }, - { t_props: 'einNum', t_label: '在场人数' }, - { t_props: 'attNum', t_label: '考勤人数' }, + { t_slot: 'teamEinStatus', t_label: '班组状态' }, + { t_slot: 'einNum', t_label: '在场人数' }, + { t_slot: 'attNum', t_label: '考勤人数' }, { t_label: '连续七天未打卡', - t_slot: 'noAttendance', + t_slot: 'sevenNotAttNum', }, ] @@ -129,8 +120,12 @@ export const personFormLabel = [ { f_label: '状态', f_model: 'status', - f_type: 'ipt', + f_type: 'sel', isShow: false, // 是否展示label + f_selList: [ + { value: 1, label: '正常' }, + { value: 2, label: '异常' }, + ], }, { f_label: '日期', @@ -147,9 +142,9 @@ export const personColumnsList = [ { t_props: 'phone', t_label: '联系方式' }, { t_props: 'postName', t_label: '工种' }, { t_props: 'subName', t_label: '所属分包' }, - { t_props: 'attDay', t_label: '考勤天数' }, + { t_slot: 'attDay', t_label: '考勤天数' }, { - t_props: 'notAttNum', + t_slot: 'notAttNum', t_label: '缺勤天数', }, ] diff --git a/src/views/construction-person/attendance-manage/attendance-count/index.vue b/src/views/construction-person/attendance-manage/attendance-count/index.vue index 9ed81fc..a626e1f 100644 --- a/src/views/construction-person/attendance-manage/attendance-count/index.vue +++ b/src/views/construction-person/attendance-manage/attendance-count/index.vue @@ -16,6 +16,10 @@ {{ data.subComName }} + + + + + + + + + + + + + item.value == status, + ) + if (res && res.label) { + return res.label || '' + } + return '' + } + + return status || '' + }, + + // 初始化工程状态标签 + initType(data) { + if (typeof data === 'string') { + const res = this.dict.type.project_status.find( + (item) => item.value == data, + ) + + if (res && res.raw) { + return res.raw.listClass || 'primary' + } + return 'primary' || '' + } + + return 'primary' || '' + }, + }, + + created() { + projectFormLabel.forEach((item) => { + if (item.f_model === 'proStatus') { + item.f_selList = this.dict.type.project_status + } + }) }, } diff --git a/src/views/construction-person/attendance-manage/attendance-count/sub-team-table.vue b/src/views/construction-person/attendance-manage/attendance-count/sub-team-table.vue index 7f55dea..f6ccfe4 100644 --- a/src/views/construction-person/attendance-manage/attendance-count/sub-team-table.vue +++ b/src/views/construction-person/attendance-manage/attendance-count/sub-team-table.vue @@ -2,9 +2,9 @@
+ + + + + + + + -
@@ -252,6 +298,8 @@