This commit is contained in:
guochunsi
2026-01-29 11:56:37 +08:00
parent 043c92efc9
commit 9fea29454f
28 changed files with 230 additions and 384 deletions

View File

@@ -0,0 +1,103 @@
# hooks/table 使用方法检查
## 一、useTable 源码要点(`src/hooks/table.ts`
### 1. 入参 `BasicTableProps`
| 属性 | 类型 | 默认值 | 说明 |
|------|------|--------|------|
| `createdIsNeed` | `boolean` | **true** | 是否在 `onMounted` 时自动请求列表 |
| `isPage` | `boolean` | true | 是否分页 |
| `queryForm` | `any` | `{}` | 查询条件,会合并到请求参数 |
| `pageList` | `(...arg: any) => Promise<any>` | - | **必填**,分页接口方法 |
| `props` | `object` | `{ item: 'records', totalCount: 'total' }` | 列表/总数的数据路径 |
| `validate` | `Function` | - | 请求前校验,不通过则不请求 |
| `onLoaded` | `Function` | - | 请求成功、写入 `dataList` 后的回调 |
| `onCascaded` | `Function` | - | 级联回调 |
| `pagination` | `Pagination` | 见源码 | 分页配置 |
### 2. 内部逻辑
- **请求参数**`query()` 调用 `state.pageList({ ...state.queryForm, current, size, descs, ascs })`
- **响应处理**:用 `state.props.item``state.props.totalCount``res.data` 取列表和总数,写入 `state.dataList``state.pagination.total`
- **首次加载**:在 **hooks 内部的 `onMounted`** 里,若 `state.createdIsNeed === true` 则执行一次 `query()`
- **注意**`useTable` **不 return state**,调用方需要自己持有一份 `state`(通常用 `reactive`)并传给 `useTable(state)`表格数据、分页、loading 都写在这份 `state` 上。
### 3. 返回值
```ts
{
getDataList, // (refresh?: any) => void默认重置到第 1 页再请求getDataList(false) 不重置页码
currentChangeHandle, // 页码变化时调用
sizeChangeHandle, // 每页条数变化时调用
sortChangeHandle, // 排序变化时调用(若表格支持 sortable="custom"
tableStyle, // { cellStyle, headerCellStyle }
downBlobFile // 下载文件
}
```
---
## 二、推荐用法(与 search-form 配合)
### 1. 定义 state 并传入 useTable
```ts
import { BasicTableProps, useTable } from '/@/hooks/table'
const search = reactive({ deptCode: '', realName: '', teacherNo: '' })
const state = reactive<BasicTableProps>({
queryForm: search, // 与 search-form 的 :model 同一对象
pageList: fetchList, // 或自定义方法合并额外参数
// createdIsNeed 不写则默认为 true首屏自动请求
})
const { getDataList, currentChangeHandle, sizeChangeHandle, tableStyle } = useTable(state)
```
- **state 由调用方定义并传入**,不要在解构时期望 `useTable` 返回 `state`(源码未返回)。
### 2. 模板绑定
- 表格:`:data="state.dataList"``v-loading="state.loading"``tableStyle` 用于 `cell-style` / `header-cell-style`
- 分页:`v-bind="state.pagination"` 或分别绑定 `current`/`size`/`total`,事件用 `@current-change="currentChangeHandle"``@size-change="sizeChangeHandle"`
### 3. 查询 / 重置 / 刷新
- 点击「查询」:先更新 `search`(或额外参数),再 `getDataList()`(会回到第 1 页)。
- 重置:清空 `search`(及 ref 里的额外参数),可选 `searchFormRef?.resetFields()`,再 `getDataList()`
- 只刷新当前页:`getDataList(false)`
### 4. 与 createdIsNeed 的关系
- **createdIsNeed: true默认**hooks 内部 onMounted 会自动调一次 `query()`**页面里不需要再在 onMounted 里调 getDataList()**,否则会重复请求。
- **createdIsNeed: false**:不在挂载时请求,需要自己在合适时机(例如 onMounted 或某个条件满足后)调用 `getDataList()`
---
## 三、professionaltitlerelation/index.vue 检查结果
| 检查项 | 状态 | 说明 |
|--------|------|------|
| queryForm 使用 search | ✅ | 与 search-form 的 model 一致 |
| pageList 返回结构 | ✅ | 返回 `{ data: { records, total } }`,与默认 props 一致 |
| createdIsNeed | ✅ | 未配置即默认 true首屏由 useTable 自动请求 |
| onMounted 不重复请求 | ✅ | 仅 `loadDictData()`,未再调 getDataList |
| 表格绑定 state.dataList / state.loading | ✅ | 正确 |
| 分页绑定 state.pagination + currentChangeHandle/sizeChangeHandle | ✅ | 正确 |
| 查询 handleFilter → getDataList() | ✅ | 正确 |
| 重置 resetQuery → 清空 search + getDataList() | ✅ | 正确 |
| 删除/审核后 getDataList() | ✅ | 正确 |
| tableStyle 用于 el-table | ✅ | 正确 |
**结论**:当前 `professionaltitlerelation/index.vue` 对 hooks/table 的使用符合上述规范,无需修改。
---
## 四、常见注意点
1. **不要从 useTable 解构 state**:源码未返回 state应自己在页面里 `const state = reactive<BasicTableProps>({...})` 并传给 `useTable(state)`
2. **文档中若写 `const { state } = useTable(state)`**:属于文档笔误,实际应使用调用方定义的 `state`
3. **自定义 pageList 时**:返回结构需与 `props` 一致,默认即 `res.data.records``res.data.total`;若后端字段不同,可同时配置 `props: { item: 'xxx', totalCount: 'yyy' }`
4. **需要额外请求参数时**:在 `pageList` 里对入参做合并,例如 `return await fetchList({ ...queryParams, ...params.value })`

View File

@@ -82,7 +82,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, onMounted } from 'vue' import { ref, reactive } from 'vue'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
import { BasicTableProps, useTable } from '/@/hooks/table' import { BasicTableProps, useTable } from '/@/hooks/table'
import { fetchList } from '/@/api/professional/professionaluser/professionalpartychange' import { fetchList } from '/@/api/professional/professionaluser/professionalpartychange'
@@ -130,10 +130,7 @@ const resetQuery = () => {
getDataList() getDataList()
} }
// 初始化 // 表格数据由 useTablecreatedIsNeed 默认 true在挂载时自动请求
onMounted(() => {
getDataList()
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@@ -402,10 +402,9 @@ const loadDictData = async () => {
} }
} }
// 初始化 // 初始化:仅加载下拉字典,表格数据由 useTablecreatedIsNeed 默认 true自动请求
onMounted(async () => { onMounted(async () => {
await loadDictData() await loadDictData()
getDataList()
}) })
</script> </script>

View File

@@ -456,10 +456,9 @@ const loadDictData = async () => {
} }
} }
// 初始化 // 初始化:仅加载下拉字典,表格数据由 useTablecreatedIsNeed 默认 true自动请求
onMounted(async () => { onMounted(async () => {
await loadDictData() await loadDictData()
getDataList()
}) })
</script> </script>

View File

