Merge branch 'dev-hub' into dev

This commit is contained in:
jackhoo_98 2023-03-28 15:44:46 +08:00
commit 407f3a8758
5 changed files with 28 additions and 11 deletions

View File

@ -99,8 +99,8 @@
@click="handleClick"
:active="_selectedRowKeys.includes(slotProps.id)"
class="card-box"
:status="getState(slotProps).value"
:statusText="getState(slotProps)?.text"
:status="slotProps?.runningState?.value"
:statusText="slotProps?.runningState?.text"
:statusNames="Object.fromEntries(colorMap.entries())"
>
<template #title>
@ -282,7 +282,7 @@ import BatchUpdate from './components/BatchUpdate/index.vue';
import SaveModBus from './Save/SaveModBus.vue';
import SaveOPCUA from './Save/SaveOPCUA.vue';
import Scan from './Scan/index.vue';
import { colorMap, getState } from '../data.ts';
import { colorMap } from '../data.ts';
import { cloneDeep, isNumber } from 'lodash-es';
import { getWebSocket } from '@/utils/websocket';
import { map } from 'rxjs/operators';

View File

@ -38,8 +38,14 @@
<j-tag
class="tree-left-tag"
v-if="data.id !== '*'"
:color="colorMap.get(getState(data)?.value)"
>{{ getState(data)?.text }}</j-tag
:color="colorMap.get(data?.runningState?.value)"
>{{ data?.runningState?.text }}</j-tag
>
<j-tag
class="tree-left-tag2"
v-if="data.id !== '*'"
:color="colorMap.get(data?.state?.value)"
>{{ data?.state?.text }}</j-tag
>
<span
v-if="data.id !== '*'"
@ -119,7 +125,7 @@ import Save from './Save/index.vue';
import { onlyMessage } from '@/utils/comm';
import { Store } from 'jetlinks-store';
import _ from 'lodash';
import { colorMap, getState } from '../data.ts';
import { colorMap } from '../data.ts';
const props = defineProps({
data: {
@ -285,7 +291,7 @@ watch(
<style lang="less" scoped>
.tree-container {
padding-right: 24px;
width: 350px;
width: 370px;
.add-btn {
margin: 10px 0;
@ -311,6 +317,11 @@ watch(
display: flex;
justify-content: center;
}
.tree-left-tag2 {
width: 50px;
display: flex;
justify-content: center;
}
.func-btns {
// display: none;
display: block;

View File

@ -4,6 +4,8 @@ colorMap.set('partialError', 'warning');
colorMap.set('failed', 'error');
colorMap.set('stopped', 'default');
colorMap.set('processing', '#cccccc');
colorMap.set('enabled', 'processing');
colorMap.set('disabled', 'error');
export const getState = (record: any) => {
const enabled = record?.state?.value === 'enabled';

View File

@ -36,9 +36,9 @@ const changeTree = (row: any) => {
min-height: calc(100vh - 180px);
width: 100%;
.left {
width: 350px;
width: 370px;
border-right: 1px #eeeeee solid;
margin: 10px;
margin: 10px 10px 0 0;
}
.right {
flex: 1;

View File

@ -1021,7 +1021,9 @@
type="primary"
@click="saveData"
:loading="loading"
:hasPermission="`link/Type:${id ? 'update' : 'add'}`"
:hasPermission="`link/Type:${
id !== ':id' ? 'update' : 'add'
}`"
>
保存
</PermissionButton>
@ -1219,7 +1221,9 @@ const saveData = async () => {
loading.value = true;
const resp: any =
id === ':id' ? await save(params) : await update({ ...params, id });
id === ':id'
? await save(params).catch(() => {})
: await update({ ...params, id }).catch(() => {});
loading.value = false;
if (resp?.status === 200) {
onlyMessage('操作成功', 'success');