Przeglądaj źródła

考勤-优化姓名查询为弹窗选择

zhonghuizhen 11 miesięcy temu
rodzic
commit
5bd3beb894

+ 23 - 3
src/views/business/attendance/attendanceDetails.vue

@@ -30,6 +30,17 @@
                     value-format="yyyy-MM-dd"
                 />
             </template>
+            <template slot="userSlot">
+                <ibps-user-selector
+                    v-model="searchXinMing"
+                    type="user"
+                    readonly-text="text"
+                    :multiple="true"
+                    size="mini"
+                    :filter="filter"
+                    filtrate
+                />
+            </template>
             <!-- 自定义多级表头 -->
             <template #prepend-column>
                 <el-table-column key="userName" prop="userName" label="姓名" width="110">
@@ -98,9 +109,13 @@
 import ActionUtils from '@/utils/action'
 import FixHeight from '@/mixins/height'
 import IbpsExport from '@/plugins/export'
+import ibpsUserSelector from '@/business/platform/org/selector'
 import color from '@/store/modules/ibps/modules/color'
 
 export default {
+    components: {
+        ibpsUserSelector
+    },
     mixins: [FixHeight],
     data () {
         const { userList = [], deptList = [] } = this.$store.getters || {}
@@ -121,6 +136,7 @@ export default {
             },
             sorts: {},
             daterRange: [],
+            searchXinMing: '',
             pickerOptions: {
                 disabledDate (time) {
                     const today = new Date()
@@ -139,7 +155,8 @@ export default {
                     itemWidth: 200,
                     forms: [
                         { prop: 'Q^kao_qin_zhuang_ta^SL', label: '考勤状态', fieldType: 'select', options: [{ value: '正常', label: '正常' }, { value: '异常', label: '异常' }] },
-                        { prop: 'Q^yong_hu_id_^S', label: '姓名', fieldType: 'select', options: userOption },
+                        // { prop: 'Q^yong_hu_id_^S', label: '姓名', fieldType: 'select', options: userOption },
+                        { prop: '', label: '姓名', fieldType: 'slot', slotName: 'userSlot' },
                         { prop: 'Q^gong_hao_^S', label: '工号' },
                         { prop: 'Q^bu_men_^SL', label: '部门', fieldType: 'select', options: deptOption },
                         { prop: 'Q^pai_ban_ming_chen^SL', label: '排班名称' },
@@ -231,8 +248,11 @@ export default {
                     }
                 })
 
-                if (conditions.length > 0) {
-                    const wherestr = ' WHERE ' + conditions.join(' AND ')
+                if (conditions.length > 0) { // 正常查询条件一定会大于0,因为地点必查
+                    let wherestr = ' WHERE ' + conditions.join(' AND ')
+                    if (this.searchXinMing) {
+                        wherestr += `and yong_hu_id_ in ('` + this.searchXinMing.split(',').join("','") + `')`
+                    }
                     sql = `select t.*, (select COUNT(*) FROM t_attendance_detail ${wherestr} ) AS total_count FROM t_attendance_detail t ${wherestr}  ORDER BY ri_qi_ DESC `
                 }
             }

+ 21 - 2
src/views/business/attendance/attendanceOverview.vue

@@ -30,6 +30,17 @@
                     value-format="yyyy-MM-dd"
                 />
             </template>
+            <template slot="userSlot">
+                <ibps-user-selector
+                    v-model="searchXinMing"
+                    type="user"
+                    readonly-text="text"
+                    :multiple="true"
+                    size="mini"
+                    :filter="filter"
+                    filtrate
+                />
+            </template>
             <!-- 自定义多级表头 -->
             <template #prepend-column>
                 <el-table-column key="ri_qi_" prop="ri_qi_" label="日期" width="110" />
@@ -76,9 +87,13 @@
 import ActionUtils from '@/utils/action'
 import FixHeight from '@/mixins/height'
 import IbpsExport from '@/plugins/export'
+import ibpsUserSelector from '@/business/platform/org/selector'
 import color from '@/store/modules/ibps/modules/color'
 
 export default {
+    components: {
+        ibpsUserSelector
+    },
     mixins: [FixHeight],
     data () {
         const { userList = [], deptList = [] } = this.$store.getters || {}
@@ -99,6 +114,7 @@ export default {
             },
             sorts: {},
             daterRange: [],
+            searchXinMing: '',
             pickerOptions: {
                 disabledDate (time) {
                     const today = new Date()
@@ -117,7 +133,7 @@ export default {
                     forms: [
                         { prop: '', label: '日期范围', fieldType: 'slot', slotName: 'time' },
                         // { prop: 'Q^kao_qin_zhuang_ta^SL', label: '考勤状态', fieldType: 'select', options: [{ value: '正常', label: '正常' }, { value: '异常', label: '异常' }] },
-                        { prop: 'Q^yong_hu_id_^S', label: '姓名', fieldType: 'select', options: userOption },
+                        { prop: '', label: '姓名', fieldType: 'slot', slotName: 'userSlot' },
                         { prop: 'Q^bu_men_^SL', label: '部门', fieldType: 'select', options: deptOption }
                     ]
                 },
@@ -201,7 +217,10 @@ export default {
                 })
 
                 if (conditions.length > 0) {
-                    const wherestr = ' WHERE ' + conditions.join(' AND ')
+                    let wherestr = ' WHERE ' + conditions.join(' AND ')
+                    if (this.searchXinMing) {
+                        wherestr += `and yong_hu_id_ in ('` + this.searchXinMing.split(',').join("','") + `')`
+                    }
                     sql = `select 
                             t.*,
                             (select COUNT(DISTINCT USER_ID_) 

+ 21 - 2
src/views/business/attendance/attendanceStatistics.vue

@@ -30,6 +30,17 @@
                     value-format="yyyy-MM-dd"
                 />
             </template>
+            <template slot="userSlot">
+                <ibps-user-selector
+                    v-model="searchXinMing"
+                    type="user"
+                    readonly-text="text"
+                    :multiple="true"
+                    size="mini"
+                    :filter="filter"
+                    filtrate
+                />
+            </template>
             <!-- 自定义多级表头 -->
             <template #prepend-column>
                 <el-table-column key="user_name_" prop="user_name_" label="姓名" width="110">
@@ -103,10 +114,14 @@
 import ActionUtils from '@/utils/action'
 import FixHeight from '@/mixins/height'
 import IbpsExport from '@/plugins/export'
+import ibpsUserSelector from '@/business/platform/org/selector'
 import color from '@/store/modules/ibps/modules/color'
 import { mount } from 'sortablejs'
 
 export default {
+    components: {
+        ibpsUserSelector
+    },
     mixins: [FixHeight],
     data () {
         const { userList = [], deptList = [] } = this.$store.getters || {}
@@ -127,6 +142,7 @@ export default {
             },
             sorts: {},
             daterRange: [],
+            searchXinMing: '',
             pickerOptions: {
                 disabledDate (time) {
                     const today = new Date()
@@ -144,7 +160,7 @@ export default {
                     labelWidth: 100,
                     forms: [
                         { prop: '', label: '日期范围', fieldType: 'slot', slotName: 'time' },
-                        { prop: 'Q^yong_hu_id_^S', label: '姓名', fieldType: 'select', options: userOption },
+                        { prop: '', label: '姓名', fieldType: 'slot', slotName: 'userSlot' },
                         { prop: 'Q^gong_hao_^S', label: '工号' },
                         { prop: 'Q^bu_men_^SL', label: '部门', fieldType: 'select', options: deptOption }
                     ]
@@ -229,7 +245,10 @@ export default {
                 })
 
                 if (conditions.length > 0) {
-                    const wherestr = ' WHERE ' + conditions.join(' AND ')
+                    let wherestr = ' WHERE ' + conditions.join(' AND ')
+                    if (this.searchXinMing) {
+                        wherestr += `and yong_hu_id_ in ('` + this.searchXinMing.split(',').join("','") + `')`
+                    }
                     sql = `select 
                         (select COUNT(DISTINCT USER_ID_) 
                             FROM v_attendance_statistics