From c0e9df213221d16f6ab6c9106ae01ad571cd45fc Mon Sep 17 00:00:00 2001
From: 小小儁爺 <1694218219@qq.com>
Date: 星期五, 15 十一月 2024 09:08:02 +0800
Subject: [PATCH] 1.考勤打卡递交

---
 src/views/attendanceModule/attendanceMonth.vue |  600 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 597 insertions(+), 3 deletions(-)

diff --git a/src/views/attendanceModule/attendanceMonth.vue b/src/views/attendanceModule/attendanceMonth.vue
index e33c05d..b86eba5 100644
--- a/src/views/attendanceModule/attendanceMonth.vue
+++ b/src/views/attendanceModule/attendanceMonth.vue
@@ -1,13 +1,607 @@
 <template>
-  <div>3212</div>
+  <div>
+    <div class="body" :style="{height:mainHeight+'px'}">
+      <div class="bodyTopButtonGroup">
+        <el-button v-waves type="primary" icon="el-icon-download" @click="download">瀵煎嚭</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-date-picker
+                v-model="form.creatdate"
+                type="monthrange"
+                range-separator="~"
+                start-placeholder="寮�濮嬫湀浠�"
+                end-placeholder="缁撴潫鏈堜唤"
+                style="width: 200px;"
+                :clearable="false"
+              />
+              <!--              <el-date-picker-->
+              <!--                v-model="form.wkshop_code"-->
+              <!--                type="months"-->
+              <!--                placeholder="閫夋嫨涓�涓垨澶氫釜鏈�"-->
+              <!--              />-->
+            </el-form-item>
+
+            <!--            <el-form-item label="鍒涘缓浜哄憳" style=" display: flex;">-->
+            <!--              <el-select-->
+            <!--                v-model="form.creatuser"-->
+            <!--                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>-->
+
+          </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="getMonthlyWageReportSearch">鏌ヨ</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="TotalWorkCount"
+            label="鎬诲伐浣滄椂闀�(灏忔椂)"
+            sortable="custom"
+          />
+          <el-table-column
+            prop="workprice"
+            label="姣忓皬鏃跺崟浠�(鍏�)"
+            sortable="custom"
+          />
+          <el-table-column
+            prop="TotalOverCount"
+            label="鎬诲姞鐝椂闀�(灏忔椂)"
+            sortable="custom"
+          />
+          <el-table-column
+            prop="overprice"
+            label="鍔犵彮姣忓皬鏃跺崟浠�(鍏�)"
+            sortable="custom"
+          />
+          <el-table-column
+            prop="TotalWorkValue"
+            label="鎬诲伐浣滃伐璧�(鍏�)"
+            sortable="custom"
+          />
+          <el-table-column
+            prop="TotalOverValue"
+            label="鎬诲姞鐝伐璧�(鍏�)"
+            sortable="custom"
+          />
+          <el-table-column
+            prop="TotalTimedMoney"
+            label="鎬昏鏃跺伐璧�(鍏�)"
+            sortable="custom"
+          />
+          <!--          <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="getMonthlyWageReportSearch"
+      />
+    </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="璇烽�夋嫨"
+          >
+            <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="opacity: 0">
+          <!--          <el-select-->
+          <!--            v-model="dialogForm.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="涓婄彮鏃堕棿" prop="workhouse">
+          <el-time-select
+            v-model="dialogForm.workhouse"
+            placeholder="涓婄彮鏃堕棿"
+            style="width: 200px"
+            :picker-options="{
+              start: '06:30',
+              step: '00:15',
+              end: '18:30'
+            }"
+          />
+        </el-form-item>
+
+        <el-form-item label="涓嬬彮鏃堕棿" prop="closehouse">
+          <el-time-select
+            v-model="dialogForm.closehouse"
+            placeholder="涓嬬彮鏃堕棿"
+            style="width: 200px"
+            :picker-options="{
+              start: '06:30',
+              step: '00:15',
+              end: '18:30',
+              minTime: dialogForm.workhouse
+            }"
+          />
+        </el-form-item>
+        <el-form-item label="涓婄彮鍚庣疆(鍒嗛挓)" prop="uphouse">
+          <el-input
+            v-model="dialogForm.uphouse"
+            oninput="value=value.replace(/[^0-9.]/g,'')"
+            style="width: 200px"
+          />
+        </el-form-item>
+        <el-form-item label="涓嬬彮鍓嶇疆(鍒嗛挓)" prop="downhouse">
+          <el-input
+            v-model="dialogForm.downhouse"
+            oninput="value=value.replace(/[^0-9.]/g,'')"
+            style="width: 200px"
+          />
+        </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-item label="鍔犵彮宸ヤ环(鍏�/灏忔椂)" prop="overprice">
+          <el-input
+            v-model="dialogForm.overprice"
+            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 { handleDatetime4 } from '@/utils/global'
+import elDragDialog from '@/directive/el-drag-dialog'
+import waves from '@/directive/waves'
+import { PersonPermissions, PrentOrganizationNoCompany } from '@/api/GeneralBasicData'
+import {
+  AttendanceSettAddUpdate,
+  AttendanceSettDelete,
+  MonthlyWageReportExcelSearch,
+  MonthlyWageReportSearch
+} from '@/api/attendanceModule'
+
 export default {
-  name: 'AttendanceMonth'
+  name: 'AttendanceMonth',
+  components: {
+    Pagination
+  },
+  directives: { elDragDialog, waves },
+  data() {
+    return {
+      mainHeight: 0,
+      tableHeight: 0,
+      form: {
+        wkshop_code: '',
+        creatdate: [new Date(), new Date()],
+        prop: 'wkshop_name', // 鎺掑簭瀛楁
+        order: 'desc', // 鎺掑簭瀛楁
+        page: 1, // 绗嚑椤�
+        rows: 20 // 姣忛〉澶氬皯鏉�
+      },
+      total: 10,
+      tableData: [],
+
+      wkshopArr: [],
+      creatuserArr: [],
+
+      dialogVisible: false,
+      dialogForm: {
+        'wkshop_code': '',
+        'workhouse': '',
+        'closehouse': '',
+        'workprice': '',
+        'overprice': '',
+        'uphouse': '',
+        'downhouse': ''
+      },
+      operation: '',
+      dialogFormRules: {
+        wkshop_code: [
+          { required: true, message: '璇烽�夋嫨鎵�灞炶溅闂�', trigger: ['blur', 'change'] }
+        ],
+        workhouse: [
+          { required: true, message: '璇烽�夋嫨涓婄彮鏃堕棿', trigger: ['blur', 'change'] }
+        ],
+        closehouse: [
+          { required: true, message: '璇烽�夋嫨涓嬬彮鏃堕棿', trigger: ['blur', 'change'] }
+        ],
+        uphouse: [
+          { required: true, message: '璇疯緭鍏ヤ笂鐝悗缃�', trigger: ['blur', 'change'] }
+        ],
+        downhouse: [
+          { required: true, message: '璇疯緭鍏ヤ笅鐝悗缃�', trigger: ['blur', 'change'] }
+        ],
+        workprice: [
+          { required: true, message: '璇疯緭鍏ヤ笂鐝伐浠�', trigger: ['blur', 'change'] }
+        ],
+        overprice: [
+          { required: true, message: '璇疯緭鍏ュ姞鐝伐浠�', trigger: ['blur', 'change'] }
+        ]
+      }
+
+    }
+  },
+  activated() {
+    window.addEventListener('resize', this.getHeight)
+    this.getHeight()
+  },
+  created() {
+    this.getMonthlyWageReportSearch()
+  },
+  async mounted() {
+    window.addEventListener('resize', this.getHeight)
+    this.getHeight()
+    await this.getPrentOrganizationNoCompany()
+    // await this.getPersonPermissions()
+
+    this.getLastDayOfCurrentMonth()
+  },
+  methods: {
+    async getPrentOrganizationNoCompany() {
+      const { data: res } = await PrentOrganizationNoCompany()
+      this.wkshopArr = res
+    },
+    async getPersonPermissions() {
+      const { data: res } = await PersonPermissions()
+      this.creatuserArr = res
+    },
+
+    async getMonthlyWageReportSearch() {
+      let tempDate = this.form.creatdate
+      if (tempDate.length > 0) {
+        tempDate = handleDatetime4(tempDate[0]) + '-01' + '~' + this.getLastDayOfCurrentMonth(handleDatetime4(tempDate[1]))
+      }
+      const data = {
+        wkshop_code: this.form.wkshop_code,
+        creatdate: tempDate,
+        prop: this.form.prop,
+        order: this.form.order,
+        page: this.form.page,
+        rows: this.form.rows
+      }
+      const res = await MonthlyWageReportSearch(data)
+      this.tableData = res.data
+      this.total = res.count
+    },
+    getLastDayOfCurrentMonth(value) {
+      const now = new Date(value)
+      const lastDayOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0)
+      return lastDayOfMonth.getFullYear() + '-' + (lastDayOfMonth.getMonth() + 1) + '-' + lastDayOfMonth.getDate()
+    },
+
+    // 鎺掑簭鏀瑰彉鏃�
+    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.getMonthlyWageReportSearch()
+    },
+    // 閲嶇疆
+    reset() {
+      this.form.wkshop_code = ''
+      this.form.creatdate = [new Date(), new Date()]
+      this.getMonthlyWageReportSearch()
+    },
+    // 鏂板鎸夐挳
+    add(operation) {
+      this.operation = operation
+      this.dialogVisible = true
+    },
+    // 淇敼鎸夐挳
+    async edit(operation, row) {
+      this.operation = operation
+      this.dialogVisible = true
+      this.$nextTick(() => {
+        this.dialogForm.wkshop_code = row.wkshop_code
+        this.dialogForm.workhouse = row.workhouse
+        this.dialogForm.closehouse = row.closehouse
+        this.dialogForm.workprice = row.workprice
+        this.dialogForm.overprice = row.overprice
+        this.dialogForm.uphouse = row.uphouse
+        this.dialogForm.downhouse = row.downhouse
+      })
+    },
+    // 鍒犻櫎鎸夐挳
+    async del(row) {
+      this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', {
+        confirmButtonText: '纭畾',
+        cancelButtonText: '鍙栨秷',
+        type: 'warning'
+      }).then(() => {
+        const data = {
+          'wkshop_code': row.wkshop_code,
+          'workhouse': row.workhouse,
+          'closehouse': row.closehouse,
+          'workprice': row.workprice,
+          'overprice': row.overprice,
+          'uphouse': row.uphouse,
+          'downhouse': row.downhouse
+        }
+        AttendanceSettDelete(data).then(res => {
+          if (res.code === '200') {
+            this.$notify.success('鍒犻櫎鎴愬姛!')
+            if (this.form.page > 1 && this.tableData.length === 1) {
+              this.form.page--
+            }
+            this.getMonthlyWageReportSearch()
+          }
+        })
+      }).catch(() => {
+        this.$notify.info('宸插彇娑堝垹闄�')
+      })
+    },
+    // 瀵硅瘽妗嗗叧闂簨浠�
+    handleClose() {
+      this.dialogForm.wkshop_code = ''
+      this.dialogForm.workhouse = ''
+      this.dialogForm.closehouse = ''
+      this.dialogForm.workprice = ''
+      this.dialogForm.overprice = ''
+      this.dialogForm.uphouse = ''
+      this.dialogForm.downhouse = ''
+      this.$refs.dialogForm.clearValidate()
+    },
+    // 瀵硅瘽妗嗗彇娑�
+    dialogVisibleCancel() {
+      this.dialogVisible = false
+    },
+    // 瀵硅瘽妗嗙‘璁�
+    dialogVisibleConfirm() {
+      this.$refs.dialogForm.validate(valid => {
+        if (valid) {
+          this.$store.state.app.buttonIsDisabled = true
+          AttendanceSettAddUpdate(this.dialogForm, 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.getMonthlyWageReportSearch()
+            } else {
+              this.$store.state.app.buttonIsDisabled = false
+              this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�')
+            }
+          })
+        }
+      })
+    },
+    async download() {
+      let tempDate = this.form.creatdate
+      if (tempDate.length > 0) {
+        tempDate = handleDatetime4(tempDate[0]) + '-01' + '~' + this.getLastDayOfCurrentMonth(handleDatetime4(tempDate[1]))
+      }
+      const data = {
+        wkshop_code: this.form.wkshop_code,
+        creatdate: tempDate
+      }
+      const { data: res } = await MonthlyWageReportExcelSearch(data)
+      window.location.href = res
+    },
+    // 鑾峰彇椤甸潰楂樺害
+    getHeight() {
+      this.$nextTick(() => {
+        this.mainHeight = window.innerHeight - 85
+        this.tableHeight = this.mainHeight - 200
+        this.$refs.tableDataRef.doLayout()
+      })
+    }
+  }
 }
 </script>
 
-<style scoped>
+<style>
+.el-picker-panel__footer {
+  display: flex !important;
+  justify-content: flex-end !important;
+}
+</style>
+<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>

--
Gitblit v1.9.3