This commit is contained in:
高云鹏 2024-10-25 10:00:53 +08:00
commit 1469d6cb0d
9 changed files with 1460 additions and 15 deletions

View File

@ -1,4 +1,12 @@
import createAxios from '/@/utils/axios' import createAxios from '/@/utils/axios'
//左侧树查询
export function enumTreeQuery(params: object = {}) {
return createAxios({
url: '/api/enum/queryEnumTypesList',
method: 'POST',
data: params,
})
}
// 枚举类型新增 // 枚举类型新增
export function enumTypeAdd(params: object = {}) { export function enumTypeAdd(params: object = {}) {
return createAxios({ return createAxios({
@ -8,6 +16,24 @@ export function enumTypeAdd(params: object = {}) {
}) })
} }
// 编辑类型新增
export function enumTypecurEdit(params: object = {}) {
return createAxios({
url: '/api/enum/updateEnumTypes',
method: 'POST',
data: params,
})
}
// 枚举类型删除
export function enumTypeDelete(params: object = {}) {
return createAxios({
url: '/api/enum/deleteEnumTypes',
method: 'POST',
data: params,
})
}
//表格查询 //表格查询
export function enumListQuery(params: object = {}) { export function enumListQuery(params: object = {}) {
return createAxios({ return createAxios({
@ -17,14 +43,7 @@ export function enumListQuery(params: object = {}) {
}) })
} }
//左侧树查询
export function enumTreeQuery(params: object = {}) {
return createAxios({
url: '/api/enum/queryEnumTypesList',
method: 'POST',
data: params,
})
}
// 枚举值新增 // 枚举值新增
export function enumValueAdd(params: object = {}) { export function enumValueAdd(params: object = {}) {
return createAxios({ return createAxios({

Binary file not shown.

After

Width:  |  Height:  |  Size: 623 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

File diff suppressed because it is too large Load Diff

View File

@ -10,6 +10,7 @@
:props="defaultProps" :props="defaultProps"
node-key="id" node-key="id"
@node-click="handleNodeClick" @node-click="handleNodeClick"
@node-contextmenu="enumContextMenu"
/> />
</el-main> </el-main>
@ -79,6 +80,31 @@
</template> </template>
</el-dialog> </el-dialog>
<!--编辑枚举类型-->
<el-dialog v-model="visibleTypeEdit" title="编辑枚举类型" width="500" :before-close="handleCloseTypeEdit">
<el-form
ref="formRef"
:inline="true"
:model="formInlineEdit"
:rules="rules"
style="padding: 24px 40px; font-size: 14px; line-height: 1.5; word-wrap: break-word; font-size: 20px"
>
<el-form-item label="名称:" prop="name">
<el-input v-model="formInlineEdit.name" placeholder="" clearable />
</el-form-item>
<el-form-item label="&nbsp;&nbsp;描述:">
<el-input v-model="formInlineEdit.description" placeholder="" clearable />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="visibleTypeEdit = false">取消</el-button>
<el-button type="primary" @click="onSubmitTypeEdit">提交</el-button>
</div>
</template>
</el-dialog>
<!--新增枚举值--> <!--新增枚举值-->
<el-dialog v-model="visibleValueAdd" title="新增枚举值" width="500" :before-close="handleClosevalue"> <el-dialog v-model="visibleValueAdd" title="新增枚举值" width="500" :before-close="handleClosevalue">
<el-form <el-form
@ -155,21 +181,39 @@
</div> </div>
</template> </template>
</el-dialog> </el-dialog>
<ContextMenu :pos="enumcontextMenuPos" v-model:visible="enumOperateVisible">
<template #default>
<div class="modelOperate">
<el-button @click="enumTypeEdit(curnodeData)">修改</el-button>
<el-popconfirm title="确认删除?" @confirm="delenumType">
<template #reference>
<el-button @click.stop>删除</el-button>
</template>
</el-popconfirm>
</div>
</template>
</ContextMenu>
</el-container> </el-container>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import {nextTick, onMounted, reactive, ref} from 'vue' import {nextTick, onMounted, reactive, ref} from 'vue'
import { Search, Plus, CaretRight } from '@element-plus/icons-vue' import { Search, Plus } from '@element-plus/icons-vue'
import { ElMessage, ElMessageBox, FormRules } from 'element-plus' import { ElMessage, FormRules } from 'element-plus'
import { import {
enumListQuery, enumListQuery,
enumTreeQuery, enumTreeQuery,
enumTypeAdd, enumTypeAdd,
enumTypecurEdit,
enumTypeDelete,
enumValueAdd, enumValueAdd,
enumValueDelete, enumValuepageEdit enumValueDelete,
enumValuepageEdit
} from "/@/api/backend/Enumeration/request"; } from "/@/api/backend/Enumeration/request";
import ContextMenu from '/@/views/backend/auth/model/contextMenu.vue'
import {delModelReq} from "/@/api/backend/deviceModel/request";
const activeName = ref('1') const activeName = ref('1')
@ -179,7 +223,6 @@ interface Tree {
enumDesc: string, enumDesc: string,
} }
const defaultProps = { const defaultProps = {
children: 'children', children: 'children',
label: 'description', label: 'description',
@ -236,13 +279,23 @@ const enumTreeTypeList = () => {
}) })
} }
const queryParameter = ref() const queryParameter = ref()
const nodename = ref()
const curnodeData=ref({
id: '',
description: '',
name:''
})
const handleNodeClick = (data: any) => { const handleNodeClick = (data: any) => {
queryParameter.value = data queryParameter.value = data
enumTypeId.value=data.id enumTypeId.value=data.id
queryListData.enumTypeId=data.id, queryListData.enumTypeId=data.id
queryListData.description=queryName.value, queryListData.description=queryName.value
queryListData.pageNum=currentPage.value, queryListData.pageNum=currentPage.value
queryListData.pageSize=currentPageSize.value queryListData.pageSize=currentPageSize.value
nodename.value=data.description
curnodeData.value.id=data.id
curnodeData.value.name=data.name
curnodeData.value.description=data.description
queryenumValueMethod(queryListData) queryenumValueMethod(queryListData)
} }
@ -492,6 +545,87 @@ const EditonSubmitvalue = () => {
}) })
} }
const visibleTypeEdit=ref(false)
const formInlineEdit=reactive({
id:'',
name: '',
description: ''
})
const enumTypeEdit = (curnodeData) => {
visibleTypeEdit.value=true
formInlineEdit.id = curnodeData.id
formInlineEdit.name = curnodeData.name
formInlineEdit.description = curnodeData.description
}
const handleCloseTypeEdit = (done: () => void) => {
visibleTypeEdit.value = false
}
const onSubmitTypeEdit = () => {
formRef.value.validate((valid: any) => {
if (valid) {
enumTypecurEdit(formInlineEdit).then((res: any) => {
if (res.code == 200) {
enumTreeTypeList()
ElMessage({
message: res.msg,
type: 'success',
})
} else {
ElMessage.error({
message: res.msg,
type: 'error',
})
}
})
visibleTypeEdit.value = false
}
})
}
const contextMenuTreeData=ref({
id:'',
name: '',
description: ''
})
const enumOperateVisible = ref(false)
const enumcontextMenuPos = ref({
x: 0,
y: 0,
})
const enumContextMenu = (event: any,curnodeData) => {
enumcontextMenuPos.value.x = event.pageX
enumcontextMenuPos.value.y = event.pageY
contextMenuTreeData.value = curnodeData
if(nodename.value=="枚举类型配置"||nodename.value==undefined){
enumOperateVisible.value = false
}else{
enumOperateVisible.value = true
}
}
const delenumType = () => {
enumTypeDelete({ id: contextMenuTreeData.value!.id! })
.then((res) => {
if (res.code == 200) {
enumTreeTypeList()
ElMessage({
message: res.msg,
type: 'success',
})
} else {
ElMessage.error({
message: res.msg,
type: 'error',
})
}
})
.catch((err) => {
ElMessage.error(err?.response?.data?.msg ?? '删除失败')
})
}
onMounted(() => { onMounted(() => {
enumTreeTypeList() enumTreeTypeList()
}) })
@ -584,5 +718,16 @@ $paginationHeight: 32px;
width: 100%; width: 100%;
} }
} }
.modelOperate{
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
width: 80px;
height: 80px;
.el-button {
margin: 0;
}
}
} }
</style> </style>