feat: 新增设备根据标签进行搜索功能

* feat: 新增设备根据标签进行搜索功能
This commit is contained in:
qiaochuLei 2024-04-02 14:20:10 +08:00 committed by GitHub
parent f1aeeaed43
commit 4c52039964
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 79 additions and 20 deletions

View File

@ -232,33 +232,28 @@ const Area = (_: any, value: any): Promise<any> =>
);
return pass ? resolve('') : reject('请配置点位死区');
} else {
value.forEach((item: any) => {
if (
item.column ===
`this['currentValue'] - this['lastValue']*init/100`
) {
return reject('请配置点位死区');
} else {
return resolve('');
}
const validate = value.find((item: any) => {
item.column ===
`this['currentValue'] - this['lastValue']*init/100`;
});
return validate ? reject('请配置点位死区') : resolve('');
}
}
});
const bacnetValueType = ref<string[]>([])
const bacnetValueType = ref<string[]>([]);
const getIdAndType = async () => {
// const res = await getBacnetPropertyId()
// if(res.success) {
// bacnetPropertyId.value = res.result
// }
const resp: any = await getBacnetValueType()
if(resp.success) {
bacnetValueType.value = resp.result
}
}
// const res = await getBacnetPropertyId()
// if(res.success) {
// bacnetPropertyId.value = res.result
// }
const resp: any = await getBacnetValueType();
if (resp.success) {
bacnetValueType.value = resp.result;
}
};
getIdAndType()
getIdAndType();
const handleOk = async () => {
const res: any = await formRef.value?.validate();

View File

@ -0,0 +1,56 @@
<template>
<j-input @click="show" v-model:value="presentation"> </j-input>
<j-modal v-if="showTagSearch" title="筛选条件" visible @cancel="showTagSearch = false" @ok="submitSearch">
<j-form layout="vertical">
<j-form-item label="设备标签:">
<j-row :gutter="16" v-for="(i,index) in searchValue" style="margin-bottom: 10px;">
<j-col :span="10">
<j-input placeholder="请输入标签key" v-model:value="i.key"></j-input>
</j-col>
<j-col :span="10">
<j-input placeholder="请输入标签value" v-model:value="i.value"></j-input>
</j-col>
<j-col :span="4">
<j-button type="link">
<template #icon><AIcon type="MinusCircleOutlined" @click="deletePair(index)"/></template>
</j-button>
</j-col>
</j-row>
</j-form-item>
<j-button type="link" @click="addPair">
添加
</j-button>
</j-form>
</j-modal>
</template>
<script lang="ts" setup>
const emit = defineEmits(['change','update:value'])
const showTagSearch = ref(false);
const presentation = ref('');
const searchValue = ref([{
key:'',
value:''
}]);
const show = () => {
showTagSearch.value = true;
};
const addPair = () =>{
searchValue.value.push({
key:'',
value:''
})
}
const deletePair = (index:number) =>{
searchValue.value.splice(index,1)
}
const submitSearch = () => {
searchValue.value.forEach((item:any,index:number)=>{
presentation.value = index === 0 ? item.key + '=' + item.value :presentation.value + ';' + item.key + '=' + item.value
})
emit('update:value',searchValue)
emit('change')
showTagSearch.value = false
}
</script>
<style lang="less" scoped></style>

View File

@ -334,6 +334,7 @@ import BatchDropdown from '@/components/BatchDropdown/index.vue';
import { BatchActionsType } from '@/components/BatchDropdown/types';
import { useRouterParams } from '@/utils/hooks/useParams';
import { accessConfigTypeFilter } from '@/utils/setting';
import TagSearch from './components/TagSearch.vue'
const instanceRef = ref<Record<string, any>>({});
const params = ref<Record<string, any>>({});
@ -548,6 +549,13 @@ const columns = [
}),
},
},
{
key: 'id$dev-tag',
dataIndex: 'id$dev-tag',
title: '设备标签',
hideInTable: true,
search : { type: 'component' , components: TagSearch , termOptions:['eq'] }
},
{
title: '说明',
dataIndex: 'describe',