Selaa lähdekoodia

考勤-补卡记录、审核添加倒叙排序

zhonghuizhen 11 kuukautta sitten
vanhempi
sitoutus
602d32d833

+ 10 - 0
src/views/business/attendance/attendanceDetails.vue

@@ -134,6 +134,16 @@ export default {
                 page: 1,
                 limit: 15
             },
+            filter: [{
+                descVal: '1',
+                includeSub: true,
+                old: 'position',
+                partyId: this.$store.getters.userInfo.employee.positions,
+                partyName: '',
+                scriptContent: '',
+                type: 'user',
+                userType: 'position'
+            }],
             sorts: {},
             daterRange: [],
             searchXinMing: '',

+ 10 - 0
src/views/business/attendance/attendanceOverview.vue

@@ -113,6 +113,16 @@ export default {
                 limit: 15
             },
             sorts: {},
+            filter: [{
+                descVal: '1',
+                includeSub: true,
+                old: 'position',
+                partyId: this.$store.getters.userInfo.employee.positions,
+                partyName: '',
+                scriptContent: '',
+                type: 'user',
+                userType: 'position'
+            }],
             daterRange: [],
             searchXinMing: '',
             pickerOptions: {

+ 10 - 0
src/views/business/attendance/attendanceStatistics.vue

@@ -141,6 +141,16 @@ export default {
                 limit: 15
             },
             sorts: {},
+            filter: [{
+                descVal: '1',
+                includeSub: true,
+                old: 'position',
+                partyId: this.$store.getters.userInfo.employee.positions,
+                partyName: '',
+                scriptContent: '',
+                type: 'user',
+                userType: 'position'
+            }],
             daterRange: [],
             searchXinMing: '',
             pickerOptions: {

+ 19 - 3
src/views/business/attendance/makeUPVerify.vue

@@ -161,7 +161,9 @@ export default {
                         const operator = operatorMap[operatorKey]
                         if (operator) {
                             let condition
-                            if (operator === 'LIKE') {
+                            if (operatorKey === 'DG' || operatorKey === 'DL') {
+                                condition = `DATE(${field}) ${operator} '${value}'` // 添加 DATE 函数
+                            } else if (operator === 'LIKE') {
                                 condition = `${field} LIKE '%${value}%'` // LIKE 模糊查询
                             } else {
                                 condition = `${field} ${operator} '${value}'` // 其他操作符(=, <=, >=)
@@ -175,6 +177,12 @@ export default {
                     sql += ' WHERE ' + conditions.join(' AND ')
                 }
             }
+            // 添加排序
+            if (this.sorts.field) {
+                sql += ` ORDER BY ${this.sorts.field} ${this.sorts.order}`
+            } else {
+                sql += ` ORDER BY bian_zhi_shi_jian DESC` // 默认排序
+            }
             // 添加分页
             sql += ` LIMIT ${this.pagination.limit} OFFSET ${(this.pagination.currentPage - 1) * this.pagination.limit}`
             return sql
@@ -185,8 +193,16 @@ export default {
             this.loadData()
         },
         handleSortChange (sort) {
-            ActionUtils.setSorts(this.sorts, sort)
-            this.loadData()
+            // 解析排序参数
+            if (sort.sortBy && sort.order) {
+                this.sorts = {
+                    field: sort.sortBy,
+                    order: sort.order === 'ascending' ? 'ASC' : 'DESC' // 转换为 SQL 排序关键字
+                }
+            } else {
+                this.sorts = {} // 取消排序
+            }
+            this.loadData() // 重新加载数据
         },
 
         // 操作处理

+ 3 - 0
src/views/business/attendance/makeUpEdit.vue

@@ -208,6 +208,9 @@ export default {
         // 查询补卡日期下的异常数据
         handleBuKaRiQiChange (buKaRiQi) {
             const self = this
+            // 清空补卡班次、补卡时间
+            self.formData.buKaBanCi = ''
+            self.formData.buKaShiJian = ''
             queryAttendanceDetail(this.getSearchFormData()).then(async (res) => {
                 // ActionUtils.handleListData(this, res.data)
                 self.yichangdata = res.data.dataResult.filter(item => item.kaoQinZhuangTa === '异常' || item.kaoQinZhuangTa === '')

+ 19 - 3
src/views/business/attendance/makeUpRecords.vue

@@ -165,7 +165,9 @@ export default {
                         const operator = operatorMap[operatorKey]
                         if (operator) {
                             let condition
-                            if (operator === 'LIKE') {
+                            if (operatorKey === 'DG' || operatorKey === 'DL') {
+                                condition = `DATE(${field}) ${operator} '${value}'` // 添加 DATE 函数
+                            } else if (operator === 'LIKE') {
                                 condition = `${field} LIKE '%${value}%'` // LIKE 模糊查询
                             } else {
                                 condition = `${field} ${operator} '${value}'` // 其他操作符(=, <=, >=)
@@ -179,6 +181,12 @@ export default {
                     sql += ' WHERE ' + conditions.join(' AND ')
                 }
             }
+            // 添加排序
+            if (this.sorts.field) {
+                sql += ` ORDER BY ${this.sorts.field} ${this.sorts.order}`
+            } else {
+                sql += ` ORDER BY bian_zhi_shi_jian DESC` // 默认排序
+            }
             // 添加分页
             sql += ` LIMIT ${this.pagination.limit} OFFSET ${(this.pagination.currentPage - 1) * this.pagination.limit}`
             return sql
@@ -189,8 +197,16 @@ export default {
             this.loadData()
         },
         handleSortChange (sort) {
-            ActionUtils.setSorts(this.sorts, sort)
-            this.loadData()
+            // 解析排序参数
+            if (sort.sortBy && sort.order) {
+                this.sorts = {
+                    field: sort.sortBy,
+                    order: sort.order === 'ascending' ? 'ASC' : 'DESC' // 转换为 SQL 排序关键字
+                }
+            } else {
+                this.sorts = {} // 取消排序
+            }
+            this.loadData() // 重新加载数据
         },
 
         // 操作处理