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