src/views/lavorissue/issue/index.vue
@@ -58,6 +58,18 @@
                  </template>
                </el-table-column>
              </el-table>
              <!-- 分页组件 -->
              <el-pagination
                v-model:current-page="queryParams.current"
                v-model:page-size="queryParams.size"
                :page-sizes="[10, 20, 50, 100]"
                :total="total"
                background
                layout="total, sizes, prev, pager, next, jumper"
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
                style="margin-top: 16px; justify-content: flex-end;s"
              />
            </div>
            <div v-else class="empty">请选择左侧部门或岗位进行配置</div>
          </div>
@@ -99,7 +111,7 @@
          <el-input-number v-model="addItemForm.quantity" :min="0" :precision="0" />
        </el-form-item>
        <el-form-item label="季度">
          <el-select v-model="addItemForm.quarter" placeholder="选择季度" style="width: 160px">
          <el-select v-model="addItemForm.quarter" placeholder="选择季度">
            <el-option :value="1" :label="quarterLabelFromNumber(1)" />
            <el-option :value="2" :label="quarterLabelFromNumber(2)" />
            <el-option :value="3" :label="quarterLabelFromNumber(3)" />
@@ -201,10 +213,41 @@
  return n === 1 ? '第一季度' : n === 2 ? '第二季度' : n === 3 ? '第三季度' : n === 4 ? '第四季度' : ''
}
// 查询参数和分页相关变量
const queryParams = reactive({
  current: 1,
  size: 10
})
const total = ref(0)
// 分页大小改变
function handleSizeChange(val) {
  queryParams.size = val
  queryParams.current = 1
  loadLaborConf()
}
// 当前页改变
function handleCurrentChange(val) {
  queryParams.current = val
  loadLaborConf()
}
// 加载劳保用品配置列表(支持分页)
async function loadLaborConf(deptPositionId) {
  if (!deptPositionId) {
    const currentId = currentPosition.value?.id ?? currentDept.value?.raw?.id
    if (!currentId) return
    deptPositionId = currentId
  }
  try {
    laborConfLoading.value = true
    const res = await laborConfListPage({ deptPositionId })
    const res = await laborConfListPage({
      deptPositionId,
      current: queryParams.current,
      size: queryParams.size
    })
    laborConfList.value = res.data.records.map(it => ({
      ...it,
      id: it.id ?? it.dictId ?? it.value,
@@ -213,6 +256,7 @@
      quarter: it.quarter,
      quarterLabel: quarterLabelFromNumber(it.quarter),
    }))
    total.value = res.data.total || 0
  } finally {
    laborConfLoading.value = false
  }
@@ -264,7 +308,7 @@
      })
    } else {
      // 新增用品
      const currentId = currentPosition.value?.id ?? currentPosition.value?.raw?.id ?? currentDept.value?.id ?? currentDept.value?.raw?.id
      const currentId = currentPosition.value?.id ?? currentDept.value?.raw?.id
      await addLaborConf({
        deptPositionId: currentId,
        dictId: addItemForm.dictId,
@@ -274,8 +318,7 @@
    }
    
    // 重新加载用品配置列表
    const currentId = currentPosition.value?.id ?? currentPosition.value?.raw?.id ?? currentDept.value?.id ?? currentDept.value?.raw?.id
    await loadLaborConf(currentId)
    await loadLaborConf()
    
    addItemDialogVisible.value = false
    ElMessage.success('保存成功')
@@ -296,8 +339,7 @@
  try {
    await deleteLaborConf([row.id])
    // 重新加载用品配置列表
    const currentId = currentPosition.value?.id ?? currentPosition.value?.raw?.id ?? currentDept.value?.id ?? currentDept.value?.raw?.id
    await loadLaborConf(currentId)
    await loadLaborConf()
    ElMessage.success('删除成功')
  } catch (e) {
    ElMessage.error((e && (e.msg || e.message)) || '删除失败')
@@ -376,13 +418,13 @@
    currentDept.value = node
    currentPosition.value = null
    // 选择部门时,加载部门级别的用品配置
    loadLaborConf(node.raw.id)
    loadLaborConf()
  } else if (node.type === 2) {
    const dept = findDeptById(departments, node.parentDeptId)
    if (dept) currentDept.value = mapDeptToTree(dept)
    currentPosition.value = node.raw
    // 选择岗位时,查询用品配置列表
    loadLaborConf(node.raw.id)
    loadLaborConf()
  }
}