dict tag
This commit is contained in:
@ -1,44 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
import request from "@/utils/request";
|
||||
|
||||
// 查询设备告警日志列表
|
||||
export function listAlertLog(query) {
|
||||
return request({
|
||||
url: '/device/alertLog/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
return request({
|
||||
url: "/device/alertLog/list",
|
||||
method: "get",
|
||||
params: query,
|
||||
});
|
||||
}
|
||||
|
||||
// 查询设备告警日志详细
|
||||
export function getAlertLog(alertLogId) {
|
||||
return request({
|
||||
url: '/device/alertLog/' + alertLogId,
|
||||
method: 'get'
|
||||
})
|
||||
return request({
|
||||
url: "/device/alertLog/" + alertLogId,
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
|
||||
// 新增设备告警日志
|
||||
export function addAlertLog(data) {
|
||||
return request({
|
||||
url: '/device/alertLog',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
return request({
|
||||
url: "/device/alertLog",
|
||||
method: "post",
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
// 修改设备告警日志
|
||||
export function updateAlertLog(data) {
|
||||
return request({
|
||||
url: '/device/alertLog',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
return request({
|
||||
url: "/device/alertLog",
|
||||
method: "put",
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
// 删除设备告警日志
|
||||
export function delAlertLog(alertLogId) {
|
||||
return request({
|
||||
url: '/device/alertLog/' + alertLogId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
return request({
|
||||
url: "/device/alertLog/" + alertLogId,
|
||||
method: "delete",
|
||||
});
|
||||
}
|
||||
|
@ -1,44 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
import request from "@/utils/request";
|
||||
|
||||
// 查询设备列表
|
||||
export function listDevice(query) {
|
||||
return request({
|
||||
url: '/iot/device/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
return request({
|
||||
url: "/iot/device/list",
|
||||
method: "get",
|
||||
params: query,
|
||||
});
|
||||
}
|
||||
|
||||
// 查询设备详细
|
||||
export function getDevice(deviceId) {
|
||||
return request({
|
||||
url: '/iot/device/' + deviceId,
|
||||
method: 'get'
|
||||
})
|
||||
return request({
|
||||
url: "/iot/device/" + deviceId,
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
|
||||
// 新增设备
|
||||
export function addDevice(data) {
|
||||
return request({
|
||||
url: '/iot/device',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
return request({
|
||||
url: "/iot/device",
|
||||
method: "post",
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
// 修改设备
|
||||
export function updateDevice(data) {
|
||||
return request({
|
||||
url: '/iot/device',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
return request({
|
||||
url: "/iot/device",
|
||||
method: "put",
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
// 删除设备
|
||||
export function delDevice(deviceId) {
|
||||
return request({
|
||||
url: '/iot/device/' + deviceId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
return request({
|
||||
url: "/iot/device/" + deviceId,
|
||||
method: "delete",
|
||||
});
|
||||
}
|
||||
|
1
src/assets/icons/svg/devices.svg
Normal file
1
src/assets/icons/svg/devices.svg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1680052930424" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8023" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M512 512m-414 0a414 414 0 1 0 828 0 414 414 0 1 0-828 0Z" fill="#F0C48A" p-id="8024"></path><path d="M938.2 716h-732c-40.8 0-74-33.2-74-74V185.2c0-40.8 33.2-74 74-74h732c40.8 0 74 33.2 74 74V642c0 41-33 74-74 74z" fill="#D3E6F8" p-id="8025"></path><path d="M132.4 616.6V642c0 40.8 33.2 74 74 74h732c40.8 0 74-33.2 74-74v-25.4h-880zM478.2 716h188.4v125.8h-188.4zM785.4 912.8H359.2v-35.2c0-19.8 16-35.8 35.8-35.8h354.6c19.8 0 35.8 16 35.8 35.8v35.2z" fill="#FFFFFF" p-id="8026"></path><path d="M709.4 912.8h76v-35.2c0-19.8-16-35.8-35.8-35.8h-40.2v71zM936.2 720.6c42 0 76-34 76-76v-33.8h-76v109.8z" fill="#D3E6F8" p-id="8027"></path><path d="M936.2 111.2c42 0 76 34 76 76v429.4h-76V111.2z" fill="#A4CFF2" p-id="8028"></path><path d="M621.6 716h44.8v122.8h-44.8z" fill="#D3E6F8" p-id="8029"></path><path d="M938.2 727.8h-732c-47.2 0-85.8-38.4-85.8-85.8V185.2c0-47.2 38.4-85.8 85.8-85.8h732c47.2 0 85.8 38.4 85.8 85.8V642c0 47.4-38.4 85.8-85.8 85.8zM206.4 122.8C172 122.8 144 150.8 144 185.2V642c0 34.4 28 62.2 62.2 62.2h732c34.4 0 62.2-28 62.2-62.2V185.2c0-34.4-28-62.2-62.2-62.2H206.4z" fill="#4C4372" p-id="8030"></path><path d="M666.4 853.6H478c-6.4 0-11.8-5.2-11.8-11.8V716c0-6.4 5.2-11.8 11.8-11.8h188.4c6.4 0 11.8 5.2 11.8 11.8v125.8c0 6.6-5.2 11.8-11.8 11.8z m-176.6-23.4h164.8v-102.4h-164.8v102.4z" fill="#4C4372" p-id="8031"></path><path d="M785.4 924.6H359.2c-6.4 0-11.8-5.2-11.8-11.8v-35.2c0-26.2 21.4-47.6 47.6-47.6h354.6c26.2 0 47.6 21.4 47.6 47.6v35.2c-0.2 6.6-5.4 11.8-11.8 11.8z m-414.4-23.4h402.6v-23.4c0-13.2-10.8-24-24-24H395c-13.2 0-24 10.8-24 24v23.4zM997.8 628.4H137.4c-6.4 0-11.8-5.2-11.8-11.8s5.2-11.8 11.8-11.8h860.2c6.4 0 11.8 5.2 11.8 11.8s-5.2 11.8-11.6 11.8z" fill="#4C4372" p-id="8032"></path><path d="M11.8 472v-55.6c0-21 17.2-38.4 38.4-38.4h194.8c21 0 38.4 17.2 38.4 38.4v458.2c0 21-17.2 38.4-38.4 38.4H50c-21 0-38.4-17.2-38.4-38.4V472z" fill="#FD919E" p-id="8033"></path><path d="M11.8 453.2h272.6v348H11.8z" fill="#FFFFFF" p-id="8034"></path><path d="M230.8 456.2h52.6V408c0-15.8-12.8-28.4-28.4-28.4h-24v76.6zM230.8 912.8h13.4c21.6 0 39.2-17.6 39.2-39.2V806c0-2.6-2.2-4.8-4.8-4.8h-47.8v111.6z" fill="#E8677D" p-id="8035"></path><path d="M230.8 456.2h52.6v344.8h-52.6z" fill="#D3E6F8" p-id="8036"></path><path d="M130.834569 872.055703a23.6 23.6 0 1 0 33.374858-33.376023 23.6 23.6 0 1 0-33.374858 33.376023Z" fill="#E8677D" p-id="8037"></path><path d="M281.8 464.8H13.2c-6.4 0-11.8-5.2-11.8-11.8s5.2-11.8 11.8-11.8h268.6c6.4 0 11.8 5.2 11.8 11.8s-5.2 11.8-11.8 11.8zM281.8 812.8H13.2c-6.4 0-11.8-5.2-11.8-11.8 0-6.4 5.2-11.8 11.8-11.8h268.6c6.4 0 11.8 5.2 11.8 11.8 0 6.6-5.2 11.8-11.8 11.8zM147.6 890.8c-19.4 0-35.2-15.8-35.2-35.2s15.8-35.2 35.2-35.2c19.4 0 35.2 15.8 35.2 35.2s-15.8 35.2-35.2 35.2z m0-47.2c-6.4 0-11.8 5.2-11.8 11.8 0 6.4 5.2 11.8 11.8 11.8 6.4 0 11.8-5.2 11.8-11.8 0-6.4-5.4-11.8-11.8-11.8z" fill="#4C4372" p-id="8038"></path><path d="M245 924.6H50c-27.6 0-50-22.4-50-50V416.4c0-27.6 22.4-50 50-50h194.8c27.6 0 50 22.4 50 50v458.2c0.2 27.4-22.2 50-49.8 50zM50 389.6c-14.6 0-26.6 12-26.6 26.6v458.2c0 14.6 12 26.6 26.6 26.6h194.8c14.6 0 26.6-12 26.6-26.6v-458c0-14.6-12-26.6-26.6-26.6H50z" fill="#4C4372" p-id="8039"></path></svg>
|
After Width: | Height: | Size: 3.4 KiB |
1
src/assets/icons/svg/model.svg
Normal file
1
src/assets/icons/svg/model.svg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1680052856086" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6088" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M114.0736 307.2l-1.4336 0.73728v418.33472L512 942.08V511.20128z" fill="#FFFFFF" p-id="6089"></path><path d="M930.73408 302.72512L521.3184 92.16 128.50176 294.07232l-15.86176 8.2944L521.3184 501.76l4.79232-2.16064L931.84 303.45216v-0.3584l-1.10592-0.36864zM526.11072 499.6096L521.3184 501.76l4.79232-2.16064z" fill="#91D5FF" p-id="6090"></path><path d="M1006.40768 264.31488a68.21888 68.21888 0 0 0-29.04064-30.39232L548.00384 7.68a67.51232 67.51232 0 0 0-62.49472 0L56.50432 232.448a66.44736 66.44736 0 0 0-17.64352 15.74912 73.25696 73.25696 0 0 0-11.02848 14.27456A67.87072 67.87072 0 0 0 20.48 291.76832v439.33696a67.33824 67.33824 0 0 0 36.7616 59.31008l428.99456 224.79872c9.32864 5.29408 19.79392 8.31488 30.5152 8.78592h5.15072a64.53248 64.53248 0 0 0 26.10176-6.9632L976.9984 792.25856A67.33824 67.33824 0 0 0 1013.76 732.93824V291.76832a64.23552 64.23552 0 0 0-7.35232-27.45344z m-80.50688 39.90528l-404.3776 199.168-4.77184 2.56v427.25376L107.60192 719.02208V303.85152l15.81056-8.41728L516.75136 89.67168l408.04352 213.8112 1.10592 0.73728z" fill="#40A9FF" p-id="6091"></path></svg>
|
After Width: | Height: | Size: 1.4 KiB |
1
src/assets/icons/svg/product.svg
Normal file
1
src/assets/icons/svg/product.svg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1680058036883" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="19378" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M1024 512c0 282.767-229.242 512-512 512C229.233 1024 0 794.767 0 512S229.233 0 512 0c282.758 0 512 229.233 512 512z" fill="#EEF5FF" p-id="19379"></path><path d="M197 760.979l292.014-168.58V180.911L197 349.523z" fill="#33A272" p-id="19380"></path><path d="M293.697 392.237l-78.002-45.04 264.643-152.821 77.971 45.065z" fill="#F7F7F7" p-id="19381"></path><path d="M186.727 343.572l290.912-167.866 11.375 5.197L208.92 342.655l75.66 43.547 278.975-161.024 11.355 5.221-291.959 168.587z" fill="#66B995" p-id="19382"></path><path d="M186.727 755.062l96.224 55.406V398.986l-96.224-55.414z" fill="#008B4F" p-id="19383"></path><path d="M282.951 810.468L574.91 641.871V230.399L282.951 398.986z" fill="#33A272" p-id="19384"></path><path d="M218.385 676.738l6.152 3.544V439.631l-6.152-3.547zM232.99 612.698l6.153 3.544V447.79l-6.153-3.545zM230.365 743.527c5.496 3.171 9.938 10.865 9.92 17.182s-4.486 8.861-9.984 5.688c-5.494-3.172-9.939-10.866-9.922-17.183 0.019-6.315 4.492-8.86 9.986-5.687z m-0.058 20.502c4.361 2.519 7.906 0.5 7.922-4.511 0.014-5.011-3.51-11.109-7.871-13.627-4.357-2.517-7.902-0.498-7.916 4.514-0.014 5.009 3.509 11.109 7.865 13.624" fill="#FFFFFF" p-id="19385"></path><path d="M301.154 823.065l326.633-188.632V87.561L301.154 276.185z" fill="#00346D" p-id="19386"></path><path d="M409.277 323.967l-87.256-50.381 296.088-170.964 87.291 50.389z" fill="#F7F7F7" p-id="19387"></path><path d="M289.643 816.461l107.648 61.968v-546.88l-107.648-62.003z" fill="#00529F" p-id="19388"></path><path d="M397.291 878.429l326.65-188.65V142.916l-326.65 188.633z" fill="#00346D" p-id="19389"></path><path d="M317.939 710.287l6.157 3.545V400.98l-6.157-3.545zM332.545 575.492l6.156 3.543V409.141l-6.156-3.547zM346.809 610.401l6.152 3.544V416.613l-6.152-3.546zM334.252 794.402c5.496 3.174 9.939 10.867 9.922 17.185-0.02 6.315-4.492 8.861-9.986 5.688-5.492-3.174-9.938-10.865-9.92-17.182 0.017-6.318 4.49-8.864 9.984-5.691z m-0.059 20.506c4.361 2.517 7.908 0.497 7.922-4.513s-3.51-11.109-7.871-13.627c-4.357-2.516-7.902-0.498-7.918 4.513-0.013 5.01 3.51 11.111 7.867 13.627" fill="#FFFFFF" p-id="19390"></path><path d="M289.643 269.546L615.068 81.72l12.719 5.841L314.43 268.483l84.627 48.759 312.115-180.176 12.769 5.85-326.65 188.633z" fill="#6697C6" p-id="19391"></path><path d="M416.627 886.934l326.652-188.65V237.926L416.627 426.551z" fill="#46ABFF" p-id="19392"></path><path d="M524.789 474.341l-87.207-50.398 296.086-170.947 87.24 50.37z" fill="#F7F7F7" p-id="19393"></path><path d="M405.152 880.295L512.82 942.28V481.871l-107.668-61.959z" fill="#46ABFF" p-id="19394"></path><path d="M512.82 942.28l326.664-188.632V293.272L512.82 481.871z" fill="#1F95FF" p-id="19395"></path><path d="M437.957 658.186l6.152 3.542V522.156l-6.152-3.546zM452.561 796.304l6.15 3.544V530.316l-6.15-3.545zM449.936 869.372c5.492 3.173 9.938 10.866 9.92 17.182-0.018 6.318-4.49 8.862-9.984 5.689s-9.936-10.865-9.918-17.183c0.017-6.315 4.485-8.861 9.982-5.688z m-0.059 20.504c4.357 2.518 7.908 0.498 7.922-4.511 0.014-5.01-3.512-11.111-7.871-13.628-4.361-2.516-7.902-0.497-7.916 4.513s3.506 11.11 7.865 13.626" fill="#FFFFFF" p-id="19396"></path><path d="M405.152 419.912l325.411-187.836 12.716 5.85-313.338 180.907 84.637 48.725 312.154-180.124 12.752 5.838L512.82 481.871z" fill="#76CCF3" p-id="19397"></path></svg>
|
After Width: | Height: | Size: 3.5 KiB |
1
src/assets/icons/svg/rules.svg
Normal file
1
src/assets/icons/svg/rules.svg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1680052717355" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3942" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M864 160h-164.512A127.712 127.712 0 0 0 576 64a128 128 0 0 0 0 256 127.712 127.712 0 0 0 123.488-96H864a32 32 0 0 1 32 32v288a32 32 0 0 1-32 32h-304a32 32 0 0 0 0 64H864a96 96 0 0 0 96-96V256a96 96 0 0 0-96-96z m-288 96a64 64 0 1 1 0.032-128.032A64 64 0 0 1 576 256z" p-id="3943"></path><path d="M832 704c-57.376 0-105.376 38.016-121.632 90.048H384a31.872 31.872 0 0 1-31.744-30.656A127.68 127.68 0 0 0 320 512c-47.264 0-88.064 25.888-110.24 64H160a32 32 0 0 1-32-32V256a32 32 0 0 1 32-32h208a32 32 0 0 0 0-64H160a96 96 0 0 0-96 96v288a96 96 0 0 0 96 96h32a127.68 127.68 0 0 0 96.16 123.52A95.936 95.936 0 0 0 384 858.08h322.688A128 128 0 1 0 832 704zM256 640a64 64 0 1 1 128.032 0.032A64 64 0 0 1 256 640z m576 256a64 64 0 1 1 0.032-128.032A64 64 0 0 1 832 896z" p-id="3944"></path></svg>
|
After Width: | Height: | Size: 1.1 KiB |
1
src/assets/icons/svg/settings.svg
Normal file
1
src/assets/icons/svg/settings.svg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1680053113699" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="12498" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M511.998 1023.988c-71.133166 0-129.004488-57.871322-129.004488-129.002488v-8.793897a393.981383 393.981383 0 0 1-44.34948-18.399784l-6.241927 6.239926c-24.283715 24.287715-56.677336 37.665559-91.216931 37.665559s-66.933216-13.377843-91.222931-37.665559c-50.293411-50.299411-50.293411-132.140451 0-182.441862l6.239927-6.235926a394.031382 394.031382 0 0 1-18.397785-44.349481h-8.793897C57.875322 641.002488 0.004 583.129166 0.004 511.996s57.873322-129.004488 129.004488-129.004488h8.789897a393.827385 393.827385 0 0 1 18.399785-44.34948l-6.239927-6.239927c-50.293411-50.299411-50.293411-132.140451 0-182.439862 24.289715-24.289715 56.683336-37.667559 91.222931-37.667559s66.933216 13.377843 91.218931 37.667559l6.239927 6.235927a393.981383 393.981383 0 0 1 44.34948-18.399785v-8.789897c0-71.133166 57.873322-129.004488 129.004488-129.004488s129.004488 57.873322 129.004488 129.004488V137.798385a394.727374 394.727374 0 0 1 44.349481 18.399785l6.239926-6.239927c24.287715-24.287715 56.681336-37.665559 91.218931-37.665559s66.933216 13.377843 91.222931 37.665559c50.293411 50.299411 50.293411 132.140451 0 182.441862-11.501865 11.501865-30.155647 11.501865-41.665511 0-11.503865-11.503865-11.503865-30.155647 0-41.661512 27.32368-27.32768 27.32368-71.791159 0-99.118839-13.159846-13.161846-30.75964-20.409761-49.55742-20.40976s-36.395573 7.247915-49.555419 20.40976l-21.547747 21.547748a29.449655 29.449655 0 0 1-35.243587 4.859943 334.960075 334.960075 0 0 0-72.911146-30.249646 29.457655 29.457655 0 0 1-21.469748-28.355667V129.010488c0-38.645547-31.439632-70.085179-70.085179-70.085179s-70.085179 31.439632-70.085179 70.085179v30.423644a29.461655 29.461655 0 0 1-21.469748 28.355667 335.000074 335.000074 0 0 0-72.911146 30.249646 29.459655 29.459655 0 0 1-35.243587-4.859943l-21.547747-21.547748c-13.159846-13.161846-30.75564-20.409761-49.555419-20.409761s-36.397573 7.247915-49.55742 20.409761c-27.32368 27.32368-27.32368 71.787159 0 99.118839l21.547748 21.543747a29.455655 29.455655 0 0 1 4.859943 35.243587 334.836076 334.836076 0 0 0-30.249646 72.911146 29.453655 29.453655 0 0 1-28.355667 21.469748H129.008488c-38.645547 0-70.085179 31.439632-70.085179 70.085179s31.439632 70.085179 70.085179 70.085179h30.423644a29.459655 29.459655 0 0 1 28.355667 21.467748 335.156072 335.156072 0 0 0 30.249646 72.913146 29.461655 29.461655 0 0 1-4.863943 35.243587l-21.547748 21.543747c-27.32168 27.32368-27.32168 71.787159 0.002 99.114839 13.159846 13.161846 30.75964 20.409761 49.55742 20.40976s36.395573-7.247915 49.555419-20.40976l21.549747-21.543748a29.457655 29.457655 0 0 1 35.237587-4.863943 335.180072 335.180072 0 0 0 72.913146 30.249646 29.457655 29.457655 0 0 1 21.469748 28.355667v30.425644c0 38.643547 31.439632 70.083179 70.085179 70.083178s70.085179-31.439632 70.085179-70.083178V864.569868a29.461655 29.461655 0 0 1 21.469748-28.355667 335.138073 335.138073 0 0 0 72.913146-30.249646 29.459655 29.459655 0 0 1 35.237587 4.863943l21.547747 21.543748c13.161846 13.161846 30.75964 20.409761 49.557419 20.40976s36.397573-7.247915 49.55742-20.40976c27.32368-27.32368 27.32368-71.789159 0-99.118839l-21.543748-21.543747a29.455655 29.455655 0 0 1-4.863943-35.243587 335.156072 335.156072 0 0 0 30.249646-72.913146 29.459655 29.459655 0 0 1 28.355667-21.467748h30.423644c38.645547 0 70.085179-31.439632 70.085179-70.085179 0-19.269774-8.171904-37.939555-22.419738-51.2194-11.903861-11.09387-12.561853-29.733652-1.467982-41.635512 11.09387-11.901861 29.739651-12.555853 41.635512-1.467983C1008.984176 442.06082 1023.992 476.438417 1023.992 512c0 71.133166-57.873322 129.004488-129.004488 129.004488H886.193615a394.777374 394.777374 0 0 1-18.397784 44.349481l6.235926 6.235926c50.297411 50.299411 50.297411 132.140451 0.002 182.439862-24.289715 24.289715-56.683336 37.667559-91.222931 37.667559s-66.933216-13.377843-91.220931-37.667559l-6.239926-6.235926a393.239392 393.239392 0 0 1-44.349481 18.399784v8.793897C641.002488 966.120678 583.129166 1023.988 511.998 1023.988z" fill="#2D527C" p-id="12499"></path><path d="M511.99 511.988m-235.149244 0a235.149244 235.149244 0 1 0 470.298488 0 235.149244 235.149244 0 1 0-470.298488 0Z" fill="#CEE8FA" p-id="12500"></path><path d="M511.998 776.614899c-145.91029 0-264.614899-118.706609-264.614899-264.614899S366.08771 247.381101 511.998 247.381101s264.614899 118.708609 264.614899 264.618899S657.90829 776.614899 511.998 776.614899z m0-470.316488c-113.420671 0-205.69559 92.274919-205.695589 205.697589 0 113.420671 92.274919 205.69559 205.695589 205.69559s205.69559-92.274919 205.69559-205.69559c0-113.422671-92.274919-205.697589-205.69559-205.697589z" fill="#2D527C" p-id="12501"></path></svg>
|
After Width: | Height: | Size: 4.9 KiB |
1
src/assets/icons/svg/template.svg
Normal file
1
src/assets/icons/svg/template.svg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1680052791650" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4953" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M243.2 290.816v562.322286h495.689143V926.47619H279.478857C219.37981 926.47619 170.666667 877.226667 170.666667 816.469333v-525.653333h72.533333zM780.190476 97.52381a73.142857 73.142857 0 0 1 73.142857 73.142857v560.761904a73.142857 73.142857 0 0 1-73.142857 73.142858H292.571429V170.666667a73.142857 73.142857 0 0 1 73.142857-73.142857h414.47619z m0 73.142857H365.714286v560.761904h414.47619V170.666667z m-125.927619 71.265523v73.362286H436.662857V241.93219h217.624381z" p-id="4954"></path></svg>
|
After Width: | Height: | Size: 829 B |
@ -5,19 +5,21 @@
|
||||
<span
|
||||
v-if="item.elTagType == 'default' || item.elTagType == ''"
|
||||
:key="item.value"
|
||||
:index="index"
|
||||
:class="item.elTagClass"
|
||||
:index="index"
|
||||
>{{ item.label }}</span
|
||||
>
|
||||
<el-tag
|
||||
v-else
|
||||
:disable-transitions="true"
|
||||
:key="item.value + ''"
|
||||
:index="index"
|
||||
:type="item.elTagType === 'primary' ? '' : item.elTagType"
|
||||
:class="item.elTagClass"
|
||||
>{{ item.label }}</el-tag
|
||||
>
|
||||
:disable-transitions="true"
|
||||
:effect="effect"
|
||||
:index="index"
|
||||
:size="size"
|
||||
:type="item.elTagType === 'primary' ? '' : item.elTagType"
|
||||
>{{ item.label }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</template>
|
||||
</div>
|
||||
@ -32,6 +34,14 @@ const props = defineProps({
|
||||
},
|
||||
// 当前的值
|
||||
value: [Number, String, Array],
|
||||
effect: {
|
||||
type: String,
|
||||
default: "light",
|
||||
},
|
||||
size: {
|
||||
type: String,
|
||||
default: "default",
|
||||
},
|
||||
});
|
||||
|
||||
const values = computed(() => {
|
||||
|
@ -6,11 +6,13 @@
|
||||
<el-table-column prop="deviceId" />
|
||||
<el-table-column label="设备名称" prop="deviceName" />
|
||||
</el-table>
|
||||
<pagination v-show="total > 0"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
v-model:page="queryParams.pageNum"
|
||||
:total="total"
|
||||
@pagination="getList" />
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
v-model:page="queryParams.pageNum"
|
||||
:total="total"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col>
|
||||
@ -28,22 +30,25 @@ import Pagination from "@/components/Pagination/index.vue";
|
||||
const props = defineProps({
|
||||
list: {
|
||||
type: Array,
|
||||
default: [{
|
||||
deviceId: 40
|
||||
}, {
|
||||
deviceId: 38
|
||||
}]
|
||||
default: [
|
||||
{
|
||||
deviceId: 40,
|
||||
},
|
||||
{
|
||||
deviceId: 38,
|
||||
},
|
||||
],
|
||||
},
|
||||
requestMethod: {
|
||||
type: Function,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
selectKey: {
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
modelValue: {
|
||||
type: Boolean
|
||||
}
|
||||
type: Boolean,
|
||||
},
|
||||
});
|
||||
const { list } = toRefs(props);
|
||||
|
||||
@ -58,8 +63,8 @@ const ids = ref([]);
|
||||
const data = reactive({
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10
|
||||
}
|
||||
pageSize: 10,
|
||||
},
|
||||
});
|
||||
|
||||
const { queryParams } = toRefs(data);
|
||||
@ -89,11 +94,14 @@ const cancel = () => {
|
||||
|
||||
const handleSelect = (selection, row) => {
|
||||
const isCheck =
|
||||
selection.findIndex((el) => el[props.selectKey] === row[props.selectKey]) > -1;
|
||||
selection.findIndex((el) => el[props.selectKey] === row[props.selectKey]) >
|
||||
-1;
|
||||
if (isCheck) {
|
||||
/*添加选中*/
|
||||
const isIdNotExist =
|
||||
list.value.findIndex((el) => el[props.selectKey] === row[props.selectKey]) === -1;
|
||||
list.value.findIndex(
|
||||
(el) => el[props.selectKey] === row[props.selectKey]
|
||||
) === -1;
|
||||
if (isIdNotExist) {
|
||||
selectedProperties.value.push(row);
|
||||
}
|
||||
@ -127,6 +135,4 @@ const confirmSelect = () => {
|
||||
getList();
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
<style scoped></style>
|
||||
|
@ -70,7 +70,7 @@
|
||||
</template>
|
||||
<script setup>
|
||||
import { reactive, toRefs, watch } from "vue";
|
||||
import { listUser } from "@/api/system/user";
|
||||
import { listUser } from "@/api/system/user";
|
||||
import { addDateRange } from "@/utils/ruoyi";
|
||||
import { deptTreeSelect } from "@/api/system/dept";
|
||||
|
||||
|
@ -1,50 +1,194 @@
|
||||
export const statusMap = new Map([["0", "正常"], ["1", "禁用"]]);
|
||||
export const deviceTypeDict = [
|
||||
{ label: "直连设备", value: 1, elTagType: "default" },
|
||||
{
|
||||
label: "网关子设备",
|
||||
value: 2,
|
||||
elTagType: "default",
|
||||
},
|
||||
{ label: "网关子设备", value: 3, elTagType: "default" },
|
||||
];
|
||||
|
||||
export const deviceTypeMap = new Map([[1, "直连设备"], [2, "网关子设备"], [3, "网关子设备"]]);
|
||||
export const vertificateMethodOptions = new Map([[1, "简单认证"], [2, "加密认证"], [3, "简单+加密"]]);
|
||||
export const dataTypeMap = new Map([["integer", "整数"], ["decimal", "小数"], ["bool", "布尔"], ["enum", "枚举"], ["string", "字符串"], ["array", "数组"]]);
|
||||
// export const isTopMap = new Map([[0, "是"], [1, "否"]]);
|
||||
export const isSysMap = new Map([[0, "否"], [1, "是"]]);
|
||||
export const modelType = new Map([[1, "属性"], [2, "功能"], [3, "事件"]]);
|
||||
// export const isMonitor = new Map([[0, "是"], [1, "否"]]);
|
||||
export const vertificateMethodDict = [
|
||||
{ label: "简单认证", value: 1, elTagType: "default" },
|
||||
{
|
||||
label: "加密认证",
|
||||
value: 2,
|
||||
elTagType: "default",
|
||||
},
|
||||
{ label: "简单+加密", value: 3, elTagType: "default" },
|
||||
];
|
||||
export const dataTypeDict = [
|
||||
{
|
||||
label: "整数",
|
||||
value: "integer",
|
||||
},
|
||||
{
|
||||
label: "小数",
|
||||
value: "decimal",
|
||||
},
|
||||
{
|
||||
label: "布尔",
|
||||
value: "bool",
|
||||
},
|
||||
{
|
||||
label: "枚举",
|
||||
value: "enum",
|
||||
},
|
||||
{
|
||||
label: "字符串",
|
||||
value: "string",
|
||||
},
|
||||
{
|
||||
label: "数组",
|
||||
value: "array",
|
||||
},
|
||||
];
|
||||
export const isSysDict = [
|
||||
{ label: "否", value: 0, elTagType: "default" },
|
||||
{
|
||||
label: "是",
|
||||
value: 1,
|
||||
elTagType: "default",
|
||||
},
|
||||
];
|
||||
export const modelTypeDict = [
|
||||
{
|
||||
label: "属性",
|
||||
value: 1,
|
||||
elTagType: "success",
|
||||
},
|
||||
{
|
||||
label: "功能",
|
||||
value: 2,
|
||||
elTagType: "warning",
|
||||
},
|
||||
{
|
||||
label: "事件",
|
||||
value: 3,
|
||||
elTagType: "primary",
|
||||
},
|
||||
];
|
||||
|
||||
export const productStatusMap = [{
|
||||
label: "未发布", value: 1, tag: "info"
|
||||
}, {
|
||||
label: "已发布", value: 2, tag: "success"
|
||||
}];
|
||||
export const productStatusMap = [
|
||||
{
|
||||
label: "未发布",
|
||||
value: 1,
|
||||
elTagType: "info",
|
||||
},
|
||||
{
|
||||
label: "已发布",
|
||||
value: 2,
|
||||
elTagType: "success",
|
||||
},
|
||||
];
|
||||
|
||||
export const firmwareLatestTypeOptions = [{
|
||||
label: "否", value: 0, tag: "danger"
|
||||
}, {
|
||||
label: "是", value: 1, tag: "success"
|
||||
}];
|
||||
|
||||
|
||||
export const locationWayMap = [{
|
||||
label: "自动定位", value: 1
|
||||
}, {
|
||||
label: "设备定位", value: 2
|
||||
}, {
|
||||
label: "自定义", value: 3
|
||||
}
|
||||
export const firmwareLatestTypeOptions = [
|
||||
{
|
||||
label: "否",
|
||||
value: 0,
|
||||
tag: "danger",
|
||||
elTagType: "danger",
|
||||
},
|
||||
{
|
||||
label: "是",
|
||||
value: 1,
|
||||
tag: "success",
|
||||
elTagType: "success",
|
||||
},
|
||||
];
|
||||
|
||||
export const locationWayMap = [
|
||||
{
|
||||
label: "自动定位",
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: "设备定位",
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
label: "自定义",
|
||||
value: 3,
|
||||
},
|
||||
];
|
||||
|
||||
// 1-未激活,2-禁用,3-在线,4-离线
|
||||
export const deviceStatusMap = [{
|
||||
label: "未激活", value: 1, tag: "info", elTagType: "info"
|
||||
}, {
|
||||
label: "禁用", value: 2, tag: "danger", elTagType: "danger"
|
||||
}, {
|
||||
label: "在线", value: 3, tag: "success", elTagType: "success"
|
||||
}, {
|
||||
label: "离线", value: 4, tag: "warning", elTagType: "warning"
|
||||
}];
|
||||
export const deviceStatusMap = [
|
||||
{
|
||||
label: "未激活",
|
||||
value: 1,
|
||||
tag: "info",
|
||||
elTagType: "info",
|
||||
},
|
||||
{
|
||||
label: "禁用",
|
||||
value: 2,
|
||||
tag: "danger",
|
||||
elTagType: "danger",
|
||||
},
|
||||
{
|
||||
label: "在线",
|
||||
value: 3,
|
||||
tag: "success",
|
||||
elTagType: "success",
|
||||
},
|
||||
{
|
||||
label: "离线",
|
||||
value: 4,
|
||||
tag: "warning",
|
||||
elTagType: "warning",
|
||||
},
|
||||
];
|
||||
|
||||
export const alertStatusDict = [
|
||||
{
|
||||
label: "启动",
|
||||
value: 1,
|
||||
elTagType: "success",
|
||||
},
|
||||
{
|
||||
label: "停止",
|
||||
value: 2,
|
||||
elTagType: "danger",
|
||||
},
|
||||
];
|
||||
|
||||
export const alertStatusDict = [{
|
||||
label: "启动", value: 1, elTagType: "success"
|
||||
}, {
|
||||
label: "停止", value: 2, elTagType: "danger"
|
||||
}];
|
||||
export const isOnlyReadDict = [
|
||||
{
|
||||
label: "否",
|
||||
value: 0,
|
||||
elTagType: "success",
|
||||
},
|
||||
{
|
||||
label: "是",
|
||||
value: 1,
|
||||
elTagType: "warning",
|
||||
},
|
||||
];
|
||||
|
||||
export const isShadowDict = [
|
||||
{
|
||||
label: "禁用",
|
||||
value: 0,
|
||||
elTagType: "danger",
|
||||
},
|
||||
{
|
||||
label: "启用",
|
||||
value: 1,
|
||||
elTagType: "success",
|
||||
},
|
||||
];
|
||||
export const statusOptions = [
|
||||
{
|
||||
label: "正常",
|
||||
value: "0",
|
||||
tag: "success",
|
||||
elTagType: "success",
|
||||
},
|
||||
{
|
||||
label: "禁用",
|
||||
value: "1",
|
||||
tag: "danger",
|
||||
elTagType: "danger",
|
||||
},
|
||||
];
|
||||
|
@ -1,12 +0,0 @@
|
||||
export const statusOptions = [
|
||||
{
|
||||
label: "正常",
|
||||
value: "0",
|
||||
tag: "success",
|
||||
},
|
||||
{
|
||||
label: "禁用",
|
||||
value: "1",
|
||||
tag: "danger",
|
||||
},
|
||||
];
|
@ -1,21 +0,0 @@
|
||||
<template>
|
||||
<el-tag v-if="type === 1" effect="dark" size="small" type="success">
|
||||
属性
|
||||
</el-tag>
|
||||
<el-tag v-else-if="type === 2" effect="dark" size="small" type="warning">
|
||||
功能
|
||||
</el-tag>
|
||||
<el-tag v-else-if="type === 3" effect="dark" size="small"> 事件 </el-tag>
|
||||
<el-tag v-else effect="dark" size="small" type="info"> 未知 </el-tag>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
type: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
@ -1,319 +1,387 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="告警名称" prop="alertName">
|
||||
<el-input
|
||||
v-model="queryParams.alertName"
|
||||
placeholder="请输入告警名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="告警级别" prop="alertLevel">
|
||||
<el-input
|
||||
v-model="queryParams.alertLevel"
|
||||
placeholder="请输入告警级别"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="产品ID" prop="productId">
|
||||
<el-input
|
||||
v-model="queryParams.productId"
|
||||
placeholder="请输入产品ID"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备ID" prop="deviceId">
|
||||
<el-input
|
||||
v-model="queryParams.deviceId"
|
||||
placeholder="请输入设备ID"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="租户ID" prop="tenantId">
|
||||
<el-input
|
||||
v-model="queryParams.tenantId"
|
||||
placeholder="请输入租户ID"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户ID" prop="userId">
|
||||
<el-input
|
||||
v-model="queryParams.userId"
|
||||
placeholder="请输入用户ID"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="Plus"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['device:alertLog:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="Edit"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['device:alertLog:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['device:alertLog:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="Download"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['device:alertLog:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="alertLogList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="告警ID" align="center" prop="alertLogId" />
|
||||
<el-table-column label="告警名称" align="center" prop="alertName" />
|
||||
<el-table-column label="告警级别" align="center" prop="alertLevel" />
|
||||
<el-table-column label="处理状态(1不需要处理 2=未处理 3已处理)" align="center" prop="status" />
|
||||
<el-table-column label="产品ID" align="center" prop="productId" />
|
||||
<el-table-column label="设备ID" align="center" prop="deviceId" />
|
||||
<el-table-column label="租户ID" align="center" prop="tenantId" />
|
||||
<el-table-column label="用户ID" align="center" prop="userId" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="类型" align="center" prop="type" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['device:alertLog:edit']">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['device:alertLog:remove']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
<div class="app-container">
|
||||
<el-form
|
||||
:model="queryParams"
|
||||
ref="queryRef"
|
||||
:inline="true"
|
||||
v-show="showSearch"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="告警名称" prop="alertName">
|
||||
<el-input
|
||||
v-model="queryParams.alertName"
|
||||
placeholder="请输入告警名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="告警级别" prop="alertLevel">
|
||||
<el-input
|
||||
v-model="queryParams.alertLevel"
|
||||
placeholder="请输入告警级别"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="产品ID" prop="productId">
|
||||
<el-input
|
||||
v-model="queryParams.productId"
|
||||
placeholder="请输入产品ID"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备ID" prop="deviceId">
|
||||
<el-input
|
||||
v-model="queryParams.deviceId"
|
||||
placeholder="请输入设备ID"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="租户ID" prop="tenantId">
|
||||
<el-input
|
||||
v-model="queryParams.tenantId"
|
||||
placeholder="请输入租户ID"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户ID" prop="userId">
|
||||
<el-input
|
||||
v-model="queryParams.userId"
|
||||
placeholder="请输入用户ID"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery"
|
||||
>搜索</el-button
|
||||
>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 添加或修改设备告警日志对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||
<el-form ref="alertLogRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="告警名称" prop="alertName">
|
||||
<el-input v-model="form.alertName" placeholder="请输入告警名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="告警级别" prop="alertLevel">
|
||||
<el-input v-model="form.alertLevel" placeholder="请输入告警级别" />
|
||||
</el-form-item>
|
||||
<el-form-item label="产品ID" prop="productId">
|
||||
<el-input v-model="form.productId" placeholder="请输入产品ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="设备ID" prop="deviceId">
|
||||
<el-input v-model="form.deviceId" placeholder="请输入设备ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="租户ID" prop="tenantId">
|
||||
<el-input v-model="form.tenantId" placeholder="请输入租户ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="用户ID" prop="userId">
|
||||
<el-input v-model="form.userId" placeholder="请输入用户ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="Plus"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['device:alertLog:add']"
|
||||
>新增</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="Edit"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['device:alertLog:edit']"
|
||||
>修改</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['device:alertLog:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="Download"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['device:alertLog:export']"
|
||||
>导出</el-button
|
||||
>
|
||||
</el-col>
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
@queryTable="getList"
|
||||
></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="alertLogList"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="告警ID" align="center" prop="alertLogId" />
|
||||
<el-table-column label="告警名称" align="center" prop="alertName" />
|
||||
<el-table-column label="告警级别" align="center" prop="alertLevel" />
|
||||
<el-table-column
|
||||
label="处理状态(1不需要处理 2=未处理 3已处理)"
|
||||
align="center"
|
||||
prop="status"
|
||||
/>
|
||||
<el-table-column label="产品ID" align="center" prop="productId" />
|
||||
<el-table-column label="设备ID" align="center" prop="deviceId" />
|
||||
<el-table-column label="租户ID" align="center" prop="tenantId" />
|
||||
<el-table-column label="用户ID" align="center" prop="userId" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="类型" align="center" prop="type" />
|
||||
<el-table-column
|
||||
label="操作"
|
||||
align="center"
|
||||
class-name="small-padding fixed-width"
|
||||
>
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
icon="Edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['device:alertLog:edit']"
|
||||
>修改</el-button
|
||||
>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
icon="Delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['device:alertLog:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改设备告警日志对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||
<el-form
|
||||
ref="alertLogRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-width="80px"
|
||||
>
|
||||
<el-form-item label="告警名称" prop="alertName">
|
||||
<el-input v-model="form.alertName" placeholder="请输入告警名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="告警级别" prop="alertLevel">
|
||||
<el-input v-model="form.alertLevel" placeholder="请输入告警级别" />
|
||||
</el-form-item>
|
||||
<el-form-item label="产品ID" prop="productId">
|
||||
<el-input v-model="form.productId" placeholder="请输入产品ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="设备ID" prop="deviceId">
|
||||
<el-input v-model="form.deviceId" placeholder="请输入设备ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="租户ID" prop="tenantId">
|
||||
<el-input v-model="form.tenantId" placeholder="请输入租户ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="用户ID" prop="userId">
|
||||
<el-input v-model="form.userId" placeholder="请输入用户ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input
|
||||
v-model="form.remark"
|
||||
type="textarea"
|
||||
placeholder="请输入内容"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="AlertLog">
|
||||
import { listAlertLog, getAlertLog, delAlertLog, addAlertLog, updateAlertLog } from "@/api/device/alertLog";
|
||||
import {
|
||||
listAlertLog,
|
||||
getAlertLog,
|
||||
delAlertLog,
|
||||
addAlertLog,
|
||||
updateAlertLog,
|
||||
} from "@/api/device/alertLog";
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
const alertLogList = ref([]);
|
||||
const open = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
const alertLogList = ref([]);
|
||||
const open = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
alertName: null,
|
||||
alertLevel: null,
|
||||
status: null,
|
||||
productId: null,
|
||||
deviceId: null,
|
||||
tenantId: null,
|
||||
userId: null,
|
||||
type: null,
|
||||
},
|
||||
rules: {
|
||||
alertName: [
|
||||
{ required: true, message: "告警名称不能为空", trigger: "blur" }
|
||||
],
|
||||
alertLevel: [
|
||||
{ required: true, message: "告警级别不能为空", trigger: "blur" }
|
||||
],
|
||||
status: [
|
||||
{ required: true, message: "处理状态(1不需要处理 2=未处理 3已处理)不能为空", trigger: "change" }
|
||||
],
|
||||
}
|
||||
});
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
alertName: null,
|
||||
alertLevel: null,
|
||||
status: null,
|
||||
productId: null,
|
||||
deviceId: null,
|
||||
tenantId: null,
|
||||
userId: null,
|
||||
type: null,
|
||||
},
|
||||
rules: {
|
||||
alertName: [
|
||||
{ required: true, message: "告警名称不能为空", trigger: "blur" },
|
||||
],
|
||||
alertLevel: [
|
||||
{ required: true, message: "告警级别不能为空", trigger: "blur" },
|
||||
],
|
||||
status: [
|
||||
{
|
||||
required: true,
|
||||
message: "处理状态(1不需要处理 2=未处理 3已处理)不能为空",
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询设备告警日志列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listAlertLog(queryParams.value).then(response => {
|
||||
alertLogList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
/** 查询设备告警日志列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listAlertLog(queryParams.value).then((response) => {
|
||||
alertLogList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
}
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
alertLogId: null,
|
||||
alertName: null,
|
||||
alertLevel: null,
|
||||
status: null,
|
||||
productId: null,
|
||||
deviceId: null,
|
||||
tenantId: null,
|
||||
userId: null,
|
||||
remark: null,
|
||||
type: null,
|
||||
createBy: null,
|
||||
createTime: null
|
||||
};
|
||||
proxy.resetForm("alertLogRef");
|
||||
}
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
alertLogId: null,
|
||||
alertName: null,
|
||||
alertLevel: null,
|
||||
status: null,
|
||||
productId: null,
|
||||
deviceId: null,
|
||||
tenantId: null,
|
||||
userId: null,
|
||||
remark: null,
|
||||
type: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
};
|
||||
proxy.resetForm("alertLogRef");
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
}
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.alertLogId);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map((item) => item.alertLogId);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
open.value = true;
|
||||
title.value = "添加设备告警日志";
|
||||
}
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
open.value = true;
|
||||
title.value = "添加设备告警日志";
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset();
|
||||
const _alertLogId = row.alertLogId || ids.value
|
||||
getAlertLog(_alertLogId).then(response => {
|
||||
form.value = response.data;
|
||||
open.value = true;
|
||||
title.value = "修改设备告警日志";
|
||||
});
|
||||
}
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset();
|
||||
const _alertLogId = row.alertLogId || ids.value;
|
||||
getAlertLog(_alertLogId).then((response) => {
|
||||
form.value = response.data;
|
||||
open.value = true;
|
||||
title.value = "修改设备告警日志";
|
||||
});
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["alertLogRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (form.value.alertLogId != null) {
|
||||
updateAlertLog(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
} else {
|
||||
addAlertLog(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["alertLogRef"].validate((valid) => {
|
||||
if (valid) {
|
||||
if (form.value.alertLogId != null) {
|
||||
updateAlertLog(form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
} else {
|
||||
addAlertLog(form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _alertLogIds = row.alertLogId || ids.value;
|
||||
proxy.$modal.confirm('是否确认删除设备告警日志编号为"' + _alertLogIds + '"的数据项?').then(function() {
|
||||
return delAlertLog(_alertLogIds);
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
}
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _alertLogIds = row.alertLogId || ids.value;
|
||||
proxy.$modal
|
||||
.confirm('是否确认删除设备告警日志编号为"' + _alertLogIds + '"的数据项?')
|
||||
.then(function () {
|
||||
return delAlertLog(_alertLogIds);
|
||||
})
|
||||
.then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('device/alertLog/export', {
|
||||
...queryParams.value
|
||||
}, `alertLog_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download(
|
||||
"device/alertLog/export",
|
||||
{
|
||||
...queryParams.value,
|
||||
},
|
||||
`alertLog_${new Date().getTime()}.xlsx`
|
||||
);
|
||||
}
|
||||
|
||||
getList();
|
||||
</script>
|
||||
getList();
|
||||
</script>
|
||||
|
@ -1,6 +1,12 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form v-show="showSearch" ref="queryRef" :inline="true" :model="queryParams" label-width="68px">
|
||||
<el-form
|
||||
v-show="showSearch"
|
||||
ref="queryRef"
|
||||
:inline="true"
|
||||
:model="queryParams"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="设备名称" prop="deviceName">
|
||||
<el-input
|
||||
v-model="queryParams.deviceName"
|
||||
@ -28,7 +34,11 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备状态" prop="status">
|
||||
<el-switch v-model="queryParams.status" :active-value="1" :inactive-value="0" />
|
||||
<el-switch
|
||||
v-model="queryParams.status"
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="用户ID" prop="userId">-->
|
||||
<!-- <el-input-->
|
||||
@ -135,7 +145,9 @@
|
||||
<!-- />-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item>
|
||||
<el-button icon="Search" type="primary" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Search" type="primary" @click="handleQuery"
|
||||
>搜索</el-button
|
||||
>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@ -148,7 +160,7 @@
|
||||
plain
|
||||
type="primary"
|
||||
@click="handleAdd"
|
||||
>新增
|
||||
>新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
@ -159,7 +171,7 @@
|
||||
plain
|
||||
type="success"
|
||||
@click="handleUpdate"
|
||||
>修改
|
||||
>修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
@ -170,7 +182,7 @@
|
||||
plain
|
||||
type="danger"
|
||||
@click="handleDelete"
|
||||
>删除
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
@ -180,13 +192,20 @@
|
||||
plain
|
||||
type="warning"
|
||||
@click="handleExport"
|
||||
>导出
|
||||
>导出
|
||||
</el-button>
|
||||
</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-table v-loading="loading" :data="deviceList" @selection-change="handleSelectionChange">
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="deviceList"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column align="center" type="selection" width="55" />
|
||||
<!-- <el-table-column align="center" label="设备ID" prop="deviceId" />-->
|
||||
<el-table-column align="center" label="设备名称" prop="deviceName" />
|
||||
@ -196,24 +215,28 @@
|
||||
<!-- <el-table-column align="center" label="租户" prop="tenantName" />-->
|
||||
<el-table-column align="center" label="固件版本" prop="firmwareVersion" />
|
||||
<el-table-column align="center" label="设备状态" prop="status">
|
||||
<template #default="{row}">
|
||||
<!-- <dict-tag :options="deviceStatusMap" :value="row.status" />-->
|
||||
<el-tag :type="deviceStatusMap.find(el=>el.value===row.status)?.tag" effect="dark">
|
||||
{{ deviceStatusMap.find(el => el.value === row.status)?.label }}
|
||||
</el-tag>
|
||||
<template #default="{ row }">
|
||||
<dict-tag
|
||||
:options="deviceStatusMap"
|
||||
:value="[row.status]"
|
||||
effect="dark"
|
||||
size="small"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column align="center" label="信号强度" prop="rssi" />-->
|
||||
<el-table-column align="center" label="是否启用设备影子" prop="isShadow">
|
||||
<template #default="{row}">
|
||||
<el-tag v-if="row.isShadow===0" type="danger">禁用</el-tag>
|
||||
<el-tag v-if="row.isShadow===1" type="success">启用</el-tag>
|
||||
<el-tag v-else type="info">未知</el-tag>
|
||||
<template #default="{ row }">
|
||||
<dict-tag
|
||||
:options="isShadowDict"
|
||||
:value="[row.isShadow]"
|
||||
size="small"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="定位方式" prop="locationWay">
|
||||
<template #default="{row}">
|
||||
{{ locationWayMap.find(el => el.value === row.locationWay)?.label }}
|
||||
<template #default="{ row }">
|
||||
{{ locationWayMap.find((el) => el.value === row.locationWay)?.label }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column align="center" label="物模型值" prop="thingsModelValue" />-->
|
||||
@ -221,7 +244,12 @@
|
||||
<!-- <el-table-column align="center" label="设备入网IP" prop="networkIp" />-->
|
||||
<!-- <el-table-column align="center" label="设备经度" prop="longitude" />-->
|
||||
<!-- <el-table-column align="center" label="设备纬度" prop="latitude" />-->
|
||||
<el-table-column align="center" label="激活时间" prop="activeTime" width="180">
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="激活时间"
|
||||
prop="activeTime"
|
||||
width="180"
|
||||
>
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.activeTime, "{y}-{m}-{d}") }}</span>
|
||||
</template>
|
||||
@ -229,20 +257,35 @@
|
||||
<!-- <el-table-column align="center" label="设备摘要" prop="summary" />-->
|
||||
<!-- <el-table-column align="center" label="图片地址" prop="imgUrl" />-->
|
||||
<el-table-column align="center" label="描述" prop="remark" />
|
||||
<el-table-column align="center" class-name="small-padding fixed-width" label="操作">
|
||||
<el-table-column
|
||||
align="center"
|
||||
class-name="small-padding fixed-width"
|
||||
label="操作"
|
||||
>
|
||||
<template #default="scope">
|
||||
<el-button v-hasPermi="['iot:device:edit']" icon="Edit" link type="primary" @click="handleUpdate(scope.row)">
|
||||
<el-button
|
||||
v-hasPermi="['iot:device:edit']"
|
||||
icon="Edit"
|
||||
link
|
||||
type="primary"
|
||||
@click="handleUpdate(scope.row)"
|
||||
>
|
||||
修改
|
||||
</el-button>
|
||||
<el-button v-hasPermi="['iot:device:remove']" icon="Delete" link type="primary"
|
||||
@click="handleDelete(scope.row)">删除
|
||||
<el-button
|
||||
v-hasPermi="['iot:device:remove']"
|
||||
icon="Delete"
|
||||
link
|
||||
type="primary"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
v-show="total > 0"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
v-model:page="queryParams.pageNum"
|
||||
:total="total"
|
||||
@ -251,11 +294,20 @@
|
||||
|
||||
<!-- 添加或修改设备对话框 -->
|
||||
<el-dialog v-model="open" :title="title" append-to-body width="800px">
|
||||
<el-form ref="deviceRef" :model="form" :rules="rules" label-position="left" label-width="140px">
|
||||
<el-form
|
||||
ref="deviceRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-position="left"
|
||||
label-width="140px"
|
||||
>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="设备名称" prop="deviceName">
|
||||
<el-input v-model="form.deviceName" placeholder="请输入设备名称" />
|
||||
<el-input
|
||||
v-model="form.deviceName"
|
||||
placeholder="请输入设备名称"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
@ -310,23 +362,31 @@
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="设备编号" prop="serialNumber">
|
||||
<el-input v-model="form.serialNumber" placeholder="请输入设备编号" />
|
||||
<el-input
|
||||
v-model="form.serialNumber"
|
||||
placeholder="请输入设备编号"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="固件版本" prop="firmwareVersion">
|
||||
<el-input v-model="form.firmwareVersion" placeholder="请输入固件版本" />
|
||||
<el-input
|
||||
v-model="form.firmwareVersion"
|
||||
placeholder="请输入固件版本"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="激活时间" prop="activeTime">
|
||||
<el-date-picker v-model="form.activeTime"
|
||||
clearable
|
||||
placeholder="请选择激活时间"
|
||||
type="datetime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss">
|
||||
<el-date-picker
|
||||
v-model="form.activeTime"
|
||||
clearable
|
||||
placeholder="请选择激活时间"
|
||||
type="datetime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
>
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@ -337,15 +397,21 @@
|
||||
<!-- </el-col>-->
|
||||
<el-col :span="12">
|
||||
<el-form-item label="是否启用设备影子" prop="isShadow">
|
||||
<el-switch v-model="form.isShadow" :active-value="1" :inactive-value="0" />
|
||||
<el-switch
|
||||
v-model="form.isShadow"
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="定位方式" prop="locationWay">
|
||||
<el-select v-model="form.locationWay"
|
||||
placeholder="请输入定位方式">
|
||||
<el-select
|
||||
v-model="form.locationWay"
|
||||
placeholder="请输入定位方式"
|
||||
>
|
||||
<el-option :value="1" label="ip自动定位" />
|
||||
<el-option :value="2" label="设备定位" />
|
||||
<el-option :value="3" label="自定义" />
|
||||
@ -354,7 +420,10 @@
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="设备所在地址" prop="networkAddress">
|
||||
<el-input v-model="form.networkAddress" placeholder="请输入设备所在地址" />
|
||||
<el-input
|
||||
v-model="form.networkAddress"
|
||||
placeholder="请输入设备所在地址"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -373,19 +442,24 @@
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="设备入网IP" prop="networkIp">
|
||||
<el-input v-model="form.networkIp" placeholder="请输入设备入网IP" />
|
||||
<el-input
|
||||
v-model="form.networkIp"
|
||||
placeholder="请输入设备入网IP"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
|
||||
|
||||
<el-form-item label="图片地址" prop="imgUrl">
|
||||
<!-- <el-input v-model="form.imgUrl" placeholder="请输入图片地址" />-->
|
||||
<image-upload v-model="form.imgUrl" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入内容" type="textarea" />
|
||||
<el-input
|
||||
v-model="form.remark"
|
||||
placeholder="请输入内容"
|
||||
type="textarea"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
@ -404,12 +478,19 @@
|
||||
</template>
|
||||
|
||||
<script name="Device" setup>
|
||||
import { addDevice, delDevice, getDevice, listDevice, updateDevice } from "@/api/iot/device";
|
||||
import {
|
||||
addDevice,
|
||||
delDevice,
|
||||
getDevice,
|
||||
listDevice,
|
||||
updateDevice,
|
||||
} from "@/api/iot/device";
|
||||
import ImageUpload from "@/components/ImageUpload/index.vue";
|
||||
import { listProduct } from "@/api/product/product";
|
||||
import { deviceStatusMap, locationWayMap } from "@/constant/dict";
|
||||
import { deviceStatusMap, isShadowDict, locationWayMap } from "@/constant/dict";
|
||||
import UserTreeSelect from "@/components/UserTreeSelect/index.vue";
|
||||
import { getCurrentInstance, reactive, ref, toRefs } from "vue";
|
||||
import DictTag from "@/components/DictTag/index.vue";
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
@ -447,16 +528,14 @@ const data = reactive({
|
||||
latitude: null,
|
||||
activeTime: null,
|
||||
summary: null,
|
||||
imgUrl: null
|
||||
imgUrl: null,
|
||||
},
|
||||
rules: {
|
||||
deviceName: [
|
||||
{ required: true, message: "设备名称不能为空", trigger: "blur" }
|
||||
{ required: true, message: "设备名称不能为空", trigger: "blur" },
|
||||
],
|
||||
productId: [
|
||||
{ required: true, message: "产品ID不能为空", trigger: "blur" }
|
||||
]
|
||||
}
|
||||
productId: [{ required: true, message: "产品ID不能为空", trigger: "blur" }],
|
||||
},
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
@ -464,7 +543,7 @@ const { queryParams, form, rules } = toRefs(data);
|
||||
/** 查询设备列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listDevice(queryParams.value).then(response => {
|
||||
listDevice(queryParams.value).then((response) => {
|
||||
deviceList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
@ -501,7 +580,7 @@ function reset() {
|
||||
imgUrl: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
remark: null
|
||||
remark: null,
|
||||
};
|
||||
proxy.resetForm("deviceRef");
|
||||
}
|
||||
@ -520,7 +599,7 @@ function resetQuery() {
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.deviceId);
|
||||
ids.value = selection.map((item) => item.deviceId);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
@ -536,7 +615,7 @@ function handleAdd() {
|
||||
function handleUpdate(row) {
|
||||
reset();
|
||||
const _deviceId = row.deviceId || ids.value;
|
||||
getDevice(_deviceId).then(response => {
|
||||
getDevice(_deviceId).then((response) => {
|
||||
form.value = response.data;
|
||||
open.value = true;
|
||||
title.value = "修改设备";
|
||||
@ -545,16 +624,16 @@ function handleUpdate(row) {
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["deviceRef"].validate(valid => {
|
||||
proxy.$refs["deviceRef"].validate((valid) => {
|
||||
if (valid) {
|
||||
if (form.value.deviceId != null) {
|
||||
updateDevice(form.value).then(response => {
|
||||
updateDevice(form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
} else {
|
||||
addDevice(form.value).then(response => {
|
||||
addDevice(form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
@ -567,27 +646,34 @@ function submitForm() {
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _deviceIds = row.deviceId || ids.value;
|
||||
proxy.$modal.confirm("是否确认删除设备编号为\"" + _deviceIds + "\"的数据项?").then(function() {
|
||||
return delDevice(_deviceIds);
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
});
|
||||
proxy.$modal
|
||||
.confirm('是否确认删除设备编号为"' + _deviceIds + '"的数据项?')
|
||||
.then(function () {
|
||||
return delDevice(_deviceIds);
|
||||
})
|
||||
.then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download("iot/device/export", {
|
||||
...queryParams.value
|
||||
}, `device_${new Date().getTime()}.xlsx`);
|
||||
proxy.download(
|
||||
"iot/device/export",
|
||||
{
|
||||
...queryParams.value,
|
||||
},
|
||||
`device_${new Date().getTime()}.xlsx`
|
||||
);
|
||||
}
|
||||
|
||||
function getProductOptions(keyword) {
|
||||
listProduct({
|
||||
productName: keyword,
|
||||
pageNum: 1,
|
||||
pageSize: 20
|
||||
pageSize: 20,
|
||||
}).then((resp) => {
|
||||
productOptions.value = resp.rows;
|
||||
});
|
||||
@ -599,8 +685,6 @@ const handleUserSelected = (data) => {
|
||||
userOpen.value = false;
|
||||
};
|
||||
|
||||
|
||||
getList();
|
||||
getProductOptions();
|
||||
|
||||
</script>
|
||||
</script>
|
||||
|
@ -5,7 +5,7 @@
|
||||
ref="queryRef"
|
||||
:inline="true"
|
||||
:model="queryParams"
|
||||
:size="productId?'small':''"
|
||||
:size="productId ? 'small' : ''"
|
||||
label-width="68px"
|
||||
>
|
||||
<!-- <el-form-item label="" prop="tenantId">-->
|
||||
@ -40,7 +40,6 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="!product" label="产品" prop="productId">
|
||||
|
||||
<el-select
|
||||
v-model="queryParams.productId"
|
||||
:remote-method="getProductOptions"
|
||||
@ -60,9 +59,8 @@
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button icon="Search" type="primary" @click="handleQuery"
|
||||
>搜索
|
||||
</el-button
|
||||
>
|
||||
>搜索
|
||||
</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@ -72,32 +70,32 @@
|
||||
<el-button
|
||||
v-if="productId"
|
||||
v-hasPermi="['product:alertRule:add']"
|
||||
:size="productId ? 'small' : ''"
|
||||
icon="Plus"
|
||||
plain
|
||||
size="small"
|
||||
type="primary"
|
||||
@click="handleAdd"
|
||||
>新增
|
||||
>新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
:size="productId ? 'small' : ''"
|
||||
icon="refresh"
|
||||
plain
|
||||
size="small"
|
||||
type="success"
|
||||
@click="getList"
|
||||
>刷新
|
||||
>刷新
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
:size="productId ? 'small' : ''"
|
||||
icon="refresh"
|
||||
plain
|
||||
size="small"
|
||||
type="success"
|
||||
@click="showSelect=true"
|
||||
>刷新
|
||||
@click="showSelect = true"
|
||||
>刷新
|
||||
</el-button>
|
||||
</el-col>
|
||||
<!-- <el-col :span="1.5">-->
|
||||
@ -138,11 +136,12 @@
|
||||
></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
|
||||
<!-- <el-dialog v-model="showSelect">-->
|
||||
<table-select v-model="showSelect" :request-method="listDevice" select-key="deviceId"
|
||||
@select-add="handleAddSelect" />
|
||||
<!-- </el-dialog>-->
|
||||
<table-select
|
||||
v-model="showSelect"
|
||||
:request-method="listDevice"
|
||||
select-key="deviceId"
|
||||
@select-add="handleAddSelect"
|
||||
/>
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="alertList"
|
||||
@ -152,16 +151,17 @@
|
||||
<el-table-column align="center" type="selection" width="55" />
|
||||
<el-table-column align="center" label="告警名称" prop="alertName" />
|
||||
<el-table-column align="center" label="告警级别" prop="alertLevel">
|
||||
<template #default="{row}">
|
||||
<dict-tag :options="iot_alert_level" :value="row.alertLevel"></dict-tag>
|
||||
<template #default="{ row }">
|
||||
<dict-tag
|
||||
:options="iot_alert_level"
|
||||
:value="row.alertLevel"
|
||||
></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="产品" prop="productName" />
|
||||
<el-table-column align="center" label="告警状态" prop="status">
|
||||
<template #default="{row}">
|
||||
<el-tag :type="alertStatusDict.find(el=>el.value===row.status)?.elTagType" effect="dark" size="small">
|
||||
{{ alertStatusDict.find(el => el.value === row.status)?.label }}
|
||||
</el-tag>
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="alertStatusDict" :value="[row.status]" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="备注" prop="remark" />
|
||||
@ -177,7 +177,7 @@
|
||||
link
|
||||
type="warning"
|
||||
@click="handleUpdate(row)"
|
||||
>{{ productId ? "修改" : "查看" }}
|
||||
>{{ productId ? "修改" : "查看" }}
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPermi="['product:alertRule:remove']"
|
||||
@ -185,7 +185,7 @@
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(row)"
|
||||
>删除
|
||||
>删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -263,7 +263,12 @@
|
||||
<div
|
||||
v-for="(item, index) in form.triggers"
|
||||
:key="index"
|
||||
style="margin-bottom: 15px; border: 1px solid #ddd; padding: 10px;width: 100%"
|
||||
style="
|
||||
margin-bottom: 15px;
|
||||
border: 1px solid #ddd;
|
||||
padding: 10px;
|
||||
width: 100%;
|
||||
"
|
||||
>
|
||||
<el-row>
|
||||
<el-col :span="4">
|
||||
@ -272,9 +277,11 @@
|
||||
placeholder="请选择"
|
||||
size="small"
|
||||
>
|
||||
<!-- @change="changeTriggerSource"-->
|
||||
<!-- @change="changeTriggerSource"-->
|
||||
<el-option
|
||||
v-for="subItem in triggerSource.filter(el=> form.triggers.length<=1||el.value==='1')"
|
||||
v-for="subItem in triggerSource.filter(
|
||||
(el) => form.triggers.length <= 1 || el.value === '1'
|
||||
)"
|
||||
:key="subItem.value"
|
||||
:label="subItem.label"
|
||||
:value="subItem.value"
|
||||
@ -300,7 +307,13 @@
|
||||
:offset="item.triggerType === '1' ? 17 : 1"
|
||||
:span="2"
|
||||
>
|
||||
<el-button link size="small" type="danger" @click="removeTriggerItem(index)">删除</el-button>
|
||||
<el-button
|
||||
link
|
||||
size="small"
|
||||
type="danger"
|
||||
@click="removeTriggerItem(index)"
|
||||
>删除</el-button
|
||||
>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
@ -395,7 +408,7 @@
|
||||
v-model="item.modelType"
|
||||
placeholder="请选择"
|
||||
size="small"
|
||||
@change="item.modelId=null"
|
||||
@change="item.modelId = null"
|
||||
>
|
||||
<el-option
|
||||
v-for="subItem in modelTypes"
|
||||
@ -406,15 +419,21 @@
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col v-if="['1','2','3'].includes(item.modelType)" :offset="1" :span="4">
|
||||
<el-col
|
||||
v-if="['1', '2', '3'].includes(item.modelType)"
|
||||
:offset="1"
|
||||
:span="4"
|
||||
>
|
||||
<el-select
|
||||
v-model="item.modelId"
|
||||
placeholder="请选择"
|
||||
size="small"
|
||||
@change="handleTriggerModelChange($event,index)"
|
||||
@change="handleTriggerModelChange($event, index)"
|
||||
>
|
||||
<el-option
|
||||
v-for="subItem in modelList.filter(el=>el.type===parseInt(item.modelType))"
|
||||
v-for="subItem in modelList.filter(
|
||||
(el) => el.type === parseInt(item.modelType)
|
||||
)"
|
||||
:key="subItem.modelId"
|
||||
:label="subItem.modelName"
|
||||
:value="subItem.modelId"
|
||||
@ -422,7 +441,11 @@
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col v-if="['1','2','3'].includes(item.modelType)" :offset="1" :span="5">
|
||||
<el-col
|
||||
v-if="['1', '2', '3'].includes(item.modelType)"
|
||||
:offset="1"
|
||||
:span="5"
|
||||
>
|
||||
<el-select
|
||||
v-model="item.operator"
|
||||
placeholder="请选择操作符"
|
||||
@ -446,13 +469,26 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col v-if="['1','2','3'].includes(item.modelType)" :offset="1" :span="5">
|
||||
<el-input v-model="item.modelValue" placeholder="值" size="small" />
|
||||
<el-col
|
||||
v-if="['1', '2', '3'].includes(item.modelType)"
|
||||
:offset="1"
|
||||
:span="5"
|
||||
>
|
||||
<el-input
|
||||
v-model="item.modelValue"
|
||||
placeholder="值"
|
||||
size="small"
|
||||
/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<el-button v-if="form.triggers[0].triggerType ==='1'" link size="small" type="primary"
|
||||
@click="addTriggerItem">
|
||||
<el-button
|
||||
v-if="form.triggers[0].triggerType === '1'"
|
||||
link
|
||||
size="small"
|
||||
type="primary"
|
||||
@click="addTriggerItem"
|
||||
>
|
||||
添加触发器
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
@ -468,7 +504,9 @@
|
||||
<!-- 选择物模型类型 -->
|
||||
<el-select v-model="item.modelType" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="subItem in modelTypes.filter(el=>['1','2','3'].includes(el.value))"
|
||||
v-for="subItem in modelTypes.filter((el) =>
|
||||
['1', '2', '3'].includes(el.value)
|
||||
)"
|
||||
:key="subItem.value"
|
||||
:label="subItem.label"
|
||||
:value="subItem.value"
|
||||
@ -481,10 +519,12 @@
|
||||
<el-select
|
||||
v-model="item.modelId"
|
||||
placeholder="请选择"
|
||||
@change="handleActionsModelChange($event,index)"
|
||||
@change="handleActionsModelChange($event, index)"
|
||||
>
|
||||
<el-option
|
||||
v-for="subItem in modelList.filter(el=>el.type===parseInt(item.modelType))"
|
||||
v-for="subItem in modelList.filter(
|
||||
(el) => el.type === parseInt(item.modelType)
|
||||
)"
|
||||
:key="subItem.modelId"
|
||||
:label="subItem.modelName"
|
||||
:value="subItem.modelId"
|
||||
@ -502,10 +542,7 @@
|
||||
<!-- </el-select>-->
|
||||
</el-col>
|
||||
<el-col :offset="1" :span="5">
|
||||
<el-select
|
||||
v-model="item.operator"
|
||||
placeholder="请选择操作符"
|
||||
>
|
||||
<el-select v-model="item.operator" placeholder="请选择操作符">
|
||||
<el-option key="=" label="等于(=)" value="=" />
|
||||
<el-option key="!=" label="不等于(!=)" value="!=" />
|
||||
<el-option key=">" label="大于(>)" value=">" />
|
||||
@ -527,19 +564,36 @@
|
||||
<el-col :offset="1" :span="5">
|
||||
<el-input v-model="item.modelValue" placeholder="值" />
|
||||
</el-col>
|
||||
<el-col v-if="index !== 0" :offset="1" :span="2"
|
||||
><a style="color: #f56c6c" @click="removeActionItem(index)"
|
||||
>删除</a
|
||||
></el-col
|
||||
>
|
||||
<el-col v-if="index !== 0" :offset="1" :span="2">
|
||||
<!-- <a style="color: #f56c6c" @click="removeActionItem(index)"-->
|
||||
<!-- >删除</a-->
|
||||
<!-- >-->
|
||||
<el-button
|
||||
link
|
||||
plus
|
||||
size="small"
|
||||
type="danger"
|
||||
@click="removeActionItem(index)"
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-button icon="plus" link size="small" type="primary" @click="addActionItem">添加执行动作</el-button>
|
||||
|
||||
<el-button
|
||||
icon="
|
||||
"
|
||||
link
|
||||
size="small"
|
||||
type="primary"
|
||||
@click="addActionItem"
|
||||
>添加执行动作
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button v-if="productId" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button v-if="productId" type="primary" @click="submitForm"
|
||||
>确 定</el-button
|
||||
>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
@ -591,7 +645,13 @@
|
||||
|
||||
<script name="Alert" setup>
|
||||
import Crontab from "@/components/Crontab/index.vue";
|
||||
import { addAlertRule, delAlertRule, getAlertRule, listAlertRule, updateAlertRule } from "@/api/product/alertRule";
|
||||
import {
|
||||
addAlertRule,
|
||||
delAlertRule,
|
||||
getAlertRule,
|
||||
listAlertRule,
|
||||
updateAlertRule,
|
||||
} from "@/api/product/alertRule";
|
||||
import { getCurrentInstance, reactive, ref, toRefs, watch } from "vue";
|
||||
import { useDict } from "@/utils/dict";
|
||||
import { listProduct } from "@/api/product/product";
|
||||
@ -605,112 +665,121 @@ const { proxy } = getCurrentInstance();
|
||||
const props = defineProps({
|
||||
product: {
|
||||
type: Object,
|
||||
default: null
|
||||
}, productId: {
|
||||
type: Number, default: null
|
||||
}
|
||||
default: null,
|
||||
},
|
||||
productId: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
const { product, productId } = toRefs(props);
|
||||
const showSelect = ref(false); // TODO:test,待删
|
||||
const showSelect = ref(false); // TODO:test,待删
|
||||
const handleAddSelect = (data) => {
|
||||
console.log(data);
|
||||
};
|
||||
const timerWeeks = [
|
||||
{
|
||||
value: 1,
|
||||
label: "周一"
|
||||
label: "周一",
|
||||
},
|
||||
{
|
||||
value: 2,
|
||||
label: "周二"
|
||||
label: "周二",
|
||||
},
|
||||
{
|
||||
value: 3,
|
||||
label: "周三"
|
||||
label: "周三",
|
||||
},
|
||||
{
|
||||
value: 4,
|
||||
label: "周四"
|
||||
label: "周四",
|
||||
},
|
||||
{
|
||||
value: 5,
|
||||
label: "周五"
|
||||
label: "周五",
|
||||
},
|
||||
{
|
||||
value: 6,
|
||||
label: "周六"
|
||||
label: "周六",
|
||||
},
|
||||
{
|
||||
value: 7,
|
||||
label: "周日"
|
||||
}
|
||||
label: "周日",
|
||||
},
|
||||
];
|
||||
|
||||
// 执行动作源
|
||||
const actionSource = [
|
||||
{
|
||||
value: 1,
|
||||
label: "设备"
|
||||
label: "设备",
|
||||
},
|
||||
{
|
||||
value: 3,
|
||||
label: "告警输出"
|
||||
}
|
||||
label: "告警输出",
|
||||
},
|
||||
];
|
||||
// 物模型类别
|
||||
const modelTypes = [
|
||||
{
|
||||
value: "1",
|
||||
label: "属性"
|
||||
label: "属性",
|
||||
},
|
||||
{
|
||||
value: "2",
|
||||
label: "功能"
|
||||
}, {
|
||||
label: "功能",
|
||||
},
|
||||
{
|
||||
value: "3",
|
||||
label: "事件"
|
||||
}, {
|
||||
label: "事件",
|
||||
},
|
||||
{
|
||||
value: "4",
|
||||
label: "设备上线"
|
||||
}, {
|
||||
label: "设备上线",
|
||||
},
|
||||
{
|
||||
value: "5",
|
||||
label: "设备下线"
|
||||
}
|
||||
label: "设备下线",
|
||||
},
|
||||
];
|
||||
// 触发器条件
|
||||
const triggerConditions = [
|
||||
{
|
||||
value: "2",
|
||||
label: "满足所有条件"
|
||||
label: "满足所有条件",
|
||||
},
|
||||
{
|
||||
value: "1",
|
||||
label: "满足任一条件"
|
||||
}
|
||||
label: "满足任一条件",
|
||||
},
|
||||
];
|
||||
// 告警状态
|
||||
const alertType = [
|
||||
{
|
||||
value: 1,
|
||||
label: "启动"
|
||||
label: "启动",
|
||||
},
|
||||
{
|
||||
value: 2,
|
||||
label: "停止"
|
||||
}
|
||||
label: "停止",
|
||||
},
|
||||
];
|
||||
// 周
|
||||
const timerWeekRepeats = ref([{
|
||||
value: "1",
|
||||
label: "每天"
|
||||
}, {
|
||||
value: "2",
|
||||
label: "仅此一次"
|
||||
}, {
|
||||
value: "3",
|
||||
label: "指定"
|
||||
}]);
|
||||
const timerWeekRepeats = ref([
|
||||
{
|
||||
value: "1",
|
||||
label: "每天",
|
||||
},
|
||||
{
|
||||
value: "2",
|
||||
label: "仅此一次",
|
||||
},
|
||||
{
|
||||
value: "3",
|
||||
label: "指定",
|
||||
},
|
||||
]);
|
||||
const productOptions = ref([]);
|
||||
const deviceOptions = ref([]);
|
||||
const alertList = ref([]);
|
||||
@ -732,12 +801,12 @@ const modelList = ref([]);
|
||||
const triggerSource = ref([
|
||||
{
|
||||
value: "1",
|
||||
label: "设备触发"
|
||||
label: "设备触发",
|
||||
},
|
||||
{
|
||||
value: "2",
|
||||
label: "定时触发"
|
||||
}
|
||||
label: "定时触发",
|
||||
},
|
||||
]);
|
||||
|
||||
const { iot_alert_level, sys_job_status } = useDict(
|
||||
@ -748,7 +817,7 @@ const data = reactive({
|
||||
form: {
|
||||
conditions: "all", // 触发器条件
|
||||
triggers: [],
|
||||
actions: []
|
||||
actions: [],
|
||||
},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
@ -759,37 +828,38 @@ const data = reactive({
|
||||
productId: null,
|
||||
triggers: null,
|
||||
actions: null,
|
||||
status: null
|
||||
status: null,
|
||||
},
|
||||
rules: {
|
||||
alertName: [
|
||||
{ required: true, message: "告警名称不能为空", trigger: "blur" }
|
||||
{ required: true, message: "告警名称不能为空", trigger: "blur" },
|
||||
],
|
||||
alertLevel: [
|
||||
{ required: true, message: "告警级别不能为空", trigger: "change" }
|
||||
{ required: true, message: "告警级别不能为空", trigger: "change" },
|
||||
],
|
||||
productId: [{ required: true, message: "产品不能为空", trigger: "change" }],
|
||||
triggers: [{ required: true, message: "触发器不能为空", trigger: "blur" }],
|
||||
actions: [{ required: true, message: "执行动作不能为空", trigger: "blur" }]
|
||||
actions: [{ required: true, message: "执行动作不能为空", trigger: "blur" }],
|
||||
},
|
||||
// 产品
|
||||
productInfo: {},
|
||||
thingsModel: {}
|
||||
thingsModel: {},
|
||||
});
|
||||
|
||||
const { queryParams, form, rules, productInfo } = toRefs(data);
|
||||
|
||||
watch(product, (val) => {
|
||||
productInfo.value = val;
|
||||
if (productInfo.value && productInfo.value.productId !== 0) {
|
||||
queryParams.value.productId = productInfo.value.productId;
|
||||
getList();
|
||||
// TODO:获取缓存的Json物模型
|
||||
// getModel(val.productId).then(response => {
|
||||
// thingsModel.value = JSON.parse(response.data);
|
||||
// });
|
||||
}
|
||||
});
|
||||
// watch(product, (val) => {
|
||||
// productInfo.value = val;
|
||||
// if (productInfo.value && productInfo.value.productId !== 0) {
|
||||
// queryParams.value.productId = productInfo.value.productId;
|
||||
// getList();
|
||||
// console.log(queryParams.value);
|
||||
// // TODO:获取缓存的Json物模型
|
||||
// // getModel(val.productId).then(response => {
|
||||
// // thingsModel.value = JSON.parse(response.data);
|
||||
// // });
|
||||
// }
|
||||
// });
|
||||
|
||||
/** 查询设备告警列表 */
|
||||
function getList() {
|
||||
@ -828,14 +898,14 @@ function reset() {
|
||||
modelValue: null,
|
||||
triggerType: "1", //1=设备,2=定时,3=告警输出
|
||||
modelType: "1", // 1=属性,2=功能
|
||||
cronExpression: null
|
||||
cronExpression: null,
|
||||
// jobId: 0,
|
||||
// deviceId: 0,
|
||||
// deviceName: "请选择一个设备",
|
||||
// id: "",
|
||||
// name: "",
|
||||
// isAdvance: 1
|
||||
}
|
||||
},
|
||||
],
|
||||
actions: [
|
||||
{
|
||||
@ -844,14 +914,14 @@ function reset() {
|
||||
modelValue: null,
|
||||
modelKey: null,
|
||||
operator: null,
|
||||
modelType: "1" // 1=属性,2=功能
|
||||
modelType: "1", // 1=属性,2=功能
|
||||
// id: "",
|
||||
// name: "",
|
||||
// deviceId: 0,
|
||||
// deviceName: "请选择一个设备",
|
||||
// triggerType: "1", //1=设备,2=定时,3=告警输出
|
||||
}
|
||||
]
|
||||
},
|
||||
],
|
||||
};
|
||||
proxy.resetForm("alertRef");
|
||||
}
|
||||
@ -911,7 +981,7 @@ function submitForm() {
|
||||
if (productId.value) {
|
||||
form.value.productId = productId.value;
|
||||
}
|
||||
form.value.triggers.forEach(el => {
|
||||
form.value.triggers.forEach((el) => {
|
||||
el.conditions = form.value.conditions;
|
||||
});
|
||||
if (form.value.alertId != null) {
|
||||
@ -935,16 +1005,15 @@ function submitForm() {
|
||||
function handleDelete(row) {
|
||||
const _alertIds = row.alertId || ids.value;
|
||||
proxy.$modal
|
||||
.confirm("是否确认删除设备告警编号为\"" + _alertIds + "\"的数据项?")
|
||||
.then(function() {
|
||||
.confirm('是否确认删除设备告警编号为"' + _alertIds + '"的数据项?')
|
||||
.then(function () {
|
||||
return delAlertRule(_alertIds);
|
||||
})
|
||||
.then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
@ -952,7 +1021,7 @@ function handleExport() {
|
||||
proxy.download(
|
||||
"device/alert/export",
|
||||
{
|
||||
...queryParams.value
|
||||
...queryParams.value,
|
||||
},
|
||||
`alert_${new Date().getTime()}.xlsx`
|
||||
);
|
||||
@ -966,7 +1035,7 @@ const addActionItem = () => {
|
||||
modelValue: "",
|
||||
modelKey: "",
|
||||
operator: "",
|
||||
modelType: "1" // 1=属性,2=功能
|
||||
modelType: "1", // 1=属性,2=功能
|
||||
// id: "",
|
||||
// name: "",
|
||||
// value: ""
|
||||
@ -993,38 +1062,37 @@ const setTriggerSource = () => {
|
||||
triggerSource.value = [
|
||||
{
|
||||
value: "1",
|
||||
label: "设备触发"
|
||||
}
|
||||
label: "设备触发",
|
||||
},
|
||||
];
|
||||
} else {
|
||||
//定时
|
||||
triggerSource.value = [
|
||||
{
|
||||
value: "1",
|
||||
label: "设备触发"
|
||||
label: "设备触发",
|
||||
},
|
||||
{
|
||||
value: "2",
|
||||
label: "定时触发"
|
||||
}
|
||||
label: "定时触发",
|
||||
},
|
||||
];
|
||||
}
|
||||
/**/
|
||||
|
||||
};
|
||||
/** 添加触发器 */
|
||||
const addTriggerItem = () => {
|
||||
setTriggerSource();
|
||||
// setTriggerSource();
|
||||
form.value.triggers.push({
|
||||
productId: productId.value,
|
||||
triggerType: "1", //1=设备,2=定时,3=告警输出
|
||||
triggerType: "1", // 1=设备,2=定时,3=告警输出
|
||||
modelType: "1", // 1=属性,2=功能
|
||||
cronExpression: null,
|
||||
modelKey: null,
|
||||
modelValue: null,
|
||||
conditions: "2",
|
||||
operator: null,
|
||||
modelId: null
|
||||
modelId: null,
|
||||
// value: "",
|
||||
// id: "",
|
||||
// name: "",
|
||||
@ -1037,7 +1105,7 @@ const addTriggerItem = () => {
|
||||
/** 删除触发器 */
|
||||
const removeTriggerItem = (index) => {
|
||||
form.value.triggers.splice(index, 1);
|
||||
setTriggerSource();
|
||||
// setTriggerSource();
|
||||
};
|
||||
/** cron表达式按钮操作 */
|
||||
const handleShowCron = (item, index) => {
|
||||
@ -1096,7 +1164,7 @@ function getProductOptions(keyword) {
|
||||
listProduct({
|
||||
productName: keyword,
|
||||
pageNum: 1,
|
||||
pageSize: 20
|
||||
pageSize: 20,
|
||||
}).then((resp) => {
|
||||
productOptions.value = resp.rows;
|
||||
});
|
||||
@ -1106,36 +1174,47 @@ function getDeviceOptions(keyword) {
|
||||
listDevice({
|
||||
deviceName: keyword,
|
||||
pageNum: 1,
|
||||
pageSize: 20
|
||||
}).then(resp => {
|
||||
pageSize: 20,
|
||||
}).then((resp) => {
|
||||
deviceOptions.value = resp.rows;
|
||||
});
|
||||
}
|
||||
|
||||
const getThingsModelOptions = (productId) => {
|
||||
listModel({
|
||||
productId
|
||||
}).then(resp => {
|
||||
productId,
|
||||
}).then((resp) => {
|
||||
modelList.value = resp.rows;
|
||||
console.log(modelList.value);
|
||||
});
|
||||
};
|
||||
|
||||
const handleModelTypeChange = () => {
|
||||
// form.value.
|
||||
};
|
||||
const handleModelTypeChange = () => {};
|
||||
const handleTriggerModelChange = (data, index) => {
|
||||
form.value.triggers[index].modelKey = modelList.value.find(el => el.modelId === data).identifier;
|
||||
form.value.triggers[index].modelKey = modelList.value.find(
|
||||
(el) => el.modelId === data
|
||||
).identifier;
|
||||
};
|
||||
const handleActionsModelChange = (data, index) => {
|
||||
form.value.actions[index].modelKey = modelList.value.find(el => el.modelId === data).identifier;
|
||||
form.value.actions[index].modelKey = modelList.value.find(
|
||||
(el) => el.modelId === data
|
||||
).identifier;
|
||||
};
|
||||
getList();
|
||||
|
||||
watch(
|
||||
productId,
|
||||
(val) => {
|
||||
queryParams.value.productId = val;
|
||||
getList();
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
}
|
||||
);
|
||||
if (!productId.value) {
|
||||
getProductOptions();
|
||||
}
|
||||
if (productId.value) {
|
||||
getThingsModelOptions(productId.value);
|
||||
}
|
||||
getDeviceOptions();
|
||||
</script>
|
||||
|
@ -172,20 +172,10 @@
|
||||
prop="latestVersionFlag"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-tag
|
||||
:type="
|
||||
firmwareLatestTypeOptions.find(
|
||||
(el) => el.value === row.latestVersionFlag
|
||||
)?.tag
|
||||
"
|
||||
size="small"
|
||||
>
|
||||
{{
|
||||
firmwareLatestTypeOptions.find(
|
||||
(el) => el.value === row.latestVersionFlag
|
||||
)?.label ?? "未知"
|
||||
}}
|
||||
</el-tag>
|
||||
<dict-tag
|
||||
:options="firmwareLatestTypeOptions"
|
||||
:value="[row.latestVersionFlag]"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="固件版本" prop="version" />
|
||||
@ -318,6 +308,7 @@ import { listProduct } from "@/api/product/product";
|
||||
import { listTenant } from "@/api/system/tenant";
|
||||
import { firmwareLatestTypeOptions } from "@/constant/dict";
|
||||
import { getCurrentInstance, reactive, ref, toRefs } from "vue";
|
||||
import DictTag from "@/components/DictTag/index.vue";
|
||||
|
||||
const props = defineProps(["productId"]);
|
||||
const { productId } = toRefs(props);
|
||||
|
@ -85,7 +85,7 @@
|
||||
v-if="form.status !== 2"
|
||||
type="primary"
|
||||
@click="submitForm"
|
||||
>提交
|
||||
>提交
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</div>
|
||||
@ -215,7 +215,7 @@
|
||||
<!-- </el-col>-->
|
||||
</el-form>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :disabled="!form.productId" label="产品模型">
|
||||
<el-tab-pane :disabled="!form.productId" label="产品模型" lazy>
|
||||
<model
|
||||
v-if="form.productId"
|
||||
ref="modelRef"
|
||||
@ -225,14 +225,26 @@
|
||||
@model-updated="getData"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :disabled="!form.productId" label="固件管理">
|
||||
<el-tab-pane :disabled="!form.productId" label="固件管理" lazy>
|
||||
<firmware v-if="form.productId" :product-id="form.productId" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :disabled="!form.productId" label="设备授权"></el-tab-pane>
|
||||
<el-tab-pane :disabled="!form.productId" label="告警配置">
|
||||
<alert v-if="form.productId" :product="form" :product-id="form.productId" />
|
||||
<el-tab-pane
|
||||
:disabled="!form.productId"
|
||||
label="设备授权"
|
||||
lazy
|
||||
></el-tab-pane>
|
||||
<el-tab-pane :disabled="!form.productId" label="告警配置" lazy>
|
||||
<alert
|
||||
v-if="form.productId"
|
||||
:product="form"
|
||||
:product-id="form.productId"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :disabled="!form.productId" label="控制界面"></el-tab-pane>
|
||||
<el-tab-pane
|
||||
:disabled="!form.productId"
|
||||
label="控制界面"
|
||||
lazy
|
||||
></el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</template>
|
||||
@ -242,7 +254,12 @@ import Firmware from "@/views/product/firmware/index.vue";
|
||||
import { onMounted, reactive, ref, toRefs } from "vue";
|
||||
import Model from "@/views/product/product/panes/model.vue";
|
||||
import { useRoute } from "vue-router";
|
||||
import { addProduct, checkProductSn, getProduct, updateProduct } from "@/api/product/product";
|
||||
import {
|
||||
addProduct,
|
||||
checkProductSn,
|
||||
getProduct,
|
||||
updateProduct,
|
||||
} from "@/api/product/product";
|
||||
import { listCategory } from "@/api/product/category";
|
||||
import { listTenant } from "@/api/system/tenant";
|
||||
import ImageUpload from "@/components/ImageUpload/index.vue";
|
||||
@ -281,19 +298,19 @@ const data = reactive({
|
||||
form: {},
|
||||
rules: {
|
||||
productName: [
|
||||
{ required: true, message: "产品名称不能为空", trigger: "blur" }
|
||||
{ required: true, message: "产品名称不能为空", trigger: "blur" },
|
||||
],
|
||||
categoryId: [
|
||||
{ required: true, message: "产品分类ID不能为空", trigger: "blur" }
|
||||
{ required: true, message: "产品分类ID不能为空", trigger: "blur" },
|
||||
],
|
||||
tenantId: [{ required: true, message: "租户ID不能为空", trigger: "blur" }],
|
||||
productSn: [
|
||||
{
|
||||
validator: checkProductSnUnique,
|
||||
trigger: "change"
|
||||
}
|
||||
]
|
||||
}
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
const { form, rules } = toRefs(data);
|
||||
@ -323,7 +340,7 @@ function reset() {
|
||||
imgUrl: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
remark: null
|
||||
remark: null,
|
||||
};
|
||||
// proxy.resetForm("productRef");
|
||||
if (productRef.value) {
|
||||
@ -357,7 +374,7 @@ const getTenantList = async (keyword) => {
|
||||
const response = await listTenant({
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
tenantName: keyword
|
||||
tenantName: keyword,
|
||||
});
|
||||
tenantOptions.value = response.rows;
|
||||
};
|
||||
|
@ -28,13 +28,13 @@
|
||||
<el-tree-select
|
||||
v-model="queryParams.categoryId"
|
||||
:data="categoryOptions"
|
||||
clearable
|
||||
:props="{
|
||||
value: 'categoryId',
|
||||
label: 'name',
|
||||
children: 'children',
|
||||
}"
|
||||
check-strictly
|
||||
clearable
|
||||
placeholder="请选择产品分类"
|
||||
value-key="categoryId"
|
||||
/>
|
||||
@ -171,28 +171,21 @@
|
||||
<el-table-column align="center" label="产品秘钥" prop="mqttSecret" />
|
||||
<el-table-column align="center" label="状态" prop="status">
|
||||
<template #default="{ row }">
|
||||
<el-tag
|
||||
:type="
|
||||
productStatusMap.find((el) => el.value === row.status)?.tag ??
|
||||
'info'
|
||||
"
|
||||
>
|
||||
{{
|
||||
productStatusMap.find((el) => el.value === row.status)?.label ??
|
||||
"未知"
|
||||
}}
|
||||
</el-tag>
|
||||
<dict-tag :options="productStatusMap" :value="[row.status]" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column align="center" label="物模型JSON" prop="thingsModelsJson" />-->
|
||||
<el-table-column align="center" label="设备类型" prop="deviceType">
|
||||
<template #default="{ row }">
|
||||
{{ deviceTypeMap.get(row.deviceType) ?? "未知" }}
|
||||
<dict-tag :options="deviceTypeDict" :value="[row.deviceType]" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="认证方式" prop="vertificateMethod">
|
||||
<template #default="{ row }">
|
||||
{{ vertificateMethodOptions.get(row.vertificateMethod) ?? "未知" }}
|
||||
<!-- {{ vertificateMethodOptions.get(row.vertificateMethod) ?? "未知" }}-->
|
||||
<dict-tag
|
||||
:options="vertificateMethodDict"
|
||||
:value="[row.vertificateMethod]"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="产品图片" prop="imgUrl">
|
||||
@ -298,13 +291,14 @@ import {
|
||||
} from "@/api/product/product";
|
||||
import { useRouter } from "vue-router";
|
||||
import {
|
||||
deviceTypeMap,
|
||||
deviceTypeDict,
|
||||
productStatusMap,
|
||||
vertificateMethodOptions,
|
||||
} from "../../../constant/dict";
|
||||
vertificateMethodDict,
|
||||
} from "@/constant/dict";
|
||||
import { listTenant } from "@/api/system/tenant";
|
||||
import { ref } from "vue";
|
||||
import { listCategory } from "@/api/product/category";
|
||||
import DictTag from "@/components/DictTag/index.vue";
|
||||
|
||||
const router = useRouter();
|
||||
const baseUrl = import.meta.env.VITE_APP_BASE_API;
|
||||
|
@ -1,939 +0,0 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form
|
||||
v-show="showSearch"
|
||||
ref="queryRef"
|
||||
:inline="true"
|
||||
:model="queryParams"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="" prop="tenantId">
|
||||
<el-input
|
||||
v-model="queryParams.tenantId"
|
||||
clearable
|
||||
placeholder="请输入"
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="告警名称" prop="alertName">
|
||||
<el-input
|
||||
v-model="queryParams.alertName"
|
||||
clearable
|
||||
placeholder="请输入告警名称"
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="告警级别" prop="alertLevel">
|
||||
<el-input
|
||||
v-model="queryParams.alertLevel"
|
||||
clearable
|
||||
placeholder="请输入告警级别"
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="产品ID" prop="productId">
|
||||
<el-input
|
||||
v-model="queryParams.productId"
|
||||
clearable
|
||||
placeholder="请输入产品ID"
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button icon="Search" type="primary" @click="handleQuery"
|
||||
>搜索
|
||||
</el-button
|
||||
>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<!-- TODO: v-hasPermi="['device:alert:add']"-->
|
||||
<el-button
|
||||
icon="Plus"
|
||||
plain
|
||||
size="small"
|
||||
type="primary"
|
||||
@click="handleAdd"
|
||||
>新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
icon="refresh"
|
||||
plain
|
||||
size="small"
|
||||
type="success"
|
||||
@click="getList"
|
||||
>刷新
|
||||
</el-button>
|
||||
</el-col>
|
||||
<!-- <el-col :span="1.5">-->
|
||||
<!-- <el-button-->
|
||||
<!-- v-hasPermi="['device:alert:edit']"-->
|
||||
<!-- :disabled="single"-->
|
||||
<!-- icon="Edit"-->
|
||||
<!-- plain-->
|
||||
<!-- type="success"-->
|
||||
<!-- @click="handleUpdate"-->
|
||||
<!-- >修改-->
|
||||
<!-- </el-button>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :span="1.5">-->
|
||||
<!-- <el-button-->
|
||||
<!-- v-hasPermi="['device:alert:remove']"-->
|
||||
<!-- :disabled="multiple"-->
|
||||
<!-- icon="Delete"-->
|
||||
<!-- plain-->
|
||||
<!-- type="danger"-->
|
||||
<!-- @click="handleDelete"-->
|
||||
<!-- >删除-->
|
||||
<!-- </el-button>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :span="1.5">-->
|
||||
<!-- <el-button-->
|
||||
<!-- v-hasPermi="['device:alert:export']"-->
|
||||
<!-- icon="Download"-->
|
||||
<!-- plain-->
|
||||
<!-- type="warning"-->
|
||||
<!-- @click="handleExport"-->
|
||||
<!-- >导出-->
|
||||
<!-- </el-button>-->
|
||||
<!-- </el-col>-->
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
@queryTable="getList"
|
||||
></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="alertList"
|
||||
border
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column align="center" type="selection" width="55" />
|
||||
<!-- <el-table-column align="center" label="告警ID" prop="alertId" />-->
|
||||
<!-- <el-table-column align="center" label="" prop="tenantId" />-->
|
||||
<el-table-column align="center" label="告警名称" prop="alertName" />
|
||||
<el-table-column align="center" label="告警级别" prop="alertLevel" />
|
||||
<el-table-column align="center" label="产品" prop="productId" />
|
||||
<el-table-column align="center" label="触发器" prop="triggers" />
|
||||
<el-table-column align="center" label="执行动作" prop="actions" />
|
||||
<el-table-column align="center" label="告警状态" prop="status" />
|
||||
<el-table-column align="center" label="备注" prop="remark" />
|
||||
<el-table-column
|
||||
align="center"
|
||||
class-name="small-padding fixed-width"
|
||||
label="操作"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
v-hasPermi="['device:alert:edit']"
|
||||
icon="Edit"
|
||||
link
|
||||
type="primary"
|
||||
@click="handleUpdate(row)"
|
||||
>修改
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPermi="['device:alert:remove']"
|
||||
icon="Delete"
|
||||
link
|
||||
type="primary"
|
||||
@click="handleDelete(row)"
|
||||
>删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
v-model:page="queryParams.pageNum"
|
||||
:total="total"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改设备告警对话框 -->
|
||||
<el-dialog v-model="open" :title="title" append-to-body width="800px">
|
||||
<div
|
||||
class="el-divider el-divider--horizontal"
|
||||
style="margin-top: -25px"
|
||||
></div>
|
||||
<el-form ref="alertRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-row :gutter="50">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="告警名称" prop="alertName">
|
||||
<el-input v-model="form.alertName" placeholder="请输入告警名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="告警级别" prop="alertLevel">
|
||||
<el-select
|
||||
v-model="form.alertLevel"
|
||||
placeholder="请选择告警级别"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in iot_alert_level"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="parseInt(dict.value)"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="告警状态">
|
||||
<el-switch
|
||||
v-model="form.status"
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input
|
||||
v-model="form.remark"
|
||||
placeholder="请输入内容"
|
||||
rows="6"
|
||||
type="textarea"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-divider></el-divider>
|
||||
<el-form-item label="触发器" prop="triggers">
|
||||
<el-select
|
||||
v-model="form.condition"
|
||||
placeholder="请选择"
|
||||
style="margin-bottom: 10px; width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in triggerConditions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
<div
|
||||
v-for="(item, index) in form.triggers"
|
||||
:key="index"
|
||||
style="margin-bottom: 15px; border: 1px solid #ddd; padding: 10px"
|
||||
>
|
||||
<el-row>
|
||||
<el-col :span="4">
|
||||
<el-select
|
||||
v-model="item.source"
|
||||
placeholder="请选择"
|
||||
size="small"
|
||||
@change="changeTriggerSource"
|
||||
>
|
||||
<el-option
|
||||
v-for="subItem in triggerSource"
|
||||
:key="subItem.value"
|
||||
:label="subItem.label"
|
||||
:value="subItem.value"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col v-if="item.source === 2" :offset="1" :span="16">
|
||||
<el-time-picker
|
||||
v-model="timerTimeValue"
|
||||
:disabled="item.isAdvance === 1"
|
||||
placeholder="选择执行时间"
|
||||
size="small"
|
||||
value-format="HH:mm"
|
||||
@change="timeChange"
|
||||
></el-time-picker>
|
||||
</el-col>
|
||||
<el-col
|
||||
v-if="index !== 0"
|
||||
:offset="item.source === 1 ? 17 : 1"
|
||||
:span="2"
|
||||
><a style="color: #f56c6c" @click="removeTriggerItem(index)"
|
||||
>删除</a
|
||||
>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!--定时-->
|
||||
<el-row v-if="item.source === 2">
|
||||
<el-col :span="24">
|
||||
<el-row style="margin-bottom: 5px">
|
||||
<el-col :span="4">
|
||||
<el-select
|
||||
v-model="timerWeekRepeatValue"
|
||||
:disabled="item.isAdvance === 1"
|
||||
placeholder="请选择"
|
||||
size="small"
|
||||
@change="repeatChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in timerWeekRepeats"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col
|
||||
v-if="timerWeekRepeatValue === 3"
|
||||
:offset="1"
|
||||
:span="15"
|
||||
>
|
||||
<el-select
|
||||
v-model="timerWeekValue"
|
||||
:disabled="item.isAdvance === 1"
|
||||
multiple
|
||||
placeholder="请选择"
|
||||
size="small"
|
||||
style="width: 485px"
|
||||
@change="weekChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in timerWeeks"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-row>
|
||||
<el-col :span="18">
|
||||
<el-input
|
||||
v-model="item.cronExpression"
|
||||
:disabled="item.isAdvance === 0"
|
||||
placeholder="cron执行表达式"
|
||||
size="small"
|
||||
>
|
||||
<template slot="append">
|
||||
<el-button
|
||||
:disabled="item.isAdvance === 0"
|
||||
type="primary"
|
||||
@click="handleShowCron(item, index)"
|
||||
>
|
||||
生成表达式
|
||||
<i class="el-icon-time el-icon--right"></i>
|
||||
</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-col>
|
||||
<el-col :offset="1" :span="4">
|
||||
<el-checkbox
|
||||
v-model="item.isAdvance"
|
||||
:false-label="0"
|
||||
:true-label="1"
|
||||
@change="customerCronChange"
|
||||
>
|
||||
自定义表达式
|
||||
</el-checkbox>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!--设备-->
|
||||
<el-row>
|
||||
<el-col :span="4">
|
||||
<el-select
|
||||
v-model="item.modelType"
|
||||
placeholder="请选择"
|
||||
size="small"
|
||||
>
|
||||
<el-option
|
||||
v-for="subItem in modelTypes"
|
||||
:key="subItem.value"
|
||||
:label="subItem.label"
|
||||
:value="subItem.value"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :offset="1" :span="4">
|
||||
<el-select
|
||||
v-model="item.modelType"
|
||||
placeholder="请选择"
|
||||
size="small"
|
||||
>
|
||||
<el-option
|
||||
v-for="subItem in modelTypes"
|
||||
:key="subItem.value"
|
||||
:label="subItem.label"
|
||||
:value="subItem.value"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :offset="1" :span="5">
|
||||
<el-select
|
||||
v-model="item.operator"
|
||||
placeholder="请选择操作符"
|
||||
size="small"
|
||||
>
|
||||
<el-option key="=" label="等于(=)" value="=" />
|
||||
<el-option key="!=" label="不等于(!=)" value="!=" />
|
||||
<el-option key=">" label="大于(>)" value=">" />
|
||||
<el-option key="<" label="小于(<)" value="<" />
|
||||
<el-option key=">=" label="大于等于(>=)" value=">=" />
|
||||
<el-option key="<=" label="小于等于(<=)" value="<=" />
|
||||
<el-option
|
||||
key="contain"
|
||||
label="包含(contain)"
|
||||
value="contain"
|
||||
/>
|
||||
<el-option
|
||||
key="notcontain"
|
||||
label="不包含(not contain)"
|
||||
value="notcontain"
|
||||
/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :offset="1" :span="5">
|
||||
<el-input v-model="item.value" placeholder="值" size="small" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div>
|
||||
+ <a style="color: #409eff" @click="addTriggerItem()">添加触发器</a>
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
<el-divider></el-divider>
|
||||
<el-form-item label="执行动作">
|
||||
<el-row
|
||||
v-for="(item, index) in form.actions"
|
||||
:key="index"
|
||||
style="margin-bottom: 10px"
|
||||
>
|
||||
<el-col :span="4">
|
||||
<el-select v-model="item.modelType" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="subItem in modelTypes"
|
||||
:key="subItem.value"
|
||||
:label="subItem.label"
|
||||
:value="subItem.value"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :offset="1" :span="4">
|
||||
<el-select v-model="item.modelType" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="subItem in modelTypes"
|
||||
:key="subItem.value"
|
||||
:label="subItem.label"
|
||||
:value="subItem.value"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :offset="1" :span="11">
|
||||
<el-input v-model="item.value" placeholder="值" />
|
||||
</el-col>
|
||||
<el-col v-if="index !== 0" :offset="1" :span="2"
|
||||
><a style="color: #f56c6c" @click="removeActionItem(index)"
|
||||
>删除</a
|
||||
></el-col
|
||||
>
|
||||
</el-row>
|
||||
<div>
|
||||
+
|
||||
<a style="color: #409eff" @click="addActionItem()">添加执行动作</a>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog
|
||||
v-model="openCron"
|
||||
append-to-body
|
||||
class="scrollbar"
|
||||
destroy-on-close
|
||||
title="Cron表达式生成器"
|
||||
>
|
||||
<crontab
|
||||
:expression="expression"
|
||||
style="padding-bottom: 80px"
|
||||
@fill="crontabFill"
|
||||
@hide="openCron = false"
|
||||
></crontab>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 添加或修改设备告警对话框 -->
|
||||
<!-- <el-dialog v-model="open" :title="title" append-to-body width="500px">-->
|
||||
<!-- <el-form ref="alertRef" :model="form" :rules="rules" label-width="80px">-->
|
||||
<!-- <el-form-item label="" prop="tenantId">-->
|
||||
<!-- <el-input v-model="form.tenantId" placeholder="请输入" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="告警名称" prop="alertName">-->
|
||||
<!-- <el-input v-model="form.alertName" placeholder="请输入告警名称" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="告警级别" prop="alertLevel">-->
|
||||
<!-- <el-input v-model="form.alertLevel" placeholder="请输入告警级别" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="产品ID" prop="productId">-->
|
||||
<!-- <el-input v-model="form.productId" placeholder="请输入产品ID" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="备注" prop="remark">-->
|
||||
<!-- <el-input v-model="form.remark" placeholder="请输入内容" type="textarea" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-form>-->
|
||||
<!-- <template #footer>-->
|
||||
<!-- <div class="dialog-footer">-->
|
||||
<!-- <el-button type="primary" @click="submitForm">确 定</el-button>-->
|
||||
<!-- <el-button @click="cancel">取 消</el-button>-->
|
||||
<!-- </div>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-dialog>-->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script name="Alert" setup>
|
||||
import Crontab from "@/components/Crontab/index.vue";
|
||||
import { addAlertRule, delAlertRule, getAlertRule, listAlertRule, updateAlertRule } from "@/api/product/alertRule";
|
||||
import { getCurrentInstance, reactive, ref, toRefs, watch } from "vue";
|
||||
import { useDict } from "@/utils/dict";
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const props = defineProps({
|
||||
product: {
|
||||
type: Object,
|
||||
default: null
|
||||
}
|
||||
});
|
||||
|
||||
const { product } = toRefs(props);
|
||||
|
||||
const timerWeeks = [
|
||||
{
|
||||
value: 1,
|
||||
label: "周一"
|
||||
},
|
||||
{
|
||||
value: 2,
|
||||
label: "周二"
|
||||
},
|
||||
{
|
||||
value: 3,
|
||||
label: "周三"
|
||||
},
|
||||
{
|
||||
value: 4,
|
||||
label: "周四"
|
||||
},
|
||||
{
|
||||
value: 5,
|
||||
label: "周五"
|
||||
},
|
||||
{
|
||||
value: 6,
|
||||
label: "周六"
|
||||
},
|
||||
{
|
||||
value: 7,
|
||||
label: "周日"
|
||||
}
|
||||
];
|
||||
|
||||
// 执行动作源
|
||||
const actionSource = [
|
||||
{
|
||||
value: 1,
|
||||
label: "设备"
|
||||
},
|
||||
{
|
||||
value: 3,
|
||||
label: "告警输出"
|
||||
}
|
||||
];
|
||||
// 物模型类别
|
||||
const modelTypes = [
|
||||
{
|
||||
value: 1,
|
||||
label: "属性"
|
||||
},
|
||||
{
|
||||
value: 2,
|
||||
label: "功能"
|
||||
}
|
||||
];
|
||||
// 触发器条件
|
||||
const triggerConditions = [
|
||||
{
|
||||
value: "all",
|
||||
label: "满足所有条件"
|
||||
},
|
||||
{
|
||||
value: "any",
|
||||
label: "满足任一条件"
|
||||
}
|
||||
];
|
||||
// 告警状态
|
||||
const alertType = [
|
||||
{
|
||||
value: 1,
|
||||
label: "启动"
|
||||
},
|
||||
{
|
||||
value: 2,
|
||||
label: "停止"
|
||||
}
|
||||
];
|
||||
|
||||
const alertList = ref([]);
|
||||
const open = ref(false);
|
||||
const openCron = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
const expression = ref(""); // 传入的表达式
|
||||
const triggerIndex = ref(0); // 触发器的索引,用于接收传入的表达式
|
||||
const timerWeekRepeatValue = ref("1");
|
||||
const timerWeekValue = ref([1, 2, 3, 4, 5, 6, 7]);
|
||||
const triggerSource = ref([
|
||||
{
|
||||
value: 1,
|
||||
label: "设备"
|
||||
},
|
||||
{
|
||||
value: 2,
|
||||
label: "定时"
|
||||
}
|
||||
]);
|
||||
|
||||
const { iot_alert_level, sys_job_status } = useDict(
|
||||
"iot_alert_level",
|
||||
"sys_job_status"
|
||||
);
|
||||
const data = reactive({
|
||||
form: {
|
||||
condition: "all", // 触发器条件
|
||||
triggers: [],
|
||||
actions: []
|
||||
},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
tenantId: null,
|
||||
alertName: null,
|
||||
alertLevel: null,
|
||||
productId: null,
|
||||
triggers: null,
|
||||
actions: null,
|
||||
status: null
|
||||
},
|
||||
rules: {
|
||||
alertName: [
|
||||
{ required: true, message: "告警名称不能为空", trigger: "blur" }
|
||||
],
|
||||
alertLevel: [
|
||||
{ required: true, message: "告警级别不能为空", trigger: "blur" }
|
||||
],
|
||||
productId: [{ required: true, message: "产品不能为空", trigger: "change" }],
|
||||
triggers: [{ required: true, message: "触发器不能为空", trigger: "blur" }],
|
||||
actions: [{ required: true, message: "执行动作不能为空", trigger: "blur" }]
|
||||
},
|
||||
// 产品
|
||||
productInfo: {},
|
||||
thingsModel: {}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules, productInfo } = toRefs(data);
|
||||
|
||||
watch(product, (val) => {
|
||||
productInfo.value = val;
|
||||
if (productInfo.value && productInfo.value.productId !== 0) {
|
||||
queryParams.value.productId = productInfo.value.productId;
|
||||
getList();
|
||||
// TODO:获取缓存的Json物模型
|
||||
// getModel(val.productId).then(response => {
|
||||
// thingsModel.value = JSON.parse(response.data);
|
||||
// });
|
||||
}
|
||||
});
|
||||
|
||||
/** 查询设备告警列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listAlertRule(queryParams.value).then((response) => {
|
||||
alertList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
alertId: null,
|
||||
tenantId: null,
|
||||
alertName: null,
|
||||
alertLevel: null,
|
||||
productId: null,
|
||||
// triggers: null,
|
||||
// actions: null,
|
||||
status: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
remark: null,
|
||||
condition: "all", // 触发器条件
|
||||
triggers: [
|
||||
{
|
||||
id: "",
|
||||
name: "",
|
||||
value: "",
|
||||
deviceId: 0,
|
||||
deviceName: "请选择一个设备",
|
||||
source: 1, //1=设备,2=定时,3=告警输出
|
||||
modelType: 1, // 1=属性,2=功能
|
||||
jobId: 0,
|
||||
cronExpression: "",
|
||||
isAdvance: 0
|
||||
}
|
||||
],
|
||||
actions: [
|
||||
{
|
||||
id: "",
|
||||
name: "",
|
||||
value: "",
|
||||
deviceId: 0,
|
||||
deviceName: "请选择一个设备",
|
||||
source: 1, //1=设备,2=定时,3=告警输出
|
||||
modelType: 1 // 1=属性,2=功能
|
||||
}
|
||||
]
|
||||
};
|
||||
proxy.resetForm("alertRef");
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map((item) => item.alertId);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
open.value = true;
|
||||
title.value = "添加设备告警";
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset();
|
||||
const _alertId = row.alertId || ids.value;
|
||||
getAlertRule(_alertId).then((response) => {
|
||||
form.value = response.data;
|
||||
open.value = true;
|
||||
title.value = "修改设备告警";
|
||||
});
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["alertRef"].validate((valid) => {
|
||||
if (valid) {
|
||||
form.value.productId = product.value.productId;
|
||||
if (form.value.alertId != null) {
|
||||
updateAlertRule(form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
} else {
|
||||
addAlertRule(form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _alertIds = row.alertId || ids.value;
|
||||
proxy.$modal
|
||||
.confirm("是否确认删除设备告警编号为\"" + _alertIds + "\"的数据项?")
|
||||
.then(function() {
|
||||
return delAlertRule(_alertIds);
|
||||
})
|
||||
.then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download(
|
||||
"device/alert/export",
|
||||
{
|
||||
...queryParams.value
|
||||
},
|
||||
`alert_${new Date().getTime()}.xlsx`
|
||||
);
|
||||
}
|
||||
|
||||
/** 添加动作 */
|
||||
const addActionItem = () => {
|
||||
form.value.actions.push({
|
||||
id: "",
|
||||
name: "",
|
||||
value: ""
|
||||
});
|
||||
};
|
||||
/** 删除动作 */
|
||||
const removeActionItem = (index) => {
|
||||
form.value.actions.splice(index, 1);
|
||||
};
|
||||
/** 触发器源改变事件 **/
|
||||
const changeTriggerSource = () => {
|
||||
setTriggerSource();
|
||||
};
|
||||
/** 设置触发器源 **/
|
||||
const setTriggerSource = () => {
|
||||
// 触发器智能包含一个定时
|
||||
let hasTimer = false;
|
||||
for (let i = 0; i < form.value.triggers.length; i++) {
|
||||
if (form.value.triggers[i].source === 2) {
|
||||
hasTimer = true;
|
||||
}
|
||||
}
|
||||
if (hasTimer) {
|
||||
triggerSource.value = [
|
||||
{
|
||||
value: 1,
|
||||
label: "设备"
|
||||
}
|
||||
];
|
||||
} else {
|
||||
//定时
|
||||
triggerSource.value = [
|
||||
{
|
||||
value: 1,
|
||||
label: "设备"
|
||||
},
|
||||
{
|
||||
value: 2,
|
||||
label: "定时"
|
||||
}
|
||||
];
|
||||
}
|
||||
};
|
||||
/** 添加触发器 */
|
||||
const addTriggerItem = () => {
|
||||
setTriggerSource();
|
||||
form.value.triggers.push({
|
||||
id: "",
|
||||
name: "",
|
||||
value: "",
|
||||
deviceId: 0,
|
||||
deviceName: "请选择一个设备",
|
||||
source: 1, //1=设备,2=定时,3=告警输出
|
||||
modelType: 1, // 1=属性,2=功能
|
||||
jobId: 0,
|
||||
cronExpression: "",
|
||||
isAdvance: 0
|
||||
});
|
||||
};
|
||||
/** 删除触发器 */
|
||||
const removeTriggerItem = (index) => {
|
||||
form.value.triggers.splice(index, 1);
|
||||
setTriggerSource();
|
||||
};
|
||||
/** cron表达式按钮操作 */
|
||||
const handleShowCron = (item, index) => {
|
||||
expression.value = item.cronExpression;
|
||||
triggerIndex.value = index;
|
||||
openCron.value = true;
|
||||
};
|
||||
/** 确定后回传值 */
|
||||
const crontabFill = (value) => {
|
||||
form.value.triggers[triggerIndex.value].cronExpression = value;
|
||||
};
|
||||
/** 修改重复事件 **/
|
||||
const repeatChange = (data) => {
|
||||
if (timerWeekRepeatValue.value === 1) {
|
||||
// 每天
|
||||
timerWeekValue.value = [1, 2, 3, 4, 5, 6, 7];
|
||||
form.value.repeat = 1;
|
||||
} else if (timerWeekRepeatValue.value === 2) {
|
||||
// 仅此一次
|
||||
timerWeekValue.value = [];
|
||||
form.value.isRepeat = 0;
|
||||
} else {
|
||||
// 指定
|
||||
form.value.isRepeat = 1;
|
||||
}
|
||||
gentCronExpression();
|
||||
};
|
||||
/** 星期改变事件 **/
|
||||
const weekChange = (data) => {
|
||||
gentCronExpression();
|
||||
};
|
||||
/** 时间改变事件 **/
|
||||
const timeChange = (data) => {
|
||||
gentCronExpression();
|
||||
};
|
||||
/**自定义cron表达式选项改变事件 */
|
||||
const customerCronChange = (data) => {
|
||||
gentCronExpression();
|
||||
};
|
||||
/** 生成cron表达式**/
|
||||
const gentCronExpression = () => {
|
||||
if (timerTimeValue.value === "") {
|
||||
proxy.$modal.alertError("执行时间不能为空");
|
||||
}
|
||||
let minute = timerTimeValue.value.substring(0, 2);
|
||||
let hour = timerTimeValue.value.substring(3);
|
||||
let week = "*";
|
||||
if (timerWeekValue.value.length > 0) {
|
||||
week = timerWeekValue.value;
|
||||
}
|
||||
form.value.triggers[triggerIndex.value].cronExpression =
|
||||
"0 " + minute + " " + hour + " ? * " + week;
|
||||
};
|
||||
|
||||
getList();
|
||||
</script>
|
@ -1,387 +0,0 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form
|
||||
v-show="showSearch"
|
||||
ref="queryRef"
|
||||
:inline="true"
|
||||
:model="queryParams"
|
||||
label-width="100px"
|
||||
label-position="left"
|
||||
>
|
||||
<el-form-item label="固件名称" prop="firmwareName">
|
||||
<el-input
|
||||
v-model="queryParams.firmwareName"
|
||||
clearable
|
||||
placeholder="请输入固件名称"
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="产品ID" prop="productId">
|
||||
<el-input
|
||||
v-model="queryParams.productId"
|
||||
clearable
|
||||
placeholder="请输入产品ID"
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="租户ID" prop="tenantId">
|
||||
<el-input
|
||||
v-model="queryParams.tenantId"
|
||||
clearable
|
||||
placeholder="请输入租户ID"
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否最新版本" prop="latestVersionFlag">
|
||||
<el-input
|
||||
v-model="queryParams.latestVersionFlag"
|
||||
clearable
|
||||
placeholder="请输入是否最新版本"
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="固件版本" prop="version">
|
||||
<el-input
|
||||
v-model="queryParams.version"
|
||||
clearable
|
||||
placeholder="请输入固件版本"
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="文件路径" prop="downloadUrl">
|
||||
<el-input
|
||||
v-model="queryParams.downloadUrl"
|
||||
clearable
|
||||
placeholder="请输入文件路径"
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button icon="Search" type="primary" @click="handleQuery"
|
||||
>搜索</el-button
|
||||
>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
v-hasPermi="['product:firmware:add']"
|
||||
icon="Plus"
|
||||
plain
|
||||
type="primary"
|
||||
@click="handleAdd"
|
||||
>新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
v-hasPermi="['product:firmware:edit']"
|
||||
:disabled="single"
|
||||
icon="Edit"
|
||||
plain
|
||||
type="success"
|
||||
@click="handleUpdate"
|
||||
>修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
v-hasPermi="['product:firmware:remove']"
|
||||
:disabled="multiple"
|
||||
icon="Delete"
|
||||
plain
|
||||
type="danger"
|
||||
@click="handleDelete"
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
v-hasPermi="['product:firmware:export']"
|
||||
icon="Download"
|
||||
plain
|
||||
type="warning"
|
||||
@click="handleExport"
|
||||
>导出
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
@queryTable="getList"
|
||||
></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="firmwareList"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column align="center" type="selection" width="55" />
|
||||
<el-table-column align="center" label="固件ID" prop="firmwareId" />
|
||||
<el-table-column align="center" label="固件名称" prop="firmwareName" />
|
||||
<el-table-column align="center" label="产品ID" prop="productId" />
|
||||
<el-table-column align="center" label="租户ID" prop="tenantId" />
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="是否最新版本"
|
||||
prop="latestVersionFlag"
|
||||
/>
|
||||
<el-table-column align="center" label="固件版本" prop="version" />
|
||||
<el-table-column align="center" label="文件路径" prop="downloadUrl" />
|
||||
<el-table-column align="center" label="备注" prop="remark" />
|
||||
<el-table-column
|
||||
align="center"
|
||||
class-name="small-padding fixed-width"
|
||||
label="操作"
|
||||
>
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
v-hasPermi="['product:firmware:edit']"
|
||||
icon="Edit"
|
||||
link
|
||||
type="primary"
|
||||
@click="handleUpdate(scope.row)"
|
||||
>修改
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPermi="['product:firmware:remove']"
|
||||
icon="Delete"
|
||||
link
|
||||
type="primary"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
v-model:page="queryParams.pageNum"
|
||||
:total="total"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改产品固件对话框 -->
|
||||
<el-dialog v-model="open" :title="title" append-to-body width="500px">
|
||||
<el-form
|
||||
ref="firmwareRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-width="80px"
|
||||
>
|
||||
<el-form-item label="固件名称" prop="firmwareName">
|
||||
<el-input v-model="form.firmwareName" placeholder="请输入固件名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="产品ID" prop="productId">
|
||||
<!-- <el-input v-model="form.productId" placeholder="请输入产品ID" />-->
|
||||
<el-select>
|
||||
<el-option v-for="item in productOp" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="租户ID" prop="tenantId">
|
||||
<el-input v-model="form.tenantId" placeholder="请输入租户ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否最新版本" prop="latestVersionFlag">
|
||||
<el-input
|
||||
v-model="form.latestVersionFlag"
|
||||
placeholder="请输入是否最新版本"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="固件版本" prop="version">
|
||||
<el-input v-model="form.version" placeholder="请输入固件版本" />
|
||||
</el-form-item>
|
||||
<el-form-item label="文件路径" prop="downloadUrl">
|
||||
<el-input v-model="form.downloadUrl" placeholder="请输入文件路径" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input
|
||||
v-model="form.remark"
|
||||
placeholder="请输入内容"
|
||||
type="textarea"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script name="Firmware" setup>
|
||||
import {
|
||||
addFirmware,
|
||||
delFirmware,
|
||||
getFirmware,
|
||||
listFirmware,
|
||||
updateFirmware,
|
||||
} from "@/api/product/firmware";
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
const firmwareList = ref([]);
|
||||
const open = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
firmwareName: null,
|
||||
productId: null,
|
||||
tenantId: null,
|
||||
latestVersionFlag: null,
|
||||
version: null,
|
||||
downloadUrl: null,
|
||||
},
|
||||
rules: {
|
||||
firmwareName: [
|
||||
{ required: true, message: "固件名称不能为空", trigger: "blur" },
|
||||
],
|
||||
productId: [{ required: true, message: "产品ID不能为空", trigger: "blur" }],
|
||||
tenantId: [{ required: true, message: "租户ID不能为空", trigger: "blur" }],
|
||||
latestVersionFlag: [
|
||||
{ required: true, message: "是否最新版本不能为空", trigger: "blur" },
|
||||
],
|
||||
version: [{ required: true, message: "固件版本不能为空", trigger: "blur" }],
|
||||
downloadUrl: [
|
||||
{ required: true, message: "文件路径不能为空", trigger: "blur" },
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询产品固件列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listFirmware(queryParams.value).then((response) => {
|
||||
firmwareList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
firmwareId: null,
|
||||
firmwareName: null,
|
||||
productId: null,
|
||||
tenantId: null,
|
||||
latestVersionFlag: null,
|
||||
version: null,
|
||||
downloadUrl: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
remark: null,
|
||||
};
|
||||
proxy.resetForm("firmwareRef");
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map((item) => item.firmwareId);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
open.value = true;
|
||||
title.value = "添加产品固件";
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset();
|
||||
const _firmwareId = row.firmwareId || ids.value;
|
||||
getFirmware(_firmwareId).then((response) => {
|
||||
form.value = response.data;
|
||||
open.value = true;
|
||||
title.value = "修改产品固件";
|
||||
});
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["firmwareRef"].validate((valid) => {
|
||||
if (valid) {
|
||||
if (form.value.firmwareId != null) {
|
||||
updateFirmware(form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
} else {
|
||||
addFirmware(form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _firmwareIds = row.firmwareId || ids.value;
|
||||
proxy.$modal
|
||||
.confirm('是否确认删除产品固件编号为"' + _firmwareIds + '"的数据项?')
|
||||
.then(function () {
|
||||
return delFirmware(_firmwareIds);
|
||||
})
|
||||
.then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download(
|
||||
"product/firmware/export",
|
||||
{
|
||||
...queryParams.value,
|
||||
},
|
||||
`firmware_${new Date().getTime()}.xlsx`
|
||||
);
|
||||
}
|
||||
|
||||
getList();
|
||||
</script>
|
@ -68,45 +68,32 @@
|
||||
<!-- </el-table-column>-->
|
||||
<el-table-column align="center" label="物模型类别" prop="type">
|
||||
<template #default="{ row }">
|
||||
<model-type-tags :type="row.type" />
|
||||
<!-- <el-tag v-if="row.type === 3" size="small" type="danger">事件</el-tag>-->
|
||||
<!-- <el-tag v-else-if="row.type === 2" size="small" type="success">功能</el-tag>-->
|
||||
<!-- <el-tag v-else-if="row.type === 1" size="small">属性</el-tag>-->
|
||||
<!-- <el-tag v-else size="small">未知</el-tag>-->
|
||||
<dict-tag
|
||||
:options="modelTypeDict"
|
||||
:value="[row.type]"
|
||||
effect="dark"
|
||||
size="small"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="数据类型" prop="datatype">
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="row.datatype === 'integer'" size="small">整数</el-tag>
|
||||
<el-tag v-else-if="row.datatype === 'decimal'" size="small"
|
||||
>小数
|
||||
</el-tag>
|
||||
<el-tag v-else-if="row.datatype === 'bool'" size="small">布尔</el-tag>
|
||||
<el-tag v-else-if="row.datatype === 'enum'" size="small">枚举</el-tag>
|
||||
<el-tag v-else-if="row.datatype === 'string'" size="small"
|
||||
>字符串
|
||||
</el-tag>
|
||||
<el-tag v-else-if="row.datatype === 'array'" size="small"
|
||||
>数组
|
||||
</el-tag>
|
||||
<el-tag v-else size="small">未知</el-tag>
|
||||
<dict-tag
|
||||
:options="dataTypeDict"
|
||||
:value="[row.datatype]"
|
||||
effect="plain"
|
||||
size="small"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="只读数据" prop="isOnlyRead">
|
||||
<template #default="{ row }">
|
||||
<el-tag
|
||||
:type="
|
||||
row.isOnlyRead === 0
|
||||
? 'success'
|
||||
: row.isOnlyRead === 1
|
||||
? 'warning'
|
||||
: ''
|
||||
"
|
||||
>
|
||||
{{
|
||||
row.isOnlyRead === 0 ? "否" : row.isOnlyRead === 1 ? "是" : "未知"
|
||||
}}
|
||||
</el-tag>
|
||||
<dict-tag
|
||||
:options="isOnlyReadDict"
|
||||
:value="[row.isOnlyRead]"
|
||||
effect="dark"
|
||||
size="small"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
@ -439,8 +426,9 @@ import {
|
||||
listModel,
|
||||
updateModel,
|
||||
} from "@/api/thingsmodel/model";
|
||||
import ModelTypeTags from "@/views/components/model-type-tags";
|
||||
import { getToken } from "@/utils/auth";
|
||||
import DictTag from "@/components/DictTag/index.vue";
|
||||
import { dataTypeDict, isOnlyReadDict, modelTypeDict } from "@/constant/dict";
|
||||
|
||||
const emits = defineEmits(["model-updated"]);
|
||||
|
||||
@ -600,11 +588,6 @@ const open = ref(false); // 是否显示编辑对话框
|
||||
const openJsonViewer = ref(false);
|
||||
const title = ref("");
|
||||
|
||||
const modelTypeMap = new Map([
|
||||
[1, "properties"],
|
||||
[2, "functions"],
|
||||
[3, "events"],
|
||||
]);
|
||||
// watch(modelJson, (value) => {
|
||||
// if (value) {
|
||||
// try {
|
||||
|
@ -126,15 +126,11 @@
|
||||
<el-table-column align="center" label="到期时间" prop="expireTime" />
|
||||
<el-table-column align="center" label="状态" prop="status">
|
||||
<template #default="{ row }">
|
||||
<el-tag
|
||||
:type="statusOptions.find((el) => el.value === row.status)?.tag"
|
||||
<dict-tag
|
||||
:options="statusOptions"
|
||||
:value="[row.status]"
|
||||
size="small"
|
||||
>
|
||||
{{
|
||||
statusOptions.find((el) => el.value === row.status)?.label ??
|
||||
"未知"
|
||||
}}
|
||||
</el-tag>
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="登录用户ID" align="center" prop="loginUserId" />-->
|
||||
@ -334,8 +330,9 @@ import {
|
||||
registerUser,
|
||||
updateTenant,
|
||||
} from "@/api/system/tenant";
|
||||
import { statusOptions } from "../../../constant/status";
|
||||
import { resetUserPwd } from "@/api/system/user";
|
||||
import { statusOptions } from "@/constant/dict";
|
||||
import DictTag from "@/components/DictTag/index.vue";
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
|
@ -81,8 +81,8 @@
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item>
|
||||
<el-button icon="Search" type="primary" @click="handleQuery"
|
||||
>搜索</el-button
|
||||
>
|
||||
>搜索
|
||||
</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@ -158,7 +158,8 @@
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="数据类型" prop="datatype">
|
||||
<template #default="{ row }">
|
||||
{{ dataTypeMap.get(row.datatype) ?? "未知" }}
|
||||
<!-- {{ dataTypeMap.get(row.datatype) ?? "未知" }}-->
|
||||
<dict-tag :options="dataTypeDict" :value="[row.datatype]" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
@ -454,7 +455,7 @@ import { formatSpecsDisplay } from "@/utils/thingsmodel";
|
||||
import { listProduct } from "@/api/product/product";
|
||||
import { listTenant } from "@/api/system/tenant";
|
||||
import ModelTypeTags from "@/views/components/model-type-tags";
|
||||
import { dataTypeMap } from "../../../constant/dict";
|
||||
import { dataTypeDict } from "../../../constant/dict";
|
||||
import { ref } from "vue";
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
@ -130,14 +130,21 @@
|
||||
/>
|
||||
<el-table-column align="center" label="模型类别" prop="type">
|
||||
<template #default="{ row }">
|
||||
<el-tag size="small">
|
||||
{{ modelType.get(row.type) ?? "未知" }}
|
||||
</el-tag>
|
||||
<dict-tag
|
||||
:options="modelTypeDict"
|
||||
:value="[row.type]"
|
||||
effect="dark"
|
||||
size="small"
|
||||
/>
|
||||
<!-- <el-tag size="small">-->
|
||||
<!-- {{ modelType.get(row.type) ?? "未知" }}-->
|
||||
<!-- </el-tag>-->
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="数据类型">
|
||||
<template #default="{ row }">
|
||||
{{ dataTypeMap.get(row.datatype) ?? "未知" }}
|
||||
<!-- {{ dataTypeMap.get(row.datatype) ?? "未知" }}-->
|
||||
<dict-tag :options="dataTypeDict" :value="[row.datatype]" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
@ -153,7 +160,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="是否系统通用" prop="isSys">
|
||||
<template #default="{ row }">
|
||||
{{ isSysMap.get(row.isSys) ?? "未知" }}
|
||||
<dict-tag :options="isSysDict" :value="[row.isSys]" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column align="center" label="是否首页显示" prop="isTop" />-->
|
||||
@ -414,9 +421,10 @@ import {
|
||||
updateTemplate,
|
||||
} from "@/api/thingsmodel/template";
|
||||
import { getCurrentInstance, reactive, ref, toRefs } from "vue";
|
||||
import { dataTypeMap, isSysMap, modelType } from "@/constant/dict";
|
||||
import { dataTypeDict, isSysDict, modelTypeDict } from "@/constant/dict";
|
||||
import { formatSpecsDisplay } from "@/utils/thingsmodel";
|
||||
import { listTenant } from "@/api/system/tenant";
|
||||
import DictTag from "@/components/DictTag/index.vue";
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
|
Reference in New Issue
Block a user