forked from zhurui/management
1 line
18 KiB
JSON
1 line
18 KiB
JSON
{"remainingRequest":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\src\\views\\modules\\applicationPart1\\attendence\\record.vue?vue&type=script&lang=js&","dependencies":[{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\src\\views\\modules\\applicationPart1\\attendence\\record.vue","mtime":1624883381528},{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\babel-loader\\lib\\index.js","mtime":499162500000},{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\nimport mixinViewModule from '@/mixins/view-module'\n// import AddOrUpdate from './attendancerecords-add-or-update'\nimport debounce from \"lodash/debounce\";\n// import {getDictDataListAll, getPersonRegion} from \"@/utils\";\n\nexport default {\n mixins: [mixinViewModule],\n data() {\n return {\n mixinViewModuleOptions: {\n getDataListURL: '/system/attendence/attendancerecords/page',\n getDataListIsPage: true,\n deleteURL: '/system/attendence/attendancerecords',\n deleteIsBatch: true,\n createdIsNeed: false,\n activatedIsNeed: false,\n },\n dataForm: {\n id: '',\n studentNumber: this.$store.state.user.username,\n todayDate: \"\",\n },\n dataPost: {\n ...this.dataForm,\n },\n popIsEdit: false,\n }\n },\n created() {\n Date.prototype.myFormat = function (fmt) {\n var o = {\n \"M+\": this.getMonth() + 1, //月份\n \"d+\": this.getDate(), //日\n \"h+\": this.getHours(), //小时\n \"m+\": this.getMinutes(), //分\n \"s+\": this.getSeconds(), //秒\n \"q+\": Math.floor((this.getMonth() + 3) / 3), //季度\n \"S\": this.getMilliseconds() //毫秒\n };\n if (/(y+)/.test(fmt)) {\n fmt = fmt.replace(RegExp.$1, (this.getFullYear() + \"\").substr(4 - RegExp.$1.length));\n }\n for (var k in o) {\n if (new RegExp(\"(\" + k + \")\").test(fmt)) {\n fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : ((\"00\" + o[k]).substr((\"\" + o[k]).length)));\n }\n }\n return fmt;\n }\n\n // var time1 = new Date().myFormat(\"yyyy-MM-dd hh:mm:ss\");\n this.dataForm.todayDate = new Date().myFormat(\"yyyy-MM-dd\");\n this.myQuery()\n },\n // components: {\n // AddOrUpdate\n // },\n methods: {\n myQuery(){\n this.dataListLoading = true\n this.$http.get(\n this.mixinViewModuleOptions.getDataListURL, {\n params: {\n order: this.order,\n orderField: this.orderField,\n page: this.mixinViewModuleOptions.getDataListIsPage ? this.page : null,\n limit: this.mixinViewModuleOptions.getDataListIsPage ? this.limit : null,\n ...this.dataForm,\n }\n }\n ).then(({\n data: res\n }) => {\n this.dataListLoading = false\n\n if (res.code !== 0) {\n this.dataList = []\n this.total = 0\n return this.$message.error(res.msg)\n }\n\n this.dataList = this.mixinViewModuleOptions.getDataListIsPage ? res.data.list : res.data\n // 如果没有查询到记录,就增加今天的打卡记录\n // console.log(\"===========\");\n // console.log(this.dataList);\n if(!this.dataList.length){\n this.dataPost.startTime = new Date().myFormat(\"yyyy-MM-dd hh:mm:ss\");\n this.dataPost.studentNumber = this.$store.state.user.username;\n this.dataPost.studentName = this.$store.state.user.realName;\n this.dataPost.todayDate = new Date().myFormat(\"yyyy-MM-dd\");\n this.dataFormSubmitHandle()\n }else {\n // 如果有查询到记录,原则上只能有今天这一条\n this.dataPost = {...this.dataList[0]}\n }\n // 如果查询到多条记录,就删除到只剩一条\n // console.log(\"===========\");\n // console.log(this.dataList);\n // console.log(this.dataList.length > 1);\n if(this.dataList.length>1){\n // console.log(\"this.dataList[this.dataList.length - 1].id\");\n // console.log(this.dataList[this.dataList.length - 1].id);\n this.deleteHandleWapper(this.dataList[this.dataList.length-1].id);\n\n }\n // console.log(\"this.dataPost\");\n // console.log(this.dataPost);\n this.total = this.mixinViewModuleOptions.getDataListIsPage ? res.data.total : 0\n let list = this.checkList[this.page]\n if (this.mixinViewModuleOptions.needCheckRecord && list && list.length > 0) {\n this.$nextTick(() => {\n let func = this.$refs.tableSelect.toggleRowSelection;\n let ids = list.map(item => item.id);\n this.dataList.forEach(item => {\n if (ids.includes(item.id)) {\n func(item, true)\n }\n })\n })\n }\n }).catch(() => {\n this.dataListLoading = false\n })\n },\n updateInfo(scopeRowId) {\n let s = new Date(this.dataPost.startTime);\n let e = new Date();\n // 保留一位小数\n let delta = Math.floor((e-s)/1000/60/60 * 10) / 10\n this.dataPost.endTime = e.myFormat(\"yyyy-MM-dd hh:mm:ss\");\n this.dataPost.duration = delta\n // console.log(this.dataPost.duration);\n this.dataPost.id = scopeRowId\n this.dataFormSubmitHandle()\n },\n // addOrUpdateHandleWapper(scopeRowId) {\n // this.popIsEdit = true;\n // this.addOrUpdateHandle(scopeRowId)\n // },\n deleteHandleWapper(id) {\n this.$http.delete(\n `${this.mixinViewModuleOptions.deleteURL}${this.mixinViewModuleOptions.deleteIsBatch ? '' : '/' + id}`,\n this.mixinViewModuleOptions.deleteIsBatch ? {\n 'data': id ? [id] : this.dataListSelections.map(item => item[this.mixinViewModuleOptions.deleteIsBatchKey])\n } : {}\n ).then(({\n data: res\n }) => {\n if (res.code !== 0) {\n return this.$message.error(res.msg)\n }\n this.myQuery()\n }).catch(() => {\n })\n },\n\n\n // 表单提交\n dataFormSubmitHandle: debounce(function () {\n this.$http[!this.dataPost.id ? 'post' : 'put']('/system/attendence/attendancerecords/', this.dataPost).then(({data: res}) => {\n if (res.code !== 0) {\n return this.$message.error(res.msg)\n }\n this.$message({\n message: this.$t('prompt.success'),\n type: 'success',\n duration: 500,\n onClose: () => {\n this.visible = false\n this.myQuery()\n }\n })\n }).catch(() => {\n })\n }, 1000, {'leading': true, 'trailing': false})\n\n }\n}\n",{"version":3,"sources":["record.vue"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuDA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA","file":"record.vue","sourceRoot":"src/views/modules/applicationPart1/attendence","sourcesContent":["<template>\n <el-card shadow=\"never\" class=\"aui-card--fill\">\n <div class=\"mod-attendence__record}\">\n <!-- <el-form :inline=\"true\" :model=\"dataForm\" @keyup.enter.native=\"getDataList()\">-->\n <!-- <el-form-item>-->\n <!-- <el-input v-model=\"dataForm.id\" placeholder=\"id\" clearable></el-input>-->\n <!-- </el-form-item>-->\n <!-- <el-form-item>-->\n <!-- <el-button @click=\"getDataList()\">{{ $t('query') }}</el-button>-->\n <!-- </el-form-item>-->\n <!-- <el-form-item>-->\n <!-- <el-button type=\"primary\" @click=\"addOrUpdateHandleWapper()\">{{ $t('add') }}</el-button>-->\n <!-- </el-form-item>-->\n <!-- <el-form-item>-->\n <!-- <el-button type=\"danger\" @click=\"deleteHandleWapper()\">{{ $t('deleteBatch') }}</el-button>-->\n <!-- </el-form-item>-->\n <!-- </el-form>-->\n <el-table v-loading=\"dataListLoading\" :data=\"dataList\" border @selection-change=\"dataListSelectionChangeHandle\"\n style=\"width: 100%;\">\n<!-- <el-table-column type=\"selection\" header-align=\"center\" align=\"center\" width=\"50\"></el-table-column>-->\n<!-- <el-table-column prop=\"id\" label=\"记录id\" header-align=\"center\" align=\"center\"></el-table-column>-->\n <el-table-column prop=\"studentNumber\" label=\"学号\" header-align=\"center\" align=\"center\"></el-table-column>\n <el-table-column prop=\"studentName\" label=\"学生名字\" header-align=\"center\" align=\"center\"></el-table-column>\n <el-table-column prop=\"startTime\" label=\"打卡开始时间\" header-align=\"center\" align=\"center\"></el-table-column>\n <el-table-column prop=\"endTime\" label=\"打卡结束时间\" header-align=\"center\" align=\"center\"></el-table-column>\n <el-table-column prop=\"duration\" label=\"在线时长(小时)\" header-align=\"center\" align=\"center\"></el-table-column>\n<!-- <el-table-column prop=\"todayDate\" label=\"打卡日期\" header-align=\"center\" align=\"center\"></el-table-column>-->\n<!-- <el-table-column prop=\"createDate\" label=\"创建时间\" header-align=\"center\" align=\"center\"></el-table-column>-->\n<!-- <el-table-column prop=\"creator\" label=\"创建人\" header-align=\"center\" align=\"center\"></el-table-column>-->\n <el-table-column :label=\"$t('handle')\" fixed=\"right\" header-align=\"center\" align=\"center\" width=\"230\">\n <template slot-scope=\"scope\">\n <el-button size=\"small\" @click=\"updateInfo(scope.row.id)\">{{ \"下班打卡\" }}</el-button>\n<!-- <el-button size=\"small\" @click=\"addOrUpdateHandleWapper(scope.row.id)\">{{ $t('update') }}</el-button>-->\n<!-- <el-button type=\"danger\" size=\"small\" @click=\"deleteHandleWapper(scope.row.id)\">{{-->\n<!-- $t('delete')-->\n<!-- }}-->\n<!-- </el-button>-->\n </template>\n </el-table-column>\n </el-table>\n <!-- <el-pagination-->\n <!-- :current-page=\"page\"-->\n <!-- :page-sizes=\"[10, 20, 50, 100]\"-->\n <!-- :page-size=\"limit\"-->\n <!-- :total=\"total\"-->\n <!-- layout=\"total, sizes, prev, pager, next, jumper\"-->\n <!-- @size-change=\"pageSizeChangeHandle\"-->\n <!-- @current-change=\"pageCurrentChangeHandle\">-->\n <!-- </el-pagination>-->\n <!-- 弹窗, 新增 / 详情/ 修改 -->\n </div>\n </el-card>\n</template>\n\n<script>\nimport mixinViewModule from '@/mixins/view-module'\n// import AddOrUpdate from './attendancerecords-add-or-update'\nimport debounce from \"lodash/debounce\";\n// import {getDictDataListAll, getPersonRegion} from \"@/utils\";\n\nexport default {\n mixins: [mixinViewModule],\n data() {\n return {\n mixinViewModuleOptions: {\n getDataListURL: '/system/attendence/attendancerecords/page',\n getDataListIsPage: true,\n deleteURL: '/system/attendence/attendancerecords',\n deleteIsBatch: true,\n createdIsNeed: false,\n activatedIsNeed: false,\n },\n dataForm: {\n id: '',\n studentNumber: this.$store.state.user.username,\n todayDate: \"\",\n },\n dataPost: {\n ...this.dataForm,\n },\n popIsEdit: false,\n }\n },\n created() {\n Date.prototype.myFormat = function (fmt) {\n var o = {\n \"M+\": this.getMonth() + 1, //月份\n \"d+\": this.getDate(), //日\n \"h+\": this.getHours(), //小时\n \"m+\": this.getMinutes(), //分\n \"s+\": this.getSeconds(), //秒\n \"q+\": Math.floor((this.getMonth() + 3) / 3), //季度\n \"S\": this.getMilliseconds() //毫秒\n };\n if (/(y+)/.test(fmt)) {\n fmt = fmt.replace(RegExp.$1, (this.getFullYear() + \"\").substr(4 - RegExp.$1.length));\n }\n for (var k in o) {\n if (new RegExp(\"(\" + k + \")\").test(fmt)) {\n fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : ((\"00\" + o[k]).substr((\"\" + o[k]).length)));\n }\n }\n return fmt;\n }\n\n // var time1 = new Date().myFormat(\"yyyy-MM-dd hh:mm:ss\");\n this.dataForm.todayDate = new Date().myFormat(\"yyyy-MM-dd\");\n this.myQuery()\n },\n // components: {\n // AddOrUpdate\n // },\n methods: {\n myQuery(){\n this.dataListLoading = true\n this.$http.get(\n this.mixinViewModuleOptions.getDataListURL, {\n params: {\n order: this.order,\n orderField: this.orderField,\n page: this.mixinViewModuleOptions.getDataListIsPage ? this.page : null,\n limit: this.mixinViewModuleOptions.getDataListIsPage ? this.limit : null,\n ...this.dataForm,\n }\n }\n ).then(({\n data: res\n }) => {\n this.dataListLoading = false\n\n if (res.code !== 0) {\n this.dataList = []\n this.total = 0\n return this.$message.error(res.msg)\n }\n\n this.dataList = this.mixinViewModuleOptions.getDataListIsPage ? res.data.list : res.data\n // 如果没有查询到记录,就增加今天的打卡记录\n // console.log(\"===========\");\n // console.log(this.dataList);\n if(!this.dataList.length){\n this.dataPost.startTime = new Date().myFormat(\"yyyy-MM-dd hh:mm:ss\");\n this.dataPost.studentNumber = this.$store.state.user.username;\n this.dataPost.studentName = this.$store.state.user.realName;\n this.dataPost.todayDate = new Date().myFormat(\"yyyy-MM-dd\");\n this.dataFormSubmitHandle()\n }else {\n // 如果有查询到记录,原则上只能有今天这一条\n this.dataPost = {...this.dataList[0]}\n }\n // 如果查询到多条记录,就删除到只剩一条\n // console.log(\"===========\");\n // console.log(this.dataList);\n // console.log(this.dataList.length > 1);\n if(this.dataList.length>1){\n // console.log(\"this.dataList[this.dataList.length - 1].id\");\n // console.log(this.dataList[this.dataList.length - 1].id);\n this.deleteHandleWapper(this.dataList[this.dataList.length-1].id);\n\n }\n // console.log(\"this.dataPost\");\n // console.log(this.dataPost);\n this.total = this.mixinViewModuleOptions.getDataListIsPage ? res.data.total : 0\n let list = this.checkList[this.page]\n if (this.mixinViewModuleOptions.needCheckRecord && list && list.length > 0) {\n this.$nextTick(() => {\n let func = this.$refs.tableSelect.toggleRowSelection;\n let ids = list.map(item => item.id);\n this.dataList.forEach(item => {\n if (ids.includes(item.id)) {\n func(item, true)\n }\n })\n })\n }\n }).catch(() => {\n this.dataListLoading = false\n })\n },\n updateInfo(scopeRowId) {\n let s = new Date(this.dataPost.startTime);\n let e = new Date();\n // 保留一位小数\n let delta = Math.floor((e-s)/1000/60/60 * 10) / 10\n this.dataPost.endTime = e.myFormat(\"yyyy-MM-dd hh:mm:ss\");\n this.dataPost.duration = delta\n // console.log(this.dataPost.duration);\n this.dataPost.id = scopeRowId\n this.dataFormSubmitHandle()\n },\n // addOrUpdateHandleWapper(scopeRowId) {\n // this.popIsEdit = true;\n // this.addOrUpdateHandle(scopeRowId)\n // },\n deleteHandleWapper(id) {\n this.$http.delete(\n `${this.mixinViewModuleOptions.deleteURL}${this.mixinViewModuleOptions.deleteIsBatch ? '' : '/' + id}`,\n this.mixinViewModuleOptions.deleteIsBatch ? {\n 'data': id ? [id] : this.dataListSelections.map(item => item[this.mixinViewModuleOptions.deleteIsBatchKey])\n } : {}\n ).then(({\n data: res\n }) => {\n if (res.code !== 0) {\n return this.$message.error(res.msg)\n }\n this.myQuery()\n }).catch(() => {\n })\n },\n\n\n // 表单提交\n dataFormSubmitHandle: debounce(function () {\n this.$http[!this.dataPost.id ? 'post' : 'put']('/system/attendence/attendancerecords/', this.dataPost).then(({data: res}) => {\n if (res.code !== 0) {\n return this.$message.error(res.msg)\n }\n this.$message({\n message: this.$t('prompt.success'),\n type: 'success',\n duration: 500,\n onClose: () => {\n this.visible = false\n this.myQuery()\n }\n })\n }).catch(() => {\n })\n }, 1000, {'leading': true, 'trailing': false})\n\n }\n}\n</script>\n"]}]} |