Browse Source

解决冲突

develop
ljlong_2630 10 months ago
parent
commit
e8ab3dda9d
  1. 12
      src/api/model/tbserverinfo.js
  2. 87
      src/views/model/device/index.vue
  3. 17
      src/views/model/devicemodel/editModel.vue
  4. 233
      src/views/model/paramclass/index.vue
  5. 2
      src/views/model/tbserverinfo/index.vue

12
src/api/model/tbserverinfo.js

@ -58,4 +58,14 @@ export function queryTbserverinfoList() {
url: '/model/dcBusiServerinfo/select/list', url: '/model/dcBusiServerinfo/select/list',
method: 'get' method: 'get'
}) })
} }
// 查询TB服务信息列表
export function listserverinfoNoPage(query) {
return request({
url: '/model/dcBusiServerinfo/listNoPage',
method: 'get',
params: query
})
}

87
src/views/model/device/index.vue

@ -227,7 +227,7 @@
</el-col> </el-col>
</el-row> </el-row>
<!-- 添加或修改设备信息对话框 --> <!-- 添加或修改设备信息对话框 -->
<el-dialog :title="title" v-model="open" width="800px" append-to-body draggable> <el-dialog ref="deviceDialog" custom-class="deviceDialogClass" :title="title" v-model="open" width="800px" append-to-body draggable>
<el-form ref="deviceRef" :model="form" :rules="rules" label-width="125px"> <el-form ref="deviceRef" :model="form" :rules="rules" label-width="125px">
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
@ -267,6 +267,20 @@
<el-input v-model="form.issGroupName" placeholder="请输入通讯来源设备ID" /> <el-input v-model="form.issGroupName" placeholder="请输入通讯来源设备ID" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12" v-show="thingsboardShow">
<el-form-item label="thingsboard服务" prop="thingsboardServer">
<el-select v-model="form.thingsboardServer" placeholder="请选择thingsboard服务">
<el-option v-for="dict in tbServerList" :key="dict.id" :label="dict.seviceName" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12" v-show="thingsboardShow">
<el-form-item label="是否同步设备到tb服务" prop="synchroDevice">
<el-select v-model="form.synchroDevice" placeholder="请选择是否同步设备到tb服务">
<el-option v-for="dict in synchro_device" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="是否可用" prop="enabledFlag"> <el-form-item label="是否可用" prop="enabledFlag">
<el-select v-model="form.enabledFlag" placeholder="请选择是否可用"> <el-select v-model="form.enabledFlag" placeholder="请选择是否可用">
@ -282,16 +296,16 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12" v-show="false" >
<el-form-item label="所属组织名称" prop="orgName"> <el-form-item label="所属组织名称" prop="orgName">
<el-tree-select v-model="form.orgName" :data="deptOptions" <el-input v-model="form.orgName" placeholder="请选择组织名称" disabled />
:props="{ value: 'label', label: 'label', children: 'children' }" value-key="id" placeholder="请选择"
check-strictly :default-expand-all="true" @node-click="selectDept" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12" v-show="false"> <el-col :span="12">
<el-form-item label="所属组织编码" prop="orgCode"> <el-form-item label="所属组织" prop="orgCode">
<el-input v-model="form.orgCode" placeholder="请选择组织名称" disabled /> <el-tree-select v-model="form.orgCode" :data="deptOptions"
:props="{value: 'id', label: 'label', children: 'children' }" value-key="id" placeholder="请选择"
check-strictly :default-expand-all="true" @node-click="selectDept" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -410,14 +424,27 @@
margin-right: 0 !important; margin-right: 0 !important;
width: 96%; width: 96%;
} }
.loading-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(255, 255, 255, 0.7);
display: flex;
justify-content: center;
align-items: center;
}
</style> </style>
<script setup name="Device"> <script setup name="Device">
import { getUuid, getDevice, delDevice, addDevice, updateDevice, listWithFilterColumn, selectDcBaseDeviceinfoMaxSort, cleanRedisCache, addAndSyncParamMap } from "@/api/model/device"; import { getUuid, getDevice, delDevice, addDevice, updateDevice, listWithFilterColumn, selectDcBaseDeviceinfoMaxSort, cleanRedisCache, addAndSyncParamMap } from "@/api/model/device";
import { listDevicemodel, } from "@/api/model/devicemodel"; import { listDevicemodel, } from "@/api/model/devicemodel";
import { deptTreeSelect } from "@/api/system/user"; import { deptTreeSelect } from "@/api/system/user";
import { listserverinfoNoPage, } from "@/api/model/tbserverinfo";
import lock from "@/assets/icons/svg/lock.svg"; import lock from "@/assets/icons/svg/lock.svg";
import { ref, onMounted, onUnmounted } from "vue"; import { ref, onMounted, onUnmounted } from "vue";
import { ElMessageBox } from 'element-plus'; import { ElMessageBox,ElLoading } from 'element-plus';
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
const { dc_img_configuration, dc_device_type, dc_device_source } = proxy.useDict('dc_img_configuration', 'dc_device_type', 'dc_device_source'); const { dc_img_configuration, dc_device_type, dc_device_source } = proxy.useDict('dc_img_configuration', 'dc_device_type', 'dc_device_source');
const router = useRouter(); const router = useRouter();
@ -444,6 +471,8 @@ const sortProps = ref([]);
const deptName = ref(null); const deptName = ref(null);
const devicemodelOptions = ref([]); const devicemodelOptions = ref([]);
const ioserverShow = ref(false); const ioserverShow = ref(false);
const thingsboardShow = ref(false);
const tbServerList = ref([]);
const enabledFlag = ref([ const enabledFlag = ref([
{ label: '可用', value: true, elTagType: 'default', elTagClass: null }, { label: '可用', value: true, elTagType: 'default', elTagClass: null },
{ label: '不可用', value: false, elTagType: 'default', elTagClass: null } { label: '不可用', value: false, elTagType: 'default', elTagClass: null }
@ -460,6 +489,10 @@ const alertEnabledTable = ref([
{ label: '告警', value: 'true', elTagType: 'default', elTagClass: null }, { label: '告警', value: 'true', elTagType: 'default', elTagClass: null },
{ label: '不告警', value: 'false', elTagType: 'default', elTagClass: null } { label: '不告警', value: 'false', elTagType: 'default', elTagClass: null }
]); ]);
const synchro_device = ref([
{ label: '同步', value: 'true', elTagType: 'default', elTagClass: null },
{ label: '不同步', value: 'false', elTagType: 'default', elTagClass: null }
])
const data = reactive({ const data = reactive({
form: {}, form: {},
params: { params: {
@ -517,6 +550,12 @@ const data = reactive({
orgCode: [ orgCode: [
{ required: true, message: "所属组织编码", trigger: "change" } { required: true, message: "所属组织编码", trigger: "change" }
], ],
thingsboardServer: [
{ required: thingsboardShow, message: "thingsboard服务", trigger: "change" }
],
synchroDevice: [
{ required: thingsboardShow, message: "是否同步设备到tb服务", trigger: "change" }
],
} }
}); });
@ -655,16 +694,22 @@ function handleUpdate(row) {
/** 提交按钮 */ /** 提交按钮 */
function submitForm() { function submitForm() {
let dialogLoading = null;
proxy.$refs["deviceRef"].validate(valid => { proxy.$refs["deviceRef"].validate(valid => {
if (valid) { if (valid) {
dialogLoading = ElLoading.service({
// target: '.deviceDialogClass', // el-dialog
text: 'Loading...', // Loading
background: 'rgba(0,0,0,0.7)', //
})
if (form.value.id != null) { if (form.value.id != null) {
updateDevice(form.value).then(response => { updateDevice(form.value).then(response => {
proxy.$modal.msgSuccess("修改成功"); proxy.$modal.msgSuccess("修改成功");
open.value = false; open.value = false;
getList(); getList();
dialogLoading.close();
}); });
} else { } else {
loading.value = true;
let param = { let param = {
"obj": { "centerDeviceCode": form.value.centerDeviceCode }, "obj": { "centerDeviceCode": form.value.centerDeviceCode },
"params": new Object(), "params": new Object(),
@ -679,6 +724,7 @@ function submitForm() {
confirmButtonText: '确定', confirmButtonText: '确定',
center: true, center: true,
}) })
dialogLoading.close();
return; return;
} else { } else {
let param = { let param = {
@ -695,6 +741,7 @@ function submitForm() {
confirmButtonText: '确定', confirmButtonText: '确定',
center: true, center: true,
}) })
dialogLoading.close();
return; return;
} else { } else {
addAndSyncParamMap(form.value).then(response => { addAndSyncParamMap(form.value).then(response => {
@ -707,12 +754,11 @@ function submitForm() {
} else { } else {
proxy.$modal.msgError(response.data?.msg); proxy.$modal.msgError(response.data?.msg);
} }
dialogLoading.close();
}); });
} }
}); });
} }
loading.value = false;
}); });
} }
} }
@ -777,7 +823,7 @@ function getDeptTree() {
}; };
function selectDept(val) { function selectDept(val) {
form.value.orgCode = val.id; form.value.orgName = val.label;
} }
function deviceSourceChange(val) { function deviceSourceChange(val) {
@ -787,8 +833,11 @@ function deviceSourceChange(val) {
} }
if (val == '002') { if (val == '002') {
ioserverShow.value = true; ioserverShow.value = true;
} else { thingsboardShow.value = false;
} else if (val == '001') {
getThServerList();
ioserverShow.value = false; ioserverShow.value = false;
thingsboardShow.value = true;
} }
}) })
} }
@ -1019,6 +1068,16 @@ function modelChange(val) {
} }
function getThServerList() {
let param = {
"seviceType": "tb",
"enabled": true,
}
listserverinfoNoPage(param).then(response => {
tbServerList.value = response.data;
});
}
getTreeselect(); getTreeselect();
getDeptTree(); getDeptTree();
getList(); getList();

