mirror of https://gitee.com/lmlz_0/dc-ui.git
ljlong_2630
1 year ago
7 changed files with 640 additions and 148 deletions
@ -0,0 +1,258 @@ |
|||
<template> |
|||
<div class="app-container" |
|||
v-loading="loading"> |
|||
<!-- 添加或修改设备模型信息对话框 --> |
|||
<div class="marginbottom50px"> |
|||
<el-steps :active="currentStep"> |
|||
<el-step title="选择设备" description="告警设备" /> |
|||
<el-step title="选择参数" description="该设备告警参数选择" /> |
|||
<el-step title="选择策略" description="参数告警的策略配置" /> |
|||
<el-step title="选择通知方式" description="告警的提醒方式配置" /> |
|||
</el-steps> |
|||
</div> |
|||
<div class="overflowscroll"> |
|||
<el-form ref="devicemodelRef" :model="form" :rules="rules" label-width="100px" class="textaligncenter"> |
|||
<el-carousel ref="carousel" :autoplay="false" :arrow="never" pause-on-hover="false" class="customCarousel" :style="{ height: windowHeight + 'px' }"> |
|||
<el-carousel-item :key="1" name="1" class="textaligncenter overflowscroll height300"> |
|||
<div class="width80percent textaligncenter displayinlineblock"> |
|||
<noalertdevices ref="devicealert"/> |
|||
</div> |
|||
</el-carousel-item> |
|||
<el-carousel-item :key="2" name="2" class="textaligncenter overflowscroll height300"> |
|||
<div class="width80percent textaligncenter displayinlineblock"> |
|||
<noalertparams ref="paramalert"/> |
|||
</div> |
|||
</el-carousel-item> |
|||
<el-carousel-item :key="3" name="3" class="textaligncenter overflowscroll height300"> |
|||
<div class="width80percent textaligncenter"> |
|||
</div> |
|||
</el-carousel-item> |
|||
<el-carousel-item :key="4" name="4" class="textaligncenter overflowscroll height300"> |
|||
<div class="width80percent textaligncenter"> |
|||
</div> |
|||
</el-carousel-item> |
|||
</el-carousel> |
|||
<el-form-item class="displayinlineblock divsonmarginleft0 margintop20"> |
|||
<el-button type="primary" v-if="prevStepButtonShow" @click="prevStep" style="display: inline-block !important" >上一步</el-button> |
|||
<el-button type="primary" v-if="submitButtonShow" @click="submitForm" style="display: inline-block !important">提交</el-button> |
|||
<el-button @click="cancel" style="display: inline-block !important">取 消</el-button> |
|||
<el-button type="primary" v-if="nextStepButtonShow" @click="nextStep" style="display: inline-block !important">下一步</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
<el-dialog :title="title" v-model="addParamModelShow" width="800px" append-to-body :dc_device_partion="dc_device_partion" :dc_class_type="dc_class_type"> |
|||
|
|||
</el-dialog> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
<style lang="scss"> |
|||
@import "@/assets/styles/self-defined.scss"; |
|||
.customCarousel { |
|||
>div{ |
|||
>button { |
|||
display: none !important; |
|||
} |
|||
} |
|||
ul{ |
|||
display: none !important; |
|||
} |
|||
} |
|||
</style> |
|||
<script setup name="addalert"> |
|||
import { required } from "@vee-validate/rules"; |
|||
import noalertdevices from "./noalertdevices"; |
|||
import noalertparams from "./noalertparams"; |
|||
import { onMounted } from "vue"; |
|||
import { ElMessage, ElMessageBox } from 'element-plus' |
|||
const { proxy } = getCurrentInstance(); |
|||
const {dc_class_type, dc_device_partion, dc_model_type} = proxy.useDict('dc_class_type', 'dc_device_partion','dc_model_type'); |
|||
const router = useRouter(); |
|||
const open = ref(false); |
|||
const loading = ref(false); |
|||
const currentStep = ref(1); |
|||
const nextStepButtonShow = ref(true); |
|||
const prevStepButtonShow = ref(false); |
|||
const submitButtonShow = ref(false); |
|||
const addParamModelShow = ref(false); |
|||
const navber = ref(0); |
|||
const tagsViewContainer = ref(0); |
|||
const marginbottom50px = ref(0); |
|||
const windowHeight = ref(0); |
|||
const selectDeviceId = ref(""); |
|||
const data = reactive({ |
|||
form: { |
|||
}, |
|||
queryParams: { |
|||
modelName: null, |
|||
modelCode: null, |
|||
sort: null, |
|||
modelTypeId: null, |
|||
pid: null, |
|||
note: null |
|||
}, |
|||
rules: { |
|||
|
|||
}, |
|||
validations: { |
|||
inputValue: { required } |
|||
} |
|||
}); |
|||
|
|||
const { queryParams, form, rules } = toRefs(data); |
|||
|
|||
// 取消按钮 |
|||
function cancel() { |
|||
open.value = false; |
|||
reset(); |
|||
} |
|||
|
|||
// 表单重置 |
|||
function reset() { |
|||
form.value = { |
|||
tentantId: null, |
|||
version: null, |
|||
createBy: null, |
|||
createTime: null, |
|||
updateBy: null, |
|||
updateTime: null, |
|||
deptId: null, |
|||
userId: null, |
|||
deleteBy: null, |
|||
deleteTime: null, |
|||
id: null, |
|||
modelName: null, |
|||
modelCode: null, |
|||
sort: null, |
|||
modelTypeId: null, |
|||
pid: null, |
|||
note: null |
|||
}; |
|||
proxy.resetForm("devicemodelRef"); |
|||
} |
|||
|
|||
/** 提交按钮 */ |
|||
function submitForm() { |
|||
|
|||
} |
|||
|
|||
|
|||
function nextStep(){ |
|||
this.$nextTick(() => { |
|||
if(currentStep.value==1){ |
|||
const selectDevice = proxy.$refs["devicealert"].$refs.addAlertTable.getSelectionRows(); |
|||
|
|||
debugger |
|||
if(!valideToAddDevice(selectDevice)){ |
|||
return; |
|||
}else{ |
|||
debugger |
|||
proxy.$refs["paramalert"].deviceUuid = selectDevice.uuid; |
|||
proxy.$refs["paramalert"].getParamsNoAlertData(); |
|||
} |
|||
currentStep.value = currentStep.value + 1; |
|||
proxy.$refs.carousel.next(); |
|||
submitButtonShow.value = true; |
|||
nextStepButtonShow.value = true; |
|||
prevStepButtonShow.value = true; |
|||
}else if(currentStep.value == 2){ |
|||
currentStep.value = currentStep.value + 1; |
|||
proxy.$refs.carousel.next(); |
|||
submitButtonShow.value = true; |
|||
nextStepButtonShow.value = true; |
|||
prevStepButtonShow.value = true; |
|||
}else{ |
|||
currentStep.value = currentStep.value + 1; |
|||
proxy.$refs.carousel.next(); |
|||
submitButtonShow.value = true; |
|||
nextStepButtonShow.value = false; |
|||
prevStepButtonShow.value = true; |
|||
} |
|||
}); |
|||
|
|||
} |
|||
function prevStep(){ |
|||
if(currentStep.value==4){ |
|||
currentStep.value = currentStep.value - 1; |
|||
proxy.$refs.carousel.prev(); |
|||
submitButtonShow.value = true; |
|||
nextStepButtonShow.value = true; |
|||
prevStepButtonShow.value = true; |
|||
}else if(currentStep.value == 3){ |
|||
currentStep.value = currentStep.value - 1; |
|||
proxy.$refs.carousel.prev(); |
|||
submitButtonShow.value = true; |
|||
nextStepButtonShow.value = true; |
|||
prevStepButtonShow.value = true; |
|||
}else if(currentStep.value == 2){ |
|||
currentStep.value = currentStep.value - 1; |
|||
proxy.$refs.carousel.prev(); |
|||
submitButtonShow.value = false; |
|||
nextStepButtonShow.value = true; |
|||
prevStepButtonShow.value = false; |
|||
} |
|||
} |
|||
|
|||
|
|||
function submit(){ |
|||
|
|||
} |
|||
|
|||
function updateWindowHeight(){ |
|||
navber.value=document.querySelector('.navbar').clientHeight; |
|||
tagsViewContainer.value=document.querySelector('.tags-view-container').clientHeight; |
|||
marginbottom50px.value=document.querySelector('.marginbottom50px').clientHeight; |
|||
windowHeight.value = window.innerHeight - navber.value - tagsViewContainer.value - marginbottom50px.value - 160; |
|||
}; |
|||
|
|||
onMounted(() => { |
|||
updateWindowHeight(); |
|||
window.addEventListener('resize', updateWindowHeight); |
|||
}); |
|||
|
|||
onUnmounted(() => { |
|||
window.removeEventListener('resize', updateWindowHeight); |
|||
}); |
|||
|
|||
function valideToAddDevice(selectDevice){ |
|||
console.log("---------------"); |
|||
|
|||
if(selectDevice.length==1){ |
|||
selectDeviceId.value = selectDevice.uuid; |
|||
return true; |
|||
}else if(selectDevice.length > 1){ |
|||
ElMessageBox.alert('请确保只选择一条设备', '提示', { |
|||
confirmButtonText: '确定', |
|||
center: true, |
|||
}) |
|||
return false; |
|||
}else if(selectDevice.length < 1){ |
|||
ElMessageBox.alert('请选择设备', '提示', { |
|||
confirmButtonText: '确定', |
|||
}) |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
function valideToAddParams(){ |
|||
console.log("---------------"); |
|||
// let selectDevice = proxy.$refs["paramalert"].$refs.addAlertTable.getSelectionRows(); |
|||
// if(selectDevice.length==1){ |
|||
// selectDeviceId.value = selectDevice.uuid; |
|||
// return true; |
|||
// }else if(selectDevice.length > 1){ |
|||
// ElMessageBox.alert('请确保只选择一条设备', '提示', { |
|||
// confirmButtonText: '确定', |
|||
// center: true, |
|||
// }) |
|||
// return false; |
|||
// }else if(selectDevice.length < 1){ |
|||
// ElMessageBox.alert('请选择设备', '提示', { |
|||
// confirmButtonText: '确定', |
|||
// }) |
|||
// return false; |
|||
// } |
|||
} |
|||
|
|||
</script> |
|||
|
|||
|
@ -0,0 +1,273 @@ |
|||
<template> |
|||
<div> |
|||
<el-form :model="queryParams" ref="queryRefForm" :inline="true" v-show="showSearch" label-width="120px"> |
|||
<el-form-item label="中台设备编码" prop="centerDeviceCode"> |
|||
<el-input |
|||
v-model="queryParams.centerDeviceCode" |
|||
placeholder="请输入中台设备编码" |
|||
clearable |
|||
@keyup.enter="handleQuery" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="设备名称" prop="deviceName"> |
|||
<el-input |
|||
v-model="queryParams.deviceName" |
|||
placeholder="请输入设备名称" |
|||
clearable |
|||
@keyup.enter="handleQuery" |
|||
/> |
|||
</el-form-item> |
|||
<el-collapse-transition> |
|||
<div v-show="collapseVisibleDialog"> |
|||
<el-form-item label="是否可用" prop="enabledFlag"> |
|||
<el-select v-model="queryParams.enabledFlag" placeholder="请选择是否可用" clearable> |
|||
<el-option |
|||
v-for="dict in enabledFlag" |
|||
:key="dict.value" |
|||
:label="dict.label" |
|||
:value="dict.value" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="通讯来源类型" prop="deviceSource"> |
|||
<el-select v-model="queryParams.deviceSource" placeholder="请选择是否可用" clearable> |
|||
<el-option |
|||
v-for="dict in dc_device_source" |
|||
:key="dict.value" |
|||
:label="dict.label" |
|||
:value="dict.value" |
|||
@change="deviceSourceChange" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="设备类型" prop="deviceType"> |
|||
<el-select v-model="queryParams.deviceType" placeholder="请选择设备类型" clearable> |
|||
<el-option |
|||
v-for="dict in dc_device_type" |
|||
:key="dict.value" |
|||
:label="dict.label" |
|||
:value="dict.value" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="所属组织名称" prop="orgName"> |
|||
<el-tree-select v-model="queryParams.orgName" :data="deptOptions" |
|||
:props="{ value: 'label', label: 'label', children: 'children' }" value-key="id" placeholder="请选择组织名称" |
|||
check-strictly :default-expand-all="true"/> |
|||
</el-form-item> |
|||
<el-form-item label="位置编码" prop="locationCode"> |
|||
<el-input |
|||
v-model="queryParams.locationCode" |
|||
placeholder="请输入位置编码" |
|||
clearable |
|||
@keyup.enter="handleQuery" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="位置名称" prop="locationName"> |
|||
<el-input |
|||
v-model="queryParams.locationName" |
|||
placeholder="请输入位置名称" |
|||
clearable |
|||
@keyup.enter="handleQuery" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="设备应用范围" prop="deviceClass"> |
|||
<el-input |
|||
v-model="queryParams.deviceClass" |
|||
placeholder="请输入设备应用范围" |
|||
clearable |
|||
@keyup.enter="handleQuery" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="接口名称" prop="apiName"> |
|||
<el-input |
|||
v-model="queryParams.apiName" |
|||
placeholder="请输入接口名称" |
|||
clearable |
|||
@keyup.enter="handleQuery" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="服务器地址" prop="serverIp"> |
|||
<el-input |
|||
v-model="queryParams.serverIp" |
|||
placeholder="请输入服务器地址" |
|||
clearable |
|||
@keyup.enter="handleQuery" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="从属网关ID" prop="gatewayId"> |
|||
<el-input |
|||
v-model="queryParams.gatewayId" |
|||
placeholder="请输入从属网关ID" |
|||
clearable |
|||
@keyup.enter="handleQuery" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="纬度" prop="latValue"> |
|||
<el-input |
|||
v-model="queryParams.latValue" |
|||
placeholder="请输入纬度" |
|||
clearable |
|||
@keyup.enter="handleQuery" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="经度" prop="lagValue"> |
|||
<el-input |
|||
v-model="queryParams.lagValue" |
|||
placeholder="请输入经度" |
|||
clearable |
|||
@keyup.enter="handleQuery" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="设备模型" prop="deviceModelId"> |
|||
<el-select v-model="queryParams.deviceModelId" placeholder="请选择设备模型id" clearable> |
|||
<el-option label="请选择设备模型" value="deviceModelId" /> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="租户号" prop="tentantId"> |
|||
<el-input |
|||
v-model="queryParams.tentantId" |
|||
placeholder="请输入租户号" |
|||
clearable |
|||
@keyup.enter="handleQuery" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="设备分组" prop="deviceGroupId"> |
|||
<el-select v-model="queryParams.deviceGroupId" placeholder="请选择设备分组ID" clearable> |
|||
<el-option label="请添加设备分组" value="" /> |
|||
</el-select> |
|||
</el-form-item> |
|||
</div> |
|||
</el-collapse-transition> |
|||
<el-form-item class="childTextAlignCenter"> |
|||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> |
|||
<el-button type="info" plain icon="Refresh" @click="resetQuery">重置</el-button> |
|||
<el-button @click="toggleCollapseDialog">{{editNameDialog}}</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
<el-row :gutter="10" class="mb8"> |
|||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"> |
|||
</right-toolbar> |
|||
</el-row> |
|||
<el-table ref="addAlertTable" v-loading="loading" :data="deviceList" @selection-change="handleSelectionChange"> |
|||
<el-table-column type="selection" width="55" align="center" fixed="left"/> |
|||
<el-table-column label="中台设备编码" align="center" prop="centerDeviceCode" :width="120"/> |
|||
<el-table-column label="设备名称" align="center" prop="deviceName" :width="120"/> |
|||
<el-table-column label="通讯来源类型" align="center" prop="deviceSource" :width="120"/> |
|||
<el-table-column label="是否可用" align="center" prop="enabledFlag" :width="120"> |
|||
<template #default="scope"> |
|||
<dict-tag :options="enabledFlagTable" :value="scope.row.enabledFlag"/> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="设备类型" align="center" prop="deviceType" :width="120"> |
|||
<template #default="scope"> |
|||
<dict-tag :options="dc_device_type" :value="scope.row.deviceType"/> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="所属组织名称" align="center" prop="orgName" :width="120" /> |
|||
<el-table-column label="位置编码" align="center" prop="locationCode" :width="120"/> |
|||
<el-table-column label="位置名称" align="center" prop="locationName" :width="120"/> |
|||
<el-table-column label="设备应用范围" align="center" prop="deviceClass" :width="120"/> |
|||
<el-table-column label="接口名称" align="center" prop="apiName" :width="120"/> |
|||
<el-table-column label="服务器地址" align="center" prop="serverIp" :width="120"/> |
|||
<el-table-column label="从属网关ID" align="center" prop="gatewayId" :width="120"/> |
|||
<el-table-column label="纬度" align="center" prop="latValue" :width="120"/> |
|||
<el-table-column label="经度" align="center" prop="lagValue" :width="120"/> |
|||
<el-table-column label="设备模型" align="center" prop="deviceModelId" :width="120"> |
|||
</el-table-column> |
|||
<el-table-column label="租户号" align="center" prop="tentantId" :width="120"/> |
|||
<el-table-column label="设备分组" align="center" prop="deviceGroupId" :width="120"/> |
|||
</el-table> |
|||
<pagination |
|||
class="sundivright10percent" |
|||
v-show="total>0" |
|||
:total="total" |
|||
v-model:page="queryParams.pageNum" |
|||
v-model:limit="queryParams.pageSize" |
|||
@pagination="getList" |
|||
/> |
|||
</div> |
|||
</template> |
|||
<style lang="scss" > |
|||
@import "@/assets/styles/self-defined.scss"; |
|||
</style> |
|||
<script setup name="devicealert"> |
|||
import { listParamclass } from "@/api/model/paramclass"; |
|||
import { getNoAlertDevice } from "@/api/model/alert"; |
|||
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'); |
|||
const showSearch = ref(true); |
|||
const editNameDialog = ref("更多筛选项"); |
|||
const collapseVisibleDialog = ref(false); |
|||
const deviceList = ref([]); |
|||
const total = ref(0); |
|||
const loading = ref(false); |
|||
let devicealert = ref(null); |
|||
const data = reactive({ |
|||
form: { |
|||
}, |
|||
queryParams: { |
|||
pageNum: 1, |
|||
pageSize: 10, |
|||
centerDeviceCode: null, |
|||
deviceName: null, |
|||
deviceSource: null, |
|||
deviceSourceId: null, |
|||
enabledFlag: null, |
|||
deviceType: null, |
|||
orgCode: null, |
|||
orgName: null, |
|||
locationCode: null, |
|||
locationName: null, |
|||
deviceClass: null, |
|||
apiName: null, |
|||
serverIp: null, |
|||
gatewayId: null, |
|||
latValue: null, |
|||
lagValue: null, |
|||
uuid: null, |
|||
alertEnabled: null, |
|||
deviceModelId: null, |
|||
tentantId: null, |
|||
deviceGroupId: null |
|||
}, |
|||
rules: { |
|||
}, |
|||
}); |
|||
|
|||
const { queryParams, form, rules } = toRefs(data); |
|||
|
|||
|
|||
|
|||
function toggleCollapseDialog() { |
|||
collapseVisibleDialog.value = !collapseVisibleDialog.value; |
|||
if(collapseVisibleDialog.value){ |
|||
editNameDialog.value = "折叠筛选项"; |
|||
}else{ |
|||
editNameDialog.value = "更多筛选项" |
|||
} |
|||
} |
|||
|
|||
/** 搜索按钮操作 */ |
|||
function handleQuery() { |
|||
loading.value = true; |
|||
queryParams.value.pageNum = 1; |
|||
getNoAlertDevice(queryParams.value).then(response=>{ |
|||
deviceList.value=response.rows; |
|||
total.value=response.total; |
|||
loading.value = false; |
|||
}); |
|||
} |
|||
|
|||
function getList() { |
|||
loading.value = true; |
|||
getNoAlertDevice(queryParams.value).then(response=>{ |
|||
deviceList.value=response.rows; |
|||
total.value=response.total; |
|||
loading.value = false; |
|||
}); |
|||
} |
|||
|
|||
getList(); |
|||
</script> |
Loading…
Reference in new issue