fix: 13662、13673、13173

This commit is contained in:
100011797 2023-05-17 18:08:25 +08:00
parent 5dcbf2d28f
commit 8e890e89fd
7 changed files with 83 additions and 33 deletions

View File

@ -470,8 +470,8 @@ const query = reactive({
}, },
{ {
title: '接入方式', title: '接入方式',
key: 'accessName', key: 'accessId',
dataIndex: 'accessName', dataIndex: 'accessId',
search: { search: {
type: 'select', type: 'select',
options: async () => { options: async () => {
@ -482,7 +482,7 @@ const query = reactive({
typeList.value = []; typeList.value = [];
typeList.value = resp.result.map((item: any) => ({ typeList.value = resp.result.map((item: any) => ({
label: item.name, label: item.name,
value: item.name, value: item.id,
})); }));
res(typeList.value); res(typeList.value);
}); });

View File

@ -271,11 +271,11 @@ const columns = [
}, },
{ {
title: '关联场景联动', title: '关联场景联动',
dataIndex: 'sceneId', dataIndex: 'scene',
wdith: 250,
scopedSlots: true, scopedSlots: true,
search: { search: {
type: 'select', type: 'select',
// defaultTermType: 'rule-bind-alarm',
options: async () => { options: async () => {
const res = await getScene( const res = await getScene(
encodeQuery({ encodeQuery({
@ -338,7 +338,23 @@ const map = {
other: '其他', other: '其他',
}; };
const handleSearch = (e: any) => { const handleSearch = (e: any) => {
params.value = e; const _terms = (e?.terms || []).map((item: any) => {
item.terms = item.terms.map((i: any) => {
if(i.column === 'scene'){
return {
...i,
termType: 'rule-bind-alarm',
column: 'id'
}
}
return i
})
return item
})
params.value = {
...e,
terms: _terms
}
}; };
const queryDefaultLevel = () => { const queryDefaultLevel = () => {
queryLevel().then((res) => { queryLevel().then((res) => {

View File

@ -38,7 +38,7 @@
v-if="['email'].includes(notifyType)" v-if="['email'].includes(notifyType)"
style="width: calc(100% - 120px)" style="width: calc(100% - 120px)"
placeholder="请选择收信人" placeholder="请选择收信人"
@change="(key, label) => onChange(source, key, false, label)" @change="(key, label) => onChange(source, key, label)"
:tree-data="treeData" :tree-data="treeData"
:multiple="true" :multiple="true"
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }" :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
@ -66,7 +66,7 @@
style="width: calc(100% - 120px)" style="width: calc(100% - 120px)"
placeholder="请选择收信人" placeholder="请选择收信人"
@change=" @change="
(key, label) => onChange(source, key, undefined, label) (key, label) => onChange(source, key, label)
" "
:tree-data="treeData" :tree-data="treeData"
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }" :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
@ -102,7 +102,6 @@
onChange( onChange(
source, source,
val, val,
false,
option?.label || option?.name, option?.label || option?.name,
) )
" "
@ -120,7 +119,6 @@
onChange( onChange(
source, source,
val, val,
false,
Array.isArray(val) ? val.join(',') : val, Array.isArray(val) ? val.join(',') : val,
) )
" "
@ -132,7 +130,7 @@
:value="value?.value" :value="value?.value"
@change=" @change="
(e) => (e) =>
onChange(source, e.target.value, false, e.target.value) onChange(source, e.target.value, e.target.value)
" "
></j-input> ></j-input>
</template> </template>
@ -183,7 +181,13 @@ const triggerType = computed(() => {
const relationData = computed(() => { const relationData = computed(() => {
const item = props.value; const item = props.value;
if (item?.source === 'relation') { if(notifyType.value === 'email'){
if(item && Array.isArray(item) && item.length){
if(item[0].source === 'relation'){
return item.map(i => i?.relation?.objectId)
}
}
} else if (item?.source === 'relation') {
const relation = item?.relation; const relation = item?.relation;
if (relation) { if (relation) {
if (relation.objectId) { if (relation.objectId) {
@ -324,7 +328,7 @@ const getObj = (
const onChange = ( const onChange = (
_source: string = 'fixed', _source: string = 'fixed',
_value?: string | string[], _value?: string | string[],
isRelation?: boolean, // isRelation?: boolean,
_name?: string, _name?: string,
) => { ) => {
let _values: any = undefined; let _values: any = undefined;
@ -332,16 +336,15 @@ const onChange = (
const _names: string[] = Array.isArray(_name) ? _name : [_name || '']; const _names: string[] = Array.isArray(_name) ? _name : [_name || ''];
if (Array.isArray(_value)) { if (Array.isArray(_value)) {
if (props?.notify?.notifyType === 'email') { if (props?.notify?.notifyType === 'email') {
if (isRelation) { _values = _value.map((item) => {
const arr = _value.map((item) => { return {
const _item = labelMap.get(item); source: "relation",
_names.push(_item?.name || ''); relation:{
return getObj('relation', item, _item?.relation); objectType: "user",
}); objectId: item
_values = arr; }
} else { }
_values = getObj(_source, _value, false); });
}
} }
} else { } else {
const item = treeDataMap.get(_value) const item = treeDataMap.get(_value)

View File

@ -149,7 +149,7 @@
:model="form.data" :model="form.data"
class="basic-form permiss-form" class="basic-form permiss-form"
> >
<j-form-item name="accessSupport" required> <j-form-item name="accessSupport" required v-if="isNoCommunity">
<template #label> <template #label>
<span style="margin-right: 3px">数据权限控制</span> <span style="margin-right: 3px">数据权限控制</span>
<j-tooltip title="此菜单页面数据所对应的资产类型"> <j-tooltip title="此菜单页面数据所对应的资产类型">
@ -263,7 +263,6 @@ import { FormInstance } from 'ant-design-vue';
import { message } from 'jetlinks-ui-components'; import { message } from 'jetlinks-ui-components';
import ChooseIconDialog from '../components/ChooseIconDialog.vue'; import ChooseIconDialog from '../components/ChooseIconDialog.vue';
import PermissChoose from '../components/PermissChoose.vue'; import PermissChoose from '../components/PermissChoose.vue';
import { import {
getMenuTree_api, getMenuTree_api,
getAssetsType_api, getAssetsType_api,
@ -273,6 +272,7 @@ import {
validCode_api, validCode_api,
} from '@/api/system/menu'; } from '@/api/system/menu';
import { Rule } from 'ant-design-vue/lib/form'; import { Rule } from 'ant-design-vue/lib/form';
import { isNoCommunity } from '@/utils/utils';
const permission = 'system/Menu'; const permission = 'system/Menu';
// //

View File

@ -38,6 +38,7 @@ import {
import { message } from 'jetlinks-ui-components'; import { message } from 'jetlinks-ui-components';
import { modeType } from '../typing'; import { modeType } from '../typing';
import { useDepartmentStore } from '@/store/department'; import { useDepartmentStore } from '@/store/department';
import { onlyMessage } from '@/utils/comm';
const department = useDepartmentStore(); const department = useDepartmentStore();
const emits = defineEmits([ const emits = defineEmits([
@ -136,11 +137,16 @@ const save = async () => {
// emits('refresh'); // emits('refresh');
// }); // });
// fix: bug#10829 // fix: bug#10829
removeKeys.length && (await delOperations_api(removeKeys)); if(addKeys.length || removeKeys.length) {
const res = await addOperations_api(addKeys); removeKeys.length && (await delOperations_api(removeKeys));
if (res.success) { const res = await addOperations_api(addKeys);
message.success('操作成功'); if (res.success) {
emits('refresh'); message.success('操作成功');
emits('refresh');
}
} else {
onlyMessage('请选择API接口','error')
return
} }
} else if (props.mode === 'appManger') { } else if (props.mode === 'appManger') {
const removeItems = removeKeys.map((key) => ({ const removeItems = removeKeys.map((key) => ({

View File

@ -109,6 +109,7 @@ import {
USER_CENTER_MENU_CODE, USER_CENTER_MENU_CODE,
MESSAGE_SUBSCRIBE_MENU_CODE MESSAGE_SUBSCRIBE_MENU_CODE
} from '@/utils/consts' } from '@/utils/consts'
import { isNoCommunity } from '@/utils/utils'
const emits = defineEmits(['update:selectItems']); const emits = defineEmits(['update:selectItems']);
const route = useRoute(); const route = useRoute();
@ -117,6 +118,7 @@ const props = defineProps({
}); });
const treeRef = ref(); const treeRef = ref();
let { ctx: that, proxy } = getCurrentInstance(); let { ctx: that, proxy } = getCurrentInstance();
const columns = [ const columns = [
{ {
title: '菜单权限', title: '菜单权限',
@ -130,13 +132,16 @@ const columns = [
key: 'action', key: 'action',
width: '260px', width: '260px',
}, },
{ ];
if(isNoCommunity){
columns.push({
title: '数据权限', title: '数据权限',
dataIndex: 'data', dataIndex: 'data',
key: 'data', key: 'data',
width: '50%', width: '50%',
}, })
]; }
const tableData = ref<tableItemType[]>([]); const tableData = ref<tableItemType[]>([]);
// - // -

View File

@ -270,6 +270,7 @@ type modalType = '' | 'add' | 'edit' | 'reset';
const handleParams = (params: any) => { const handleParams = (params: any) => {
const newParams = (params?.terms as any[])?.map((item1) => { const newParams = (params?.terms as any[])?.map((item1) => {
let arr: any[] = []
item1.terms = item1.terms.map((item2: any) => { item1.terms = item1.terms.map((item2: any) => {
if (['telephone', 'email'].includes(item2.column)) { if (['telephone', 'email'].includes(item2.column)) {
return { return {
@ -277,8 +278,27 @@ const handleParams = (params: any) => {
value: [item2], value: [item2],
}; };
} }
if (['type'].includes(item2.column) && item2.value === 'other') {
arr = [
{
...item2,
type: 'or',
termType: 'isnull',
value: 1,
},
{
...item2,
type: 'or',
termType: 'empty',
value: 1,
}
]
}
return item2; return item2;
}); });
if(arr.length){
item1.terms = [...item1.terms, ...arr]
}
return item1; return item1;
}); });
queryParams.value = { terms: newParams || [] }; queryParams.value = { terms: newParams || [] };