|
|
@ -22,8 +22,8 @@ |
|
|
|
<el-table-column prop="leader" label="负责人" width="120" /> |
|
|
|
<el-table-column prop="leader" label="负责人" width="120" /> |
|
|
|
<el-table-column prop="sort" label="排序" width="200" /> |
|
|
|
<el-table-column prop="sort" label="排序" width="200" /> |
|
|
|
<el-table-column prop="status" label="状态" width="100" /> |
|
|
|
<el-table-column prop="status" label="状态" width="100" /> |
|
|
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180" /> |
|
|
|
<el-table-column label="创建时间" prop="createTime" width="180" :formatter="dateFormatter" /> |
|
|
|
<el-table-column label="操作" align="center" class-name="fixed-width" width="160"> |
|
|
|
<el-table-column label="操作" class-name="fixed-width" width="160"> |
|
|
|
<template #default="scope"> |
|
|
|
<template #default="scope"> |
|
|
|
<el-button link type="primary" @click="openForm('update', scope.row.id)"> 修改 </el-button> |
|
|
|
<el-button link type="primary" @click="openForm('update', scope.row.id)"> 修改 </el-button> |
|
|
|
<el-button link type="danger" @click="handleDelete(scope.row.id)"> 删除 </el-button> |
|
|
|
<el-button link type="danger" @click="handleDelete(scope.row.id)"> 删除 </el-button> |
|
|
@ -36,18 +36,16 @@ |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
<script setup lang="ts" name="SystemDept"> |
|
|
|
<script setup lang="ts" name="SystemDept"> |
|
|
|
import { handleTree } from '@/utils/tree' |
|
|
|
import { handleTree } from '@/utils/tree' |
|
|
|
// import * as DeptApi from '@/api/system/dept' |
|
|
|
import * as DeptApi from '@/api/system/dept' |
|
|
|
import DeptForm from './DeptForm.vue' |
|
|
|
import DeptForm from './DeptForm.vue' |
|
|
|
// import * as UserApi from '@/api/system/user' |
|
|
|
import { dateFormatter } from '@/utils/formatTime' |
|
|
|
const message = useMessage() // 消息弹窗 |
|
|
|
const message = useMessage() // 消息弹窗 |
|
|
|
const { t } = useI18n() // 国际化 |
|
|
|
const { t } = useI18n() // 国际化 |
|
|
|
|
|
|
|
|
|
|
|
const loading = ref(true) // 列表的加载中 |
|
|
|
const loading = ref(true) // 列表的加载中 |
|
|
|
const list = ref() // 列表的数据 |
|
|
|
const list = ref() // 列表的数据 |
|
|
|
const queryParams = reactive({ |
|
|
|
const queryParams = reactive({ |
|
|
|
name: undefined, |
|
|
|
name: undefined |
|
|
|
pageNo: 1, |
|
|
|
|
|
|
|
pageSize: 20 |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
const queryFormRef = ref() // 搜索的表单 |
|
|
|
const queryFormRef = ref() // 搜索的表单 |
|
|
|
|
|
|
|
|
|
|
@ -55,11 +53,7 @@ const queryFormRef = ref() // 搜索的表单 |
|
|
|
const getList = async () => { |
|
|
|
const getList = async () => { |
|
|
|
loading.value = true |
|
|
|
loading.value = true |
|
|
|
try { |
|
|
|
try { |
|
|
|
// const data = await DeptApi.getDeptPage(queryParams) |
|
|
|
const data = await DeptApi.getDeptPage(queryParams) |
|
|
|
const data = [ |
|
|
|
|
|
|
|
{ name: '职能部', id: 10001, leader: '张三', status: 1 }, |
|
|
|
|
|
|
|
{ name: '财务部', id: 10002, leader: '李四', parentId: 10001, status: 1 } |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
list.value = handleTree(data) |
|
|
|
list.value = handleTree(data) |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
loading.value = false |
|
|
|
loading.value = false |
|
|
@ -68,13 +62,11 @@ const getList = async () => { |
|
|
|
|
|
|
|
|
|
|
|
/** 搜索按钮操作 */ |
|
|
|
/** 搜索按钮操作 */ |
|
|
|
const handleQuery = () => { |
|
|
|
const handleQuery = () => { |
|
|
|
queryParams.pageNo = 1 |
|
|
|
|
|
|
|
getList() |
|
|
|
getList() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** 重置按钮操作 */ |
|
|
|
/** 重置按钮操作 */ |
|
|
|
const resetQuery = () => { |
|
|
|
const resetQuery = () => { |
|
|
|
queryParams.pageNo = 1 |
|
|
|
|
|
|
|
queryFormRef.value.resetFields() |
|
|
|
queryFormRef.value.resetFields() |
|
|
|
handleQuery() |
|
|
|
handleQuery() |
|
|
|
} |
|
|
|
} |
|
|
@ -88,11 +80,10 @@ const openForm = (type: string, id?: number) => { |
|
|
|
/** 删除按钮操作 */ |
|
|
|
/** 删除按钮操作 */ |
|
|
|
const handleDelete = async (id: number) => { |
|
|
|
const handleDelete = async (id: number) => { |
|
|
|
try { |
|
|
|
try { |
|
|
|
console.log(id) |
|
|
|
|
|
|
|
// 删除的二次确认 |
|
|
|
// 删除的二次确认 |
|
|
|
await message.delConfirm() |
|
|
|
await message.delConfirm() |
|
|
|
// 发起删除 |
|
|
|
// 发起删除 |
|
|
|
// await DeptApi.deleteDept(id) |
|
|
|
await DeptApi.deleteDept(id) |
|
|
|
message.success(t('common.delSuccess')) |
|
|
|
message.success(t('common.delSuccess')) |
|
|
|
// 刷新列表 |
|
|
|
// 刷新列表 |
|
|
|
await getList() |
|
|
|
await getList() |
|
|
|