| | |
| | | > |
| | | <template slot="leftButton"> |
| | | <div class="margin_right_20px" style="width:200px;"> |
| | | <el-date-picker v-model="object.date" style="width:100%" type="month" placeholder="选择日期" |
| | | <el-date-picker v-model="object.date" style="width:100%" |
| | | @change="onFilterSearch" |
| | | :clearable="false" type="month" placeholder="选择日期" |
| | | :picker-options="pickerOptions" |
| | | value-format="yyyy-MM"> |
| | | </el-date-picker> |
| | | </div> |
| | | <el-button size="small" type="primary" @click="ruleSettingClick">规则设置</el-button> |
| | | </template> |
| | | </CommonSearch> |
| | | </div> |
| | |
| | | v-loading="loading" |
| | | :table-list="tableList" |
| | | @selTableCol="selTableCol" |
| | | @selCommonClick="(row,prop,item) => selCommonClick(row,prop,item)" |
| | | > |
| | | <template slot="tableButton"> |
| | | <el-table-column label="操作" width="90" fixed="right"> |
| | | <template slot-scope="scope"> |
| | | <el-button @click="delClick(scope.row.id)" type="text" size="small">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </template> |
| | | </TableCommonView> |
| | | </div> |
| | | <div class="btn-pager"> |
| | | <!-- <div class="btn-pager"> |
| | | <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" /> |
| | | </div> |
| | | </div> --> |
| | | </div> |
| | | </div> |
| | | <AttendanceStatisticsDetails ref="attendanceStatisticsDetails" :editRow="editRow" @shutdown="getData" /> |
| | | <!-- 规则设置 --> |
| | | <RuleSettingDialog ref="RuleSettingDialog" :editRow="editRow" @closeClick="getData" /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { getFollowRecordList, getDeleteFollowRecord } from "@/api/employeeSalary/attendanceStatistics.js" |
| | | import { getAttendanceStatistic } from "@/api/employeeSalary/attendanceManage.js" |
| | | import pageMixin from "@/components/makepager/pager/mixin/pageMixin" |
| | | import AttendanceStatisticsDetails from "@/views/employeeSalary/attendanceStatistics/components/AttendanceStatisticsDetails" |
| | | import RuleSettingDialog from "@/views/employeeSalary/attendanceStatistics/components/RuleSettingDialog" |
| | | import Date from "@/api/date"; |
| | | const { getCurrentMonth } = Date; |
| | | import NewDate from "@/api/date"; |
| | | const { getCurrentMonth } = NewDate; |
| | | export default { |
| | | name: "attendanceStatistics", |
| | | props: { |
| | |
| | | mixins: [pageMixin], |
| | | components: { |
| | | AttendanceStatisticsDetails, |
| | | RuleSettingDialog |
| | | }, |
| | | data() { |
| | | return { |
| | | tableList: {}, |
| | | loading: false, |
| | | pickerOptions: { |
| | | disabledDate(time) { |
| | | return time.getTime() > new Date().getTime() - 86400000; |
| | | }, |
| | | }, |
| | | object:{ |
| | | date:getCurrentMonth() |
| | | }, |
| | |
| | | title: "新建", |
| | | infomation: {} |
| | | }, |
| | | search_map: {}, |
| | | keyword: "", |
| | | tableColumn: [ |
| | | { label: "姓名", prop: "topic", min: 120, default: true }, |
| | | { label: "人员ID", prop: "client_name", min: 190,default: true}, |
| | | { label: "工种", prop: "contact_name", min: 100, }, |
| | | { label: "月份", prop: "client_status", min: 100 }, |
| | | { label: "1/周一", prop: "client_status", min: 100 }, |
| | | { label: "工作日加班时长(小时)", prop: "contact_information_name", min: 180 }, |
| | | { label: "休息日加班时长(小时)", prop: "follow_time", min: 180 }, |
| | | { label: "应出勤天数", prop: "next_follow_time", min: 110 }, |
| | | { label: "实际出勤天数", prop: "member_name", min: 110 }, |
| | | { label: "姓名", prop: "workerName", min: 120, default: true }, |
| | | { label: "人员ID", prop: "workerId", min: 190,default: true}, |
| | | { label: "工种", prop: "workType", min: 100, }, |
| | | { label: "月份", prop: "month", min: 100 }, |
| | | { label: "工作日加班时长(小时)", prop: "weekdayOverTime", min: 180 }, |
| | | { label: "休息日加班时长(小时)", prop: "restDayOverTime", min: 180 }, |
| | | { label: "应出勤天数", prop: "requiredAttendanceDays", min: 110 }, |
| | | { label: "实际出勤天数", prop: "actualAttendanceDays", min: 110 }, |
| | | ], |
| | | showCol: [ |
| | | "姓名", |
| | | "人员ID", |
| | | "工种", |
| | | "月份", |
| | | "工作日加班时长(小时)", |
| | |
| | | }, |
| | | created() { |
| | | this.setTable() |
| | | this.getData(this.search_map) |
| | | this.getData(this.keyword) |
| | | }, |
| | | computed: { |
| | | }, |
| | |
| | | setTable() { |
| | | this.tableList = { |
| | | selectIndex: true, |
| | | isFixed:true, |
| | | tableInfomation: [], |
| | | allcol: [], |
| | | showcol: this.showCol, |
| | |
| | | return this.tableColumn.map((ele) => { |
| | | return { |
| | | ...ele, |
| | | isShowColumn: showCol.includes(ele.label) |
| | | isShowColumn:ele.default?true:showCol.includes(ele.label) |
| | | } |
| | | }) |
| | | }, |
| | | selTableCol(val) { |
| | | this.showcol = val |
| | | this.tableList.tableColumn = this.setColumnVisible(val) |
| | | this.showcol = val; |
| | | this.tableList.tableColumn = this.setColumnVisible(val); |
| | | }, |
| | | // 请求数据 |
| | | async getData() { |
| | | this.loading = true |
| | | await getFollowRecordList({ |
| | | search_map: this.search_map, |
| | | page: this.pagerOptions.currPage, |
| | | pageSize: this.pagerOptions.pageSize |
| | | await getAttendanceStatistic({ |
| | | keyword: this.keyword, |
| | | month:this.object.date, |
| | | // page: this.pagerOptions.currPage, |
| | | // pageSize: this.pagerOptions.pageSize |
| | | }) |
| | | .then((res) => { |
| | | console.log(res) |
| | | if (res.code === 200) { |
| | | if (res.data.list && res.data.list.length > 0) { |
| | | let tableColumn1= [ |
| | | { label: "姓名", prop: "workerName", min: 120,default: true,fixed:'left' }, |
| | | { label: "人员ID", prop: "workerId", min: 120,default: true,fixed:'left'}, |
| | | { label: "工种", prop: "workType", min: 100,fixed:'left' }, |
| | | { label: "月份", prop: "month", min: 90 ,fixed:'left'}, |
| | | ]; |
| | | let tableColumn3=[ |
| | | { label: "工作日加班时长(小时)", prop: "weekdayOverTime", min: 140,fixed:'right'}, |
| | | { label: "休息日加班时长(小时)", prop: "restDayOverTime", min: 140,fixed:'right' }, |
| | | { label: "应出勤天数", prop: "requiredAttendanceDays", min: 110 ,fixed:'right'}, |
| | | { label: "实际出勤天数", prop: "actualAttendanceDays", min: 110,fixed:'right'}, |
| | | ] |
| | | let tableColumn2=[] |
| | | let headerList=res.data.list.length>0?res.data.list[0]:[] |
| | | if(headerList.details&&headerList.details.length>0){ |
| | | for(let i in headerList.details){ |
| | | tableColumn2.push({ |
| | | label:headerList.details[i].date+'', |
| | | prop:'headerDate'+headerList.details[i].date, |
| | | min:100, |
| | | default:true, |
| | | isCallMethod:true, |
| | | isClass: true, |
| | | getClassName:this.getHeaderClass, |
| | | getCallMethod: this.getHeaderDate, |
| | | isCommonClick:true, |
| | | isIcon:true, |
| | | }) |
| | | } |
| | | } |
| | | |
| | | let tableColumn=tableColumn1.concat(tableColumn2).concat(tableColumn3) |
| | | this.tableColumn=tableColumn; |
| | | this.setTable() |
| | | const list = res.data.list.map((item) => { |
| | | let headerItem={} |
| | | let details=item.details?item.details:[] |
| | | for(let i in details){ |
| | | headerItem['headerDate'+details[i].date]=details[i].status |
| | | } |
| | | return { |
| | | ...item, |
| | | client_name: item.client.name, |
| | | contact_name: item.contact.name, |
| | | client_status: item.client_status.name, |
| | | phone: item.contact.phone, |
| | | member_name: item.member.username, |
| | | contact_information_name: item.contact_information.name |
| | | ...headerItem, |
| | | } |
| | | }) |
| | | this.tableList.tableInfomation = list || [] |
| | | this.pagerOptions.totalCount = res.data.count |
| | | this.pagerOptions.totalCount = res.total |
| | | } else { |
| | | this.tableList.tableInfomation = [] |
| | | } |
| | |
| | | this.loading = false |
| | | }) |
| | | }, |
| | | getHeaderDate(val){ |
| | | let string='' |
| | | // 1==正常 2===加班 3==休假 4===异常 |
| | | if(val==1){ |
| | | string="<i class='el-icon-circle-check'></i>" |
| | | }else if(val==2){ |
| | | string='班' |
| | | }else if(val==3){ |
| | | string='休' |
| | | }else if(val==4){ |
| | | string='异' |
| | | } |
| | | return string |
| | | }, |
| | | getHeaderClass(val){ |
| | | let classname='' |
| | | // 1==正常 2===加班 3==休假 4===异常 |
| | | if(val==1){ |
| | | classname = "color_67c23a font_weight_700 font_size_20"; |
| | | }else if(val==2){ |
| | | classname = "color_FF9900 font_weight_700"; |
| | | }else if(val==3){ |
| | | classname = "color_333 font_weight_700"; |
| | | }else if(val==4){ |
| | | classname = "color_red font_weight_700"; |
| | | } |
| | | return classname |
| | | }, |
| | | // 搜索 |
| | | onFilterSearch(searchText) { |
| | | this.search_map.client_name = searchText ?? "" |
| | | this.keyword = searchText ?? "" |
| | | this.pagerOptions.currPage = 1 |
| | | this.getData() |
| | | }, |
| | | // 详情 |
| | | detailsClick(row) { |
| | | let config=JSON.parse(JSON.stringify(row)); |
| | | this.editRow = { ...config, title:'编辑',type:'add' } |
| | | this.$refs.addWorkKind.islook = true; |
| | | }, |
| | | // 打印 |
| | | ruleSettingClick(){ |
| | | this.$refs.RuleSettingDialog.islook = true; |
| | | }, |
| | | selCommonClick(row,prop,item){ |
| | | |
| | | // 删除 |
| | | delClick(id) { |
| | | this.$confirm("是否确认删除?", "警告", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | getDeleteFollowRecord({ ids: [id] }).then((response) => { |
| | | if (response.code === 200) { |
| | | this.$message.success("删除成功") |
| | | this.getData() |
| | | } else { |
| | | this.$message.warning("删除失败") |
| | | let config=JSON.parse(JSON.stringify(row)); |
| | | let details=config.details |
| | | let headerItem={} |
| | | for(let i in details){ |
| | | if(details[i].date==item.label){ |
| | | headerItem.classes=details[i].classes |
| | | headerItem.classesEndTime=details[i].classesEndTime |
| | | headerItem.classesStartTime=details[i].classesStartTime |
| | | headerItem.endWorkTime=details[i].endWorkTime |
| | | headerItem.startWorkTime=details[i].startWorkTime |
| | | headerItem.status=details[i].status |
| | | headerItem.dateDay=details[i].date |
| | | break; |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => {}) |
| | | } |
| | | this.editRow = { |
| | | ...config, |
| | | ...headerItem, |
| | | } |
| | | this.$refs.attendanceStatisticsDetails.islook = true; |
| | | }, |
| | | } |
| | | } |
| | |
| | | overflow: hidden; |
| | | } |
| | | .list-view { |
| | | height: calc(100% - 60px); |
| | | height: calc(100% - 10px); |
| | | overflow: hidden; |
| | | } |
| | | .btn-pager { |