fix: bug#10763、10750、10732、10686
This commit is contained in:
parent
a6a8bbefc7
commit
a8478617cd
|
@ -1,6 +1,8 @@
|
||||||
<template>
|
<template>
|
||||||
<ConfigProvider :locale='zhCN'>
|
<ConfigProvider :locale='zhCN'>
|
||||||
<router-view />
|
<keep-alive>
|
||||||
|
<router-view />
|
||||||
|
</keep-alive>
|
||||||
</ConfigProvider>
|
</ConfigProvider>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
v-model:selectedKeys="state.selectedKeys"
|
v-model:selectedKeys="state.selectedKeys"
|
||||||
:pure="state.pure"
|
:pure="state.pure"
|
||||||
:breadcrumb="{ routes: breadcrumb }"
|
:breadcrumb="{ routes: breadcrumb }"
|
||||||
|
@back='routerBack'
|
||||||
>
|
>
|
||||||
<template #breadcrumbRender="slotProps">
|
<template #breadcrumbRender="slotProps">
|
||||||
<a
|
<a
|
||||||
|
@ -70,6 +71,10 @@ const state = reactive<StateType>({
|
||||||
selectedKeys: [],
|
selectedKeys: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const routerBack = () => {
|
||||||
|
router.go(-1)
|
||||||
|
}
|
||||||
|
|
||||||
const findRouteMeta = (code: string) => {
|
const findRouteMeta = (code: string) => {
|
||||||
let meta = []
|
let meta = []
|
||||||
let menuItem: any = menu.menus[code]
|
let menuItem: any = menu.menus[code]
|
||||||
|
|
|
@ -194,7 +194,7 @@ const timeChange = (e: any) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const inputChange = (e: any) => {
|
const inputChange = (e: any) => {
|
||||||
emit('change', e.target ? e.target.value : e)
|
emit('change', e && e.target ? e.target.value : e)
|
||||||
}
|
}
|
||||||
|
|
||||||
const dateChange = (e: any) => {
|
const dateChange = (e: any) => {
|
||||||
|
|
|
@ -51,7 +51,7 @@ export const AccountMenu = {
|
||||||
export default [
|
export default [
|
||||||
{ path: '/*', redirect: '/'},
|
{ path: '/*', redirect: '/'},
|
||||||
{
|
{
|
||||||
path: '/login',
|
path: LoginPath,
|
||||||
component: () => import('@/views/user/Login/index.vue')
|
component: () => import('@/views/user/Login/index.vue')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -155,10 +155,11 @@ const errorHandler = (error: any) => {
|
||||||
Notification.error({
|
Notification.error({
|
||||||
key: '401',
|
key: '401',
|
||||||
message: 'Unauthorized',
|
message: 'Unauthorized',
|
||||||
description: 'Authorization verification failed'
|
description: '用户未登录'
|
||||||
})
|
})
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
router.replace({
|
debugger
|
||||||
|
router.push({
|
||||||
path: LoginPath
|
path: LoginPath
|
||||||
})
|
})
|
||||||
}, 0)
|
}, 0)
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
format="YYYY-MM-DD HH:mm:ss"
|
format="YYYY-MM-DD HH:mm:ss"
|
||||||
valueFormat="YYYY-MM-DD HH:mm:ss"
|
valueFormat="YYYY-MM-DD HH:mm:ss"
|
||||||
style="margin-left: 12px"
|
style="margin-left: 12px"
|
||||||
|
:show-time="{ format: 'HH:mm:ss' }"
|
||||||
@change="rangeChange"
|
@change="rangeChange"
|
||||||
v-model:value="rangeVal"
|
v-model:value="rangeVal"
|
||||||
:allowClear="false"
|
:allowClear="false"
|
||||||
|
@ -110,5 +111,5 @@ const handleBtnChange = (val: string) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
handleBtnChange(radioValue.value);
|
handleBtnChange(radioValue.value);
|
||||||
watch(() => radioValue.value, { deep: true, immediate: true });
|
// watch(() => radioValue.value, { deep: true, immediate: true });
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -237,6 +237,11 @@ const getData = (
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
queryFlow(start, end, {
|
queryFlow(start, end, {
|
||||||
orderBy: 'date',
|
orderBy: 'date',
|
||||||
|
terms: [{
|
||||||
|
column : "cardId",
|
||||||
|
termType: "eq",
|
||||||
|
value: route.params.id
|
||||||
|
}]
|
||||||
}).then((resp: any) => {
|
}).then((resp: any) => {
|
||||||
if (resp.status === 200) {
|
if (resp.status === 200) {
|
||||||
const sortArray = resp.result.sort(
|
const sortArray = resp.result.sort(
|
||||||
|
|
|
@ -232,8 +232,8 @@ const handleOk = () => {
|
||||||
btnLoading.value = true;
|
btnLoading.value = true;
|
||||||
const resp =
|
const resp =
|
||||||
props.type === 'add'
|
props.type === 'add'
|
||||||
? await add(toRaw(modelRef))
|
? await add(toRaw(modelRef)).catch(err => err)
|
||||||
: await edit(toRaw(modelRef));
|
: await edit(toRaw(modelRef)).catch(err => err);
|
||||||
btnLoading.value = false;
|
btnLoading.value = false;
|
||||||
if (resp.status === 200) {
|
if (resp.status === 200) {
|
||||||
message.success('操作成功')
|
message.success('操作成功')
|
||||||
|
|
|
@ -457,6 +457,7 @@ const columns = [
|
||||||
width: 200,
|
width: 200,
|
||||||
search: {
|
search: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
defaultTermType: 'eq'
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -466,6 +467,9 @@ const columns = [
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
scopedSlots: true,
|
scopedSlots: true,
|
||||||
width: 200,
|
width: 200,
|
||||||
|
search: {
|
||||||
|
type: 'string'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '平台对接',
|
title: '平台对接',
|
||||||
|
@ -571,7 +575,8 @@ const columns = [
|
||||||
{ label: '正常', value: 'using' },
|
{ label: '正常', value: 'using' },
|
||||||
{ label: '未激活', value: 'toBeActivated' },
|
{ label: '未激活', value: 'toBeActivated' },
|
||||||
{ label: '停机', value: 'deactivate' },
|
{ label: '停机', value: 'deactivate' },
|
||||||
],
|
{ label: '其它', value: 'using,toBeActivated,deactivate' },
|
||||||
|
]
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -737,7 +742,16 @@ const getActions = (
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSearch = (e: any) => {
|
const handleSearch = (e: any) => {
|
||||||
params.value = e;
|
const newParams = (e?.terms as any[])?.map(item1 => {
|
||||||
|
item1.terms = item1.terms.map((item2: any) => {
|
||||||
|
if (['cardStateType'].includes(item2.column)) {
|
||||||
|
item2.termType = 'nin'
|
||||||
|
}
|
||||||
|
return item2
|
||||||
|
})
|
||||||
|
return item1
|
||||||
|
})
|
||||||
|
params.value = { terms: newParams || [] };
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSelectChange = (keys: string[], rows: []) => {
|
const onSelectChange = (keys: string[], rows: []) => {
|
||||||
|
|
|
@ -87,7 +87,7 @@
|
||||||
</page-container>
|
</page-container>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts" name='IotCardHome'>
|
||||||
import { getImage } from '@/utils/comm';
|
import { getImage } from '@/utils/comm';
|
||||||
import Guide from '../components/Guide.vue';
|
import Guide from '../components/Guide.vue';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
@ -113,14 +113,14 @@ const menuHasPermission = useMenuStore().hasPermission;
|
||||||
const btnHasPermission = usePermissionStore().hasPermission;
|
const btnHasPermission = usePermissionStore().hasPermission;
|
||||||
|
|
||||||
// 菜单权限
|
// 菜单权限
|
||||||
const dashBoardUrl = menuHasPermission('/iot-card/Dashboard');
|
const dashBoardUrl = menuHasPermission('iot-card/Dashboard');
|
||||||
const platformUrl = menuHasPermission('/iot-card/Platform/Detail');
|
const platformUrl = menuHasPermission('iot-card/Platform/Detail');
|
||||||
const recordUrl = menuHasPermission('/iot-card/Record');
|
const recordUrl = menuHasPermission('iot-card/Record');
|
||||||
const cardUrl = menuHasPermission('/iot-card/CardManagement');
|
const cardUrl = menuHasPermission('iot-card/CardManagement');
|
||||||
|
|
||||||
// 按钮权限
|
// 按钮权限
|
||||||
const paltformPermission = btnHasPermission(`/iot-card/Platform:add`);
|
const paltformPermission = btnHasPermission(`iot-card/Platform:add`);
|
||||||
const cardPermission = btnHasPermission(`/iot-card/CardManagement:add`);
|
const cardPermission = btnHasPermission(`iot-card/CardManagement:add`);
|
||||||
|
|
||||||
const Image = {
|
const Image = {
|
||||||
1: getImage('/home/1.png'),
|
1: getImage('/home/1.png'),
|
||||||
|
@ -179,23 +179,19 @@ const pieChartData = ref<any[]>([
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const jumpPage = (data: GuideItemProps) => {
|
const jumpPage = (data: GuideItemProps) => {
|
||||||
|
console.log(data.auth)
|
||||||
if (!data.auth){
|
if (!data.auth){
|
||||||
message.warning('暂无权限,请联系管理员');
|
message.warning('暂无权限,请联系管理员');
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (data.key === 'EQUIPMENT') {
|
if (data.key === 'EQUIPMENT') {
|
||||||
menuStory.jumpPage(data.url, { id: 'add' });
|
menuStory.jumpPage(data.url, { id: ':id'});
|
||||||
} else {
|
} else {
|
||||||
menuStory.jumpPage(data.url);
|
menuStory.jumpPage(data.url);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const jumpDashboard = () => {
|
const jumpDashboard = () => {
|
||||||
// if (dashBoardUrl) {
|
|
||||||
// router.push(`${dashBoardUrl}`);
|
|
||||||
// } else {
|
|
||||||
// message.warning('暂无权限,请联系管理员');
|
|
||||||
// }
|
|
||||||
menuStory.jumpPage('iot-card/Dashboard');
|
menuStory.jumpPage('iot-card/Dashboard');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -204,6 +204,7 @@ const rules = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const getDetail = async () => {
|
const getDetail = async () => {
|
||||||
|
console.log(route.params)
|
||||||
if (route.params.id === ':id') return;
|
if (route.params.id === ':id') return;
|
||||||
const resp: any = await queryById(route.params.id);
|
const resp: any = await queryById(route.params.id);
|
||||||
if (resp.status === 200) {
|
if (resp.status === 200) {
|
||||||
|
|
|
@ -238,7 +238,7 @@ const handleSearch = (e: any) => {
|
||||||
* 新增
|
* 新增
|
||||||
*/
|
*/
|
||||||
const handleAdd = () => {
|
const handleAdd = () => {
|
||||||
menuStory.jumpPage('iot-card/Platform/Detail', { id: 'add' })
|
menuStory.jumpPage('iot-card/Platform/Detail', { id: ':id' })
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,9 @@
|
||||||
</j-radio-button>
|
</j-radio-button>
|
||||||
</j-radio-group>
|
</j-radio-group>
|
||||||
<j-range-picker
|
<j-range-picker
|
||||||
format="YYYY-MM-DD"
|
format="YYYY-MM-DD HH:mm:ss"
|
||||||
valueFormat="YYYY-MM-DD"
|
valueFormat="YYYY-MM-DD HH:mm:ss"
|
||||||
|
:show-time="{ format: 'HH:mm:ss' }"
|
||||||
style="margin-left: 12px"
|
style="margin-left: 12px"
|
||||||
@change="rangeChange"
|
@change="rangeChange"
|
||||||
v-model:value="rangeVal"
|
v-model:value="rangeVal"
|
||||||
|
@ -28,7 +29,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import moment from 'moment';
|
import dayjs from 'dayjs';
|
||||||
import { PropType } from 'vue';
|
import { PropType } from 'vue';
|
||||||
|
|
||||||
interface BtnOptions {
|
interface BtnOptions {
|
||||||
|
@ -70,38 +71,37 @@ const rangeVal = ref<[string, string]>();
|
||||||
const rangeChange = (val: any) => {
|
const rangeChange = (val: any) => {
|
||||||
radioValue.value = undefined;
|
radioValue.value = undefined;
|
||||||
emit('change', {
|
emit('change', {
|
||||||
start: moment(val[0]).valueOf(),
|
start: dayjs(val[0]).valueOf(),
|
||||||
end: moment(val[1]).valueOf(),
|
end: dayjs(val[1]).valueOf(),
|
||||||
type: undefined,
|
type: undefined,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const getTimeByType = (type: string) => {
|
const getTimeByType = (type?: string) => {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'hour':
|
case 'hour':
|
||||||
return moment().subtract(1, 'hours').valueOf();
|
return dayjs().subtract(1, 'hours').valueOf();
|
||||||
case 'week':
|
case 'week':
|
||||||
return moment().subtract(6, 'days').valueOf();
|
return dayjs().subtract(6, 'days').valueOf();
|
||||||
case 'month':
|
case 'month':
|
||||||
return moment().subtract(29, 'days').valueOf();
|
return dayjs().subtract(29, 'days').valueOf();
|
||||||
case 'year':
|
case 'year':
|
||||||
return moment().subtract(365, 'days').valueOf();
|
return dayjs().subtract(365, 'days').valueOf();
|
||||||
default:
|
default:
|
||||||
return moment().startOf('day').valueOf();
|
return dayjs().startOf('day').valueOf();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleBtnChange = (val: string) => {
|
const handleBtnChange = (val?: string) => {
|
||||||
radioValue.value = val;
|
let endTime = dayjs(new Date()).valueOf();
|
||||||
let endTime = moment(new Date()).valueOf();
|
|
||||||
let startTime = getTimeByType(val);
|
let startTime = getTimeByType(val);
|
||||||
if (val === 'yesterday') {
|
if (val === 'yesterday') {
|
||||||
startTime = moment().subtract(1, 'days').startOf('day').valueOf();
|
startTime = dayjs().subtract(1, 'days').startOf('day').valueOf();
|
||||||
endTime = moment().subtract(1, 'days').endOf('day').valueOf();
|
endTime = dayjs().subtract(1, 'days').endOf('day').valueOf();
|
||||||
}
|
}
|
||||||
rangeVal.value = [
|
rangeVal.value = [
|
||||||
moment(startTime).format('YYYY-MM-DD'),
|
dayjs(startTime).format('YYYY-MM-DD HH:mm:ss'),
|
||||||
moment(endTime).format('YYYY-MM-DD'),
|
dayjs(endTime).format('YYYY-MM-DD HH:mm:ss'),
|
||||||
];
|
];
|
||||||
emit('change', {
|
emit('change', {
|
||||||
start: startTime,
|
start: startTime,
|
||||||
|
@ -110,11 +110,8 @@ const handleBtnChange = (val: string) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
watch(
|
nextTick(() => {
|
||||||
() => radioValue.value,
|
handleBtnChange(radioValue.value)
|
||||||
(val) => {
|
})
|
||||||
handleBtnChange(val);
|
|
||||||
},
|
|
||||||
{ deep: true, immediate: true },
|
|
||||||
);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
title='触发规则'
|
title='触发规则'
|
||||||
visible
|
visible
|
||||||
:width='820'
|
:width='820'
|
||||||
@click='save'
|
@ok='save'
|
||||||
@cancel='cancel'
|
@cancel='cancel'
|
||||||
:maskClosable="false"
|
:maskClosable="false"
|
||||||
>
|
>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
type='simple'
|
type='simple'
|
||||||
@search="handleSearch"
|
@search="handleSearch"
|
||||||
class='search'
|
class="scene-search"
|
||||||
target="scene-triggrt-device-device"
|
target="scene-triggrt-device-device"
|
||||||
/>
|
/>
|
||||||
<j-divider style='margin: 0' />
|
<j-divider style='margin: 0' />
|
||||||
|
|
|
@ -22,11 +22,16 @@
|
||||||
<j-form-item>定时调用所选功能</j-form-item>
|
<j-form-item>定时调用所选功能</j-form-item>
|
||||||
</j-col>
|
</j-col>
|
||||||
<j-col :span='24'>
|
<j-col :span='24'>
|
||||||
|
<j-form-item
|
||||||
|
name='functionData'
|
||||||
|
:rules="rules"
|
||||||
|
>
|
||||||
<FunctionCall
|
<FunctionCall
|
||||||
:value='_value'
|
v-model:value='formModel.functionData'
|
||||||
:data='functionData'
|
:data='functionData'
|
||||||
@change='callDataChange'
|
@change='callDataChange'
|
||||||
/>
|
/>
|
||||||
|
</j-form-item>
|
||||||
</j-col>
|
</j-col>
|
||||||
</j-row>
|
</j-row>
|
||||||
</j-form>
|
</j-form>
|
||||||
|
@ -66,9 +71,9 @@ const props = defineProps({
|
||||||
const emit = defineEmits<Emit>()
|
const emit = defineEmits<Emit>()
|
||||||
const invokeForm = ref()
|
const invokeForm = ref()
|
||||||
const formModel = reactive({
|
const formModel = reactive({
|
||||||
functionId: props.functionId
|
functionId: props.functionId,
|
||||||
|
functionData: props.functionParameters
|
||||||
})
|
})
|
||||||
const _value = ref<any[]>(props.functionParameters)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前选择功能属性
|
* 获取当前选择功能属性
|
||||||
|
@ -94,13 +99,29 @@ const functionData = computed(() => {
|
||||||
return arrCache
|
return arrCache
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const rules = [{
|
||||||
|
validator(_: string, value: any) {
|
||||||
|
if (!value?.length && functionData.value.length) {
|
||||||
|
return Promise.reject('请输入功能值')
|
||||||
|
} else {
|
||||||
|
let hasValue = value.find((item: { name: string, value: any}) => !item.value)
|
||||||
|
if (hasValue) {
|
||||||
|
const functionItem = functionData.value.find((item: any) => item.id === hasValue.name)
|
||||||
|
return Promise.reject(functionItem?.name ? `请输入${functionItem?.name}值` : '请输入功能值')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
|
||||||
const onSelect = (v: string, item: any) => {
|
const onSelect = (v: string, item: any) => {
|
||||||
|
formModel.functionData = []
|
||||||
emit('update:action', `执行${item.name}`)
|
emit('update:action', `执行${item.name}`)
|
||||||
emit('update:functionId', v)
|
emit('update:functionId', v)
|
||||||
|
emit('update:functionParameters', [])
|
||||||
}
|
}
|
||||||
|
|
||||||
const callDataChange = (v: any[]) => {
|
const callDataChange = (v: any[]) => {
|
||||||
_value.value = v
|
|
||||||
emit('update:functionParameters', v)
|
emit('update:functionParameters', v)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
type='simple'
|
type='simple'
|
||||||
@search="handleSearch"
|
@search="handleSearch"
|
||||||
class='search'
|
class="scene-search"
|
||||||
target="scene-triggrt-device-device"
|
target="scene-triggrt-device-device"
|
||||||
/>
|
/>
|
||||||
<j-divider style='margin: 0' />
|
<j-divider style='margin: 0' />
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
title='触发规则'
|
title='触发规则'
|
||||||
visible
|
visible
|
||||||
:width='820'
|
:width='820'
|
||||||
@click='save'
|
@ok='save'
|
||||||
@cancel='cancel'
|
@cancel='cancel'
|
||||||
>
|
>
|
||||||
<Timer
|
<Timer
|
||||||
|
@ -15,17 +15,16 @@
|
||||||
<script setup lang="ts" name="timerAddModel">
|
<script setup lang="ts" name="timerAddModel">
|
||||||
import Timer from '../components/Timer'
|
import Timer from '../components/Timer'
|
||||||
import type { OperationTimer } from '@/views/rule-engine/Scene/typings'
|
import type { OperationTimer } from '@/views/rule-engine/Scene/typings'
|
||||||
import {nextTick, PropType} from "vue";
|
import { PropType} from "vue";
|
||||||
import {TriggerDevice} from "@/views/rule-engine/Scene/typings";
|
|
||||||
import {handleTimerOptions} from "@/views/rule-engine/Scene/Save/components/Timer/util";
|
import {handleTimerOptions} from "@/views/rule-engine/Scene/Save/components/Timer/util";
|
||||||
|
|
||||||
type Emit = {
|
type Emit = {
|
||||||
(e: 'cancel'): void
|
(e: 'cancel'): void
|
||||||
(e: 'save', data: TriggerDevice, options: Record<string, any>): void
|
(e: 'save', data: OperationTimer, options: Record<string, any>): void
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
timer: {
|
value: {
|
||||||
type: Object as PropType<OperationTimer>,
|
type: Object as PropType<OperationTimer>,
|
||||||
default: () => ({})
|
default: () => ({})
|
||||||
}
|
}
|
||||||
|
@ -39,14 +38,14 @@ interface AddModelType {
|
||||||
}
|
}
|
||||||
|
|
||||||
const addModel = reactive<AddModelType>({
|
const addModel = reactive<AddModelType>({
|
||||||
timer: props.timer
|
timer: props.value
|
||||||
})
|
})
|
||||||
|
|
||||||
const save = async () => {
|
const save = async () => {
|
||||||
const timerData = await timerRef.value?.validateFields()
|
const timerData = await timerRef.value?.validateFields()
|
||||||
if (timerData) {
|
if (timerData) {
|
||||||
const options = handleTimerOptions(timerData)
|
const options = handleTimerOptions(addModel.timer)
|
||||||
emit("save", timerData, options)
|
emit("save", addModel.timer, options)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,8 +53,8 @@ const cancel = () => {
|
||||||
emit("cancel")
|
emit("cancel")
|
||||||
}
|
}
|
||||||
|
|
||||||
nextTick(() => {
|
watchEffect(() => {
|
||||||
Object.assign(addModel, props.timer)
|
addModel.timer = props.value
|
||||||
})
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
<template>
|
||||||
|
<div :class='["trigger-options-content", isAdd ? "is-add" : ""]'>
|
||||||
|
<span v-if='!isAdd'> 点击配置定时触发 </span>
|
||||||
|
<template v-else>
|
||||||
|
<div class='center-item'>
|
||||||
|
<AIcon v-if='options.selectorIcon' :type='options.selectorIcon' class='icon-padding-right' />
|
||||||
|
<span class='trigger-options-name'>
|
||||||
|
<Ellipsis style='max-width: 310px'>
|
||||||
|
{{ options.name }}
|
||||||
|
</Ellipsis>
|
||||||
|
</span>
|
||||||
|
<span v-if='options.extraName'>{{ options.extraName }}</span>
|
||||||
|
</div>
|
||||||
|
<div v-if='options.when'>
|
||||||
|
<span className='trigger-options-when'>{{ options.when }}</span>
|
||||||
|
</div>
|
||||||
|
<div v-if='options.time'>
|
||||||
|
<span className='trigger-options-time'>{{ options.time }}</span>
|
||||||
|
</div>
|
||||||
|
<div v-if='options.extraTime'>
|
||||||
|
<span className='trigger-options-extraTime'>{{ options.extraTime }}</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang='ts' name='TimerTitle'>
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
options: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const isAdd = computed(() => {
|
||||||
|
console.log(props.options, Object.keys(props.options).length)
|
||||||
|
return !!Object.keys(props.options).length
|
||||||
|
})
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang='less'>
|
||||||
|
.trigger-options-content {
|
||||||
|
display: inline-flex;
|
||||||
|
gap: 16px;
|
||||||
|
|
||||||
|
.center-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-padding-right {
|
||||||
|
padding-right: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -29,8 +29,7 @@
|
||||||
v-if="visible"
|
v-if="visible"
|
||||||
@cancel='visible = false'
|
@cancel='visible = false'
|
||||||
@save="save"
|
@save="save"
|
||||||
:value="data.trigger.device"
|
:value="data.trigger.timer"
|
||||||
:options="data.options.trigger"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -41,6 +40,7 @@ import { storeToRefs } from 'pinia';
|
||||||
import Action from '../action/index.vue';
|
import Action from '../action/index.vue';
|
||||||
import AddModel from './AddModal.vue'
|
import AddModel from './AddModal.vue'
|
||||||
import AddButton from '../components/AddButton.vue'
|
import AddButton from '../components/AddButton.vue'
|
||||||
|
import Title from './Title.vue'
|
||||||
import type { OperationTimer, BranchesThen } from '@/views/rule-engine/Scene/typings'
|
import type { OperationTimer, BranchesThen } from '@/views/rule-engine/Scene/typings'
|
||||||
|
|
||||||
const sceneStore = useSceneStore();
|
const sceneStore = useSceneStore();
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
type="simple"
|
type="simple"
|
||||||
@search="handleSearch"
|
@search="handleSearch"
|
||||||
class="search"
|
class="scene-search"
|
||||||
target="scene-trigger-device-product"
|
target="scene-trigger-device-product"
|
||||||
/>
|
/>
|
||||||
<j-divider style="margin: 0" />
|
<j-divider style="margin: 0" />
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
showSearch
|
showSearch
|
||||||
placeholder="请选择功能"
|
placeholder="请选择功能"
|
||||||
v-model:value="modelRef.message.functionId"
|
v-model:value="modelRef.message.functionId"
|
||||||
|
@select='functionSelect'
|
||||||
>
|
>
|
||||||
<j-select-option
|
<j-select-option
|
||||||
v-for="item in metadata?.functions || []"
|
v-for="item in metadata?.functions || []"
|
||||||
|
@ -34,7 +35,7 @@
|
||||||
<j-form-item
|
<j-form-item
|
||||||
v-if="modelRef.message.functionId"
|
v-if="modelRef.message.functionId"
|
||||||
:name="['message', 'inputs']"
|
:name="['message', 'inputs']"
|
||||||
:rules="[{ required: true, message: '请输入功能值' }]"
|
:rules="functionRules"
|
||||||
>
|
>
|
||||||
<EditTable
|
<EditTable
|
||||||
:functions="functions"
|
:functions="functions"
|
||||||
|
@ -138,6 +139,25 @@ const modelRef = reactive({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const functionSelect = () => {
|
||||||
|
modelRef.message.inputs = []
|
||||||
|
}
|
||||||
|
|
||||||
|
const functionRules = [{
|
||||||
|
validator(_: string, value: any) {
|
||||||
|
if (!value?.length && functions.value.length) {
|
||||||
|
return Promise.reject('请输入功能值')
|
||||||
|
} else {
|
||||||
|
const hasValue = value.find((item: { name: string, value: any}) => !item.value)
|
||||||
|
if (hasValue) {
|
||||||
|
const functionItem = functions.value.find((item: any) => item.id === hasValue.name)
|
||||||
|
return Promise.reject(functionItem?.name ? `请输入${functionItem.name}值` : '请输入功能值')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
|
||||||
const metadata = ref<{
|
const metadata = ref<{
|
||||||
functions: any[];
|
functions: any[];
|
||||||
properties: any[];
|
properties: any[];
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
type="simple"
|
type="simple"
|
||||||
@search="handleSearch"
|
@search="handleSearch"
|
||||||
class="search"
|
class="scene-search"
|
||||||
target="scene-trigger-device-device"
|
target="scene-trigger-device-device"
|
||||||
/>
|
/>
|
||||||
<j-divider style="margin: 0" />
|
<j-divider style="margin: 0" />
|
||||||
|
|
|
@ -101,6 +101,7 @@ const valueChange = debounce(() => {
|
||||||
const _value = dataSource.value.map(item => ({
|
const _value = dataSource.value.map(item => ({
|
||||||
name: item.id, value: item.value
|
name: item.id, value: item.value
|
||||||
}))
|
}))
|
||||||
|
console.log(_value)
|
||||||
emit('change', _value)
|
emit('change', _value)
|
||||||
emit('update:value', _value)
|
emit('update:value', _value)
|
||||||
}, 500)
|
}, 500)
|
||||||
|
|
|
@ -17,6 +17,7 @@ import { numberToString } from './util'
|
||||||
|
|
||||||
type Emit = {
|
type Emit = {
|
||||||
(e: 'update:value', data: Array<number>):void
|
(e: 'update:value', data: Array<number>):void
|
||||||
|
(e: 'change', data: Array<number>):void
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
@ -48,6 +49,7 @@ const change = (number: number) => {
|
||||||
}
|
}
|
||||||
rowKeys.value = [..._keys.values()]
|
rowKeys.value = [..._keys.values()]
|
||||||
emit('update:value', rowKeys.value)
|
emit('update:value', rowKeys.value)
|
||||||
|
emit('change', rowKeys.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
const allActive = computed(() => {
|
const allActive = computed(() => {
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
]'
|
]'
|
||||||
option-type='button'
|
option-type='button'
|
||||||
button-style='solid'
|
button-style='solid'
|
||||||
|
@change='updateValue'
|
||||||
/>
|
/>
|
||||||
</j-form-item>
|
</j-form-item>
|
||||||
<j-form-item v-if='showCron' name='cron' :rules="[
|
<j-form-item v-if='showCron' name='cron' :rules="[
|
||||||
|
@ -32,11 +33,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]">
|
]">
|
||||||
<j-input placeholder='corn表达式' v-model:value='formModel.cron' />
|
<j-input placeholder='corn表达式' v-model:value='formModel.cron' @change='updateValue' />
|
||||||
</j-form-item>
|
</j-form-item>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<j-form-item name='when'>
|
<j-form-item name='when'>
|
||||||
<WhenOption v-model:value='formModel.when' :type='formModel.trigger' />
|
<WhenOption v-model:value='formModel.when' :type='formModel.trigger' @change='updateValue' />
|
||||||
</j-form-item>
|
</j-form-item>
|
||||||
<j-form-item name='mod'>
|
<j-form-item name='mod'>
|
||||||
<j-radio-group
|
<j-radio-group
|
||||||
|
@ -47,13 +48,19 @@
|
||||||
]'
|
]'
|
||||||
option-type='button'
|
option-type='button'
|
||||||
button-style='solid'
|
button-style='solid'
|
||||||
|
@change='updateValue'
|
||||||
/>
|
/>
|
||||||
</j-form-item>
|
</j-form-item>
|
||||||
</template>
|
</template>
|
||||||
<j-space v-if='showOnce' style='display: flex;gap: 24px'>
|
<j-space v-if='showOnce' style='display: flex;gap: 24px'>
|
||||||
<j-form-item :name="['once', 'time']">
|
<j-form-item :name="['once', 'time']">
|
||||||
<j-time-picker valueFormat='HH:mm:ss' v-model:value='formModel.once.time' style='width: 100%'
|
<j-time-picker
|
||||||
format='HH:mm:ss' />
|
valueFormat='HH:mm:ss'
|
||||||
|
v-model:value='formModel.once.time'
|
||||||
|
style='width: 100%'
|
||||||
|
format='HH:mm:ss'
|
||||||
|
@change='updateValue'
|
||||||
|
/>
|
||||||
</j-form-item>
|
</j-form-item>
|
||||||
<j-form-item> 执行一次</j-form-item>
|
<j-form-item> 执行一次</j-form-item>
|
||||||
</j-space>
|
</j-space>
|
||||||
|
@ -68,6 +75,7 @@
|
||||||
@change='(v) => {
|
@change='(v) => {
|
||||||
formModel.period.from = v[0]
|
formModel.period.from = v[0]
|
||||||
formModel.period.to = v[1]
|
formModel.period.to = v[1]
|
||||||
|
updateValue()
|
||||||
}'
|
}'
|
||||||
/>
|
/>
|
||||||
</j-form-item>
|
</j-form-item>
|
||||||
|
@ -83,6 +91,7 @@
|
||||||
:min='1'
|
:min='1'
|
||||||
:max='59'
|
:max='59'
|
||||||
v-model:value='formModel.period.every'
|
v-model:value='formModel.period.every'
|
||||||
|
@change='updateValue'
|
||||||
>
|
>
|
||||||
<template #addonAfter>
|
<template #addonAfter>
|
||||||
<j-select
|
<j-select
|
||||||
|
@ -92,6 +101,7 @@
|
||||||
{ label: "分", value: "minutes" },
|
{ label: "分", value: "minutes" },
|
||||||
{ label: "小时", value: "hours" },
|
{ label: "小时", value: "hours" },
|
||||||
]'
|
]'
|
||||||
|
@select='updateValue'
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</j-input-number>
|
</j-input-number>
|
||||||
|
@ -103,7 +113,7 @@
|
||||||
|
|
||||||
<script setup lang='ts' name='Timer'>
|
<script setup lang='ts' name='Timer'>
|
||||||
import type { PropType } from 'vue'
|
import type { PropType } from 'vue'
|
||||||
import moment from 'moment'
|
import dayjs from 'dayjs'
|
||||||
import WhenOption from './WhenOption.vue'
|
import WhenOption from './WhenOption.vue'
|
||||||
import { cloneDeep } from 'lodash-es'
|
import { cloneDeep } from 'lodash-es'
|
||||||
import type { OperationTimer } from '../../../typings'
|
import type { OperationTimer } from '../../../typings'
|
||||||
|
@ -131,23 +141,21 @@ const emit = defineEmits<Emit>()
|
||||||
|
|
||||||
const formModel = reactive<OperationTimer>({
|
const formModel = reactive<OperationTimer>({
|
||||||
trigger: 'week',
|
trigger: 'week',
|
||||||
when: [],
|
when: props.value.when || [],
|
||||||
mod: 'period',
|
mod: 'period',
|
||||||
cron: undefined,
|
cron: undefined,
|
||||||
once: {
|
once: {
|
||||||
time: moment(new Date()).format('HH:mm:ss')
|
time: dayjs(new Date()).format('HH:mm:ss')
|
||||||
},
|
},
|
||||||
period: {
|
period: {
|
||||||
from: moment(new Date()).startOf('day').format('HH:mm:ss'),
|
from: dayjs(new Date()).startOf('day').format('HH:mm:ss'),
|
||||||
to: moment(new Date()).endOf('day').format('HH:mm:ss'),
|
to: dayjs(new Date()).endOf('day').format('HH:mm:ss'),
|
||||||
every: 1,
|
every: 1,
|
||||||
unit: 'seconds'
|
unit: 'seconds'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const timerForm = ref()
|
const timerForm = ref()
|
||||||
|
|
||||||
Object.assign(formModel, props.value)
|
|
||||||
|
|
||||||
const showCron = computed(() => {
|
const showCron = computed(() => {
|
||||||
return formModel.trigger === 'cron'
|
return formModel.trigger === 'cron'
|
||||||
})
|
})
|
||||||
|
@ -160,7 +168,7 @@ const showPeriod = computed(() => {
|
||||||
return formModel.trigger !== 'cron' && formModel.mod === 'period'
|
return formModel.trigger !== 'cron' && formModel.mod === 'period'
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(() => formModel, () => {
|
const updateValue = () => {
|
||||||
const cloneValue = cloneDeep(formModel)
|
const cloneValue = cloneDeep(formModel)
|
||||||
if (cloneValue.trigger === 'cron') {
|
if (cloneValue.trigger === 'cron') {
|
||||||
delete cloneValue.when
|
delete cloneValue.when
|
||||||
|
@ -174,7 +182,7 @@ watch(() => formModel, () => {
|
||||||
delete cloneValue.period
|
delete cloneValue.period
|
||||||
}
|
}
|
||||||
emit('update:value', cloneValue)
|
emit('update:value', cloneValue)
|
||||||
}, { deep: true })
|
}
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
validateFields: () => new Promise(async (resolve) => {
|
validateFields: () => new Promise(async (resolve) => {
|
||||||
|
@ -182,6 +190,8 @@ defineExpose({
|
||||||
resolve(data)
|
resolve(data)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Object.assign(formModel, props.value)
|
||||||
|
formModel.when = props.value.when || []
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -114,4 +114,7 @@ onUnmounted(() => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
</style>
|
||||||
|
<style lang='less'>
|
||||||
|
@import "./style.less";
|
||||||
</style>
|
</style>
|
|
@ -0,0 +1,3 @@
|
||||||
|
.scene-search {
|
||||||
|
padding: 24px 0 0 0;
|
||||||
|
}
|
|
@ -70,7 +70,7 @@
|
||||||
:status="slotProps.state?.value"
|
:status="slotProps.state?.value"
|
||||||
:statusText="slotProps.state?.text"
|
:statusText="slotProps.state?.text"
|
||||||
:statusNames="{
|
:statusNames="{
|
||||||
online: 'success',
|
online: 'processing',
|
||||||
offline: 'error',
|
offline: 'error',
|
||||||
notActive: 'warning',
|
notActive: 'warning',
|
||||||
}"
|
}"
|
||||||
|
@ -147,7 +147,7 @@
|
||||||
:status="slotProps.state.value"
|
:status="slotProps.state.value"
|
||||||
:text="slotProps.state.text"
|
:text="slotProps.state.text"
|
||||||
:statusNames="{
|
:statusNames="{
|
||||||
online: 'success',
|
online: 'processing',
|
||||||
offline: 'error',
|
offline: 'error',
|
||||||
notActive: 'warning',
|
notActive: 'warning',
|
||||||
}"
|
}"
|
||||||
|
@ -247,6 +247,9 @@ const columns = [
|
||||||
search: {
|
search: {
|
||||||
rename: 'productId$product-info',
|
rename: 'productId$product-info',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
|
handleValue(value: string) {
|
||||||
|
return `id is ${value}`
|
||||||
|
},
|
||||||
options: () =>
|
options: () =>
|
||||||
new Promise((resolve) => {
|
new Promise((resolve) => {
|
||||||
const params = {
|
const params = {
|
||||||
|
@ -288,14 +291,9 @@ const columns = [
|
||||||
search: {
|
search: {
|
||||||
type: 'select',
|
type: 'select',
|
||||||
options: [
|
options: [
|
||||||
{
|
{ label: '禁用', value: 'notActive' },
|
||||||
label: '正常',
|
{ label: '离线', value: 'offline' },
|
||||||
value: 1,
|
{ label: '在线', value: 'online' },
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '禁用',
|
|
||||||
value: 0,
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
scopedSlots: true,
|
scopedSlots: true,
|
||||||
|
|
|
@ -68,9 +68,8 @@
|
||||||
:status="slotProps.state?.value"
|
:status="slotProps.state?.value"
|
||||||
:statusText="slotProps.state?.text"
|
:statusText="slotProps.state?.text"
|
||||||
:statusNames="{
|
:statusNames="{
|
||||||
online: 'success',
|
1: 'processing',
|
||||||
offline: 'error',
|
0: 'error',
|
||||||
notActive: 'warning',
|
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<template #img>
|
<template #img>
|
||||||
|
@ -172,9 +171,8 @@
|
||||||
:status="slotProps.state.value"
|
:status="slotProps.state.value"
|
||||||
:text="slotProps.state.text"
|
:text="slotProps.state.text"
|
||||||
:statusNames="{
|
:statusNames="{
|
||||||
online: 'success',
|
1: 'processing',
|
||||||
offline: 'error',
|
0: 'error',
|
||||||
notActive: 'warning',
|
|
||||||
}"
|
}"
|
||||||
></BadgeStatus>
|
></BadgeStatus>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<pro-search
|
<pro-search
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
target="category"
|
target="category"
|
||||||
@search="(params:any)=>queryParams = {...params}"
|
@search="handleParams"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<j-pro-table
|
<j-pro-table
|
||||||
|
@ -262,6 +262,23 @@ type dictType = {
|
||||||
name: string;
|
name: string;
|
||||||
};
|
};
|
||||||
type modalType = '' | 'add' | 'edit' | 'reset';
|
type modalType = '' | 'add' | 'edit' | 'reset';
|
||||||
|
|
||||||
|
const handleParams = (params: any)=> {
|
||||||
|
|
||||||
|
const newParams = (params?.terms as any[])?.map(item1 => {
|
||||||
|
item1.terms = item1.terms.map((item2: any) => {
|
||||||
|
if (['telephone', 'email'].includes(item2.column)) {
|
||||||
|
return {
|
||||||
|
column: 'id$user-detail',
|
||||||
|
value: [item2]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return item2
|
||||||
|
})
|
||||||
|
return item1
|
||||||
|
})
|
||||||
|
queryParams.value = { terms: newParams || [] }
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
|
|
@ -3700,8 +3700,8 @@ jetlinks-store@^0.0.3:
|
||||||
|
|
||||||
jetlinks-ui-components@^1.0.5:
|
jetlinks-ui-components@^1.0.5:
|
||||||
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#682711e0f69c141fff2c256db61a060c82539611"
|
resolved "http://47.108.170.157:9013/jetlinks-ui-components/-/jetlinks-ui-components-1.0.5.tgz#77bd58156212d793fdebe41fc8864eeed5db7182"
|
||||||
integrity sha512-rQxD/YlE+XSAG7BWIcFTtKrCQJXk5o+TUgejyuUT/baBThJB6xYt1k2dQEdXyiwpukYen5FzaoLpelSD9SUegw==
|
integrity sha512-VXuCMJlMV/bbmBhPtBzY/BUBIvGebQbguLPE06xps79i5Pjq46+HBW8VPsJ9MwvyMhYkhzPlQJu9Ft7v5uo+yA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@vueuse/core" "^9.12.0"
|
"@vueuse/core" "^9.12.0"
|
||||||
ant-design-vue "^3.2.15"
|
ant-design-vue "^3.2.15"
|
||||||
|
|
Loading…
Reference in New Issue