字典树修改
This commit is contained in:
33
src/api/system-boot/dictType.ts
Normal file
33
src/api/system-boot/dictType.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function dictTypeList(data: any) {
|
||||
return request({
|
||||
url: '/system-boot/dictType/list',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function dictTypeUpdate(data: any) {
|
||||
return request({
|
||||
url: '/system-boot/dictType/update',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function dictTypeAdd(data: any) {
|
||||
return request({
|
||||
url: '/system-boot/dictType/add',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function dictTypeDelete(data: any) {
|
||||
return request({
|
||||
url: '/system-boot/dictType/delete',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
@@ -25,8 +25,8 @@
|
||||
</el-form>
|
||||
</div>
|
||||
<template v-if="$slots.select || datePicker">
|
||||
<el-button @click="onComSearch" type="primary">查询</el-button>
|
||||
<el-button @click="onResetForm">重置</el-button>
|
||||
<el-button @click="onComSearch" type="primary" :icon="Search">查询</el-button>
|
||||
<el-button @click="onResetForm" :icon="RefreshLeft">重置</el-button>
|
||||
<div class="table-search-button-group" v-if="showUnfoldButton">
|
||||
<el-button class="table-search-button-item" color="#dcdfe6" plain @click="showSelectChange">
|
||||
<Icon size="14" name="el-icon-Search" />
|
||||
@@ -45,11 +45,14 @@ import DatePicker from '@/components/form/datePicker/index.vue'
|
||||
import Area from '@/components/form/area/index.vue'
|
||||
import { mainHeight } from '@/utils/layout'
|
||||
import { useDictData } from '@/stores/dictData'
|
||||
import { Search, RefreshLeft } from '@element-plus/icons-vue'
|
||||
|
||||
const tableStore = inject('tableStore') as TableStore
|
||||
const tableHeader = ref()
|
||||
const datePickerRef = ref()
|
||||
const dictData = useDictData()
|
||||
const areaRef = ref()
|
||||
|
||||
interface Props {
|
||||
datePicker?: boolean
|
||||
area?: boolean
|
||||
|
||||
@@ -29,12 +29,10 @@ const state = reactive({
|
||||
const refresh = () => {
|
||||
router.go(0)
|
||||
}
|
||||
if (isAdminApp() && navTabs.state.tabsViewRoutes.length > 0) {
|
||||
let firstRoute = getFirstRoute(navTabs.state.tabsViewRoutes)
|
||||
if (firstRoute) routePush(firstRoute.path)
|
||||
}else{
|
||||
routePush('/')
|
||||
}
|
||||
// if (isAdminApp() && navTabs.state.tabsViewRoutes.length > 0) {
|
||||
// let firstRoute = getFirstRoute(navTabs.state.tabsViewRoutes)
|
||||
// if (firstRoute) routePush(firstRoute.path)
|
||||
// }
|
||||
|
||||
timer = window.setTimeout(() => {
|
||||
state.showReload = true
|
||||
|
||||
@@ -24,7 +24,7 @@ export const adminBaseRoute = {
|
||||
meta: {
|
||||
title: `pagesTitle.loading`
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ function createAxios<Data = any, T = ApiPromise<Data>>(
|
||||
// 登录失效
|
||||
ElNotification({
|
||||
type: 'error',
|
||||
message: response.data.msg
|
||||
message: response.data.message
|
||||
})
|
||||
adminInfo.removeToken()
|
||||
router.push({ name: 'login' })
|
||||
|
||||
114
src/views/setting/dictionary/list/detail.vue
Normal file
114
src/views/setting/dictionary/list/detail.vue
Normal file
@@ -0,0 +1,114 @@
|
||||
<template>
|
||||
<div class='default-main'>
|
||||
<TableHeader>
|
||||
<template #select>
|
||||
<el-form-item label='过滤筛选'>
|
||||
<el-input
|
||||
style='width: 240px'
|
||||
v-model='tableStore.table.params.searchValue'
|
||||
clearable
|
||||
placeholder='请输入名称或编码筛选'
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template #operation>
|
||||
<el-button :icon='Plus' type='primary' @click='add'>新增字典类型</el-button>
|
||||
</template>
|
||||
</TableHeader>
|
||||
<Table ref='tableRef' />
|
||||
<PopupEdit ref='popupEditRef'></PopupEdit>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang='ts'>
|
||||
import { Plus } from '@element-plus/icons-vue'
|
||||
import { ref, onMounted, provide } from 'vue'
|
||||
import TableStore from '@/utils/tableStore'
|
||||
import Table from '@/components/table/index.vue'
|
||||
import TableHeader from '@/components/table/header/index.vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import PopupEdit from './popupEdit.vue'
|
||||
import { dictTypeDelete } from '@/api/system-boot/dictType'
|
||||
import router from '@/router'
|
||||
|
||||
|
||||
defineOptions({
|
||||
name: 'setting/dictionary/list/detail'
|
||||
})
|
||||
const popupEditRef = ref()
|
||||
const tableStore = new TableStore({
|
||||
url: '/system-boot/dictType/list',
|
||||
method: 'POST',
|
||||
column: [
|
||||
{ title: '序号', type: 'seq', width: '60' },
|
||||
{ title: '名称', field: 'name' },
|
||||
{ title: '编码', field: 'code' },
|
||||
{ title: '开启等级', field: 'openLevelName' },
|
||||
{ title: '开启算法', field: 'openDescribeName' },
|
||||
{ title: '状态', field: 'stateName' },
|
||||
{ title: '字典描述', field: 'remark' },
|
||||
{ title: '创建时间', field: 'createTime' },
|
||||
{ title: '更新时间', field: 'updateTime' },
|
||||
{
|
||||
title: '操作',
|
||||
width: '180',
|
||||
render: 'buttons',
|
||||
fixed: 'right',
|
||||
buttons: [
|
||||
{
|
||||
title: '查看',
|
||||
type: 'primary',
|
||||
icon: 'el-icon-ZoomIn',
|
||||
render: 'tipButton',
|
||||
click: row => {
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '编辑',
|
||||
type: 'primary',
|
||||
icon: 'el-icon-EditPen',
|
||||
render: 'tipButton',
|
||||
click: row => {
|
||||
popupEditRef.value.open('编辑字典类型', row)
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '删除',
|
||||
type: 'danger',
|
||||
icon: 'el-icon-Delete',
|
||||
render: 'confirmButton',
|
||||
popconfirm: {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
confirmButtonType: 'danger',
|
||||
title: '确定删除该字典类型吗?'
|
||||
},
|
||||
click: row => {
|
||||
dictTypeDelete([row.id]).then(() => {
|
||||
ElMessage.success('删除成功')
|
||||
tableStore.index()
|
||||
})
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
loadCallback: () => {
|
||||
tableStore.table.data.forEach((item: any) => {
|
||||
item.stateName = item.state === 1 ? '正常' : '删除'
|
||||
item.openLevelName = item.openLevel === 1 ? '开启' : '不开启'
|
||||
item.openDescribeName = item.openDescribe === 1 ? '开启' : '不开启'
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
provide('tableStore', tableStore)
|
||||
tableStore.table.params.searchValue = ''
|
||||
tableStore.table.params.searchState = 0
|
||||
onMounted(() => {
|
||||
tableStore.index()
|
||||
})
|
||||
const add = () => {
|
||||
popupEditRef.value.open('新增字典类型')
|
||||
}
|
||||
|
||||
</script>
|
||||
121
src/views/setting/dictionary/list/index.vue
Normal file
121
src/views/setting/dictionary/list/index.vue
Normal file
@@ -0,0 +1,121 @@
|
||||
<template>
|
||||
<div class='default-main'>
|
||||
<TableHeader>
|
||||
<template #select>
|
||||
<el-form-item label='过滤筛选'>
|
||||
<el-input
|
||||
style='width: 240px'
|
||||
v-model='tableStore.table.params.searchValue'
|
||||
clearable
|
||||
placeholder='请输入名称或编码筛选'
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template #operation>
|
||||
<el-button :icon='Plus' type='primary' @click='add'>新增字典类型</el-button>
|
||||
</template>
|
||||
</TableHeader>
|
||||
<Table ref='tableRef' />
|
||||
<PopupEdit ref='popupEditRef'></PopupEdit>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang='ts'>
|
||||
import { Plus } from '@element-plus/icons-vue'
|
||||
import { ref, onMounted, provide } from 'vue'
|
||||
import TableStore from '@/utils/tableStore'
|
||||
import Table from '@/components/table/index.vue'
|
||||
import TableHeader from '@/components/table/header/index.vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import PopupEdit from './popupEdit.vue'
|
||||
import { dictTypeDelete } from '@/api/system-boot/dictType'
|
||||
import router from '@/router/index'
|
||||
|
||||
|
||||
|
||||
defineOptions({
|
||||
name: 'setting/dictionary/list'
|
||||
})
|
||||
const popupEditRef = ref()
|
||||
const tableStore = new TableStore({
|
||||
url: '/system-boot/dictType/list',
|
||||
method: 'POST',
|
||||
column: [
|
||||
{ title: '序号', type: 'seq', width: '60' },
|
||||
{ title: '名称', field: 'name' },
|
||||
{ title: '编码', field: 'code' },
|
||||
{ title: '开启等级', field: 'openLevelName' },
|
||||
{ title: '开启算法', field: 'openDescribeName' },
|
||||
{ title: '状态', field: 'stateName' },
|
||||
{ title: '字典描述', field: 'remark' },
|
||||
{ title: '创建时间', field: 'createTime' },
|
||||
{ title: '更新时间', field: 'updateTime' },
|
||||
{
|
||||
title: '操作',
|
||||
width: '180',
|
||||
render: 'buttons',
|
||||
fixed: 'right',
|
||||
buttons: [
|
||||
{
|
||||
title: '查看',
|
||||
type: 'primary',
|
||||
icon: 'el-icon-ZoomIn',
|
||||
render: 'tipButton',
|
||||
click: row => {
|
||||
// router.push({
|
||||
// path: '/admin/setting/dictionary/list/detail',
|
||||
// params: {
|
||||
// id: row.id
|
||||
// }
|
||||
// })
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '编辑',
|
||||
type: 'primary',
|
||||
icon: 'el-icon-EditPen',
|
||||
render: 'tipButton',
|
||||
click: row => {
|
||||
popupEditRef.value.open('编辑字典类型', row)
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
title: '删除',
|
||||
type: 'danger',
|
||||
icon: 'el-icon-Delete',
|
||||
render: 'confirmButton',
|
||||
popconfirm: {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
confirmButtonType: 'danger',
|
||||
title: '确定删除该字典类型吗?'
|
||||
},
|
||||
click: row => {
|
||||
dictTypeDelete([row.id]).then(() => {
|
||||
ElMessage.success('删除成功')
|
||||
tableStore.index()
|
||||
})
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
loadCallback: () => {
|
||||
tableStore.table.data.forEach((item: any) => {
|
||||
item.stateName = item.state === 1 ? '正常' : '删除'
|
||||
item.openLevelName = item.openLevel === 1 ? '开启' : '不开启'
|
||||
item.openDescribeName = item.openDescribe === 1 ? '开启' : '不开启'
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
provide('tableStore', tableStore)
|
||||
tableStore.table.params.searchValue = ''
|
||||
tableStore.table.params.searchState = 0
|
||||
onMounted(() => {
|
||||
tableStore.index()
|
||||
})
|
||||
const add = () => {
|
||||
popupEditRef.value.open('新增字典类型')
|
||||
}
|
||||
</script>
|
||||
130
src/views/setting/dictionary/list/popupEdit.vue
Normal file
130
src/views/setting/dictionary/list/popupEdit.vue
Normal file
@@ -0,0 +1,130 @@
|
||||
<template>
|
||||
<el-dialog class='cn-operate-dialog' v-model='dialogVisible' :title='title'>
|
||||
<el-scrollbar>
|
||||
<el-form :inline='false' :model='form' label-width='120px' :rules='rules' ref='formRef'>
|
||||
<el-form-item label='名称' prop='name'>
|
||||
<el-input v-model='form.name'></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label='编码' class='top' prop='code'>
|
||||
<el-input v-model='form.code'></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label='排序' class='top' prop='sort'>
|
||||
<el-input-number v-model="form.sort" :min="0" />
|
||||
</el-form-item>
|
||||
<el-form-item label='开启等级' class='top'>
|
||||
<el-select
|
||||
v-model='form.openLevel'
|
||||
placeholder='选择开启等级'
|
||||
style='width: 100%'
|
||||
>
|
||||
<el-option
|
||||
v-for='item in OpenLevel'
|
||||
:key='item.value'
|
||||
:label='item.label'
|
||||
:value='item.value'
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label='开启算法' class='top'>
|
||||
<el-select
|
||||
v-model='form.openDescribe'
|
||||
placeholder='选择开启算法'
|
||||
style='width: 100%'
|
||||
>
|
||||
<el-option
|
||||
v-for='item in OpenDescribe'
|
||||
:key='item.value'
|
||||
:label='item.label'
|
||||
:value='item.value'
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label='字典描述' class='top'>
|
||||
<el-input
|
||||
v-model='form.remark'
|
||||
type='textarea'
|
||||
:rows='2'
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-scrollbar>
|
||||
|
||||
<template #footer>
|
||||
<span class='dialog-footer'>
|
||||
<el-button @click='dialogVisible = false'>取消</el-button>
|
||||
<el-button type='primary' @click='submit'>确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script lang='ts' setup>
|
||||
import { ref, inject } from 'vue'
|
||||
import { reactive } from 'vue'
|
||||
import TableStore from '@/utils/tableStore'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useAdminInfo } from '@/stores/adminInfo'
|
||||
import { dictTypeAdd, dictTypeUpdate } from '@/api/system-boot/dictType'
|
||||
|
||||
const adminInfo = useAdminInfo()
|
||||
const tableStore = inject('tableStore') as TableStore
|
||||
const OpenLevel = [
|
||||
{ value: 0, label: '不开启' },
|
||||
{ value: 1, label: '开启' }
|
||||
]
|
||||
const OpenDescribe = [
|
||||
{ value: 0, label: '不开启' },
|
||||
{ value: 1, label: '开启' }
|
||||
]
|
||||
const formRef = ref()
|
||||
const form = reactive({
|
||||
openLevel: 0,
|
||||
openDescribe: 0,
|
||||
remark: '',
|
||||
name: '',
|
||||
code: '',
|
||||
sort: 0,
|
||||
id: ''
|
||||
})
|
||||
const rules = {
|
||||
name: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
||||
sort: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
||||
code: [{ required: true, message: '不能为空', trigger: 'blur' }]
|
||||
}
|
||||
const dialogVisible = ref(false)
|
||||
const title = ref('新增字典类型')
|
||||
const open = (text: string, data?: anyObj) => {
|
||||
title.value = text
|
||||
dialogVisible.value = true
|
||||
if (data) {
|
||||
for (let key in form) {
|
||||
form[key] = data[key]
|
||||
}
|
||||
} else {
|
||||
for (let key in form) {
|
||||
form[key] = ''
|
||||
}
|
||||
form.openLevel = 0
|
||||
form.openDescribe = 0
|
||||
form.sort = 0
|
||||
}
|
||||
}
|
||||
const submit = async () => {
|
||||
formRef.value.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
if (form.id) {
|
||||
await dictTypeUpdate(form)
|
||||
} else {
|
||||
await dictTypeAdd(form)
|
||||
}
|
||||
ElMessage.success('保存成功')
|
||||
tableStore.index()
|
||||
dialogVisible.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
33
src/views/setting/dictionary/tree/index.vue
Normal file
33
src/views/setting/dictionary/tree/index.vue
Normal file
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<div class="default-main">
|
||||
<TableHeader datePicker> </TableHeader>
|
||||
<Table ref="tableRef" />
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { Plus } from '@element-plus/icons-vue'
|
||||
import { ref, onMounted, provide } from 'vue'
|
||||
import TableStore from '@/utils/tableStore'
|
||||
import Table from '@/components/table/index.vue'
|
||||
import TableHeader from '@/components/table/header/index.vue'
|
||||
|
||||
defineOptions({
|
||||
name: 'setting/dictionary/tree'
|
||||
})
|
||||
const tableStore = new TableStore({
|
||||
url: '/cs-device-boot/csEventSendMsg/queryLog',
|
||||
method: 'POST',
|
||||
column: [
|
||||
{ title: '推送用户', field: 'userName', align: 'center' },
|
||||
{ title: '推送内容', field: 'showName', align: 'center' },
|
||||
{ title: '推送时间', field: 'sendTime', align: 'center' },
|
||||
]
|
||||
})
|
||||
|
||||
provide('tableStore', tableStore)
|
||||
tableStore.table.params.searchState = 0
|
||||
onMounted(() => {
|
||||
tableStore.index()
|
||||
})
|
||||
const addMenu = () => {}
|
||||
</script>
|
||||
Reference in New Issue
Block a user