@@ -56,16 +56,16 @@
<el-row> <el-row>
<div class="mb15" style="width: 100%;"> <div class="mb15" style="width: 100%;">
<el-button <el-button
v-auth="'professional_professionalteachercertificaterelation_add'"
type="primary" type="primary"
icon="FolderAdd" icon="FolderAdd"
@click="handleAdd" @click="handleAdd">
v-if="permissions.professional_professionalteachercertificaterelation_add">
</el-button> </el-button>
<el-button <el-button
v-auth="'professional_teacherbase_export'"
type="warning" type="warning"
plain plain
icon="Download" icon="Download"
v-if="permissions.professional_teacherbase_export"
@click="handleDownLoadWord" @click="handleDownLoadWord"
:loading="exportLoading">导出信息 :loading="exportLoading">导出信息
</el-button> </el-button>
@@ -123,31 +123,34 @@
<el-table-column label="操作" width="280" align="center" fixed="right"> <el-table-column label="操作" width="280" align="center" fixed="right">
<template #default="scope"> <template #default="scope">
<el-button <el-button
v-auth="'professional_professionalteachercertificaterelation_edit'"
v-if="scope.row.state === '0' || scope.row.state === '-2'"
type="primary" type="primary"
link link
icon="edit-pen" icon="edit-pen"
v-if="permissions.professional_professionalteachercertificaterelation_edit && (scope.row.state === '0' || scope.row.state === '-2')"
@click="handleEdit(scope.row)">编辑 @click="handleEdit(scope.row)">编辑
</el-button> </el-button>
<el-button <el-button
v-auth="'professional_professionalteachercertificaterelation_exam'"
v-if="scope.row.state === '0'"
type="success" type="success"
link link
icon="CircleCheck" icon="CircleCheck"
v-if="permissions.professional_professionalteachercertificaterelation_exam && scope.row.state === '0'"
@click="changeState(scope.row, 1)">通过 @click="changeState(scope.row, 1)">通过
</el-button> </el-button>
<el-button <el-button
v-auth="'professional_professionalteachercertificaterelation_exam'"
v-if="scope.row.state === '0' || scope.row.state === '1'"
type="danger" type="danger"
link link
icon="CircleClose" icon="CircleClose"
v-if="permissions.professional_professionalteachercertificaterelation_exam && (scope.row.state === '0' || scope.row.state === '1')"
@click="changeState(scope.row, -2)">驳回 @click="changeState(scope.row, -2)">驳回
</el-button> </el-button>
<el-button <el-button
v-auth="'professional_professionalteachercertificaterelation_del'"
type="danger" type="danger"
link link
icon="delete" icon="delete"
v-if="permissions.professional_professionalteachercertificaterelation_del"
style="margin-left: 12px" style="margin-left: 12px"
@click="handleDel(scope.row)">删除 @click="handleDel(scope.row)">删除
</el-button> </el-button>
@@ -178,9 +181,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, computed, onMounted, nextTick } from 'vue' import { ref, reactive, onMounted, nextTick } from 'vue'
import { storeToRefs } from 'pinia'
import { useUserInfo } from '/@/stores/userInfo'
import { BasicTableProps, useTable } from '/@/hooks/table' import { BasicTableProps, useTable } from '/@/hooks/table'
import { useMessage } from '/@/hooks/message' import { useMessage } from '/@/hooks/message'
import { useMessageBox } from '/@/hooks/message' import { useMessageBox } from '/@/hooks/message'
@@ -207,19 +208,6 @@ const auditStateOptions: StateOption[] = [
{ value: '0', label: '待审核', type: 'warning', icon: 'fa-regular fa-clock', effect: 'light' } { value: '0', label: '待审核', type: 'warning', icon: 'fa-regular fa-clock', effect: 'light' }
] ]
// 使用 Pinia store
const userInfoStore = useUserInfo()
const { userInfos } = storeToRefs(userInfoStore)
// 创建权限对象
const permissions = computed(() => {
const perms: Record<string, boolean> = {}
userInfos.value.authBtnList.forEach((perm: string) => {
perms[perm] = true
})
return perms
})
// 消息提示 hooks // 消息提示 hooks
const message = useMessage() const message = useMessage()
const messageBox = useMessageBox() const messageBox = useMessageBox()
@@ -397,10 +385,9 @@ const loadDictData = async () => {
} }
} }
// 初始化 // 初始化:仅加载下拉字典,表格数据由 useTablecreatedIsNeed 默认 true自动请求
onMounted(async () => { onMounted(async () => {
await loadDictData() await loadDictData()
getDataList()
}) })
</script> </script>

View File

