Merge branch 'dev' of github.com:jetlinks/jetlinks-ui-vue into dev
This commit is contained in:
commit
0998f4bc79
|
@ -16,14 +16,10 @@ export const useInstanceStore = defineStore({
|
|||
this.detail = current
|
||||
},
|
||||
async refresh(id: string) {
|
||||
const resp: any = await detail(id).catch((err) => {
|
||||
onlyMessage(err.response.data.message, 'error')
|
||||
})
|
||||
const resp: any = await detail(id)
|
||||
if(resp.status === 200){
|
||||
this.current = resp.result
|
||||
this.detail = resp.result
|
||||
} else {
|
||||
onlyMessage(resp?.message, 'error')
|
||||
}
|
||||
},
|
||||
setTabActiveKey(key: string) {
|
||||
|
|
|
@ -151,6 +151,8 @@ const errorHandler = (error: any) => {
|
|||
path: LoginPath
|
||||
})
|
||||
}, 0)
|
||||
} else if (status === 404) {
|
||||
showNotification(error?.code, error?.response?.data?.message, '404')
|
||||
}
|
||||
} else if (error.response === undefined) {
|
||||
showNotification(error.message, (error.stack + '').substr(0, 90), undefined)
|
||||
|
|
|
@ -53,7 +53,8 @@
|
|||
<img
|
||||
:width="88"
|
||||
:height="88"
|
||||
:src="slotProps?.photoUrl ||
|
||||
:src="
|
||||
slotProps?.photoUrl ||
|
||||
getImage('/device/instance/device-card.png')
|
||||
"
|
||||
/>
|
||||
|
@ -85,8 +86,42 @@
|
|||
</j-row>
|
||||
</template>
|
||||
<template #actions="item">
|
||||
<j-dropdown
|
||||
placement="bottomRight"
|
||||
v-if="item.key === 'others'"
|
||||
>
|
||||
<j-button>
|
||||
<AIcon :type="item.icon" />
|
||||
<span>{{ item.text }}</span>
|
||||
</j-button>
|
||||
<template #overlay>
|
||||
<j-menu>
|
||||
<j-menu-item
|
||||
v-for="(o, i) in item.children"
|
||||
:key="i"
|
||||
>
|
||||
<PermissionButton
|
||||
:disabled="o.disabled"
|
||||
:popConfirm="o.popConfirm"
|
||||
:tooltip="{
|
||||
...o.tooltip,
|
||||
}"
|
||||
@click="o.onClick"
|
||||
:hasPermission="
|
||||
'edge/Device:' + o.key
|
||||
"
|
||||
type="link"
|
||||
>
|
||||
<AIcon :type="o.icon" />
|
||||
<span>{{ o?.text }}</span>
|
||||
</PermissionButton>
|
||||
</j-menu-item>
|
||||
</j-menu>
|
||||
</template>
|
||||
</j-dropdown>
|
||||
<PermissionButton
|
||||
:disabled="item.disabled"
|
||||
v-else
|
||||
:popConfirm="item.popConfirm"
|
||||
:tooltip="{
|
||||
...item.tooltip,
|
||||
|
@ -383,36 +418,6 @@ const getActions = (
|
|||
current.value = data;
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'setting',
|
||||
text: '远程控制',
|
||||
tooltip: {
|
||||
title: '远程控制',
|
||||
},
|
||||
icon: 'ControlOutlined',
|
||||
onClick: () => {
|
||||
menuStory.jumpPage('edge/Device/Remote', { id: data.id });
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'password',
|
||||
text: '重置密码',
|
||||
tooltip: {
|
||||
title: '重置密码',
|
||||
},
|
||||
icon: 'RedoOutlined',
|
||||
popConfirm: {
|
||||
title: '确认重置密码为P@ssw0rd?',
|
||||
onConfirm: async () => {
|
||||
restPassword(data.id).then((resp: any) => {
|
||||
if (resp.status === 200) {
|
||||
message.success('操作成功!');
|
||||
edgeDeviceRef.value?.reload();
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'action',
|
||||
text: data.state?.value !== 'notActive' ? '禁用' : '启用',
|
||||
|
@ -443,34 +448,82 @@ const getActions = (
|
|||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
const others = [
|
||||
{
|
||||
key: 'delete',
|
||||
text: '删除',
|
||||
disabled: data.state?.value !== 'notActive',
|
||||
key: 'setting',
|
||||
text: '远程控制',
|
||||
tooltip: {
|
||||
title:
|
||||
data.state.value !== 'notActive'
|
||||
? '已启用的设备不能删除'
|
||||
: '删除',
|
||||
title: '远程控制',
|
||||
},
|
||||
icon: 'ControlOutlined',
|
||||
onClick: () => {
|
||||
menuStory.jumpPage('edge/Device/Remote', {
|
||||
id: data.id,
|
||||
});
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'password',
|
||||
text: '重置密码',
|
||||
tooltip: {
|
||||
title: '重置密码',
|
||||
},
|
||||
icon: 'RedoOutlined',
|
||||
popConfirm: {
|
||||
title: '确认删除?',
|
||||
title: '确认重置密码为P@ssw0rd?',
|
||||
onConfirm: async () => {
|
||||
const resp = await _delete(data.id);
|
||||
if (resp.status === 200) {
|
||||
message.success('操作成功!');
|
||||
edgeDeviceRef.value?.reload();
|
||||
} else {
|
||||
message.error('操作失败!');
|
||||
}
|
||||
restPassword(data.id).then((resp: any) => {
|
||||
if (resp.status === 200) {
|
||||
message.success('操作成功!');
|
||||
edgeDeviceRef.value?.reload();
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
icon: 'DeleteOutlined',
|
||||
},
|
||||
];
|
||||
if (type === 'card')
|
||||
return actions.filter((i: ActionsType) => i.key !== 'view');
|
||||
return actions;
|
||||
|
||||
const deleteItem = {
|
||||
key: 'delete',
|
||||
text: '删除',
|
||||
disabled: data.state?.value !== 'notActive',
|
||||
tooltip: {
|
||||
title:
|
||||
data.state.value !== 'notActive'
|
||||
? '已启用的设备不能删除'
|
||||
: '删除',
|
||||
},
|
||||
popConfirm: {
|
||||
title: '确认删除?',
|
||||
onConfirm: async () => {
|
||||
const resp = await _delete(data.id);
|
||||
if (resp.status === 200) {
|
||||
message.success('操作成功!');
|
||||
edgeDeviceRef.value?.reload();
|
||||
} else {
|
||||
message.error('操作失败!');
|
||||
}
|
||||
},
|
||||
},
|
||||
icon: 'DeleteOutlined',
|
||||
};
|
||||
|
||||
if (type === 'card') {
|
||||
const arr = actions.filter((i: ActionsType) => i.key !== 'view');
|
||||
return [
|
||||
...arr,
|
||||
{
|
||||
key: 'others',
|
||||
text: '其他',
|
||||
icon: 'EllipsisOutlined',
|
||||
children: [...others],
|
||||
},
|
||||
deleteItem,
|
||||
];
|
||||
} else {
|
||||
return [...actions, ...others, deleteItem];
|
||||
}
|
||||
};
|
||||
|
||||
const handleSearch = (_params: any) => {
|
||||
|
|
|
@ -208,7 +208,7 @@ watch(
|
|||
*/
|
||||
const onTreeSelect = (keys: any) => {
|
||||
deptId.value = keys[0];
|
||||
pageSize.value = 5;
|
||||
pageSize.value = 10;
|
||||
current.value = 1;
|
||||
};
|
||||
|
||||
|
|
|
@ -43,14 +43,14 @@
|
|||
</j-form-item>
|
||||
<j-form-item
|
||||
v-else
|
||||
name="selectorValues"
|
||||
name="upperKey"
|
||||
label="变量"
|
||||
:rules="[{ required: true, message: '请选择' }]"
|
||||
>
|
||||
<j-tree-select
|
||||
style="width: 100%; height: 100%"
|
||||
:tree-data="builtInList"
|
||||
v-model:value="modelRef.selectorValues"
|
||||
v-model:value="modelRef.upperKey"
|
||||
placeholder="请选择参数"
|
||||
@select="onVariableChange"
|
||||
:fieldNames="{ label: 'name', value: 'id' }"
|
||||
|
@ -302,7 +302,7 @@ const onVariableChange = (val: any, node: any) => {
|
|||
modelRef.deviceId = val;
|
||||
modelRef.source = 'upper';
|
||||
modelRef.upperKey = val;
|
||||
modelRef.selectorValues = [{ value: val, name: node.description }] as any;
|
||||
modelRef.selectorValues = undefined // [{ value: val, name: node.description }] as any;
|
||||
emits('save', unref(modelRef), { name: node.description });
|
||||
};
|
||||
|
||||
|
@ -366,7 +366,7 @@ const onFormSave = () => {
|
|||
});
|
||||
}
|
||||
} else {
|
||||
resolve(_data);
|
||||
resolve({..._data});
|
||||
}
|
||||
})
|
||||
.catch((err: any) => {
|
||||
|
|
|
@ -136,11 +136,9 @@ const onSave = (_data: any) => {
|
|||
source: DeviceModel.source,
|
||||
selectorValues: DeviceModel.selectorValues,
|
||||
productId: DeviceModel.productId,
|
||||
upperKey: DeviceModel.upperKey,
|
||||
message: _data.message,
|
||||
};
|
||||
if (DeviceModel.selector === 'variable') {
|
||||
item.selector = 'fixed';
|
||||
}
|
||||
if (DeviceModel.selector === 'relation') {
|
||||
item.upperKey = 'scene.deviceId';
|
||||
}
|
||||
|
@ -167,6 +165,7 @@ const onSave = (_data: any) => {
|
|||
? JSON.stringify(_options?.propertiesValue)
|
||||
: _options?.propertiesValue)
|
||||
}
|
||||
console.log(item)
|
||||
emit('save', item, JSON.parse(JSON.stringify(_options)));
|
||||
};
|
||||
|
||||
|
@ -181,7 +180,6 @@ const onProductChange = (_val: any, bol: boolean) => {
|
|||
JSON.parse(_val.metadata || '{}'),
|
||||
DeviceModel?.message,
|
||||
);
|
||||
console.log(flag)
|
||||
if (!flag) {
|
||||
DeviceModel.message = {
|
||||
messageType: 'INVOKE_FUNCTION',
|
||||
|
|
|
@ -242,7 +242,7 @@
|
|||
v-else-if="data?.executor === 'device'"
|
||||
@click="onType('device')"
|
||||
>
|
||||
<template v-if="data?.device?.selector === 'fixed'">
|
||||
<template v-if="['fixed', 'context'].includes(data?.device?.selector)">
|
||||
<div style='display: flex; align-items: center;'>
|
||||
<AIcon
|
||||
:type="
|
||||
|
|
|
@ -28,6 +28,14 @@
|
|||
onSelect: changeSelect,
|
||||
}"
|
||||
@cancelSelect="selectedRowKeys = []"
|
||||
:defaultParams="{
|
||||
pageSize: 10,
|
||||
}"
|
||||
:pagination="{
|
||||
pageSizeOptions: ['10', '20', '50', '100'],
|
||||
showSizeChanger: true,
|
||||
hideOnSinglePage: false,
|
||||
}"
|
||||
>
|
||||
</j-pro-table>
|
||||
</j-modal>
|
||||
|
@ -101,11 +109,11 @@ const confirm = () => {
|
|||
};
|
||||
const changeSelect = (item: any, state: boolean) => {
|
||||
const arr = new Set(selectedRowKeys.value);
|
||||
console.log(item,state);
|
||||
if(state){
|
||||
arr.add(item.id)
|
||||
}else{
|
||||
arr.delete(item.id)
|
||||
console.log(item, state);
|
||||
if (state) {
|
||||
arr.add(item.id);
|
||||
} else {
|
||||
arr.delete(item.id);
|
||||
}
|
||||
selectedRowKeys.value = [...arr.values()];
|
||||
};
|
||||
|
|
|
@ -3700,8 +3700,8 @@ jetlinks-store@^0.0.3:
|
|||
|
||||
jetlinks-ui-components@^1.0.5:
|
||||
version "1.0.5"
|
||||
resolved "http://47.108.170.157:9013/jetlinks-ui-components/-/jetlinks-ui-components-1.0.5.tgz#1cd2b4b99afdda515bffd05f7fc9dd61a3cff16d"
|
||||
integrity sha512-cIB/6wOiU+GHDKI3dUnGLa27VrHXuEOoOsqKI30GcKRHbdamBfApchOcvAON+SHpv19n5i3inKw8pNXaHOeKZw==
|
||||
resolved "http://47.108.170.157:9013/jetlinks-ui-components/-/jetlinks-ui-components-1.0.5.tgz#c71ecae61776bff738f43efe46aac7264f092736"
|
||||
integrity sha512-+1a/4nA5RCiInRFyyaVCMEWSBzNU8lzxOYTTpY0GiNhuJuhGE5AbBsVp9CXXF0lFECK2iqaAElY+QN4Wjms1Dw==
|
||||
dependencies:
|
||||
"@vueuse/core" "^9.12.0"
|
||||
ant-design-vue "^3.2.15"
|
||||
|
|
Loading…
Reference in New Issue