From 19a02db65a717d22138a623a425040dfba292eb8 Mon Sep 17 00:00:00 2001
From: 小小儁爺 <1694218219@qq.com>
Date: 星期一, 09 九月 2024 14:41:53 +0800
Subject: [PATCH] 1.递交
---
src/views/attendanceModule/attendanceClockIn.vue | 349 ++++++------
src/views/attendanceModule/attendanceRecord.vue | 1163 ++++++++++++++++++++++----------------------
2 files changed, 761 insertions(+), 751 deletions(-)
diff --git a/src/views/attendanceModule/attendanceClockIn.vue b/src/views/attendanceModule/attendanceClockIn.vue
index 86f67dd..e3485b7 100644
--- a/src/views/attendanceModule/attendanceClockIn.vue
+++ b/src/views/attendanceModule/attendanceClockIn.vue
@@ -1,172 +1,177 @@
-<template>
- <div>
- <div class="body" :style="{height:mainHeight+'px'}">
-
- <div class="bodyTopFormGroup" style="margin-top: 10px;height: 50px;padding:5px 0;">
- <div class="elForm" style="align-items: center;padding:5px 0;">
- <div style="font-weight: bolder;font-size: 14px;margin: 0 15px;color: #606266">
- 宸ュ彿浜岀淮鐮�
- </div>
- <el-input
- v-model="form.usercode"
- :name="'usercodeInput'"
- placeholder="璇锋壂鎻忔垨杈撳叆宸ュ彿浜岀淮鐮�"
- style="width: 300px"
- @change="enterNative"
- />
- </div>
- </div>
-
- <div class="bodyTopButtonGroup" style="margin-top: 2px;height: 100px;align-items: center;">
- <el-form
- ref="form"
- :model="form"
- label-width="80px"
- inline
- style="display: flex;width: 50%;"
- >
- <div class="elForm">
- <el-form-item label="鍛樺伐缂栧彿:" style=" display: flex;">
- <div style="width: 200px;">{{ form2.usercode }}</div>
- </el-form-item>
- <el-form-item label="鍛樺伐濮撳悕:" style=" display: flex;">
- <div style="width: 200px;">{{ form2.username }}</div>
- </el-form-item>
- <el-form-item label="鎵�灞炶溅闂�:" style=" display: flex;">
- <div style="width: 200px;">{{ form2.torg_name }}</div>
- </el-form-item>
- <el-form-item label="鎵�灞炲矖浣�:" style=" display: flex;">
- <div style="width: 200px;">{{ form2.postname }}</div>
- </el-form-item>
- </div>
- </el-form>
- </div>
-
- <div class="elTableDiv">
- <el-table
- ref="tableDataRef"
- class="tableFixed"
- :data="tableData"
- :height="tableHeight+'px'"
- border
- row-class-name="custom-row"
- :style="{width: 100+'%',height:tableHeight+'px',}"
- highlight-current-row
- :header-cell-style="this.$headerCellStyle"
- :cell-style="this.$cellStyle"
- >
- <el-table-column
- type="index"
- width="50"
- fixed
- label="搴忓彿"
- />
- <el-table-column
- prop="wkshop_name"
- label="鎵�灞炶溅闂�"
- />
- <el-table-column
- prop="username"
- label="鎵撳崱浜哄憳"
- />
- <el-table-column
- prop="createdate"
- label="鎵撳崱鏃堕棿"
- />
- <el-table-column
- prop="workprice"
- label="宸ヤ环(鍏�/灏忔椂)"
- />
- </el-table>
- </div>
- <div
- class="bodyTopButtonGroup"
- style="margin-top: 0;height: 60px;display:flex;align-items: center;justify-content: center"
- >
- <el-button
- v-waves
- :disabled="isDisabled"
- type="primary"
- style="width: 150px;height: 40px;"
- icon="el-icon-alarm-clock"
- @click="clockIn"
- >鑰冨嫟鎵撳崱</el-button>
- </div>
-
- </div>
-
- </div>
-</template>
-
-<script>
-import elDragDialog from '@/directive/el-drag-dialog'
-import waves from '@/directive/waves'
-import { AttendanceSave, AttendanceSearch } from '@/api/attendanceModule'
-import $ from 'jquery'
-
-export default {
- name: 'AttendanceClockIn',
- directives: { elDragDialog, waves },
- data() {
- return {
- mainHeight: 0,
- tableHeight: 0,
- form: {
- usercode: ''
- },
- form2: {
-
- },
- tableData: [],
- isDisabled: true
- }
- },
- activated() {
window.addEventListener('resize', this.getHeight)
this.getHeight()
},
created() {
- },
- mounted() {
- window.addEventListener('resize', this.getHeight)
- this.getHeight()
- this.inputFocus()
- },
- methods: {
- inputFocus() {
- // this.$nextTick(() => {
- $('input[name=\'usercodeInput\']')[0].focus()
- // })
- },
- async enterNative(val) {
- const { data: res } = await AttendanceSearch({ usercode: val })
- this.form.usercode = ''
- if (res.userdate.length === 0 && res.checkcrd.length === 0) {
- this.$message.info('鏃犳鍛樺伐鍙凤紒')
- this.form2 = {}
- this.tableData = []
- this.isDisabled = true
- } else {
- this.form2 = res.userdate[0]
- this.tableData = res.checkcrd
- this.isDisabled = false
- }
- },
- async clockIn() {
- const data = {
- 'wkshop_code': this.form2.storg_code,
- 'user_code': this.form2.usercode
- }
- const res = await AttendanceSave(data)
- if (res.code === '200') {
- await this.enterNative(this.form2.usercode)
- }
- },
- // 鑾峰彇椤甸潰楂樺害
- getHeight() {
- this.$nextTick(() => {
- this.mainHeight = window.innerHeight - 85
- this.tableHeight = this.mainHeight - 250
- this.$refs.tableDataRef.doLayout()
- })
- }
- }
-}
-</script>
-
+<template>
+ <div>
+ <div class="body" :style="{height:mainHeight+'px'}">
+
+ <div class="bodyTopFormGroup" style="margin-top: 10px;height: 50px;padding:5px 0;">
+ <div class="elForm" style="align-items: center;padding:5px 0;">
+ <div style="font-weight: bolder;font-size: 14px;margin: 0 15px;color: #606266">
+ 宸ュ彿浜岀淮鐮�
+ </div>
+ <el-input
+ v-model="form.usercode"
+ :name="'usercodeInput'"
+ placeholder="璇锋壂鎻忔垨杈撳叆宸ュ彿浜岀淮鐮�"
+ style="width: 300px"
+ @change="enterNative"
+ />
+ </div>
+ </div>
+
+ <div class="bodyTopButtonGroup" style="margin-top: 2px;height: 100px;align-items: center;">
+ <el-form
+ ref="form"
+ :model="form"
+ label-width="80px"
+ inline
+ style="display: flex;width: 50%;"
+ >
+ <div class="elForm">
+ <el-form-item label="鍛樺伐缂栧彿:" style=" display: flex;">
+ <div style="width: 200px;">{{ form2.usercode }}</div>
+ </el-form-item>
+ <el-form-item label="鍛樺伐濮撳悕:" style=" display: flex;">
+ <div style="width: 200px;">{{ form2.username }}</div>
+ </el-form-item>
+ <el-form-item label="鎵�灞炶溅闂�:" style=" display: flex;">
+ <div style="width: 200px;">{{ form2.torg_name }}</div>
+ </el-form-item>
+ <el-form-item label="鎵�灞炲矖浣�:" style=" display: flex;">
+ <div style="width: 200px;">{{ form2.postname }}</div>
+ </el-form-item>
+ </div>
+ </el-form>
+ </div>
+
+ <div class="elTableDiv">
+ <el-table
+ ref="tableDataRef"
+ class="tableFixed"
+ :data="tableData"
+ :height="tableHeight+'px'"
+ border
+ row-class-name="custom-row"
+ :style="{width: 100+'%',height:tableHeight+'px',}"
+ highlight-current-row
+ :header-cell-style="this.$headerCellStyle"
+ :cell-style="this.$cellStyle"
+ >
+ <el-table-column
+ type="index"
+ width="50"
+ fixed
+ label="搴忓彿"
+ />
+ <el-table-column
+ prop="wkshop_name"
+ label="鎵�灞炶溅闂�"
+ />
+ <el-table-column
+ prop="username"
+ label="鎵撳崱浜哄憳"
+ />
+ <el-table-column
+ prop="createdate"
+ label="鎵撳崱鏃堕棿"
+ />
+ <el-table-column
+ prop="workprice"
+ label="宸ヤ环(鍏�/灏忔椂)"
+ />
+ </el-table>
+ </div>
+ <div
+ class="bodyTopButtonGroup"
+ style="margin-top: 0;height: 60px;display:flex;align-items: center;justify-content: center"
+ >
+ <el-button
+ v-waves
+ :disabled="isDisabled"
+ type="primary"
+ style="width: 150px;height: 40px;"
+ icon="el-icon-alarm-clock"
+ @click="clockIn"
+ >鑰冨嫟鎵撳崱</el-button>
+ </div>
+
+ </div>
+
+ </div>
+</template>
+
+<script>
+import elDragDialog from '@/directive/el-drag-dialog'
+import waves from '@/directive/waves'
+import { AttendanceSave, AttendanceSearch } from '@/api/attendanceModule'
+import $ from 'jquery'
+
+export default {
+ name: 'AttendanceClockIn',
+ directives: { elDragDialog, waves },
+ data() {
+ return {
+ mainHeight: 0,
+ tableHeight: 0,
+ form: {
+ usercode: ''
+ },
+ form2: {
+
+ },
+ tableData: [],
+ isDisabled: true
+ }
+ },
+ activated() {
+ window.addEventListener('resize', this.getHeight)
+ this.getHeight()
+ },
+ created() {
+ },
+ mounted() {
+ window.addEventListener('resize', this.getHeight)
+ this.getHeight()
+ this.inputFocus()
+ },
+ methods: {
+ inputFocus() {
+ // this.$nextTick(() => {
+ $('input[name=\'usercodeInput\']')[0].focus()
+ // })
+ },
+ async enterNative(val) {
+ const { data: res } = await AttendanceSearch({ usercode: val })
+ this.form.usercode = ''
+ if (res.userdate.length === 0 && res.checkcrd.length === 0) {
+ this.$message.info('鏃犳鍛樺伐鍙凤紒')
+ this.form2 = {}
+ this.tableData = []
+ this.isDisabled = true
+ } else {
+ this.form2 = res.userdate[0]
+ this.tableData = res.checkcrd
+ this.isDisabled = false
+ }
+ },
+ async clockIn() {
+ const data = {
+ 'wkshop_code': this.form2.storg_code,
+ 'user_code': this.form2.usercode
+ }
+ const res = await AttendanceSave(data)
+ if (res.code === '200') {
+ await this.enterNative(this.form2.usercode)
+ this.$message.success('鎵撳崱鎴愬姛锛�')
+ }
+ },
+ // 鑾峰彇椤甸潰楂樺害
+ getHeight() {
+ this.$nextTick(() => {
+ this.mainHeight = window.innerHeight - 85
+ this.tableHeight = this.mainHeight - 250
+ this.$refs.tableDataRef.doLayout()
+ })
+ }
+ }
+}
+</script>
+
diff --git a/src/views/attendanceModule/attendanceRecord.vue b/src/views/attendanceModule/attendanceRecord.vue
index 016c348..3b41a45 100644
--- a/src/views/attendanceModule/attendanceRecord.vue
+++ b/src/views/attendanceModule/attendanceRecord.vue
@@ -1,579 +1,584 @@
-<template>
- <div>
- <div class="body" :style="{height:mainHeight+'px'}">
- <div class="bodyTopButtonGroup" style="justify-content: space-between">
- <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button>
- <el-button
- v-waves
- type="success"
- icon="el-icon-circle-check"
- @click="clockCheck"
- >鑰冨嫟鏍哥畻
- </el-button>
- </div>
-
- <div class="bodyTopFormGroup">
- <el-form
- ref="form"
- :model="form"
- label-width="100px"
- inline
- style="display: flex;"
- >
- <div class="elForm">
- <el-form-item label="杞﹂棿鍚嶇О" style=" display: flex;">
- <el-select
- v-model="form.wkshop_code"
- style="width: 200px"
- placeholder="璇烽�夋嫨"
- >
- <el-option
- v-for="item in wkshopArr"
- :key="item.torg_code"
- :label="item.torg_name"
- :value="item.torg_code"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="鍒涘缓浜哄憳" style=" display: flex;">
- <el-select
- v-model="form.creatusercode"
- style="width: 200px"
- placeholder="璇烽�夋嫨"
- >
- <el-option
- v-for="item in creatuserArr"
- :key="item.usercode"
- :label="item.username"
- :value="item.usercode"
- />
- </el-select>
- </el-form-item>
-
- <el-form-item label="鍒涘缓鏃堕棿" style=" display: flex;">
- <el-date-picker
- v-model="form.creatdate"
- type="daterange"
- range-separator="~"
- class="timeMini"
- size="mini"
- style="width: 200px;display: flex;line-height: 34px;height: 34px;"
- :clearable="false"
- start-placeholder="寮�濮嬫棩鏈�"
- end-placeholder="缁撴潫鏃ユ湡"
- />
- </el-form-item>
- <el-form-item label="鏍哥畻鐘舵��" style=" display: flex;">
- <el-select
- v-model="form.status"
- style="width: 200px"
- placeholder="璇烽�夋嫨"
- >
- <el-option
- v-for="item in statusArr"
- :key="item.code"
- :label="item.name"
- :value="item.code"
- />
- </el-select>
- </el-form-item>
- </div>
- <div
- class="bodySearchReset"
- :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"
- >
- <el-button v-waves type="primary" icon="el-icon-search" @click="getAttendanceRecordSearch">鏌ヨ</el-button>
- <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button>
- </div>
- </el-form>
- <div
- class="bodyTopFormExpand"
- style="height:5px"
- >
- <!-- <svg-icon-->
- <!-- v-show="mouseHoverType==='mouseout'"-->
- <!-- style="cursor: pointer"-->
- <!-- :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"-->
- <!-- @mouseenter="mouseHoverType=$event.type"-->
- <!-- />-->
- <!-- <svg-icon-->
- <!-- v-show="mouseHoverType==='mouseenter'"-->
- <!-- style="cursor: pointer"-->
- <!-- :icon-class="!isExpandForm?'doubleDown':'doubleUp'"-->
- <!-- @click="isExpandForm=!isExpandForm"-->
- <!-- @mouseout="mouseHoverType=$event.type"-->
- <!-- />-->
- </div>
- </div>
-
- <div class="elTableDiv">
- <el-table
- ref="tableDataRef"
- class="tableFixed"
- :data="tableData"
- :height="tableHeight+'px'"
- border
- row-class-name="custom-row"
- :style="{width: 100+'%',height:tableHeight+'px',}"
- highlight-current-row
- :header-cell-style="this.$headerCellStyle"
- :cell-style="this.$cellStyle"
- @sort-change="sortChange"
- >
- <el-table-column
- prop="rowNum"
- width="50"
- fixed
- label="搴忓彿"
- />
- <el-table-column
- prop="wkshop_name"
- label="鎵�灞炶溅闂�"
- sortable="custom"
- />
- <el-table-column
- prop="username"
- label="鎵撳崱浜哄憳"
- sortable="custom"
- />
- <el-table-column
- prop="createdate"
- label="鎵撳崱鏃堕棿"
- sortable="custom"
- />
- <el-table-column
- prop="workprice"
- label="宸ヤ环(鍏�/灏忔椂)"
- sortable="custom"
- />
- <el-table-column
- prop="status"
- label="鏄惁宸叉牳绠�"
- sortable="custom"
- >
- <template slot-scope="{row}">
- <el-tag v-if="row.status==='Y'" size="small" type="success">宸叉牳绠�</el-tag>
- <el-tag v-if="row.status==='N'" size="small" type="info">鏈牳绠�</el-tag>
- </template>
- </el-table-column>
- <el-table-column
- label="鎿嶄綔"
- width="120"
- fixed="right"
- >
- <template slot-scope="{row}">
- <div class="operationClass">
- <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top">
- <i
- v-if="row.leve!==0"
- class="el-icon-edit-outline"
- :style="{color:$store.state.settings.theme}"
- @click="edit('edit',row)"
- />
- </el-tooltip>
- <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top">
- <i
- v-if="row.leve!==0"
- class="el-icon-delete"
- :style="{color:$store.state.settings.theme}"
- @click="del(row)"
- />
- </el-tooltip>
- </div>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <!--鍒嗛〉-->
- <pagination
- :total="total"
- :page.sync="form.page"
- :limit.sync="form.rows"
- align="right"
- layout="total,prev, pager, next,sizes,jumper"
- popper-class="select_bottom"
- @pagination="getAttendanceRecordSearch"
- />
- </div>
-
- <el-dialog
- v-el-drag-dialog
- :title="operation==='add'?'鏂板':'缂栬緫'"
- :visible.sync="dialogVisible"
- width="900px"
- :close-on-click-modal="false"
- top="15vh"
- @closed="handleClose"
- @close="handleClose"
- >
- <el-form
- ref="dialogForm"
- inline
- :rules="dialogFormRules"
- :model="dialogForm"
- label-width="140px"
- >
- <el-form-item label="杞﹂棿鍚嶇О" prop="wkshop_code">
- <el-select
- v-model="dialogForm.wkshop_code"
- style="width: 200px"
- placeholder="璇烽�夋嫨"
- :disabled="operation==='edit'"
- @change="wkshopChange"
- >
- <el-option
- v-for="item in wkshopArr"
- :key="item.torg_code"
- :label="item.torg_name"
- :value="item.torg_code"
- />
- </el-select>
- </el-form-item>
-
- <el-form-item label="鎵撳崱浜哄憳" prop="creatusercode">
- <el-select
- v-model="dialogForm.creatusercode"
- style="width: 200px"
- placeholder="璇烽�夋嫨"
- :disabled="dialogForm.wkshop_code===''||operation==='edit'"
- >
- <el-option
- v-for="item in creatuserArr2"
- :key="item.usercode"
- :label="item.username"
- :value="item.usercode"
- />
- </el-select>
- </el-form-item>
-
- <el-form-item label="鎵撳崱鏃堕棿" prop="creatdate">
- <el-date-picker
- v-model="dialogForm.creatdate"
- type="datetime"
- style="width: 200px;"
- :clearable="false"
- popper-class="popperClass"
- placeholder="閫夋嫨鏃ユ湡鏃堕棿"
- />
- </el-form-item>
-
- <!-- <el-form-item label="宸ヤ环(鍏�/灏忔椂)" prop="workprice">-->
- <!-- <el-input-->
- <!-- v-model="dialogForm.workprice"-->
- <!-- oninput="value=value.replace(/[^0-9.]/g,'')"-->
- <!-- style="width: 200px"-->
- <!-- />-->
- <!-- </el-form-item>-->
-
- </el-form>
- <span slot="footer" class="dialog-footer">
- <div class="footerButton">
- <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button>
- <el-button
- v-waves
- type="primary"
- :loading="$store.state.app.buttonIsDisabled"
- :disabled="$store.state.app.buttonIsDisabled"
- @click="dialogVisibleConfirm"
- >纭� 瀹�</el-button>
- </div>
- </span>
- </el-dialog>
-
- </div>
-</template>
-
-<script>
-import Pagination from '@/components/Pagination'
-import { handleDatetime, handleDatetime2 } from '@/utils/global'
-import elDragDialog from '@/directive/el-drag-dialog'
-import waves from '@/directive/waves'
-import { PersonPermissions, PrentOrganizationNoCompany, TorgPersonPermissions } from '@/api/GeneralBasicData'
-import {
- AttendanceRecordAddUpdate,
- AttendanceRecordDelete,
- AttendanceRecordSave,
- AttendanceRecordSearch
-} from '@/api/attendanceModule'
-
-export default {
- name: 'AttendanceSettings',
- components: {
- Pagination
- },
- directives: { elDragDialog, waves },
- data() {
- return {
- mainHeight: 0,
- tableHeight: 0,
- form: {
- wkshop_code: '',
- creatusercode: '',
- creatdate: [new Date(), new Date()],
- status: '',
- prop: 'createdate', // 鎺掑簭瀛楁
- order: 'desc', // 鎺掑簭瀛楁
- page: 1, // 绗嚑椤�
- rows: 20 // 姣忛〉澶氬皯鏉�
- },
- total: 10,
- tableData: [],
-
- wkshopArr: [],
- creatuserArr: [],
- creatuserArr2: [],
-
- statusArr: [
- { code: 'N', name: '鏈牳绠�' },
- { code: 'Y', name: '宸叉牳绠�' }
- ],
-
- dialogVisible: false,
- dialogForm: {
- 'id': '',
- 'wkshop_code': '',
- 'creatusercode': '',
- 'creatdate': '',
- 'status': ''
- },
- operation: '',
- dialogFormRules: {
- wkshop_code: [
- { required: true, message: '璇烽�夋嫨鎵�灞炶溅闂�', trigger: ['blur', 'change'] }
- ],
- creatusercode: [
- { required: true, message: '璇烽�夋嫨鎵撳崱浜哄憳', trigger: ['blur', 'change'] }
- ],
- creatdate: [
- { required: true, message: '璇烽�夋嫨鎵撳崱鏃堕棿', trigger: ['blur', 'change'] }
- ]
- }
-
- }
- },
- activated() {
window.addEventListener('resize', this.getHeight)
this.getHeight()
},
created() {
- this.getAttendanceRecordSearch()
- },
- async mounted() {
- window.addEventListener('resize', this.getHeight)
- this.getHeight()
- await this.getPrentOrganizationNoCompany()
- await this.getPersonPermissions()
- },
- methods: {
- async getPrentOrganizationNoCompany() {
- const { data: res } = await PrentOrganizationNoCompany()
- this.wkshopArr = res
- },
- async getPersonPermissions() {
- const { data: res } = await PersonPermissions()
- this.creatuserArr = res
- },
-
- async getAttendanceRecordSearch() {
- let tempDate = this.form.creatdate
- if (tempDate.length > 0) {
- tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1])
- }
-
- const data = {
- wkshop_code: this.form.wkshop_code,
- creatusercode: this.form.creatusercode,
- status: this.form.status,
- creatdate: tempDate,
- prop: this.form.prop,
- order: this.form.order,
- page: this.form.page,
- rows: this.form.rows
- }
- const res = await AttendanceRecordSearch(data)
- this.tableData = res.data
- this.total = res.count
- },
-
- // 鎺掑簭鏀瑰彉鏃�
- sortChange({ column, prop, order }) {
- if (order === 'descending') {
- order = 'desc'
- } else if (order === 'ascending') {
- order = 'asc'
- } else {
- order = 'desc'
- }
- this.form.order = order
- this.form.prop = prop
- this.getAttendanceRecordSearch()
- },
- // 閲嶇疆
- reset() {
- this.form.wkshop_code = ''
- this.form.creatusercode = ''
- this.form.creatdate = [new Date(), new Date()]
- this.form.status = ''
- this.getAttendanceRecordSearch()
- },
- // 鏂板鎸夐挳
- add(operation) {
- this.operation = operation
- this.dialogVisible = true
- this.dialogForm.status = 'N'
- },
- // 淇敼鎸夐挳
- async edit(operation, row) {
- this.operation = operation
- this.dialogVisible = true
- await this.wkshopChange(row.wkshop_code)
-
- this.$nextTick(() => {
- this.dialogForm.id = row.id
- this.dialogForm.wkshop_code = row.wkshop_code
- this.dialogForm.creatusercode = row.usercode
- this.dialogForm.creatdate = row.createdate
- this.dialogForm.status = row.status
- })
- },
- // 鍒犻櫎鎸夐挳
- async del(row) {
- this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', {
- confirmButtonText: '纭畾',
- cancelButtonText: '鍙栨秷',
- type: 'warning'
- }).then(() => {
- const data = {
- 'id': row.id,
- 'wkshop_code': row.wkshop_code,
- 'creatusercode': row.usercode,
- 'creatdate': row.createdate,
- 'status': row.status
- }
- AttendanceRecordDelete(data).then(res => {
- if (res.code === '200') {
- this.$notify.success('鍒犻櫎鎴愬姛!')
- if (this.form.page > 1 && this.tableData.length === 1) {
- this.form.page--
- }
- this.getAttendanceRecordSearch()
- }
- })
- }).catch(() => {
- this.$notify.info('宸插彇娑堝垹闄�')
- })
- },
- // 瀵硅瘽妗嗗叧闂簨浠�
- handleClose() {
- this.dialogForm.id = ''
- this.dialogForm.wkshop_code = ''
- this.dialogForm.creatusercode = ''
- this.dialogForm.creatdate = ''
- this.dialogForm.status = ''
- this.$refs.dialogForm.clearValidate()
- },
- // 瀵硅瘽妗嗗彇娑�
- dialogVisibleCancel() {
- this.dialogVisible = false
- },
-
- async wkshopChange(val) {
- const { data: res } = await TorgPersonPermissions({ torgcode: val })
- this.creatuserArr2 = res
- },
- // 瀵硅瘽妗嗙‘璁�
- dialogVisibleConfirm() {
- this.$refs.dialogForm.validate(valid => {
- if (valid) {
- this.$store.state.app.buttonIsDisabled = true
-
- const data = {
- 'id': this.dialogForm.id,
- 'wkshop_code': this.dialogForm.wkshop_code,
- 'creatusercode': this.dialogForm.creatusercode,
- 'creatdate': handleDatetime2(this.dialogForm.creatdate),
- 'status': this.dialogForm.status
- }
-
- AttendanceRecordAddUpdate(data, this.operation === 'add' ? 'Add' : 'Update').then(res => {
- if (res.code === '200') {
- this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�')
- this.dialogVisible = false
- this.$store.state.app.buttonIsDisabled = false
- this.getAttendanceRecordSearch()
- } else {
- this.$store.state.app.buttonIsDisabled = false
- this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�')
- }
- })
- }
- })
- },
- // 鑰冨嫟鏍哥畻
- async clockCheck() {
- let tempDate = this.form.creatdate
- if (tempDate.length > 0) {
- tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1])
- }
- const data = {
- wkshop_code: this.form.wkshop_code,
- creatusercode: this.form.creatusercode,
- status: 'Y',
- creatdate: tempDate
- }
- const res = await AttendanceRecordSave(data)
- if (res.code === '200') {
- return this.$message.success('鑰冨嫟鏍哥畻鎴愬姛锛�')
- }
- },
- // 鑾峰彇椤甸潰楂樺害
- getHeight() {
- this.$nextTick(() => {
- this.mainHeight = window.innerHeight - 85
- this.tableHeight = this.mainHeight - 200
- this.$refs.tableDataRef.doLayout()
- })
- }
- }
-}
-</script>
-<style scoped lang="scss">
-::v-deep .el-select__caret {
- display: flex;
- align-items: center;
- justify-content: center;
-}
-
-::v-deep .el-range__icon {
- line-height: 28px !important;
-}
-
-::v-deep .el-range-separator {
- line-height: 28px !important;
-}
-
-::v-deep .el-range-input {
- font-size: 14px;
-}
-
-::v-deep .el-range-separator {
- display: flex;
- justify-content: center;
- align-items: center;
-}
-
-::v-deep .el-progress-bar__innerText {
- display: none !important;
-}
-
-//.custom-table-class {
-// ::v-deep .el-table__row {
-// height: 80px;
-// line-height:80px;
-// }
-//}
-
-</style>
-
-<style>
- .el-picker-panel__footer {
- display: flex !important;
- justify-content: flex-end !important;
-}
-</style>
+<template>
+ <div>
+ <div class="body" :style="{height:mainHeight+'px'}">
+ <div class="bodyTopButtonGroup" style="justify-content: space-between">
+ <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button>
+ <el-button
+ v-waves
+ type="success"
+ icon="el-icon-circle-check"
+ @click="clockCheck"
+ >鑰冨嫟鏍哥畻
+ </el-button>
+ </div>
+
+ <div class="bodyTopFormGroup">
+ <el-form
+ ref="form"
+ :model="form"
+ label-width="100px"
+ inline
+ style="display: flex;"
+ >
+ <div class="elForm">
+ <el-form-item label="杞﹂棿鍚嶇О" style=" display: flex;">
+ <el-select
+ v-model="form.wkshop_code"
+ style="width: 200px"
+ placeholder="璇烽�夋嫨"
+ >
+ <el-option
+ v-for="item in wkshopArr"
+ :key="item.torg_code"
+ :label="item.torg_name"
+ :value="item.torg_code"
+ />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="鍒涘缓浜哄憳" style=" display: flex;">
+ <el-select
+ v-model="form.creatusercode"
+ style="width: 200px"
+ placeholder="璇烽�夋嫨"
+ >
+ <el-option
+ v-for="item in creatuserArr"
+ :key="item.usercode"
+ :label="item.username"
+ :value="item.usercode"
+ />
+ </el-select>
+ </el-form-item>
+
+ <el-form-item label="鍒涘缓鏃堕棿" style=" display: flex;">
+ <el-date-picker
+ v-model="form.creatdate"
+ type="daterange"
+ range-separator="~"
+ class="timeMini"
+ size="mini"
+ style="width: 200px;display: flex;line-height: 34px;height: 34px;"
+ :clearable="false"
+ start-placeholder="寮�濮嬫棩鏈�"
+ end-placeholder="缁撴潫鏃ユ湡"
+ />
+ </el-form-item>
+ <el-form-item label="鏍哥畻鐘舵��" style=" display: flex;">
+ <el-select
+ v-model="form.status"
+ style="width: 200px"
+ placeholder="璇烽�夋嫨"
+ >
+ <el-option
+ v-for="item in statusArr"
+ :key="item.code"
+ :label="item.name"
+ :value="item.code"
+ />
+ </el-select>
+ </el-form-item>
+ </div>
+ <div
+ class="bodySearchReset"
+ :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"
+ >
+ <el-button v-waves type="primary" icon="el-icon-search" @click="getAttendanceRecordSearch">鏌ヨ</el-button>
+ <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button>
+ </div>
+ </el-form>
+ <div
+ class="bodyTopFormExpand"
+ style="height:5px"
+ >
+ <!-- <svg-icon-->
+ <!-- v-show="mouseHoverType==='mouseout'"-->
+ <!-- style="cursor: pointer"-->
+ <!-- :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"-->
+ <!-- @mouseenter="mouseHoverType=$event.type"-->
+ <!-- />-->
+ <!-- <svg-icon-->
+ <!-- v-show="mouseHoverType==='mouseenter'"-->
+ <!-- style="cursor: pointer"-->
+ <!-- :icon-class="!isExpandForm?'doubleDown':'doubleUp'"-->
+ <!-- @click="isExpandForm=!isExpandForm"-->
+ <!-- @mouseout="mouseHoverType=$event.type"-->
+ <!-- />-->
+ </div>
+ </div>
+
+ <div class="elTableDiv">
+ <el-table
+ ref="tableDataRef"
+ class="tableFixed"
+ :data="tableData"
+ :height="tableHeight+'px'"
+ border
+ row-class-name="custom-row"
+ :style="{width: 100+'%',height:tableHeight+'px',}"
+ highlight-current-row
+ :header-cell-style="this.$headerCellStyle"
+ :cell-style="this.$cellStyle"
+ @sort-change="sortChange"
+ >
+ <el-table-column
+ prop="rowNum"
+ width="50"
+ fixed
+ label="搴忓彿"
+ />
+ <el-table-column
+ prop="wkshop_name"
+ label="鎵�灞炶溅闂�"
+ sortable="custom"
+ />
+ <el-table-column
+ prop="username"
+ label="鎵撳崱浜哄憳"
+ sortable="custom"
+ />
+ <el-table-column
+ prop="createdate"
+ label="鎵撳崱鏃堕棿"
+ sortable="custom"
+ />
+ <el-table-column
+ prop="workprice"
+ label="宸ヤ环(鍏�/灏忔椂)"
+ sortable="custom"
+ />
+ <el-table-column
+ prop="status"
+ label="鏄惁宸叉牳绠�"
+ sortable="custom"
+ >
+ <template slot-scope="{row}">
+ <el-tag v-if="row.status==='Y'" size="small" type="success">宸叉牳绠�</el-tag>
+ <el-tag v-if="row.status==='N'" size="small" type="info">鏈牳绠�</el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column
+ label="鎿嶄綔"
+ width="120"
+ fixed="right"
+ >
+ <template slot-scope="{row}">
+ <div class="operationClass">
+ <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top">
+ <i
+ v-if="row.leve!==0"
+ class="el-icon-edit-outline"
+ :style="{color:$store.state.settings.theme}"
+ @click="edit('edit',row)"
+ />
+ </el-tooltip>
+ <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top">
+ <i
+ v-if="row.leve!==0"
+ class="el-icon-delete"
+ :style="{color:$store.state.settings.theme}"
+ @click="del(row)"
+ />
+ </el-tooltip>
+ </div>
+ </template>
+ </el-table-column>
+ </el-table>
+ </div>
+ <!--鍒嗛〉-->
+ <pagination
+ :total="total"
+ :page.sync="form.page"
+ :limit.sync="form.rows"
+ align="right"
+ layout="total,prev, pager, next,sizes,jumper"
+ popper-class="select_bottom"
+ @pagination="getAttendanceRecordSearch"
+ />
+ </div>
+
+ <el-dialog
+ v-el-drag-dialog
+ :title="operation==='add'?'鏂板':'缂栬緫'"
+ :visible.sync="dialogVisible"
+ width="900px"
+ :close-on-click-modal="false"
+ top="15vh"
+ @closed="handleClose"
+ @close="handleClose"
+ >
+ <el-form
+ ref="dialogForm"
+ inline
+ :rules="dialogFormRules"
+ :model="dialogForm"
+ label-width="140px"
+ >
+ <el-form-item label="杞﹂棿鍚嶇О" prop="wkshop_code">
+ <el-select
+ v-model="dialogForm.wkshop_code"
+ style="width: 200px"
+ placeholder="璇烽�夋嫨"
+ :disabled="operation==='edit'"
+ @change="wkshopChange"
+ >
+ <el-option
+ v-for="item in wkshopArr"
+ :key="item.torg_code"
+ :label="item.torg_name"
+ :value="item.torg_code"
+ />
+ </el-select>
+ </el-form-item>
+
+ <el-form-item label="鎵撳崱浜哄憳" prop="creatusercode">
+ <el-select
+ v-model="dialogForm.creatusercode"
+ style="width: 200px"
+ placeholder="璇烽�夋嫨"
+ :disabled="dialogForm.wkshop_code===''||operation==='edit'"
+ >
+ <el-option
+ v-for="item in creatuserArr2"
+ :key="item.usercode"
+ :label="item.username"
+ :value="item.usercode"
+ />
+ </el-select>
+ </el-form-item>
+
+ <el-form-item label="鎵撳崱鏃堕棿" prop="creatdate">
+ <el-date-picker
+ v-model="dialogForm.creatdate"
+ type="datetime"
+ style="width: 200px;"
+ :clearable="false"
+ popper-class="popperClass"
+ placeholder="閫夋嫨鏃ユ湡鏃堕棿"
+ />
+ </el-form-item>
+
+ <!-- <el-form-item label="宸ヤ环(鍏�/灏忔椂)" prop="workprice">-->
+ <!-- <el-input-->
+ <!-- v-model="dialogForm.workprice"-->
+ <!-- oninput="value=value.replace(/[^0-9.]/g,'')"-->
+ <!-- style="width: 200px"-->
+ <!-- />-->
+ <!-- </el-form-item>-->
+
+ </el-form>
+ <span slot="footer" class="dialog-footer">
+ <div class="footerButton">
+ <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button>
+ <el-button
+ v-waves
+ type="primary"
+ :loading="$store.state.app.buttonIsDisabled"
+ :disabled="$store.state.app.buttonIsDisabled"
+ @click="dialogVisibleConfirm"
+ >纭� 瀹�</el-button>
+ </div>
+ </span>
+ </el-dialog>
+
+ </div>
+</template>
+
+<script>
+import Pagination from '@/components/Pagination'
+import { handleDatetime, handleDatetime2 } from '@/utils/global'
+import elDragDialog from '@/directive/el-drag-dialog'
+import waves from '@/directive/waves'
+import { PersonPermissions, PrentOrganizationNoCompany, TorgPersonPermissions } from '@/api/GeneralBasicData'
+import {
+ AttendanceRecordAddUpdate,
+ AttendanceRecordDelete,
+ AttendanceRecordSave,
+ AttendanceRecordSearch
+} from '@/api/attendanceModule'
+
+export default {
+ name: 'AttendanceSettings',
+ components: {
+ Pagination
+ },
+ directives: { elDragDialog, waves },
+ data() {
+ return {
+ mainHeight: 0,
+ tableHeight: 0,
+ form: {
+ wkshop_code: '',
+ creatusercode: '',
+ creatdate: [new Date(), new Date()],
+ status: '',
+ prop: 'createdate', // 鎺掑簭瀛楁
+ order: 'desc', // 鎺掑簭瀛楁
+ page: 1, // 绗嚑椤�
+ rows: 20 // 姣忛〉澶氬皯鏉�
+ },
+ total: 10,
+ tableData: [],
+
+ wkshopArr: [],
+ creatuserArr: [],
+ creatuserArr2: [],
+
+ statusArr: [
+ { code: 'N', name: '鏈牳绠�' },
+ { code: 'Y', name: '宸叉牳绠�' }
+ ],
+
+ dialogVisible: false,
+ dialogForm: {
+ 'id': '',
+ 'wkshop_code': '',
+ 'creatusercode': '',
+ 'creatdate': '',
+ 'status': ''
+ },
+ operation: '',
+ dialogFormRules: {
+ wkshop_code: [
+ { required: true, message: '璇烽�夋嫨鎵�灞炶溅闂�', trigger: ['blur', 'change'] }
+ ],
+ creatusercode: [
+ { required: true, message: '璇烽�夋嫨鎵撳崱浜哄憳', trigger: ['blur', 'change'] }
+ ],
+ creatdate: [
+ { required: true, message: '璇烽�夋嫨鎵撳崱鏃堕棿', trigger: ['blur', 'change'] }
+ ]
+ }
+
+ }
+ },
+ activated() {
+ window.addEventListener('resize', this.getHeight)
+ this.getHeight()
+ },
+ created() {
+ this.getAttendanceRecordSearch()
+ },
+ async mounted() {
+ window.addEventListener('resize', this.getHeight)
+ this.getHeight()
+ await this.getPrentOrganizationNoCompany()
+ await this.getPersonPermissions()
+ },
+ methods: {
+ async getPrentOrganizationNoCompany() {
+ const { data: res } = await PrentOrganizationNoCompany()
+ this.wkshopArr = res
+ },
+ async getPersonPermissions() {
+ const { data: res } = await PersonPermissions()
+ this.creatuserArr = res
+ },
+
+ async getAttendanceRecordSearch() {
+ let tempDate = this.form.creatdate
+ if (tempDate.length > 0) {
+ tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1])
+ }
+
+ const data = {
+ wkshop_code: this.form.wkshop_code,
+ creatusercode: this.form.creatusercode,
+ status: this.form.status,
+ creatdate: tempDate,
+ prop: this.form.prop,
+ order: this.form.order,
+ page: this.form.page,
+ rows: this.form.rows
+ }
+ const res = await AttendanceRecordSearch(data)
+ this.tableData = res.data
+ this.total = res.count
+ },
+
+ // 鎺掑簭鏀瑰彉鏃�
+ sortChange({ column, prop, order }) {
+ if (order === 'descending') {
+ order = 'desc'
+ } else if (order === 'ascending') {
+ order = 'asc'
+ } else {
+ order = 'desc'
+ }
+ this.form.order = order
+ this.form.prop = prop
+ this.getAttendanceRecordSearch()
+ },
+ // 閲嶇疆
+ reset() {
+ this.form.wkshop_code = ''
+ this.form.creatusercode = ''
+ this.form.creatdate = [new Date(), new Date()]
+ this.form.status = ''
+ this.getAttendanceRecordSearch()
+ },
+ // 鏂板鎸夐挳
+ add(operation) {
+ this.operation = operation
+ this.dialogVisible = true
+ this.dialogForm.status = 'N'
+ },
+ // 淇敼鎸夐挳
+ async edit(operation, row) {
+ this.operation = operation
+ this.dialogVisible = true
+ await this.wkshopChange(row.wkshop_code)
+
+ this.$nextTick(() => {
+ this.dialogForm.id = row.id
+ this.dialogForm.wkshop_code = row.wkshop_code
+ this.dialogForm.creatusercode = row.usercode
+ this.dialogForm.creatdate = row.createdate
+ this.dialogForm.status = row.status
+ })
+ },
+ // 鍒犻櫎鎸夐挳
+ async del(row) {
+ this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ const data = {
+ 'id': row.id,
+ 'wkshop_code': row.wkshop_code,
+ 'creatusercode': row.usercode,
+ 'creatdate': row.createdate,
+ 'status': row.status
+ }
+ AttendanceRecordDelete(data).then(res => {
+ if (res.code === '200') {
+ this.$notify.success('鍒犻櫎鎴愬姛!')
+ if (this.form.page > 1 && this.tableData.length === 1) {
+ this.form.page--
+ }
+ this.getAttendanceRecordSearch()
+ }
+ })
+ }).catch(() => {
+ this.$notify.info('宸插彇娑堝垹闄�')
+ })
+ },
+ // 瀵硅瘽妗嗗叧闂簨浠�
+ handleClose() {
+ this.dialogForm.id = ''
+ this.dialogForm.wkshop_code = ''
+ this.dialogForm.creatusercode = ''
+ this.dialogForm.creatdate = ''
+ this.dialogForm.status = ''
+ this.$refs.dialogForm.clearValidate()
+ },
+ // 瀵硅瘽妗嗗彇娑�
+ dialogVisibleCancel() {
+ this.dialogVisible = false
+ },
+
+ async wkshopChange(val) {
+ const { data: res } = await TorgPersonPermissions({ torgcode: val })
+ this.creatuserArr2 = res
+ },
+ // 瀵硅瘽妗嗙‘璁�
+ dialogVisibleConfirm() {
+ this.$refs.dialogForm.validate(valid => {
+ if (valid) {
+ this.$store.state.app.buttonIsDisabled = true
+
+ const data = {
+ 'id': this.dialogForm.id,
+ 'wkshop_code': this.dialogForm.wkshop_code,
+ 'creatusercode': this.dialogForm.creatusercode,
+ 'creatdate': handleDatetime2(this.dialogForm.creatdate),
+ 'status': this.dialogForm.status
+ }
+
+ AttendanceRecordAddUpdate(data, this.operation === 'add' ? 'Add' : 'Update').then(res => {
+ if (res.code === '200') {
+ this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�')
+ this.dialogVisible = false
+ this.$store.state.app.buttonIsDisabled = false
+ this.getAttendanceRecordSearch()
+ } else {
+ this.$store.state.app.buttonIsDisabled = false
+ this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�')
+ }
+ })
+ }
+ })
+ },
+ // 鑰冨嫟鏍哥畻
+ async clockCheck() {
+ let tempDate = this.form.creatdate
+ if (tempDate.length > 0) {
+ tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1])
+ }
+ const data = {
+ wkshop_code: this.form.wkshop_code,
+ creatusercode: this.form.creatusercode,
+ status: this.form.status,
+ creatdate: tempDate
+ }
+ const res = await AttendanceRecordSave(data)
+ if (res.code === '200') {
+ await this.getAttendanceRecordSearch()
+ return this.$message.success('鑰冨嫟鏍哥畻鎴愬姛锛�')
+ }
+ },
+ // 鑾峰彇椤甸潰楂樺害
+ getHeight() {
+ this.$nextTick(() => {
+ this.mainHeight = window.innerHeight - 85
+ this.tableHeight = this.mainHeight - 200
+ this.$refs.tableDataRef.doLayout()
+ })
+ }
+ }
+}
+</script>
+<style scoped lang="scss">
+::v-deep .el-select__caret {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+
+::v-deep .el-range__icon {
+ line-height: 28px !important;
+}
+
+::v-deep .el-range-separator {
+ line-height: 28px !important;
+}
+
+::v-deep .el-range-input {
+ font-size: 14px;
+}
+
+::v-deep .el-range-separator {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+}
+
+::v-deep .el-progress-bar__innerText {
+ display: none !important;
+}
+
+//.custom-table-class {
+// ::v-deep .el-table__row {
+// height: 80px;
+// line-height:80px;
+// }
+//}
+
+</style>
+
+<style>
+ .el-picker-panel__footer {
+ display: flex !important;
+ justify-content: flex-end !important;
+}
+</style>
--
Gitblit v1.9.3