Browse Source

bug处理第2波

pull/1/head
ljlong_2630 1 year ago
parent
commit
0e13ed72c0
  1. 4
      .env.development
  2. 4
      .env.production
  3. 8
      src/api/model/device.js
  4. 3
      src/main.js
  5. 29
      src/utils/request.js
  6. 57
      src/views/model/alert/deviceparamalert.vue
  7. 87
      src/views/model/alert/logicconfig.vue
  8. 71
      src/views/model/alert/method.vue
  9. 59
      src/views/model/alert/model.vue
  10. 157
      src/views/model/alert/policy.vue
  11. 116
      src/views/model/device/index.vue
  12. 84
      src/views/model/params/index.vue
  13. 2
      vite.config.js

4
.env.development

@ -5,5 +5,5 @@ VITE_APP_TITLE = 联美运营系统
VITE_APP_ENV = 'development'
# 联美运营系统/开发环境
VITE_APP_BASE_API = 'http://localhost:9000'
VITE_APP_BASE_API_IMAGE = 'http://localhost:9000'
VITE_APP_BASE_API = 'http://localhost:9010'
VITE_APP_BASE_API_IMAGE = 'http://localhost:9010'

4
.env.production

@ -5,8 +5,8 @@ VITE_APP_TITLE = 联美管理驾驶舱
VITE_APP_ENV = 'production'
# 若依管理系统/生产环境
VITE_APP_BASE_API = 'http://10.10.10.56:9000'
VITE_APP_BASE_API_IMAGE = 'http://10.10.10.56:9000'
VITE_APP_BASE_API = 'http://10.10.10.56:9010'
VITE_APP_BASE_API_IMAGE = 'http://10.10.10.56:9010'
# 是否在打包时开启压缩,支持 gzip 和 brotli
VITE_BUILD_COMPRESS = gzip

8
src/api/model/device.js

@ -84,3 +84,11 @@ export function listWithFilterColumn(data){
data: data
});
}
//获取最大排序
export function selectDcBaseDeviceinfoMaxSort(){
return request({
url: '/model/dcBaseDeviceinfo/selectDcBaseDeviceinfoMaxSort',
method: 'get'
});
}

3
src/main.js

@ -15,7 +15,7 @@ import directive from './directive' // directive
// 注册指令
import plugins from './plugins' // plugins
import { download } from '@/utils/request'
import { download,newDownload } from '@/utils/request'
// svg图标
import 'virtual:svg-icons-register'
@ -54,6 +54,7 @@ app.config.warnHandler = () => null
// 全局方法挂载
app.config.globalProperties.useDict = useDict
app.config.globalProperties.download = download
app.config.globalProperties.newDownload = newDownload
app.config.globalProperties.parseTime = parseTime
app.config.globalProperties.resetForm = resetForm
app.config.globalProperties.handleTree = handleTree

29
src/utils/request.js

@ -145,4 +145,33 @@ export function download(url, params, filename, config) {
})
}
// 新通用下载方法
export function newDownload(url, params, filename, config) {
downloadLoadingInstance = ElLoading.service({ text: "正在下载数据,请稍候", background: "rgba(0, 0, 0, 0.7)", })
return service.post(url, JSON.stringify(params), {
headers: { 'Content-Type': 'application/json' },
responseType: 'blob',
...config
}).then(async (data) => {
const isBlob = blobValidate(data);
if (isBlob) {
const blob = new Blob([data])
saveAs(blob, filename)
} else {
const resText = await data.text();
const rspObj = JSON.parse(resText);
const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
ElMessage.error(errMsg);
}
downloadLoadingInstance.close();
}).catch((r) => {
console.error(r)
ElMessage.error('下载文件出现错误,请联系管理员!')
downloadLoadingInstance.close();
})
}
export default service

57
src/views/model/alert/deviceparamalert.vue

