场景联动

This commit is contained in:
2023-04-28 17:37:34 +08:00
parent 5fecd74d59
commit e08ed33cd9
11 changed files with 1542 additions and 187 deletions

44
src/api/device/linkage.js Normal file
View File

@ -0,0 +1,44 @@
import request from "@/utils/request";
// 查询场景联动列表
export function listLinkage(query) {
return request({
url: "/device/linkage/list",
method: "get",
params: query,
});
}
// 查询场景联动详细
export function getLinkage(sceneId) {
return request({
url: "/device/linkage/" + sceneId,
method: "get",
});
}
// 新增场景联动
export function addLinkage(data) {
return request({
url: "/device/linkage",
method: "post",
data: data,
});
}
// 修改场景联动
export function updateLinkage(data) {
return request({
url: "/device/linkage",
method: "put",
data: data,
});
}
// 删除场景联动
export function delLinkage(sceneId) {
return request({
url: "/device/linkage/" + sceneId,
method: "delete",
});
}

View File

@ -8,10 +8,7 @@
width="320" width="320"
> >
<template #reference> <template #reference>
<el-badge <el-badge :hidden="unreadCount === 0" :value="unreadCount">
:hidden="unreadCount === 0"
:value="unreadCount"
>
<el-icon class="notification-icon" @click="visible = !visible"> <el-icon class="notification-icon" @click="visible = !visible">
<Bell /> <Bell />
</el-icon> </el-icon>
@ -24,7 +21,7 @@
<div class="notification-content"> <div class="notification-content">
<div class="status-tab"> <div class="status-tab">
<el-radio-group <el-radio-group
v-model="status" v-model="queryParams.status"
class="ios-style-radio" class="ios-style-radio"
size="small" size="small"
> >
@ -42,7 +39,7 @@
{{ selectMulti ? "取消" : "选择" }} {{ selectMulti ? "取消" : "选择" }}
</el-button> </el-button>
<el-button <el-button
v-if="ids.length && status === 2" v-if="ids.length && queryParams.status === 2"
link link
size="small" size="small"
type="danger" type="danger"
@ -50,18 +47,14 @@
>删除 >删除
</el-button> </el-button>
<el-button <el-button
v-if="ids.length && status === 1" v-if="ids.length && queryParams.status === 1"
link link
size="small" size="small"
type="danger" type="danger"
@click="markAsRead" @click="markAsRead"
>标为已读 >标为已读
</el-button> </el-button>
<el-button <el-button link size="small" type="primary" @click="refreshList"
link
size="small"
type="primary"
@click="refreshList"
>刷新 >刷新
</el-button> </el-button>
</div> </div>
@ -87,7 +80,9 @@
<span class="notification-title">{{ <span class="notification-title">{{
item.msgTitle item.msgTitle
}}</span> }}</span>
<span class="notification-time">{{ dayjs(item.sendTime).format("YYYY-MM-DD HH:mm:ss") }}</span> <span class="notification-time">{{
dayjs(item.sendTime).format("YYYY-MM-DD HH:mm:ss")
}}</span>
</div> </div>
</div> </div>
</template> </template>
@ -116,8 +111,7 @@
<!-- </template>--> <!-- </template>-->
{{ msgDetail.msgContent }} {{ msgDetail.msgContent }}
</el-dialog> </el-dialog>
<el-dialog v-model="showOfflineNotice" <el-dialog v-model="showOfflineNotice" title="下线通知"></el-dialog>
title="下线通知"></el-dialog>
</div> </div>
</template> </template>
@ -146,9 +140,9 @@ const data = reactive({
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
status: 1 status: 1,
}, },
msgDetail: {} msgDetail: {},
}); });
const router = useRouter(); const router = useRouter();
const loadKey = ref(0); const loadKey = ref(0);
@ -166,36 +160,26 @@ const ids = ref([]); //选中的列表
const refreshList = () => { const refreshList = () => {
ids.value = []; ids.value = [];
selectMulti.value = false; selectMulti.value = false;
queryParams.value.status = status.value;
queryParams.value.pageNum = 1; queryParams.value.pageNum = 1;
// if (status.value === 2) {
notificationList.value = []; notificationList.value = [];
// }
loadKey.value += 1; loadKey.value += 1;
}; };
watch(status, (value) => {
watch(
() => queryParams.value.status,
(value) => {
ids.value = []; ids.value = [];
selectMulti.value = false; selectMulti.value = false;
queryParams.value.status = value;
queryParams.value.pageNum = 1; queryParams.value.pageNum = 1;
// if (value === 2) {
notificationList.value = []; notificationList.value = [];
// }
loadKey.value += 1; loadKey.value += 1;
}); }
);
const loadMore = async ($state) => { const loadMore = async ($state) => {
// console.log($state);
try { try {
loading.value = true; loading.value = true;
const resp = await listMsg(queryParams.value); const resp = await listMsg(queryParams.value);
// if (queryParams.value.status === 0) {
// notificationStore.pushItems(resp.rows);
// } else if (queryParams.value.status === 2) {
notificationList.value.push(...resp.rows); notificationList.value.push(...resp.rows);
// }
// queryParams.value.status === 0 &&
// resp.rows.length &&
// updateMsg(resp.rows.map((el) => el.msgId).join(","), 1);
total.value = resp.total; total.value = resp.total;
if (queryParams.value.status === 1) { if (queryParams.value.status === 1) {
unreadCount.value = resp.total; unreadCount.value = resp.total;
@ -232,9 +216,6 @@ const deleteReadMsg = async () => {
const markAsRead = async () => { const markAsRead = async () => {
await updateMsg(ids.value.join(","), 2); await updateMsg(ids.value.join(","), 2);
refreshList(); refreshList();
/* for (const id of ids.value) {
notificationStore.removeItem(id);
}*/
ids.value = []; ids.value = [];
selectMulti.value = false; selectMulti.value = false;
}; };
@ -256,55 +237,40 @@ function logout() {
cancelButtonText: "取消", cancelButtonText: "取消",
showCancelButton: false, showCancelButton: false,
showClose: false, showClose: false,
type: "warning" type: "warning",
}) })
.then(() => { .then(() => {
userStore.logOut().then(() => { userStore.logOut().then(() => {
location.href = "/index"; location.href = "/index";
// router.go("/index")
}); });
}) })
.catch(() => { .catch(() => {
userStore.logOut().then(() => { userStore.logOut().then(() => {
location.href = "/index"; location.href = "/index";
// router.go("/index")
}); });
}); });
} }
watch(visible, (value) => { watch(visible, (value) => {
if (value) { if (value) {
/*当打开通知弹窗时*/
notificationList.value = []; notificationList.value = [];
queryParams.value.pageNum = 1; queryParams.value.pageNum = 1;
queryParams.value.status = 1; queryParams.value.status = 1;
status.value = 1;
loadKey.value++; loadKey.value++;
} }
}); });
/*获取未读数量*/
const getUnreadCount = async () => { const getUnreadCount = async () => {
// loading.value = true;
// notificationList.value = [];
// queryParams.value.pageNum = 1;
// queryParams.value.status = 1;
// status.value = 1;
const resp = await listMsg({ const resp = await listMsg({
pageSize: 10, pageNum: 1, status: 1 pageSize: 10,
pageNum: 1,
status: 1,
}); });
// if (queryParams.value.status === 0) {
// notificationStore.pushItems(resp.rows);
// } else if (queryParams.value.status === 2) {
// notificationList.value.push(...resp.rows);
// }
// queryParams.value.status === 0 &&
// resp.rows.length &&
// updateMsg(resp.rows.map((el) => el.msgId).join(","), 1);
unreadCount.value = resp.total; unreadCount.value = resp.total;
// queryParams.value.pageNum++;
// loading.value = false;
}; };
onMounted(() => { onMounted(() => {
getUnreadCount(); getUnreadCount();
if (userStore.userId) { if (userStore.userId) {
@ -337,20 +303,12 @@ onMounted(() => {
console.log(event.data); console.log(event.data);
const wsData = JSON.parse(event.data); const wsData = JSON.parse(event.data);
if (wsData.type === "msg") { if (wsData.type === "msg") {
// if (visible.value) {
// refreshList();
// } else {
if (visible.value && queryParams.value.status === 1) { if (visible.value && queryParams.value.status === 1) {
refreshList(); refreshList();
} else { } else {
getUnreadCount(); getUnreadCount();
} }
// }
// const msg = wsData.data;
// updateMsg(msg.msgId, 1);
// notificationStore.pushItem(msg);
} else if (wsData.type === "offline") { } else if (wsData.type === "offline") {
// showOfflineNotice.value = true;
logout(); logout();
} }
}); });
@ -396,7 +354,6 @@ onMounted(() => {
margin-top: 16px; margin-top: 16px;
.notification-item { .notification-item {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
@ -449,7 +406,6 @@ onMounted(() => {
&:last-child { &:last-child {
border-bottom: 1px solid #eeefef; border-bottom: 1px solid #eeefef;
} }
} }
} }

View File

@ -11,6 +11,7 @@
v-loading="loading" v-loading="loading"
:data="dataList" :data="dataList"
@select="handleSelect" @select="handleSelect"
@row-click="handleRowClick"
@select-all="handleSelectAll" @select-all="handleSelectAll"
> >
<el-table-column <el-table-column
@ -53,8 +54,8 @@
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
<el-button v-if="!readonly" type="primary" @click="confirmSelect" <el-button v-if="!readonly" type="primary" @click="confirmSelect"
>确认</el-button >确认
> </el-button>
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</template> </template>
@ -62,7 +63,7 @@
</template> </template>
<script name="TableSelect" setup> <script name="TableSelect" setup>
import { nextTick, reactive, ref, toRefs, watchEffect } from "vue"; import { nextTick, onMounted, reactive, ref, toRefs, watchEffect } from "vue";
import { cloneDeep } from "lodash-es"; import { cloneDeep } from "lodash-es";
import Pagination from "@/components/Pagination/index.vue"; import Pagination from "@/components/Pagination/index.vue";
@ -75,6 +76,14 @@ const props = defineProps({
type: Array, type: Array,
default: [], default: [],
}, },
multiple: {
type: Boolean,
default: true,
},
multiPage: {
type: Boolean,
default: true,
},
readonly: { readonly: {
type: Boolean, type: Boolean,
default: false, default: false,
@ -90,7 +99,7 @@ const props = defineProps({
type: Boolean, type: Boolean,
}, },
}); });
const { list } = toRefs(props); const { list, multiple } = toRefs(props);
const emit = defineEmits(["update:modelValue", "confirm-select"]); const emit = defineEmits(["update:modelValue", "confirm-select"]);
@ -102,8 +111,8 @@ const selectedProperties = ref([]);
const ids = ref([]); const ids = ref([]);
const data = reactive({ const data = reactive({
queryParams: { queryParams: {
pageNum: 1, pageNum: props.multiPage ? 1 : null,
pageSize: 10, pageSize: props.multiPage ? 10 : null,
}, },
}); });
@ -135,19 +144,35 @@ const cancel = () => {
selectedProperties.value = []; selectedProperties.value = [];
emit("update:modelValue", false); emit("update:modelValue", false);
}; };
const handleSelectChange = (selection) => {};
const handleRowClick = (row, _, event) => {
event.target?.parentNode?.parentNode?.firstElementChild?.firstElementChild?.firstElementChild?.click();
};
/*监听单选事件*/ /*监听单选事件*/
const handleSelect = (selection, row) => { const handleSelect = (selection, row) => {
const isCheck = const isCheck =
selection.findIndex((el) => el[props.selectKey] === row[props.selectKey]) > selection.findIndex((el) => el[props.selectKey] === row[props.selectKey]) >
-1; -1; /* 是否将行切换为选中状态 */
if (isCheck) { if (isCheck) {
/*如果是单选状态 multiple 为false */
if (!multiple.value) {
// nextTick(() => {
selectedProperties.value = [];
selection.forEach((el) => {
if (el[props.selectKey] !== row[props.selectKey]) {
tableRef.value.toggleRowSelection(el, false);
}
});
// });
}
/*添加选中*/ /*添加选中*/
const isIdNotExist = const isIdNotExist =
selectedProperties.value.findIndex( selectedProperties.value.findIndex(
(el) => el[props.selectKey] === row[props.selectKey] (el) => el[props.selectKey] === row[props.selectKey]
) === -1; ) === -1;
if (isIdNotExist) { if (isIdNotExist) {
console.log(isIdNotExist);
selectedProperties.value.push(row); selectedProperties.value.push(row);
} }
} else { } else {
@ -205,13 +230,24 @@ const confirmSelect = () => {
defineExpose({ defineExpose({
getList, getList,
}); });
onMounted(() => {
document.documentElement.style.setProperty(
"--show-select-all",
multiple.value ? "visible" : "hidden"
);
document.documentElement.style.setProperty(
"--checkbox-round",
multiple.value ? "inherit" : "50%"
);
});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
:deep(.el-table__header) { :deep(.el-table__header) {
.el-table-column--selection { .el-table-column--selection {
.el-checkbox { .el-checkbox {
//visibility: hidden; visibility: var(--show-select-all);
} }
} }
} }

View File

@ -323,3 +323,16 @@ export const noticeStatusDict = [
elTagType: "success", elTagType: "success",
}, },
]; ];
export const triggerTypeDict = [
{
label: "设备触发",
value: "1",
elTagType: "danger",
},
{
label: "正常",
value: "0",
elTagType: "success",
},
];

View File

@ -20,7 +20,7 @@ export default {
/** /**
* 是否显示 tagsView * 是否显示 tagsView
*/ */
tagsView: true, tagsView: false,
/** /**
* 是否固定头部 * 是否固定头部

View File

@ -11,7 +11,7 @@ const useUserStore = defineStore("user", {
roles: [], roles: [],
userId: null, userId: null,
permissions: [], permissions: [],
uniqueId: "" uniqueId: "",
}), }),
actions: { actions: {
// 登录 // 登录
@ -77,11 +77,11 @@ const useUserStore = defineStore("user", {
reject(error); reject(error);
}); });
}); });
} },
}, },
persist: { persist: {
paths: ["uniqueId"] paths: ["uniqueId"],
} },
}); });
export default useUserStore; export default useUserStore;

File diff suppressed because it is too large Load Diff

View File

@ -666,7 +666,13 @@
<script name="Alert" setup> <script name="Alert" setup>
import Crontab from "@/components/Crontab/index.vue"; 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 { getCurrentInstance, reactive, ref, toRefs, watch } from "vue";
import { useDict } from "@/utils/dict"; import { useDict } from "@/utils/dict";
import { listProduct } from "@/api/product/product"; import { listProduct } from "@/api/product/product";
@ -680,116 +686,116 @@ const { proxy } = getCurrentInstance();
const props = defineProps({ const props = defineProps({
product: { product: {
type: Object, type: Object,
default: null default: null,
}, },
productId: { productId: {
type: Number, type: Number,
default: null default: null,
} },
}); });
const { product, productId } = toRefs(props); const { product, productId } = toRefs(props);
const timerWeeks = [ const timerWeeks = [
{ {
value: 1, value: 1,
label: "周一" label: "周一",
}, },
{ {
value: 2, value: 2,
label: "周二" label: "周二",
}, },
{ {
value: 3, value: 3,
label: "周三" label: "周三",
}, },
{ {
value: 4, value: 4,
label: "周四" label: "周四",
}, },
{ {
value: 5, value: 5,
label: "周五" label: "周五",
}, },
{ {
value: 6, value: 6,
label: "周六" label: "周六",
}, },
{ {
value: 7, value: 7,
label: "周日" label: "周日",
} },
]; ];
// 执行动作源 // 执行动作源
const actionSource = [ const actionSource = [
{ {
value: 1, value: 1,
label: "设备" label: "设备",
}, },
{ {
value: 3, value: 3,
label: "告警输出" label: "告警输出",
} },
]; ];
// 物模型类别 // 物模型类别
const modelTypes = [ const modelTypes = [
{ {
value: "1", value: "1",
label: "属性" label: "属性",
}, },
{ {
value: "2", value: "2",
label: "服务" label: "服务",
}, },
{ {
value: "3", value: "3",
label: "事件" label: "事件",
}, },
{ {
value: "4", value: "4",
label: "设备上线" label: "设备上线",
}, },
{ {
value: "5", value: "5",
label: "设备下线" label: "设备下线",
} },
]; ];
// 触发器条件 // 触发器条件
const triggerConditions = [ const triggerConditions = [
{ {
value: "2", value: "2",
label: "满足所有条件" label: "满足所有条件",
}, },
{ {
value: "1", value: "1",
label: "满足任一条件" label: "满足任一条件",
} },
]; ];
// 告警状态 // 告警状态
const alertType = [ const alertType = [
{ {
value: 1, value: 1,
label: "启动" label: "启动",
}, },
{ {
value: 2, value: 2,
label: "停止" label: "停止",
} },
]; ];
// 周 // 周
const timerWeekRepeats = ref([ const timerWeekRepeats = ref([
{ {
value: "1", value: "1",
label: "每天" label: "每天",
}, },
{ {
value: "2", value: "2",
label: "仅此一次" label: "仅此一次",
}, },
{ {
value: "3", value: "3",
label: "指定" label: "指定",
} },
]); ]);
const productOptions = ref([]); const productOptions = ref([]);
const noticeConfigOptions = ref([]); /*通知配置选项*/ const noticeConfigOptions = ref([]); /*通知配置选项*/
@ -813,12 +819,12 @@ const modelList = ref([]);
const triggerSource = ref([ const triggerSource = ref([
{ {
value: "1", value: "1",
label: "设备触发" label: "设备触发",
}, },
{ {
value: "2", value: "2",
label: "定时触发" label: "定时触发",
} },
]); ]);
const { iot_alert_level, sys_job_status } = useDict( const { iot_alert_level, sys_job_status } = useDict(
@ -829,7 +835,7 @@ const data = reactive({
form: { form: {
conditions: "1", // 触发器条件 conditions: "1", // 触发器条件
triggers: [], triggers: [],
actions: [] actions: [],
}, },
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
@ -840,25 +846,25 @@ const data = reactive({
productId: null, productId: null,
triggers: null, triggers: null,
actions: null, actions: null,
status: null status: null,
}, },
rules: { rules: {
noticeConfigId: [ noticeConfigId: [
{ required: true, message: "告警通知不能为空", trigger: "change" } { required: true, message: "告警通知不能为空", trigger: "change" },
], ],
alertName: [ alertName: [
{ required: true, message: "告警名称不能为空", trigger: "blur" } { required: true, message: "告警名称不能为空", trigger: "blur" },
], ],
alertLevel: [ alertLevel: [
{ required: true, message: "告警级别不能为空", trigger: "change" } { required: true, message: "告警级别不能为空", trigger: "change" },
], ],
productId: [{ required: true, message: "产品不能为空", trigger: "change" }], productId: [{ required: true, message: "产品不能为空", trigger: "change" }],
triggers: [{ required: true, message: "触发器不能为空", trigger: "blur" }], triggers: [{ required: true, message: "触发器不能为空", trigger: "blur" }],
actions: [{ required: true, message: "执行动作不能为空", trigger: "blur" }] actions: [{ required: true, message: "执行动作不能为空", trigger: "blur" }],
}, },
// 产品 // 产品
productInfo: {}, productInfo: {},
thingsModel: {} thingsModel: {},
}); });
const { queryParams, form, rules, productInfo } = toRefs(data); const { queryParams, form, rules, productInfo } = toRefs(data);
@ -866,7 +872,7 @@ const getNoticeConfigOption = (keyword) => {
listNoticeConfig({ listNoticeConfig({
configName: keyword, configName: keyword,
pageNum: 1, pageNum: 1,
pageSize: 100 pageSize: 100,
}).then((resp) => { }).then((resp) => {
noticeConfigOptions.value = resp.rows; noticeConfigOptions.value = resp.rows;
}); });
@ -912,14 +918,14 @@ function reset() {
modelValue: null, modelValue: null,
triggerType: "1", //1=设备2=定时3=告警输出 triggerType: "1", //1=设备2=定时3=告警输出
modelType: "1", // 1=属性2=服务 modelType: "1", // 1=属性2=服务
cronExpression: null cronExpression: null,
// jobId: 0, // jobId: 0,
// deviceId: 0, // deviceId: 0,
// deviceName: "请选择一个设备", // deviceName: "请选择一个设备",
// id: "", // id: "",
// name: "", // name: "",
// isAdvance: 1 // isAdvance: 1
} },
], ],
actions: [ actions: [
{ {
@ -928,14 +934,14 @@ function reset() {
modelValue: null, modelValue: null,
modelKey: null, modelKey: null,
operator: null, operator: null,
modelType: "1" // 1=属性2=服务 modelType: "1", // 1=属性2=服务
// id: "", // id: "",
// name: "", // name: "",
// deviceId: 0, // deviceId: 0,
// deviceName: "请选择一个设备", // deviceName: "请选择一个设备",
// triggerType: "1", //1=设备2=定时3=告警输出 // triggerType: "1", //1=设备2=定时3=告警输出
} },
] ],
}; };
proxy.resetForm("alertRef"); proxy.resetForm("alertRef");
} }
@ -1021,7 +1027,7 @@ function submitForm() {
function handleDelete(row) { function handleDelete(row) {
const _alertIds = row.alertId || ids.value; const _alertIds = row.alertId || ids.value;
proxy.$modal proxy.$modal
.confirm("是否确认删除设备告警编号为\"" + _alertIds + "\"的数据项?") .confirm('是否确认删除设备告警编号为"' + _alertIds + '"的数据项?')
.then(function () { .then(function () {
return delAlertRule(_alertIds); return delAlertRule(_alertIds);
}) })
@ -1029,8 +1035,7 @@ function handleDelete(row) {
getList(); getList();
proxy.$modal.msgSuccess("删除成功"); proxy.$modal.msgSuccess("删除成功");
}) })
.catch(() => { .catch(() => {});
});
} }
/** 导出按钮操作 */ /** 导出按钮操作 */
@ -1038,7 +1043,7 @@ function handleExport() {
proxy.download( proxy.download(
"device/alert/export", "device/alert/export",
{ {
...queryParams.value ...queryParams.value,
}, },
`alert_${new Date().getTime()}.xlsx` `alert_${new Date().getTime()}.xlsx`
); );
@ -1052,7 +1057,7 @@ const addActionItem = () => {
modelValue: "", modelValue: "",
modelKey: "", modelKey: "",
operator: "", operator: "",
modelType: "1" // 1=属性2=服务 modelType: "1", // 1=属性2=服务
// id: "", // id: "",
// name: "", // name: "",
// value: "" // value: ""
@ -1079,20 +1084,20 @@ const setTriggerSource = () => {
triggerSource.value = [ triggerSource.value = [
{ {
value: "1", value: "1",
label: "设备触发" label: "设备触发",
} },
]; ];
} else { } else {
//定时 //定时
triggerSource.value = [ triggerSource.value = [
{ {
value: "1", value: "1",
label: "设备触发" label: "设备触发",
}, },
{ {
value: "2", value: "2",
label: "定时触发" label: "定时触发",
} },
]; ];
} }
/**/ /**/
@ -1110,7 +1115,7 @@ const addTriggerItem = () => {
modelValue: null, modelValue: null,
// conditions: "2", // conditions: "2",
operator: null, operator: null,
modelId: null modelId: null,
// value: "", // value: "",
// id: "", // id: "",
// name: "", // name: "",
@ -1185,7 +1190,7 @@ function getProductOptions(keyword) {
listProduct({ listProduct({
productName: keyword, productName: keyword,
pageNum: 1, pageNum: 1,
pageSize: 20 pageSize: 20,
}).then((resp) => { }).then((resp) => {
productOptions.value = resp.rows; productOptions.value = resp.rows;
}); });
@ -1195,7 +1200,7 @@ function getDeviceOptions(keyword) {
listDevice({ listDevice({
deviceName: keyword, deviceName: keyword,
pageNum: 1, pageNum: 1,
pageSize: 20 pageSize: 20,
}).then((resp) => { }).then((resp) => {
deviceOptions.value = resp.rows; deviceOptions.value = resp.rows;
}); });
@ -1203,7 +1208,7 @@ function getDeviceOptions(keyword) {
const getThingsModelOptions = (productId) => { const getThingsModelOptions = (productId) => {
listModel({ listModel({
productId productId,
}).then((resp) => { }).then((resp) => {
modelList.value = resp.rows; modelList.value = resp.rows;
}); });
@ -1227,7 +1232,7 @@ watch(
getList(); getList();
}, },
{ {
immediate: true immediate: true,
} }
); );

View File

@ -118,7 +118,7 @@
> >
<firmware v-if="form.productId" :product-id="form.productId" /> <firmware v-if="form.productId" :product-id="form.productId" />
</el-tab-pane> </el-tab-pane>
<el-tab-pane :disabled="!form.productId" label="告警配置" lazy> <el-tab-pane :disabled="!form.productId" label="告警联动" lazy>
<alert <alert
v-if="form.productId" v-if="form.productId"
:product="form" :product="form"

View File

@ -198,20 +198,20 @@
<!-- />--> <!-- />-->
<!-- </template>--> <!-- </template>-->
<!-- </el-table-column>--> <!-- </el-table-column>-->
<el-table-column align="center" label="图片" prop="imgUrl"> <!-- <el-table-column align="center" label="图片" prop="imgUrl">-->
<template #default="{ row }"> <!-- <template #default="{ row }">-->
<el-image <!-- <el-image-->
:preview-src-list="[`${baseUrl}/${row.imgUrl}`]" <!-- :preview-src-list="[`${baseUrl}/${row.imgUrl}`]"-->
:src="`${baseUrl}/${row.imgUrl}`" <!-- :src="`${baseUrl}/${row.imgUrl}`"-->
></el-image> <!-- ></el-image>-->
</template> <!-- </template>-->
</el-table-column> <!-- </el-table-column>-->
<el-table-column align="center" label="备注" prop="remark" /> <el-table-column align="center" label="备注" prop="remark" />
<el-table-column <el-table-column
align="center" align="center"
class-name="small-padding fixed-width" class-name="small-padding fixed-width"
label="操作" label="操作"
width="190px" width="240px"
> >
<template #default="scope"> <template #default="scope">
<!-- TODO:--> <!-- TODO:-->
@ -231,7 +231,17 @@
>详情 >详情
<!-- {{ scope.row.status === 2 ? "查看" : "" }}--> <!-- {{ scope.row.status === 2 ? "查看" : "" }}-->
</el-button> </el-button>
<el-button link type="primary" @click="viewDeviceList(scope.row)" <el-button
link
type="primary"
@click="viewEditTab(scope.row, 'model')"
>物模型
<!-- {{ scope.row.status === 2 ? "查看" : "" }}-->
</el-button>
<el-button
link
type="primary"
@click="viewEditTab(scope.row, 'device')"
>设备列表 >设备列表
<!-- {{ scope.row.status === 2 ? "查看" : "" }}--> <!-- {{ scope.row.status === 2 ? "查看" : "" }}-->
</el-button> </el-button>
@ -463,14 +473,14 @@ function handleUpdate(row) {
// }); // });
} }
const viewDeviceList = (row) => { const viewEditTab = (row, tab) => {
const _productId = row.productId; const _productId = row.productId;
router.push({ router.push({
path: "/produc/product/edit", path: "/produc/product/edit",
query: { query: {
productId: _productId, productId: _productId,
pageNum: queryParams.value.pageNum, // pageNum: queryParams.value.pageNum,
initTab: "device", initTab: tab,
}, },
}); });
}; };

View File

@ -97,16 +97,16 @@
>删除 >删除
</el-button> </el-button>
</el-col> </el-col>
<el-col :span="1.5"> <!-- <el-col :span="1.5">-->
<el-button <!-- <el-button-->
v-hasPermi="['sys:tenant:export']" <!-- v-hasPermi="['sys:tenant:export']"-->
icon="Download" <!-- icon="Download"-->
plain <!-- plain-->
type="warning" <!-- type="warning"-->
@click="handleExport" <!-- @click="handleExport"-->
>导出 <!-- >导出-->
</el-button> <!-- </el-button>-->
</el-col> <!-- </el-col>-->
<right-toolbar <right-toolbar
v-model:showSearch="showSearch" v-model:showSearch="showSearch"
@queryTable="getList" @queryTable="getList"
@ -384,10 +384,18 @@ const data = reactive({
loginAccount: null, loginAccount: null,
}, },
rules: { rules: {
expireTime: [
{
required: true,
message: "请选择到期时间",
trigger: "change",
},
],
tenantName: [ tenantName: [
{ required: true, message: "请输入租户名称", trigger: "blur" }, { required: true, message: "请输入租户名称", trigger: "blur" },
], ],
}, },
loginUserForm: {}, loginUserForm: {},
loginUserRules: { loginUserRules: {
username: [ username: [