Merge branch '2.0-bugfix' into dev
# Conflicts: # src/views/notice/Template/Detail/index.vue
11
README.md
|
@ -24,7 +24,16 @@ yarn add jetlinks-ui-components@latest
|
||||||
yarn dev:force
|
yarn dev:force
|
||||||
|
|
||||||
```
|
```
|
||||||
|
## Node
|
||||||
|
* node >= 18.14.0
|
||||||
|
|
||||||
|
## 浏览器兼容
|
||||||
|
* Chrome >= 100
|
||||||
|
* Firefox >= 100
|
||||||
|
* Edge >= 100
|
||||||
|
不支持IE
|
||||||
|
|
||||||
### 备注
|
### 备注
|
||||||
|
|
||||||
项目在开发模式下,首页加载慢属于正常现象;
|
* 项目在开发模式下,首页加载慢属于正常现象;
|
||||||
|
* 打开F12后页面卡顿是`vuetools`引起,[https://github.com/vuejs/devtools/issues/1987](https://github.com/vuejs/devtools/issues/1987)
|
|
@ -25,7 +25,7 @@
|
||||||
"event-source-polyfill": "^1.0.31",
|
"event-source-polyfill": "^1.0.31",
|
||||||
"global": "^4.4.0",
|
"global": "^4.4.0",
|
||||||
"jetlinks-store": "^0.0.3",
|
"jetlinks-store": "^0.0.3",
|
||||||
"jetlinks-ui-components": "^1.0.8",
|
"jetlinks-ui-components": "^1.0.9",
|
||||||
"js-cookie": "^3.0.1",
|
"js-cookie": "^3.0.1",
|
||||||
"less": "^4.1.3",
|
"less": "^4.1.3",
|
||||||
"less-loader": "^11.1.0",
|
"less-loader": "^11.1.0",
|
||||||
|
|
Before Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 416 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 5.9 KiB |
|
@ -146,8 +146,8 @@ const getBackgroundColor = (code: string | number) => {
|
||||||
const _color = color[code] || color.default;
|
const _color = color[code] || color.default;
|
||||||
return `linear-gradient(
|
return `linear-gradient(
|
||||||
188.4deg,
|
188.4deg,
|
||||||
rgba(${_color}, 0.03) 22.94%,
|
rgba(${_color}, 0.03) 30%,
|
||||||
rgba(${_color}, 0) 94.62%
|
rgba(${_color}, 0) 80%
|
||||||
)`;
|
)`;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -201,6 +201,7 @@ onUnmounted(() => {
|
||||||
if (ws.value) {
|
if (ws.value) {
|
||||||
ws.value.unsubscribe?.();
|
ws.value.unsubscribe?.();
|
||||||
}
|
}
|
||||||
|
clearAction()
|
||||||
})
|
})
|
||||||
|
|
||||||
const options = ref<{ label: string, value: string }[]>()
|
const options = ref<{ label: string, value: string }[]>()
|
||||||
|
|
|
@ -32,20 +32,14 @@ export const defaultBranches = [
|
||||||
{
|
{
|
||||||
terms: [
|
terms: [
|
||||||
{
|
{
|
||||||
terms: [
|
column: undefined,
|
||||||
{
|
value: {
|
||||||
column: undefined,
|
source: 'fixed',
|
||||||
value: {
|
value: undefined
|
||||||
source: 'fixed',
|
},
|
||||||
value: undefined
|
termType: undefined,
|
||||||
},
|
key: 'params_1',
|
||||||
termType: undefined,
|
|
||||||
key: 'params_1',
|
|
||||||
type: 'and',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
type: 'and',
|
type: 'and',
|
||||||
key: 'terms_1_terms_1',
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
type: 'and',
|
type: 'and',
|
||||||
|
@ -124,6 +118,7 @@ export const useSceneStore = defineStore('scene', () => {
|
||||||
branches.push(null);
|
branches.push(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log(branches)
|
||||||
data.value = {
|
data.value = {
|
||||||
...result,
|
...result,
|
||||||
trigger: result.trigger || {},
|
trigger: result.trigger || {},
|
||||||
|
|
|
@ -72,6 +72,13 @@
|
||||||
}"
|
}"
|
||||||
:params="params"
|
:params="params"
|
||||||
>
|
>
|
||||||
|
<template #completeTime="slotProps">
|
||||||
|
<span>{{
|
||||||
|
moment(slotProps.completeTime).format(
|
||||||
|
'YYYY-MM-DD HH:mm:ss',
|
||||||
|
)
|
||||||
|
}}</span>
|
||||||
|
</template>
|
||||||
<template #createTime="slotProps">
|
<template #createTime="slotProps">
|
||||||
<span>{{
|
<span>{{
|
||||||
moment(slotProps.createTime).format(
|
moment(slotProps.createTime).format(
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<j-input-search v-model:value="searchValue" placeholder="请输入名称" @search="handleSearch" allowClear></j-input-search>
|
<j-input-search v-model:value="searchValue" placeholder="请输入名称" @search="handleSearch" allowClear></j-input-search>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<PermissionButton type="primary" :uhas-permission="`${permission}:update`" key="add" @click="handleAddClick"
|
<PermissionButton type="primary" :hasPermission="`${permission}:update`" key="add" @click="handleAddClick"
|
||||||
:disabled="operateLimits('add', type)" :tooltip="{
|
:disabled="operateLimits('add', type)" :tooltip="{
|
||||||
title: operateLimits('add', type) ? '当前的存储方式不支持新增' : '新增',
|
title: operateLimits('add', type) ? '当前的存储方式不支持新增' : '新增',
|
||||||
}">
|
}">
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<j-tooltip :title="instanceStore.detail?.independentMetadata && type === 'device'
|
<j-tooltip :title="instanceStore.detail?.independentMetadata && type === 'device'
|
||||||
? '该设备已脱离产品物模型,修改产品物模型对该设备无影响'
|
? '该设备已脱离产品物模型,修改产品物模型对该设备无影响'
|
||||||
: '设备会默认继承产品的物模型,修改设备物模型后将脱离产品物模型'">
|
: '设备会默认继承产品的物模型,修改设备物模型后将脱离产品物模型'">
|
||||||
<div class="ellipsis">
|
<div class="ellipsis" style='color: #999;'>
|
||||||
<AIcon type="InfoCircleOutlined" style="margin-right: 3px" />
|
<AIcon type="InfoCircleOutlined" style="margin-right: 3px" />
|
||||||
{{
|
{{
|
||||||
instanceStore.detail?.independentMetadata && type === 'device'
|
instanceStore.detail?.independentMetadata && type === 'device'
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<div class="box-item">
|
<div class="box-item">
|
||||||
<div class="label">设备数量</div>
|
<div class="label">设备数量</div>
|
||||||
<div class="value">{{ deviceNum }}</div>
|
<div class="value">{{ deviceNum }}</div>
|
||||||
<img src="/images/home/Group3793.png" alt="" />
|
<img src="/images/home/top-1.png" alt="" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -287,14 +287,8 @@
|
||||||
</j-row>
|
</j-row>
|
||||||
</div>
|
</div>
|
||||||
<div :class="current !== 2 ? 'steps-action' : 'steps-action-save'">
|
<div :class="current !== 2 ? 'steps-action' : 'steps-action-save'">
|
||||||
<j-button
|
|
||||||
v-if="[0, 1].includes(current)"
|
<j-button v-if="current > 0" @click="prev" style="margin-right: 8px"> 上一步 </j-button>
|
||||||
type="primary"
|
|
||||||
style="margin-right: 8px"
|
|
||||||
@click="next"
|
|
||||||
>
|
|
||||||
下一步
|
|
||||||
</j-button>
|
|
||||||
<PermissionButton
|
<PermissionButton
|
||||||
v-if="current === 2 && view === 'false'"
|
v-if="current === 2 && view === 'false'"
|
||||||
type="primary"
|
type="primary"
|
||||||
|
@ -306,7 +300,14 @@
|
||||||
>
|
>
|
||||||
保存
|
保存
|
||||||
</PermissionButton>
|
</PermissionButton>
|
||||||
<j-button v-if="current > 0" @click="prev"> 上一步 </j-button>
|
<j-button
|
||||||
|
v-if="[0, 1].includes(current)"
|
||||||
|
type="primary"
|
||||||
|
|
||||||
|
@click="next"
|
||||||
|
>
|
||||||
|
下一步
|
||||||
|
</j-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -372,14 +372,7 @@
|
||||||
</j-row>
|
</j-row>
|
||||||
</div>
|
</div>
|
||||||
<div :class="current !== 2 ? 'steps-action' : 'steps-action-save'">
|
<div :class="current !== 2 ? 'steps-action' : 'steps-action-save'">
|
||||||
<j-button
|
<j-button v-if="current > 0" @click="prev" style="margin-right: 8px"> 上一步 </j-button>
|
||||||
v-if="[0, 1].includes(current)"
|
|
||||||
type="primary"
|
|
||||||
style="margin-right: 8px"
|
|
||||||
@click="next"
|
|
||||||
>
|
|
||||||
下一步
|
|
||||||
</j-button>
|
|
||||||
<PermissionButton
|
<PermissionButton
|
||||||
style="margin-right: 8px"
|
style="margin-right: 8px"
|
||||||
v-if="current === 2 && view === 'false'"
|
v-if="current === 2 && view === 'false'"
|
||||||
|
@ -391,7 +384,15 @@
|
||||||
>
|
>
|
||||||
保存
|
保存
|
||||||
</PermissionButton>
|
</PermissionButton>
|
||||||
<j-button v-if="current > 0" @click="prev"> 上一步 </j-button>
|
<j-button
|
||||||
|
v-if="[0, 1].includes(current)"
|
||||||
|
type="primary"
|
||||||
|
|
||||||
|
@click="next"
|
||||||
|
>
|
||||||
|
下一步
|
||||||
|
</j-button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -178,13 +178,7 @@
|
||||||
v-if="channel !== 'edge-child-device'"
|
v-if="channel !== 'edge-child-device'"
|
||||||
:class="current !== 1 ? 'steps-action' : 'steps-action-save'"
|
:class="current !== 1 ? 'steps-action' : 'steps-action-save'"
|
||||||
>
|
>
|
||||||
<j-button
|
<j-button v-if="current > 0" @click="prev" style="margin-right: 8px"> 上一步 </j-button>
|
||||||
v-if="[0].includes(current)"
|
|
||||||
style="margin-right: 8px"
|
|
||||||
@click="next"
|
|
||||||
>
|
|
||||||
下一步
|
|
||||||
</j-button>
|
|
||||||
<PermissionButton
|
<PermissionButton
|
||||||
v-if="current === 1 && view === 'false'"
|
v-if="current === 1 && view === 'false'"
|
||||||
type="primary"
|
type="primary"
|
||||||
|
@ -196,7 +190,13 @@
|
||||||
>
|
>
|
||||||
保存
|
保存
|
||||||
</PermissionButton>
|
</PermissionButton>
|
||||||
<j-button v-if="current > 0" @click="prev"> 上一步 </j-button>
|
<j-button
|
||||||
|
v-if="[0].includes(current)"
|
||||||
|
|
||||||
|
@click="next"
|
||||||
|
>
|
||||||
|
下一步
|
||||||
|
</j-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -279,12 +279,11 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="steps-action">
|
<div class="steps-action">
|
||||||
<j-button
|
<j-button
|
||||||
v-if="[0, 1].includes(current)"
|
v-if="type === 'child-device' ? current > 1 : current > 0"
|
||||||
type="primary"
|
style="margin-right: 8px"
|
||||||
style="margin-right: 8px"
|
@click="prev"
|
||||||
@click="next"
|
|
||||||
>
|
>
|
||||||
下一步
|
上一步
|
||||||
</j-button>
|
</j-button>
|
||||||
<PermissionButton
|
<PermissionButton
|
||||||
v-if="current === 2 && view === 'false'"
|
v-if="current === 2 && view === 'false'"
|
||||||
|
@ -299,10 +298,11 @@
|
||||||
保存
|
保存
|
||||||
</PermissionButton>
|
</PermissionButton>
|
||||||
<j-button
|
<j-button
|
||||||
v-if="type === 'child-device' ? current > 1 : current > 0"
|
v-if="[0, 1].includes(current)"
|
||||||
@click="prev"
|
type="primary"
|
||||||
|
@click="next"
|
||||||
>
|
>
|
||||||
上一步
|
下一步
|
||||||
</j-button>
|
</j-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -134,13 +134,13 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="steps-action">
|
<div class="steps-action">
|
||||||
<j-button
|
<j-button
|
||||||
v-if="current === 0"
|
v-if="current > 0"
|
||||||
type="primary"
|
@click="prev"
|
||||||
style="margin-right: 8px"
|
style="margin-right: 8px"
|
||||||
@click="next"
|
|
||||||
>
|
>
|
||||||
下一步
|
上一步
|
||||||
</j-button>
|
</j-button>
|
||||||
|
|
||||||
<PermissionButton
|
<PermissionButton
|
||||||
v-if="current === 1 && view === 'false'"
|
v-if="current === 1 && view === 'false'"
|
||||||
type="primary"
|
type="primary"
|
||||||
|
@ -154,10 +154,12 @@
|
||||||
保存
|
保存
|
||||||
</PermissionButton>
|
</PermissionButton>
|
||||||
<j-button
|
<j-button
|
||||||
v-if="current > 0"
|
v-if="current === 0"
|
||||||
@click="prev"
|
type="primary"
|
||||||
|
|
||||||
|
@click="next"
|
||||||
>
|
>
|
||||||
上一步
|
下一步
|
||||||
</j-button>
|
</j-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -76,8 +76,9 @@ const props = defineProps({
|
||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
img {
|
img {
|
||||||
width: 100%;
|
width: 100px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
transform: translateY(2px);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<div class="box-item">
|
<div class="box-item">
|
||||||
<div class="label">通道数量</div>
|
<div class="label">通道数量</div>
|
||||||
<div class="value">{{ channelCount }}</div>
|
<div class="value">{{ channelCount }}</div>
|
||||||
<img :src="getImage('/home/top-2.png')" alt="" />
|
<img :src="getImage('/home/product.png')" alt="" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1219,8 +1219,13 @@ const handleSubmit = () => {
|
||||||
delete formData.value.template.ttsmessage;
|
delete formData.value.template.ttsmessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (formData.value.provider === 'dingTalkRobotWebHook' && formData.value.template?.messageType === 'text') {
|
if (formData.value.provider === 'dingTalkRobotWebHook') {
|
||||||
formData.value.template.text!.content = formData.value.template.message as string
|
if (formData.value.template?.messageType === 'text') {
|
||||||
|
formData.value.template.text!.content = formData.value.template.message as string
|
||||||
|
}
|
||||||
|
if (formData.value.template.messageType === 'markdown') {
|
||||||
|
formData.value.template.markdown!.text = formData.value.template.message
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
formRef.value?.validate()
|
formRef.value?.validate()
|
||||||
|
|
|
@ -65,6 +65,7 @@ const columns = [
|
||||||
dataIndex: 'handleTime',
|
dataIndex: 'handleTime',
|
||||||
key: 'handleTime',
|
key: 'handleTime',
|
||||||
scopedSlots: true,
|
scopedSlots: true,
|
||||||
|
width: 180,
|
||||||
search: {
|
search: {
|
||||||
type: 'date',
|
type: 'date',
|
||||||
},
|
},
|
||||||
|
@ -74,6 +75,7 @@ const columns = [
|
||||||
title: '处理类型',
|
title: '处理类型',
|
||||||
key: 'handleType',
|
key: 'handleType',
|
||||||
scopedSlots: true,
|
scopedSlots: true,
|
||||||
|
width: 120,
|
||||||
search: {
|
search: {
|
||||||
type: 'select',
|
type: 'select',
|
||||||
options: [
|
options: [
|
||||||
|
@ -96,11 +98,13 @@ const columns = [
|
||||||
search: {
|
search: {
|
||||||
type: 'date',
|
type: 'date',
|
||||||
},
|
},
|
||||||
|
width:180,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '告警处理',
|
title: '告警处理',
|
||||||
dataIndex: 'description',
|
dataIndex: 'description',
|
||||||
key: 'description',
|
key: 'description',
|
||||||
|
ellipsis: true,
|
||||||
search: {
|
search: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
},
|
},
|
||||||
|
|
|
@ -120,7 +120,7 @@ const jumpDetail = (item:any) =>{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.new-alarm-item-level {
|
.new-alarm-item-level {
|
||||||
width: 52px;
|
width: 70px;
|
||||||
padding: 2px 8px;
|
padding: 2px 8px;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
|
@ -78,8 +78,8 @@ const props = defineProps({
|
||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
img {
|
img {
|
||||||
width: 100%;
|
width: 100px;
|
||||||
height: 100%;
|
height: 100px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.content-right-echart{
|
.content-right-echart{
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { cloneDeep } from 'lodash-es';
|
import { cloneDeep, isObject } from 'lodash-es'
|
||||||
import ParamsDropdown from '../../../components/ParamsDropdown';
|
import ParamsDropdown from '../../../components/ParamsDropdown';
|
||||||
import { handleParamsData } from './index';
|
import { handleParamsData } from './index';
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
@ -172,6 +172,7 @@ const onChange = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const onValueChange = (val: any, label: string) => {
|
const onValueChange = (val: any, label: string) => {
|
||||||
|
const optionColumn = isObject(val) && (val as any).metadata ? [(val as any).column] : []
|
||||||
const obj = {
|
const obj = {
|
||||||
[`${propertyModelRef.properties}`]: {
|
[`${propertyModelRef.properties}`]: {
|
||||||
value: propertyModelRef?.propertiesValue,
|
value: propertyModelRef?.propertiesValue,
|
||||||
|
@ -179,7 +180,7 @@ const onValueChange = (val: any, label: string) => {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
emit('update:value', obj);
|
emit('update:value', obj);
|
||||||
emit('change', label || val)
|
emit('change', label || val, optionColumn)
|
||||||
};
|
};
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
|
|
@ -298,7 +298,7 @@ watch(
|
||||||
{ immediate: true },
|
{ immediate: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
const onWriteChange = (val: string) => {
|
const onWriteChange = (val: string, optionColumn: string[]) => {
|
||||||
modelRef.propertiesValue = val;
|
modelRef.propertiesValue = val;
|
||||||
emit('change', {
|
emit('change', {
|
||||||
propertiesName:
|
propertiesName:
|
||||||
|
@ -306,7 +306,7 @@ const onWriteChange = (val: string) => {
|
||||||
? _function.value?.name
|
? _function.value?.name
|
||||||
: _property.value?.name,
|
: _property.value?.name,
|
||||||
propertiesValue: modelRef.propertiesValue,
|
propertiesValue: modelRef.propertiesValue,
|
||||||
});
|
}, optionColumn);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onFormSave = () => {
|
const onFormSave = () => {
|
||||||
|
|
|
@ -102,6 +102,10 @@ const props = defineProps({
|
||||||
parallel: {
|
parallel: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
},
|
},
|
||||||
|
options: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({})
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const current = ref<number>(0);
|
const current = ref<number>(0);
|
||||||
|
@ -125,6 +129,7 @@ const DeviceModel = reactive<DeviceModelType>({
|
||||||
const DeviceOptions = ref<DeviceOptionType>({});
|
const DeviceOptions = ref<DeviceOptionType>({});
|
||||||
|
|
||||||
const emit = defineEmits<Emit>();
|
const emit = defineEmits<Emit>();
|
||||||
|
const optionColumnCache = ref<string[]>(props.options?.otherColumn || [])
|
||||||
|
|
||||||
const onCancel = () => {
|
const onCancel = () => {
|
||||||
emit('cancel');
|
emit('cancel');
|
||||||
|
@ -150,6 +155,7 @@ const onSave = (_data: any) => {
|
||||||
selector: DeviceModel.selector, //选择器标识
|
selector: DeviceModel.selector, //选择器标识
|
||||||
triggerName: data.value.options?.trigger?.name || '触发设备',
|
triggerName: data.value.options?.trigger?.name || '触发设备',
|
||||||
...DeviceOptions.value,
|
...DeviceOptions.value,
|
||||||
|
otherColumns: []
|
||||||
};
|
};
|
||||||
const _type = _data.message.messageType;
|
const _type = _data.message.messageType;
|
||||||
if (_type === 'INVOKE_FUNCTION') {
|
if (_type === 'INVOKE_FUNCTION') {
|
||||||
|
@ -164,8 +170,9 @@ const onSave = (_data: any) => {
|
||||||
(typeof _options?.propertiesValue === 'object'
|
(typeof _options?.propertiesValue === 'object'
|
||||||
? JSON.stringify(_options?.propertiesValue)
|
? JSON.stringify(_options?.propertiesValue)
|
||||||
: _options?.propertiesValue)
|
: _options?.propertiesValue)
|
||||||
|
_options.otherColumns = optionColumnCache.value
|
||||||
}
|
}
|
||||||
console.log(item)
|
|
||||||
emit('save', item, JSON.parse(JSON.stringify(_options)));
|
emit('save', item, JSON.parse(JSON.stringify(_options)));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -195,7 +202,8 @@ const onDeviceSave = (_data: any, obj?: any) => {
|
||||||
DeviceOptions.value = { ...unref(DeviceOptions), ...obj };
|
DeviceOptions.value = { ...unref(DeviceOptions), ...obj };
|
||||||
};
|
};
|
||||||
|
|
||||||
const onActionsChange = (options?: any) => {
|
const onActionsChange = (options?: any, optionColumn: string[]) => {
|
||||||
|
optionColumnCache.value = optionColumn
|
||||||
const obj = {
|
const obj = {
|
||||||
...DeviceOptions.value,
|
...DeviceOptions.value,
|
||||||
...options,
|
...options,
|
||||||
|
|
|
@ -368,6 +368,7 @@
|
||||||
:branchGroup="thenName"
|
:branchGroup="thenName"
|
||||||
:branchesName="branchesName"
|
:branchesName="branchesName"
|
||||||
:data="data"
|
:data="data"
|
||||||
|
:options='_data.branches[branchesName].then[thenName].actions[name].options'
|
||||||
@cancel="onClose"
|
@cancel="onClose"
|
||||||
@save="onSave"
|
@save="onSave"
|
||||||
/>
|
/>
|
||||||
|
@ -377,6 +378,7 @@
|
||||||
v-bind="props"
|
v-bind="props"
|
||||||
v-if="!!actionType"
|
v-if="!!actionType"
|
||||||
:actionType="actionType"
|
:actionType="actionType"
|
||||||
|
:options='_data.branches[branchesName].then[thenName].actions[name].options'
|
||||||
@save="onPropsOk"
|
@save="onPropsOk"
|
||||||
@cancel="onPropsCancel"
|
@cancel="onPropsCancel"
|
||||||
/>
|
/>
|
||||||
|
@ -523,12 +525,17 @@ const onType = (_type: string) => {
|
||||||
const onSave = (data: ActionsType, options: any) => {
|
const onSave = (data: ActionsType, options: any) => {
|
||||||
const { key, terms } = _data.value.branches![props.branchesName].then?.[props.thenName].actions?.[props.name]
|
const { key, terms } = _data.value.branches![props.branchesName].then?.[props.thenName].actions?.[props.name]
|
||||||
console.log({...props.options, ...options})
|
console.log({...props.options, ...options})
|
||||||
|
|
||||||
|
const columns = new Set([...(props.options?.termsColumns || []), ...(options.otherColumns.filter((item?: string) => item))])
|
||||||
|
|
||||||
const actionItem: ActionsType = {
|
const actionItem: ActionsType = {
|
||||||
...data,
|
...data,
|
||||||
options: {...props.options, ...options},
|
options: {...props.options, ...options, columns: [...columns.values()]},
|
||||||
key,
|
key,
|
||||||
terms
|
terms
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(actionItem)
|
||||||
_data.value.branches![props.branchesName].then[props.thenName].actions.splice(props.name, 1, actionItem)
|
_data.value.branches![props.branchesName].then[props.thenName].actions.splice(props.name, 1, actionItem)
|
||||||
|
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
|
|
|
@ -82,7 +82,10 @@ const onSave = (data: any, options?: any) => {
|
||||||
const item: ActionsType = {
|
const item: ActionsType = {
|
||||||
...extra,
|
...extra,
|
||||||
key: data.key,
|
key: data.key,
|
||||||
options,
|
options: {
|
||||||
|
...options,
|
||||||
|
columns: options.otherColumns.filter((item?: string) => item)
|
||||||
|
},
|
||||||
};
|
};
|
||||||
emit('add', item)
|
emit('add', item)
|
||||||
visible.value = false
|
visible.value = false
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<template v-if="actionType === 'device'">
|
<template v-if="actionType === 'device'">
|
||||||
<Device v-bind="props" :value="data?.device" @cancel="onCancel" @save="onPropsOk" />
|
<Device v-bind="props" :value="data?.device" :options='options' @cancel="onCancel" @save="onPropsOk" />
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="actionType === 'notify'">
|
<template v-else-if="actionType === 'notify'">
|
||||||
<Notify :options="data?.options" :value="data?.notify" @cancel="onCancel" @save="onPropsOk" />
|
<Notify :options="data?.options" :value="data?.notify" @cancel="onCancel" @save="onPropsOk" />
|
||||||
|
@ -42,6 +42,10 @@ const props = defineProps({
|
||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
|
options: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({})
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['cancel', 'save']);
|
const emit = defineEmits(['cancel', 'save']);
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
v-bind="props"
|
v-bind="props"
|
||||||
v-if="!!actionType"
|
v-if="!!actionType"
|
||||||
:actionType="actionType"
|
:actionType="actionType"
|
||||||
|
:options='actionOptions'
|
||||||
@save="onPropsOk"
|
@save="onPropsOk"
|
||||||
@cancel="onPropsCancel"
|
@cancel="onPropsCancel"
|
||||||
/>
|
/>
|
||||||
|
@ -64,6 +65,10 @@ const props = defineProps({
|
||||||
parallel: {
|
parallel: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
},
|
},
|
||||||
|
actionOptions: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({})
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['cancel', 'save']);
|
const emit = defineEmits(['cancel', 'save']);
|
||||||
|
|
|
@ -8,13 +8,13 @@
|
||||||
<j-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, index) in variableDefinitions"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:required="getType(item) !== 'file' ? true : false"
|
:required="getType(item) !== 'file' ? true : false"
|
||||||
:rules="[
|
:rules="[
|
||||||
{
|
{
|
||||||
validator: (_rule, value) => checkValue(_rule, value, item),
|
validator: (_rule, value) => checkValue(_rule, value, item),
|
||||||
trigger: ['change', 'blur'],
|
trigger: ['blur', 'change'],
|
||||||
},
|
},
|
||||||
]"
|
]"
|
||||||
>
|
>
|
||||||
|
@ -22,19 +22,19 @@
|
||||||
:notify="notify"
|
:notify="notify"
|
||||||
v-if="getType(item) === 'user'"
|
v-if="getType(item) === 'user'"
|
||||||
v-model:value="modelRef[item.id]"
|
v-model:value="modelRef[item.id]"
|
||||||
@change="(val) => onChange(val, 'user')"
|
@change="(val) => onChange(val, 'user', index)"
|
||||||
/>
|
/>
|
||||||
<Org
|
<Org
|
||||||
: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')"
|
@change="(val) => onChange(val, 'org', index)"
|
||||||
/>
|
/>
|
||||||
<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')"
|
@change="(val) => onChange(val, 'tag', index)"
|
||||||
/>
|
/>
|
||||||
<InputFile
|
<InputFile
|
||||||
v-else-if="getType(item) === 'file'"
|
v-else-if="getType(item) === 'file'"
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
v-else
|
v-else
|
||||||
:item="item"
|
:item="item"
|
||||||
v-model:value="modelRef[item.id]"
|
v-model:value="modelRef[item.id]"
|
||||||
@change="(val) => onChange(val, 'build-in')"
|
@change="(val, _options) => onChange(val, 'build-in', index, _options)"
|
||||||
/>
|
/>
|
||||||
</j-form-item>
|
</j-form-item>
|
||||||
</j-form>
|
</j-form>
|
||||||
|
@ -70,16 +70,20 @@ const props = defineProps({
|
||||||
},
|
},
|
||||||
value: {
|
value: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {},
|
default: () => ({}),
|
||||||
},
|
},
|
||||||
notify: {
|
notify: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {},
|
default: () => ({}),
|
||||||
},
|
},
|
||||||
template: {
|
template: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {},
|
default: () => ({}),
|
||||||
},
|
},
|
||||||
|
options: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({})
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['update:value', 'change']);
|
const emit = defineEmits(['update:value', 'change']);
|
||||||
|
@ -87,15 +91,14 @@ const emit = defineEmits(['update:value', 'change']);
|
||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
|
|
||||||
const modelRef = reactive({});
|
const modelRef = reactive({});
|
||||||
|
const otherColumns = ref<(string | undefined)[]>(props.options?.otherColumns || [])
|
||||||
|
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
Object.assign(modelRef, props?.value);
|
Object.assign(modelRef, props?.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
if(props?.template?.template?.sendTo && props?.template?.template?.sendTo?.length){
|
emit('change', { sendTo: props?.template?.template?.sendTo?.join(' ') });
|
||||||
emit('change', { sendTo: props?.template?.template?.sendTo.join(' ') });
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const getType = (item: any) => {
|
const getType = (item: any) => {
|
||||||
|
@ -184,13 +187,21 @@ const checkValue = (_rule: any, value: any, item: any) => {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
};
|
};
|
||||||
|
|
||||||
const onChange = (val: any, type: any) => {
|
const onChange = (val: any, type: any, index: number, options?: string) => {
|
||||||
|
if (type === 'build-in') {
|
||||||
|
otherColumns.value[index] = options
|
||||||
|
} else {
|
||||||
|
otherColumns.value[index] = undefined
|
||||||
|
}
|
||||||
|
|
||||||
if (type === 'org') {
|
if (type === 'org') {
|
||||||
emit('change', { orgName: val.join(',') });
|
emit('change', { orgName: val.join(','), otherColumns: [] });
|
||||||
} else if (type === 'tag') {
|
} else if (type === 'tag') {
|
||||||
emit('change', { tagName: val });
|
emit('change', { tagName: val, otherColumns: [] });
|
||||||
} else if (type === 'user') {
|
} else if (type === 'user') {
|
||||||
emit('change', { sendTo: val });
|
emit('change', { sendTo: val, otherColumns: [] });
|
||||||
|
} else {
|
||||||
|
emit('change', { otherColumns: otherColumns.value });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,7 @@
|
||||||
:value="formModel.variables"
|
:value="formModel.variables"
|
||||||
:notify="formModel"
|
:notify="formModel"
|
||||||
:template="template"
|
:template="template"
|
||||||
|
:options='options'
|
||||||
@change="(val) => onValChange(val, 'variables')"
|
@change="(val) => onValChange(val, 'variables')"
|
||||||
ref="variableRef"
|
ref="variableRef"
|
||||||
/>
|
/>
|
||||||
|
@ -82,7 +83,7 @@
|
||||||
</j-modal>
|
</j-modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup name='NotifyIndex'>
|
||||||
import NotifyWay from './NotifyWay.vue';
|
import NotifyWay from './NotifyWay.vue';
|
||||||
import NotifyConfig from './NotifyConfig.vue';
|
import NotifyConfig from './NotifyConfig.vue';
|
||||||
import NotifyTemplate from './NotifyTemplate.vue';
|
import NotifyTemplate from './NotifyTemplate.vue';
|
||||||
|
@ -99,7 +100,7 @@ const props = defineProps({
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {},
|
default: () => ({}),
|
||||||
},
|
},
|
||||||
name: {
|
name: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
placeholder="请选择参数"
|
placeholder="请选择参数"
|
||||||
style="width: calc(100% - 120px)"
|
style="width: calc(100% - 120px)"
|
||||||
:fieldNames="{ label: 'name', value: 'id' }"
|
:fieldNames="{ label: 'name', value: 'id' }"
|
||||||
@change="(val, label) => itemOnChange(undefined, val, label)"
|
@change="(val, label, extra) => itemOnChange(undefined, val, label, extra)"
|
||||||
>
|
>
|
||||||
<template #title="{ fullName, description }">
|
<template #title="{ fullName, description }">
|
||||||
<j-space>
|
<j-space>
|
||||||
|
@ -57,7 +57,7 @@
|
||||||
</j-input-group>
|
</j-input-group>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup name='NotifyBuildIn'>
|
||||||
import { queryBuiltInParams } from '@/api/rule-engine/scene';
|
import { queryBuiltInParams } from '@/api/rule-engine/scene';
|
||||||
import { useSceneStore } from '@/store/scene';
|
import { useSceneStore } from '@/store/scene';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
|
@ -103,15 +103,22 @@ const sourceChange = (val: any) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const itemOnChange = (val: any, _upperKey?: string, label?: any) => {
|
const itemOnChange = (val: any, _upperKey?: string, label?: any, extra?: any) => {
|
||||||
|
const item = extra?.triggerNode?.props
|
||||||
|
let othersColumns = ''
|
||||||
|
if (item && item.metadata) {
|
||||||
|
othersColumns = item.column
|
||||||
|
}
|
||||||
|
|
||||||
emit('update:value', {
|
emit('update:value', {
|
||||||
...props.value,
|
...props.value,
|
||||||
value: val,
|
value: val,
|
||||||
upperKey: _upperKey,
|
upperKey: _upperKey,
|
||||||
});
|
});
|
||||||
|
|
||||||
emit('change', {
|
emit('change', {
|
||||||
sendTo: label?.[0] || val,
|
sendTo: label?.[0] || val,
|
||||||
});
|
}, othersColumns);
|
||||||
};
|
};
|
||||||
|
|
||||||
const treeDataFilter = (arr: any[], type: string) => {
|
const treeDataFilter = (arr: any[], type: string) => {
|
||||||
|
|
|
@ -65,8 +65,8 @@
|
||||||
v-else
|
v-else
|
||||||
style="width: calc(100% - 120px)"
|
style="width: calc(100% - 120px)"
|
||||||
placeholder="请选择收信人"
|
placeholder="请选择收信人"
|
||||||
@select="
|
@change="
|
||||||
(key, node) => onChange(source, key, node?.isRelation, node?.name)
|
(key, label) => onChange(source, key, undefined, label)
|
||||||
"
|
"
|
||||||
:tree-data="treeData"
|
:tree-data="treeData"
|
||||||
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
|
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
|
||||||
|
@ -209,6 +209,7 @@ const treeData = ref<any[]>([
|
||||||
]);
|
]);
|
||||||
const mySource = ref<string>('relation');
|
const mySource = ref<string>('relation');
|
||||||
const labelMap = new Map();
|
const labelMap = new Map();
|
||||||
|
const treeDataMap = new Map()
|
||||||
|
|
||||||
const getRelationUsers = async (notifyType: string, notifierId: string) => {
|
const getRelationUsers = async (notifyType: string, notifierId: string) => {
|
||||||
let resp = undefined;
|
let resp = undefined;
|
||||||
|
@ -250,6 +251,7 @@ const getUser = async (_source: string, triggerType: string) => {
|
||||||
}
|
}
|
||||||
if (platformResp.status === 200) {
|
if (platformResp.status === 200) {
|
||||||
newTree[0].children = platformResp.result.map((item: any) => {
|
newTree[0].children = platformResp.result.map((item: any) => {
|
||||||
|
treeDataMap.set(item.id, item)
|
||||||
return {
|
return {
|
||||||
...item,
|
...item,
|
||||||
value: item.id,
|
value: item.id,
|
||||||
|
@ -265,6 +267,7 @@ const getUser = async (_source: string, triggerType: string) => {
|
||||||
key: 'p2',
|
key: 'p2',
|
||||||
selectable: false,
|
selectable: false,
|
||||||
children: relationResp.result.map((item: any) => {
|
children: relationResp.result.map((item: any) => {
|
||||||
|
treeDataMap.set(item.id, item)
|
||||||
return {
|
return {
|
||||||
...item,
|
...item,
|
||||||
value: item.id,
|
value: item.id,
|
||||||
|
@ -324,6 +327,7 @@ const onChange = (
|
||||||
_name?: string,
|
_name?: string,
|
||||||
) => {
|
) => {
|
||||||
let _values: any = undefined;
|
let _values: any = undefined;
|
||||||
|
|
||||||
const _names: string[] = Array.isArray(_name) ? _name : [_name || ''];
|
const _names: string[] = Array.isArray(_name) ? _name : [_name || ''];
|
||||||
if (Array.isArray(_value)) {
|
if (Array.isArray(_value)) {
|
||||||
if (props?.notify?.notifyType === 'email') {
|
if (props?.notify?.notifyType === 'email') {
|
||||||
|
@ -339,7 +343,9 @@ const onChange = (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_values = getObj(_source, _value, isRelation);
|
const item = treeDataMap.get(_value)
|
||||||
|
const _isRelation = item.isRelation
|
||||||
|
_values = getObj(_source, _value, _isRelation);
|
||||||
}
|
}
|
||||||
emit('update:value', _values);
|
emit('update:value', _values);
|
||||||
emit('change', _names.filter((item) => !!item).join(','));
|
emit('change', _names.filter((item) => !!item).join(','));
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
:getPopupContainer='getPopupContainer'
|
:getPopupContainer='getPopupContainer'
|
||||||
popupClassName='manual-time-picker-popup'
|
popupClassName='manual-time-picker-popup'
|
||||||
@change='change'
|
@change='change'
|
||||||
|
@ok='change'
|
||||||
/>
|
/>
|
||||||
<j-date-picker
|
<j-date-picker
|
||||||
v-else
|
v-else
|
||||||
|
@ -21,6 +22,7 @@
|
||||||
:getPopupContainer='getPopupContainer'
|
:getPopupContainer='getPopupContainer'
|
||||||
popupClassName='manual-time-picker-popup'
|
popupClassName='manual-time-picker-popup'
|
||||||
@change='change'
|
@change='change'
|
||||||
|
@ok='change'
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -58,6 +60,7 @@ const getPopupContainer = (trigger: HTMLElement) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const change = (e: string) => {
|
const change = (e: string) => {
|
||||||
|
console.log('Time',e)
|
||||||
myValue.value = e
|
myValue.value = e
|
||||||
emit('update:value', e)
|
emit('update:value', e)
|
||||||
emit('change', e)
|
emit('change', e)
|
||||||
|
|
|
@ -163,7 +163,6 @@ watchEffect(() => {
|
||||||
const option = getOption(_options, props.value as string, props.valueName) // 回显label值
|
const option = getOption(_options, props.value as string, props.valueName) // 回显label值
|
||||||
myValue.value = props.value
|
myValue.value = props.value
|
||||||
mySource.value = props.source
|
mySource.value = props.source
|
||||||
console.log(_options, props.value, props.valueName, option)
|
|
||||||
if (option) {
|
if (option) {
|
||||||
label.value = option[props.labelName] || option.name
|
label.value = option[props.labelName] || option.name
|
||||||
treeOpenKeys.value = openKeysByTree(_options, props.value, props.valueName)
|
treeOpenKeys.value = openKeysByTree(_options, props.value, props.valueName)
|
||||||
|
@ -176,6 +175,8 @@ watchEffect(() => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang='less'>
|
<style scoped lang='less'>
|
||||||
|
|
|
@ -141,19 +141,13 @@ const addWhen = () => {
|
||||||
type: 'and',
|
type: 'and',
|
||||||
terms: [
|
terms: [
|
||||||
{
|
{
|
||||||
terms: [
|
column: undefined,
|
||||||
{
|
value: {
|
||||||
column: undefined,
|
source: 'fixed',
|
||||||
value: {
|
value: undefined
|
||||||
source: 'fixed',
|
},
|
||||||
value: undefined
|
termType: undefined,
|
||||||
},
|
key: `params_${randomString()}`,
|
||||||
termType: undefined,
|
|
||||||
key: `params_${randomString()}`,
|
|
||||||
type: 'and',
|
|
||||||
}
|
|
||||||
],
|
|
||||||
key: `terms_2_${randomString()}`,
|
|
||||||
type: 'and',
|
type: 'and',
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
|
@ -276,16 +276,24 @@ const columnSelect = (option: any) => {
|
||||||
} else if (termTypeChange) {
|
} else if (termTypeChange) {
|
||||||
const oldValue = isArray(paramsValue.value!.value) ? paramsValue.value!.value[0] : paramsValue.value!.value
|
const oldValue = isArray(paramsValue.value!.value) ? paramsValue.value!.value[0] : paramsValue.value!.value
|
||||||
const value = arrayParamsKey.includes(paramsValue.termType as string) ? [ oldValue, undefined ] : oldValue
|
const value = arrayParamsKey.includes(paramsValue.termType as string) ? [ oldValue, undefined ] : oldValue
|
||||||
paramsValue.value = {
|
|
||||||
source: paramsValue.value?.source || tabsOptions.value[0].key,
|
const _source = paramsValue.value?.source || tabsOptions.value[0].key
|
||||||
|
const newValue: any = {
|
||||||
|
source: _source,
|
||||||
value: value
|
value: value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_source === 'metric') {
|
||||||
|
newValue.metric = paramsValue.value?.metric
|
||||||
|
}
|
||||||
|
|
||||||
|
paramsValue.value = newValue
|
||||||
}
|
}
|
||||||
handOptionByColumn(option)
|
handOptionByColumn(option)
|
||||||
emit('update:value', { ...paramsValue })
|
emit('update:value', { ...paramsValue })
|
||||||
formItemContext.onFieldChange()
|
formItemContext.onFieldChange()
|
||||||
formModel.value.options!.when[props.branchName].terms[props.whenName].terms[props.name][0] = option.name
|
formModel.value.options!.when[props.branchName].terms[props.whenName].terms[props.termsName][0] = option.name
|
||||||
formModel.value.options!.when[props.branchName].terms[props.whenName].terms[props.name][1] = paramsValue.termType
|
formModel.value.options!.when[props.branchName].terms[props.whenName].terms[props.termsName][1] = paramsValue.termType
|
||||||
}
|
}
|
||||||
|
|
||||||
const termsTypeSelect = (e: { key: string, name: string }) => {
|
const termsTypeSelect = (e: { key: string, name: string }) => {
|
||||||
|
@ -304,35 +312,41 @@ const termsTypeSelect = (e: { key: string, name: string }) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
paramsValue.value = {
|
const _source = paramsValue.value?.source || tabsOptions.value[0].key
|
||||||
source: paramsValue.value?.source || tabsOptions.value[0].key,
|
const newValue: any = {
|
||||||
|
source: _source,
|
||||||
value: value
|
value: value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_source === 'metric') {
|
||||||
|
newValue.metric = paramsValue.value?.metric
|
||||||
|
}
|
||||||
|
paramsValue.value = newValue
|
||||||
emit('update:value', { ...paramsValue })
|
emit('update:value', { ...paramsValue })
|
||||||
formItemContext.onFieldChange()
|
formItemContext.onFieldChange()
|
||||||
formModel.value.options!.when[props.branchName].terms[props.whenName].terms[props.name][1] = e.name
|
formModel.value.options!.when[props.branchName].terms[props.whenName].terms[props.termsName][1] = e.name
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const valueSelect = (v: any, label: string, labelObj: Record<number, any>, option: any) => {
|
const valueSelect = (v: any, label: string, labelObj: Record<number, any>, option: any) => {
|
||||||
if (paramsValue.value?.source === 'metric') {
|
if (paramsValue.value?.source === 'metric') {
|
||||||
paramsValue.metric = option?.id
|
paramsValue.value.metric = option?.id
|
||||||
}
|
}
|
||||||
|
|
||||||
const newValues = { ...paramsValue }
|
const newValues = { ...paramsValue }
|
||||||
|
|
||||||
if (paramsValue.value?.source !== 'metric') {
|
if (paramsValue.value?.source !== 'metric') {
|
||||||
delete newValues.metric
|
delete newValues.value.metric
|
||||||
}
|
}
|
||||||
|
|
||||||
emit('update:value', { ...newValues })
|
emit('update:value', { ...newValues })
|
||||||
formItemContext.onFieldChange()
|
formItemContext.onFieldChange()
|
||||||
formModel.value.options!.when[props.branchName].terms[props.whenName].terms[props.name][2] = labelObj
|
formModel.value.options!.when[props.branchName].terms[props.whenName].terms[props.termsName][2] = labelObj
|
||||||
}
|
}
|
||||||
|
|
||||||
const typeSelect = (e: any) => {
|
const typeSelect = (e: any) => {
|
||||||
emit('update:value', { ...paramsValue })
|
emit('update:value', { ...paramsValue })
|
||||||
formModel.value.options!.when[props.branchName].terms[props.whenName].terms[props.name][3] = e.label
|
formModel.value.options!.when[props.branchName].terms[props.whenName].terms[props.termsName][3] = e.label
|
||||||
}
|
}
|
||||||
|
|
||||||
const termAdd = () => {
|
const termAdd = () => {
|
||||||
|
@ -346,17 +360,17 @@ const termAdd = () => {
|
||||||
type: 'and',
|
type: 'and',
|
||||||
key: `params_${new Date().getTime()}`
|
key: `params_${new Date().getTime()}`
|
||||||
}
|
}
|
||||||
formModel.value.branches?.[props.branchName]?.when?.[props.whenName]?.terms?.[props.termsName]?.terms?.push(terms)
|
formModel.value.branches?.[props.branchName]?.when?.[props.whenName]?.terms?.push(terms)
|
||||||
formModel.value.options!.when[props.branchName].terms[props.whenName].terms[props.termsName].push(['', '', '', '并且'])
|
formModel.value.options!.when[props.branchName].terms[props.whenName].terms[props.termsName].push(['', '', '', '并且'])
|
||||||
}
|
}
|
||||||
|
|
||||||
const onDelete = () => {
|
const onDelete = () => {
|
||||||
formModel.value.branches?.[props.branchName]?.when?.[props.whenName]?.terms?.[props.termsName]?.terms?.splice(props.name, 1)
|
formModel.value.branches?.[props.branchName]?.when?.[props.whenName]?.terms?.splice(props.termsName, 1)
|
||||||
formModel.value.options!.when[props.branchName].terms[props.whenName].terms.splice(props.name, 1)
|
formModel.value.options!.when[props.branchName].terms[props.whenName].terms.splice(props.termsName, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
Object.assign(paramsValue, pick(props.value, ['column', 'options', 'termType', 'terms', 'type', 'value']))
|
Object.assign(paramsValue, pick(props.value, ['column', 'options', 'termType', 'terms', 'type', 'value', 'metric', 'key']))
|
||||||
})
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<TitleComponent data='触发条件' style='font-size: 14px;' >
|
<TitleComponent data='触发条件' style='font-size: 14px;' >
|
||||||
<template #extra>
|
<template #extra>
|
||||||
<j-switch
|
<j-switch
|
||||||
:checked='open'
|
v-model:checked='open'
|
||||||
@change='change'
|
@change='change'
|
||||||
checkedChildren='开'
|
checkedChildren='开'
|
||||||
unCheckedChildren='关'
|
unCheckedChildren='关'
|
||||||
|
@ -60,17 +60,35 @@ import Action from '../../action/index.vue'
|
||||||
|
|
||||||
const sceneStore = useSceneStore()
|
const sceneStore = useSceneStore()
|
||||||
const { data } = storeToRefs(sceneStore)
|
const { data } = storeToRefs(sceneStore)
|
||||||
const open = ref(false)
|
const open = ref<boolean>(false)
|
||||||
const columnOptions = ref<any>([])
|
const columnOptions = ref<any>([])
|
||||||
|
|
||||||
provide(ContextKey, columnOptions)
|
provide(ContextKey, columnOptions)
|
||||||
|
|
||||||
const change = (e: boolean) => {
|
const change = (e: boolean) => {
|
||||||
open.value = e
|
|
||||||
if (!e) {
|
if (!e) {
|
||||||
data.value.branches!.length = 1
|
data.value.branches!.length = 1
|
||||||
|
data.value.branches![0].when = []
|
||||||
} else {
|
} else {
|
||||||
data.value.branches!.push(null as any)
|
data.value.branches!.push(null as any)
|
||||||
|
data.value.branches![0].when = [
|
||||||
|
{
|
||||||
|
terms: [
|
||||||
|
{
|
||||||
|
column: undefined,
|
||||||
|
value: {
|
||||||
|
source: 'fixed',
|
||||||
|
value: undefined
|
||||||
|
},
|
||||||
|
termType: undefined,
|
||||||
|
key: 'params_1',
|
||||||
|
type: 'and',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
type: 'and',
|
||||||
|
key: 'terms_1',
|
||||||
|
},
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,10 +137,15 @@ watchEffect(() => {
|
||||||
})
|
})
|
||||||
|
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
open.value = !(
|
if (data.value.branches?.filter(item => item).length) {
|
||||||
data.value.branches &&
|
open.value = !!data.value.branches[0].when.length
|
||||||
data.value.branches?.length === 1
|
} else {
|
||||||
)
|
open.value = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
console.log('terms-onMounted')
|
||||||
})
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -13,19 +13,15 @@
|
||||||
<AIcon type='CloseOutlined' />
|
<AIcon type='CloseOutlined' />
|
||||||
</div>
|
</div>
|
||||||
</j-popconfirm>
|
</j-popconfirm>
|
||||||
|
|
||||||
<j-form-item
|
<j-form-item
|
||||||
v-for='(item, index) in termsData'
|
:name='["branches", branchName, "when", whenName, "terms", props.name]'
|
||||||
:key='item.key'
|
|
||||||
:name='["branches", branchName, "when", whenName, "terms", props.name, "terms", index]'
|
|
||||||
:rules='rules'
|
:rules='rules'
|
||||||
>
|
>
|
||||||
<ParamsItem
|
<ParamsItem
|
||||||
v-model:value='formModel.branches[branchName].when[whenName].terms[props.name].terms[index]'
|
v-model:value='formModel.branches[branchName].when[whenName].terms[props.name]'
|
||||||
:isFirst='index === 0'
|
:isFirst='isFirst'
|
||||||
:isLast='index === termsData.length - 1'
|
:isLast='isLast'
|
||||||
:showDeleteBtn='termsData.length !== 1'
|
:showDeleteBtn='showDeleteBtn'
|
||||||
:name='index'
|
|
||||||
:termsName='name'
|
:termsName='name'
|
||||||
:whenName='whenName'
|
:whenName='whenName'
|
||||||
:branchName='branchName'
|
:branchName='branchName'
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
:branchName='branchName'
|
:branchName='branchName'
|
||||||
:whenName='props.name'
|
:whenName='props.name'
|
||||||
:name='index'
|
:name='index'
|
||||||
:showDeleteBtn='showDeleteBtn'
|
:showDeleteBtn='termsData.length > 1'
|
||||||
:isFirst='index === 0'
|
:isFirst='index === 0'
|
||||||
:isLast='index === termsData.length -1'
|
:isLast='index === termsData.length -1'
|
||||||
:data='item'
|
:data='item'
|
||||||
|
@ -93,19 +93,13 @@ const addWhen = () => {
|
||||||
type: 'and',
|
type: 'and',
|
||||||
terms: [
|
terms: [
|
||||||
{
|
{
|
||||||
terms: [
|
column: undefined,
|
||||||
{
|
value: {
|
||||||
column: undefined,
|
source: 'manual',
|
||||||
value: {
|
value: undefined
|
||||||
source: 'manual',
|
},
|
||||||
value: undefined
|
termType: undefined,
|
||||||
},
|
key: `params_${randomString()}`,
|
||||||
termType: undefined,
|
|
||||||
key: `params_${randomString()}`,
|
|
||||||
type: 'and',
|
|
||||||
}
|
|
||||||
],
|
|
||||||
key: `terms_2_${randomString()}`,
|
|
||||||
type: 'and',
|
type: 'and',
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
|
@ -389,6 +389,8 @@ const handleView = (id: string, triggerType: string) => {
|
||||||
.subTitle {
|
.subTitle {
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-top: 18px;
|
margin-top: 18px;
|
||||||
|
display: inline-block;
|
||||||
|
height: 50px;
|
||||||
|
|
||||||
.subTitle-title {
|
.subTitle-title {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@ -400,6 +402,7 @@ const handleView = (id: string, triggerType: string) => {
|
||||||
color: rgba(0, 0, 0, 0.65);
|
color: rgba(0, 0, 0, 0.65);
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
text-indent: 38px;
|
text-indent: 38px;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
|
@ -3836,10 +3836,10 @@ jetlinks-ui-components@1.0.5:
|
||||||
lodash-es "^4.17.21"
|
lodash-es "^4.17.21"
|
||||||
monaco-editor "^0.35.0"
|
monaco-editor "^0.35.0"
|
||||||
|
|
||||||
jetlinks-ui-components@^1.0.8:
|
jetlinks-ui-components@^1.0.9:
|
||||||
version "1.0.8"
|
version "1.0.9"
|
||||||
resolved "https://registry.jetlinks.cn/jetlinks-ui-components/-/jetlinks-ui-components-1.0.8.tgz#bcbdbbdc6c0011207f15cbb51fadcc8389803f53"
|
resolved "https://registry.jetlinks.cn/jetlinks-ui-components/-/jetlinks-ui-components-1.0.9.tgz#c71e593e65b9e8dd16c746cebf16d45339a0d340"
|
||||||
integrity sha512-FdXSS4Wdnq5cCUKP5f6Z/3FHu3XHFkRIzSAvkUQdneHbYO6iHkEjMJyHChttlP9cp4s6ydRpeqY2jjtoftYhtA==
|
integrity sha512-NRKA20IYMvaGabJTnt180ahjL6ERJz8rDohAMtaP4bWQeSAq89hBB5s6XMRJK4VexliEEo4+V3E/edK2iNsGWg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@vueuse/core" "^9.12.0"
|
"@vueuse/core" "^9.12.0"
|
||||||
"@vueuse/router" "^9.13.0"
|
"@vueuse/router" "^9.13.0"
|
||||||
|
|