@ -280,7 +280,7 @@
<el-table-column label="符号" align="center" prop="code" :width="120"/>
<el-table-column label="运算符" align="center" prop="operator" :width="120">
<template #default="scope">
<dict-tag :options="operator_sign" :value="scope.row.operator"/>
<dict-tag :options="dc_operator_sign" :value="scope.row.operator"/>
</template>
</el-table-column>
<el-table-column label="限值" align="center" prop="value">
@ -306,30 +306,7 @@
</el-form-item>
</template>
</el-table-column>
<!-- <el-table-column label="状态值" align="center" prop="statusValue">
<template #default="scope">
<el-select v-model="scope.row.statusValue" placeholder="请选择状态类型">
<el-option
v-for="item in statusValueSelects"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="状态类型" align="center" prop="statusType">
<template #default="scope">
<el-select v-model="scope.row.statusType" placeholder="请选择状态类型">
<el-option
v-for="item in statusSelects"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
</el-table-column> -->
</el-table>
</el-col>
</el-row>
@ -357,7 +334,7 @@ import {listPolicyInfo,updatePolicy,updatePolicyBatch,addPolicy,addPolicyBatch,l
import lock from "@/assets/icons/svg/lock.svg";
const { proxy } = getCurrentInstance();
const router = useRouter();
const { operator_sign,dc_param_value_type,dc_alert_level,dc_device_partion } = proxy.useDict('operator_sign','dc_param_value_type','dc_alert_level','dc_device_partion');
const { dc_operator_sign,dc_param_value_type,dc_alert_level,dc_device_partion } = proxy.useDict('dc_operator_sign','dc_param_value_type','dc_alert_level','dc_device_partion');
const alertList = ref([]);
const open = ref(false);
const openPolicy = ref(false);
@ -643,7 +620,6 @@ function submitForm() {
addAlert(form.value).then(response => {
proxy.$modal.msgSuccess("新增成功");
open.value = false;
debugger
getList();
handlePolicy(response.data);
});
@ -1157,11 +1133,28 @@ const isInvalid = (value,row) => {
};
function changeEnabled(row){
let param = {
id:row.id,
enabled:row.enabled
}
updateAlert(param);
ElMessageBox.confirm('确定修改该告警状态吗', '提示', {
distinguishCancelAndClose: true,
confirmButtonText: '确定',
cancelButtonText: '取消',
})
.then(() => {
console.log("确定");
let param = {
id:row.id,
enabled:row.enabled
}
updateAlert(param);
})
.catch((action) => {
console.log("取消");
if(row.enabled == 0){
row.enabled = 1
}else{
row.enabled = 0
}
})
}
function levelChange(value){

87
src/views/model/alert/logicconfig.vue

@ -52,13 +52,13 @@
@click="handleAdd"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<!-- <el-col :span="1.5">
<el-button
type="success"
icon="Edit"
@click="handleUpdate"
>修改</el-button>
</el-col>
</el-col> -->
<el-col :span="1.5">
<el-button
type="success"
@ -77,7 +77,7 @@
</el-row>
<el-table v-loading="loading" :data="logicconfigList" @selection-change="handleSelectionChange" :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="id" />
<!-- <el-table-column label="主键" align="center" prop="id" /> -->
<el-table-column label="逻辑编码" align="center" prop="logicCode">
<template #default="scope">
<dict-tag :options="dc_alert_logic" :value="scope.row.logicCode"/>
@ -122,7 +122,37 @@
<!-- 添加或修改告警逻辑对话框 -->
<el-dialog :title="title" v-model="open" width="800px" append-to-body>
<el-form ref="logicconfigRef" :model="form" :rules="rules" label-width="120px">
<el-row>
<el-col :span="12">
<el-form-item label="逻辑编码" prop="logicCode">
<el-select v-model="form.logicCode" placeholder="请选择逻辑编码">
<el-option
v-for="dict in dc_alert_logic"
: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="paramValueType">
<el-select v-model="form.paramValueType" 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="note">
<el-input v-model="form.note" placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<div class="dialog-footer">
@ -139,9 +169,9 @@
<script setup name="Logicconfig">
import { listLogicconfig, getLogicconfig, delLogicconfig, addLogicconfig, updateLogicconfig } from "@/api/model/logicconfig";
import lock from "@/assets/icons/svg/lock.svg";
import { ElMessageBox } from 'element-plus';
const { proxy } = getCurrentInstance();
const { dc_alert_logic, dc_param_value_type } = proxy.useDict('dc_alert_logic', 'dc_param_value_type');
const logicconfigList = ref([]);
const open = ref(false);
const loading = ref(true);
@ -158,6 +188,7 @@ const queryParamFilter = ref({});
const sortProps = ref([]);
const collapseVisible = ref(false);
const editName = ref("更多筛选项");
const names = ref([]);
const data = reactive({
form: {},
queryParams: {
@ -225,6 +256,15 @@ function resetQuery() {
//
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.id);
names.value = selection.map(item => {
let name = null;
dc_param_value_type.value.forEach(element => {
if (element.value == item.paramValueType) {
name = element.label
}
});
return name;
});
single.value = selection.length != 1;
multiple.value = !selection.length;
}
@ -239,7 +279,20 @@ function handleAdd() {
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const _id = row.id || ids.value
const _id = row.id || ids.value;
if(_id.length === 0){
ElMessageBox.alert('请选择需要修改的记录', '提示', {
confirmButtonText: '确定',
center: true,
})
return;
}else if(_id.length > 1){
ElMessageBox.alert('只能选择一条记录进行修改', '提示', {
confirmButtonText: '确定',
center: true,
})
return;
}
getLogicconfig(_id).then(response => {
form.value = response.data;
open.value = true;
@ -271,7 +324,15 @@ function submitForm() {
/** 删除按钮操作 */
function handleDelete(row) {
const _ids = row.id || ids.value;
proxy.$modal.confirm('是否确认删除告警逻辑编号为"' + _ids + '"的数据项?').then(function() {
if(_ids.length == 0){
ElMessageBox.alert('请先选择需要删除的记录', '提示', {
confirmButtonText: '确定',
center: true,
})
return;
}
const _names = getParamTypeName(row.paramValueType) || names.value;
proxy.$modal.confirm('是否确认删除参数变量类型为"' + _names + '"的数据项?').then(function() {
return delLogicconfig(_ids);
}).then(() => {
getList();
@ -281,7 +342,7 @@ function handleDelete(row) {
/** 导出按钮操作 */
function handleExport() {
proxy.download('model/alert/logicconfig/export', {
proxy.download('model/dcBusiAlertLogicConfig/export', {
...queryParams.value
}, `logicconfig_${new Date().getTime()}.xlsx`)
}
@ -322,5 +383,15 @@ const calculateTableHeight = () => {
});
};
function getParamTypeName(value){
let result = null;
dc_param_value_type.value.forEach(item=>{
if(item.value==value){
result = item.label;
}
})
return result;
}
getList();
</script>

71
src/views/model/alert/method.vue

@ -40,13 +40,13 @@
@click="handleAdd"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<!-- <el-col :span="1.5">
<el-button
type="success"
icon="Edit"
@click="handleUpdate"
>修改</el-button>
</el-col>
</el-col> -->
<el-col :span="1.5">
<el-button
type="success"
@ -66,7 +66,7 @@
<el-table v-loading="loading" :data="methodList" @selection-change="handleSelectionChange" :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="id" />
<!-- <el-table-column label="主键" align="center" prop="id" /> -->
<el-table-column label="策略名称" align="center" prop="methodName" />
<el-table-column label="是否有效" align="center" prop="flagEnabled" >
<template #default="scope">
@ -143,6 +143,7 @@
<script setup name="Method">
import { listMethod, getMethod, delMethod, addMethod, updateMethod } from "@/api/model/method";
import lock from "@/assets/icons/svg/lock.svg";
import { ElMessageBox } from 'element-plus';
const { proxy } = getCurrentInstance();
const methodList = ref([]);
const open = ref(false);
@ -160,6 +161,7 @@ const queryParamFilter = ref({});
const sortProps = ref([]);
const collapseVisible = ref(false);
const editName = ref("更多筛选项");
const names = ref([]);
const flagEnabledTable = ref([
{label: '可用', value: 'true', elTagType: 'default', elTagClass: null},
{label: '不可用', value: 'false', elTagType: 'default', elTagClass: null}
@ -177,6 +179,12 @@ const data = reactive({
flagEnabled: null
},
rules: {
methodName: [
{ required: true, message: "告警方式名称不能为空", trigger: "blur" }
],
flagEnabled: [
{ required: true, message: "告警方式是否有效不能为空", trigger: "blur" }
],
}
});
@ -233,6 +241,7 @@ function resetQuery() {
//
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.id);
names.value = selection.map(item => item.methodName);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
@ -247,7 +256,20 @@ function handleAdd() {
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const _id = row.id || ids.value
const _id = row.id || ids.value;
if(_id.length === 0){
ElMessageBox.alert('请选择需要修改的记录', '提示', {
confirmButtonText: '确定',
center: true,
})
return;
}else if(_id.length > 1){
ElMessageBox.alert('只能选择一条记录进行修改', '提示', {
confirmButtonText: '确定',
center: true,
})
return;
}
getMethod(_id).then(response => {
form.value = response.data;
open.value = true;
@ -266,11 +288,24 @@ function submitForm() {
getList();
});
} else {
addMethod(form.value).then(response => {
proxy.$modal.msgSuccess("新增成功");
open.value = false;
getList();
let param = {"methodName":form.value.methodName};
listMethod(param).then(response => {
total.value = response.total;
if(response.total > 0){
ElMessageBox.alert('该告警方式名称重复', '提示', {
confirmButtonText: '确定',
center: true,
})
}else{
addMethod(form.value).then(response => {
proxy.$modal.msgSuccess("新增成功");
open.value = false;
getList();
});
}
});
}
}
});
@ -279,7 +314,15 @@ function submitForm() {
/** 删除按钮操作 */
function handleDelete(row) {
const _ids = row.id || ids.value;
proxy.$modal.confirm('是否确认删除告警方式编号为"' + _ids + '"的数据项?').then(function() {
if(_ids.length == 0){
ElMessageBox.alert('请先选择需要删除的记录', '提示', {
confirmButtonText: '确定',
center: true,
})
return;
}
const _names = row.methodName || names.value;
proxy.$modal.confirm('是否确认删除告警策略名称为"' + _names + '"的数据项?').then(function() {
return delMethod(_ids);
}).then(() => {
getList();
@ -289,7 +332,7 @@ function handleDelete(row) {
/** 导出按钮操作 */
function handleExport() {
proxy.download('model/method/export', {
proxy.download('/model/dcBusiAlertMethod/export', {
...queryParams.value
}, `method_${new Date().getTime()}.xlsx`)
}
@ -329,6 +372,14 @@ const calculateTableHeight = () => {
});
};
function toggleCollapse() {
collapseVisible.value = !collapseVisible.value;
if(collapseVisible.value){
editName.value = "折叠筛选项";
}else{
editName.value = "更多筛选项"
}
}
getList();
</script>

59
src/views/model/alert/model.vue

@ -38,7 +38,7 @@
</el-col>
<el-col :span="4">
<el-form-item label="级别" prop="level">
<el-select v-model="form.level" placeholder="请选择告警级别">
<el-select v-model="queryParams.level" placeholder="请选择告警级别" clearable>
<el-option
v-for="dict in dc_alert_level"
:key="dict.value"
@ -52,7 +52,7 @@
<el-form-item label="运算符" prop="operator">
<el-select v-model="queryParams.operator" placeholder="请选择运算符" clearable>
<el-option
v-for="dict in operator_sign"
v-for="dict in dc_operator_sign"
:key="dict.value"
:label="dict.label"
:value="dict.value"
@ -98,13 +98,13 @@
@click="handleAdd"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<!-- <el-col :span="1.5">
<el-button
type="success"
icon="Edit"
@click="handleUpdate"
>修改</el-button>
</el-col>
</el-col> -->
<el-col :span="1.5">
<el-button
type="success"
@ -124,7 +124,7 @@
<el-table ref="modelTable" v-loading="loading" :data="modelList" @selection-change="handleSelectionChange" :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="id" />
<!-- <el-table-column label="主键" align="center" prop="id" /> -->
<el-table-column label="参数数据类型" align="center" prop="paramType" >
<template #default="scope">
<dict-tag :options="dc_param_value_type" :value="scope.row.paramType"/>
@ -144,7 +144,7 @@
<el-table-column label="排序" align="center" prop="sort" />
<el-table-column label="运算符" align="center" prop="operator" >
<template #default="scope">
<dict-tag :options="operator_sign" :value="scope.row.operator"/>
<dict-tag :options="dc_operator_sign" :value="scope.row.operator"/>
</template>
</el-table-column>
<el-table-column label="名称" align="center" prop="name" />
@ -233,7 +233,7 @@
<el-form-item label="运算符" prop="operator">
<el-select v-model="form.operator" :disabled="operatorDisabled" placeholder="请选择运算符">
<el-option
v-for="dict in operator_sign"
v-for="dict in dc_operator_sign"
:key="dict.value"
:label="dict.label"
:value="dict.value"
@ -255,7 +255,7 @@
<el-form-item label="值" prop="value">
<el-select v-model="form.value" placeholder="请选择值">
<el-option
v-for="dict in alert_value"
v-for="dict in dc_alert_value"
:key="dict.label"
:label="dict.label"
:value="parseFloat(dict.label)"
@ -282,7 +282,7 @@ import { listModel,listModelEnabledNoPage, getModel, delModel, addModel, updateM
import { ElMessageBox } from 'element-plus';
import lock from "@/assets/icons/svg/lock.svg";
const { proxy } = getCurrentInstance();
const { dc_param_value_type,operator_sign,dc_alert_level } = proxy.useDict('dc_param_value_type','operator_sign','dc_alert_level');
const { dc_param_value_type,dc_operator_sign,dc_alert_level } = proxy.useDict('dc_param_value_type','dc_operator_sign','dc_alert_level');
const modelList = ref([]);
const open = ref(false);
const loading = ref(true);
@ -305,6 +305,7 @@ const sortItemMap = ref({});
const queryParamFilter = ref({});
const sortProps = ref([]);
const collapseVisible = ref(false);
const names = ref([]);
const editName = ref("更多筛选项");
const flagEnabled = ref([
{label: '有效', value: 1, elTagType: 'default', elTagClass: null},
@ -314,7 +315,7 @@ const flagEnabledTable = ref([
{label: '有效', value: '1', elTagType: 'default', elTagClass: null},
{label: '无效', value: '0', elTagType: 'default', elTagClass: null}
]);
const alert_value = ref([
const dc_alert_value = ref([
{label: '1', value: true, elTagType: 'default', elTagClass: null},
{label: '0', value: false, elTagType: 'default', elTagClass: null}
]);
@ -438,6 +439,7 @@ function handleQuery() {
/** 重置按钮操作 */
function resetQuery() {
reset();
proxy.resetForm("queryRef");
codeVisiable.value = true;
sortVisiable.value = true;
@ -451,6 +453,7 @@ function resetQuery() {
//
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.id);
names.value = selection.map(item => item.name);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
@ -466,7 +469,20 @@ function handleAdd() {
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const _id = row.id || ids.value
const _id = row.id || ids.value;
if(_id.length === 0){
ElMessageBox.alert('请选择需要修改的记录', '提示', {
confirmButtonText: '确定',
center: true,
})
return;
}else if(_id.length > 1){
ElMessageBox.alert('只能选择一条记录进行修改', '提示', {
confirmButtonText: '确定',
center: true,
})
return;
}
getModel(_id).then(response => {
form.value = response.data;
open.value = true;
@ -516,7 +532,15 @@ function submitForm() {
/** 删除按钮操作 */
function handleDelete(row) {
const _ids = row.id || ids.value;
proxy.$modal.confirm('是否确认删除告警模版编号为"' + _ids + '"的数据项?').then(function() {
if(_ids.length == 0){
ElMessageBox.alert('请先选择需要删除的记录', '提示', {
confirmButtonText: '确定',
center: true,
})
return;
}
const _names = row.name || names.value;
proxy.$modal.confirm('是否确认删除告警模版名称为"' + _names + '"的数据项?').then(function() {
return delModel(_ids);
}).then(() => {
getList();
@ -526,7 +550,7 @@ function handleDelete(row) {
/** 导出按钮操作 */
function handleExport() {
proxy.download('model/model/export', {
proxy.download('model/dcBusiAlertModel/export', {
...queryParams.value
}, `model_${new Date().getTime()}.xlsx`)
}
@ -655,7 +679,14 @@ const calculateTableHeight = () => {
});
};
function toggleCollapse() {
collapseVisible.value = !collapseVisible.value;
if(collapseVisible.value){
editName.value = "折叠筛选项";
}else{
editName.value = "更多筛选项"
}
}
getList();
</script>

157
src/views/model/alert/policy.vue

@ -1,6 +1,6 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="80px" class="my-custom-form" >
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="100px" class="my-custom-form" >
<el-row>
<el-col :span="4">
<el-form-item label="数据类型" prop="paramType">
@ -15,16 +15,58 @@
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="界限值" prop="beginValue">
<el-form-item label="设备名称" prop="deviceName">
<el-input
v-model="queryParams.beginValue"
placeholder="请输入界限值"
v-model="queryParams.deviceName"
placeholder="请输入设备名称"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="参数名称" prop="paramName">
<el-input
v-model="queryParams.paramName"
placeholder="请输入参数名称"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
</el-col>
<el-col :span="4" v-show="collapseVisible">
<el-form-item label="设备Id" prop="deviceId">
<el-input
v-model="queryParams.deviceId"
placeholder="请输入设备Id"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
</el-col>
<el-col :span="4" v-show="collapseVisible">
<el-form-item label="参数编码" prop="paramCode">
<el-input
v-model="queryParams.paramCode"
placeholder="请输入参数编码"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
</el-col>
<el-col :span="4" v-show="collapseVisible">
<el-form-item label="告警方式" prop="methodIds">
<el-select v-model="queryParams.methodIds" multiple placeholder="请选择告警方式ID" clearable>
<el-option
v-for="item in methodList"
:key="item.id"
:label="item.methodName"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="4" v-show="collapseVisible">
<el-form-item label="是否告警" prop="alertFlag">
<el-select v-model="queryParams.alertFlag" placeholder="请选择是否告警" clearable>
<el-option
@ -36,6 +78,48 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="4" v-show="collapseVisible">
<el-form-item label="浮点值" prop="floatValue">
<el-input
v-model="queryParams.floatValue"
placeholder="请输入浮点值"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
</el-col>
<el-col :span="4" v-show="collapseVisible">
<el-form-item label="整数值" prop="intValue">
<el-input
v-model="queryParams.intValue"
placeholder="请输入整数值"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
</el-col>
<el-col :span="4" v-show="collapseVisible">
<el-form-item label="开关值" prop="boolValue">
<el-select v-model="form.value" placeholder="请选择开关值">
<el-option
v-for="dict in dc_alert_value"
:key="dict.label"
:label="dict.label"
:value="parseFloat(dict.label)"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="4" v-show="collapseVisible">
<el-form-item label="字符值" prop="stringValue">
<el-input
v-model="queryParams.stringValue"
placeholder="请输入字符值"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
</el-col>
<el-col :span="4" v-show="collapseVisible">
<el-form-item label="策略ID" prop="alertId">
<el-input
@ -73,23 +157,12 @@
/>
</el-form-item>
</el-col>
<el-col :span="4" v-show="collapseVisible">
<el-col :span="4" v-show="collapseVisible">
<el-form-item label="排序" prop="sortId">
<el-input-number v-model="queryParams.sortId" :min="1" :max="1000" />
</el-form-item>
</el-col>
<el-col :span="4" v-show="collapseVisible">
<el-form-item label="告警方式" prop="methodId">
<el-select v-model="queryParams.methodId" placeholder="请选择告警方式ID" clearable>
<el-option
v-for="item in methodList"
:key="item.id"
:label="item.methodName"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6" class="childTextAlignRight">
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
@ -113,7 +186,7 @@
<el-table v-loading="loading" :data="policyList" @selection-change="handleSelectionChange" :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="id" />
<!-- <el-table-column label="主键" align="center" prop="id" /> -->
<el-table-column label="设备名称" align="center" prop="deviceName" :width="120"/>
<el-table-column label="中台设备ID" align="center" prop="deviceId" />
<el-table-column label="参数名称" align="center" prop="paramName" :width="120"/>
@ -123,7 +196,14 @@
<dict-tag :options="dc_param_value_type" :value="scope.row.paramType"/>
</template>
</el-table-column>
<el-table-column label="控制值" align="center" prop="beginValue" />
<el-table-column label="浮点值" align="center" prop="floatValue" />
<el-table-column label="整数值" align="center" prop="intValue" />
<el-table-column label="开关值" align="center" prop="boolValue" >
<template #default="scope">
{{getBoolValueDic(scope.row.boolValue)}}
</template>
</el-table-column>
<el-table-column label="字符值" align="center" prop="stringValue" />
<!-- <el-table-column label="结束值" align="center" prop="endValue" /> -->
<el-table-column label="是否告警" align="center" prop="alertFlag" >
<template #default="scope">
@ -138,9 +218,9 @@
</template>
</el-table-column>
<el-table-column label="排序" align="center" prop="sortId" />
<el-table-column label="告警方式" align="center" prop="methodId" >
<el-table-column label="告警方式" align="center" prop="methodIds" >
<template #default="scope">
<span>{{ getMethodName(scope.row.methodId) }}</span>
<span>{{ getMethodName(scope.row.methodIds) }}</span>
</template>
</el-table-column>
</el-table>
@ -229,7 +309,7 @@ import { selectDeviceParamPolicy, listPolicy, getPolicy, delPolicy, addPolicy, u
import { listMethod } from "@/api/model/method";
const { proxy } = getCurrentInstance();
const router = useRouter();
const { dc_param_value_type } = proxy.useDict('dc_param_value_type');
const { dc_param_value_type,dc_bool_value } = proxy.useDict('dc_param_value_type','dc_bool_value');
const policyList = ref([]);
const open = ref(false);
const loading = ref(true);
@ -365,7 +445,7 @@ function submitForm() {
/** 导出按钮操作 */
function handleExport() {
proxy.download('model/policy/export', {
proxy.download('model/dcBusiAlertParamPolicy/export', {
...queryParams.value
}, `policy_${new Date().getTime()}.xlsx`)
}
@ -381,12 +461,18 @@ function initializeDeviceUuid(){
form.value.alertId = router.currentRoute._value.query.id;
}
function getMethodName(methodId){
function getMethodName(methodIds){
let methodNameTable = "";
methodList.value.forEach(item=>{
if(item.id == methodId){
methodNameTable = item.methodName;
};
let methodIdList = methodIds?.split(",");
methodIdList?.forEach(methodId=>{
methodList.value.forEach(item=>{
if(item.id == methodId){
if(methodNameTable != ""){
methodNameTable += ",";
}
methodNameTable = item.methodName;
};
})
})
return methodNameTable;
}
@ -427,6 +513,21 @@ const calculateTableHeight = () => {
});
};
function toggleCollapse() {
collapseVisible.value = !collapseVisible.value;
if(collapseVisible.value){
editName.value = "折叠筛选项";
}else{
editName.value = "更多筛选项"
}
}
function getBoolValueDic(bool) {
if(bool){
return "1";
}
return "0";
}
initializeDeviceUuid();
getList();

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

@ -181,6 +181,13 @@
@click="handleAdd"
>新增</el-button>
</el-col>
<!-- <el-col :span="1.5">
<el-button
type="success"
icon="Edit"
@click="handleUpdate"
>修改</el-button>
</el-col> -->
<el-col :span="1.5">
<el-button
type="success"
@ -277,7 +284,7 @@
<el-row>
<el-col :span="12">
<el-form-item label="中台设备编码" prop="centerDeviceCode">
<el-input :disabled="disabled" v-model="form.centerDeviceCode" placeholder="请输入中台设备编码" />
<el-input :disabled="disabledDeviceCode" v-model="form.centerDeviceCode" placeholder="请输入中台设备编码" />
</el-form-item>
</el-col>
<el-col :span="12">
@ -454,10 +461,11 @@
}
</style>
<script setup name="Device">
import { getUuid, listDevice, getDevice, delDevice, addDevice, updateDevice, listWithFilterColumn } from "@/api/model/device";
import { getUuid, listDevice, getDevice, delDevice, addDevice, updateDevice, listWithFilterColumn,selectDcBaseDeviceinfoMaxSort } from "@/api/model/device";
import { deptTreeSelect } from "@/api/system/user";
import lock from "@/assets/icons/svg/lock.svg";
import { ref,onMounted,onUnmounted } from "vue";
import { ElMessageBox } from 'element-plus';
const { proxy } = getCurrentInstance();
const { dc_device_type, dc_device_source } = proxy.useDict('dc_device_type','dc_device_source');
const router = useRouter();
@ -466,6 +474,7 @@ const open = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref([]);
const names = ref([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
@ -473,7 +482,7 @@ const title = ref("");
const collapseVisible = ref(false);
const editName = ref("更多筛选项");
const deptOptions = ref([]);
const disabled = ref(false);
const disabledDeviceCode = ref(false);
const fixedColumns = ref(false);
const tableHeight = ref("0px");
const sortItemMap = ref({});
@ -633,20 +642,25 @@ function resetQuery() {
//
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.id);
names.value = selection.map(item => item.deviceName);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
/** 新增按钮操作 */
function handleAdd() {
reset();
loading.value = true;
getUuid().then(response=>{
form.value.centerDeviceCode = response.msg;
form.value.uuid = response.msg;
form.value.enabledFlag = true;
loading.value = false;
});
reset();
selectDcBaseDeviceinfoMaxSort().then(response=>{
form.value.sort = response.data?.sort + 1;
loading.value = false;
})
disabledDeviceCode.value = false;
open.value = true;
title.value = "添加设备信息";
}
@ -654,10 +668,24 @@ function handleAdd() {
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const _id = row.id || ids.value
const _id = row.id || ids.value;
if(_id.length === 0){
ElMessageBox.alert('请选择需要修改的记录', '提示', {
confirmButtonText: '确定',
center: true,
})
return;
}else if(_id.length > 1){
ElMessageBox.alert('只能选择一条记录进行修改', '提示', {
confirmButtonText: '确定',
center: true,
})
return;
}
getDevice(_id).then(response => {
form.value = response.data;
open.value = true;
disabledDeviceCode.value = true;
title.value = "修改设备信息";
});
@ -674,10 +702,48 @@ function submitForm() {
getList();
});
} else {
addDevice(form.value).then(response => {
proxy.$modal.msgSuccess("新增成功");
open.value = false;
getList();
loading.value = true;
let param = {
"obj":{"centerDeviceCode":form.value.centerDeviceCode},
"params":new Object(),
"sort":[],
"pageNum": 1,
"pageSize": 10,
}
listWithFilterColumn(param).then(response => {
let total = response.data.tableData.total;
if(total > 0){
ElMessageBox.alert('设备中台编号不能重复', '提示', {
confirmButtonText: '确定',
center: true,
})
return;
}else{
let param = {
"obj":{"uuid":form.value.uuid},
"params":new Object(),
"sort":[],
"pageNum": 1,
"pageSize": 10,
}
listWithFilterColumn(param).then(response => {
let total = response.data.tableData.total;
if(total > 0){
ElMessageBox.alert('设备中台uuid不能重复', '提示', {
confirmButtonText: '确定',
center: true,
})
return;
}else{
addDevice(form.value).then(response => {
proxy.$modal.msgSuccess("新增成功");
open.value = false;
getList();
});
}
});
}
loading.value = false;
});
}
}
@ -687,7 +753,15 @@ function submitForm() {
/** 删除按钮操作 */
function handleDelete(row) {
const _ids = row.id || ids.value;
proxy.$modal.confirm('是否确认删除设备信息编号为"' + _ids + '"的数据项?').then(function() {
if(_ids.length == 0){
ElMessageBox.alert('请先选择要删除的项', '提示', {
confirmButtonText: '确定',
center: true,
})
return;
}
const _names = row.deviceName || names.value;
proxy.$modal.confirm('是否确认删除设备信息名称为"' + _names + '"的数据项?').then(function() {
return delDevice(_ids);
}).then(() => {
getList();
@ -697,8 +771,13 @@ function handleDelete(row) {
/** 导出按钮操作 */
function handleExport() {
proxy.download('model/dcBaseDeviceinfo/export', {
...queryParams.value
let param = {
"obj":queryParams.value,
"params":queryParamFilter.value,
"sort":sortProps.value,
}
proxy.newDownload('model/dcBaseDeviceinfo/export', {
...param
}, `device_${new Date().getTime()}.xlsx`)
}
@ -733,18 +812,9 @@ function selectDept(val){
}
function deviceSourceChange(val){
form.value.deviceSourceId=val;
dc_device_source.value.forEach(item=>{
form.value.deviceSource=item.label;
})
}
function deviceTypeChange(val){
let flag = false;
dc_device_type.value.forEach(item=>{
if(item.value==val){
flag = true;
form.value.deviceType=item.label;
form.value.deviceSource=item.label;
}
})
}

84
src/views/model/params/index.vue

@ -32,16 +32,6 @@
/>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="参数编码" prop="paramCode">
<el-input
v-model="queryParams.paramCode"
placeholder="请输入参数编码"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
</el-col>
<el-col :span="4" v-show="collapseVisible">
<el-form-item label="数据类型" prop="paramType">
<el-select v-model="queryParams.paramType" placeholder="请选择数据类型" clearable>
@ -57,7 +47,12 @@
<el-col :span="4" v-show="collapseVisible">
<el-form-item label="是否可控" prop="contrlFlag">
<el-select v-model="queryParams.contrlFlag" placeholder="请选择是否可控" clearable>
<el-option label="请选择字典生成" value="" />
<el-option
v-for="dict in contrlFlag"
:key="dict.value"
:label="dict.label"
:value="dict.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
@ -76,7 +71,11 @@
<el-col :span="4" v-show="collapseVisible">
<el-form-item label="是否有效" prop="enabled">
<el-select v-model="queryParams.enabled" placeholder="请选择是否有效" clearable>
<el-option label="请选择字典生成" value="" />
<el-option
v-for="dict in enabled"
:label="dict.label"
:value="dict.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
@ -123,14 +122,23 @@
<el-col :span="4" v-show="collapseVisible">
<el-form-item label="参数模版ID" prop="paramModelId">
<el-select v-model="queryParams.paramModelId" placeholder="请选择参数模版ID" clearable>
<el-option label="请选择字典生成" value="" />
<el-option
v-for="dict in paramClassList"
:label="dict.paramClassName"
:value=dict.paramClassCode>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="4" v-show="collapseVisible">
<el-form-item label="分区(字典)" prop="partion">
<el-select v-model="queryParams.partion" placeholder="请选择分区(字典)" clearable>
<el-option label="请选择字典生成" value="" />
<el-option
v-for="dict in dc_device_partion"
:key="dict.value"
:label="dict.label"
:value="dict.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
@ -209,6 +217,13 @@
<dict-tag :options="enabledTable" :value="scope.row.enabled"/>
</template>
</el-table-column>
<el-table-column label="计算单位" align="center" prop="contrlType" column-key="contrlType" filter-placement="bottom-end"
:filters="getfilterNameItem('contrlType')" :filter-method="filterMethod" :width="120" sortable
>
<template #default="scope">
<dict-tag :options="dc_param_uint_type" :value="scope.row.contrlType" :default-value="'Unknown'"/>
</template>
</el-table-column>
<el-table-column label="设置值" align="center" prop="setDefautvalue" :width="120" sortable/>
<el-table-column label="偏移量" align="center" prop="setAdjustvalue" :width="120" sortable/>
<el-table-column label="验证范围" align="center" prop="validateScope" :width="120" sortable/>
@ -259,7 +274,6 @@
<!-- 添加或修改设备参数明细对话框 -->
<el-dialog :title="title" v-model="open" width="800px" append-to-body>
<el-form ref="paramsRef" :model="form" :rules="rules" label-width="120px">
<el-row>
<el-col :span="12">
<el-form-item label="中台设备ID" prop="deviceUuid">
@ -377,6 +391,7 @@
import { listParams, getParams, delParams, addParams, updateParams,listWithFilterColumn } from "@/api/model/params";
import { listParamclassNoPage } from "@/api/model/paramclass";
import lock from "@/assets/icons/svg/lock.svg";
import { ElMessageBox } from 'element-plus';
const { proxy } = getCurrentInstance();
const router = useRouter();
const { dc_param_uint_type, dc_param_value_type, dc_device_partion } = proxy.useDict('dc_param_uint_type', 'dc_param_value_type', 'dc_device_partion');
@ -404,6 +419,7 @@ const tableHeight = ref("0px");
const sortItemMap = ref({});
const queryParamFilter = ref({});
const sortProps = ref([]);
const names = ref([]);
const contrlFlag = ref([
{label: '可控', value: true, elTagType: 'default', elTagClass: null},
{label: '不可控', value: false, elTagType: 'default', elTagClass: null}
@ -580,6 +596,7 @@ function resetQuery() {
//
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.id);
names.value = selection.map(item => item.paramName);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
@ -598,7 +615,20 @@ function handleAdd() {
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const _id = row.id || ids.value
const _id = row.id || ids.value;
if(_id.length === 0){
ElMessageBox.alert('请选择需要修改的记录', '提示', {
confirmButtonText: '确定',
center: true,
})
return;
}else if(_id.length > 1){
ElMessageBox.alert('只能选择一条记录进行修改', '提示', {
confirmButtonText: '确定',
center: true,
})
return;
}
getParams(_id).then(response => {
form.value = response.data;
paramModelDisabled.value = true;
@ -631,8 +661,17 @@ function submitForm() {
/** 删除按钮操作 */
function handleDelete(row) {
const _ids = row.id || ids.value;
proxy.$modal.confirm('是否确认删除设备参数明细编号为"' + _ids + '"的数据项?').then(function() {
if(_ids.length == 0){
ElMessageBox.alert('请先选择要删除的项', '提示', {
confirmButtonText: '确定',
center: true,
})
return;
}
const _names = row.paramName || names.value;
proxy.$modal.confirm('是否确认删除设备参数名称为"' + _names + '"的数据项?').then(function() {
return delParams(_ids);
}).then(() => {
getList();
@ -642,8 +681,13 @@ function handleDelete(row) {
/** 导出按钮操作 */
function handleExport() {
proxy.download('model/dcBaseDeviceParam/export', {
...queryParams.value
let param = {
"obj":queryParams.value,
"params":queryParamFilter.value,
"sort":sortProps.value,
}
proxy.newDownload('model/dcBaseDeviceParam/export', {
...param
}, `params_${new Date().getTime()}.xlsx`)
}
@ -668,7 +712,7 @@ function getParamModelName(id){
function checkedParamModel(val){
paramClassList.value.forEach(item=>{
if(item.id == val){
if(item.paramClassCode == val){
paramClassCodeSeleted.value = item.paramClassCode;
if(form.value.partion !== undefined && form.value.partion !== null && form.value.partion !== ""){
form.value.paramCode = form.value.partion+form.value.deviceUuid+paramClassCodeSeleted.value;

2
vite.config.js

@ -35,7 +35,7 @@ export default defineConfig(({ mode, command }) => {
},
// vite 相关配置
server: {
port: 80,
port: 8010,
host: true,
open: true
// proxy: {

Loading…
Cancel
Save