@@ -56,10 +56,10 @@
<el-row> <el-row>
<div class="mb15" style="width: 100%;"> <div class="mb15" style="width: 100%;">
<el-button <el-button
v-auth="'professional_professionalteacherhonor_add'"
type="primary" type="primary"
icon="FolderAdd" icon="FolderAdd"
@click="handleAdd" @click="handleAdd">
v-if="permissions.professional_professionalteacherhonor_add">
</el-button> </el-button>
<el-button <el-button
type="warning" type="warning"
@@ -118,31 +118,34 @@
<el-table-column label="操作" width="280" align="center" fixed="right"> <el-table-column label="操作" width="280" align="center" fixed="right">
<template #default="scope"> <template #default="scope">
<el-button <el-button
v-auth="'professional_professionalteacherhonor_edit'"
v-if="scope.row.state === '0' || scope.row.state === '-2'"
type="primary" type="primary"
link link
icon="edit-pen" icon="edit-pen"
v-if="permissions.professional_professionalteacherhonor_edit && (scope.row.state === '0' || scope.row.state === '-2')" @click="handleEdit(scope.row)">修改
@click="handleEdit(scope.row)">编辑
</el-button> </el-button>
<el-button <el-button
v-auth="'professional_professionalteacherhonor_exam'"
v-if="scope.row.state === '0'"
type="success" type="success"
link link
icon="CircleCheck" icon="CircleCheck"
v-if="permissions.professional_professionalteacherhonor_exam && scope.row.state === '0'"
@click="changeState(scope.row, 1)">通过 @click="changeState(scope.row, 1)">通过
</el-button> </el-button>
<el-button <el-button
v-auth="'professional_professionalteacherhonor_exam'"
v-if="scope.row.state === '0' || scope.row.state === '1'"
type="danger" type="danger"
link link
icon="CircleClose" icon="CircleClose"
v-if="permissions.professional_professionalteacherhonor_exam && (scope.row.state === '0' || scope.row.state === '1')"
@click="changeState(scope.row, -2)">驳回 @click="changeState(scope.row, -2)">驳回
</el-button> </el-button>
<el-button <el-button
v-auth="'professional_professionalteacherhonor_del'"
type="danger" type="danger"
link link
icon="delete" icon="delete"
v-if="permissions.professional_professionalteacherhonor_del"
style="margin-left: 12px" style="margin-left: 12px"
@click="handleDel(scope.row)">删除 @click="handleDel(scope.row)">删除
</el-button> </el-button>
@@ -173,9 +176,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, computed, onMounted, nextTick } from 'vue' import { ref, reactive, nextTick } from 'vue'
import { storeToRefs } from 'pinia'
import { useUserInfo } from '/@/stores/userInfo'
import { BasicTableProps, useTable } from '/@/hooks/table' import { BasicTableProps, useTable } from '/@/hooks/table'
import { useMessage } from '/@/hooks/message' import { useMessage } from '/@/hooks/message'
import { useMessageBox } from '/@/hooks/message' import { useMessageBox } from '/@/hooks/message'
@@ -185,6 +186,7 @@ import {
examObj, examObj,
delObj delObj
} from '/@/api/professional/professionaluser/professionalteacherhonor' } from '/@/api/professional/professionaluser/professionalteacherhonor'
import { PROFESSIONAL_AUDIT_STATE_OPTIONS } from '/@/config/global'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
const TeacherNameNo = defineAsyncComponent(() => import('/@/components/TeacherNameNo/index.vue')) const TeacherNameNo = defineAsyncComponent(() => import('/@/components/TeacherNameNo/index.vue'))
const AuditState = defineAsyncComponent(() => import('/@/components/AuditState/index.vue')) const AuditState = defineAsyncComponent(() => import('/@/components/AuditState/index.vue'))
@@ -192,19 +194,6 @@ const ProfessionalBackResaon = defineAsyncComponent(() => import('/@/views/profe
const DataForm = defineAsyncComponent(() => import('./form.vue')) const DataForm = defineAsyncComponent(() => import('./form.vue'))
const previewFile = defineAsyncComponent(() => import('/@/components/tools/preview-file.vue')) const previewFile = defineAsyncComponent(() => import('/@/components/tools/preview-file.vue'))
// 使用 Pinia store
const userInfoStore = useUserInfo()
const { userInfos } = storeToRefs(userInfoStore)
// 创建权限对象
const permissions = computed(() => {
const perms: Record<string, boolean> = {}
userInfos.value.authBtnList.forEach((perm: string) => {
perms[perm] = true
})
return perms
})
// 消息提示 hooks // 消息提示 hooks
const message = useMessage() const message = useMessage()
const messageBox = useMessageBox() const messageBox = useMessageBox()
@@ -212,13 +201,8 @@ const messageBox = useMessageBox()
// 字典数据 // 字典数据
const { professional_state: professionalState } = useDict('professional_state') const { professional_state: professionalState } = useDict('professional_state')
// 审核状态选项(独立定义,防止其他页面修改时被波及) // 审核状态选项
import type { StateOption } from '/@/components/AuditState/index.vue' const auditStateOptions = PROFESSIONAL_AUDIT_STATE_OPTIONS
const auditStateOptions: StateOption[] = [
{ value: '1', label: '已通过', type: 'success', icon: 'fa-solid fa-circle-check', effect: 'dark' },
{ value: '-2', label: '已驳回', type: 'danger', icon: 'fa-solid fa-circle-xmark', effect: 'dark' },
{ value: '0', label: '待审核', type: 'warning', icon: 'fa-regular fa-clock', effect: 'light' }
]
// 表格引用 // 表格引用
const tableRef = ref() const tableRef = ref()
@@ -365,10 +349,7 @@ const handleDownLoadWord = async () => {
} }
} }
// 初始化 // 表格数据由 useTablecreatedIsNeed 默认 true在挂载时自动请求
onMounted(() => {
getDataList()
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@@ -83,7 +83,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, onMounted } from 'vue' import { ref, reactive } from 'vue'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
import { BasicTableProps, useTable } from '/@/hooks/table' import { BasicTableProps, useTable } from '/@/hooks/table'
import { fetchList } from '/@/api/professional/professionaluser/professionalteacherstationchange' import { fetchList } from '/@/api/professional/professionaluser/professionalteacherstationchange'
@@ -136,10 +136,7 @@ const doPrint = (row: any) => {
window.open(`/professional/professionalteacherstationchange/print/${row.id}`) window.open(`/professional/professionalteacherstationchange/print/${row.id}`)
} }
// 初始化 // 表格数据由 useTablecreatedIsNeed 默认 true在挂载时自动请求
onMounted(() => {
getDataList()
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@@ -8,7 +8,7 @@
type="primary" type="primary"
icon="FolderAdd" icon="FolderAdd"
@click="handleAdd" @click="handleAdd"
v-if="permissions.professional_professionalteachertype_add"> v-auth="'professional_professionalteachertype_add'">
</el-button> </el-button>
</div> </div>
</el-row> </el-row>
@@ -35,14 +35,14 @@
<el-table-column label="操作" width="150" align="center" fixed="right"> <el-table-column label="操作" width="150" align="center" fixed="right">
<template #default="scope"> <template #default="scope">
<el-button <el-button
v-if="permissions.professional_professionalteachertype_edit" v-auth="'professional_professionalteachertype_edit'"
icon="edit-pen" icon="edit-pen"
link link
type="primary" type="primary"
@click="handleEdit(scope.row)">修改 @click="handleEdit(scope.row)">修改
</el-button> </el-button>
<el-button <el-button
v-if="permissions.professional_professionalteachertype_del" v-auth="'professional_professionalteachertype_del'"
icon="delete" icon="delete"
link link
type="danger" type="danger"
@@ -63,7 +63,7 @@
<!-- 新增/编辑弹窗 --> <!-- 新增/编辑弹窗 -->
<el-dialog <el-dialog
v-model="dialogVisible" v-model="dialogVisible"
:title="form.id ? '编辑' : '新增'" :title="form.id ? '修改' : '新增'"
width="600px" width="600px"
:close-on-click-modal="false" :close-on-click-modal="false"
destroy-on-close destroy-on-close
@@ -114,27 +114,12 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, computed } from 'vue' import { ref, reactive } from 'vue'
import { storeToRefs } from 'pinia'
import { useUserInfo } from '/@/stores/userInfo'
import { BasicTableProps, useTable } from '/@/hooks/table' import { BasicTableProps, useTable } from '/@/hooks/table'
import { useMessage } from '/@/hooks/message' import { useMessage } from '/@/hooks/message'
import { useMessageBox } from '/@/hooks/message' import { useMessageBox } from '/@/hooks/message'
import { fetchList, addObj, putObj, delObj } from '/@/api/professional/rsbase/professionalteachertype' import { fetchList, addObj, putObj, delObj } from '/@/api/professional/rsbase/professionalteachertype'
// 使用 Pinia store
const userInfoStore = useUserInfo()
const { userInfos } = storeToRefs(userInfoStore)
// 创建权限对象
const permissions = computed(() => {
const perms: Record<string, boolean> = {}
userInfos.value.authBtnList.forEach((perm: string) => {
perms[perm] = true
})
return perms
})
// 消息提示 hooks // 消息提示 hooks
const message = useMessage() const message = useMessage()
const messageBox = useMessageBox() const messageBox = useMessageBox()
@@ -235,7 +220,7 @@ const handleSubmit = async () => {
getDataList() getDataList()
} catch (error: any) { } catch (error: any) {
// 处理业务错误 // 处理业务错误
message.error(error.msg)
} finally { } finally {
submitLoading.value = false submitLoading.value = false
} }

View File

@@ -8,7 +8,7 @@
type="primary" type="primary"
icon="FolderAdd" icon="FolderAdd"
@click="handleAdd" @click="handleAdd"
v-if="permissions.professional_professionalteachingmaterialconfig_add"> v-auth="'professional_professionalteachingmaterialconfig_add'">
</el-button> </el-button>
</div> </div>
</el-row> </el-row>
@@ -35,14 +35,14 @@
<el-table-column label="操作" width="150" align="center" fixed="right"> <el-table-column label="操作" width="150" align="center" fixed="right">
<template #default="scope"> <template #default="scope">
<el-button <el-button
v-if="permissions.professional_professionalteachingmaterialconfig_edit" v-auth="'professional_professionalteachingmaterialconfig_edit'"
icon="edit-pen" icon="edit-pen"
link link
type="primary" type="primary"
@click="handleEdit(scope.row)">修改 @click="handleEdit(scope.row)">修改
</el-button> </el-button>
<el-button <el-button
v-if="permissions.professional_professionalteachingmaterialconfig_del" v-auth="'professional_professionalteachingmaterialconfig_del'"
icon="delete" icon="delete"
link link
type="danger" type="danger"
@@ -114,27 +114,12 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, computed } from 'vue' import { ref, reactive } from 'vue'
import { storeToRefs } from 'pinia'
import { useUserInfo } from '/@/stores/userInfo'
import { BasicTableProps, useTable } from '/@/hooks/table' import { BasicTableProps, useTable } from '/@/hooks/table'
import { useMessage } from '/@/hooks/message' import { useMessage } from '/@/hooks/message'
import { useMessageBox } from '/@/hooks/message' import { useMessageBox } from '/@/hooks/message'
import { fetchList, addObj, putObj, delObj } from '/@/api/professional/rsbase/professionalteachingmaterialconfig' import { fetchList, addObj, putObj, delObj } from '/@/api/professional/rsbase/professionalteachingmaterialconfig'
// 使用 Pinia store
const userInfoStore = useUserInfo()
const { userInfos } = storeToRefs(userInfoStore)
// 创建权限对象
const permissions = computed(() => {
const perms: Record<string, boolean> = {}
userInfos.value.authBtnList.forEach((perm: string) => {
perms[perm] = true
})
return perms
})
// 消息提示 hooks // 消息提示 hooks
const message = useMessage() const message = useMessage()
const messageBox = useMessageBox() const messageBox = useMessageBox()
@@ -235,7 +220,7 @@ const handleSubmit = async () => {
getDataList() getDataList()
} catch (error: any) { } catch (error: any) {
// 处理业务错误 // 处理业务错误
message.error(error.msg)
} finally { } finally {
submitLoading.value = false submitLoading.value = false
} }

View File

