Merge branch 'dev' of github.com:jetlinks/jetlinks-ui-vue into dev
This commit is contained in:
commit
0bef99ca88
|
@ -43,7 +43,7 @@ export const detail = (id: string) => server.get<ProductItem>(`/device-product/$
|
|||
* 产品分类
|
||||
* @param data 查询条件
|
||||
*/
|
||||
export const category = (data: any) => server.post('/device/category/_tree', data)
|
||||
export const category = (data: any) => server.get('/device/category/_tree?paging=false', data)
|
||||
|
||||
/**
|
||||
* 获取网关类型
|
||||
|
|
|
@ -42,9 +42,7 @@ import { getStreamingAggType } from '@/api/device/product'
|
|||
const props = defineProps({
|
||||
value: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
type: 'script',
|
||||
})
|
||||
default: () => ({})
|
||||
},
|
||||
name: {
|
||||
type: Array as PropType<(string| number)[]>,
|
||||
|
@ -89,7 +87,7 @@ const changeWindow = (val: boolean | string | number) => {
|
|||
props.value.window = {}
|
||||
}
|
||||
} else {
|
||||
delete props.value.type
|
||||
props.value.type = 'script'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<a-space align="end">
|
||||
<a-upload
|
||||
<j-space align="end">
|
||||
<j-upload
|
||||
v-model:fileList="modelValue.upload"
|
||||
name="file"
|
||||
:action="FILE_UPLOAD"
|
||||
|
@ -12,21 +12,22 @@
|
|||
:showUploadList="false"
|
||||
@change="uploadChange"
|
||||
>
|
||||
<a-button>
|
||||
<j-button>
|
||||
<template #icon><AIcon type="UploadOutlined" /></template>
|
||||
文件上传
|
||||
</a-button>
|
||||
</a-upload>
|
||||
</j-button>
|
||||
</j-upload>
|
||||
<div style="margin-left: 20px">
|
||||
<a-space>
|
||||
<j-space>
|
||||
下载模板
|
||||
<a @click="downFile('xlsx')">.xlsx</a>
|
||||
<a @click="downFile('csv')">.csv</a>
|
||||
</a-space>
|
||||
</j-space>
|
||||
</div>
|
||||
</a-space>
|
||||
</j-space>
|
||||
<div style="margin-top: 20px" v-if="importLoading">
|
||||
<a-badge v-if="flag" status="processing" text="进行中" />
|
||||
<a-badge v-else status="success" text="已完成" />
|
||||
<j-badge v-if="flag" status="processing" text="进行中" />
|
||||
<j-badge v-else status="success" text="已完成" />
|
||||
<span>总数量:{{ count }}</span>
|
||||
<p style="color: red">{{ errMessage }}</p>
|
||||
</div>
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
width="800px"
|
||||
:visible="true"
|
||||
title="导入"
|
||||
@ok="handleSave"
|
||||
@cancel="handleCancel"
|
||||
>
|
||||
<div style="margin-top: 10px">
|
||||
|
@ -44,6 +43,9 @@
|
|||
</j-row>
|
||||
</j-form>
|
||||
</div>
|
||||
<template #footer>
|
||||
<j-button type="primary" @click="handleSave">关闭</j-button>
|
||||
</template>
|
||||
</j-modal>
|
||||
</template>
|
||||
|
||||
|
@ -100,6 +102,7 @@ const handleCancel = () => {
|
|||
};
|
||||
|
||||
const handleSave = () => {
|
||||
emit('close');
|
||||
emit('save');
|
||||
};
|
||||
</script>
|
|
@ -193,6 +193,8 @@ watch(
|
|||
}
|
||||
});
|
||||
Object.assign(modelRef, newValue);
|
||||
// description 和 describe 处理
|
||||
modelRef.describe = newValue?.describe || newValue?.description
|
||||
},
|
||||
{ immediate: true, deep: true },
|
||||
);
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
type="primary"
|
||||
:popConfirm="{
|
||||
title: `确定应用配置?`,
|
||||
onConfirm: handleConfig,
|
||||
onConfirm: handleDeploy,
|
||||
}"
|
||||
:disabled="productStore.current?.state === 0"
|
||||
:tooltip="
|
||||
|
|
|
@ -68,7 +68,11 @@
|
|||
:tree-data="treeList"
|
||||
@change="valueChange"
|
||||
allow-clear
|
||||
:fieldNames="{ label: 'name', value: 'id' }"
|
||||
:fieldNames="{
|
||||
label: 'name',
|
||||
value: 'id',
|
||||
children: 'children',
|
||||
}"
|
||||
:filterTreeNode="
|
||||
(v, option) => filterSelectNode(v, option)
|
||||
"
|
||||
|
@ -120,11 +124,7 @@ import { FILE_UPLOAD } from '@/api/comm';
|
|||
import { isInput } from '@/utils/regular';
|
||||
import type { Rule } from 'ant-design-vue/es/form';
|
||||
import { queryProductId, addProduct, editProduct } from '@/api/device/product';
|
||||
import {
|
||||
SearchOutlined,
|
||||
CheckOutlined,
|
||||
DeleteOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
import encodeQuery from '@/utils/encodeQuery';
|
||||
const productStore = useProductStore();
|
||||
const emit = defineEmits(['success']);
|
||||
const props = defineProps({
|
||||
|
@ -246,14 +246,25 @@ const valueChange = (value: string, label: string) => {
|
|||
* 查询产品分类
|
||||
*/
|
||||
const queryProductTree = async () => {
|
||||
category({
|
||||
paging: false,
|
||||
}).then((resp) => {
|
||||
category(encodeQuery({ sorts: { sortIndex: 'asc' } })).then((resp) => {
|
||||
if (resp.status === 200) {
|
||||
treeList.value = resp.result;
|
||||
treeList.value = dealProductTree(treeList.value);
|
||||
}
|
||||
});
|
||||
};
|
||||
/**
|
||||
* 处理产品分类key
|
||||
*/
|
||||
const dealProductTree = (arr: any) => {
|
||||
return arr.map((element: any) => {
|
||||
element.key = element.id;
|
||||
if (element.children) {
|
||||
element.children = dealProductTree(element.children);
|
||||
}
|
||||
return element
|
||||
});
|
||||
};
|
||||
watch(
|
||||
() => props.isAdd,
|
||||
() => {
|
||||
|
@ -326,7 +337,7 @@ const submitData = () => {
|
|||
// 编辑
|
||||
form.classifiedId
|
||||
? form.classifiedId
|
||||
: (form.classifiedId = ''); // 产品分类不选传空字符串
|
||||
: (form.classifiedId = ''); // 产品分类不选传空字符串
|
||||
form.classifiedName
|
||||
? form.classifiedName
|
||||
: (form.classifiedName = '');
|
||||
|
|
|
@ -117,11 +117,16 @@ const routeChange = async (id: string) => {
|
|||
});
|
||||
}
|
||||
}
|
||||
watch(
|
||||
() => route.params.id,
|
||||
(id) => routeChange(id as string),
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
// watch(
|
||||
// () => route.params.id,
|
||||
// (id) => routeChange(id as string),
|
||||
// { immediate: true }
|
||||
// )
|
||||
|
||||
onMounted(() => {
|
||||
routeChange(route.params.id as string)
|
||||
})
|
||||
|
||||
watch(
|
||||
() => [props.visible, props.type],
|
||||
|
|
|
@ -110,9 +110,9 @@
|
|||
}"
|
||||
/>
|
||||
</template>
|
||||
<template #createTime="slotProps">
|
||||
<template #registryTime="slotProps">
|
||||
<span>{{
|
||||
dayjs(slotProps.createTime).format('YYYY-MM-DD HH:mm:ss')
|
||||
dayjs(slotProps.registryTime).format('YYYY-MM-DD HH:mm:ss')
|
||||
}}</span>
|
||||
</template>
|
||||
<template #action="slotProps">
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<PermissionButton
|
||||
type="primary"
|
||||
@click="add"
|
||||
hasPermission="device/Instance:add"
|
||||
hasPermission="rule-engine/Alarm/Configuration:add"
|
||||
>
|
||||
<template #icon
|
||||
><AIcon type="PlusOutlined"
|
||||
|
@ -82,7 +82,7 @@
|
|||
<PermissionButton
|
||||
:disabled="item.disabled"
|
||||
:popConfirm="item.popConfirm"
|
||||
:tooltip="{ ...item.tootip }"
|
||||
:tooltip="{ ...item.tooltip }"
|
||||
@click="item.onClick"
|
||||
:hasPermission="
|
||||
'rule-engine/Alarm/Configuration:' +
|
||||
|
|
|
@ -287,7 +287,7 @@ const orgCol = [
|
|||
},
|
||||
];
|
||||
|
||||
let params:any = ref({
|
||||
let params: any = ref({
|
||||
sorts: [{ name: 'alarmTime', order: 'desc' }],
|
||||
terms: [],
|
||||
});
|
||||
|
@ -369,7 +369,10 @@ const getActions = (
|
|||
key: 'solve',
|
||||
text: '告警处理',
|
||||
tooltip: {
|
||||
title: '告警处理',
|
||||
title:
|
||||
currentData.state?.value === 'normal'
|
||||
? '无告警'
|
||||
: '告警处理',
|
||||
},
|
||||
icon: 'ToolOutlined',
|
||||
onClick: () => {
|
||||
|
@ -432,14 +435,14 @@ const closeLog = () => {
|
|||
};
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.content-left{
|
||||
border-right: .2px solid rgba(0,0,0,0.2);
|
||||
.content-left {
|
||||
border-right: 0.2px solid rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
.content-right-title{
|
||||
.content-right-title {
|
||||
color: #666;
|
||||
font-size: 12px
|
||||
font-size: 12px;
|
||||
}
|
||||
.content-left-title{
|
||||
font-size: 18px
|
||||
.content-left-title {
|
||||
font-size: 18px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
placeholder="请输入时间"
|
||||
v-model:value="_value"
|
||||
:precision="3"
|
||||
:min="0"
|
||||
:min="0.001"
|
||||
:max="65535"
|
||||
>
|
||||
<template #addonAfter>
|
||||
|
@ -60,8 +60,8 @@ const unit = ref<'seconds' | 'minutes' | 'hours'>(
|
|||
watch(
|
||||
() => props.value,
|
||||
(newVal) => {
|
||||
_value.value = newVal?.time || 0
|
||||
unit.value = newVal?.unit || 'seconds'
|
||||
_value.value = newVal?.time || 0;
|
||||
unit.value = newVal?.unit || 'seconds';
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
|
@ -73,17 +73,21 @@ const onCancel = () => {
|
|||
emit('cancel');
|
||||
};
|
||||
const onOk = () => {
|
||||
if (unref(_value) || unref(_value) === 0) {
|
||||
if (unref(_value)) {
|
||||
emit(
|
||||
'save',
|
||||
{
|
||||
time: _value.value,
|
||||
unit: unit.value,
|
||||
},
|
||||
{
|
||||
name: `${_value.value} ${
|
||||
timeUnitEnum[unit.value]
|
||||
}后,执行后续动作`,
|
||||
},
|
||||
);
|
||||
} else {
|
||||
onlyMessage('请输入时间', 'error');
|
||||
}
|
||||
emit(
|
||||
'save',
|
||||
{
|
||||
time: _value.value,
|
||||
unit: unit.value,
|
||||
},
|
||||
{ name: `${_value.value} ${timeUnitEnum[unit.value]}后,执行后续动作` },
|
||||
);
|
||||
};
|
||||
</script>
|
|
@ -172,9 +172,8 @@ const handleClick = (_detail: any) => {
|
|||
};
|
||||
|
||||
watch(() => props.value?.[0]?.value, (newVal) => {
|
||||
console.log(newVal, '123')
|
||||
if(newVal){
|
||||
detail(newVal[0]?.value).then(resp => {
|
||||
detail(newVal).then(resp => {
|
||||
emit('change', resp.result);
|
||||
})
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ const handleItem = (data: any) => {
|
|||
valueType: data.valueType ? data.valueType.type : '-',
|
||||
format: data.valueType ? data.valueType.format : undefined,
|
||||
options: data.valueType ? data.valueType.elements : undefined,
|
||||
value: data.value,
|
||||
value: data?.value,
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -135,9 +135,9 @@ watch(
|
|||
options.value = newTag.map((item: any) => {
|
||||
return { label: item.name, value: item.id, ...item };
|
||||
});
|
||||
if (newVal && newVal[0] && newVal[0].name && newTag && newTag.length) {
|
||||
if (newVal && newVal[0] && newVal[0]?.name && newTag && newTag.length) {
|
||||
const names: string[] = [];
|
||||
const newTagList = newVal[0].value
|
||||
const newTagList = newVal[0]?.value
|
||||
.filter((valueItem: any) => {
|
||||
return newTag.some(
|
||||
(item: any) => valueItem.column === item.id,
|
||||
|
@ -151,8 +151,8 @@ watch(
|
|||
names.push(oldItem.name);
|
||||
return {
|
||||
...handleItem(oldItem),
|
||||
value: valueItem.value,
|
||||
type: valueItem.type,
|
||||
value: valueItem?.value,
|
||||
type: valueItem?.type,
|
||||
};
|
||||
}
|
||||
return valueItem;
|
||||
|
@ -169,12 +169,12 @@ watch(
|
|||
);
|
||||
|
||||
const onValueChange = () => {
|
||||
const _data = tagList.value.filter((item) => !!item.value);
|
||||
const _data = tagList.value.filter((item) => !!item?.value);
|
||||
const newValue = _data.map((item: any) => {
|
||||
return {
|
||||
column: item.id,
|
||||
type: item.type,
|
||||
value: item.value,
|
||||
type: item?.type,
|
||||
value: item?.value,
|
||||
};
|
||||
});
|
||||
emits('update:value', [{ value: newValue, name: '标签' }]);
|
||||
|
|
|
@ -77,10 +77,10 @@
|
|||
钉钉
|
||||
</span>
|
||||
向<span class="notify-text-highlight">{{
|
||||
options?.orgName || ''
|
||||
options?.sendTo || ''
|
||||
}}</span>
|
||||
<span class="notify-text-highlight">{{
|
||||
options?.sendTo || ''
|
||||
options?.orgName || ''
|
||||
}}</span>
|
||||
发送
|
||||
<span class="notify-text-highlight">
|
||||
|
@ -107,10 +107,10 @@
|
|||
微信
|
||||
</span>
|
||||
向<span class="notify-text-highlight">{{
|
||||
options?.orgName || ''
|
||||
options?.sendTo || ''
|
||||
}}</span>
|
||||
<span class="notify-text-highlight">{{
|
||||
options?.sendTo || ''
|
||||
options?.orgName || ''
|
||||
}}</span>
|
||||
<span class="notify-text-highlight">{{
|
||||
options?.tagName || ''
|
||||
|
|
|
@ -44,7 +44,12 @@
|
|||
v-else-if="getType(item) === 'link'"
|
||||
v-model:value="modelRef[item.id]"
|
||||
/>
|
||||
<BuildIn v-else :item="item" v-model:value="modelRef[item.id]" />
|
||||
<BuildIn
|
||||
v-else
|
||||
:item="item"
|
||||
v-model:value="modelRef[item.id]"
|
||||
@change="(val) => onChange(val, 'build-in')"
|
||||
/>
|
||||
</j-form-item>
|
||||
</j-form>
|
||||
</template>
|
||||
|
@ -79,7 +84,6 @@ const formRef = ref();
|
|||
const modelRef = reactive({});
|
||||
|
||||
watchEffect(() => {
|
||||
console.log(props?.value)
|
||||
Object.assign(modelRef, props?.value);
|
||||
});
|
||||
|
||||
|
@ -88,6 +92,9 @@ const getType = (item: any) => {
|
|||
};
|
||||
|
||||
const checkValue = (_rule: any, value: any, item: any) => {
|
||||
if(!value){
|
||||
return Promise.resolve();
|
||||
}
|
||||
const type = item.expands?.businessType || item?.type;
|
||||
if (type === 'file') {
|
||||
return Promise.resolve();
|
||||
|
@ -153,7 +160,7 @@ const checkValue = (_rule: any, value: any, item: any) => {
|
|||
if (
|
||||
props.notify.notifyType &&
|
||||
['sms', 'voice'].includes(props?.notify?.notifyType) &&
|
||||
value?.source !== 'relation'
|
||||
value?.source !== 'relation' && value?.value
|
||||
) {
|
||||
const reg = /^[1][3-9]\d{9}$/;
|
||||
if (!reg.test(value?.value)) {
|
||||
|
@ -173,6 +180,8 @@ const onChange = (val: any, type: any) => {
|
|||
emit('change', { tagName: val });
|
||||
} else if (type === 'user') {
|
||||
emit('change', { sendTo: val });
|
||||
} else if (type === 'build-in') {
|
||||
// emit('change', { sendTo: val });
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -16,12 +16,14 @@
|
|||
placeholder="请选择参数"
|
||||
style="width: calc(100% - 120px)"
|
||||
:fieldNames="{ label: 'name', value: 'id' }"
|
||||
@change="(val) => itemOnChange(undefined, val)"
|
||||
@change="(val, label) => itemOnChange(undefined, val, label)"
|
||||
>
|
||||
<template #title="{ fullName, description }">
|
||||
<j-space>
|
||||
{{ fullName }}
|
||||
<span style="color: grey; margin-left: 5px">{{ description }}</span>
|
||||
<span style="color: grey; margin-left: 5px">{{
|
||||
description
|
||||
}}</span>
|
||||
</j-space>
|
||||
</template>
|
||||
</j-tree-select>
|
||||
|
@ -84,7 +86,7 @@ const props = defineProps({
|
|||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['update:value']);
|
||||
const emit = defineEmits(['update:value', 'change']);
|
||||
|
||||
const source = computed(() => {
|
||||
return props.value?.source || 'fixed';
|
||||
|
@ -97,15 +99,18 @@ const sourceChange = (val: any) => {
|
|||
emit('update:value', {
|
||||
...props.value,
|
||||
source: val,
|
||||
value: undefined
|
||||
value: undefined,
|
||||
});
|
||||
};
|
||||
|
||||
const itemOnChange = (val: any, _upperKey?: string) => {
|
||||
const itemOnChange = (val: any, _upperKey?: string, label?: any) => {
|
||||
emit('update:value', {
|
||||
...props.value,
|
||||
value: val,
|
||||
upperKey: _upperKey
|
||||
upperKey: _upperKey,
|
||||
});
|
||||
emit('change', {
|
||||
sendTo: label?.[0] || val,
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -164,7 +169,7 @@ watch(
|
|||
watch(
|
||||
() => props.value.upperKey,
|
||||
(newVal) => {
|
||||
upperKey.value = newVal
|
||||
upperKey.value = newVal;
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue