Merge branch 'dev' of github.com:jetlinks/jetlinks-ui-vue into dev
This commit is contained in:
commit
7da4678231
|
|
@ -166,6 +166,7 @@ const columns = [
|
||||||
dataIndex: 'registerTime',
|
dataIndex: 'registerTime',
|
||||||
search: {
|
search: {
|
||||||
type: 'date',
|
type: 'date',
|
||||||
|
rename: 'registryTime'
|
||||||
},
|
},
|
||||||
width: 200,
|
width: 200,
|
||||||
scopedSlots: true,
|
scopedSlots: true,
|
||||||
|
|
@ -290,7 +291,19 @@ watch(
|
||||||
* @param params
|
* @param params
|
||||||
*/
|
*/
|
||||||
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 (item2.column === 'version') {
|
||||||
|
return {
|
||||||
|
column: 'id$dev-firmware',
|
||||||
|
value: [item2]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return item2
|
||||||
|
})
|
||||||
|
return item1
|
||||||
|
})
|
||||||
|
params.value = { terms: newParams || []}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1019,6 +1019,9 @@ watchEffect(() => {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
getData();
|
getData();
|
||||||
});
|
});
|
||||||
|
watch(()=>productStore.current,()=>{
|
||||||
|
getData()
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
:deep(
|
:deep(
|
||||||
|
|
|
||||||
|
|
@ -185,7 +185,8 @@ export default [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
accessSupport: { text: "支持", value: "support" },
|
accessSupport: { text: "支持", value: "support" },
|
||||||
supportDataAccess: true
|
supportDataAccess: true,
|
||||||
|
assetType: 'notifyConfig'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
code: 'notice/Template',
|
code: 'notice/Template',
|
||||||
|
|
@ -306,6 +307,7 @@ export default [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
accessSupport: { text: "支持", value: "support" },
|
accessSupport: { text: "支持", value: "support" },
|
||||||
|
assetType: 'notifyTemplate',
|
||||||
supportDataAccess: true
|
supportDataAccess: true
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
@ -969,8 +971,9 @@ export default [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
accessSupport: { text: "不支持", value: "unsupported" },
|
accessSupport: { text: "支持", value: "support" },
|
||||||
supportDataAccess: false
|
supportDataAccess: true,
|
||||||
|
assetType: 'deviceGateway'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
code: 'link/Protocol',
|
code: 'link/Protocol',
|
||||||
|
|
@ -1041,8 +1044,9 @@ export default [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
accessSupport: { text: "不支持", value: "unsupported" },
|
accessSupport: { text: "支持", value: "support" },
|
||||||
supportDataAccess: false
|
supportDataAccess: true,
|
||||||
|
assetType: 'protocol'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
code: 'Log',
|
code: 'Log',
|
||||||
|
|
@ -1143,8 +1147,9 @@ export default [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
accessSupport: { text: "不支持", value: "unsupported" },
|
accessSupport: { text: "支持", value: "support" },
|
||||||
supportDataAccess: false
|
supportDataAccess: true,
|
||||||
|
assetType: 'network'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
code: 'link/Certificate',
|
code: 'link/Certificate',
|
||||||
|
|
@ -1200,7 +1205,8 @@ export default [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
accessSupport: { text: "支持", value: "support" },
|
accessSupport: { text: "支持", value: "support" },
|
||||||
supportDataAccess: true
|
supportDataAccess: true,
|
||||||
|
assetType: 'certificate'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
code: 'media/Stream',
|
code: 'media/Stream',
|
||||||
|
|
@ -1546,7 +1552,8 @@ export default [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
accessSupport: { text: "支持", value: "support" },
|
accessSupport: { text: "支持", value: "support" },
|
||||||
supportDataAccess: true
|
supportDataAccess: true,
|
||||||
|
assetType: 'dataCollectChannel'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
code: 'DataCollect/Collector',
|
code: 'DataCollect/Collector',
|
||||||
|
|
@ -1679,7 +1686,8 @@ export default [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
accessSupport: { text: "支持", value: "support" },
|
accessSupport: { text: "支持", value: "support" },
|
||||||
supportDataAccess: true
|
supportDataAccess: true,
|
||||||
|
assetType: 'ataCollectCollector'
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
@ -1850,7 +1858,8 @@ export default [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
accessSupport: { text: "支持", value: "support" },
|
accessSupport: { text: "支持", value: "support" },
|
||||||
supportDataAccess: true
|
supportDataAccess: true,
|
||||||
|
assetType: 'alarmConfig'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
code: 'rule-engine/Alarm/Log',
|
code: 'rule-engine/Alarm/Log',
|
||||||
|
|
@ -1994,8 +2003,9 @@ export default [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
accessSupport: { text: "不支持", value: "unsupported" },
|
accessSupport: { text: "支持", value: "support" },
|
||||||
supportDataAccess: false
|
supportDataAccess: true,
|
||||||
|
assetType: 'dueros'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
code: 'Northbound/AliCloud',
|
code: 'Northbound/AliCloud',
|
||||||
|
|
@ -2233,7 +2243,8 @@ export default [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
accessSupport: { text: "支持", value: "support" },
|
accessSupport: { text: "支持", value: "support" },
|
||||||
supportDataAccess: true
|
supportDataAccess: true,
|
||||||
|
assetType: 'ruleInstance'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
code: 'rule-engine/Scene',
|
code: 'rule-engine/Scene',
|
||||||
|
|
@ -2385,7 +2396,8 @@ export default [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
accessSupport: { text: "支持", value: "support" },
|
accessSupport: { text: "支持", value: "support" },
|
||||||
supportDataAccess: true
|
supportDataAccess: true,
|
||||||
|
assetType: 'scene'
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
@ -2906,7 +2918,8 @@ export default [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
accessSupport: { text: "支持", value: "support" },
|
accessSupport: { text: "支持", value: "support" },
|
||||||
supportDataAccess: true
|
supportDataAccess: true,
|
||||||
|
assetType: 'gbCascade'
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
@ -3051,7 +3064,8 @@ export default [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
accessSupport: { text: "支持", value: "support" },
|
accessSupport: { text: "支持", value: "support" },
|
||||||
supportDataAccess: true
|
supportDataAccess: true,
|
||||||
|
assetType: 'user'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
code: 'system/Department',
|
code: 'system/Department',
|
||||||
|
|
@ -3249,7 +3263,8 @@ export default [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
accessSupport: { text: "支持", value: "support" },
|
accessSupport: { text: "支持", value: "support" },
|
||||||
supportDataAccess: true
|
supportDataAccess: true,
|
||||||
|
assetType: 'organization'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
code: 'system/Role',
|
code: 'system/Role',
|
||||||
|
|
@ -3326,7 +3341,8 @@ export default [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
accessSupport: { text: "支持", value: "support" },
|
accessSupport: { text: "支持", value: "support" },
|
||||||
supportDataAccess: true
|
supportDataAccess: true,
|
||||||
|
assetType: 'role'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
code: 'system/Menu',
|
code: 'system/Menu',
|
||||||
|
|
@ -3640,7 +3656,8 @@ export default [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
accessSupport: { text: "支持", value: "support" },
|
accessSupport: { text: "支持", value: "support" },
|
||||||
supportDataAccess: true
|
supportDataAccess: true,
|
||||||
|
assetType: 'datasource'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
code: 'system/Platforms/Setting',
|
code: 'system/Platforms/Setting',
|
||||||
|
|
@ -4042,8 +4059,9 @@ export default [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
accessSupport: { text: "不支持", value: "unsupported" },
|
accessSupport: { text: "支持", value: "support" },
|
||||||
supportDataAccess: false
|
supportDataAccess: true,
|
||||||
|
assetType: 'networkCard'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '5Hpl-ZjAG',
|
path: '5Hpl-ZjAG',
|
||||||
|
|
@ -4160,8 +4178,9 @@ export default [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
accessSupport: { text: "不支持", value: "unsupported" },
|
accessSupport: { text: "支持", value: "support" },
|
||||||
supportDataAccess: false
|
supportDataAccess: true,
|
||||||
|
assetType: 'networkCardPlatform'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '5Hpl-cL34',
|
path: '5Hpl-cL34',
|
||||||
|
|
|
||||||
|
|
@ -1,132 +1,146 @@
|
||||||
<!-- 绑定设备 -->
|
<!-- 绑定设备 -->
|
||||||
<template>
|
<template>
|
||||||
<j-modal :maskClosable="false" width="1100px" :visible="true" title="选择设备" okText="确定" cancelText="取消" @ok="handleOk"
|
<j-modal :maskClosable='false' width='1100px' :visible='true' title='选择设备' okText='确定' cancelText='取消' @ok='handleOk'
|
||||||
@cancel="handleCancel" :confirmLoading="btnLoading">
|
@cancel='handleCancel' :confirmLoading='btnLoading'>
|
||||||
<div style="margin-top: 10px">
|
<div style='margin-top: 10px'>
|
||||||
<pro-search :columns="columns" target="iot-card-bind-device" @search="handleSearch" type="simple" />
|
<pro-search :columns='columns' target='iot-card-bind-device' @search='handleSearch' type='simple' />
|
||||||
<j-pro-table ref="bindDeviceRef" :columns="columns" :request="queryUnbounded" model="TABLE" :defaultParams="{
|
<j-pro-table
|
||||||
sorts: [{ name: 'createTime', order: 'desc' }],
|
ref='bindDeviceRef'
|
||||||
}" :rowSelection="{
|
:columns='columns'
|
||||||
type: 'radio',
|
:request='queryUnbounded'
|
||||||
selectedRowKeys: _selectedRowKeys,
|
model='TABLE'
|
||||||
onSelect: onSelectChange,
|
:defaultParams="{
|
||||||
}" @cancelSelect="cancelSelect" :params="params">
|
pageSize: 10,
|
||||||
<template #registryTime="slotProps">
|
sorts: [{ name: 'createTime', order: 'desc' }],
|
||||||
{{
|
}"
|
||||||
slotProps.registryTime
|
:pagination="{
|
||||||
? moment(slotProps.registryTime).format(
|
showSizeChanger: true,
|
||||||
'YYYY-MM-DD HH:mm:ss',
|
pageSizeOptions: ['10', '20', '50', '100'],
|
||||||
)
|
}"
|
||||||
: ''
|
:rowSelection="{
|
||||||
}}
|
type: 'radio',
|
||||||
</template>
|
selectedRowKeys: _selectedRowKeys,
|
||||||
<template #state="slotProps">
|
onSelect: onSelectChange,
|
||||||
<j-badge :text="slotProps.state.text" :status="statusMap.get(slotProps.state.value)" />
|
}"
|
||||||
</template>
|
@cancelSelect='cancelSelect'
|
||||||
</j-pro-table>
|
:params='params'
|
||||||
</div>
|
>
|
||||||
</j-modal>
|
<template #registryTime='slotProps'>
|
||||||
|
{{
|
||||||
|
slotProps.registryTime
|
||||||
|
? moment(slotProps.registryTime).format(
|
||||||
|
'YYYY-MM-DD HH:mm:ss'
|
||||||
|
)
|
||||||
|
: ''
|
||||||
|
}}
|
||||||
|
</template>
|
||||||
|
<template #state='slotProps'>
|
||||||
|
<j-badge :text='slotProps.state.text' :status='statusMap.get(slotProps.state.value)' />
|
||||||
|
</template>
|
||||||
|
</j-pro-table>
|
||||||
|
</div>
|
||||||
|
</j-modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang='ts'>
|
||||||
import { queryUnbounded, bind } from '@/api/iot-card/cardManagement';
|
import { queryUnbounded, bind } from '@/api/iot-card/cardManagement'
|
||||||
import moment from 'moment';
|
import moment from 'moment'
|
||||||
import { message } from 'jetlinks-ui-components';
|
import { message } from 'jetlinks-ui-components'
|
||||||
|
|
||||||
const emit = defineEmits(['change']);
|
const emit = defineEmits(['change'])
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
cardId: {
|
cardId: {
|
||||||
type: String,
|
type: String
|
||||||
},
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
const bindDeviceRef = ref<Record<string, any>>({});
|
const bindDeviceRef = ref<Record<string, any>>({})
|
||||||
const params = ref<Record<string, any>>({});
|
const params = ref<Record<string, any>>({})
|
||||||
const _selectedRowKeys = ref<string[]>([]);
|
const _selectedRowKeys = ref<string[]>([])
|
||||||
const btnLoading = ref<boolean>(false);
|
const btnLoading = ref<boolean>(false)
|
||||||
|
|
||||||
const statusMap = new Map();
|
const statusMap = new Map()
|
||||||
statusMap.set('online', 'processing');
|
statusMap.set('online', 'processing')
|
||||||
statusMap.set('offline', 'error');
|
statusMap.set('offline', 'error')
|
||||||
statusMap.set('notActive', 'warning');
|
statusMap.set('notActive', 'warning')
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
title: 'ID',
|
title: 'ID',
|
||||||
dataIndex: 'id',
|
dataIndex: 'id',
|
||||||
key: 'id',
|
key: 'id',
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
fixed: 'left',
|
fixed: 'left',
|
||||||
search: {
|
search: {
|
||||||
type: 'string',
|
type: 'string'
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '设备名称',
|
title: '设备名称',
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
key: 'name',
|
key: 'name',
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
search: {
|
search: {
|
||||||
type: 'string',
|
type: 'string'
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '注册时间',
|
title: '注册时间',
|
||||||
dataIndex: 'registryTime',
|
dataIndex: 'registryTime',
|
||||||
key: 'registryTime',
|
key: 'registryTime',
|
||||||
scopedSlots: true,
|
scopedSlots: true,
|
||||||
search: {
|
search: {
|
||||||
type: 'date',
|
type: 'date'
|
||||||
},
|
}
|
||||||
// sorter: true,
|
// sorter: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '状态',
|
title: '状态',
|
||||||
dataIndex: 'state',
|
dataIndex: 'state',
|
||||||
key: 'state',
|
key: 'state',
|
||||||
scopedSlots: true,
|
scopedSlots: true,
|
||||||
search: {
|
search: {
|
||||||
type: 'select',
|
type: 'select',
|
||||||
options: [
|
options: [
|
||||||
{ label: '禁用', value: 'notActive' },
|
{ label: '禁用', value: 'notActive' },
|
||||||
{ label: '离线', value: 'offline' },
|
{ label: '离线', value: 'offline' },
|
||||||
{ label: '在线', value: 'online' },
|
{ label: '在线', value: 'online' }
|
||||||
],
|
]
|
||||||
},
|
}
|
||||||
// filterMultiple: false,
|
// filterMultiple: false,
|
||||||
},
|
}
|
||||||
];
|
]
|
||||||
|
|
||||||
const handleSearch = (e: any) => {
|
const handleSearch = (e: any) => {
|
||||||
params.value = e;
|
params.value = e
|
||||||
};
|
}
|
||||||
|
|
||||||
const onSelectChange = (record: any) => {
|
const onSelectChange = (record: any) => {
|
||||||
_selectedRowKeys.value = [record.id];
|
_selectedRowKeys.value = [record.id]
|
||||||
};
|
}
|
||||||
|
|
||||||
const cancelSelect = () => {
|
const cancelSelect = () => {
|
||||||
_selectedRowKeys.value = [];
|
_selectedRowKeys.value = []
|
||||||
};
|
}
|
||||||
|
|
||||||
const handleOk = () => {
|
const handleOk = () => {
|
||||||
btnLoading.value = true;
|
btnLoading.value = true
|
||||||
bind(props.cardId, _selectedRowKeys.value[0])
|
bind(props.cardId, _selectedRowKeys.value[0])
|
||||||
.then((resp: any) => {
|
.then((resp: any) => {
|
||||||
if (resp.status === 200) {
|
if (resp.status === 200) {
|
||||||
message.success('操作成功')
|
message.success('操作成功')
|
||||||
emit('change', true);
|
emit('change', true)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
btnLoading.value = false;
|
btnLoading.value = false
|
||||||
});
|
})
|
||||||
};
|
}
|
||||||
|
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
emit('change', false);
|
emit('change', false)
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="less"></style>
|
<style scoped lang='less'></style>
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,6 @@
|
||||||
<TimeSelect
|
<TimeSelect
|
||||||
key="flow-static"
|
key="flow-static"
|
||||||
:type="'week'"
|
:type="'week'"
|
||||||
|
|
||||||
@change="initQueryTime"
|
@change="initQueryTime"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -483,7 +482,11 @@ const selectChange = () => {
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
state.ranking = res.result
|
state.ranking = res.result
|
||||||
?.filter((item: any) => item.group === 'alarmRank')
|
?.filter(
|
||||||
|
(item: any) =>
|
||||||
|
item.group === 'alarmRank' &&
|
||||||
|
item.data?.value?.count !== 0,
|
||||||
|
)
|
||||||
.map((d: { data: { value: any } }) => d.data?.value)
|
.map((d: { data: { value: any } }) => d.data?.value)
|
||||||
.sort(
|
.sort(
|
||||||
(a: { count: number }, b: { count: number }) =>
|
(a: { count: number }, b: { count: number }) =>
|
||||||
|
|
|
||||||
|
|
@ -242,10 +242,30 @@ const handleOptionsColumnsValue = (termsColumns: any[], _options: any) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const columnSelect = (e: any) => {
|
const columnSelect = (e: any) => {
|
||||||
paramsValue.termType = 'eq'
|
const dataType = e.type
|
||||||
paramsValue.value = {
|
const hasTypeChange = dataType !== tabsOptions.value[0].component
|
||||||
source: tabsOptions.value[0].key,
|
let termTypeChange = false
|
||||||
value: undefined
|
|
||||||
|
// 如果参数类型未发生变化,则不修改操作符以及值
|
||||||
|
const termTypes = e.termTypes
|
||||||
|
if (!termTypes.some((item: {id: string}) => paramsValue.termType === item.id)) { // 修改操作符
|
||||||
|
termTypeChange = true
|
||||||
|
paramsValue.termType = termTypes?.length ? termTypes[0].id : 'eq'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasTypeChange) {
|
||||||
|
paramsValue.termType = termTypes?.length ? termTypes[0].id : 'eq'
|
||||||
|
paramsValue.value = {
|
||||||
|
source: tabsOptions.value[0].key,
|
||||||
|
value: undefined
|
||||||
|
}
|
||||||
|
} else if (termTypeChange) {
|
||||||
|
const oldValue = isArray(paramsValue.value!.value) ? paramsValue.value!.value[0] : paramsValue.value!.value
|
||||||
|
const value = arrayParamsKey.includes(e.key) ? [ oldValue, undefined ] : oldValue
|
||||||
|
paramsValue.value = {
|
||||||
|
source: paramsValue.value?.source || tabsOptions.value[0].key,
|
||||||
|
value: value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const columns = e.metadata === true ? [e.column] : []
|
const columns = e.metadata === true ? [e.column] : []
|
||||||
|
|
@ -266,7 +286,7 @@ const termsTypeSelect = (e: { key: string, name: string }) => {
|
||||||
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(e.key) ? [ oldValue, undefined ] : oldValue
|
const value = arrayParamsKey.includes(e.key) ? [ oldValue, undefined ] : oldValue
|
||||||
paramsValue.value = {
|
paramsValue.value = {
|
||||||
source: tabsOptions.value[0].key,
|
source: paramsValue.value?.source || tabsOptions.value[0].key,
|
||||||
value: value
|
value: value
|
||||||
}
|
}
|
||||||
emit('update:value', { ...paramsValue })
|
emit('update:value', { ...paramsValue })
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ const label: Record<number, any> = {
|
||||||
|
|
||||||
const emit = defineEmits<Emit>()
|
const emit = defineEmits<Emit>()
|
||||||
|
|
||||||
const myValue = ref<ValueType>(props.value)
|
const myValue = ref<ValueType>(props.value || [undefined, undefined] as any)
|
||||||
const mySource = ref<string>(props.source)
|
const mySource = ref<string>(props.source)
|
||||||
|
|
||||||
const onSelect = (v: any, _label: string, index: number) => {
|
const onSelect = (v: any, _label: string, index: number) => {
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ type Emit = {
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
...defaultSetting
|
...defaultSetting,
|
||||||
})
|
})
|
||||||
|
|
||||||
const emit = defineEmits<Emit>()
|
const emit = defineEmits<Emit>()
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ export type TabsOption = {
|
||||||
key: string;
|
key: string;
|
||||||
component: string
|
component: string
|
||||||
}
|
}
|
||||||
type ValueArrayType = [string, number]
|
type ValueArrayType = [string, number, undefined]
|
||||||
export type ValueType = string | number | undefined | ValueArrayType
|
export type ValueType = string | number | undefined | ValueArrayType
|
||||||
|
|
||||||
export const defaultSetting = {
|
export const defaultSetting = {
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ const props = defineProps({
|
||||||
type: '',
|
type: '',
|
||||||
termType: 'eq',
|
termType: 'eq',
|
||||||
value: {
|
value: {
|
||||||
source: 'fixed',
|
source: 'manual',
|
||||||
value: undefined
|
value: undefined
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -216,12 +216,20 @@ watch(() => [columnOptions.value, paramsValue.column], () => {
|
||||||
|
|
||||||
const showDouble = computed(() => {
|
const showDouble = computed(() => {
|
||||||
const isRange = paramsValue.termType ? arrayParamsKey.includes(paramsValue.termType) : false
|
const isRange = paramsValue.termType ? arrayParamsKey.includes(paramsValue.termType) : false
|
||||||
|
const isSourceMetric = paramsValue.value?.source === 'metric'
|
||||||
if (metricsCacheOption.value.length) {
|
if (metricsCacheOption.value.length) {
|
||||||
metricOption.value = metricsCacheOption.value.filter(item => isRange ? item.range : !item.range)
|
metricOption.value = metricsCacheOption.value.filter(item => isRange ? item.range : !item.range)
|
||||||
} else {
|
} else {
|
||||||
metricOption.value = []
|
metricOption.value = []
|
||||||
}
|
}
|
||||||
return isRange && !isMetric.value
|
|
||||||
|
if (isRange) {
|
||||||
|
if (isMetric.value) {
|
||||||
|
return !isSourceMetric
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
})
|
})
|
||||||
|
|
||||||
const mouseover = () => {
|
const mouseover = () => {
|
||||||
|
|
@ -237,11 +245,29 @@ const mouseout = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const columnSelect = (option: any) => {
|
const columnSelect = (option: any) => {
|
||||||
|
const dataType = option.dataType
|
||||||
|
const hasTypeChange = dataType !== tabsOptions.value[0].component
|
||||||
|
let termTypeChange = false
|
||||||
|
// 如果参数类型未发生变化,则不修改操作符以及值
|
||||||
const termTypes = option.termTypes
|
const termTypes = option.termTypes
|
||||||
paramsValue.termType = termTypes?.length ? termTypes[0].id : 'eq'
|
if (!termTypes.some((item: {id: string}) => paramsValue.termType === item.id)) { // 修改操作符
|
||||||
paramsValue.value = {
|
termTypeChange = true
|
||||||
source: tabsOptions.value[0].key,
|
paramsValue.termType = termTypes?.length ? termTypes[0].id : 'eq'
|
||||||
value: undefined
|
}
|
||||||
|
|
||||||
|
if (hasTypeChange) { // 类型发生变化
|
||||||
|
paramsValue.termType = termTypes?.length ? termTypes[0].id : 'eq'
|
||||||
|
paramsValue.value = {
|
||||||
|
source: tabsOptions.value[0].key,
|
||||||
|
value: undefined
|
||||||
|
}
|
||||||
|
} 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,
|
||||||
|
value: value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
handOptionByColumn(option)
|
handOptionByColumn(option)
|
||||||
emit('update:value', { ...paramsValue })
|
emit('update:value', { ...paramsValue })
|
||||||
|
|
@ -254,7 +280,7 @@ const termsTypeSelect = (e: { key: string, name: string }) => {
|
||||||
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(e.key) ? [ oldValue, undefined ] : oldValue
|
const value = arrayParamsKey.includes(e.key) ? [ oldValue, undefined ] : oldValue
|
||||||
paramsValue.value = {
|
paramsValue.value = {
|
||||||
source: tabsOptions.value[0].key,
|
source: paramsValue.value?.source || tabsOptions.value[0].key,
|
||||||
value: value
|
value: value
|
||||||
}
|
}
|
||||||
emit('update:value', { ...paramsValue })
|
emit('update:value', { ...paramsValue })
|
||||||
|
|
@ -263,7 +289,7 @@ const termsTypeSelect = (e: { key: string, name: string }) => {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const valueSelect = (_: any, label: string, labelObj: Record<number, any>) => {
|
const valueSelect = (v: any, label: string, labelObj: Record<number, any>) => {
|
||||||
emit('update:value', { ...paramsValue })
|
emit('update:value', { ...paramsValue })
|
||||||
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.name][2] = labelObj
|
||||||
|
|
@ -278,7 +304,7 @@ const termAdd = () => {
|
||||||
const terms = {
|
const terms = {
|
||||||
column: undefined,
|
column: undefined,
|
||||||
value: {
|
value: {
|
||||||
source: 'fixed',
|
source: 'manual',
|
||||||
value: undefined
|
value: undefined
|
||||||
},
|
},
|
||||||
termType: undefined,
|
termType: undefined,
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ const addWhen = () => {
|
||||||
{
|
{
|
||||||
column: undefined,
|
column: undefined,
|
||||||
value: {
|
value: {
|
||||||
source: 'fixed',
|
source: 'manual',
|
||||||
value: undefined
|
value: undefined
|
||||||
},
|
},
|
||||||
termType: undefined,
|
termType: undefined,
|
||||||
|
|
|
||||||
|
|
@ -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#531a7cd5cc4069dc299f0efcc92411a4eee369e7"
|
resolved "http://47.108.170.157:9013/jetlinks-ui-components/-/jetlinks-ui-components-1.0.5.tgz#031a300df4df31a353d738cacee8b4ff630ae2d0"
|
||||||
integrity sha512-7VHsz5lVG9PlFkHoJvEown4QARuVuasR+jDa9NNQ+pJSHAtHAeiIO1bpVTQKfE5WCyhCKPnN8yIerJLLzmQ1fA==
|
integrity sha512-SfucQ7LzlE13VdyZsDhrhzwF9Le/NOke5F6UY3bNN1OJiRD/bZMJecGQxWBQGv567lKcV60SOPCMT8ExiZxUgw==
|
||||||
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