Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
XieYongHong 2023-07-10 20:12:20 +08:00
commit 19706fec7b
2 changed files with 69 additions and 110 deletions

View File

@ -94,7 +94,7 @@
<template #label> <template #label>
通知Token 通知Token
<j-tooltip <j-tooltip
title="自定义token,可用于验证请求是否来自OneNet" title="填写OneNet数据推送配置中设置的Token"
> >
<AIcon <AIcon
type="QuestionCircleOutlined" type="QuestionCircleOutlined"

View File

@ -1,14 +1,6 @@
<template> <template>
<j-modal <j-modal class="add-device-or-product-dialog-container" title="绑定" width="1440px" :maskClosable="false" @ok="confirm"
class="add-device-or-product-dialog-container" :confirmLoading="loading" @cancel="cancel" visible>
title="绑定"
width="1440px"
:maskClosable="false"
@ok="confirm"
:confirmLoading="loading"
@cancel="cancel"
visible
>
<h5 class="row"> <h5 class="row">
<AIcon type="ExclamationCircleOutlined" style="margin-right: 6px" /> <AIcon type="ExclamationCircleOutlined" style="margin-right: 6px" />
只能分配有共享权限的资产数据 只能分配有共享权限的资产数据
@ -16,12 +8,7 @@
<div class="row"> <div class="row">
<span style="margin-right: 8px">批量配置</span> <span style="margin-right: 8px">批量配置</span>
<j-switch <j-switch v-model:checked="bulkBool" checked-children="" un-checked-children="" style="width: 56px" />
v-model:checked="bulkBool"
checked-children="开"
un-checked-children="关"
style="width: 56px"
/>
</div> </div>
<div v-show="bulkBool"> <div v-show="bulkBool">
<j-checkbox-group v-model:value="bulkList" :options="options" /> <j-checkbox-group v-model:value="bulkList" :options="options" />
@ -45,44 +32,28 @@
:columns="columns" :columns="columns"
> >
<template #card="slotProps"> <template #card="slotProps">
<CardBox <CardBox :value="slotProps" :actions="[{ key: 1 }]" v-bind="slotProps" :active="table._selectedRowKeys.value.includes(slotProps.id)
:value="slotProps" " @click="table.onSelectChange" :status="slotProps.state?.value"
:actions="[{ key: 1 }]" :statusText="slotProps.state?.text" :statusNames="{
v-bind="slotProps"
:active="
table._selectedRowKeys.value.includes(slotProps.id)
"
@click="table.onSelectChange"
:status="slotProps.state?.value"
:statusText="slotProps.state?.text"
:statusNames="{
online: 'processing', online: 'processing',
offline: 'error', offline: 'error',
notActive: 'warning', notActive: 'warning',
}" }">
>
<template #img> <template #img>
<slot name="img"> <slot name="img">
<img <img :src="getImage('/device-product.png')" style="cursor: pointer" />
:src="getImage('/device-product.png')"
style="cursor: pointer"
/>
</slot> </slot>
</template> </template>
<template #content> <template #content>
<h3 class="card-item-content-title" style='margin-bottom: 18px;'> <h3 class="card-item-content-title" style='margin-bottom: 18px;'>
<Ellipsis style="width: calc(100% - 100px);" <Ellipsis style="width: calc(100% - 100px);">
> {{ slotProps.name }}
{{ slotProps.name }} </Ellipsis>
</Ellipsis>
</h3> </h3>
<j-row> <j-row>
<j-col :span="12"> <j-col :span="12">
<div class="card-item-content-text">ID</div> <div class="card-item-content-text">ID</div>
<div <div style="cursor: pointer" class="card-item-content-value">
style="cursor: pointer"
class="card-item-content-value"
>
{{ slotProps.id }} {{ slotProps.id }}
</div> </div>
</j-col> </j-col>
@ -90,17 +61,10 @@
<div class="card-item-content-text"> <div class="card-item-content-text">
资产权限 资产权限
</div> </div>
<div <div style="cursor: pointer" class="card-item-content-value"
style="cursor: pointer" @click="(e) => e.stopPropagation()">
class="card-item-content-value" <j-checkbox-group v-model:value="slotProps.selectPermissions
@click="(e) => e.stopPropagation()" " :options="slotProps.permissionList" />
>
<j-checkbox-group
v-model:value="
slotProps.selectPermissions
"
:options="slotProps.permissionList"
/>
</div> </div>
</j-col> </j-col>
</j-row> </j-row>
@ -109,27 +73,16 @@
</template> </template>
<template #permission="slotProps"> <template #permission="slotProps">
<div <div style="cursor: pointer" class="card-item-content-value" @click="(e) => e.stopPropagation()">
style="cursor: pointer" <j-checkbox-group v-model:value="slotProps.selectPermissions" :options="slotProps.permissionList" />
class="card-item-content-value"
@click="(e) => e.stopPropagation()"
>
<j-checkbox-group
v-model:value="slotProps.selectPermissions"
:options="slotProps.permissionList"
/>
</div> </div>
</template> </template>
<template #state="slotProps"> <template #state="slotProps">
<BadgeStatus <BadgeStatus :status="slotProps.state.value" :text="slotProps.state.text" :statusNames="{
:status="slotProps.state.value" online: 'processing',
:text="slotProps.state.text" offline: 'error',
:statusNames="{ notActive: 'warning',
online: 'processing', }"></BadgeStatus>
offline: 'error',
notActive: 'warning',
}"
></BadgeStatus>
</template> </template>
<template #registryTime="slotProps"> <template #registryTime="slotProps">
<span>{{ <span>{{
@ -215,23 +168,23 @@ const columns = props.queryColumns.filter(
); );
const searchColumns = computed(() => { const searchColumns = computed(() => {
return props.queryColumns.map(item => { return props.queryColumns.map(item => {
if (departmentStore.productId) { if (departmentStore.productId) {
if (item.dataIndex === 'productName') { if (item.dataIndex === 'productName') {
item.search.first = true item.search.first = true
item.search.componentProps = { item.search.componentProps = {
mode: 'multiple', mode: 'multiple',
"max-tag-count": "responsive" "max-tag-count": "responsive"
} }
item.search.defaultTermType = 'eq' item.search.defaultTermType = 'eq'
item.search.defaultOnceValue = departmentStore.productId item.search.defaultOnceValue = departmentStore.productId
} else if (item.search && 'first' in item.search) { } else if (item.search && 'first' in item.search) {
delete item.search.first delete item.search.first
} }
} }
return item return item
}) })
}) })
const queryParams = ref({}); const queryParams = ref({});
@ -370,14 +323,14 @@ const table: any = {
item.state === 1 item.state === 1
? 'online' ? 'online'
: item.state === 0 : item.state === 0
? 'offline' ? 'offline'
: '', : '',
text: text:
item.state === 1 item.state === 1
? '正常' ? '正常'
: item.state === 0 : item.state === 0
? '禁用' ? '禁用'
: '', : '',
}; };
} }
}); });
@ -402,18 +355,18 @@ const table: any = {
queryCount.value += 1; queryCount.value += 1;
if (props.parentId) { if (props.parentId) {
let terms = [{ let terms = [{
column: 'id', column: 'id',
termType: 'dim-assets$not', termType: 'dim-assets$not',
value: { value: {
assetType: props.assetType, assetType: props.assetType,
targets: [ targets: [
{ {
type: 'org', type: 'org',
id: props.parentId, id: props.parentId,
}, },
], ],
}, },
type: 'and' type: 'and'
}] }]
// if ( // if (
@ -426,7 +379,7 @@ const table: any = {
// terms[0].terms.pop(); // terms[0].terms.pop();
// } // }
if (oParams.terms && oParams.terms.length > 0) { if (oParams.terms && oParams.terms.length > 0) {
terms = [ ...oParams.terms, ...terms] terms = [...oParams.terms, ...terms]
} }
const params = { const params = {
@ -468,18 +421,22 @@ table.init();
// table._selectedRowKeys.value = okRows.map((item) => item.id); // table._selectedRowKeys.value = okRows.map((item) => item.id);
// }; // };
// fix: bug#10749 // fix: bug#10749
const selectChange = (keys: string[], rows: any[]) => { const selectChange = (record: any,selected: boolean,selectedRows: any,) => {
table.selectedRows = rows; if(selected){
table._selectedRowKeys.value = keys; table._selectedRowKeys.value.push(record?.id)
}else{
}
console.log(record,selected,selectedRows);
}; };
const cancel = () => { const cancel = () => {
departmentStore.setProductId() departmentStore.setProductId()
emits('update:visible', false) emits('update:visible', false)
} }
const search = (query: any) => { const search = (query: any) => {
queryParams.value = query queryParams.value = query
} }
</script> </script>
@ -489,11 +446,13 @@ const search = (query: any) => {
height: calc(100vh - 400px); height: calc(100vh - 400px);
overflow-y: auto; overflow-y: auto;
} }
h5 { h5 {
padding: 12px; padding: 12px;
background-color: #f6f6f6; background-color: #f6f6f6;
font-size: 14px; font-size: 14px;
} }
.row { .row {
margin-bottom: 12px; margin-bottom: 12px;
} }