@@ -8,7 +8,7 @@
type="primary" type="primary"
icon="FolderAdd" icon="FolderAdd"
@click="handleAdd" @click="handleAdd"
v-if="permissions.professional_professionaltitlelevelconfig_add"> v-auth="'professional_professionaltitlelevelconfig_add'">
</el-button> </el-button>
</div> </div>
</el-row> </el-row>
@@ -35,14 +35,14 @@
<el-table-column label="操作" width="150" align="center" fixed="right"> <el-table-column label="操作" width="150" align="center" fixed="right">
<template #default="scope"> <template #default="scope">
<el-button <el-button
v-if="permissions.professional_professionaltitlelevelconfig_edit" v-auth="'professional_professionaltitlelevelconfig_edit'"
icon="edit-pen" icon="edit-pen"
link link
type="primary" type="primary"
@click="handleEdit(scope.row)">修改 @click="handleEdit(scope.row)">修改
</el-button> </el-button>
<el-button <el-button
v-if="permissions.professional_professionaltitlelevelconfig_del" v-auth="'professional_professionaltitlelevelconfig_del'"
icon="delete" icon="delete"
link link
type="danger" type="danger"
@@ -114,27 +114,12 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, computed } from 'vue' import { ref, reactive } from 'vue'
import { storeToRefs } from 'pinia'
import { useUserInfo } from '/@/stores/userInfo'
import { BasicTableProps, useTable } from '/@/hooks/table' import { BasicTableProps, useTable } from '/@/hooks/table'
import { useMessage } from '/@/hooks/message' import { useMessage } from '/@/hooks/message'
import { useMessageBox } from '/@/hooks/message' import { useMessageBox } from '/@/hooks/message'
import { fetchList, addObj, putObj, delObj } from '/@/api/professional/rsbase/professionaltitlelevelconfig' import { fetchList, addObj, putObj, delObj } from '/@/api/professional/rsbase/professionaltitlelevelconfig'
// 使用 Pinia store
const userInfoStore = useUserInfo()
const { userInfos } = storeToRefs(userInfoStore)
// 创建权限对象
const permissions = computed(() => {
const perms: Record<string, boolean> = {}
userInfos.value.authBtnList.forEach((perm: string) => {
perms[perm] = true
})
return perms
})
// 消息提示 hooks // 消息提示 hooks
const message = useMessage() const message = useMessage()
const messageBox = useMessageBox() const messageBox = useMessageBox()
@@ -235,7 +220,6 @@ const handleSubmit = async () => {
getDataList() getDataList()
} catch (error: any) { } catch (error: any) {
// 处理业务错误 // 处理业务错误
message.error(error.msg)
} finally { } finally {
submitLoading.value = false submitLoading.value = false
} }

View File

@@ -1,5 +1,5 @@
<template> <template>
<el-dialog v-model="dialogVisible" title="编辑职称" width="600px" append-to-body :close-on-click-modal="false" destroy-on-close> <el-dialog v-model="dialogVisible" title="修改职称" width="600px" append-to-body :close-on-click-modal="false" destroy-on-close>
<div v-if="showForm"> <div v-if="showForm">
<el-form <el-form
ref="formRef" ref="formRef"

View File

@@ -88,17 +88,17 @@
<el-row> <el-row>
<div class="mb15" style="width: 100%;"> <div class="mb15" style="width: 100%;">
<el-button <el-button
v-auth="'professional_professionaltitlerelation_add'"
type="primary" type="primary"
icon="FolderAdd" icon="FolderAdd"
@click="handleAdd" @click="handleAdd">
v-if="permissions.professional_professionaltitlerelation_add">
</el-button> </el-button>
<el-button <el-button
v-auth="'professional_teacherbase_export'"
class="ml10" class="ml10"
type="warning" type="warning"
plain plain
icon="Download" icon="Download"
v-if="permissions.professional_teacherbase_export"
@click="handleDownLoadWord" @click="handleDownLoadWord"
:loading="exportLoading">导出信息 :loading="exportLoading">导出信息
</el-button> </el-button>
@@ -162,31 +162,34 @@
<el-table-column label="操作" width="280" align="center" fixed="right"> <el-table-column label="操作" width="280" align="center" fixed="right">
<template #default="scope"> <template #default="scope">
<el-button <el-button
v-auth="'professional_professionaltitlerelation_edit'"
v-if="scope.row.state === '0' || scope.row.state === '-2'"
type="primary" type="primary"
link link
icon="edit-pen" icon="edit-pen"
v-if="permissions.professional_professionaltitlerelation_edit && (scope.row.state === '0' || scope.row.state === '-2')" @click="handleEdit(scope.row)">修改
@click="handleEdit(scope.row)">编辑
</el-button> </el-button>
<el-button <el-button
v-auth="'professional_professionaltitlerelation_exam'"
v-if="scope.row.state === '0'"
type="success" type="success"
link link
icon="CircleCheck" icon="CircleCheck"
v-if="permissions.professional_professionaltitlerelation_exam && scope.row.state === '0'"
@click="changeState(scope.row, 1)">通过 @click="changeState(scope.row, 1)">通过
</el-button> </el-button>
<el-button <el-button
v-auth="'professional_professionaltitlerelation_exam'"
v-if="scope.row.state === '0' || scope.row.state === '1'"
type="danger" type="danger"
link link
icon="CircleClose" icon="CircleClose"
v-if="permissions.professional_professionaltitlerelation_exam && (scope.row.state === '0' || scope.row.state === '1')"
@click="changeState(scope.row, -2)">驳回 @click="changeState(scope.row, -2)">驳回
</el-button> </el-button>
<el-button <el-button
v-auth="'professional_professionaltitlerelation_del'"
type="danger" type="danger"
link link
icon="delete" icon="delete"
v-if="permissions.professional_professionaltitlerelation_del"
style="margin-left: 12px" style="margin-left: 12px"
@click="handleDel(scope.row)">删除 @click="handleDel(scope.row)">删除
</el-button> </el-button>
@@ -218,9 +221,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, computed, onMounted, nextTick } from 'vue' import { ref, reactive, onMounted, nextTick } from 'vue'
import { storeToRefs } from 'pinia'
import { useUserInfo } from '/@/stores/userInfo'
import { BasicTableProps, useTable } from '/@/hooks/table' import { BasicTableProps, useTable } from '/@/hooks/table'
import { useMessage } from '/@/hooks/message' import { useMessage } from '/@/hooks/message'
import { useMessageBox } from '/@/hooks/message' import { useMessageBox } from '/@/hooks/message'
@@ -244,18 +245,6 @@ const ProfessionalBackResaon = defineAsyncComponent(() => import('/@/views/profe
const previewFile = defineAsyncComponent(() => import('/@/components/tools/preview-file.vue')) const previewFile = defineAsyncComponent(() => import('/@/components/tools/preview-file.vue'))
// 使用 Pinia store // 使用 Pinia store
const userInfoStore = useUserInfo()
const { userInfos } = storeToRefs(userInfoStore)
// 创建权限对象
const permissions = computed(() => {
const perms: Record<string, boolean> = {}
userInfos.value.authBtnList.forEach((perm: string) => {
perms[perm] = true
})
return perms
})
// 消息提示 hooks // 消息提示 hooks
const message = useMessage() const message = useMessage()
const messageBox = useMessageBox() const messageBox = useMessageBox()
@@ -452,11 +441,9 @@ const loadDictData = async () => {
} }
} }
// 初始化 // 初始化:仅加载下拉字典,表格数据由 useTable 在 createdIsNeed: true 时自动请求
onMounted(async () => { onMounted(async () => {
await loadDictData() await loadDictData()
dataFormRef.value?.init()
getDataList()
}) })
</script> </script>

View File

