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