小小儁爺
2024-09-04 0b3436dfe135d4110b197188f8d22ed935c868d4
1.考勤模块路由创建
已添加6个文件
已修改2个文件
476 ■■■■■ 文件已修改
src/icons/svg/kqmk.svg 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/index.js 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/attendanceModule/attendanceClockIn.vue 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/attendanceModule/attendanceDay.vue 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/attendanceModule/attendanceMonth.vue 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/attendanceModule/attendanceRecord.vue 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/attendanceModule/attendanceSettings.vue 370 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
vue.config.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/icons/svg/kqmk.svg
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1725433286413" class="icon" viewBox="0 0 1065 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4335" data-spm-anchor-id="a313x.search_index.0.i2.3dfd3a81X6eGiQ" xmlns:xlink="http://www.w3.org/1999/xlink" width="66.5625" height="64"><path d="M971.352337 546.055573V198.349529a76.184497 76.184497 0 0 0-76.184497-76.184497h-115.800435v36.301913a19.046124 19.046124 0 0 1-38.092249 0V122.165032H284.491958v36.549512a19.046124 19.046124 0 1 1-38.092249 0V122.165032H133.32287a76.184497 76.184497 0 0 0-76.184497 76.184497v685.660473a76.184497 76.184497 0 0 0 76.184497 76.184497h482.381189c8.513618 13.446564 18.112864 26.09319 28.683463 37.882741H132.332471a114.276746 114.276746 0 0 1-114.276745-114.276745v-685.660474a114.276746 114.276746 0 0 1 114.276745-114.276745h114.067238v-39.425477a19.046124 19.046124 0 0 1 38.092249 0v39.425477H741.275156V44.190199a19.046124 19.046124 0 1 1 38.092249 0v39.673077h116.390865a114.276746 114.276746 0 0 1 114.276745 114.276745v368.675828A282.301654 282.301654 0 0 0 971.352337 546.055573z" fill="#00A79D" p-id="4336"></path><path d="M533.291479 312.626274h342.830237a19.046124 19.046124 0 1 1 0 38.092249H533.291479a19.046124 19.046124 0 0 1 0-38.092249zM533.291479 464.995268h342.830237a19.046124 19.046124 0 1 1 0 38.092249H533.291479a19.046124 19.046124 0 0 1 0-38.092249z" fill="#00A79D" p-id="4337"></path><path d="M1012.606242 723.62259v68.642231l-59.957199 12.284751a177.052771 177.052771 0 0 1-17.731942 43.310886l33.864009 51.329305-0.09523 0.095231-48.11051 48.434294-0.095231 0.09523-50.986475-34.092562a174.081576 174.081576 0 0 1-42.834733 17.846218l-12.189519 60.357168h-68.185125l-12.18952-60.357168a175.871911 175.871911 0 0 1-42.834733-17.846218l-51.081706 34.092562-48.300971-48.624755 33.883055-51.329305a179.623998 179.623998 0 0 1-17.731941-43.310886l-59.957199-12.284751v-68.642231l59.957199-12.265704a172.081733 172.081733 0 0 1 17.827172-43.310887l-33.883055-51.329305 48.300971-48.624755 50.986475 34.016378a175.490989 175.490989 0 0 1 42.834733-17.865265l12.18952-60.280983h68.204171l12.170473 60.376214a174.805328 174.805328 0 0 1 42.834733 17.846218l50.986475-34.092562 0.095231 0.076184 48.129556 48.453341 0.171415 0.09523-33.883055 51.329305c7.808911 13.579887 13.770348 28.150172 17.750988 43.310887l59.861968 12.265704z m-231.962747-88.335925c-67.251865-0.076184-121.819011 54.738561-121.895195 122.428487-0.076184 67.708972 54.376685 122.65704 121.609503 122.733225 67.251865 0.076184 121.819011-54.757607 121.895195-122.447533 0.076184-67.689926-54.376685-122.637994-121.609503-122.714179z m-371.970807 97.059049c-40.111138 40.415876-80.29846 80.774613-120.314367 121.304766-3.333072 3.371164-5.275776 3.656856-8.475525 0.68566l-0.685661-0.647568-0.057138-0.057138a13764.253076 13764.253076 0 0 0-43.710855-44.167962c-13.294195-13.389425-26.607436-26.740758-39.920677-40.111138-1.352275-1.371321-2.952149-2.495042-3.847317-3.256887l0.323784-0.323784-0.609475-0.628523 28.416817-28.626324 0.609476 0.628522 0.114277-0.095231 62.566518 63.023625 102.639563-103.382362c8.094603 8.170787 15.560684 15.67496 22.969626 23.198179 3.580671 3.63781 5.294823 4.951992 5.180546 6.361406l0.228554 0.228553-0.438061 0.476153c-0.571384 1.161814-2.190304 2.571227-4.990085 5.390053z m-129.532691 121.28572z m0 0z m-0.818983-0.761845c-12.018104-12.265704-24.112393-24.455224-36.206682-36.663789a13764.253076 13764.253076 0 0 1 37.025665 37.425634c-0.266646-0.2476-0.533291-0.457107-0.818983-0.761845z m68.032756-468.534657l-62.147504 62.566518-90.888105-91.497581 26.835989-27.007404 62.947441 64.147347 102.791933-103.515686 27.350234 27.750203c-0.476153 0.761845-1.218952 1.466552-1.980797 2.247443a69878.249093 69878.249093 0 0 0-64.909191 65.30916z m-127.056695 118.181201l0.228553 0.228554c-0.152369-0.019046-0.285692-0.038092-0.438061-0.019047l0.209508-0.209507z m62.814117 93.040317l0.571384-0.571384 1.409413 1.314183 102.144365-102.963348 26.474112 26.969312c-0.019046 0.476153-0.095231 0.990398-0.152369 1.504644l-128.84703 129.723152-91.440443-92.068964 26.816943-26.988358h0.438061l62.585564 63.080763z" fill="#00A79D" p-id="4338"></path></svg>
src/router/index.js
@@ -642,7 +642,56 @@
        meta: { code: '0804', title: '流转设置', icon: '', keepAlive: true }
      }
    ]
  },
  {
    path: '/attendanceModule',
    component: Layout,
    redirect: '/attendanceModule/attendanceSettings',
    name: '考勤模块',
    code: '11',
    meta: { code: '11', title: '考勤模块', icon: 'kqmk' },
    alwaysShow: true, // å½“children只有一个时,也显示父菜单
    children: [
      {
        path: 'attendanceSettings',
        name: 'attendanceSettings',
        code: '1101',
        component: () => import('@/views/attendanceModule/attendanceSettings'),
        meta: { code: '1101', title: '考勤设置', icon: '', keepAlive: true }
      },
      {
        path: 'attendanceClockIn',
        name: 'attendanceClockIn',
        code: '1102',
        component: () => import('@/views/attendanceModule/attendanceClockIn'),
        meta: { code: '1102', title: '考勤打卡', icon: '', keepAlive: true }
      },
      {
        path: 'attendanceRecord',
        name: 'attendanceRecord',
        code: '1103',
        component: () => import('@/views/attendanceModule/attendanceRecord'),
        meta: { code: '1103', title: '考勤记录', icon: '', keepAlive: true }
      },
      {
        path: 'attendanceDay',
        name: 'attendanceDay',
        code: '1104',
        component: () => import('@/views/attendanceModule/attendanceDay'),
        meta: { code: '1104', title: '日计时工资', icon: '', keepAlive: true }
      },
      {
        path: 'attendanceMonth',
        name: 'attendanceMonth',
        code: '1105',
        component: () => import('@/views/attendanceModule/attendanceMonth'),
        meta: { code: '1105', title: '月计时工资', icon: '', keepAlive: true }
      }
    ]
  }
]
const createRouter = () => new Router({
src/views/attendanceModule/attendanceClockIn.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,15 @@
<template>
  <div>
    123
  </div>
</template>
<script>
export default {
  name: 'AttendanceClockIn'
}
</script>
<style scoped>
</style>
src/views/attendanceModule/attendanceDay.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,13 @@
<template>
  <div>322222</div>
</template>
<script>
export default {
  name: 'AttendanceDay'
}
</script>
<style scoped>
</style>
src/views/attendanceModule/attendanceMonth.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,13 @@
<template>
  <div>3212</div>
</template>
<script>
export default {
  name: 'AttendanceMonth'
}
</script>
<style scoped>
</style>
src/views/attendanceModule/attendanceRecord.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,13 @@
<template>
  <div>123123</div>
</template>
<script>
export default {
  name: 'AttendanceRecord'
}
</script>
<style scoped>
</style>
src/views/attendanceModule/attendanceSettings.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,370 @@
<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-download"-->
        <!--          @click="$router.push('./../systemSetting/dataImport?fileCode=1')"-->
        <!--        >导入-->
        <!--        </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-input v-model="form.postcode" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item label="参加人员" style=" display: flex;">
              <el-input v-model="form.postname" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item label="创建时间" style=" display: flex;">
              <el-input v-model="form.postname" placeholder="请输入" style="width: 200px" />
            </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="getPostData">查询</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="postcode"
            label="岗位编码"
            sortable="custom"
          />
          <el-table-column
            prop="postname"
            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="danger">停用</el-tag>
            </template>
          </el-table-column>
          <el-table-column
            prop="description"
            label="描述"
            sortable="custom"
          >
            <template slot-scope="{row}">
              {{ row.description ? row.description : '/' }}
            </template>
          </el-table-column>
          <el-table-column
            prop="username"
            label="创建人员"
            sortable="custom"
          />
          <el-table-column
            prop="lm_date"
            label="创建时间"
            width="160"
            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="getPostData"
      />
    </div>
    <el-dialog
      v-el-drag-dialog
      :title="operation==='add'?'新增':'编辑'"
      :visible.sync="dialogVisible"
      width="800px"
      :close-on-click-modal="false"
      top="15vh"
      @closed="handleClose"
      @close="handleClose"
    >
      <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px">
        <el-form-item label="岗位编码" prop="postcode">
          <el-input v-model="dialogForm.postcode" :disabled="operation!=='add'" style="width: 200px" />
        </el-form-item>
        <el-form-item label="岗位名称" prop="postname">
          <el-input v-model="dialogForm.postname" style="width: 200px" />
        </el-form-item>
        <el-form-item label="描述">
          <el-input
            v-model="dialogForm.description"
            type="textarea"
            style="width: 200px"
          />
        </el-form-item>
        <el-form-item required label="岗位状态">
          <el-radio-group v-model="dialogForm.status">
            <el-radio label="Y">正常</el-radio>
            <el-radio label="N">停用</el-radio>
          </el-radio-group>
        </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 { AddUpdatePost, DeletePost, PostData } from '@/api/basicSettings'
import { validateCode } from '@/utils/global'
import elDragDialog from '@/directive/el-drag-dialog'
import waves from '@/directive/waves'
export default {
  name: 'AttendanceSettings',
  components: {
    Pagination
  },
  directives: { elDragDialog, waves },
  data() {
    return {
      mainHeight: 0,
      tableHeight: 0,
      form: {
        postcode: '', // ç»„织架构编码
        postname: '', // ç»„织架构名称
        prop: 'lm_date', // æŽ’序字段
        order: 'desc', // æŽ’序字段
        page: 1, // ç¬¬å‡ é¡µ
        rows: 20 // æ¯é¡µå¤šå°‘条
      },
      total: 10,
      tableData: [],
      dialogVisible: false,
      dialogForm: {
        postcode: '', // ç»„织编码
        postname: '', // ç»„织名称
        description: '', // æè¿°
        status: 'Y'// çŠ¶æ€
      },
      operation: '',
      dialogFormRules: {
        postcode: [
          { required: true, validator: validateCode, trigger: ['blur', 'change'] }
        ],
        postname: [
          { required: true, message: '请输入岗位名称', trigger: ['blur', 'change'] }
        ]
      }
    }
  },
  created() {
    this.getPostData()
  },
  mounted() {
    window.addEventListener('resize', this.getHeight)
    this.getHeight()
  },
  methods: {
    // ç»„织架构大列表查询
    async getPostData() {
      const res = await PostData(this.form)
      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.getPostData()
    },
    // é‡ç½®
    reset() {
      this.form.postcode = ''
      this.form.postname = ''
      this.getPostData()
    },
    // æ–°å¢žæŒ‰é’®
    add(operation) {
      this.operation = operation
      this.dialogVisible = true
      this.dialogForm.OperType = 'Add'
    },
    // ä¿®æ”¹æŒ‰é’®
    async edit(operation, row) {
      this.operation = operation
      this.dialogVisible = true
      this.dialogForm.OperType = 'Update'
      this.$nextTick(() => {
        this.dialogForm.postcode = row.postcode
        this.dialogForm.postname = row.postname
        this.dialogForm.description = row.description
        this.dialogForm.status = row.status
      })
    },
    // åˆ é™¤æŒ‰é’®
    async del(row) {
      this.$confirm('是否确认删除?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        DeletePost({ postcode: row.postcode }).then(res => {
          if (res.code === '200') {
            this.$notify.success('删除成功!')
            if (this.form.page > 1 && this.tableData.length === 1) {
              this.form.page--
            }
            this.getPostData()
          }
        })
      }).catch(() => {
        this.$notify.info('已取消删除')
      })
    },
    // å¯¹è¯æ¡†å…³é—­äº‹ä»¶
    handleClose() {
      this.dialogForm.postcode = ''
      this.dialogForm.postname = ''
      this.dialogForm.status = 'Y'
      this.dialogForm.description = ''
      this.$refs.dialogForm.clearValidate()
    },
    // å¯¹è¯æ¡†å–消
    dialogVisibleCancel() {
      this.dialogVisible = false
    },
    // å¯¹è¯æ¡†ç¡®è®¤
    dialogVisibleConfirm() {
      this.$refs.dialogForm.validate(valid => {
        if (valid) {
          this.$store.state.app.buttonIsDisabled = true
          AddUpdatePost(this.dialogForm).then(res => {
            if (res.code === '200') {
              this.$notify.success(this.operation === 'add' ? '添加成功!' : '修改成功!')
              this.dialogVisible = false
              this.$store.state.app.buttonIsDisabled = false
              this.getPostData()
            } else {
              this.$store.state.app.buttonIsDisabled = false
              this.$notify.error(this.operation === 'add' ? '添加失败!' : '修改失败!')
            }
          })
        }
      })
    },
    // èŽ·å–é¡µé¢é«˜åº¦
    getHeight() {
      this.$nextTick(() => {
        this.mainHeight = window.innerHeight - 85
        this.tableHeight = this.mainHeight - 200
        this.$refs.tableDataRef.doLayout()
      })
    }
  }
}
</script>
vue.config.js
@@ -52,7 +52,7 @@
    },
    proxy: {
      [process.env.VUE_APP_BASE_API]: {
        target: 'http://121.196.36.24:8033', // æœ¬åœ°
        target: 'http://121.196.36.24:8034', // æœ¬åœ°
        // target: 'http://192.168.0.147:8000', // ä¼˜å…‹
        changeOrigin: true, // è¯·æ±‚跨域时,需 é…ç½®æ­¤é¡¹
        pathRewrite: { // è·¯å¾„重写,替换target中的请求地址