@@ -8,7 +8,7 @@
type="primary" type="primary"
icon="FolderAdd" icon="FolderAdd"
@click="handleAdd" @click="handleAdd"
v-if="permissions.professional_professionaltopiclevelconfig_add"> v-auth="'professional_professionaltopiclevelconfig_add'">
</el-button> </el-button>
</div> </div>
</el-row> </el-row>
@@ -35,14 +35,14 @@
<el-table-column label="操作" width="150" align="center" fixed="right"> <el-table-column label="操作" width="150" align="center" fixed="right">
<template #default="scope"> <template #default="scope">
<el-button <el-button
v-if="permissions.professional_professionaltopiclevelconfig_edit" v-auth="'professional_professionaltopiclevelconfig_edit'"
icon="edit-pen" icon="edit-pen"
link link
type="primary" type="primary"
@click="handleEdit(scope.row)">修改 @click="handleEdit(scope.row)">修改
</el-button> </el-button>
<el-button <el-button
v-if="permissions.professional_professionaltopiclevelconfig_del" v-auth="'professional_professionaltopiclevelconfig_del'"
icon="delete" icon="delete"
link link
type="danger" type="danger"
@@ -63,7 +63,7 @@
<!-- 新增/编辑弹窗 --> <!-- 新增/编辑弹窗 -->
<el-dialog <el-dialog
v-model="dialogVisible" v-model="dialogVisible"
:title="form.id ? '编辑' : '新增'" :title="form.id ? '修改' : '新增'"
width="600px" width="600px"
:close-on-click-modal="false" :close-on-click-modal="false"
destroy-on-close destroy-on-close
@@ -114,27 +114,12 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, computed } from 'vue' import { ref, reactive } from 'vue'
import { storeToRefs } from 'pinia'
import { useUserInfo } from '/@/stores/userInfo'
import { BasicTableProps, useTable } from '/@/hooks/table' import { BasicTableProps, useTable } from '/@/hooks/table'
import { useMessage } from '/@/hooks/message' import { useMessage } from '/@/hooks/message'
import { useMessageBox } from '/@/hooks/message' import { useMessageBox } from '/@/hooks/message'
import { fetchList, addObj, putObj, delObj } from '/@/api/professional/rsbase/professionaltopiclevelconfig' import { fetchList, addObj, putObj, delObj } from '/@/api/professional/rsbase/professionaltopiclevelconfig'
// 使用 Pinia store
const userInfoStore = useUserInfo()
const { userInfos } = storeToRefs(userInfoStore)
// 创建权限对象
const permissions = computed(() => {
const perms: Record<string, boolean> = {}
userInfos.value.authBtnList.forEach((perm: string) => {
perms[perm] = true
})
return perms
})
// 消息提示 hooks // 消息提示 hooks
const message = useMessage() const message = useMessage()
const messageBox = useMessageBox() const messageBox = useMessageBox()
@@ -235,7 +220,6 @@ const handleSubmit = async () => {
getDataList() getDataList()
} catch (error: any) { } catch (error: any) {
// 处理业务错误 // 处理业务错误
message.error(error.msg)
} finally { } finally {
submitLoading.value = false submitLoading.value = false
} }

View File

@@ -8,7 +8,7 @@
type="primary" type="primary"
icon="FolderAdd" icon="FolderAdd"
@click="handleAdd" @click="handleAdd"
v-if="permissions.professional_professionaltopicsourceconfig_add"> v-auth="'professional_professionaltopicsourceconfig_add'">
</el-button> </el-button>
</div> </div>
</el-row> </el-row>
@@ -35,14 +35,14 @@
<el-table-column label="操作" width="150" align="center" fixed="right"> <el-table-column label="操作" width="150" align="center" fixed="right">
<template #default="scope"> <template #default="scope">
<el-button <el-button
v-if="permissions.professional_professionaltopicsourceconfig_edit" v-auth="'professional_professionaltopicsourceconfig_edit'"
icon="edit-pen" icon="edit-pen"
link link
type="primary" type="primary"
@click="handleEdit(scope.row)">修改 @click="handleEdit(scope.row)">修改
</el-button> </el-button>
<el-button <el-button
v-if="permissions.professional_professionaltopicsourceconfig_del" v-auth="'professional_professionaltopicsourceconfig_del'"
icon="delete" icon="delete"
link link
type="danger" type="danger"
@@ -63,7 +63,7 @@
<!-- 新增/编辑弹窗 --> <!-- 新增/编辑弹窗 -->
<el-dialog <el-dialog
v-model="dialogVisible" v-model="dialogVisible"
:title="form.id ? '编辑' : '新增'" :title="form.id ? '修改' : '新增'"
width="600px" width="600px"
:close-on-click-modal="false" :close-on-click-modal="false"
destroy-on-close destroy-on-close
@@ -114,27 +114,12 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, computed } from 'vue' import { ref, reactive } from 'vue'
import { storeToRefs } from 'pinia'
import { useUserInfo } from '/@/stores/userInfo'
import { BasicTableProps, useTable } from '/@/hooks/table' import { BasicTableProps, useTable } from '/@/hooks/table'
import { useMessage } from '/@/hooks/message' import { useMessage } from '/@/hooks/message'
import { useMessageBox } from '/@/hooks/message' import { useMessageBox } from '/@/hooks/message'
import { fetchList, addObj, putObj, delObj } from '/@/api/professional/rsbase/professionaltopicsourceconfig' import { fetchList, addObj, putObj, delObj } from '/@/api/professional/rsbase/professionaltopicsourceconfig'
// 使用 Pinia store
const userInfoStore = useUserInfo()
const { userInfos } = storeToRefs(userInfoStore)
// 创建权限对象
const permissions = computed(() => {
const perms: Record<string, boolean> = {}
userInfos.value.authBtnList.forEach((perm: string) => {
perms[perm] = true
})
return perms
})
// 消息提示 hooks // 消息提示 hooks
const message = useMessage() const message = useMessage()
const messageBox = useMessageBox() const messageBox = useMessageBox()
@@ -235,7 +220,6 @@ const handleSubmit = async () => {
getDataList() getDataList()
} catch (error: any) { } catch (error: any) {
// 处理业务错误 // 处理业务错误
message.error(error.msg)
} finally { } finally {
submitLoading.value = false submitLoading.value = false
} }

View File

@@ -8,7 +8,7 @@
type="primary" type="primary"
icon="FolderAdd" icon="FolderAdd"
@click="handleAdd" @click="handleAdd"
v-if="permissions.professional_worktype_add"> v-auth="'professional_worktype_add'">
</el-button> </el-button>
</div> </div>
</el-row> </el-row>
@@ -31,14 +31,14 @@
<el-table-column label="操作" width="150" align="center" fixed="right"> <el-table-column label="操作" width="150" align="center" fixed="right">
<template #default="scope"> <template #default="scope">
<el-button <el-button
v-if="permissions.professional_worktype_edit" v-auth="'professional_worktype_edit'"
icon="edit-pen" icon="edit-pen"
link link
type="primary" type="primary"
@click="handleEdit(scope.row)">修改 @click="handleEdit(scope.row)">修改
</el-button> </el-button>
<el-button <el-button
v-if="permissions.professional_worktype_del" v-auth="'professional_worktype_del'"
icon="delete" icon="delete"
link link
type="danger" type="danger"
@@ -59,7 +59,7 @@
<!-- 新增/编辑弹窗 --> <!-- 新增/编辑弹窗 -->
<el-dialog <el-dialog
v-model="dialogVisible" v-model="dialogVisible"
:title="form.id ? '编辑' : '新增'" :title="form.id ? '修改' : '新增'"
width="600px" width="600px"
:close-on-click-modal="false" :close-on-click-modal="false"
destroy-on-close destroy-on-close
@@ -91,27 +91,12 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, computed } from 'vue' import { ref, reactive } from 'vue'
import { storeToRefs } from 'pinia'
import { useUserInfo } from '/@/stores/userInfo'
import { BasicTableProps, useTable } from '/@/hooks/table' import { BasicTableProps, useTable } from '/@/hooks/table'
import { useMessage } from '/@/hooks/message' import { useMessage } from '/@/hooks/message'
import { useMessageBox } from '/@/hooks/message' import { useMessageBox } from '/@/hooks/message'
import { fetchList, addObj, putObj, delObj } from '/@/api/professional/rsbase/professionalworktype' import { fetchList, addObj, putObj, delObj } from '/@/api/professional/rsbase/professionalworktype'
// 使用 Pinia store
const userInfoStore = useUserInfo()
const { userInfos } = storeToRefs(userInfoStore)
// 创建权限对象
const permissions = computed(() => {
const perms: Record<string, boolean> = {}
userInfos.value.authBtnList.forEach((perm: string) => {
perms[perm] = true
})
return perms
})
// 消息提示 hooks // 消息提示 hooks
const message = useMessage() const message = useMessage()
const messageBox = useMessageBox() const messageBox = useMessageBox()
@@ -203,7 +188,6 @@ const handleSubmit = async () => {
getDataList() getDataList()
} catch (error: any) { } catch (error: any) {
// 处理业务错误 // 处理业务错误
message.error(error.msg)
} finally { } finally {
submitLoading.value = false submitLoading.value = false
} }

