Merge branch 'dev' of github.com:jetlinks/jetlinks-ui-vue into dev
This commit is contained in:
commit
8a811aad25
|
@ -5180,7 +5180,7 @@
|
||||||
"node_modules/jetlinks-ui-components": {
|
"node_modules/jetlinks-ui-components": {
|
||||||
"version": "1.0.5",
|
"version": "1.0.5",
|
||||||
"resolved": "http://47.108.170.157:9013/jetlinks-ui-components/-/jetlinks-ui-components-1.0.5.tgz",
|
"resolved": "http://47.108.170.157:9013/jetlinks-ui-components/-/jetlinks-ui-components-1.0.5.tgz",
|
||||||
"integrity": "sha512-u1jqTyBWHB+b/NOKimucxNMYxet6g9Hi/I30T1VNWGq+x/Gf2zjz8dJoxjUcLW+9t/yjG6opWUE8Z8NWQRp3Eg==",
|
"integrity": "sha512-zrMe/4PjtWNCQtlP6kNLA7hVyQ7ftPSgivQZp8TGcpbUMOU/IYyCLQ0+VoWcqEopTSt1zEzEazodR4EjEzv7pQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vueuse/core": "^9.12.0",
|
"@vueuse/core": "^9.12.0",
|
||||||
"ant-design-vue": "^3.2.15",
|
"ant-design-vue": "^3.2.15",
|
||||||
|
@ -8343,6 +8343,8 @@
|
||||||
},
|
},
|
||||||
"node_modules/npm/node_modules/debug/node_modules/ms": {
|
"node_modules/npm/node_modules/debug/node_modules/ms": {
|
||||||
"version": "2.1.2",
|
"version": "2.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||||
|
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
|
||||||
"inBundle": true,
|
"inBundle": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
@ -9913,6 +9915,8 @@
|
||||||
},
|
},
|
||||||
"node_modules/npm/node_modules/request/node_modules/form-data": {
|
"node_modules/npm/node_modules/request/node_modules/form-data": {
|
||||||
"version": "2.3.3",
|
"version": "2.3.3",
|
||||||
|
"resolved": "https://registry.jetlinks.cn/form-data/-/form-data-2.3.3.tgz",
|
||||||
|
"integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==",
|
||||||
"inBundle": true,
|
"inBundle": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -9926,6 +9930,8 @@
|
||||||
},
|
},
|
||||||
"node_modules/npm/node_modules/request/node_modules/tough-cookie": {
|
"node_modules/npm/node_modules/request/node_modules/tough-cookie": {
|
||||||
"version": "2.5.0",
|
"version": "2.5.0",
|
||||||
|
"resolved": "https://registry.jetlinks.cn/tough-cookie/-/tough-cookie-2.5.0.tgz",
|
||||||
|
"integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==",
|
||||||
"inBundle": true,
|
"inBundle": true,
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -10156,6 +10162,8 @@
|
||||||
},
|
},
|
||||||
"node_modules/npm/node_modules/string-width/node_modules/strip-ansi": {
|
"node_modules/npm/node_modules/string-width/node_modules/strip-ansi": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-4XaJ2zQdCzROZDivEVIDPkcQn8LMFSa8kj8Gxb/Lnwzv9A8VctNZ+lfivC/sV3ivW8ElJTERXZoPBRrZKkNKow==",
|
||||||
"inBundle": true,
|
"inBundle": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -17272,7 +17280,7 @@
|
||||||
"jetlinks-ui-components": {
|
"jetlinks-ui-components": {
|
||||||
"version": "1.0.5",
|
"version": "1.0.5",
|
||||||
"resolved": "http://47.108.170.157:9013/jetlinks-ui-components/-/jetlinks-ui-components-1.0.5.tgz",
|
"resolved": "http://47.108.170.157:9013/jetlinks-ui-components/-/jetlinks-ui-components-1.0.5.tgz",
|
||||||
"integrity": "sha512-u1jqTyBWHB+b/NOKimucxNMYxet6g9Hi/I30T1VNWGq+x/Gf2zjz8dJoxjUcLW+9t/yjG6opWUE8Z8NWQRp3Eg==",
|
"integrity": "sha512-zrMe/4PjtWNCQtlP6kNLA7hVyQ7ftPSgivQZp8TGcpbUMOU/IYyCLQ0+VoWcqEopTSt1zEzEazodR4EjEzv7pQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@vueuse/core": "^9.12.0",
|
"@vueuse/core": "^9.12.0",
|
||||||
"ant-design-vue": "^3.2.15",
|
"ant-design-vue": "^3.2.15",
|
||||||
|
@ -19672,6 +19680,8 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ms": {
|
"ms": {
|
||||||
"version": "2.1.2",
|
"version": "2.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||||
|
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
|
||||||
"bundled": true
|
"bundled": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20833,6 +20843,8 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"form-data": {
|
"form-data": {
|
||||||
"version": "2.3.3",
|
"version": "2.3.3",
|
||||||
|
"resolved": "https://registry.jetlinks.cn/form-data/-/form-data-2.3.3.tgz",
|
||||||
|
"integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"asynckit": "^0.4.0",
|
"asynckit": "^0.4.0",
|
||||||
|
@ -20842,6 +20854,8 @@
|
||||||
},
|
},
|
||||||
"tough-cookie": {
|
"tough-cookie": {
|
||||||
"version": "2.5.0",
|
"version": "2.5.0",
|
||||||
|
"resolved": "https://registry.jetlinks.cn/tough-cookie/-/tough-cookie-2.5.0.tgz",
|
||||||
|
"integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"psl": "^1.1.28",
|
"psl": "^1.1.28",
|
||||||
|
@ -20994,6 +21008,8 @@
|
||||||
},
|
},
|
||||||
"strip-ansi": {
|
"strip-ansi": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-4XaJ2zQdCzROZDivEVIDPkcQn8LMFSa8kj8Gxb/Lnwzv9A8VctNZ+lfivC/sV3ivW8ElJTERXZoPBRrZKkNKow==",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"ansi-regex": "^3.0.0"
|
"ansi-regex": "^3.0.0"
|
||||||
|
|
|
@ -42,7 +42,7 @@ export default {
|
||||||
// 不分页-列表
|
// 不分页-列表
|
||||||
queryListNoPaging: (data: any) => post(`/notifier/config/_query/no-paging?paging=false`, data),
|
queryListNoPaging: (data: any) => post(`/notifier/config/_query/no-paging?paging=false`, data),
|
||||||
//
|
//
|
||||||
queryDingTalkUsers: (id: string) => get<any>(`/notifier/dingtalk/corp/${id}/users?sorts[0].name='name'&sorts[0].order=asc`),
|
queryDingTalkUsers: (id: string) => get<any>(`/notifier/dingtalk/corp/${id}/users?sorts[0].name="name"&sorts[0].order=asc`),
|
||||||
//
|
//
|
||||||
queryWechatUsers: (id: string) => get<any>(`/notifier/wechat/corp/${id}/users?sorts[0].name='name'&sorts[0].order=asc`),
|
queryWechatUsers: (id: string) => get<any>(`/notifier/wechat/corp/${id}/users?sorts[0].name="name"&sorts[0].order=asc`),
|
||||||
}
|
}
|
|
@ -53,6 +53,7 @@
|
||||||
v-model:value="myValue"
|
v-model:value="myValue"
|
||||||
placeholder="请输入图片链接"
|
placeholder="请输入图片链接"
|
||||||
allowClear
|
allowClear
|
||||||
|
@change='inputChange'
|
||||||
>
|
>
|
||||||
<template #addonAfter>
|
<template #addonAfter>
|
||||||
<j-upload
|
<j-upload
|
||||||
|
@ -182,6 +183,7 @@ const handleFileChange = (info: UploadChangeParam<UploadFile<any>>) => {
|
||||||
const url = info.file.response?.result;
|
const url = info.file.response?.result;
|
||||||
myValue.value = url;
|
myValue.value = url;
|
||||||
emit('update:modelValue', url);
|
emit('update:modelValue', url);
|
||||||
|
emit('change', url);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -149,8 +149,8 @@ const columns = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '说明',
|
title: '说明',
|
||||||
dataIndex: 'describe',
|
dataIndex: 'description',
|
||||||
key: 'describe',
|
key: 'description',
|
||||||
search: {
|
search: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
},
|
},
|
||||||
|
|
|
@ -191,8 +191,8 @@ const columns = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '说明',
|
title: '说明',
|
||||||
dataIndex: 'describe',
|
dataIndex: 'description',
|
||||||
key: 'describe',
|
key: 'description',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '状态',
|
title: '状态',
|
||||||
|
|
|
@ -144,7 +144,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { queryNoPagingPost } from '@/api/device/product';
|
import { queryGatewayList, queryNoPagingPost } from '@/api/device/product';
|
||||||
import { queryTree } from '@/api/device/category';
|
import { queryTree } from '@/api/device/category';
|
||||||
import { message } from 'jetlinks-ui-components';
|
import { message } from 'jetlinks-ui-components';
|
||||||
import { ActionsType } from '@/views/device/Instance/typings';
|
import { ActionsType } from '@/views/device/Instance/typings';
|
||||||
|
@ -260,6 +260,26 @@ const columns = [
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: 'productId$product-info',
|
||||||
|
dataIndex: 'productId$product-info',
|
||||||
|
title: '接入方式',
|
||||||
|
hideInTable: true,
|
||||||
|
search: {
|
||||||
|
type: 'select',
|
||||||
|
options: () =>
|
||||||
|
new Promise((resolve) => {
|
||||||
|
queryGatewayList({}).then((resp: any) => {
|
||||||
|
resolve(
|
||||||
|
resp.result.map((item: any) => ({
|
||||||
|
label: item.name,
|
||||||
|
value: `accessId is ${item.id}`,
|
||||||
|
})),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
dataIndex: 'deviceType',
|
dataIndex: 'deviceType',
|
||||||
title: '设备类型',
|
title: '设备类型',
|
||||||
|
|
|
@ -1,21 +1,22 @@
|
||||||
|
<!-- 通知记录 -->
|
||||||
<template>
|
<template>
|
||||||
<j-modal v-model:visible="_vis" title="通知记录" :footer="null" width="70%">
|
<j-modal v-model:visible="_vis" title="通知记录" :footer="null" width="70%">
|
||||||
<pro-search
|
<pro-search type="simple" :columns="columns" @search="handleSearch" />
|
||||||
type="simple"
|
|
||||||
:columns="columns"
|
|
||||||
@search="handleSearch"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<JProTable
|
<JProTable
|
||||||
ref="instanceRef"
|
ref="logRef"
|
||||||
|
model="table"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:request="(e:any) => configApi.getHistory(e, data.id)"
|
:request="(e:any) => configApi.getHistory(e, data.id)"
|
||||||
:defaultParams="{
|
:defaultParams="{
|
||||||
|
pageSize: 5,
|
||||||
sorts: [{ name: 'notifyTime', order: 'desc' }],
|
sorts: [{ name: 'notifyTime', order: 'desc' }],
|
||||||
terms: [{ column: 'notifyType$IN', value: data.type }],
|
terms: [{ column: 'notifyType$IN', value: data.type }],
|
||||||
}"
|
}"
|
||||||
:params="params"
|
:params="params"
|
||||||
model="table"
|
:pagination="{
|
||||||
|
pageSizeOptions: ['5', '10', '20', '50', '100'],
|
||||||
|
}"
|
||||||
>
|
>
|
||||||
<template #notifyTime="slotProps">
|
<template #notifyTime="slotProps">
|
||||||
{{ moment(slotProps.notifyTime).format('YYYY-MM-DD HH:mm:ss') }}
|
{{ moment(slotProps.notifyTime).format('YYYY-MM-DD HH:mm:ss') }}
|
||||||
|
@ -127,9 +128,7 @@ const params = ref<Record<string, any>>({});
|
||||||
* @param params
|
* @param params
|
||||||
*/
|
*/
|
||||||
const handleSearch = (e: any) => {
|
const handleSearch = (e: any) => {
|
||||||
// console.log('handleSearch e:', e);
|
|
||||||
params.value = e;
|
params.value = e;
|
||||||
// console.log('params.value: ', params.value);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -169,5 +168,3 @@ const handleDetail = (e: any) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped></style>
|
|
||||||
|
|
|
@ -1,21 +1,22 @@
|
||||||
|
<!-- 通知记录 -->
|
||||||
<template>
|
<template>
|
||||||
<j-modal v-model:visible="_vis" title="通知记录" :footer="null" width="70%">
|
<j-modal v-model:visible="_vis" title="通知记录" :footer="null" width="70%">
|
||||||
<pro-search
|
<pro-search type="simple" :columns="columns" @search="handleSearch" />
|
||||||
type="simple"
|
|
||||||
:columns="columns"
|
|
||||||
@search="handleSearch"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<JProTable
|
<JProTable
|
||||||
ref="instanceRef"
|
ref="logRef"
|
||||||
|
model="table"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:request="(e:any) => templateApi.getHistory(e, data.id)"
|
:request="(e:any) => templateApi.getHistory(e, data.id)"
|
||||||
:defaultParams="{
|
:defaultParams="{
|
||||||
|
pageSize: 5,
|
||||||
sorts: [{ name: 'notifyTime', order: 'desc' }],
|
sorts: [{ name: 'notifyTime', order: 'desc' }],
|
||||||
terms: [{ column: 'notifyType$IN', value: data.type }],
|
terms: [{ column: 'notifyType$IN', value: data.type }],
|
||||||
}"
|
}"
|
||||||
:params="params"
|
:params="params"
|
||||||
model="table"
|
:pagination="{
|
||||||
|
pageSizeOptions: ['5', '10', '20', '50', '100'],
|
||||||
|
}"
|
||||||
>
|
>
|
||||||
<template #notifyTime="slotProps">
|
<template #notifyTime="slotProps">
|
||||||
{{ moment(slotProps.notifyTime).format('YYYY-MM-DD HH:mm:ss') }}
|
{{ moment(slotProps.notifyTime).format('YYYY-MM-DD HH:mm:ss') }}
|
||||||
|
@ -127,9 +128,7 @@ const params = ref<Record<string, any>>({});
|
||||||
* @param params
|
* @param params
|
||||||
*/
|
*/
|
||||||
const handleSearch = (e: any) => {
|
const handleSearch = (e: any) => {
|
||||||
// console.log('handleSearch e:', e);
|
|
||||||
params.value = e;
|
params.value = e;
|
||||||
// console.log('params.value: ', params.value);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -169,5 +168,3 @@ const handleDetail = (e: any) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped></style>
|
|
||||||
|
|
|
@ -13,20 +13,28 @@
|
||||||
import { useSceneStore } from '@/store/scene';
|
import { useSceneStore } from '@/store/scene';
|
||||||
import Action from '../action/index.vue';
|
import Action from '../action/index.vue';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import { ActionsType } from '@/views/rule-engine/Scene/typings';
|
|
||||||
|
|
||||||
const sceneStore = useSceneStore();
|
const sceneStore = useSceneStore();
|
||||||
const { data } = storeToRefs(sceneStore);
|
const { data } = storeToRefs(sceneStore);
|
||||||
|
|
||||||
const onActionAdd = (_data: any) => {
|
const onActionAdd = (_data: any) => {
|
||||||
if (data.value?.branches && _data) {
|
if (data.value?.branches && _data) {
|
||||||
data?.value.branches?.[0].then.push(_data)
|
const newThen = [...data.value.branches[0].then, _data];
|
||||||
console.log(data?.value.branches?.[0].then)
|
data.value.branches![0].then = newThen
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const onActionUpdate = (_data: ActionsType, type: boolean) => {
|
const onActionUpdate = (_data: any, type: boolean) => {
|
||||||
console.log(_data, type)
|
const indexOf = data.value.branches![0].then.findIndex(
|
||||||
|
(item) => item.parallel === type,
|
||||||
|
);
|
||||||
|
if (indexOf !== -1) {
|
||||||
|
if (_data?.actions?.length) {
|
||||||
|
data.value.branches![0].then[indexOf] = _data;
|
||||||
|
} else {
|
||||||
|
data.value.branches![0].then[indexOf].actions = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
@ok="onOk"
|
@ok="onOk"
|
||||||
:maskClosable="false"
|
:maskClosable="false"
|
||||||
>
|
>
|
||||||
<a-input-number
|
<j-input-number
|
||||||
style="max-width: 220px"
|
style="max-width: 220px"
|
||||||
placeholder="请输入时间"
|
placeholder="请输入时间"
|
||||||
v-model:value="_value"
|
v-model:value="_value"
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
:max="6535"
|
:max="6535"
|
||||||
>
|
>
|
||||||
<template #addonAfter>
|
<template #addonAfter>
|
||||||
<a-select
|
<j-select
|
||||||
:options="[
|
:options="[
|
||||||
{ label: '秒', value: 'seconds' },
|
{ label: '秒', value: 'seconds' },
|
||||||
{ label: '分', value: 'minutes' },
|
{ label: '分', value: 'minutes' },
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
v-model:value="unit"
|
v-model:value="unit"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</a-input-number>
|
</j-input-number>
|
||||||
</j-modal>
|
</j-modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<template>
|
<template>
|
||||||
<j-advanced-search
|
<pro-search
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
type="simple"
|
type="simple"
|
||||||
@search="handleSearch"
|
@search="handleSearch"
|
||||||
class="search"
|
class="search"
|
||||||
target="scene-trigger-device-product"
|
target="scene-trigger-device-product"
|
||||||
/>
|
/>
|
||||||
<a-divider style="margin: 0" />
|
<j-divider style="margin: 0" />
|
||||||
<j-pro-table
|
<j-pro-table
|
||||||
ref="actionRef"
|
ref="actionRef"
|
||||||
model="CARD"
|
model="CARD"
|
||||||
|
@ -48,16 +48,16 @@
|
||||||
</span>
|
</span>
|
||||||
</Ellipsis>
|
</Ellipsis>
|
||||||
</div>
|
</div>
|
||||||
<a-row>
|
<j-row>
|
||||||
<a-col :span="12">
|
<j-col :span="12">
|
||||||
<div class="card-item-content-text">设备类型</div>
|
<div class="card-item-content-text">设备类型</div>
|
||||||
<Ellipsis>{{ slotProps.deviceType?.text }}</Ellipsis>
|
<Ellipsis>{{ slotProps.deviceType?.text }}</Ellipsis>
|
||||||
</a-col>
|
</j-col>
|
||||||
<a-col :span="12">
|
<j-col :span="12">
|
||||||
<div class="card-item-content-text">接入方式</div>
|
<div class="card-item-content-text">接入方式</div>
|
||||||
<Ellipsis>{{ slotProps?.accessName || '未接入' }}</Ellipsis>
|
<Ellipsis>{{ slotProps?.accessName || '未接入' }}</Ellipsis>
|
||||||
</a-col>
|
</j-col>
|
||||||
</a-row>
|
</j-row>
|
||||||
</template>
|
</template>
|
||||||
</CardBox>
|
</CardBox>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -15,13 +15,16 @@
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<ParamsDropdown
|
<ParamsDropdown
|
||||||
icon="icon-canshu"
|
|
||||||
placeholder="请选择"
|
placeholder="请选择"
|
||||||
:options="[]"
|
:options="[]"
|
||||||
:tabsOptions="tabOptions"
|
:tabsOptions="tabOptions"
|
||||||
:metricOption="upperOptions(record.valueType)"
|
:metricOption="upperOptions(record.valueType)"
|
||||||
v-model:value="record.value"
|
v-model:value="record.value"
|
||||||
/>
|
>
|
||||||
|
<template v-slot="{label}">
|
||||||
|
<j-input :value="label" />
|
||||||
|
</template>
|
||||||
|
</ParamsDropdown>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<a-form :layout="'vertical'" ref="formRef" :model="modelRef">
|
<j-form :layout="'vertical'" ref="formRef" :model="modelRef">
|
||||||
<j-row>
|
<j-row>
|
||||||
<j-col :span="11">
|
<j-col :span="11">
|
||||||
<j-form-item
|
<j-form-item
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
</j-form-item>
|
</j-form-item>
|
||||||
</j-col>
|
</j-col>
|
||||||
</j-row>
|
</j-row>
|
||||||
</a-form>
|
</j-form>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<a-form :layout="'vertical'" ref="formRef" :model="modelRef">
|
<j-form :layout="'vertical'" ref="formRef" :model="modelRef">
|
||||||
<j-form-item
|
<j-form-item
|
||||||
:name="['message', 'messageType']"
|
:name="['message', 'messageType']"
|
||||||
label="动作类型"
|
label="动作类型"
|
||||||
|
@ -67,7 +67,7 @@
|
||||||
:builtInList="builtInList"
|
:builtInList="builtInList"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</a-form>
|
</j-form>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -211,6 +211,7 @@ watch(
|
||||||
watch(
|
watch(
|
||||||
() => props.values?.message,
|
() => props.values?.message,
|
||||||
(newVal) => {
|
(newVal) => {
|
||||||
|
console.log(newVal)
|
||||||
if (newVal?.messageType) {
|
if (newVal?.messageType) {
|
||||||
modelRef.message = newVal;
|
modelRef.message = newVal;
|
||||||
if (newVal.messageType === 'INVOKE_FUNCTION' && newVal.functionId) {
|
if (newVal.messageType === 'INVOKE_FUNCTION' && newVal.functionId) {
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<template>
|
<template>
|
||||||
<j-advanced-search
|
<pro-search
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
type="simple"
|
type="simple"
|
||||||
@search="handleSearch"
|
@search="handleSearch"
|
||||||
class="search"
|
class="search"
|
||||||
target="scene-trigger-device-device"
|
target="scene-trigger-device-device"
|
||||||
/>
|
/>
|
||||||
<a-divider style="margin: 0" />
|
<j-divider style="margin: 0" />
|
||||||
<j-pro-table
|
<j-pro-table
|
||||||
ref="actionRef"
|
ref="actionRef"
|
||||||
model="CARD"
|
model="CARD"
|
||||||
|
@ -153,7 +153,7 @@ const deviceQuery = (p: any) => {
|
||||||
if (props.value) {
|
if (props.value) {
|
||||||
sorts.push({
|
sorts.push({
|
||||||
name: 'id',
|
name: 'id',
|
||||||
value: props.value,
|
value: props.value[0]?.value,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
sorts.push({ name: 'createTime', order: 'desc' });
|
sorts.push({ name: 'createTime', order: 'desc' });
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<a-form :layout="'vertical'" ref="formRef" :model="modelRef">
|
<j-form :layout="'vertical'" ref="formRef" :model="modelRef">
|
||||||
<j-form-item
|
<j-form-item
|
||||||
name="selector"
|
name="selector"
|
||||||
label="选择方式"
|
label="选择方式"
|
||||||
|
@ -64,16 +64,16 @@
|
||||||
:fieldNames="{ label: 'name', value: 'id' }"
|
:fieldNames="{ label: 'name', value: 'id' }"
|
||||||
>
|
>
|
||||||
<template #title="{ name, description }">
|
<template #title="{ name, description }">
|
||||||
<a-space>
|
<j-space>
|
||||||
{{ name }}
|
{{ name }}
|
||||||
<span style="color: grey; margin-left: 5px">{{
|
<span style="color: grey; margin-left: 5px">{{
|
||||||
description
|
description
|
||||||
}}</span>
|
}}</span>
|
||||||
</a-space>
|
</j-space>
|
||||||
</template>
|
</template>
|
||||||
</j-tree-select>
|
</j-tree-select>
|
||||||
</j-form-item>
|
</j-form-item>
|
||||||
</a-form>
|
</j-form>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -19,17 +19,17 @@
|
||||||
v-if="data?.executor === 'alarm'"
|
v-if="data?.executor === 'alarm'"
|
||||||
>
|
>
|
||||||
<template v-if="data?.alarm?.mode === 'trigger'">
|
<template v-if="data?.alarm?.mode === 'trigger'">
|
||||||
满足条件后将触发<a-button
|
满足条件后将触发<j-button style="padding: 0;"
|
||||||
type="link"
|
type="link"
|
||||||
@click.stop="triggerVisible = true"
|
@click.stop="triggerVisible = true"
|
||||||
>关联此场景的告警</a-button
|
>关联此场景的告警</j-button
|
||||||
>
|
>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
满足条件后将解除<a-button
|
满足条件后将解除<j-button style="padding: 0;"
|
||||||
type="link"
|
type="link"
|
||||||
@click.stop="triggerVisible = true"
|
@click.stop="triggerVisible = true"
|
||||||
>关联此场景的告警</a-button
|
>关联此场景的告警</j-button
|
||||||
>
|
>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
@ -308,14 +308,14 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<a-button v-else @click="onAdd">点击配置执行动作</a-button>
|
<j-button v-else @click="onAdd">点击配置执行动作</j-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="item-number">{{ name + 1 }}</div>
|
<div class="item-number">{{ name + 1 }}</div>
|
||||||
<a-popconfirm title="确认删除?" @confirm="onDelete">
|
<j-popconfirm title="确认删除?" @confirm="onDelete">
|
||||||
<div class="item-delete">
|
<div class="item-delete">
|
||||||
<AIcon type="DeleteOutlined" />
|
<AIcon type="DeleteOutlined" />
|
||||||
</div>
|
</div>
|
||||||
</a-popconfirm>
|
</j-popconfirm>
|
||||||
</div>
|
</div>
|
||||||
<template v-if="!isLast && type === 'serial'">
|
<template v-if="!isLast && type === 'serial'">
|
||||||
<div class="actions-item-filter-warp">
|
<div class="actions-item-filter-warp">
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<Device v-bind="props" :value="data?.device" @cancel="onCancel" @save="onPropsOk" :thenName="branchesName" />
|
<Device v-bind="props" :value="data?.device" @cancel="onCancel" @save="onPropsOk" :thenName="branchesName" />
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="actionType === 'notify'">
|
<template v-else-if="actionType === 'notify'">
|
||||||
<Notify v-bind="props" :value="data?.notify" @cancel="onCancel" @save="onPropsOk" />
|
<Notify :options="data?.options" :value="data?.notify" @cancel="onCancel" @save="onPropsOk" />
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="actionType === 'delay'">
|
<template v-else-if="actionType === 'delay'">
|
||||||
<Delay :value="data?.delay" @cancel="onCancel" @save="onPropsOk" />
|
<Delay :value="data?.delay" @cancel="onCancel" @save="onPropsOk" />
|
||||||
|
@ -55,7 +55,7 @@ const onPropsOk = (data: any, options: any) => {
|
||||||
type: props.actionType,
|
type: props.actionType,
|
||||||
executor: props.actionType,
|
executor: props.actionType,
|
||||||
key: props?.data?.key || `${props.actionType}_${new Date().getTime()}`,
|
key: props?.data?.key || `${props.actionType}_${new Date().getTime()}`,
|
||||||
device: {
|
[props.actionType]: {
|
||||||
...data,
|
...data,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
@ok="onOk"
|
@ok="onOk"
|
||||||
:maskClosable="false"
|
:maskClosable="false"
|
||||||
>
|
>
|
||||||
<a-form ref="actionForm" :model="formModel" layout="vertical">
|
<j-form ref="actionForm" :model="formModel" layout="vertical">
|
||||||
<a-form-item
|
<j-form-item
|
||||||
label="类型"
|
label="类型"
|
||||||
name="type"
|
name="type"
|
||||||
:rules="[
|
:rules="[
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
]"
|
]"
|
||||||
>
|
>
|
||||||
<CardSelect v-model:value="formModel.type" :options="options"/>
|
<CardSelect v-model:value="formModel.type" :options="options"/>
|
||||||
</a-form-item>
|
</j-form-item>
|
||||||
<ActionTypeComponent
|
<ActionTypeComponent
|
||||||
v-bind="props"
|
v-bind="props"
|
||||||
v-if="!!actionType"
|
v-if="!!actionType"
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
@save="onPropsOk"
|
@save="onPropsOk"
|
||||||
@cancel="onPropsCancel"
|
@cancel="onPropsCancel"
|
||||||
/>
|
/>
|
||||||
</a-form>
|
</j-form>
|
||||||
</j-modal>
|
</j-modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<j-advanced-search
|
<pro-search
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
type="simple"
|
type="simple"
|
||||||
target="action-notice-config"
|
target="action-notice-config"
|
||||||
|
@ -9,22 +9,7 @@
|
||||||
<div style="height: 400px; overflow-y: auto">
|
<div style="height: 400px; overflow-y: auto">
|
||||||
<JProTable
|
<JProTable
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:request="(e) => ConfigApi.list({
|
:request="query"
|
||||||
...e,
|
|
||||||
terms: [
|
|
||||||
...e?.terms,
|
|
||||||
{
|
|
||||||
terms: [
|
|
||||||
{
|
|
||||||
termType: 'eq',
|
|
||||||
column: 'type',
|
|
||||||
value: props.notifyType,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
sorts: [{ name: 'id', value: props.value }, { name: 'createTime', order: 'desc' }],
|
|
||||||
})"
|
|
||||||
model="CARD"
|
model="CARD"
|
||||||
:bodyStyle="{
|
:bodyStyle="{
|
||||||
paddingRight: 0,
|
paddingRight: 0,
|
||||||
|
@ -34,8 +19,8 @@
|
||||||
:gridColumn="2"
|
:gridColumn="2"
|
||||||
:rowSelection="{
|
:rowSelection="{
|
||||||
selectedRowKeys: _selectedRowKeys,
|
selectedRowKeys: _selectedRowKeys,
|
||||||
|
onChange: onSelectChange,
|
||||||
}"
|
}"
|
||||||
@cancelSelect="cancelSelect"
|
|
||||||
>
|
>
|
||||||
<template #card="slotProps">
|
<template #card="slotProps">
|
||||||
<CardBox
|
<CardBox
|
||||||
|
@ -63,22 +48,22 @@
|
||||||
{{ slotProps.name }}
|
{{ slotProps.name }}
|
||||||
</span>
|
</span>
|
||||||
</Ellipsis>
|
</Ellipsis>
|
||||||
<a-row>
|
<j-row>
|
||||||
<a-col :span="12">
|
<j-col :span="12">
|
||||||
<div class="card-item-content-text">
|
<div class="card-item-content-text">
|
||||||
通知方式
|
通知方式
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{{ getMethodTxt(slotProps.type) }}
|
{{ getMethodTxt(slotProps.type) }}
|
||||||
</div>
|
</div>
|
||||||
</a-col>
|
</j-col>
|
||||||
<a-col :span="12">
|
<j-col :span="12">
|
||||||
<div class="card-item-content-text">说明</div>
|
<div class="card-item-content-text">说明</div>
|
||||||
<Ellipsis>
|
<Ellipsis>
|
||||||
{{ slotProps.description }}
|
{{ slotProps.description }}
|
||||||
</Ellipsis>
|
</Ellipsis>
|
||||||
</a-col>
|
</j-col>
|
||||||
</a-row>
|
</j-row>
|
||||||
</template>
|
</template>
|
||||||
</CardBox>
|
</CardBox>
|
||||||
</template>
|
</template>
|
||||||
|
@ -100,7 +85,7 @@ const props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['update:value']);
|
const emit = defineEmits(['update:value', 'change']);
|
||||||
|
|
||||||
const getLogo = (type: string, provider: string) => {
|
const getLogo = (type: string, provider: string) => {
|
||||||
return MSG_TYPE[type].find((f: any) => f.value === provider)?.logo;
|
return MSG_TYPE[type].find((f: any) => f.value === provider)?.logo;
|
||||||
|
@ -140,17 +125,39 @@ const columns = [
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const query = (e: Record<string, any>) =>
|
||||||
|
ConfigApi.list({
|
||||||
|
...e,
|
||||||
|
terms: [
|
||||||
|
...e?.terms,
|
||||||
|
{
|
||||||
|
terms: [
|
||||||
|
{
|
||||||
|
termType: 'eq',
|
||||||
|
column: 'type',
|
||||||
|
value: props.notifyType,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
sorts: [
|
||||||
|
{ name: 'id', value: props.value },
|
||||||
|
{ name: 'createTime', order: 'desc' },
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
const handleSearch = (_params: any) => {
|
const handleSearch = (_params: any) => {
|
||||||
params.value = _params;
|
params.value = _params;
|
||||||
};
|
};
|
||||||
|
|
||||||
const cancelSelect = () => {
|
const onSelectChange = (keys: string[]) => {
|
||||||
_selectedRowKeys.value = [];
|
_selectedRowKeys.value = [...keys];
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleClick = (dt: any) => {
|
const handleClick = (dt: any) => {
|
||||||
_selectedRowKeys.value = [dt.id];
|
_selectedRowKeys.value = [dt.id];
|
||||||
emit('update:value', dt.id);
|
emit('update:value', dt.id);
|
||||||
|
emit('change', { provider: dt?.provider });
|
||||||
};
|
};
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
@ -176,7 +183,7 @@ watch(
|
||||||
padding-left: 0px;
|
padding-left: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.logo{
|
.logo {
|
||||||
width: 88px;
|
width: 88px;
|
||||||
height: 88px;
|
height: 88px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<j-advanced-search
|
<pro-search
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
type="simple"
|
type="simple"
|
||||||
target="action-notice-template"
|
target="action-notice-template"
|
||||||
|
@ -19,8 +19,8 @@
|
||||||
:gridColumn="2"
|
:gridColumn="2"
|
||||||
:rowSelection="{
|
:rowSelection="{
|
||||||
selectedRowKeys: _selectedRowKeys,
|
selectedRowKeys: _selectedRowKeys,
|
||||||
|
onChange: onSelectChange,
|
||||||
}"
|
}"
|
||||||
@cancelSelect="cancelSelect"
|
|
||||||
>
|
>
|
||||||
<template #card="slotProps">
|
<template #card="slotProps">
|
||||||
<CardBox
|
<CardBox
|
||||||
|
@ -48,22 +48,22 @@
|
||||||
{{ slotProps.name }}
|
{{ slotProps.name }}
|
||||||
</span>
|
</span>
|
||||||
</Ellipsis>
|
</Ellipsis>
|
||||||
<a-row>
|
<j-row>
|
||||||
<a-col :span="12">
|
<j-col :span="12">
|
||||||
<div class="card-item-content-text">
|
<div class="card-item-content-text">
|
||||||
通知方式
|
通知方式
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{{ getMethodTxt(slotProps.type) }}
|
{{ getMethodTxt(slotProps.type) }}
|
||||||
</div>
|
</div>
|
||||||
</a-col>
|
</j-col>
|
||||||
<a-col :span="12">
|
<j-col :span="12">
|
||||||
<div class="card-item-content-text">说明</div>
|
<div class="card-item-content-text">说明</div>
|
||||||
<Ellipsis>
|
<Ellipsis>
|
||||||
{{ slotProps.description }}
|
{{ slotProps.description }}
|
||||||
</Ellipsis>
|
</Ellipsis>
|
||||||
</a-col>
|
</j-col>
|
||||||
</a-row>
|
</j-row>
|
||||||
</template>
|
</template>
|
||||||
</CardBox>
|
</CardBox>
|
||||||
</template>
|
</template>
|
||||||
|
@ -85,7 +85,7 @@ const props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['update:value']);
|
const emit = defineEmits(['update:value', 'change']);
|
||||||
|
|
||||||
const getLogo = (type: string, provider: string) => {
|
const getLogo = (type: string, provider: string) => {
|
||||||
return MSG_TYPE[type].find((f: any) => f.value === provider)?.logo;
|
return MSG_TYPE[type].find((f: any) => f.value === provider)?.logo;
|
||||||
|
@ -129,13 +129,14 @@ const handleSearch = (_params: any) => {
|
||||||
params.value = _params;
|
params.value = _params;
|
||||||
};
|
};
|
||||||
|
|
||||||
const cancelSelect = () => {
|
|
||||||
_selectedRowKeys.value = [];
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleClick = (dt: any) => {
|
const handleClick = (dt: any) => {
|
||||||
_selectedRowKeys.value = [dt.id];
|
_selectedRowKeys.value = [dt.id];
|
||||||
emit('update:value', dt.id);
|
emit('update:value', dt.id);
|
||||||
|
emit('change', { templateName: dt?.name });
|
||||||
|
};
|
||||||
|
|
||||||
|
const onSelectChange = (keys: string[]) => {
|
||||||
|
_selectedRowKeys.value = [...keys];
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleData = async (e: any) => {
|
const handleData = async (e: any) => {
|
||||||
|
@ -178,8 +179,7 @@ watch(
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
.search {
|
.search {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
padding-right: 0px;
|
padding: 0;
|
||||||
padding-left: 0px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.logo {
|
.logo {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<a-spin :spinning="loading">
|
<j-spin :spinning="loading">
|
||||||
<div class="notify-type-warp" :class="{ disabled: disabled }">
|
<div class="notify-type-warp" :class="{ disabled: disabled }">
|
||||||
<div
|
<div
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
<div class="notify-type-item-title">{{item.label}}</div>
|
<div class="notify-type-item-title">{{item.label}}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a-spin>
|
</j-spin>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
@ -40,7 +40,7 @@ const props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['update:value']);
|
const emit = defineEmits(['update:value', 'change']);
|
||||||
|
|
||||||
const loading = ref<boolean>(false);
|
const loading = ref<boolean>(false);
|
||||||
const notifyType = ref('');
|
const notifyType = ref('');
|
||||||
|
@ -57,6 +57,7 @@ watch(
|
||||||
const onSelect = (val: string) => {
|
const onSelect = (val: string) => {
|
||||||
if (!props.disabled) {
|
if (!props.disabled) {
|
||||||
emit('update:value', val);
|
emit('update:value', val);
|
||||||
|
emit('change', val);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
<template>
|
<template>
|
||||||
<a-form
|
<j-form
|
||||||
v-if="variableDefinitions.length"
|
v-if="variableDefinitions.length"
|
||||||
:layout="'vertical'"
|
:layout="'vertical'"
|
||||||
ref="formRef"
|
ref="formRef"
|
||||||
:model="modelRef"
|
:model="modelRef"
|
||||||
>
|
>
|
||||||
<a-form-item
|
<j-form-item
|
||||||
:name="`${item?.id}`"
|
:name="`${item?.id}`"
|
||||||
:label="item?.name"
|
:label="item?.name"
|
||||||
v-for="item in variableDefinitions"
|
v-for="item in variableDefinitions"
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
:rules="[
|
:rules="[
|
||||||
{
|
{
|
||||||
validator: (_rule, value) => checkValue(_rule, value, item),
|
validator: (_rule, value) => checkValue(_rule, value, item),
|
||||||
trigger: 'change',
|
trigger: ['change', 'blur']
|
||||||
},
|
},
|
||||||
]"
|
]"
|
||||||
>
|
>
|
||||||
|
@ -27,23 +27,25 @@
|
||||||
:notify="notify"
|
:notify="notify"
|
||||||
v-else-if="getType(item) === 'org'"
|
v-else-if="getType(item) === 'org'"
|
||||||
v-model:value="modelRef[item.id]"
|
v-model:value="modelRef[item.id]"
|
||||||
|
@change="(val) => onChange(val, 'org')"
|
||||||
/>
|
/>
|
||||||
<Tag
|
<Tag
|
||||||
:notify="notify"
|
:notify="notify"
|
||||||
v-else-if="getType(item) === 'tag'"
|
v-else-if="getType(item) === 'tag'"
|
||||||
v-model:value="modelRef[item.id]"
|
v-model:value="modelRef[item.id]"
|
||||||
|
@change="(val) => onChange(val, 'tag')"
|
||||||
/>
|
/>
|
||||||
<InputFile
|
<InputFile
|
||||||
v-else-if="getType(item) === 'file'"
|
v-else-if="getType(item) === 'file'"
|
||||||
v-model:value="modelRef[item.id]"
|
v-model:value="modelRef[item.id]"
|
||||||
/>
|
/>
|
||||||
<a-input
|
<j-input
|
||||||
v-else-if="getType(item) === 'link'"
|
v-else-if="getType(item) === 'link'"
|
||||||
v-model:value="modelRef[item.id]"
|
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]" />
|
||||||
</a-form-item>
|
</j-form-item>
|
||||||
</a-form>
|
</j-form>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
@ -69,6 +71,8 @@ const props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits(['update:value', 'change']);
|
||||||
|
|
||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
|
|
||||||
const modelRef = reactive({});
|
const modelRef = reactive({});
|
||||||
|
@ -111,14 +115,14 @@ const checkValue = (_rule: any, value: any, item: any) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (value.source === 'fixed' && !value.value) {
|
} else if (value?.source === 'fixed' && !value.value) {
|
||||||
return Promise.reject(new Error('请输入' + item.name));
|
return Promise.reject(new Error('请输入' + item.name));
|
||||||
} else if (value.source === 'relation' && !value.value && !value.relation) {
|
} else if (value?.source === 'relation' && !value.value && !value.relation) {
|
||||||
return Promise.reject(new Error('请选择' + item.name));
|
return Promise.reject(new Error('请选择' + item.name));
|
||||||
} else if (value.source === 'upper' && !value.upperKey) {
|
} else if (value?.source === 'upper' && !value.upperKey) {
|
||||||
return Promise.reject(new Error('请选择' + item.name));
|
return Promise.reject(new Error('请选择' + item.name));
|
||||||
} else if (type === 'user') {
|
} else if (type === 'user') {
|
||||||
if (props.notify.notifyType === 'email') {
|
if (props.notify.notifyType === 'email' && value?.source !== 'relation') {
|
||||||
if (Array.isArray(value.value)) {
|
if (Array.isArray(value.value)) {
|
||||||
if (!value.value.length) {
|
if (!value.value.length) {
|
||||||
return Promise.reject(new Error('请输入收件人'));
|
return Promise.reject(new Error('请输入收件人'));
|
||||||
|
@ -139,7 +143,7 @@ const checkValue = (_rule: any, value: any, item: any) => {
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
props.notify.notifyType &&
|
props.notify.notifyType &&
|
||||||
['sms', 'voice'].includes(props?.notify?.notifyType)
|
['sms', 'voice'].includes(props?.notify?.notifyType) && value?.source !== 'relation'
|
||||||
) {
|
) {
|
||||||
const reg = /^[1][3-9]\d{9}$/;
|
const reg = /^[1][3-9]\d{9}$/;
|
||||||
if (!reg.test(value.value)) {
|
if (!reg.test(value.value)) {
|
||||||
|
@ -151,4 +155,21 @@ const checkValue = (_rule: any, value: any, item: any) => {
|
||||||
}
|
}
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onChange = (val: any, type: any) => {
|
||||||
|
if (type === 'org') {
|
||||||
|
emit('change', { orgName: val.join(',') });
|
||||||
|
} else if (type === 'tag') {
|
||||||
|
emit('change', { tagName: val });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const onSave = () =>
|
||||||
|
new Promise((resolve) => {
|
||||||
|
formRef.value.validate().then(async (_data: any) => {
|
||||||
|
resolve(_data);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
defineExpose({ onSave });
|
||||||
</script>
|
</script>
|
|
@ -8,17 +8,17 @@
|
||||||
:maskClosable="false"
|
:maskClosable="false"
|
||||||
>
|
>
|
||||||
<div class="steps-steps">
|
<div class="steps-steps">
|
||||||
<a-steps :current="current" size="small" @change="onChange">
|
<j-steps :current="current" size="small" @change="onChange">
|
||||||
<a-step title="通知方式" key="way" />
|
<j-step title="通知方式" key="way" />
|
||||||
<a-step title="通知配置" key="config" />
|
<j-step title="通知配置" key="config" />
|
||||||
<a-step title="通知模板" key="template" />
|
<j-step title="通知模板" key="template" />
|
||||||
<a-step title="模板变量" key="variable" />
|
<j-step title="模板变量" key="variable" />
|
||||||
</a-steps>
|
</j-steps>
|
||||||
</div>
|
</div>
|
||||||
<div class="steps-content">
|
<div class="steps-content">
|
||||||
<a-form ref="actionForm" :model="formModel" layout="vertical">
|
<j-form ref="actionForm" :model="formModel" layout="vertical">
|
||||||
<template v-if="current === 0">
|
<template v-if="current === 0">
|
||||||
<a-form-item
|
<j-form-item
|
||||||
label="应用"
|
label="应用"
|
||||||
name="notifyType"
|
name="notifyType"
|
||||||
:rules="[
|
:rules="[
|
||||||
|
@ -28,38 +28,45 @@
|
||||||
},
|
},
|
||||||
]"
|
]"
|
||||||
>
|
>
|
||||||
<NotifyWay v-model:value="formModel.notifyType" />
|
<NotifyWay
|
||||||
</a-form-item>
|
v-model:value="formModel.notifyType"
|
||||||
|
@change="(val) => onValChange(val, 'notifyType')"
|
||||||
|
/>
|
||||||
|
</j-form-item>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="current === 1">
|
<template v-if="current === 1">
|
||||||
<a-form-item name="notifierId">
|
<j-form-item name="notifierId">
|
||||||
<NotifyConfig
|
<NotifyConfig
|
||||||
v-model:value="formModel.notifierId"
|
v-model:value="formModel.notifierId"
|
||||||
:notifyType="formModel.notifyType"
|
:notifyType="formModel.notifyType"
|
||||||
|
@change="(val) => onValChange(val, 'notifierId')"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</j-form-item>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="current === 2">
|
<template v-if="current === 2">
|
||||||
<a-form-item name="templateId">
|
<j-form-item name="templateId">
|
||||||
<NotifyTemplate
|
<NotifyTemplate
|
||||||
v-model:value="formModel.templateId"
|
v-model:value="formModel.templateId"
|
||||||
:notifierId="formModel.notifierId"
|
:notifierId="formModel.notifierId"
|
||||||
|
@change="(val) => onValChange(val, 'templateId')"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</j-form-item>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="current === 3">
|
<template v-if="current === 3">
|
||||||
<a-form-item name="variables">
|
<j-form-item name="variables">
|
||||||
<VariableDefinitions
|
<VariableDefinitions
|
||||||
:variableDefinitions="variable"
|
:variableDefinitions="variable"
|
||||||
v-model:value="formModel.variables"
|
:value="formModel.variables"
|
||||||
:notify="formModel"
|
:notify="formModel"
|
||||||
|
@change="(val) => onValChange(val, 'variables')"
|
||||||
|
ref="variableRef"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</j-form-item>
|
||||||
</template>
|
</template>
|
||||||
</a-form>
|
</j-form>
|
||||||
</div>
|
</div>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<a-space>
|
<j-space>
|
||||||
<j-button v-if="current === 0" @click="onCancel">取消</j-button>
|
<j-button v-if="current === 0" @click="onCancel">取消</j-button>
|
||||||
<j-button v-if="current > 0" @click="prev">上一步</j-button>
|
<j-button v-if="current > 0" @click="prev">上一步</j-button>
|
||||||
<j-button v-if="current < 3" type="primary" @click="next"
|
<j-button v-if="current < 3" type="primary" @click="next"
|
||||||
|
@ -68,7 +75,7 @@
|
||||||
<j-button v-if="current === 3" type="primary" @click="onOk"
|
<j-button v-if="current === 3" type="primary" @click="onOk"
|
||||||
>确定</j-button
|
>确定</j-button
|
||||||
>
|
>
|
||||||
</a-space>
|
</j-space>
|
||||||
</template>
|
</template>
|
||||||
</j-modal>
|
</j-modal>
|
||||||
</template>
|
</template>
|
||||||
|
@ -90,6 +97,7 @@ const props = defineProps({
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
default: () => {},
|
||||||
},
|
},
|
||||||
name: {
|
name: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
@ -106,9 +114,11 @@ const formModel = reactive({
|
||||||
notifierId: '',
|
notifierId: '',
|
||||||
templateId: '',
|
templateId: '',
|
||||||
variables: {},
|
variables: {},
|
||||||
|
options: {},
|
||||||
});
|
});
|
||||||
|
|
||||||
const variable = ref([]);
|
const variable = ref([]);
|
||||||
|
const variableRef = ref();
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.value,
|
() => props.value,
|
||||||
|
@ -118,6 +128,27 @@ watch(
|
||||||
{ deep: true, immediate: true },
|
{ deep: true, immediate: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
|
watchEffect(() => {
|
||||||
|
formModel.options = props.options || {};
|
||||||
|
});
|
||||||
|
|
||||||
|
const onValChange = (val: any, type: string) => {
|
||||||
|
if (type === 'notifyType') {
|
||||||
|
formModel.templateId = '';
|
||||||
|
formModel.variables = [];
|
||||||
|
formModel.notifierId = '';
|
||||||
|
} else if (type === 'notifierId') {
|
||||||
|
formModel.templateId = '';
|
||||||
|
formModel.variables = [];
|
||||||
|
} else if (type === 'templateId') {
|
||||||
|
formModel.variables = [];
|
||||||
|
}
|
||||||
|
formModel.options = {
|
||||||
|
...unref(formModel.options),
|
||||||
|
...val,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
const jumpStep = async (val: number) => {
|
const jumpStep = async (val: number) => {
|
||||||
if (val === 0) {
|
if (val === 0) {
|
||||||
current.value = val;
|
current.value = val;
|
||||||
|
@ -134,7 +165,6 @@ const jumpStep = async (val: number) => {
|
||||||
onlyMessage('请选择通知配置', 'error');
|
onlyMessage('请选择通知配置', 'error');
|
||||||
}
|
}
|
||||||
} else if (val === 3) {
|
} else if (val === 3) {
|
||||||
formModel.templateId = '1628943618904956928';
|
|
||||||
if (formModel.templateId) {
|
if (formModel.templateId) {
|
||||||
const resp = await Template.getTemplateDetail(formModel.templateId);
|
const resp = await Template.getTemplateDetail(formModel.templateId);
|
||||||
if (resp.status === 200) {
|
if (resp.status === 200) {
|
||||||
|
@ -162,8 +192,11 @@ const next = async () => {
|
||||||
const onCancel = () => {
|
const onCancel = () => {
|
||||||
emit('cancel');
|
emit('cancel');
|
||||||
};
|
};
|
||||||
const onOk = () => {
|
const onOk = async () => {
|
||||||
emit('save');
|
const _data = await variableRef.value.onSave();
|
||||||
|
formModel.variables = _data;
|
||||||
|
const { options, ...extra } = formModel;
|
||||||
|
emit('save', { ...extra }, { ...options });
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<a-input-group compact>
|
<j-input-group compact>
|
||||||
<a-select
|
<j-select
|
||||||
:options="[
|
:options="[
|
||||||
{ label: '手动输入', value: 'fixed' },
|
{ label: '手动输入', value: 'fixed' },
|
||||||
{ label: '内置参数', value: 'upper' },
|
{ label: '内置参数', value: 'upper' },
|
||||||
|
@ -10,22 +10,22 @@
|
||||||
@change="sourceChange"
|
@change="sourceChange"
|
||||||
/>
|
/>
|
||||||
<template v-if="source === 'upper'">
|
<template v-if="source === 'upper'">
|
||||||
<a-tree-select
|
<j-tree-select
|
||||||
v-model:value="upperKey"
|
v-model:value="upperKey"
|
||||||
:treeData="builtInList"
|
:treeData="builtInList"
|
||||||
placeholder="请选择参数"
|
placeholder="请选择参数"
|
||||||
style="width: calc(100% - 120px)"
|
style="width: calc(100% - 120px)"
|
||||||
>
|
>
|
||||||
<template #title="{ name, description }">
|
<template #title="{ name, description }">
|
||||||
<a-space>
|
<j-space>
|
||||||
{{ name }}
|
{{ name }}
|
||||||
<span style="color: grey; margin-left: 5px">{{ description }}</span>
|
<span style="color: grey; margin-left: 5px">{{ description }}</span>
|
||||||
</a-space>
|
</j-space>
|
||||||
</template>
|
</template>
|
||||||
</a-tree-select>
|
</j-tree-select>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<a-date-picker
|
<j-date-picker
|
||||||
:value="value.value"
|
:value="value.value"
|
||||||
allowClear
|
allowClear
|
||||||
format="YYYY-MM-DD HH:mm:ss"
|
format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
v-if="item.type === 'date'"
|
v-if="item.type === 'date'"
|
||||||
@change="(_, dateString) => itemOnChange(dateString)"
|
@change="(_, dateString) => itemOnChange(dateString)"
|
||||||
/>
|
/>
|
||||||
<a-input-number
|
<j-input-number
|
||||||
:value="value.value"
|
:value="value.value"
|
||||||
allowClear
|
allowClear
|
||||||
style="width: calc(100% - 120px)"
|
style="width: calc(100% - 120px)"
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
:placeholder="`请输入${item.name}`"
|
:placeholder="`请输入${item.name}`"
|
||||||
@change="itemOnChange"
|
@change="itemOnChange"
|
||||||
/>
|
/>
|
||||||
<a-input
|
<j-input
|
||||||
:value="value.value"
|
:value="value.value"
|
||||||
allowClear
|
allowClear
|
||||||
style="width: calc(100% - 120px)"
|
style="width: calc(100% - 120px)"
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
@change="(e) => itemOnChange(e.target.value)"
|
@change="(e) => itemOnChange(e.target.value)"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</a-input-group>
|
</j-input-group>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<template>
|
<template>
|
||||||
<a-input
|
<j-input
|
||||||
allowClear
|
allowClear
|
||||||
placeholder="请上传文件"
|
placeholder="请上传文件"
|
||||||
v-model:value="url"
|
v-model:value="url"
|
||||||
@change="onChange"
|
@change="onChange"
|
||||||
>
|
>
|
||||||
<template #addonAfter>
|
<template #addonAfter>
|
||||||
<a-upload
|
<j-upload
|
||||||
name="file"
|
name="file"
|
||||||
:showUploadList="false"
|
:showUploadList="false"
|
||||||
:accept="'image/jpeg,image/png'"
|
:accept="'image/jpeg,image/png'"
|
||||||
|
@ -23,9 +23,9 @@
|
||||||
<AIcon type="PlusOutlined" v-else />
|
<AIcon type="PlusOutlined" v-else />
|
||||||
上传附件
|
上传附件
|
||||||
</j-button>
|
</j-button>
|
||||||
</a-upload>
|
</j-upload>
|
||||||
</template>
|
</template>
|
||||||
</a-input>
|
</j-input>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
|
|
@ -26,7 +26,7 @@ const props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['update:value']);
|
const emit = defineEmits(['update:value', 'change']);
|
||||||
|
|
||||||
const departmentTree = ref<any[]>([]);
|
const departmentTree = ref<any[]>([]);
|
||||||
const keys = ref<any[]>([]);
|
const keys = ref<any[]>([]);
|
||||||
|
@ -68,6 +68,7 @@ const onChange = (key: string[], label: string[]) => {
|
||||||
source: 'fixed',
|
source: 'fixed',
|
||||||
value: key,
|
value: key,
|
||||||
});
|
});
|
||||||
|
emit('change', label)
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -22,10 +22,10 @@ const props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['update:value']);
|
const emit = defineEmits(['update:value', 'change']);
|
||||||
|
|
||||||
const tagsList = ref<any[]>([]);
|
const tagsList = ref<any[]>([]);
|
||||||
const keys = ref<string>('');
|
const keys = ref<string | undefined>(undefined);
|
||||||
|
|
||||||
const getDepartment = async (id: string) => {
|
const getDepartment = async (id: string) => {
|
||||||
const resp = await TemplateApi.getTags(id);
|
const resp = await TemplateApi.getTags(id);
|
||||||
|
@ -37,9 +37,9 @@ const getDepartment = async (id: string) => {
|
||||||
watch(
|
watch(
|
||||||
() => props.value,
|
() => props.value,
|
||||||
(newVal) => {
|
(newVal) => {
|
||||||
keys.value = newVal || ''
|
keys.value = newVal || undefined
|
||||||
},
|
},
|
||||||
{ deep: true, immediate: true },
|
{ immediate: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
@ -52,12 +52,12 @@ watch(
|
||||||
{ deep: true, immediate: true },
|
{ deep: true, immediate: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
const onChange = (key: string, label: string[]) => {
|
const onChange = (key: string, option: any) => {
|
||||||
// TODO 回显label的问题
|
|
||||||
emit('update:value', {
|
emit('update:value', {
|
||||||
source: 'fixed',
|
source: 'fixed',
|
||||||
value: key,
|
value: key,
|
||||||
});
|
});
|
||||||
|
emit('change', option ? option?.label : '')
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -1,83 +1,87 @@
|
||||||
<template>
|
<template>
|
||||||
<a-input-group compact>
|
<j-input-group compact>
|
||||||
<a-select
|
<j-select
|
||||||
style="width: 120px"
|
style="width: 120px"
|
||||||
v-model:value="mySource"
|
v-model:value="mySource"
|
||||||
@change="sourceChange"
|
@change="sourceChange"
|
||||||
>
|
>
|
||||||
<a-select-option key="5" value="relation">
|
<j-select-option key="5" value="relation">
|
||||||
平台用户
|
平台用户
|
||||||
</a-select-option>
|
</j-select-option>
|
||||||
<a-select-option
|
<j-select-option
|
||||||
v-if="notifyType === 'dingTalk'"
|
v-if="notifyType === 'dingTalk'"
|
||||||
key="1"
|
key="1"
|
||||||
value="fixed"
|
value="fixed"
|
||||||
>
|
>
|
||||||
钉钉用户
|
钉钉用户
|
||||||
</a-select-option>
|
</j-select-option>
|
||||||
<a-select-option
|
<j-select-option
|
||||||
v-else-if="notifyType === 'weixin'"
|
v-else-if="notifyType === 'weixin'"
|
||||||
key="2"
|
key="2"
|
||||||
value="fixed"
|
value="fixed"
|
||||||
>
|
>
|
||||||
微信用户
|
微信用户
|
||||||
</a-select-option>
|
</j-select-option>
|
||||||
<a-select-option
|
<j-select-option
|
||||||
v-else-if="notifyType === 'email'"
|
v-else-if="notifyType === 'email'"
|
||||||
key="3"
|
key="3"
|
||||||
value="fixed"
|
value="fixed"
|
||||||
>
|
>
|
||||||
固定邮箱
|
固定邮箱
|
||||||
</a-select-option>
|
</j-select-option>
|
||||||
<a-select-option v-else key="4" value="fixed">
|
<j-select-option v-else key="4" value="fixed">
|
||||||
固定号码
|
固定号码
|
||||||
</a-select-option>
|
</j-select-option>
|
||||||
</a-select>
|
</j-select>
|
||||||
<a-tree-select
|
<j-tree-select
|
||||||
v-if="source === 'relation'"
|
v-if="source === 'relation'"
|
||||||
style="width: calc(100% - 120px)"
|
style="width: calc(100% - 120px)"
|
||||||
placeholder="请选择收信人"
|
placeholder="请选择收信人"
|
||||||
@select="treeSelect"
|
@select="(key, node) => onChange(source, key, false, node?.relation, node.name)"
|
||||||
:tree-data="treeData"
|
:tree-data="treeData"
|
||||||
|
:multiple="['email'].includes(notifyType)"
|
||||||
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
|
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
|
||||||
:value="relationData"
|
:value="relationData"
|
||||||
/>
|
|
||||||
<a-select
|
|
||||||
style="width: calc(100% - 120px)"
|
|
||||||
v-else-if="['dingTalk', 'weixin'].includes(notifyType)"
|
|
||||||
placeholder="请选择收信人"
|
|
||||||
:value="value?.value"
|
|
||||||
@change="(val) => onChange(val)"
|
|
||||||
>
|
>
|
||||||
<a-select-option
|
<template #title="{ key, username, title }">
|
||||||
v-for="item in relationList"
|
<div style="display: flex; justify-content: space-between; margin-right: 10px;" v-if="key !== 'p1' && key !== 'p2'">{{ title }} <span style="color: #cfcfcf;">{{ username }}</span></div>
|
||||||
:key="item.id"
|
<span v-else>{{ title }}</span>
|
||||||
:value="item.id"
|
</template>
|
||||||
>{{ item.name }}</a-select-option
|
</j-tree-select>
|
||||||
>
|
<template v-else>
|
||||||
</a-select>
|
<j-select
|
||||||
<a-input
|
style="width: calc(100% - 120px)"
|
||||||
style="width: calc(100% - 120px)"
|
v-if="['dingTalk', 'weixin'].includes(notifyType)"
|
||||||
v-else-if="['email'].includes(notifyType)"
|
placeholder="请选择收信人"
|
||||||
placeholder="请输入固定邮箱"
|
:value="value?.value"
|
||||||
:value="value?.value"
|
showSearch
|
||||||
:multiple="true"
|
@change="(val, option) => onChange(source, val, false, option?.label || option?.name)"
|
||||||
@change="(e) => onChange(e.target.value)"
|
:options="relationList"
|
||||||
></a-input>
|
/>
|
||||||
<a-input
|
<j-select
|
||||||
style="width: calc(100% - 120px)"
|
style="width: calc(100% - 120px)"
|
||||||
v-else-if="['sms', 'voice'].includes(notifyType)"
|
v-else-if="['email'].includes(notifyType)"
|
||||||
placeholder="请输入固定号码"
|
placeholder="请输入收件人邮箱,多个收件人用换行分隔"
|
||||||
:value="value?.value"
|
:value="value?.value"
|
||||||
@change="(e) => onChange(e.target.value)"
|
mode="tags"
|
||||||
></a-input>
|
@change="(val) => onChange(source, val, false, Array.isArray(val) ? val.join(',') : val)"
|
||||||
</a-input-group>
|
/>
|
||||||
|
<j-input
|
||||||
|
style="width: calc(100% - 120px)"
|
||||||
|
v-else-if="['sms', 'voice'].includes(notifyType)"
|
||||||
|
placeholder="请输入固定号码"
|
||||||
|
:value="value?.value"
|
||||||
|
@change="(e) => onChange(source, e.target.value, false, e.target.value)"
|
||||||
|
></j-input>
|
||||||
|
</template>
|
||||||
|
</j-input-group>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import { useSceneStore } from '@/store/scene';
|
import { useSceneStore } from '@/store/scene';
|
||||||
import NoticeApi from '@/api/notice/config';
|
import NoticeApi from '@/api/notice/config';
|
||||||
|
import { unionBy } from 'lodash-es';
|
||||||
|
|
||||||
const sceneStore = useSceneStore();
|
const sceneStore = useSceneStore();
|
||||||
const { data } = storeToRefs(sceneStore);
|
const { data } = storeToRefs(sceneStore);
|
||||||
|
@ -93,7 +97,7 @@ const props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['update:value']);
|
const emit = defineEmits(['update:value', 'change']);
|
||||||
|
|
||||||
const notifyType = computed(() => {
|
const notifyType = computed(() => {
|
||||||
return props.notify?.notifyType;
|
return props.notify?.notifyType;
|
||||||
|
@ -142,6 +146,7 @@ const treeData = ref<any[]>([
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
const mySource = ref<string>('relation');
|
const mySource = ref<string>('relation');
|
||||||
|
const labelMap = new Map();
|
||||||
|
|
||||||
const getRelationUsers = async (notifyType: string, notifierId: string) => {
|
const getRelationUsers = async (notifyType: string, notifierId: string) => {
|
||||||
let resp = undefined;
|
let resp = undefined;
|
||||||
|
@ -151,7 +156,12 @@ const getRelationUsers = async (notifyType: string, notifierId: string) => {
|
||||||
resp = await NoticeApi.queryWechatUsers(notifierId);
|
resp = await NoticeApi.queryWechatUsers(notifierId);
|
||||||
}
|
}
|
||||||
if (resp && resp.status === 200) {
|
if (resp && resp.status === 200) {
|
||||||
relationList.value = resp.result;
|
relationList.value = unionBy(resp.result, 'id').map((item: any) => {
|
||||||
|
return {
|
||||||
|
value: item.id,
|
||||||
|
label: item.name,
|
||||||
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -206,43 +216,72 @@ const getUser = async (_source: string, triggerType: string) => {
|
||||||
treeData.value = newTree;
|
treeData.value = newTree;
|
||||||
};
|
};
|
||||||
|
|
||||||
const treeSelect = (val: string, _data: any) => {
|
|
||||||
const obj = {
|
|
||||||
source: source.value,
|
|
||||||
relation: {}
|
|
||||||
};
|
|
||||||
if (_data?.isRelation) {
|
|
||||||
obj.relation = {
|
|
||||||
objectType: 'device',
|
|
||||||
objectSource: {
|
|
||||||
source: 'upper',
|
|
||||||
upperKey: 'scene.deviceId',
|
|
||||||
},
|
|
||||||
related: {
|
|
||||||
objectType: 'user',
|
|
||||||
relation: val,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
obj.relation = {
|
|
||||||
objectType: 'user',
|
|
||||||
objectId: val,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
emit('update:value', obj);
|
|
||||||
};
|
|
||||||
|
|
||||||
const sourceChange = (v: any) => {
|
const sourceChange = (v: any) => {
|
||||||
emit('update:value', {
|
emit('update:value', {
|
||||||
source: v,
|
source: v,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const onChange = (val: any) => {
|
const getObj = (
|
||||||
emit('update:value', {
|
_source: string = 'fixed',
|
||||||
source: source.value,
|
_value?: string | string[],
|
||||||
value: val,
|
isRelation?: boolean,
|
||||||
});
|
) => {
|
||||||
|
const obj: any = {
|
||||||
|
source: _source,
|
||||||
|
};
|
||||||
|
if (_source === 'relation') {
|
||||||
|
if (isRelation) {
|
||||||
|
obj.relation = {
|
||||||
|
objectType: 'device',
|
||||||
|
objectSource: {
|
||||||
|
source: 'upper',
|
||||||
|
upperKey: 'deviceId',
|
||||||
|
},
|
||||||
|
related: {
|
||||||
|
objectType: 'user',
|
||||||
|
relation: _value,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
obj.relation = {
|
||||||
|
objectType: 'user',
|
||||||
|
objectId: _value,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
obj.value = _value;
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
};
|
||||||
|
|
||||||
|
const onChange = (
|
||||||
|
_source: string = 'fixed',
|
||||||
|
_value?: string | string[],
|
||||||
|
isRelation?: boolean,
|
||||||
|
_name?: string,
|
||||||
|
) => {
|
||||||
|
let _values: any = undefined;
|
||||||
|
const _names: string[] = [_name || ''];
|
||||||
|
if (Array.isArray(_value)) {
|
||||||
|
if (props?.notify?.notifyType === 'email') {
|
||||||
|
if (isRelation) {
|
||||||
|
const arr = _value.map((item) => {
|
||||||
|
const _item = labelMap.get(item);
|
||||||
|
_names.push(_item?.name || '');
|
||||||
|
return getObj('relation', item, _item?.relation);
|
||||||
|
});
|
||||||
|
_values = arr;
|
||||||
|
} else {
|
||||||
|
_values = getObj(_source, _value, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
_values = getObj(_source, _value, isRelation);
|
||||||
|
}
|
||||||
|
console.log(_values, '_values')
|
||||||
|
emit('update:value', _values);
|
||||||
|
emit('change', { sendTo: _names.filter((item) => !!item).join(',') });
|
||||||
};
|
};
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="actions-warp">
|
<div class="actions-warp">
|
||||||
<a-collapse v-model:activeKey="activeKeys">
|
<j-collapse v-model:activeKey="activeKeys">
|
||||||
<a-collapse-panel key="1">
|
<j-collapse-panel key="1">
|
||||||
<template #header>
|
<template #header>
|
||||||
<span>
|
<span>
|
||||||
串行
|
串行
|
||||||
|
@ -27,11 +27,11 @@
|
||||||
serialArray.length ? serialArray[0].actions : []
|
serialArray.length ? serialArray[0].actions : []
|
||||||
"
|
"
|
||||||
@add="(_item) => onAdd(_item, false)"
|
@add="(_item) => onAdd(_item, false)"
|
||||||
@delete="onDelete"
|
@delete="(_key) => onDelete(_key, false)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</a-collapse-panel>
|
</j-collapse-panel>
|
||||||
<a-collapse-panel key="2">
|
<j-collapse-panel key="2">
|
||||||
<template #header>
|
<template #header>
|
||||||
<span>
|
<span>
|
||||||
并行
|
并行
|
||||||
|
@ -51,11 +51,11 @@
|
||||||
: []
|
: []
|
||||||
"
|
"
|
||||||
@add="(_item) => onAdd(_item, true)"
|
@add="(_item) => onAdd(_item, true)"
|
||||||
@delete="onDelete"
|
@delete="(_key) => onDelete(_key, true)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</a-collapse-panel>
|
</j-collapse-panel>
|
||||||
</a-collapse>
|
</j-collapse>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -98,8 +98,6 @@ watch(
|
||||||
parallelArray.value = newVal.filter((item) => item.parallel);
|
parallelArray.value = newVal.filter((item) => item.parallel);
|
||||||
serialArray.value = newVal.filter((item) => !item.parallel);
|
serialArray.value = newVal.filter((item) => !item.parallel);
|
||||||
|
|
||||||
console.log(parallelArray.value, serialArray.value, '123')
|
|
||||||
|
|
||||||
const isSerialActions = serialArray.value.some((item) => {
|
const isSerialActions = serialArray.value.some((item) => {
|
||||||
return !!item.actions.length;
|
return !!item.actions.length;
|
||||||
});
|
});
|
||||||
|
@ -121,28 +119,39 @@ watch(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const onDelete = (_key: string) => {
|
const onDelete = (_key: string, _parallel: boolean) => {
|
||||||
const aIndex = unref(serialArray)[0].actions?.findIndex(
|
const newArray = _parallel ? [...parallelArray.value] : [...serialArray.value];
|
||||||
|
const aIndex = newArray[0].actions?.findIndex(
|
||||||
(aItem) => aItem.key === _key,
|
(aItem) => aItem.key === _key,
|
||||||
);
|
);
|
||||||
if (aIndex !== -1) {
|
if (aIndex !== -1) {
|
||||||
serialArray.value[0].actions?.splice(aIndex, 1);
|
if(_parallel){
|
||||||
emit('update', serialArray[0], false);
|
parallelArray.value[0].actions?.splice(aIndex, 1);
|
||||||
|
emit('update', parallelArray.value[0], _parallel);
|
||||||
|
} else {
|
||||||
|
serialArray.value[0].actions?.splice(aIndex, 1);
|
||||||
|
emit('update', serialArray.value[0], _parallel);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const onAdd = (actionItem: any, _parallel: boolean) => {
|
const onAdd = (actionItem: any, _parallel: boolean) => {
|
||||||
const newParallelArray = [...parallelArray.value];
|
const newArray = _parallel ? [...parallelArray.value] : [...serialArray.value];
|
||||||
if (newParallelArray.length) {
|
if (newArray.length) {
|
||||||
const indexOf = newParallelArray[0].actions?.findIndex(
|
const indexOf = newArray[0].actions?.findIndex(
|
||||||
(aItem) => aItem.key === actionItem.key,
|
(aItem) => aItem.key === actionItem.key,
|
||||||
);
|
);
|
||||||
if (indexOf !== -1) {
|
if (indexOf !== -1) {
|
||||||
newParallelArray[0].actions.splice(indexOf, 1, actionItem);
|
newArray[0].actions.splice(indexOf, 1, actionItem);
|
||||||
} else {
|
} else {
|
||||||
newParallelArray[0].actions.push(actionItem);
|
newArray[0].actions.push(actionItem);
|
||||||
}
|
}
|
||||||
parallelArray.value = [...newParallelArray];
|
if(_parallel){
|
||||||
emit('update', newParallelArray[0], _parallel);
|
parallelArray.value = [...newArray];
|
||||||
|
} else {
|
||||||
|
serialArray.value = [...newArray];
|
||||||
|
}
|
||||||
|
emit('update', newArray[0], _parallel);
|
||||||
} else {
|
} else {
|
||||||
actionItem.key = randomString();
|
actionItem.key = randomString();
|
||||||
emit('add', {
|
emit('add', {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class='dropdown-time-picker'>
|
<div class='dropdown-time-picker'>
|
||||||
<j-time-picker
|
<j-time-picker
|
||||||
v-if='!_type'
|
v-if='type === "time"'
|
||||||
open
|
open
|
||||||
v-model:value='myValue'
|
v-model:value='myValue'
|
||||||
class='manual-time-picker'
|
class='manual-time-picker'
|
||||||
|
@ -59,9 +59,6 @@ const change = (e: Dayjs) => {
|
||||||
emit('change', e.format(myFormat))
|
emit('change', e.format(myFormat))
|
||||||
}
|
}
|
||||||
|
|
||||||
const _type = computed(() => {
|
|
||||||
return props.value?.includes('-')
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang='less'>
|
<style lang='less'>
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
<div class='select-box-content'>
|
<div class='select-box-content'>
|
||||||
<DropdownTimePicker
|
<DropdownTimePicker
|
||||||
v-if='["time","date"].includes(item.component)'
|
v-if='["time","date"].includes(item.component)'
|
||||||
:type='item.component'
|
type='time'
|
||||||
v-model:value='myValue'
|
v-model:value='myValue'
|
||||||
@change='timeChange'
|
@change='timeChange'
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="shakeLimit">
|
<div class="shakeLimit">
|
||||||
<a-switch
|
<j-switch
|
||||||
checkedChildren="开启防抖"
|
checkedChildren="开启防抖"
|
||||||
unCheckedChildren="关闭防抖"
|
unCheckedChildren="关闭防抖"
|
||||||
v-model:checked="shakeLimit.enabled"
|
v-model:checked="shakeLimit.enabled"
|
||||||
style="margin-right: 12px"
|
style="margin-right: 12px"
|
||||||
/>
|
/>
|
||||||
<template v-if="shakeLimit.enabled">
|
<template v-if="shakeLimit.enabled">
|
||||||
<a-input-number :min="1" :max="100" :precision="0" size="small" v-model:value="shakeLimit.time" style="width: 32px" />
|
<j-input-number :min="1" :max="100" :precision="0" size="small" v-model:value="shakeLimit.time" style="width: 32px" />
|
||||||
<span>秒内发送</span>
|
<span>秒内发送</span>
|
||||||
<a-input-number :min="1" :max="100" :precision="0" size="small" v-model:value="shakeLimit.threshold" style="width: 32px" />
|
<j-input-number :min="1" :max="100" :precision="0" size="small" v-model:value="shakeLimit.threshold" style="width: 32px" />
|
||||||
<span>次及以上时,处理</span>
|
<span>次及以上时,处理</span>
|
||||||
<a-radio-group :options="alarmFirstOptions" optionType="button" v-model:value="shakeLimit.alarmFirst" size="small" />
|
<j-radio-group :options="alarmFirstOptions" optionType="button" v-model:value="shakeLimit.alarmFirst" size="small" />
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -19,19 +19,23 @@
|
||||||
>
|
>
|
||||||
<j-popconfirm
|
<j-popconfirm
|
||||||
title='该操作将清空其它所有否则条件,确认删除?'
|
title='该操作将清空其它所有否则条件,确认删除?'
|
||||||
placement='topRight'
|
placement="topRight"
|
||||||
@confirm='onDeleteAll'
|
@confirm='onDeleteAll'
|
||||||
>
|
>
|
||||||
<AIcon type='CloseOutlined' v-show='showDelete' />
|
<div class='terms-params-delete' v-show='showDelete'>
|
||||||
|
<AIcon type='CloseOutlined' />
|
||||||
|
</div>
|
||||||
</j-popconfirm>
|
</j-popconfirm>
|
||||||
|
|
||||||
<div class='actions-terms-list-content'>
|
<div class='actions-terms-list-content'>
|
||||||
<template v-if='showWhen'>
|
<template v-if='showWhen'>
|
||||||
<TermsItem
|
<TermsItem
|
||||||
v-for='(item, index) in data.when'
|
v-for='(item, index) in whenData'
|
||||||
:key='item.key'
|
:key='item.key'
|
||||||
|
:name='index'
|
||||||
|
:showDeleteBtn='whenData.length !== 1'
|
||||||
:isFirst='index === 0'
|
:isFirst='index === 0'
|
||||||
:isLast='index === data.when.length -1'
|
:isLast='index === whenData.length -1'
|
||||||
:branchName='name'
|
:branchName='name'
|
||||||
:whenName='index'
|
:whenName='index'
|
||||||
:data='item'
|
:data='item'
|
||||||
|
@ -92,6 +96,10 @@ const showWhen = computed(() => {
|
||||||
return props.data.when.length
|
return props.data.when.length
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const whenData = computed(() => {
|
||||||
|
return props.data.when
|
||||||
|
})
|
||||||
|
|
||||||
const onDelete = () => {
|
const onDelete = () => {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -101,19 +109,36 @@ const onDeleteAll = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const mouseover = () => {
|
const mouseover = () => {
|
||||||
if (props.isFirst && props.data.when.length){
|
if (!props.isFirst){
|
||||||
showDelete.value = true
|
showDelete.value = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mouseout = () => {
|
const mouseout = () => {
|
||||||
if (props.isFirst && props.data.when.length){
|
if (!props.isFirst){
|
||||||
showDelete.value = false
|
showDelete.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const addWhen = () => {
|
const addWhen = () => {
|
||||||
|
const whenItem = {
|
||||||
|
key: `when_${new Date().getTime()}`,
|
||||||
|
type: 'and',
|
||||||
|
terms: [
|
||||||
|
{
|
||||||
|
column: undefined,
|
||||||
|
value: {
|
||||||
|
source: 'fixed',
|
||||||
|
value: undefined
|
||||||
|
},
|
||||||
|
termType: undefined,
|
||||||
|
key: 'params_1',
|
||||||
|
type: 'and',
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
FormModel.value.branches?.[props.name].when.push(whenItem)
|
||||||
|
FormModel.value.branches?.push(null)
|
||||||
}
|
}
|
||||||
|
|
||||||
const optionsClass = computed(() => {
|
const optionsClass = computed(() => {
|
||||||
|
|
|
@ -75,6 +75,11 @@ import { getOption } from '../DropdownButton/util'
|
||||||
import ParamsDropdown, { DoubleParamsDropdown } from '../ParamsDropdown'
|
import ParamsDropdown, { DoubleParamsDropdown } from '../ParamsDropdown'
|
||||||
import { inject } from 'vue'
|
import { inject } from 'vue'
|
||||||
import { ContextKey } from './util'
|
import { ContextKey } from './util'
|
||||||
|
import { useSceneStore } from 'store/scene'
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
|
const sceneStore = useSceneStore()
|
||||||
|
const { data: formModel } = storeToRefs(sceneStore)
|
||||||
|
|
||||||
type Emit = {
|
type Emit = {
|
||||||
(e: 'update:value', data: TermsType): void
|
(e: 'update:value', data: TermsType): void
|
||||||
|
@ -95,10 +100,26 @@ const props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
},
|
},
|
||||||
|
showDeleteBtn: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
name: {
|
name: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 0
|
default: 0
|
||||||
},
|
},
|
||||||
|
termsName: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
branchName: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
whenName: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
value: {
|
value: {
|
||||||
type: Object as PropType<TermsType>,
|
type: Object as PropType<TermsType>,
|
||||||
default: () => ({
|
default: () => ({
|
||||||
|
@ -176,13 +197,13 @@ const showDouble = computed(() => {
|
||||||
})
|
})
|
||||||
|
|
||||||
const mouseover = () => {
|
const mouseover = () => {
|
||||||
if (props.name !== 0){
|
if (props.showDeleteBtn){
|
||||||
showDelete.value = true
|
showDelete.value = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mouseout = () => {
|
const mouseout = () => {
|
||||||
if (props.name !== 0){
|
if (props.showDeleteBtn){
|
||||||
showDelete.value = false
|
showDelete.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -205,11 +226,21 @@ const termsTypeSelect = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const termAdd = () => {
|
const termAdd = () => {
|
||||||
|
const terms = {
|
||||||
|
column: undefined,
|
||||||
|
value: {
|
||||||
|
source: 'fixed',
|
||||||
|
value: undefined
|
||||||
|
},
|
||||||
|
termType: undefined,
|
||||||
|
type: 'and',
|
||||||
|
key: `params_${new Date().getTime()}`
|
||||||
|
}
|
||||||
|
formModel.value.branches?.[props.branchName]?.when?.[props.whenName]?.terms?.push(terms)
|
||||||
}
|
}
|
||||||
|
|
||||||
const onDelete = () => {
|
const onDelete = () => {
|
||||||
|
formModel.value.branches?.[props.branchName]?.when?.[props.whenName]?.terms?.splice(props.name, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
|
|
|
@ -97,7 +97,19 @@ const queryColumn = (dataModel: FormModelType) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const addBranches = () => {
|
const addBranches = () => {
|
||||||
|
const branchesItem = {
|
||||||
|
when: [],
|
||||||
|
key: `branches_${new Date().getTime()}`,
|
||||||
|
shakeLimit: {
|
||||||
|
enabled: false,
|
||||||
|
time: 1,
|
||||||
|
threshold: 1,
|
||||||
|
alarmFirst: false,
|
||||||
|
},
|
||||||
|
then: [],
|
||||||
|
}
|
||||||
|
const lastIndex = data.value.branches!.length - 1 || 0
|
||||||
|
data.value.branches?.splice(lastIndex, 1, branchesItem)
|
||||||
}
|
}
|
||||||
|
|
||||||
const branchesDelete = (index: number) => {
|
const branchesDelete = (index: number) => {
|
||||||
|
|
|
@ -26,21 +26,29 @@
|
||||||
</j-popconfirm>
|
</j-popconfirm>
|
||||||
|
|
||||||
<j-form-item
|
<j-form-item
|
||||||
v-for='(item, index) in data.terms'
|
v-for='(item, index) in termsData'
|
||||||
:key='item.key'
|
:key='item.key'
|
||||||
:name='["branches", branchName, "when", whenName, "terms", index]'
|
:name='["branches", branchName, "when", whenName, "terms", index]'
|
||||||
>
|
>
|
||||||
<ParamsItem
|
<ParamsItem
|
||||||
v-model:value='formModel.branches[branchName].when[whenName].terms[index]'
|
v-model:value='formModel.branches[branchName].when[whenName].terms[index]'
|
||||||
:isFirst='index === 0'
|
:isFirst='index === 0'
|
||||||
:isLast='index === data.terms.length - 1'
|
:isLast='index === termsData.length - 1'
|
||||||
|
:showDeleteBtn='termsData.length !== 1'
|
||||||
:name='index'
|
:name='index'
|
||||||
|
:termsName='name'
|
||||||
|
:whenName='whenName'
|
||||||
|
:branchName='branchName'
|
||||||
@change='paramsChange'
|
@change='paramsChange'
|
||||||
@delete='paramsDelete'
|
|
||||||
@add='paramsAdd'
|
|
||||||
/>
|
/>
|
||||||
</j-form-item>
|
</j-form-item>
|
||||||
</div>
|
</div>
|
||||||
|
<div class='terms-group-add' @click='addTerms' v-if='isLast'>
|
||||||
|
<div class='terms-content'>
|
||||||
|
<AIcon type='PlusOutlined' />
|
||||||
|
<span>分组</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -61,6 +69,14 @@ const props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
},
|
},
|
||||||
|
isLast: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
showDeleteBtn: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
data: {
|
data: {
|
||||||
type: Object as PropType<TermsType>,
|
type: Object as PropType<TermsType>,
|
||||||
default: () => ({
|
default: () => ({
|
||||||
|
@ -73,6 +89,10 @@ const props = defineProps({
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
},
|
},
|
||||||
|
name: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
branchName: {
|
branchName: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 0
|
default: 0
|
||||||
|
@ -85,36 +105,48 @@ const props = defineProps({
|
||||||
|
|
||||||
const showDelete = ref(false)
|
const showDelete = ref(false)
|
||||||
|
|
||||||
|
const termsData = computed(() => {
|
||||||
|
return props.data.terms
|
||||||
|
})
|
||||||
|
|
||||||
const mouseover = () => {
|
const mouseover = () => {
|
||||||
if (props.whenName !== 0){
|
if (props.showDeleteBtn){
|
||||||
showDelete.value = true
|
showDelete.value = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mouseout = () => {
|
const mouseout = () => {
|
||||||
if (props.whenName !== 0){
|
if (props.showDeleteBtn){
|
||||||
showDelete.value = false
|
showDelete.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const onDelete = () => {
|
const onDelete = () => {
|
||||||
|
formModel.value.branches?.[props.branchName]?.when?.splice(props.name, 1)
|
||||||
}
|
|
||||||
|
|
||||||
const onDeleteAll = () => {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const paramsChange = () => {
|
const paramsChange = () => {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const paramsDelete = () => {
|
const addTerms = () => {
|
||||||
|
const terms = {
|
||||||
}
|
type: 'and',
|
||||||
|
terms: [
|
||||||
const paramsAdd = () => {
|
{
|
||||||
|
column: undefined,
|
||||||
|
value: {
|
||||||
|
source: 'fixed',
|
||||||
|
value: undefined
|
||||||
|
},
|
||||||
|
termType: undefined,
|
||||||
|
key: 'params_1',
|
||||||
|
type: 'and',
|
||||||
|
}
|
||||||
|
],
|
||||||
|
key: `terms_${new Date().getTime()}`
|
||||||
|
}
|
||||||
|
formModel.value.branches?.[props.branchName]?.when?.push(terms)
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: -10px;
|
top: -10px;
|
||||||
right: -10px;
|
right: -10px;
|
||||||
display: none;
|
|
||||||
width: 20px;
|
width: 20px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
color: #999;
|
color: #999;
|
||||||
|
@ -37,7 +36,7 @@
|
||||||
.actions-terms {
|
.actions-terms {
|
||||||
.actions-terms-warp {
|
.actions-terms-warp {
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 66.66%;
|
//width: 66.66%;
|
||||||
margin-bottom: 24px;
|
margin-bottom: 24px;
|
||||||
|
|
||||||
&.first-children {
|
&.first-children {
|
||||||
|
|
Loading…
Reference in New Issue