diff --git a/src/api/construction-person/attendance-manage/card-replacement-apply.js b/src/api/construction-person/attendance-manage/card-replacement-apply.js index 53f89f7..23de122 100644 --- a/src/api/construction-person/attendance-manage/card-replacement-apply.js +++ b/src/api/construction-person/attendance-manage/card-replacement-apply.js @@ -40,7 +40,7 @@ export const editCardReplacementApplyAPI = (data) => { // 删除补卡申请 export const deleteCardReplacementApplyAPI = (data) => { return request({ - url: '/bmw/pmAttDevice/delPmAttDevice', + url: '/bmw/cardApply/delRepairCardApply', method: 'POST', data, }) diff --git a/src/api/construction-person/attendance-manage/card-replacement-audit.js b/src/api/construction-person/attendance-manage/card-replacement-audit.js new file mode 100644 index 0000000..eb10e2e --- /dev/null +++ b/src/api/construction-person/attendance-manage/card-replacement-audit.js @@ -0,0 +1,28 @@ +import request from '@/utils/request' + +// 获取补卡审核列表 +export const getCardReplacementAuditListAPI = (data) => { + return request({ + url: '/bmw/cardApply/list', + method: 'GET', + params: data, + }) +} + +// 获取补卡审核详情 +export const getCardReplacementAuditDetailAPI = (data) => { + return request({ + url: '/bmw/cardApply/getRepairCardDetails', + method: 'GET', + params: data, + }) +} + +// 补卡审核接口 +export const cardReplacementAuditAPI = (data) => { + return request({ + url: '/bmw/cardApply/audit', + method: 'POST', + data, + }) +} diff --git a/src/components/DialogModel/index.vue b/src/components/DialogModel/index.vue index 12b42a5..4e2002f 100644 --- a/src/components/DialogModel/index.vue +++ b/src/components/DialogModel/index.vue @@ -25,8 +25,8 @@ :before-close="handleCloseInner" :visible.sync="dialogConfig.innerVisible" :style="{ - '--el-dialog-min-height': dialogConfig.minHeight, - '--el-dialog-max-height': dialogConfig.maxHeight, + '--el-dialog-min-height': dialogConfig.innerMinHeight, + '--el-dialog-max-height': dialogConfig.innerMaxHeight, }" > diff --git a/src/components/TableModel/index.vue b/src/components/TableModel/index.vue index aca6a45..bc69759 100644 --- a/src/components/TableModel/index.vue +++ b/src/components/TableModel/index.vue @@ -342,13 +342,18 @@ export default { if (e.f_type === 'dateRange') { this.$set(this.queryParams, e.dateType[0], '') this.$set(this.queryParams, e.dateType[1], '') + + console.log(e.dateType, 'e.dateType') + console.log(this.queryParams, 'this.queryParams') this.typeList = e.dateType } else { this.$set(this.queryParams, e.f_model, '') } }) if (this.sendParams !== null) { - Object.assign(this.queryParams, this.sendParams) + for (let key in this.sendParams) { + this.$set(this.queryParams, key, this.sendParams[key]) + } } this.getTableList() }, @@ -371,15 +376,17 @@ export default { } const params = { ...this.queryParams } - delete params.time + const queryParams = JSON.parse(JSON.stringify(params)) + console.log(this.queryParams, 'queryParams') + delete queryParams.time console.log( `%c🔍 列表查询入参 %c`, 'background: linear-gradient(90deg, #FF6B6B, #4ECDC4); color: white; padding: 5px 10px; border-radius: 5px; font-weight: bold;', '', - params, + queryParams, ) this.loading = true - const res = await this.requestApi(params) + const res = await this.requestApi(queryParams) if (res.code === 200) { this.tableList = res.rows this.total = res.total @@ -398,10 +405,10 @@ export default { /** 重置按钮 */ resetQuery() { this.$refs.queryFormRef.resetFields() - if (this.typeList.length > 0) { this.queryParams[this.typeList[0]] = '' this.queryParams[this.typeList[1]] = '' + this.queryParams.time = [] } else { this.queryParams[this.typeList] = '' } @@ -481,12 +488,12 @@ export default { /* 时间change事件 */ onChangeTime(e, type) { - // console.log(e, "时间", type); + console.log(e, '时间', type) const [_1, _2] = type const [_time1, _time2] = e if (e.length > 0) { - this.queryParams[_time1] = _1 - this.queryParams[_time2] = _2 + this.queryParams[_1] = _time1 + this.queryParams[_2] = _time2 } }, }, diff --git a/src/views/construction-person/attendance-manage/card-replacement-apply/add-apply-form.vue b/src/views/construction-person/attendance-manage/card-replacement-apply/add-apply-form.vue index b7b59e8..f7652cc 100644 --- a/src/views/construction-person/attendance-manage/card-replacement-apply/add-apply-form.vue +++ b/src/views/construction-person/attendance-manage/card-replacement-apply/add-apply-form.vue @@ -114,6 +114,7 @@ > + + { - const res = await deleteAttendanceMachineAPI({ - deviceCode: data.deviceCode, + const res = await deleteCardReplacementApplyAPI({ + id: data.id, }) if (res.code === 200) { this.$modal.msgSuccess('删除成功') - this.$refs.attendanceMachineTableRef.getTableList() // 更新列表 + this.$refs.cardReplacementApplyTableRef.getTableList() // 更新列表 } }) .catch(() => { @@ -213,26 +218,15 @@ export default { }) }, - // 确定按钮 - onHandleConfirm() { - console.log('确定') - }, - // 最终的确定按钮 async onHandleConfirmFinish() { - this.$refs.addApplyFormRef.onHandleConfirmFinishFun() - // try { - // await - // this.handleCloseDialogOuter() - // // this.$refs.attendanceMachineTableRef.getTableList() - // } catch (error) { - // // console.log('表单提交失败', error) - // } - }, - - // 关闭弹框 - handleCloseDialogOuter() { - this.dialogConfig.outerVisible = false + try { + await this.$refs.addApplyFormRef.onHandleConfirmFinishFun() + this.handleCloseDialogOuter() + this.$refs.cardReplacementApplyTableRef.getTableList() + } catch (error) { + // console.log('表单提交失败', error) + } }, // 下一步 @@ -255,6 +249,11 @@ export default { (item) => item.value === this.selectProjectId, ).label }, + + // 关闭弹框 + handleCloseDialogOuter() { + this.dialogConfig.outerVisible = false + }, }, async created() { diff --git a/src/views/construction-person/attendance-manage/card-replacement-apply/select-person-and-date.vue b/src/views/construction-person/attendance-manage/card-replacement-apply/select-person-and-date.vue index 9f5a034..0b59ffb 100644 --- a/src/views/construction-person/attendance-manage/card-replacement-apply/select-person-and-date.vue +++ b/src/views/construction-person/attendance-manage/card-replacement-apply/select-person-and-date.vue @@ -123,6 +123,11 @@ export default { type: String, default: () => '', }, + + editRow: { + type: Object, + default: () => {}, + }, }, components: { // AttendanceCalendar, @@ -139,11 +144,14 @@ export default { personOptions: [], name: '', idNumber: '', + workerId: '', initHeight: 0, // 补卡信息列表 dateList: [], // 补卡日期列表 cardReplacementDateList: [], + // 修改时的补卡日期列表 + editRepairDateList: [], } }, methods: { @@ -192,11 +200,11 @@ export default { // 获取考勤记录 async getCardReplacementPersonCheckRecord() { - const workerId = this.personOptions.find( - (item) => item.value === this.queryPersonForm.selectPersonId, - ).id + // const workerId = this.personOptions.find( + // (item) => item.value === this.queryPersonForm.selectPersonId, + // ).id const { data: res } = await getCardReplacementPersonCheckRecordAPI({ - workerId, + workerId: this.workerId, proId: this.selectProjectId, startTime: this.queryPersonForm.time[0], endTime: this.queryPersonForm.time[1], @@ -204,15 +212,28 @@ export default { const tempList = [] if (Object.keys(res).length > 0) { - for (const key in res) { - tempList.push({ - month: key.split('-')[1], - date: key.split('-')[2], - inRange: res[key].inRange, - isActive: res[key].isActive, - currentDate: key, - isChecked: false, - }) + if (this.editRepairDateList.length > 0) { + for (const key in res) { + tempList.push({ + month: key.split('-')[1], + date: key.split('-')[2], + inRange: res[key].inRange, + isActive: res[key].isActive, + currentDate: key, + isChecked: this.editRepairDateList.includes(key), + }) + } + } else { + for (const key in res) { + tempList.push({ + month: key.split('-')[1], + date: key.split('-')[2], + inRange: res[key].inRange, + isActive: res[key].isActive, + currentDate: key, + isChecked: false, + }) + } } } @@ -239,6 +260,7 @@ export default { console.log(personInfo, 'personInfo') const { name, idNumber, phone, teamName, id, teamId } = personInfo + this.workerId = id this.dateList = [] this.dateList.push({ @@ -266,6 +288,30 @@ export default { created() { this.getCardReplacementPersonList() }, + + watch: { + editRow: { + handler(newVal) { + if (Object.keys(newVal).length > 0) { + const { workerId, idNumber, name, repairDate } = newVal + this.queryPersonForm.selectPersonId = workerId + this.workerId = workerId + this.idNumber = idNumber + this.name = name + + const repairDateList = repairDate.split(',') + this.editRepairDateList = repairDateList + this.queryPersonForm.time = [ + repairDateList[0], + repairDateList[repairDateList.length - 1], + ] + this.getCardReplacementPersonCheckRecord() + } + }, + deep: true, + immediate: true, + }, + }, } diff --git a/src/views/construction-person/attendance-manage/card-replacement-audit/audit-form.vue b/src/views/construction-person/attendance-manage/card-replacement-audit/audit-form.vue new file mode 100644 index 0000000..e583280 --- /dev/null +++ b/src/views/construction-person/attendance-manage/card-replacement-audit/audit-form.vue @@ -0,0 +1,167 @@ + + + diff --git a/src/views/construction-person/attendance-manage/card-replacement-audit/config.js b/src/views/construction-person/attendance-manage/card-replacement-audit/config.js new file mode 100644 index 0000000..e6580a2 --- /dev/null +++ b/src/views/construction-person/attendance-manage/card-replacement-audit/config.js @@ -0,0 +1,57 @@ +export const formLabel = [ + { + isShow: false, // 是否展示label + f_type: 'ipt', + f_label: '姓名', + f_model: 'deviceCode', + }, + { + isShow: false, // 是否展示label + f_type: 'ipt', + f_label: '工程', + f_model: 'deviceName', + }, + { + isShow: false, // 是否展示label + f_type: 'ipt', + f_label: '状态', + f_model: 'proName', + }, +] + +export const columnsList = [ + { t_props: 'proName', t_label: '工程名称' }, + { t_props: 'repairNum', t_label: '补卡人数' }, + { t_props: 'repairDay', t_label: '补卡天数' }, + { t_props: 'repairRemark', t_label: '补卡说明' }, + { + t_label: '申请人', + t_props: 'applyUser', + }, + { t_label: '申请时间', t_props: 'applyTime' }, + { + t_label: '审核状态', + t_slot: 'checkStatus', + }, + { + t_label: '审核人', + t_props: 'checkUser', + }, + { + t_label: '审核时间', + t_props: 'checkTime', + }, +] + +export const dialogConfig = { + outerTitle: '', + minHeight: '90vh', + maxHeight: '90vh', + outerWidth: '80%', + outerVisible: false, + innerMinHeight: '50vh', + innerMaxHeight: '50vh', + innerWidth: '40%', + innerVisible: false, + innerTitle: '驳回意见', +} diff --git a/src/views/construction-person/attendance-manage/card-replacement-audit/index.vue b/src/views/construction-person/attendance-manage/card-replacement-audit/index.vue index 4e039e0..4c647b4 100644 --- a/src/views/construction-person/attendance-manage/card-replacement-audit/index.vue +++ b/src/views/construction-person/attendance-manage/card-replacement-audit/index.vue @@ -1,11 +1,243 @@ +import TableModel from '@/components/TableModel' +import DialogModel from '@/components/DialogModel' - +import AuditForm from './audit-form.vue' +import { formLabel, columnsList, dialogConfig } from './config' +import { + getCardReplacementAuditListAPI, + cardReplacementAuditAPI, +} from '@/api/construction-person/attendance-manage/card-replacement-audit' + +export default { + name: 'CardReplacementAudit', + components: { + TableModel, + DialogModel, + AuditForm, + }, + + data() { + return { + formLabel, + columnsList, + dialogConfig, + editFormData: {}, // 修改时回显的数据 + getCardReplacementAuditListAPI, + + lotProjectOptions: [], + queryDetailsId: '', + selectProjectName: '', + refuseRemark: '', + } + }, + methods: { + // 导出按钮 + onHandleExportCardReplacementAudit(queryParams) { + this.download( + '/bmw/pmAttDevice/export', + { + ...queryParams, + }, + `考勤机列表.xlsx`, + ) + }, + + // 审核按钮 + onHandleAudit(data) { + this.selectProjectName = data.proName + this.queryDetailsId = data.id + this.dialogConfig.outerVisible = true + }, + + // 详情按钮 + onHandleDetail(data) { + console.log(data) + }, + + // 关闭弹框 + onHandleReject() { + this.dialogConfig.innerVisible = true + }, + + // 通过和驳回按钮 + onHandlePassAndReject(checkStatus) { + this.$confirm( + checkStatus === 1 + ? '确定通过此次补卡申请吗?' + : '确定驳回此次补卡申请吗?', + '温馨提示', + { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + }, + ) + .then(async () => { + const params = { + id: this.queryDetailsId, + checkStatus, + } + if (checkStatus === 2) { + params.refuseRemark = this.refuseRemark + } + const res = await cardReplacementAuditAPI(params) + if (res.code === 200) { + this.$modal.msgSuccess( + checkStatus === 1 ? '通过成功' : '驳回成功', + ) + this.$refs.cardReplacementAuditTableRef.getTableList() + } + }) + .catch(() => { + // console.log('取消') + }) + .finally(() => { + if (checkStatus === 0) { + this.refuseRemark = '' + this.dialogConfig.innerVisible = false + } + this.dialogConfig.outerVisible = false + }) + }, + + // 关闭弹框 外层 + handleCloseDialogOuter() { + this.dialogConfig.outerVisible = false + }, + + // 关闭弹框 内层 + handleCloseDialogInner() { + this.dialogConfig.innerVisible = false + }, + }, +} + diff --git a/src/views/construction-person/attendance-manage/card-replacement-count/add-apply-form.vue b/src/views/construction-person/attendance-manage/card-replacement-count/add-apply-form.vue new file mode 100644 index 0000000..f7652cc --- /dev/null +++ b/src/views/construction-person/attendance-manage/card-replacement-count/add-apply-form.vue @@ -0,0 +1,285 @@ + + + diff --git a/src/views/construction-person/attendance-manage/card-replacement-count/config.js b/src/views/construction-person/attendance-manage/card-replacement-count/config.js new file mode 100644 index 0000000..b047726 --- /dev/null +++ b/src/views/construction-person/attendance-manage/card-replacement-count/config.js @@ -0,0 +1,27 @@ +export const formLabel = [ + { + isShow: false, // 是否展示label + f_type: 'ipt', + f_label: '工程', + f_model: 'deviceName', + }, +] + +export const columnsList = [ + { t_props: 'deviceCode', t_label: '工程名称' }, + { t_props: 'deviceName', t_label: '申请补卡次数' }, + { t_props: 'proName', t_label: '申请补卡人数' }, + { t_slot: 'isShanghai', t_label: '申请补卡天数' }, + { + t_label: '最后申请时间', + t_slot: 'onLine', + }, +] + +export const dialogConfig = { + outerTitle: '', + minHeight: '', + maxHeight: '', + outerWidth: '40%', + outerVisible: false, +} diff --git a/src/views/construction-person/attendance-manage/card-replacement-count/index.vue b/src/views/construction-person/attendance-manage/card-replacement-count/index.vue index 4877a0b..68be6aa 100644 --- a/src/views/construction-person/attendance-manage/card-replacement-count/index.vue +++ b/src/views/construction-person/attendance-manage/card-replacement-count/index.vue @@ -1,11 +1,267 @@ +import TableModel from '@/components/TableModel' +import DialogModel from '@/components/DialogModel' - +import AddApplyForm from './add-apply-form.vue' +import { formLabel, columnsList, dialogConfig } from './config' +import { + deleteAttendanceMachineAPI, + getCardReplacementApplyListAPI, +} from '@/api/construction-person/attendance-manage/card-replacement-apply' + +import { getLotProjectSelectListCommonFun } from '@/utils/getCommonData' +export default { + name: 'CardReplacementCount', + components: { + TableModel, + DialogModel, + + AddApplyForm, + }, + + data() { + return { + formLabel, + columnsList, + dialogConfig, + editFormData: {}, // 修改时回显的数据 + getCardReplacementApplyListAPI, + + lotProjectOptions: [], + selectProjectId: '', + selectProjectName: '', + } + }, + methods: { + // 导出按钮 + onHandleExportAttendanceMachine(queryParams) { + this.download( + '/bmw/pmAttDevice/export', + { + ...queryParams, + }, + `考勤机列表.xlsx`, + ) + }, + + // 新增或修改 + onHandleAddOrBindAttendanceMachine(type, data) { + this.dialogConfig.outerTitle = + type === 1 ? '新增考勤机' : '绑定考勤机' + + if (type === 2) { + const { proId, deviceCode, deviceName } = data + + this.editFormData = { + isUpdate: true, + proId, + deviceCode, + deviceName, + } + } else { + this.editFormData = {} + } + this.dialogConfig.outerVisible = true + }, + + // 新增补卡申请 + onHandleAddCardReplacementApply(type, data) { + this.dialogConfig.outerTitle = '选择补卡工程' + this.dialogConfig.outerWidth = '30%' + this.dialogConfig.minHeight = '' + this.dialogConfig.maxHeight = '' + this.dialogConfig.outerVisible = true + }, + + // 删除 + onHandleDeleteSubBaseInfo(data) { + this.$confirm('确定删除该考勤机吗?', '温馨提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + }) + .then(async () => { + const res = await deleteAttendanceMachineAPI({ + deviceCode: data.deviceCode, + }) + if (res.code === 200) { + this.$modal.msgSuccess('删除成功') + this.$refs.attendanceMachineTableRef.getTableList() // 更新列表 + } + }) + .catch(() => { + // console.log('取消') + }) + }, + + // 确定按钮 + onHandleConfirm() { + console.log('确定') + }, + + // 最终的确定按钮 + async onHandleConfirmFinish() { + try { + await this.$refs.addApplyFormRef.onHandleConfirmFinishFun() + this.handleCloseDialogOuter() + this.$refs.cardReplacementApplyTableRef.getTableList() + } catch (error) { + // console.log('表单提交失败', error) + } + }, + + // 关闭弹框 + handleCloseDialogOuter() { + this.dialogConfig.outerVisible = false + }, + + // 下一步 + onHandleNextStep() { + if (!this.selectProjectId) { + this.$modal.msgError('请选择补卡工程') + return + } + + this.dialogConfig.outerTitle = '新增补卡申请' + this.dialogConfig.outerWidth = '80%' + this.dialogConfig.minHeight = '80vh' + this.dialogConfig.maxHeight = '80h' + this.dialogConfig.outerVisible = true + }, + + // 选择补卡工程 + handleSelectProject() { + this.selectProjectName = this.lotProjectOptions.find( + (item) => item.value === this.selectProjectId, + ).label + }, + }, + + async created() { + const lot = await getLotProjectSelectListCommonFun() + this.lotProjectOptions = lot.map((item) => ({ + value: item.id, + label: item.proName, + })) + }, +} + diff --git a/src/views/construction-person/attendance-manage/card-replacement-count/select-person-and-date.vue b/src/views/construction-person/attendance-manage/card-replacement-count/select-person-and-date.vue new file mode 100644 index 0000000..0b59ffb --- /dev/null +++ b/src/views/construction-person/attendance-manage/card-replacement-count/select-person-and-date.vue @@ -0,0 +1,349 @@ + + + + +