View File

@@ -8,7 +8,7 @@
type="primary" type="primary"
icon="FolderAdd" icon="FolderAdd"
@click="handleAdd" @click="handleAdd"
v-if="permissions.professional_professionalyearbounds_add"> v-auth="'professional_professionalyearbounds_add'">
</el-button> </el-button>
</div> </div>
</el-row> </el-row>
@@ -46,14 +46,14 @@
<el-table-column label="操作" min-width="150" align="center" fixed="right"> <el-table-column label="操作" min-width="150" align="center" fixed="right">
<template #default="scope"> <template #default="scope">
<el-button <el-button
v-if="permissions.professional_professionalyearbounds_edit" v-auth="'professional_professionalyearbounds_edit'"
icon="edit-pen" icon="edit-pen"
link link
type="primary" type="primary"
@click="handleEdit(scope.row)">修改 @click="handleEdit(scope.row)">修改
</el-button> </el-button>
<el-button <el-button
v-if="permissions.professional_professionalyearbounds_del" v-auth="'professional_professionalyearbounds_del'"
icon="delete" icon="delete"
link link
type="danger" type="danger"
@@ -74,7 +74,7 @@
<!-- 新增/编辑弹窗 --> <!-- 新增/编辑弹窗 -->
<el-dialog <el-dialog
v-model="dialogVisible" v-model="dialogVisible"
:title="form.id ? '编辑' : '新增'" :title="form.id ? '修改' : '新增'"
width="800px" width="800px"
:close-on-click-modal="false" :close-on-click-modal="false"
destroy-on-close destroy-on-close
@@ -175,29 +175,14 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, computed } from 'vue' import { ref, reactive } from 'vue'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
import { storeToRefs } from 'pinia'
import { useUserInfo } from '/@/stores/userInfo'
import { BasicTableProps, useTable } from '/@/hooks/table' import { BasicTableProps, useTable } from '/@/hooks/table'
import { useMessage, useMessageBox } from '/@/hooks/message' import { useMessage, useMessageBox } from '/@/hooks/message'
import { fetchList, addObj, putObj, delObj } from '/@/api/professional/salaries/professionalyearbounds' import { fetchList, addObj, putObj, delObj } from '/@/api/professional/salaries/professionalyearbounds'
const TeacherNameNo = defineAsyncComponent(() => import('/@/components/TeacherNameNo/index.vue')) const TeacherNameNo = defineAsyncComponent(() => import('/@/components/TeacherNameNo/index.vue'))
// 使用 Pinia store
const userInfoStore = useUserInfo()
const { userInfos } = storeToRefs(userInfoStore)
// 创建权限对象
const permissions = computed(() => {
const perms: Record<string, boolean> = {}
userInfos.value.authBtnList.forEach((perm: string) => {
perms[perm] = true
})
return perms
})
// 消息提示 hooks // 消息提示 hooks
const message = useMessage() const message = useMessage()
const messageBox = useMessageBox() const messageBox = useMessageBox()
@@ -317,7 +302,7 @@ const handleSubmit = async () => {
dialogVisible.value = false dialogVisible.value = false
getDataList(false) // 提交后保持当前页 getDataList(false) // 提交后保持当前页
} catch (error: any) { } catch (error: any) {
message.error(error.msg) // 错误处理已在数据请求层统一处理,此处不需要提示
} finally { } finally {
submitLoading.value = false submitLoading.value = false
} }

View File

@@ -72,7 +72,7 @@
<el-table-column label="操作" min-width="80" align="center" fixed="right"> <el-table-column label="操作" min-width="80" align="center" fixed="right">
<template #default="scope"> <template #default="scope">
<el-button <el-button
v-if="permissions.professional_salaryexportrecord_del" v-auth="'professional_salaryexportrecord_del'"
icon="delete" icon="delete"
link link
type="primary" type="primary"
@@ -93,26 +93,11 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, computed } from 'vue' import { ref, reactive } from 'vue'
import { storeToRefs } from 'pinia'
import { useUserInfo } from '/@/stores/userInfo'
import { BasicTableProps, useTable } from '/@/hooks/table' import { BasicTableProps, useTable } from '/@/hooks/table'
import { useMessage, useMessageBox } from '/@/hooks/message' import { useMessage, useMessageBox } from '/@/hooks/message'
import { fetchList, delObj } from '/@/api/professional/salaries/salaryexportrecord' import { fetchList, delObj } from '/@/api/professional/salaries/salaryexportrecord'
// 使用 Pinia store
const userInfoStore = useUserInfo()
const { userInfos } = storeToRefs(userInfoStore)
// 创建权限对象
const permissions = computed(() => {
const perms: Record<string, boolean> = {}
userInfos.value.authBtnList.forEach((perm: string) => {
perms[perm] = true
})
return perms
})
// 消息提示 hooks // 消息提示 hooks
const message = useMessage() const message = useMessage()
const messageBox = useMessageBox() const messageBox = useMessageBox()
@@ -169,7 +154,7 @@ const handleDel = (row: any) => {
message.success('删除成功') message.success('删除成功')
getDataList(false) // 删除后保持当前页 getDataList(false) // 删除后保持当前页
} catch (error: any) { } catch (error: any) {
message.error(error.msg) // 错误处理已在数据请求层统一处理,此处不需要提示
} }
}).catch(() => { }).catch(() => {
// 用户取消 // 用户取消

View File

@@ -27,7 +27,7 @@
</template> </template>
<el-button <el-button
size="small" size="small"
v-if="permissions.professional_salary_import" v-auth="'teacher_award_import'"
type="primary">选择文件 type="primary">选择文件
</el-button> </el-button>
</el-upload> </el-upload>
@@ -45,8 +45,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed } from 'vue' import { ref, computed } from 'vue'
import { storeToRefs } from 'pinia'
import { useUserInfo } from '/@/stores/userInfo'
import { useMessage } from '/@/hooks/message' import { useMessage } from '/@/hooks/message'
import { Session } from '/@/utils/storage' import { Session } from '/@/utils/storage'
import request from '/@/utils/request' import request from '/@/utils/request'
@@ -56,19 +54,6 @@ const emit = defineEmits<{
(e: 'refreshData'): void (e: 'refreshData'): void
}>() }>()
// 使用 Pinia store
const userInfoStore = useUserInfo()
const { userInfos } = storeToRefs(userInfoStore)
// 创建权限对象
const permissions = computed(() => {
const perms: Record<string, boolean> = {}
userInfos.value.authBtnList.forEach((perm: string) => {
perms[perm] = true
})
return perms
})
// 消息提示 // 消息提示
const message = useMessage() const message = useMessage()

View File

@@ -55,7 +55,7 @@
type="primary" type="primary"
plain plain
icon="UploadFilled" icon="UploadFilled"
v-if="permissions.teacher_award_import" v-auth="'teacher_award_import'"
@click="handleImportBaseSalary">绩效导入 @click="handleImportBaseSalary">绩效导入
</el-button> </el-button>
</div> </div>
@@ -107,25 +107,10 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, computed } from 'vue' import { ref, reactive } from 'vue'
import { storeToRefs } from 'pinia'
import { useUserInfo } from '/@/stores/userInfo'
import { BasicTableProps, useTable } from '/@/hooks/table' import { BasicTableProps, useTable } from '/@/hooks/table'
import { fetchList } from '/@/api/professional/salaries/teacherawardtax' import { fetchList } from '/@/api/professional/salaries/teacherawardtax'
import ImportAwardTax from './importAwardTax.vue' const ImportAwardTax = defineAsyncComponent(() => import('./importAwardTax.vue'))
// 使用 Pinia store
const userInfoStore = useUserInfo()
const { userInfos } = storeToRefs(userInfoStore)
// 创建权限对象
const permissions = computed(() => {
const perms: Record<string, boolean> = {}
userInfos.value.authBtnList.forEach((perm: string) => {
perms[perm] = true
})
return perms
})
// 表格引用 // 表格引用
const tableRef = ref() const tableRef = ref()

View File

@@ -1492,7 +1492,7 @@
import {updateStatus} from '/@/api/professional/professionalstatuslock' import {updateStatus} from '/@/api/professional/professionalstatuslock'
import {resetPassWord} from "/@/api/professional/professionaluser/teacherbase" import {resetPassWord} from "/@/api/professional/professionaluser/teacherbase"
// 组件配置已不再需要(已从 avue-crud 迁移到 el-table // 组件配置已不再需要(已从 avue-crud 迁移到 el-table
import authImg from "/@/components/tools/auth-img.vue" const authImg = defineAsyncComponent(() => import("/@/components/tools/auth-img.vue"))
// 导入工具 // 导入工具
import { Session } from '/@/utils/storage' import { Session } from '/@/utils/storage'

View File

@@ -90,19 +90,19 @@
type="primary" type="primary"
plain plain
icon="UploadFilled" icon="UploadFilled"
v-if="permissions.professional_salary_import" v-auth="'professional_salary_import'"
@click="handleImportBaseSalary">工资条导入 @click="handleImportBaseSalary">工资条导入
</el-button> </el-button>
<el-button <el-button
icon="View" icon="View"
class="ml10" class="ml10"
v-if="permissions.professional_seach_auth" v-auth="'professional_seach_auth'"
@click="canSearch(1)">设置可查询 @click="canSearch(1)">设置可查询
</el-button> </el-button>
<el-button <el-button
icon="Hide" icon="Hide"
class="ml10" class="ml10"
v-if="permissions.professional_seach_auth" v-auth="'professional_seach_auth'"
@click="canSearch(0)">设置不可查询 @click="canSearch(0)">设置不可查询
</el-button> </el-button>
<el-button <el-button
@@ -110,7 +110,7 @@
plain plain
icon="Delete" icon="Delete"
class="ml10" class="ml10"
v-if="permissions.professional_professionalsalaries_del" v-auth="'professional_professionalsalaries_del'"
@click="delbatch">批量删除 @click="delbatch">批量删除
</el-button> </el-button>
</div> </div>
@@ -186,33 +186,19 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, computed, onMounted } from 'vue' import { ref, reactive, onMounted } from 'vue'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
import { storeToRefs } from 'pinia'
import { useUserInfo } from '/@/stores/userInfo'
import { BasicTableProps, useTable } from '/@/hooks/table' import { BasicTableProps, useTable } from '/@/hooks/table'
import { useMessage, useMessageBox } from '/@/hooks/message' import { useMessage, useMessageBox } from '/@/hooks/message'
import { fetchList, delBatch, setCanSearch } from '/@/api/professional/salaries/teacherpayslip' import { fetchList, delBatch, setCanSearch } from '/@/api/professional/salaries/teacherpayslip'
import { checkAuth } from '/@/api/professional/salaries/teachersalary' import { checkAuth } from '/@/api/professional/salaries/teachersalary'
import { getStationLevelList } from '/@/api/professional/professionalstationlevelconfig' import { getStationLevelList } from '/@/api/professional/professionalstationlevelconfig'
import SalaryInfo from './salaryInfo.vue' const SalaryInfo = defineAsyncComponent(() => import('./salaryInfo.vue'))
import ImportBaseSalary from './importBaseSalary.vue' const ImportBaseSalary = defineAsyncComponent(() => import('./importBaseSalary.vue'))
import ExportBaseSalary from './exportBaseSalary.vue' const ExportBaseSalary = defineAsyncComponent(() => import('./exportBaseSalary.vue'))
const TeacherNameNo = defineAsyncComponent(() => import('/@/components/TeacherNameNo/index.vue')) const TeacherNameNo = defineAsyncComponent(() => import('/@/components/TeacherNameNo/index.vue'))
// 使用 Pinia store
const userInfoStore = useUserInfo()
const { userInfos } = storeToRefs(userInfoStore)
// 创建权限对象
const permissions = computed(() => {
const perms: Record<string, boolean> = {}
userInfos.value.authBtnList.forEach((perm: string) => {
perms[perm] = true
})
return perms
})
// 消息提示 hooks // 消息提示 hooks
const message = useMessage() const message = useMessage()
@@ -339,7 +325,7 @@ const delbatch = () => {
getDataList(false) // 删除后保持当前页 getDataList(false) // 删除后保持当前页
} }
} catch (error: any) { } catch (error: any) {
message.error(error?.msg || '删除失败') // 错误处理已在数据请求层统一处理,此处不需要提示
} }
}).catch(() => { }).catch(() => {
// 用户取消 // 用户取消
@@ -359,7 +345,7 @@ const canSearch = (val: number) => {
message.success("设置成功") message.success("设置成功")
getDataList(false) // 设置后保持当前页 getDataList(false) // 设置后保持当前页
} catch (error: any) { } catch (error: any) {
message.error(error?.msg || '设置失败') // 错误处理已在数据请求层统一处理,此处不需要提示
} }
}).catch(() => { }).catch(() => {
// 用户取消 // 用户取消

View File

@@ -96,7 +96,7 @@
type="primary" type="primary"
plain plain
icon="UploadFilled" icon="UploadFilled"
v-if="permissions.professional_salary_import" v-auth="'professional_salary_import'"
@click="handleImportBaseSalary">人事薪资导入 @click="handleImportBaseSalary">人事薪资导入
</el-button> </el-button>
<el-button <el-button
@@ -104,7 +104,7 @@
plain plain
icon="Download" icon="Download"
class="ml10" class="ml10"
v-if="permissions.professional_salary_finance_import" v-auth="'professional_salary_finance_import'"
@click="handleExportSalart">薪资导出 @click="handleExportSalart">薪资导出
</el-button> </el-button>
<el-button <el-button
@@ -112,19 +112,19 @@
plain plain
icon="UploadFilled" icon="UploadFilled"
class="ml10" class="ml10"
v-if="permissions.professional_salary_finance_import" v-auth="'professional_salary_finance_import'"
@click="handleImportTaxSalary">税金导入 @click="handleImportTaxSalary">税金导入
</el-button> </el-button>
<el-button <el-button
icon="View" icon="View"
class="ml10" class="ml10"
v-if="permissions.professional_seach_auth" v-auth="'professional_seach_auth'"
@click="canSearch(1)">设置可查询 @click="canSearch(1)">设置可查询
</el-button> </el-button>
<el-button <el-button
icon="Hide" icon="Hide"
class="ml10" class="ml10"
v-if="permissions.professional_seach_auth" v-auth="'professional_seach_auth'"
@click="canSearch(0)">设置不可查询 @click="canSearch(0)">设置不可查询
</el-button> </el-button>
<el-button <el-button
@@ -132,7 +132,7 @@
plain plain
icon="Delete" icon="Delete"
class="ml10" class="ml10"
v-if="permissions.professional_professionalsalaries_del" v-auth="'professional_professionalsalaries_del'"
@click="delbatch">批量删除 @click="delbatch">批量删除
</el-button> </el-button>
</div> </div>
@@ -208,33 +208,18 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, computed, onMounted } from 'vue' import { ref, reactive, onMounted } from 'vue'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
import { storeToRefs } from 'pinia'
import { useUserInfo } from '/@/stores/userInfo'
import { BasicTableProps, useTable } from '/@/hooks/table' import { BasicTableProps, useTable } from '/@/hooks/table'
import { useMessage, useMessageBox } from '/@/hooks/message' import { useMessage, useMessageBox } from '/@/hooks/message'
import { fetchList, delBatch, setCanSearch, checkAuth } from '/@/api/professional/salaries/teachersalary' import { fetchList, delBatch, setCanSearch, checkAuth } from '/@/api/professional/salaries/teachersalary'
import { getStationLevelList } from '/@/api/professional/professionalstationlevelconfig' import { getStationLevelList } from '/@/api/professional/professionalstationlevelconfig'
import SalaryInfo from './salaryInfo.vue' const SalaryInfo = defineAsyncComponent(() => import('./salaryInfo.vue'))
import ImportBaseSalary from './importBaseSalary.vue' const ImportBaseSalary = defineAsyncComponent(() => import('./importBaseSalary.vue'))
const ExportBaseSalary = defineAsyncComponent(() => import('./exportBaseSalary.vue'))
const ImportTaxSalary = defineAsyncComponent(() => import('./importTaxSalary.vue'))
const TeacherNameNo = defineAsyncComponent(() => import('/@/components/TeacherNameNo/index.vue')) const TeacherNameNo = defineAsyncComponent(() => import('/@/components/TeacherNameNo/index.vue'))
import ExportBaseSalary from './exportBaseSalary.vue'
import ImportTaxSalary from './importTaxSalary.vue'
// 使用 Pinia store
const userInfoStore = useUserInfo()
const { userInfos } = storeToRefs(userInfoStore)
// 创建权限对象
const permissions = computed(() => {
const perms: Record<string, boolean> = {}
userInfos.value.authBtnList.forEach((perm: string) => {
perms[perm] = true
})
return perms
})
// 消息提示 hooks // 消息提示 hooks
const message = useMessage() const message = useMessage()
@@ -396,7 +381,7 @@ const canSearch = (val: number) => {
message.success("设置成功") message.success("设置成功")
getDataList(false) // 设置后保持当前页 getDataList(false) // 设置后保持当前页
} catch (error: any) { } catch (error: any) {
message.error(error?.msg || '设置失败') // 错误处理已在数据请求层统一处理,此处不需要提示
} }
}).catch(() => { }).catch(() => {
// 用户取消 // 用户取消

View File

@@ -341,7 +341,7 @@ const searchUserInfo = async () => {
message.success('查询成功') message.success('查询成功')
} }
} catch (error: any) { } catch (error: any) {
message.error(error?.msg || '查询失败') // 错误处理已在数据请求层统一处理,此处不需要提示
} finally { } finally {
baseLoading.value = false baseLoading.value = false
} }