17
src/views/model/devicemodel/editModel.vue

@ -98,7 +98,7 @@
<el-option v-for="dict in dc_device_partion" :value="dict.value" :label="dict.label" :key="dict.key" /> <el-option v-for="dict in dc_device_partion" :value="dict.value" :label="dict.label" :key="dict.key" />
</el-select> </el-select>
<el-table ref="dialogTable" v-show="paramClassTableShow" :data="paramModelListShow" key="newTable" <el-table ref="dialogTable" v-show="paramClassTableShow" :data="paramModelListShow" key="newTable"
style="width: 100%" :style="{ maxHeight: tableHeightNew }"> style="width: 100%" :style="{ maxHeight: tableHeightNew ,overflow:'auto'}" class="table_over_flow">
<el-table-column type="selection" width="55" :selectable="ifselectable" /> <el-table-column type="selection" width="55" :selectable="ifselectable" />
<el-table-column label="参数名称" align="center" prop="paramClassName" /> <el-table-column label="参数名称" align="center" prop="paramClassName" />
<el-table-column label="参数编码" align="center" prop="paramClassCode" /> <el-table-column label="参数编码" align="center" prop="paramClassCode" />
@ -128,6 +128,10 @@
ul { ul {
display: none !important; display: none !important;
} }
.table_over_flow{
overflow: auto !important;;
}
} }
.customCarousel .vxeTableStyle button { .customCarousel .vxeTableStyle button {
@ -307,7 +311,7 @@ const columns = ref([
editRender: { name: "$select", options: dc_class_type, attrs: { placeholder: "请输入角色内共享" } }, editRender: { name: "$select", options: dc_class_type, attrs: { placeholder: "请输入角色内共享" } },
}, },
{ {
field: "devicePartion", field: "partion",
title: "分区", title: "分区",
width: 'auto', width: 'auto',
minWidth: 120, minWidth: 120,
@ -378,7 +382,7 @@ const config = ref({
custom: true, // custom: true, //
}, },
editRules: { editRules: {
devicePartion: [ partion: [
{ required: true, message: '分区不能为空' }, { required: true, message: '分区不能为空' },
], ],
} }
@ -576,7 +580,7 @@ function partionChange(val) {
paramClassTableShow.value = true; paramClassTableShow.value = true;
paramClassTableShowByPartion.value = paramModelList.value; paramClassTableShowByPartion.value = paramModelList.value;
selectedModelListByPartion.value = selectedModelList.value?.filter(element => { selectedModelListByPartion.value = selectedModelList.value?.filter(element => {
return element.devicePartion == val; return element.partion == val;
}); });
paramModelListShow.value = paramClassTableShowByPartion.value?.filter(element => { paramModelListShow.value = paramClassTableShowByPartion.value?.filter(element => {
@ -586,9 +590,10 @@ function partionChange(val) {
item.paramClassId = item.paramClassCode; item.paramClassId = item.paramClassCode;
item.modelId = form.value.modelCode; item.modelId = form.value.modelCode;
item.controllab = false; item.controllab = false;
item.devicePartion = val; item.partion = val;
item.id = "ABCDEFXYZ" + form.value.modelCode + item.paramClassCode; item.id = "ABCDEFXYZ" + form.value.modelCode + item.paramClassCode;
}); });
debugger
} }
@ -695,7 +700,7 @@ function pageChange(currentPage, pageSize) {
function beforeChangeParamClass(envent, row, column) { function beforeChangeParamClass(envent, row, column) {
if (envent !== undefined && envent) { if (envent !== undefined && envent) {
let thePartionModelList = selectedModelList.value.filter(item => { let thePartionModelList = selectedModelList.value.filter(item => {
return row.devicePartion === item.devicePartion; return row.partion === item.partion;
}) })
paramModelListVxetable.value = paramModelList.value.filter(element => { paramModelListVxetable.value = paramModelList.value.filter(element => {
return !thePartionModelList.some(item => { return !thePartionModelList.some(item => {

233
src/views/model/paramclass/index.vue

@ -1,48 +1,35 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" class="my-custom-form"> <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" class="my-custom-form">
<el-row> <el-row>
<el-col :span="4"> <el-col :span="4">
<el-form-item label="参数名称" prop="paramClassName" label-width="auto"> <el-form-item label="参数名称" prop="paramClassName" label-width="auto">
<el-input <el-input v-model="queryParams.paramClassName" placeholder="请输入参数名称" clearable @keyup.enter="handleQuery" />
v-model="queryParams.paramClassName"
placeholder="请输入参数名称"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="4"> <el-col :span="4">
<el-form-item label="参数编码" prop="paramClassCode" label-width="auto"> <el-form-item label="参数编码" prop="paramClassCode" label-width="auto">
<el-input <el-input v-model="queryParams.paramClassCode" placeholder="请输入参数编码" clearable @keyup.enter="handleQuery" />
v-model="queryParams.paramClassCode"
placeholder="请输入参数编码"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="4"> <el-col :span="4">
<el-form-item label="类别" prop="classType" label-width="auto"> <el-form-item label="类别" prop="classType" label-width="auto">
<el-select v-model="queryParams.classType" placeholder="请选择类别" clearable> <el-select v-model="queryParams.classType" placeholder="请选择类别" clearable>
<el-option <el-option v-for="dict in dc_class_type" :key="dict.value" :label="dict.label" :value="dict.value" />
v-for="dict in dc_class_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="4"> <el-col :span="4">
<el-form-item label="单位" prop="paramUnit" label-width="auto"> <el-form-item label="单位" prop="paramUnit" label-width="auto">
<el-select v-model="queryParams.paramUnit" placeholder="请选择单位" clearable> <el-select v-model="queryParams.paramUnit" placeholder="请选择单位" clearable>
<el-option <el-option v-for="dict in dc_param_uint_type" :key="dict.value" :label="dict.label" :value="dict.value" />
v-for="dict in dc_param_uint_type" </el-select>
:key="dict.value" </el-form-item>
:label="dict.label" </el-col>
:value="dict.value" <el-col :span="4">
/> <el-form-item label="数据类型" prop="paramType">
<el-select v-model="queryParams.paramType" placeholder="请选择数据类型" clearable>
<el-option v-for="dict in dc_param_value_type" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -57,119 +44,104 @@
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button type="success" icon="Plus" @click="handleAdd">新增</el-button>
type="success"
icon="Plus"
@click="handleAdd"
>新增</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button type="success" icon="Delete" @click="handleDelete">删除</el-button>
type="success"
icon="Delete"
@click="handleDelete"
>删除</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button type="warning" icon="Download" @click="handleExport">导出</el-button>
type="warning"
icon="Download"
@click="handleExport"
>导出</el-button>
</el-col> </el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="paramclassList" @selection-change="handleSelectionChange" :max-height="tableHeight" :border="true" :column-width-draggable="true"> <el-table v-loading="loading" :data="paramclassList" @selection-change="handleSelectionChange"
<el-table-column type="selection" width="55" align="center" fixed="left"/> :max-height="tableHeight" :border="true" :column-width-draggable="true">
<el-table-column type="selection" width="55" align="center" fixed="left" />
<el-table-column label="参数名称" align="center" prop="paramClassName" /> <el-table-column label="参数名称" align="center" prop="paramClassName" />
<el-table-column label="参数编码" align="center" prop="paramClassCode" /> <el-table-column label="参数编码" align="center" prop="paramClassCode" />
<el-table-column label="数据类型" align="center" prop="paramType">
<template #default="scope">
<dict-tag :options="dc_param_value_type" :value="scope.row.paramType" />
</template>
</el-table-column>
<el-table-column label="类别" align="center" prop="classType"> <el-table-column label="类别" align="center" prop="classType">
<template #default="scope"> <template #default="scope">
<dict-tag :options="dc_class_type" :value="scope.row.classType"/> <dict-tag :options="dc_class_type" :value="scope.row.classType" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="单位" align="center" prop="paramUnit"> <el-table-column label="单位" align="center" prop="paramUnit">
<template #default="scope"> <template #default="scope">
<dict-tag :options="dc_param_uint_type" :value="scope.row.paramUnit"/> <dict-tag :options="dc_param_uint_type" :value="scope.row.paramUnit" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" align="center" prop="note" /> <el-table-column label="备注" align="center" prop="note" />
<!-- <el-table-column label="主键" align="center" prop="id" /> --> <!-- <el-table-column label="主键" align="center" prop="id" /> -->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" :width="200" :fixed="fixedColumns?'right':false"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width" :width="200"
:fixed="fixedColumns ? 'right' : false">
<template #header> <template #header>
<div class="fixed-column-header" style="text-align: center;display: block;" @dblclick="toggleFixedColumns"> <div class="fixed-column-header" style="text-align: center;display: block;" @dblclick="toggleFixedColumns">
<span style="text-align: center;display: block;">操作<img style="width:10px;margin-left:5px" v-show="fixedColumns" :src="lock" alt="Image"/></span> <span style="text-align: center;display: block;">操作<img style="width:10px;margin-left:5px"
v-show="fixedColumns" :src="lock" alt="Image" /></span>
</div> </div>
</template> </template>
<template #default="scope"> <template #default="scope">
<el-button <el-button type="text" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button>
type="text" <el-button type="text" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
icon="Edit"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
type="text"
icon="Delete"
@click="handleDelete(scope.row)"
>删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
v-show="total>0" @pagination="getList" class="paddingBothLeftRight" />
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
class="paddingBothLeftRight"
/>
<!-- 添加或修改参数模型信息对话框 --> <!-- 添加或修改参数模型信息对话框 -->
<el-dialog :title="title" v-model="open" width="500px" append-to-body draggable> <el-dialog :title="title" v-model="open" width="500px" append-to-body draggable>
<el-form ref="paramclassRef" :model="form" :rules="rules" label-width="80px"> <el-form ref="paramclassRef" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="12">
<el-form-item label="参数名称" prop="paramClassName">
<el-input v-model="form.paramClassName" placeholder="请输入参数名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="参数编码" prop="paramClassCode">
<el-input v-model="form.paramClassCode" placeholder="请输入参数编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="类别" prop="classType">
<el-select v-model="form.classType" placeholder="请选择类别">
<el-option
v-for="dict in dc_class_type"
:key="dict.value"
:label="dict.label"
:value="dict.value" ></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单位" prop="paramUnit">
<el-select v-model="form.paramUnit" placeholder="请选择单位">
<el-option
v-for="dict in dc_param_uint_type"
:key="dict.value"
:label="dict.label"
:value="dict.value" ></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="note">
<el-input v-model="form.note" placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row> <el-row>
<el-col :span="12">
<el-form-item label="参数名称" prop="paramClassName">
<el-input v-model="form.paramClassName" placeholder="请输入参数名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="参数编码" prop="paramClassCode">
<el-input v-model="form.paramClassCode" placeholder="请输入参数编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="数据类型" prop="paramType">
<el-select v-model="form.paramType" placeholder="请选择数据类型">
<el-option v-for="dict in dc_param_value_type" :key="dict.value" :label="dict.label"
:value="dict.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="类别" prop="classType">
<el-select v-model="form.classType" placeholder="请选择类别">
<el-option v-for="dict in dc_class_type" :key="dict.value" :label="dict.label"
:value="dict.value"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单位" prop="paramUnit">
<el-select v-model="form.paramUnit" placeholder="请选择单位">
<el-option v-for="dict in dc_param_uint_type" :key="dict.value" :label="dict.label"
:value="dict.value"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="note">
<el-input v-model="form.note" placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
</el-form> </el-form>
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
@ -180,15 +152,14 @@
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<style lang="scss" > <style lang="scss" > @import "@/assets/styles/self-defined.scss";
@import "@/assets/styles/self-defined.scss";
</style> </style>
<script setup name="Paramclass"> <script setup name="Paramclass">
import { listParamclass, getParamclass, delParamclass, addParamclass, updateParamclass,listParamclassForRepetition } from "@/api/model/paramclass"; import { listParamclass, getParamclass, delParamclass, addParamclass, updateParamclass, listParamclassForRepetition } from "@/api/model/paramclass";
import lock from "@/assets/icons/svg/lock.svg"; import lock from "@/assets/icons/svg/lock.svg";
import { ElMessageBox } from 'element-plus'; import { ElMessageBox } from 'element-plus';
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
const { dc_class_type, dc_param_uint_type } = proxy.useDict('dc_class_type', 'dc_param_uint_type'); const { dc_class_type, dc_param_uint_type, dc_param_value_type } = proxy.useDict('dc_class_type', 'dc_param_uint_type', 'dc_param_value_type');
const paramclassList = ref([]); const paramclassList = ref([]);
const open = ref(false); const open = ref(false);
const loading = ref(true); const loading = ref(true);
@ -227,7 +198,7 @@ const data = reactive({
{ required: true, message: "参数类型不能为空", trigger: "blur" } { required: true, message: "参数类型不能为空", trigger: "blur" }
], ],
paramUnit: [ paramUnit: [
{ required: true, message: "单位不能为空", trigger: "blur" } { required: false, message: "单位不能为空", trigger: "blur" }
], ],
} }
}); });
@ -304,17 +275,17 @@ function handleAdd() {
function handleUpdate(row) { function handleUpdate(row) {
reset(); reset();
const _id = row.id || ids.value; const _id = row.id || ids.value;
if(_id.length === 0){ if (_id.length === 0) {
ElMessageBox.alert('请选择需要修改的记录', '提示', { ElMessageBox.alert('请选择需要修改的记录', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
center: true, center: true,
}) })
return; return;
}else if(_id.length > 1){ } else if (_id.length > 1) {
ElMessageBox.alert('只能选择一条记录进行修改', '提示', { ElMessageBox.alert('只能选择一条记录进行修改', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
center: true, center: true,
}) })
return; return;
} }
getParamclass(_id).then(response => { getParamclass(_id).then(response => {
@ -328,7 +299,7 @@ function handleUpdate(row) {
function submitForm() { function submitForm() {
proxy.$refs["paramclassRef"].validate(valid => { proxy.$refs["paramclassRef"].validate(valid => {
if (valid) { if (valid) {
const param = {"paramClassCode":form.value.paramClassCode}; const param = { "paramClassCode": form.value.paramClassCode };
if (form.value.id != null) { if (form.value.id != null) {
listParamclassForRepetition(param).then(response => { listParamclassForRepetition(param).then(response => {
const result = response.data; const result = response.data;
@ -338,7 +309,7 @@ function submitForm() {
confirmButtonText: '确定', confirmButtonText: '确定',
center: true, center: true,
}) })
}else{ } else {
updateParamclass(form.value).then(response => { updateParamclass(form.value).then(response => {
proxy.$modal.msgSuccess("修改成功"); proxy.$modal.msgSuccess("修改成功");
open.value = false; open.value = false;
@ -355,7 +326,7 @@ function submitForm() {
confirmButtonText: '确定', confirmButtonText: '确定',
center: true, center: true,
}) })
}else{ } else {
addParamclass(form.value).then(response => { addParamclass(form.value).then(response => {
proxy.$modal.msgSuccess("新增成功"); proxy.$modal.msgSuccess("新增成功");
open.value = false; open.value = false;
@ -371,20 +342,20 @@ function submitForm() {
/** 删除按钮操作 */ /** 删除按钮操作 */
function handleDelete(row) { function handleDelete(row) {
const _ids = row.id || ids.value; const _ids = row.id || ids.value;
if(_ids.length == 0){ if (_ids.length == 0) {
ElMessageBox.alert('请先选择要删除的项', '提示', { ElMessageBox.alert('请先选择要删除的项', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
center: true, center: true,
}) })
return; return;
} }
const _names = row.paramClassName || names.value; const _names = row.paramClassName || names.value;
proxy.$modal.confirm('是否确认删除参数模型名称为"' + _names + '"的数据项?').then(function() { proxy.$modal.confirm('是否确认删除参数模型名称为"' + _names + '"的数据项?').then(function () {
return delParamclass(_ids); return delParamclass(_ids);
}).then(() => { }).then(() => {
getList(); getList();
proxy.$modal.msgSuccess("删除成功"); proxy.$modal.msgSuccess("删除成功");
}).catch(() => {}); }).catch(() => { });
} }
/** 导出按钮操作 */ /** 导出按钮操作 */
@ -400,7 +371,7 @@ function toggleFixedColumns() {
fixedColumns.value = !fixedColumns.value; fixedColumns.value = !fixedColumns.value;
} }
onMounted(()=>{ onMounted(() => {
calculateTableHeight(); calculateTableHeight();
window.addEventListener('resize', calculateTableHeight); window.addEventListener('resize', calculateTableHeight);
window.onresize = () => { window.onresize = () => {
@ -414,14 +385,14 @@ onUnmounted(() => {
window.removeEventListener('resize', calculateTableHeight); window.removeEventListener('resize', calculateTableHeight);
}); });
watch( watch(
[collapseVisible,showSearch], [collapseVisible, showSearch],
() => { () => {
calculateTableHeight(); calculateTableHeight();
} }
); );
const calculateTableHeight = () => { const calculateTableHeight = () => {
nextTick(() => { nextTick(() => {
const heightForm = proxy.$refs.queryRef?.$el.clientHeight||0; const heightForm = proxy.$refs.queryRef?.$el.clientHeight || 0;
const windowHeight = window.innerHeight; const windowHeight = window.innerHeight;
const paginationHeight = 60; const paginationHeight = 60;
const tableHeaderHeight = 40; const tableHeaderHeight = 40;

2
src/views/model/tbserverinfo/index.vue

@ -101,7 +101,7 @@
@pagination="getList" /> @pagination="getList" />
<!-- 添加或修改TB服务信息对话框 --> <!-- 添加或修改TB服务信息对话框 -->
<el-dialog :title="title" v-model="open" width="800px" append-to-body> <el-dialog :title="title" v-model="open" width="800px" append-to-body draggable>
<el-form ref="tbserverinfoRef" :model="form" :rules="rules" class="my-custom-form"> <el-form ref="tbserverinfoRef" :model="form" :rules="rules" class="my-custom-form">
<el-row> <el-row>

Loading…
Cancel
Save