Преглед на файлове

考勤功能-补卡查看详情

zhonghuizhen преди 1 година
родител
ревизия
7d3b2d7a26
променени са 3 файла, в които са добавени 157 реда и са изтрити 56 реда
  1. 108 13
      src/views/business/attendance/makeUPVerify.vue
  2. 28 29
      src/views/business/attendance/makeUpEdit.vue
  3. 21 14
      src/views/business/attendance/makeUpRecords.vue

+ 108 - 13
src/views/business/attendance/makeUPVerify.vue

@@ -18,16 +18,25 @@
             @row-dblclick="handleRowDblclick"
         >
         </ibps-crud>
+        <makeUpEdit
+            v-if="showMakeUpEdit"
+            :visible.sync="showMakeUpEdit"
+            :params="bukaInfo"
+            :readonly="readonly"
+            @close="() => {closeBuKaDialog()}"
+        />
     </div>
 </template>
 
 <script>
+import { saveAttendanceReissue, saveAttendanceDetail, getAttendanceDetail } from '@/api/business/attendance'
 import ActionUtils from '@/utils/action'
 import FixHeight from '@/mixins/height'
-import IbpsExport from '@/plugins/export'
-import color from '@/store/modules/ibps/modules/color'
 
 export default {
+    components: {
+        makeUpEdit: () => import('./makeUpEdit')
+    },
     mixins: [FixHeight],
     data () {
         const { userList = [], deptList = [] } = this.$store.getters || {}
@@ -45,6 +54,8 @@ export default {
                 currentPage: 1,
                 limit: 20
             },
+            showMakeUpEdit: false,
+            bukaInfo: {},
             sorts: {},
             listConfig: {
                 toolbars: [
@@ -62,21 +73,23 @@ export default {
                     ]
                 },
                 columns: [
-                    { prop: 'bianZhiRen', label: '申请人', tags: userOption, width: 80 },
-                    { prop: 'bianZhiShiJian', label: '申请时间', dateFormat: 'yyyy-MM-dd HH:mm', sortable: 'custom', width: 140 },
+                    { prop: 'bian_zhi_ren_', label: '申请人', tags: userOption, width: 80 },
+                    { prop: 'bian_zhi_shi_jian', label: '申请时间', dateFormat: 'yyyy-MM-dd HH:mm', sortable: 'custom', width: 140 },
                     // { prop: 'shenHeRen', label: '审核人', tags: userOption, dataType: 'stringArray', separator: ',', minWidth: 100 },
                     // { prop: 'shenHeShiJian', label: '审核时间', dateFormat: 'yyyy-MM-dd HH:mm', sortable: 'custom', width: 140 },
-                    { prop: 'zhuangTai', label: '状态', width: 90 },
-                    { prop: 'buKaRiQi', label: '补卡日期', dateFormat: 'yyyy-MM-dd', sortable: 'custom', width: 80 },
-                    { prop: 'buKaShiJian', label: '补卡时间', dateFormat: 'HH:mm', sortable: 'custom', width: 80 },
-                    { prop: 'buKaBanCi', label: '补卡班次', width: 80 },
-                    { prop: 'buKaShiYou', label: '补卡事由', width: 300 },
-                    { prop: 'fuJian', label: '说明附件', width: 150 }
+                    { prop: 'zhuang_tai_', label: '状态', width: 90 },
+                    { prop: 'bu_ka_ri_qi_', label: '补卡日期', dateFormat: 'yyyy-MM-dd', sortable: 'custom', width: 80 },
+                    { prop: 'bu_ka_shi_jian_', label: '补卡时间', dateFormat: 'HH:mm', sortable: 'custom', width: 80 },
+                    { prop: 'bu_ka_ban_ci_', label: '补卡班次', width: 80 },
+                    { prop: 'bu_ka_shi_you_', label: '补卡事由', width: 300 },
+                    { prop: 'fu_jian_', label: '说明附件', width: 150 }
                 ],
                 rowHandle: {
                     effect: 'default',
                     // effect: 'display',
                     actions: [
+                        { key: 'agree', label: '同意', type: 'success', icon: 'ibps-icon-check' },
+                        { key: 'disagree', label: '不同意', type: 'danger', icon: 'ibps-icon-close' },
                         { key: 'detail', label: '详情', type: 'primary', icon: 'ibps-icon-list-alt' }
                     ]
                 }
@@ -120,6 +133,7 @@ export default {
             const { first, second } = this.$store.getters.level || {}
             const searchParam = this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {}
             searchParam['Q^di_dian_^S'] = second || first
+            searchParam['Q^shen_he_ren_^S'] = this.$store.getters.userId
             return ActionUtils.formatParams(searchParam, this.pagination, this.sorts)
         },
         getSearchSql () {
@@ -173,17 +187,98 @@ export default {
         },
 
         // 操作处理
-        handleAction (command, _, selection) {
+        handleAction (command, position, selection, data) {
             switch (command) {
                 case 'search':
                     ActionUtils.setFirstPagination(this.pagination)
                     this.loadData()
                     break
+                case 'agree':
+                    this.handleAgree(command, data)
+                    break
+                case 'disagree':
+                    this.handleAgree(command, data)
+                    break
+                case 'detail':
+                    this.handleEdit(command, data)
+                    break
             }
         },
-        addData () {
-
+        /* 点击单条同意/不同意
+         */
+        async handleAgree (key, data) {
+            const self = this
+            let status = '未通过'
+            if (key === 'agree') {
+                status = '已通过'
+            }
+            const submitData = {
+                banCiZhuangTai: data.ban_ci_zhuang_tai || '',
+                bianZhiRen: data.bian_zhi_ren_ || '',
+                bianZhiShiJian: data.bian_zhi_shi_jian || '',
+                buKaBanCi: data.bu_ka_ban_ci_ || '',
+                buKaRiQi: data.bu_ka_ri_qi_ || '',
+                buKaShiJian: data.bu_ka_shi_jian_ || '',
+                buKaShiYou: data.bu_ka_shi_you_ || '',
+                createBy: data.create_by_ || '',
+                createTime: data.create_time_ || '',
+                diDian: data.di_dian_ || '',
+                fuJian: data.fu_jian_ || '',
+                id: data.id_ || '',
+                ip: data.ip_ || '',
+                kaoQinId: data.kao_qin_id_ || '',
+                paiBanId: data.pai_ban_id_ || '',
+                paiBanJiLuId: data.pai_ban_ji_lu_id_ || '',
+                shenHeRen: data.shen_he_ren_ || '',
+                shenHeShiJian: data.shen_he_shi_jian_ || '',
+                shenHeYiJian: data.shen_he_yi_jian_ || '',
+                tenantId: data.tenant_id_ || '',
+                updateBy: data.update_by_ || '',
+                updateTime: data.update_time_ || '',
+                zhuangTai: status
+            }
+            // 更新补卡数据
+            saveAttendanceReissue(submitData).then((res) => {
+                self.$message.success(`操作成功`)
+                self.loadData() // 刷新列表
+                if (key === 'agree') {
+                    // 更新考勤表
+                    self.updateAttendanceDetail(submitData)
+                }
+            })
+        },
+        // 更新考勤
+        updateAttendanceDetail (submitData) {
+            const self = this
+            getAttendanceDetail({ id: submitData.kaoQinId }).then((res) => { // 获取考勤明细
+                const updateData = res.data
+                if (submitData.buKaBanCi.includes('上班')) { // 更新上班数据
+                    updateData.zhuangTai1 = '正常'
+                    updateData.daKaShiJian1 = submitData.buKaShiJian
+                } else { // 更新下班数据
+                    updateData.zhuangTai2 = '正常'
+                    updateData.daKaShiJian2 = submitData.buKaShiJian
+                }
+                saveAttendanceDetail(updateData)
+            })
+        },
+        /**
+         * 处理编辑
+         */
+        async handleEdit (key, data) {
+            this.params = {
+                data,
+                action: key === 'detail' ? 'view' : 'edit'
+            }
+            this.bukaInfo = data
+            this.readonly = key === 'detail'
+            this.showMakeUpEdit = true
+        },
+        closeBuKaDialog () {
+            this.showMakeUpEdit = false
+            this.loadData()
         }
+
     }
 }
 </script>

+ 28 - 29
src/views/business/attendance/makeUpEdit.vue

@@ -31,7 +31,7 @@
                     placeholder="选择日期"
                     value-format="yyyy-MM-dd"
                     :picker-options="buKaRiQiPickerOptions"
-                    :disabled="isFromDetail"
+                    :disabled="readonly"
                     @change="handleBuKaRiQiChange"
                 />
             </el-form-item>
@@ -40,7 +40,7 @@
                 <el-select
                     v-model="formData.buKaBanCi"
                     placeholder="请选择班次"
-                    :disabled="isFromDetail"
+                    :disabled="readonly"
                     @focus="loadBuKaBanCiOptions"
                 >
                     <el-option
@@ -57,6 +57,7 @@
                     v-model="formData.buKaShiJian"
                     value-format="HH:mm"
                     placeholder="选择时间"
+                    :disabled="readonly"
                 />
             </el-form-item>
             <!-- 补卡事由 -->
@@ -67,6 +68,7 @@
                     :rows="3"
                     placeholder="请输入补卡原因"
                     maxlength="200"
+                    :disabled="readonly"
                     show-word-limit
                 />
             </el-form-item>
@@ -77,7 +79,7 @@
                     :download="true"
                     multiple
                     accept="*"
-                    :readonly="readonly"
+                    :disabled="readonly"
                     style="width:100%"
                 />
             </el-form-item>
@@ -88,7 +90,7 @@
     </el-dialog>
 </template>
 <script>
-import { queryAttendanceDetail, saveAttendanceReissue, saveAttendanceDetail } from '@/api/business/attendance'
+import { queryAttendanceDetail, saveAttendanceReissue } from '@/api/business/attendance'
 import IbpsAttachment from '@/business/platform/file/attachment/selector'
 import ActionUtils from '@/utils/action'
 export default {
@@ -101,6 +103,10 @@ export default {
         params: {
             type: Object,
             default: () => ({})
+        },
+        readonly: {
+            type: Boolean,
+            default: false
         }
     },
     data () {
@@ -109,7 +115,6 @@ export default {
             submitting: false,
             dialogVisible: this.visible,
             title: '补卡申请',
-            isFromDetail: false,
             formData: {
                 buKaRiQi: '',
                 buKaBanCi: '',
@@ -146,9 +151,23 @@ export default {
         }
     },
     mounted () {
-        this.initFromParams()
+        this.init()
     },
     methods: {
+        init () {
+            const isEmpty = Object.keys(this.params).length === 0
+            // 查阅状态初始化
+            if (!isEmpty) {
+                this.buKaBanCiOptions = [{ label: this.params.bu_ka_ban_ci_, value: this.params.bu_ka_ban_ci_ }]
+                this.formData = {
+                    buKaRiQi: this.params.bu_ka_ri_qi_ || '',
+                    buKaBanCi: this.params.bu_ka_ban_ci_ || '',
+                    buKaShiJian: this.params.bu_ka_shi_jian_ || '',
+                    buKaShiYou: this.params.bu_ka_shi_you_ || '',
+                    fuJian: this.params.fu_jian_ || ''
+                }
+            }
+        },
         /**
          * 异常考勤查询参数
          */
@@ -191,13 +210,6 @@ export default {
             }).catch(() => {
             })
         },
-        initFromParams () {
-            if (this.params.source === 'buKaBanCiDetail') {
-                this.isFromDetail = true
-                this.formData.buKaRiQi = this.defaultbuKaRiQi
-                this.formData.buKaBanCi = this.defaultbuKaBanCi
-            }
-        },
         async loadBuKaBanCiOptions () {
             if (!this.formData.buKaRiQi) {
                 this.$message.warning('请先选择补卡日期')
@@ -272,26 +284,13 @@ export default {
 
                     // 提交数据
                     saveAttendanceReissue(submitData).then((res) => {
-                        // 更新考勤表
-                        this.updateAttendanceDetail(submitData, updateObj, updateData)
+                        self.$message.success(`申请成功`)
+                        // 关闭弹窗,更新列表数据
+                        this.closeDialog()
                     })
                 })
             })
         },
-        updateAttendanceDetail (submitData, updateObj, updateData) {
-            const self = this
-            if (updateObj.value.includes('上班')) { // 更新上班数据
-                updateData.zhuangTai1 = '正常'
-                updateData.daKaShiJian1 = submitData.buKaShiJian
-            } else { // 更新下班数据
-                updateData.zhuangTai2 = '正常'
-                updateData.daKaShiJian2 = submitData.buKaShiJian
-            }
-            saveAttendanceDetail(updateData).then(async (res) => {
-                self.$message.success(`补卡成功`)
-                self.closeDialog()
-            })
-        },
         handleCancel () {
             this.closeDialog()
         },

+ 21 - 14
src/views/business/attendance/makeUpRecords.vue

@@ -21,10 +21,9 @@
         <makeUpEdit
             v-if="showMakeUpEdit"
             :visible.sync="showMakeUpEdit"
-            :params="params"
+            :params="bukaInfo"
             :readonly="readonly"
-            @refresh="loadData"
-            @close="() => showMakeUpEdit = false"
+            @close="() => {closeBuKaDialog()}"
         />
     </div>
 </template>
@@ -58,6 +57,7 @@ export default {
             },
             showMakeUpEdit: false,
             params: {},
+            bukaInfo: {},
             sorts: {},
             listConfig: {
                 toolbars: [
@@ -76,16 +76,16 @@ export default {
                     ]
                 },
                 columns: [
-                    { prop: 'bianZhiRen', label: '申请人', tags: userOption, width: 80 },
-                    { prop: 'bianZhiShiJian', label: '申请时间', dateFormat: 'yyyy-MM-dd HH:mm', sortable: 'custom', width: 140 },
+                    { prop: 'bian_zhi_ren_', label: '申请人', tags: userOption, width: 80 },
+                    { prop: 'bian_zhi_shi_jian', label: '申请时间', dateFormat: 'yyyy-MM-dd HH:mm', sortable: 'custom', width: 140 },
                     // { prop: 'shenHeRen', label: '审核人', tags: userOption, dataType: 'stringArray', separator: ',', minWidth: 100 },
                     // { prop: 'shenHeShiJian', label: '审核时间', dateFormat: 'yyyy-MM-dd HH:mm', sortable: 'custom', width: 140 },
-                    { prop: 'zhuangTai', label: '状态', width: 90 },
-                    { prop: 'buKaRiQi', label: '补卡日期', dateFormat: 'yyyy-MM-dd', sortable: 'custom', width: 80 },
-                    { prop: 'buKaShiJian', label: '补卡时间', dateFormat: 'HH:mm', sortable: 'custom', width: 80 },
-                    { prop: 'buKaBanCi', label: '补卡班次', width: 80 },
-                    { prop: 'buKaShiYou', label: '补卡事由', width: 300 },
-                    { prop: 'fuJian', label: '说明附件', width: 150 }
+                    { prop: 'zhuang_tai_', label: '状态', width: 90 },
+                    { prop: 'bu_ka_ri_qi_', label: '补卡日期', dateFormat: 'yyyy-MM-dd', sortable: 'custom', width: 80 },
+                    { prop: 'bu_ka_shi_jian_', label: '补卡时间', dateFormat: 'HH:mm', sortable: 'custom', width: 80 },
+                    { prop: 'bu_ka_ban_ci_', label: '补卡班次', width: 80 },
+                    { prop: 'bu_ka_shi_you_', label: '补卡事由', width: 300 },
+                    { prop: 'fu_jian_', label: '说明附件', width: 150 }
                 ],
                 rowHandle: {
                     effect: 'default',
@@ -199,19 +199,26 @@ export default {
                 case 'add':
                     this.handleEdit(command, {})
                     break
+                case 'detail':
+                    this.handleEdit(command, data)
+                    break
             }
         },
         /**
          * 处理编辑
          */
-        async handleEdit (key, { id, scheduleId }) {
+        async handleEdit (key, data) {
             this.params = {
-                id,
-                scheduleId,
+                data,
                 action: key === 'detail' ? 'view' : 'edit'
             }
+            this.bukaInfo = data
             this.readonly = key === 'detail'
             this.showMakeUpEdit = true
+        },
+        closeBuKaDialog () {
+            this.showMakeUpEdit = false
+            this.loadData()
         }
     }
 }