微调
This commit is contained in:
@@ -2,7 +2,7 @@ import http from '@/api'
|
||||
import { type Dict } from '@/api/system/dictionary/interface'
|
||||
|
||||
//获取字典类型
|
||||
export const getDictTreeList = (params: Dict.ReqDictTreeParams) => {
|
||||
export const getDictTreeList = (params: Dict.ResDictTree) => {
|
||||
return http.get(`/dictTree/queryTree`, params)
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ export const updateDictTree = (params: Dict.ResDictTree) => {
|
||||
}
|
||||
|
||||
//删除字典类型
|
||||
export const deleteDictTree = (params: string[]) => {
|
||||
return http.post(`/dictTree/delete`, params)
|
||||
export const deleteDictTree = (params: Dict.ResDictTree) => {
|
||||
return http.post(`/dictTree/delete?id=${params.id}`)
|
||||
}
|
||||
|
||||
|
||||
@@ -141,18 +141,6 @@ export namespace Dict {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 树形字典数据表格分页查询参数
|
||||
*/
|
||||
export interface ReqDictTreeParams extends ReqPage{
|
||||
id: string;//指标字典表Id
|
||||
pid: string;//
|
||||
pids: string;//
|
||||
name:string;//
|
||||
code:string;//
|
||||
sort:number;//
|
||||
}
|
||||
|
||||
/**
|
||||
* 树形字典数据新增、修改、根据id查询返回的对象
|
||||
@@ -165,7 +153,7 @@ export namespace Dict {
|
||||
code:string;//
|
||||
sort:number;//
|
||||
remark?:string;//
|
||||
status?:number;//'状态(字典 0正常 1停用 2删除)
|
||||
state?:number;//'状态(字典 0正常 1停用 2删除)
|
||||
createBy?:string | null;//
|
||||
createTime?:string | null;//
|
||||
updateBy?:string | null;//
|
||||
@@ -176,11 +164,5 @@ export namespace Dict {
|
||||
children?: ResDictTree[];
|
||||
}
|
||||
|
||||
/**
|
||||
* 电能质量指标字典数据表格查询分页返回的对象;
|
||||
*/
|
||||
export interface ResDictTreePage extends ResPage<ResDictTree> {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ export namespace User {
|
||||
loginTime?: string;//最后一次登录时间
|
||||
loginErrorTimes: number;//登录错误次数
|
||||
lockTime?: string; //用户密码错误锁定时间
|
||||
state:number;//0-删除;1-正常;2-锁定;3-待审核;4-休眠;5-密码过期
|
||||
createBy?: string;//创建用户
|
||||
createTime?: string;//创建时间
|
||||
updateBy?: string;//更新用户
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
:data='resourceData'
|
||||
@selection-change="handleSelectionChange"
|
||||
type="selection"
|
||||
:pagination="false"
|
||||
>
|
||||
<!-- 表格 header 按钮 -->
|
||||
<template #tableHeader>
|
||||
|
||||
@@ -21,13 +21,7 @@
|
||||
const {dialogVisible,data} = defineProps<{
|
||||
dialogVisible: boolean;
|
||||
title: string;
|
||||
<<<<<<< HEAD
|
||||
data: Role.Permission;
|
||||
=======
|
||||
data: Role.ResRoleLimport { Role } from '@/api/role/interface'
|
||||
import { dialogBig } from '@/utils/elementBind'
|
||||
ist;
|
||||
>>>>>>> 74c03a2358e19cae853711ea22910b1697a4a903
|
||||
}>()
|
||||
|
||||
// const leftvalue = ref<Role.Permission[]>([])
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<el-form-item label='设备类型' prop='devType'>
|
||||
<el-select v-model="formContent.devType" clearable placeholder="请选择设备类型">
|
||||
<el-option
|
||||
v-for="item in dictStore.getDictData('High_Cate')"
|
||||
v-for="item in dictStore.getDictData('Dev_Type')"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.code"
|
||||
@@ -22,27 +22,48 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="设备通道数" prop="devChns" placeholder="请输入设备通道">
|
||||
<el-input v-model="formContent.devChns" />
|
||||
<el-form-item label="设备通道数" prop="devChns">
|
||||
<el-select v-model="formContent.devChns" clearable placeholder="请选择设备通道数">
|
||||
<el-option
|
||||
v-for="item in dictStore.getDictData('Dev_Chns')"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="24" >
|
||||
<el-col :span="8">
|
||||
<el-form-item label="额定电压(V)" prop="devVolt">
|
||||
<el-input v-model='formContent.devVolt' placeholder="请输入额定电压"/>
|
||||
<el-select v-model="formContent.devVolt" clearable placeholder="请选择额定电压">
|
||||
<el-option
|
||||
v-for="item in dictStore.getDictData('Dev_Volt')"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="额定电流(A)" prop="devCurr" placeholder="请输入额定电流">
|
||||
<el-input v-model="formContent.devCurr" />
|
||||
<el-form-item label="额定电流(A)" prop="devCurr" >
|
||||
<el-select v-model="formContent.devCurr" clearable placeholder="请选择额定电流">
|
||||
<el-option
|
||||
v-for="item in dictStore.getDictData('Dev_Curr')"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label='生产厂家' prop='manufacturer'>
|
||||
<el-select v-model="formContent.manufacturer" clearable placeholder="请选择生产厂家">
|
||||
<el-option
|
||||
v-for="item in dictStore.getDictData('High_Cate')"
|
||||
v-for="item in dictStore.getDictData('Dev_Manufacturers')"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.code"
|
||||
|
||||
@@ -69,7 +69,7 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
||||
{
|
||||
prop: 'devType',
|
||||
label: '类型',
|
||||
enum: dictStore.getDictData('High_Cate'),
|
||||
enum: dictStore.getDictData('Dev_Type'),
|
||||
fieldNames: { label: 'name', value: 'code' },
|
||||
minWidth: 200,
|
||||
},
|
||||
@@ -77,21 +77,27 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
||||
prop: 'devChns',
|
||||
label: '设备通道数',
|
||||
minWidth: 110,
|
||||
enum: dictStore.getDictData('Dev_Chns'),
|
||||
fieldNames: { label: 'name', value: 'code' },
|
||||
},
|
||||
{
|
||||
prop: 'devVolt',
|
||||
label: '额定电压(V)',
|
||||
minWidth: 130,
|
||||
enum: dictStore.getDictData('Dev_Volt'),
|
||||
fieldNames: { label: 'name', value: 'code' },
|
||||
},
|
||||
{
|
||||
prop: 'devCurr',
|
||||
label: '额定电流(A)',
|
||||
minWidth: 130,
|
||||
enum: dictStore.getDictData('Dev_Curr'),
|
||||
fieldNames: { label: 'name', value: 'code' },
|
||||
},
|
||||
{
|
||||
prop: 'manufacturer',
|
||||
label: '生产厂商',
|
||||
enum: dictStore.getDictData('High_Cate'),
|
||||
enum: dictStore.getDictData('Dev_Manufacturers'),
|
||||
search: { el: 'select', props: { filterable: true }},
|
||||
fieldNames: { label: 'name', value: 'code' },
|
||||
minWidth: 200,
|
||||
|
||||
@@ -62,7 +62,7 @@ const columns = reactive<ColumnProps<Dict.ResDictData>[]>([
|
||||
{
|
||||
prop: 'name',
|
||||
label: '名称',
|
||||
width: 180,
|
||||
minWidth: 180,
|
||||
search: {
|
||||
el: 'input'
|
||||
}
|
||||
@@ -70,7 +70,7 @@ const columns = reactive<ColumnProps<Dict.ResDictData>[]>([
|
||||
{
|
||||
prop: 'code',
|
||||
label: '编码',
|
||||
width: 180,
|
||||
minWidth: 180,
|
||||
search: {
|
||||
el: 'input'
|
||||
}
|
||||
@@ -78,12 +78,12 @@ const columns = reactive<ColumnProps<Dict.ResDictData>[]>([
|
||||
{
|
||||
prop: 'value',
|
||||
label: '值',
|
||||
width: 180
|
||||
minWidth: 180
|
||||
},
|
||||
{
|
||||
prop: 'level',
|
||||
label: '事件等级',
|
||||
width: 180,
|
||||
minWidth: 180,
|
||||
render: scope => {
|
||||
return (
|
||||
<>
|
||||
@@ -99,13 +99,13 @@ const columns = reactive<ColumnProps<Dict.ResDictData>[]>([
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: '创建时间',
|
||||
width: 180
|
||||
minWidth: 180
|
||||
},
|
||||
{
|
||||
prop: 'operation',
|
||||
label: '操作',
|
||||
fixed: 'right',
|
||||
minWidth: 300
|
||||
width: 200
|
||||
},
|
||||
])
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
<el-form-item label='数据统计类型' :label-width='140' prop='statMethod'>
|
||||
<el-select v-model="selectedStatMethods" multiple placeholder="请选择数据统计类型">
|
||||
<el-option
|
||||
v-for="item in dictStore.getDictData('Event_Type')"
|
||||
v-for="item in dictStore.getDictData('stat_Method')"
|
||||
:key="item.value"
|
||||
:label="item.name"
|
||||
:value="item.code"
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
prop: 'statMethod',
|
||||
label: '数据统计类型',
|
||||
width: 250,
|
||||
enum: dictStore.getDictData('Event_Type'),
|
||||
enum: dictStore.getDictData('stat_Method'),
|
||||
fieldNames: { label: 'name', value: 'code' },
|
||||
render: (scope) => {
|
||||
// 假设 statMethod 是一个数组,包含多个 'code' 值
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
import { addDictTree, updateDictTree } from '@/api/system/dictionary/dictTree'
|
||||
import { computed, type Ref, ref } from 'vue';
|
||||
import { useDictStore } from '@/stores/modules/dict'
|
||||
import { type ResultData } from '@/api/interface';
|
||||
const dictStore = useDictStore()
|
||||
const selectedStatMethods = ref<string[]>([])
|
||||
// 定义弹出组件元信息
|
||||
const dialogFormRef = ref()
|
||||
function useMetaInfo() {
|
||||
@@ -48,7 +48,7 @@
|
||||
code: ' ',
|
||||
sort: 100,
|
||||
remark: '',
|
||||
status: 1,
|
||||
state: 0,
|
||||
children: [],
|
||||
})
|
||||
return { dialogVisible, titleType, formContent }
|
||||
@@ -59,13 +59,13 @@
|
||||
const resetFormContent = () => {
|
||||
formContent.value = {
|
||||
id: '',
|
||||
pid: '',
|
||||
pids: '',
|
||||
pid: '0',
|
||||
pids: '0',
|
||||
name: '',
|
||||
code: ' ',
|
||||
sort: 100,
|
||||
remark: '',
|
||||
status: 1,
|
||||
state: 0,
|
||||
children: [],
|
||||
}
|
||||
}
|
||||
@@ -76,8 +76,8 @@
|
||||
|
||||
// 定义表单校验规则
|
||||
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
||||
dataType: [{ required: true, message: '数据模型必选!', trigger: 'change' }],
|
||||
name: [{ required: true, message: '指标名称必填!', trigger: 'blur' }],
|
||||
name: [{ required: true, message: '字典名称必填!', trigger: 'blur' }],
|
||||
code: [{ required: true, message: '编码必填!', trigger: 'blur' }],
|
||||
})
|
||||
|
||||
// 关闭弹窗
|
||||
@@ -87,7 +87,6 @@
|
||||
resetFormContent()
|
||||
// 重置表单
|
||||
dialogFormRef.value?.resetFields()
|
||||
selectedStatMethods.value = []
|
||||
}
|
||||
|
||||
// 保存数据
|
||||
@@ -96,13 +95,18 @@
|
||||
dialogFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
if (formContent.value.id) {
|
||||
const result = await updateDictTree(formContent.value);
|
||||
let result: ResultData<unknown>;
|
||||
if( titleType.value == 'add'){
|
||||
result = await addDictTree(formContent.value);
|
||||
}else{
|
||||
result = await updateDictTree(formContent.value);
|
||||
}
|
||||
|
||||
if(result.code != 'A0000'){
|
||||
ElMessage.error({ message: result.message})
|
||||
}else{
|
||||
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
||||
}
|
||||
|
||||
} else {
|
||||
const result = await addDictTree(formContent.value);
|
||||
if(result.code != 'A0000'){
|
||||
@@ -126,7 +130,12 @@
|
||||
titleType.value = sign
|
||||
dialogVisible.value = true
|
||||
if (data.id) {
|
||||
formContent.value = { ...data }
|
||||
if(sign == 'add'){
|
||||
resetFormContent()
|
||||
formContent.value.pid = data.id
|
||||
}else{
|
||||
formContent.value = { ...data }
|
||||
}
|
||||
} else {
|
||||
resetFormContent()
|
||||
}
|
||||
|
||||
@@ -4,13 +4,14 @@
|
||||
ref='proTable'
|
||||
:columns='columns'
|
||||
:request-api='getDictTreeList'
|
||||
:pagination="false"
|
||||
>
|
||||
<template #tableHeader>
|
||||
<el-button type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
|
||||
</template>
|
||||
|
||||
<template #operation='scope'>
|
||||
<el-button type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
|
||||
<el-button type='primary' link :icon='CirclePlus' @click="openDialog('add',scope.row)">新增</el-button>
|
||||
<el-button type='primary' link :icon='EditPen' @click="openDialog('edit', scope.row)">编辑</el-button>
|
||||
<el-button type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
|
||||
</template>
|
||||
@@ -41,42 +42,49 @@
|
||||
{
|
||||
prop: 'name',
|
||||
label: '字典名称',
|
||||
width: 180,
|
||||
|
||||
},
|
||||
{
|
||||
prop: 'code',
|
||||
label: '编码',
|
||||
width: 180,
|
||||
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: '描述',
|
||||
width: 180,
|
||||
|
||||
},
|
||||
{
|
||||
prop: 'status',
|
||||
prop: 'state',
|
||||
label: '状态',
|
||||
width: 180,
|
||||
minWidth:30,
|
||||
enum: dictStore.getDictData('state'),
|
||||
fieldNames: { label: 'label', value: 'code' },
|
||||
render: scope => {
|
||||
return (
|
||||
<el-tag type={scope.row.state === 0 ? 'success' : (scope.row.state === 1 ? 'warning' : 'danger')}>
|
||||
{scope.row.state === 0 ? '正常' : (scope.row.state === 1 ? '停用' : '删除')}
|
||||
</el-tag>
|
||||
)
|
||||
},
|
||||
},
|
||||
{
|
||||
prop: 'operation',
|
||||
label: '操作',
|
||||
fixed: 'right',
|
||||
minWidth: 200,
|
||||
},
|
||||
])
|
||||
|
||||
|
||||
// 打开 drawer(新增、编辑)
|
||||
const openDialog = (titleType: string, row: Partial<Dict.ResDictTree> = {}) => {
|
||||
treePopup.value?.open(titleType, row)
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 删除字典类型
|
||||
const handleDelete = async (params: Dict.ResDictTree) => {
|
||||
await useHandleData(deleteDictTree, [params.id], `删除【${params.name}】树形字典类型`)
|
||||
console.log(params)
|
||||
await useHandleData(deleteDictTree, params, `删除【${params.name}】树形字典类型`)
|
||||
proTable.value?.getTableList()
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ const columns = reactive<ColumnProps<Dict.ResDictType>[]>([
|
||||
{
|
||||
prop: 'name',
|
||||
label: '类型名称',
|
||||
width: 180,
|
||||
minWidth: 180,
|
||||
search: {
|
||||
el: 'input',
|
||||
},
|
||||
@@ -57,7 +57,7 @@ const columns = reactive<ColumnProps<Dict.ResDictType>[]>([
|
||||
{
|
||||
prop: 'code',
|
||||
label: '类型编码',
|
||||
width: 180,
|
||||
minWidth: 200,
|
||||
search: {
|
||||
el: 'input',
|
||||
},
|
||||
@@ -67,16 +67,21 @@ const columns = reactive<ColumnProps<Dict.ResDictType>[]>([
|
||||
label: '描述',
|
||||
minWidth: 300,
|
||||
},
|
||||
{
|
||||
prop: 'sort',
|
||||
label: '排序',
|
||||
minWidth: 70,
|
||||
},
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: '创建时间',
|
||||
width: 180,
|
||||
minWidth: 180,
|
||||
},
|
||||
{
|
||||
prop: 'operation',
|
||||
label: '操作',
|
||||
fixed: 'right',
|
||||
width: 330,
|
||||
minWidth: 300,
|
||||
},
|
||||
])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user