View File

@@ -8,7 +8,7 @@
type="primary" type="primary"
icon="FolderAdd" icon="FolderAdd"
@click="handleAdd" @click="handleAdd"
v-if="permissions.professional_typeofworkconfig_add"> v-auth="'professional_typeofworkconfig_add'">
</el-button> </el-button>
</div> </div>
</el-row> </el-row>
@@ -35,14 +35,14 @@
<el-table-column label="操作" width="150" align="center" fixed="right"> <el-table-column label="操作" width="150" align="center" fixed="right">
<template #default="scope"> <template #default="scope">
<el-button <el-button
v-if="permissions.professional_typeofworkconfig_edit" v-auth="'professional_typeofworkconfig_edit'"
icon="edit-pen" icon="edit-pen"
link link
type="primary" type="primary"
@click="handleEdit(scope.row)">修改 @click="handleEdit(scope.row)">修改
</el-button> </el-button>
<el-button <el-button
v-if="permissions.professional_typeofworkconfig_del" v-auth="'professional_typeofworkconfig_del'"
icon="delete" icon="delete"
link link
type="danger" type="danger"
@@ -63,7 +63,7 @@
<!-- 新增/编辑弹窗 --> <!-- 新增/编辑弹窗 -->
<el-dialog <el-dialog
v-model="dialogVisible" v-model="dialogVisible"
:title="form.id ? '编辑' : '新增'" :title="form.id ? '修改' : '新增'"
width="600px" width="600px"
:close-on-click-modal="false" :close-on-click-modal="false"
destroy-on-close destroy-on-close
@@ -114,27 +114,12 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, computed } from 'vue' import { ref, reactive } from 'vue'
import { storeToRefs } from 'pinia'
import { useUserInfo } from '/@/stores/userInfo'
import { BasicTableProps, useTable } from '/@/hooks/table' import { BasicTableProps, useTable } from '/@/hooks/table'
import { useMessage } from '/@/hooks/message' import { useMessage } from '/@/hooks/message'
import { useMessageBox } from '/@/hooks/message' import { useMessageBox } from '/@/hooks/message'
import { fetchList, addObj, putObj, delObj } from '/@/api/professional/rsbase/typeofworkconfig' import { fetchList, addObj, putObj, delObj } from '/@/api/professional/rsbase/typeofworkconfig'
// 使用 Pinia store
const userInfoStore = useUserInfo()
const { userInfos } = storeToRefs(userInfoStore)
// 创建权限对象
const permissions = computed(() => {
const perms: Record<string, boolean> = {}
userInfos.value.authBtnList.forEach((perm: string) => {
perms[perm] = true
})
return perms
})
// 消息提示 hooks // 消息提示 hooks
const message = useMessage() const message = useMessage()
const messageBox = useMessageBox() const messageBox = useMessageBox()
@@ -235,7 +220,7 @@ const handleSubmit = async () => {
getDataList() getDataList()
} catch (error: any) { } catch (error: any) {
// 处理业务错误 // 处理业务错误
message.error(error.msg) // 错误处理已在数据请求层统一处理,此处不需要提示
} finally { } finally {
submitLoading.value = false submitLoading.value = false
} }

View File

@@ -167,7 +167,7 @@
</template> </template>
<script setup lang="ts" name="recruitstudentplan"> <script setup lang="ts" name="recruitstudentplan">
import { ref, reactive, computed, onMounted } from 'vue' import { ref, reactive, computed } from 'vue'
import { storeToRefs } from 'pinia' import { storeToRefs } from 'pinia'
import { useUserInfo } from '/@/stores/userInfo' import { useUserInfo } from '/@/stores/userInfo'
import { BasicTableProps, useTable } from '/@/hooks/table' import { BasicTableProps, useTable } from '/@/hooks/table'
@@ -312,9 +312,7 @@ const handleSubmit = async () => {
}) })
} }
onMounted(() => { // 表格数据由 useTablecreatedIsNeed 默认 true在挂载时自动请求
getDataList()
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@@ -113,7 +113,7 @@
</template> </template>
<script setup lang="ts" name="recruitstudentplandegreeofeducation"> <script setup lang="ts" name="recruitstudentplandegreeofeducation">
import { ref, reactive, computed, onMounted } from 'vue' import { ref, reactive, computed } from 'vue'
import { storeToRefs } from 'pinia' import { storeToRefs } from 'pinia'
import { useUserInfo } from '/@/stores/userInfo' import { useUserInfo } from '/@/stores/userInfo'
import { BasicTableProps, useTable } from '/@/hooks/table' import { BasicTableProps, useTable } from '/@/hooks/table'
@@ -242,9 +242,7 @@ const handleSubmit = async () => {
}) })
} }
onMounted(() => { // 表格数据由 useTablecreatedIsNeed 默认 true在挂载时自动请求
getDataList()
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@@ -307,9 +307,9 @@ const resetQuery = () => {
getDataList(); getDataList();
}; };
// 表格数据由 useTablecreatedIsNeed 默认 true自动请求onMounted 仅执行 init
onMounted(() => { onMounted(() => {
init(); init();
getDataList();
}); });
</script> </script>

View File

@@ -97,7 +97,7 @@
</template> </template>
<script setup lang="ts" name="recruitstudentsignupturnovermoneychange"> <script setup lang="ts" name="recruitstudentsignupturnovermoneychange">
import { ref, reactive, computed, onMounted, defineAsyncComponent, nextTick } from 'vue' import { ref, reactive, computed, defineAsyncComponent, nextTick } from 'vue'
import { storeToRefs } from 'pinia' import { storeToRefs } from 'pinia'
import { useUserInfo } from '/@/stores/userInfo' import { useUserInfo } from '/@/stores/userInfo'
import { BasicTableProps, useTable } from '/@/hooks/table' import { BasicTableProps, useTable } from '/@/hooks/table'
@@ -182,9 +182,7 @@ const handleDel = async (row: any) => {
} }
} }
onMounted(() => { // 表格数据由 useTablecreatedIsNeed 默认 true在挂载时自动请求
getDataList()
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>