ZN
2 天以前 021f2421448ce16e2c6331caac0d2300683a36bd
src/views/personnelManagement/attendanceCheckin/checkinRules/index.vue
@@ -2,14 +2,14 @@
  <div class="app-container">
    <!-- 页面标题和操作按钮 -->
    <div class="page-header">
      <div class="title">打卡规则配置</div>
      <div class="title">班次配置</div>
      <div class="actions">
        <el-button type="primary"
                   @click="openForm('add')">
          <el-icon>
            <Plus />
          </el-icon>
          新增规则
          新增班次
        </el-button>
      </div>
    </div>
@@ -50,7 +50,7 @@
        </el-button>
      </el-form-item>
    </el-form> -->
    <!-- 规则列表 -->
    <!-- 班次列表 -->
    <el-card shadow="never"
             class="mb16">
      <el-table :data="tableData"
@@ -65,6 +65,11 @@
        <el-table-column label="部门">
          <template #default="scope">
            {{ getDeptNameById(scope.row.sysDeptId) }}
          </template>
        </el-table-column>
        <el-table-column label="班次">
          <template #default="scope">
            {{ getShiftNameByValue(scope.row.shift) }}
          </template>
        </el-table-column>
        <el-table-column prop="locationName"
@@ -110,7 +115,7 @@
                  @pagination="paginationChange"
                  class="mt10" />
    </el-card>
    <!-- 新增/编辑规则弹窗 -->
    <!-- 新增/编辑班次弹窗 -->
    <rule-form ref="ruleFormRef"
               v-model="dialogVisible"
               :operation-type="operationType"
@@ -122,7 +127,14 @@
<script setup>
  import { ref, reactive, onMounted } from "vue";
  import { ElMessage, ElMessageBox } from "element-plus";
  import { Plus, Edit, Delete, Search, Refresh } from "@element-plus/icons-vue";
  import {
    Plus,
    Edit,
    Delete,
    Search,
    Refresh,
    ArrowLeft,
  } from "@element-plus/icons-vue";
  import Pagination from "@/components/Pagination/index.vue";
  import RuleForm from "./components/form.vue";
  import { deptTreeSelect } from "@/api/system/user.js";
@@ -130,6 +142,7 @@
    getAttendanceRules,
    deleteAttendanceRule,
  } from "@/api/personnelManagement/attendanceRules.js";
  import { useDict } from "@/utils/dict";
  const { proxy } = getCurrentInstance();
@@ -152,6 +165,8 @@
  // 部门选项
  const deptOptions = ref([]);
  // 获取班次字典值
  const { shifts_list } = useDict("shifts_list");
  // 弹窗控制
  const dialogVisible = ref(false);
@@ -166,6 +181,13 @@
    return `${String(date.getHours()).padStart(2, "0")}:${String(
      date.getMinutes()
    ).padStart(2, "0")}`;
  };
  // 根据班次值获取班次名称
  const getShiftNameByValue = value => {
    if (!value) return "";
    const shift = shifts_list.value.find(item => item.value === value);
    return shift ? shift.label : value;
  };
  // 获取部门列表
@@ -206,7 +228,7 @@
    return "";
  };
  // 查询规则列表
  // 查询班次列表
  const fetchData = () => {
    tableLoading.value = true;
    getAttendanceRules({ ...page, ...searchForm })
@@ -240,9 +262,9 @@
    dialogVisible.value = true;
  };
  // 删除规则
  // 删除班次
  const handleDelete = id => {
    ElMessageBox.confirm("确定要删除这条规则吗?", "删除确认", {
    ElMessageBox.confirm("确定要删除这条班次吗?", "删除确认", {
      confirmButtonText: "确定",
      cancelButtonText: "取消",
      type: "warning",