Merge remote-tracking branch 'origin/dev' into dev
# Conflicts: # src/views/media/Device/Channel/index.vue
This commit is contained in:
commit
b73c9fdf92
|
@ -78,6 +78,7 @@
|
|||
/>
|
||||
<j-input
|
||||
v-else
|
||||
:placeholder="placeholder"
|
||||
allowClear
|
||||
type="text"
|
||||
v-model:value="myValue"
|
||||
|
@ -144,6 +145,10 @@ const props = defineProps({
|
|||
mode: {
|
||||
type: String as PropType<'multiple' | 'tags' | 'combobox' | ''>,
|
||||
default: ''
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: () => '',
|
||||
}
|
||||
});
|
||||
// type Props = {
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
:name="['dataSource', index, 'value']"
|
||||
:rules="[
|
||||
{
|
||||
required: true,
|
||||
required: record.required,
|
||||
message:
|
||||
record.type === 'enum' ||
|
||||
record.type === 'boolean'
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
placeholder="请选择属性"
|
||||
v-model:value="modelRef.message.properties"
|
||||
show-search
|
||||
@change="onPropertyChange"
|
||||
@change="(val) => onPropertyChange(val, false)"
|
||||
>
|
||||
<j-select-option
|
||||
v-for="i in metadata?.properties || []"
|
||||
|
@ -89,6 +89,7 @@
|
|||
:itemType="
|
||||
property.valueType?.type || property.type || 'int'
|
||||
"
|
||||
:placeholder="property.valueType?.type === 'array' ? '多个数据用英文,分割' : ''"
|
||||
:options="
|
||||
property.valueType?.type === 'enum'
|
||||
? (property?.valueType?.elements || []).map(
|
||||
|
@ -101,8 +102,8 @@
|
|||
)
|
||||
: property.valueType?.type === 'boolean'
|
||||
? [
|
||||
{ label: '是', value: true },
|
||||
{ label: '否', value: false },
|
||||
{ label: property.valueType?.trueText, value: property.valueType?.trueValue },
|
||||
{ label: property.valueType?.falseText, value: property.valueType?.falseValue },
|
||||
]
|
||||
: undefined
|
||||
"
|
||||
|
@ -208,10 +209,10 @@ const onPropertyChange = (val: string, flag?: boolean) => {
|
|||
(item: any) => item.id === val,
|
||||
);
|
||||
property.value = _item || {};
|
||||
}
|
||||
if(!flag){
|
||||
modelRef.message.value = undefined
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const onTypeChange = () => {
|
||||
|
@ -249,6 +250,7 @@ const funcChange = (val: string) => {
|
|||
name: item.name,
|
||||
value: undefined,
|
||||
valueType: item?.valueType?.type,
|
||||
required: item?.expands?.required
|
||||
};
|
||||
});
|
||||
modelRef.message.inputs = list;
|
||||
|
@ -265,7 +267,6 @@ const saveBtn = () =>
|
|||
resolve(false);
|
||||
});
|
||||
}
|
||||
console.log(_data)
|
||||
emit('update:modelValue', _data)
|
||||
resolve(_data);
|
||||
})
|
||||
|
|
|
@ -42,6 +42,10 @@
|
|||
required: true,
|
||||
message: '请选择产品',
|
||||
},
|
||||
// {
|
||||
// validator: _validator,
|
||||
// trigger: 'change',
|
||||
// },
|
||||
]"
|
||||
>
|
||||
<j-select
|
||||
|
@ -147,11 +151,23 @@
|
|||
: `动作映射${index + 1}`
|
||||
"
|
||||
>
|
||||
<template #extra
|
||||
><AIcon
|
||||
<template #extra>
|
||||
<div
|
||||
style="width: 20px"
|
||||
@click.stop
|
||||
>
|
||||
<j-popconfirm
|
||||
title="确认删除?"
|
||||
@confirm.prevent="
|
||||
delItem(index)
|
||||
"
|
||||
>
|
||||
<AIcon
|
||||
type="DeleteOutlined"
|
||||
@click="delItem(index)"
|
||||
/></template>
|
||||
/>
|
||||
</j-popconfirm>
|
||||
</div>
|
||||
</template>
|
||||
<j-row :gutter="24">
|
||||
<j-col :span="12">
|
||||
<j-form-item
|
||||
|
@ -326,15 +342,25 @@
|
|||
: `属性映射${index + 1}`
|
||||
"
|
||||
>
|
||||
<template #extra
|
||||
><AIcon
|
||||
type="DeleteOutlined"
|
||||
@click="
|
||||
<template #extra>
|
||||
<div
|
||||
style="width: 20px"
|
||||
@click.stop
|
||||
>
|
||||
<j-popconfirm
|
||||
title="确认删除?"
|
||||
@confirm.prevent="
|
||||
delPropertyItem(
|
||||
index,
|
||||
)
|
||||
"
|
||||
/></template>
|
||||
>
|
||||
<AIcon
|
||||
type="DeleteOutlined"
|
||||
/>
|
||||
</j-popconfirm>
|
||||
</div>
|
||||
</template>
|
||||
<j-row :gutter="24">
|
||||
<j-col :span="12">
|
||||
<j-form-item
|
||||
|
@ -392,7 +418,6 @@
|
|||
v-model:value="
|
||||
item.target
|
||||
"
|
||||
mode="tags"
|
||||
show-search
|
||||
>
|
||||
<j-select-option
|
||||
|
@ -486,7 +511,7 @@ import {
|
|||
savePatch,
|
||||
detail,
|
||||
} from '@/api/northbound/dueros';
|
||||
import _ from 'lodash';
|
||||
import _, { cloneDeep } from 'lodash';
|
||||
import { useMenuStore } from '@/store/menu';
|
||||
import { onlyMessage } from '@/utils/comm';
|
||||
|
||||
|
@ -517,7 +542,7 @@ const modelRef = reactive({
|
|||
propertyMappings: [
|
||||
{
|
||||
source: undefined,
|
||||
target: [],
|
||||
target: undefined,
|
||||
},
|
||||
],
|
||||
description: undefined,
|
||||
|
@ -569,25 +594,31 @@ const addItem = () => {
|
|||
|
||||
const delItem = (index: number) => {
|
||||
modelRef.actionMappings.splice(index, 1);
|
||||
if (!modelRef.actionMappings.length) {
|
||||
addItem();
|
||||
}
|
||||
};
|
||||
|
||||
const addPropertyItem = () => {
|
||||
propertyActiveKey.value.push(String(modelRef.propertyMappings.length));
|
||||
modelRef.propertyMappings.push({
|
||||
source: undefined,
|
||||
target: [],
|
||||
target: undefined,
|
||||
});
|
||||
};
|
||||
|
||||
const delPropertyItem = (index: number) => {
|
||||
modelRef.propertyMappings.splice(index, 1);
|
||||
if (!modelRef.propertyMappings.length) {
|
||||
addPropertyItem();
|
||||
}
|
||||
};
|
||||
|
||||
const productChange = (value: string) => {
|
||||
modelRef.propertyMappings = modelRef.propertyMappings.map((item) => {
|
||||
return { source: item.source, target: [] };
|
||||
modelRef.propertyMappings = modelRef.propertyMappings?.map((item) => {
|
||||
return { source: item.source, target: undefined };
|
||||
});
|
||||
modelRef.actionMappings = modelRef.actionMappings.map((item) => {
|
||||
modelRef.actionMappings = modelRef.actionMappings?.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
command: {
|
||||
|
@ -608,10 +639,10 @@ const productChange = (value: string) => {
|
|||
};
|
||||
|
||||
const typeChange = () => {
|
||||
modelRef.propertyMappings = modelRef.propertyMappings.map((item) => {
|
||||
modelRef.propertyMappings = modelRef.propertyMappings?.map((item) => {
|
||||
return { source: undefined, target: item.target };
|
||||
});
|
||||
modelRef.actionMappings = modelRef.actionMappings.map((item) => {
|
||||
modelRef.actionMappings = modelRef.actionMappings?.map((item) => {
|
||||
return { ...item, action: undefined };
|
||||
});
|
||||
};
|
||||
|
@ -645,49 +676,60 @@ const getTypes = async () => {
|
|||
};
|
||||
|
||||
const getDuerOSProperties = (val: string) => {
|
||||
console.log(val);
|
||||
const arr = modelRef.propertyMappings.map((item) => item?.source) || [];
|
||||
const arr = modelRef.propertyMappings?.map((item) => item?.source) || [];
|
||||
const checked = _.cloneDeep(arr);
|
||||
const _index = checked.findIndex((i) => i === val);
|
||||
// 去掉重复的
|
||||
checked.splice(_index, 1);
|
||||
const targetList = findApplianceType.value?.properties;
|
||||
const list = targetList?.filter(
|
||||
(i: { id: string }) => !checked.includes(i?.id as any),
|
||||
(i: { id: string }) => !checked?.includes(i?.id as any),
|
||||
);
|
||||
return list || [];
|
||||
};
|
||||
|
||||
const getProductProperties = (val: string[]) => {
|
||||
const items =
|
||||
modelRef.propertyMappings.map((item: { target: string[] }) =>
|
||||
item?.target.map((j) => j),
|
||||
) || [];
|
||||
const checked = _.flatMap(items);
|
||||
modelRef.propertyMappings?.map((item: any) => item?.target) || [];
|
||||
const checked = items.filter((i) => i);
|
||||
const _checked: any[] = [];
|
||||
checked.map((_item) => {
|
||||
if (!val.includes(_item)) {
|
||||
checked?.map((_item) => {
|
||||
if (!val?.includes(_item)) {
|
||||
_checked.push(_item);
|
||||
}
|
||||
});
|
||||
const sourceList = findProductMetadata.value?.properties;
|
||||
const list = sourceList?.filter(
|
||||
(i: { id: string }) => !_checked.includes(i.id),
|
||||
(i: { id: string }) => !_checked?.includes(i.id),
|
||||
);
|
||||
return list || [];
|
||||
};
|
||||
|
||||
const getTypesActions = (val: string) => {
|
||||
const items = modelRef.actionMappings.map((item) => item?.action) || [];
|
||||
const items = modelRef.actionMappings?.map((item) => item?.action) || [];
|
||||
const checked = _.cloneDeep(items);
|
||||
const _index = checked.findIndex((i) => i === val);
|
||||
checked.splice(_index, 1);
|
||||
const actionsList = findApplianceType.value?.actions || [];
|
||||
const list = actionsList?.filter(
|
||||
(i: { id: string; name: string }) => !checked.includes(i?.id as any),
|
||||
(i: { id: string; name: string }) => !checked?.includes(i?.id as any),
|
||||
);
|
||||
return list || [];
|
||||
};
|
||||
|
||||
// const _validator = (_rule: any, value: string): Promise<any> =>
|
||||
// new Promise((resolve, reject) => {
|
||||
// const _item = productList.value.find((item) => item.id === value);
|
||||
// if (!_item) {
|
||||
// return reject('该产品已被删除');
|
||||
// }
|
||||
// return resolve('');
|
||||
// });
|
||||
|
||||
watchEffect(() => {
|
||||
console.log(modelRef.id)
|
||||
})
|
||||
|
||||
const saveBtn = async () => {
|
||||
const tasks: any[] = [];
|
||||
for (let i = 0; i < command.value.length; i++) {
|
||||
|
@ -704,6 +746,16 @@ const saveBtn = async () => {
|
|||
.then(async (data: any) => {
|
||||
if (tasks.every((item) => item) && data) {
|
||||
loading.value = true;
|
||||
data.propertyMappings = data.propertyMappings?.map(
|
||||
(it: any) => {
|
||||
return {
|
||||
source: it.source,
|
||||
target: Array.isArray(it?.target)
|
||||
? it?.target
|
||||
: [it?.target],
|
||||
};
|
||||
},
|
||||
);
|
||||
const resp = await savePatch(data).finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
|
@ -715,12 +767,12 @@ const saveBtn = async () => {
|
|||
}
|
||||
})
|
||||
.catch((err: any) => {
|
||||
const _arr = err.errorFields.map((item: any) => item.name);
|
||||
_arr.map((item: string | any[]) => {
|
||||
const _arr = err.errorFields?.map((item: any) => item.name);
|
||||
_arr?.map((item: string | any[]) => {
|
||||
if (item.length >= 3) {
|
||||
if (
|
||||
item[0] === 'propertyMappings' &&
|
||||
!propertyActiveKey.value.includes(item[1])
|
||||
!propertyActiveKey.value?.includes(item[1])
|
||||
) {
|
||||
propertyActiveKey.value.push(item[1]);
|
||||
}
|
||||
|
@ -738,16 +790,16 @@ watch(
|
|||
() => route.params?.id,
|
||||
async (newId) => {
|
||||
if (newId) {
|
||||
getProduct(newId as string);
|
||||
await getProduct(newId as string);
|
||||
getTypes();
|
||||
if (newId === ':id') return;
|
||||
const resp = await detail(newId as string);
|
||||
const _data: any = resp.result;
|
||||
const _obj = cloneDeep(_data);
|
||||
if (_data) {
|
||||
_data.applianceType = _data?.applianceType?.value;
|
||||
_obj.applianceType = _obj?.applianceType?.value;
|
||||
}
|
||||
Object.assign(modelRef, _data);
|
||||
console.log(modelRef.propertyMappings);
|
||||
Object.assign(modelRef, _obj);
|
||||
}
|
||||
},
|
||||
{ immediate: true, deep: true },
|
||||
|
|
|
@ -26,7 +26,7 @@ export const USER_CENTER_MENU_DATA = {
|
|||
permissions: [
|
||||
{
|
||||
permission: 'user',
|
||||
action: ['update-self-pwd']
|
||||
actions: ['update-self-pwd']
|
||||
},
|
||||
{
|
||||
permission: 'system_config',
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
:columns="columns"
|
||||
:request="(e:any) => ChannelApi.list(e, route?.query.id as string)"
|
||||
:defaultParams="{
|
||||
sorts: [{ name: 'notifyTime', order: 'desc' }],
|
||||
sorts: [{ name: 'modifyTime', order: 'desc' }],
|
||||
}"
|
||||
:params="params"
|
||||
:pagination="{
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
>
|
||||
<template #description>
|
||||
<template v-if="!isPermission"
|
||||
>暂无权限, 请联系管理员</template
|
||||
>暂无数据, 请联系管理员</template
|
||||
>
|
||||
<template v-else>
|
||||
暂无数据,请先
|
||||
|
|
|
@ -156,19 +156,26 @@
|
|||
</j-radio-button>
|
||||
</j-radio-group>
|
||||
</j-form-item>
|
||||
<j-form-item label="设备厂商">
|
||||
<j-form-item label="设备厂商"
|
||||
name="manufacturer"
|
||||
:rules="[{ max: 64, message: '最多可输入64位字符', trigger: 'change' }]">
|
||||
<j-input
|
||||
v-model:value="formData.manufacturer"
|
||||
placeholder="请输入设备厂商"
|
||||
|
||||
/>
|
||||
</j-form-item>
|
||||
<j-form-item label="设备型号">
|
||||
<j-form-item label="设备型号"
|
||||
name="model"
|
||||
:rules="[{ max: 64, message: '最多可输入64位字符', trigger: 'change' }]">
|
||||
<j-input
|
||||
v-model:value="formData.model"
|
||||
placeholder="请输入设备型号"
|
||||
/>
|
||||
</j-form-item>
|
||||
<j-form-item label="固件版本">
|
||||
<j-form-item label="固件版本"
|
||||
name="firmware"
|
||||
:rules="[{ max: 64, message: '最多可输入64位字符', trigger: 'change' }]">
|
||||
<j-input
|
||||
v-model:value="formData.firmware"
|
||||
placeholder="请输入固件版本"
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
@cancel="emit('close')"
|
||||
@ok="onSave"
|
||||
>
|
||||
<Role v-model="_selectedRowKeys" :gridColumn="1" />
|
||||
<Role v-model="_selectedRowKeys" :gridColumn="2" />
|
||||
</j-modal>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -304,12 +304,12 @@ const onAction = (e: boolean) => {
|
|||
role: {
|
||||
idList: [],
|
||||
},
|
||||
permissions: [
|
||||
permissions: props.provider === 'alarm' ? [
|
||||
{
|
||||
id: 'alarm-config',
|
||||
actions: ['query'],
|
||||
},
|
||||
],
|
||||
] : [],
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
noPagination
|
||||
model="TABLE"
|
||||
>
|
||||
<!-- :rowKey="(record) => record.id + record.method" -->
|
||||
<template #url="slotProps">
|
||||
<span
|
||||
style="color: #1d39c4; cursor: pointer"
|
||||
|
@ -68,6 +69,11 @@ const columns = [
|
|||
key: 'summary',
|
||||
},
|
||||
];
|
||||
|
||||
watchEffect(() => {
|
||||
console.log(props.tableData)
|
||||
})
|
||||
|
||||
const rowSelection = {
|
||||
// onSelect: (record: any) => {
|
||||
// const targetId = record.id;
|
||||
|
|
Loading…
Reference in New Issue