Merge branch 'dev' of github.com:jetlinks/jetlinks-ui-vue into dev
This commit is contained in:
commit
4db5abc096
|
@ -7,10 +7,10 @@
|
|||
:headers="{
|
||||
'X-Access-Token': LocalStore.get(TOKEN_KEY),
|
||||
}"
|
||||
accept=".xlsx,.csv"
|
||||
:maxCount="1"
|
||||
:showUploadList="false"
|
||||
@change="uploadChange"
|
||||
:accept="props?.file?.fileType ? `.${props?.file?.fileType}` : '.xlsx'"
|
||||
>
|
||||
<j-button>
|
||||
<template #icon><AIcon type="UploadOutlined" /></template>
|
||||
|
|
|
@ -90,8 +90,8 @@ const props: JUploadProps = defineProps({
|
|||
default: '',
|
||||
},
|
||||
accept:{
|
||||
type:Array,
|
||||
default:()=>[],
|
||||
type: String,
|
||||
default: undefined
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<j-row type="flex">
|
||||
<j-col flex="180px">
|
||||
<j-form-item name="photoUrl">
|
||||
<JProUpload accept="image/*" v-model="modelRef.photoUrl" />
|
||||
<JProUpload accept="image/jpg,image/png,image/jfif,image/pjp,image/pjpeg,image/jpeg" v-model="modelRef.photoUrl" />
|
||||
</j-form-item>
|
||||
</j-col>
|
||||
<j-col flex="auto">
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<j-row type="flex">
|
||||
<j-col flex="180px">
|
||||
<j-form-item name="photoUrl">
|
||||
<JProUpload accept="image/*" v-model="modelRef.photoUrl" />
|
||||
<JProUpload accept="image/jpg,image/png,image/jfif,image/pjp,image/pjpeg,image/jpeg" v-model="modelRef.photoUrl" />
|
||||
</j-form-item>
|
||||
</j-col>
|
||||
<j-col flex="auto">
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
@ok="onSave"
|
||||
@cancel="onCancel"
|
||||
>
|
||||
<div class="alert">
|
||||
<div class="resource-issue-alert">
|
||||
<AIcon
|
||||
type="InfoCircleOutlined"
|
||||
style="margin-right: 10px"
|
||||
|
@ -17,7 +17,7 @@
|
|||
target="edge-resource-issue"
|
||||
@search="handleSearch"
|
||||
type="simple"
|
||||
class="search"
|
||||
class="resource-issue-search"
|
||||
/>
|
||||
<JProTable
|
||||
ref="edgeResourceIssueRef"
|
||||
|
@ -31,6 +31,10 @@
|
|||
selectedRowKeys: _selectedRowKeys,
|
||||
onChange: onSelectChange,
|
||||
}"
|
||||
:pagination="{
|
||||
showSizeChanger: true,
|
||||
pageSizeOptions: ['10', '20', '50', '100'],
|
||||
}"
|
||||
>
|
||||
<template #state="slotProps">
|
||||
<j-badge
|
||||
|
@ -47,7 +51,12 @@
|
|||
}}</span>
|
||||
</template>
|
||||
</JProTable>
|
||||
<Result v-if="visible" :data="props.data" :list="_data" @close="onCancel" />
|
||||
<Result
|
||||
v-if="visible"
|
||||
:data="props.data"
|
||||
:list="_data"
|
||||
@close="onCancel"
|
||||
/>
|
||||
</j-modal>
|
||||
</template>
|
||||
|
||||
|
@ -56,9 +65,11 @@ import { onlyMessage } from '@/utils/comm';
|
|||
import { queryDeviceList } from '@/api/edge/resource';
|
||||
import dayjs from 'dayjs';
|
||||
import Result from './Result.vue';
|
||||
import { queryNoPagingPost } from '@/api/device/product';
|
||||
|
||||
const defaultParams = {
|
||||
sorts: [{ name: 'createTime', order: 'desc' }],
|
||||
pageSize: 10,
|
||||
sorts: [{ name: 'registerTime', order: 'desc' }],
|
||||
terms: [
|
||||
{
|
||||
terms: [
|
||||
|
@ -111,6 +122,18 @@ const columns = [
|
|||
ellipsis: true,
|
||||
search: {
|
||||
type: 'select',
|
||||
rename: 'productId',
|
||||
options: () =>
|
||||
new Promise((resolve) => {
|
||||
queryNoPagingPost({ paging: false }).then((resp: any) => {
|
||||
resolve(
|
||||
resp.result.map((item: any) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
})),
|
||||
);
|
||||
});
|
||||
}),
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -155,10 +178,10 @@ const handleSearch = (v: any) => {
|
|||
};
|
||||
|
||||
const onSave = () => {
|
||||
if(_data.value.length){
|
||||
visible.value = true
|
||||
if (_data.value.length) {
|
||||
visible.value = true;
|
||||
} else {
|
||||
onlyMessage('请选择设备', 'error')
|
||||
onlyMessage('请选择设备', 'error');
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -167,12 +190,12 @@ const onCancel = () => {
|
|||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.search {
|
||||
padding: 0px;
|
||||
<style lang="less">
|
||||
.resource-issue-search {
|
||||
padding: 18px 0 0 0;
|
||||
margin: 0px;
|
||||
}
|
||||
.alert {
|
||||
.resource-issue-alert {
|
||||
height: 40px;
|
||||
padding-left: 10px;
|
||||
color: rgba(0, 0, 0, 0.55);
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
<template #card="slotProps">
|
||||
<CardBox
|
||||
:value="slotProps"
|
||||
@click="handleView(slotProps)"
|
||||
:actions="getActions(slotProps, 'card')"
|
||||
:status="slotProps.state?.value"
|
||||
:statusText="slotProps.state?.text"
|
||||
|
@ -30,10 +31,7 @@
|
|||
</template>
|
||||
<template #content>
|
||||
<Ellipsis style="width: calc(100% - 100px)">
|
||||
<span
|
||||
style="font-size: 16px; font-weight: 600"
|
||||
@click.stop="handleView(slotProps.id)"
|
||||
>
|
||||
<span style="font-size: 16px; font-weight: 600">
|
||||
{{ slotProps.name }}
|
||||
</span>
|
||||
</Ellipsis>
|
||||
|
@ -120,7 +118,11 @@
|
|||
type="link"
|
||||
style="padding: 0 5px"
|
||||
:danger="i.key === 'delete'"
|
||||
:hasPermission="i.key === 'view' ? true : 'edge/Resource:' + i.key"
|
||||
:hasPermission="
|
||||
i.key === 'view'
|
||||
? true
|
||||
: 'edge/Resource:' + i.key
|
||||
"
|
||||
>
|
||||
<template #icon><AIcon :type="i.icon" /></template>
|
||||
</PermissionButton>
|
||||
|
@ -213,17 +215,6 @@ const columns = [
|
|||
new Promise((resolve) => {
|
||||
queryNoPagingPost({
|
||||
paging: false,
|
||||
terms: [
|
||||
{
|
||||
terms: [
|
||||
{
|
||||
column: 'productId$product-info',
|
||||
value: 'accessProvider is official-edge-gateway',
|
||||
},
|
||||
],
|
||||
type: 'and',
|
||||
},
|
||||
],
|
||||
sorts: [
|
||||
{
|
||||
name: 'createTime',
|
||||
|
@ -278,6 +269,17 @@ const getActions = (
|
|||
): ActionsType[] => {
|
||||
if (!data) return [];
|
||||
const actions = [
|
||||
{
|
||||
key: 'view',
|
||||
text: '查看',
|
||||
tooltip: {
|
||||
title: '查看',
|
||||
},
|
||||
icon: 'EyeOutlined',
|
||||
onClick: () => {
|
||||
handleView(data);
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'update',
|
||||
text: '编辑',
|
||||
|
@ -370,8 +372,8 @@ const handleSearch = (_params: any) => {
|
|||
params.value = _params;
|
||||
};
|
||||
|
||||
const handleView = (id: string) => {
|
||||
menuStory.jumpPage('device/Instance/Detail', { id });
|
||||
const handleView = (dt: any) => {
|
||||
menuStory.jumpPage('device/Instance/Detail', { id: dt?.sourceId });
|
||||
};
|
||||
|
||||
const saveBtn = () => {
|
||||
|
@ -384,6 +386,7 @@ const onRefresh = () => {
|
|||
edgeResourceRef.value?.reload();
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
</style>
|
||||
|
||||
<style lang="less" scoped>
|
||||
</style>
|
||||
|
||||
|
|
|
@ -35,14 +35,14 @@ export default {
|
|||
createTime: 1679906031144,
|
||||
granted: true,
|
||||
icon: "icon-keshihua",
|
||||
id:"68a02c9efa9fb4885c89b007f97d074d",
|
||||
level:3,
|
||||
name:"仪表盘",
|
||||
id: "68a02c9efa9fb4885c89b007f97d074d",
|
||||
level: 3,
|
||||
name: "仪表盘",
|
||||
owner: "iot",
|
||||
parentId :"b6327c3ff01b49c9a7a96101606dc27a",
|
||||
path:"WXaI-KCgA-gBU0",
|
||||
sortIndex:1,
|
||||
url:"/iot/device/DashBoard",
|
||||
parentId: "b6327c3ff01b49c9a7a96101606dc27a",
|
||||
path: "WXaI-KCgA-gBU0",
|
||||
sortIndex: 1,
|
||||
url: "/iot/device/DashBoard",
|
||||
},
|
||||
{
|
||||
id: '1-3-2',
|
||||
|
@ -201,6 +201,21 @@ export default {
|
|||
},
|
||||
],
|
||||
[ROLEKEYS.link]: [
|
||||
{
|
||||
assetAccesses: [],
|
||||
code: "link/DashBoard",
|
||||
createTime: 1679994088091,
|
||||
granted: true,
|
||||
icon: "icon-keshihua",
|
||||
id: "47bedff9df89ecc0f0ce896e53805f02",
|
||||
level: 3,
|
||||
name: "仪表盘",
|
||||
owner: "iot",
|
||||
parentId: "bd55cdc9d0c1700afe628f572f91c22e",
|
||||
path: "rmJT-eI2B-2yTR",
|
||||
sortIndex: 1,
|
||||
url: "/iot/link/dashboard",
|
||||
},
|
||||
{
|
||||
id: '1-4-2',
|
||||
parentId: '1-4',
|
||||
|
@ -258,6 +273,20 @@ export default {
|
|||
options: {},
|
||||
createTime: 1659344075524,
|
||||
granted: true,
|
||||
}, {
|
||||
assetAccesses: [],
|
||||
code: "Log",
|
||||
createTime: 1679994088091,
|
||||
granted: true,
|
||||
icon: "icon-rizhifuwu",
|
||||
id: "c340f8977e0d221da893715cab58ae8c",
|
||||
level: 3,
|
||||
name: "日志管理",
|
||||
owner: "iot",
|
||||
parentId: "bd55cdc9d0c1700afe628f572f91c22e",
|
||||
path: "rmJT-eI2B-xH5Y",
|
||||
sortIndex: 1,
|
||||
url: "/iot/link/Log",
|
||||
},
|
||||
{
|
||||
id: '1-4-5',
|
||||
|
@ -446,6 +475,21 @@ export default {
|
|||
},
|
||||
],
|
||||
[ROLEKEYS.complex]: [
|
||||
{
|
||||
assetAccesses: [],
|
||||
code: "device/DashBoard",
|
||||
createTime: 1679906031144,
|
||||
granted: true,
|
||||
icon: "icon-keshihua",
|
||||
id: "68a02c9efa9fb4885c89b007f97d074d",
|
||||
level: 3,
|
||||
name: "仪表盘",
|
||||
owner: "iot",
|
||||
parentId: "b6327c3ff01b49c9a7a96101606dc27a",
|
||||
path: "WXaI-KCgA-gBU0",
|
||||
sortIndex: 1,
|
||||
url: "/iot/device/DashBoard",
|
||||
},
|
||||
{
|
||||
id: '1-3-2',
|
||||
parentId: '1-3',
|
||||
|
@ -601,6 +645,21 @@ export default {
|
|||
createTime: 1659344075524,
|
||||
granted: true,
|
||||
},
|
||||
{
|
||||
assetAccesses: [],
|
||||
code: "link/DashBoard",
|
||||
createTime: 1679994088091,
|
||||
granted: true,
|
||||
icon: "icon-keshihua",
|
||||
id: "47bedff9df89ecc0f0ce896e53805f02",
|
||||
level: 3,
|
||||
name: "仪表盘",
|
||||
owner: "iot",
|
||||
parentId: "bd55cdc9d0c1700afe628f572f91c22e",
|
||||
path: "rmJT-eI2B-2yTR",
|
||||
sortIndex: 1,
|
||||
url: "/iot/link/dashboard",
|
||||
},
|
||||
{
|
||||
id: '1-4-2',
|
||||
parentId: '1-4',
|
||||
|
@ -659,6 +718,21 @@ export default {
|
|||
createTime: 1659344075524,
|
||||
granted: true,
|
||||
},
|
||||
{
|
||||
assetAccesses: [],
|
||||
code: "Log",
|
||||
createTime: 1679994088091,
|
||||
granted: true,
|
||||
icon: "icon-rizhifuwu",
|
||||
id: "c340f8977e0d221da893715cab58ae8c",
|
||||
level: 3,
|
||||
name: "日志管理",
|
||||
owner: "iot",
|
||||
parentId: "bd55cdc9d0c1700afe628f572f91c22e",
|
||||
path: "rmJT-eI2B-xH5Y",
|
||||
sortIndex: 1,
|
||||
url: "/iot/link/Log",
|
||||
},
|
||||
{
|
||||
id: '1-4-5',
|
||||
parentId: '1-4',
|
||||
|
|
|
@ -84,7 +84,7 @@ const props = defineProps({
|
|||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['update:value', 'change']);
|
||||
const emit = defineEmits(['update:value', 'change', 'update:detail']);
|
||||
|
||||
const getLogo = (type: string, provider: string) => {
|
||||
return MSG_TYPE[type].find((f: any) => f.value === provider)?.logo;
|
||||
|
@ -133,10 +133,12 @@ const handleClick = (dt: any) => {
|
|||
_selectedRowKeys.value = [];
|
||||
emit('update:value', undefined);
|
||||
emit('change', { templateName: undefined });
|
||||
emit('update:detail', undefined);
|
||||
} else {
|
||||
_selectedRowKeys.value = [dt.id];
|
||||
emit('update:value', dt.id);
|
||||
emit('change', { templateName: dt?.name });
|
||||
emit('update:detail', dt);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -75,6 +75,10 @@ const props = defineProps({
|
|||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
template: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['update:value', 'change']);
|
||||
|
@ -87,6 +91,12 @@ watchEffect(() => {
|
|||
Object.assign(modelRef, props?.value);
|
||||
});
|
||||
|
||||
watchEffect(() => {
|
||||
if(props?.template?.template?.sendTo && props?.template?.template?.sendTo?.length){
|
||||
emit('change', { sendTo: props?.template?.template?.sendTo.join(' ') });
|
||||
}
|
||||
});
|
||||
|
||||
const getType = (item: any) => {
|
||||
return item.expands?.businessType || item.type;
|
||||
};
|
||||
|
@ -180,16 +190,16 @@ const onChange = (val: any, type: any) => {
|
|||
emit('change', { tagName: val });
|
||||
} else if (type === 'user') {
|
||||
emit('change', { sendTo: val });
|
||||
} else if (type === 'build-in') {
|
||||
// emit('change', { sendTo: val });
|
||||
}
|
||||
};
|
||||
|
||||
const onSave = () =>
|
||||
new Promise((resolve) => {
|
||||
formRef.value?.validate().then(async (_data: any) => {
|
||||
new Promise((resolve, reject) => {
|
||||
formRef.value?.validate().then((_data: any) => {
|
||||
resolve(_data);
|
||||
});
|
||||
}).catch(() => {
|
||||
reject(false)
|
||||
})
|
||||
});
|
||||
|
||||
defineExpose({ onSave });
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
<j-form-item name="templateId">
|
||||
<NotifyTemplate
|
||||
v-model:value="formModel.templateId"
|
||||
v-model:detail="template"
|
||||
:notifierId="formModel.notifierId"
|
||||
@change="(val) => onValChange(val, 'templateId')"
|
||||
/>
|
||||
|
@ -58,6 +59,7 @@
|
|||
:variableDefinitions="variable"
|
||||
:value="formModel.variables"
|
||||
:notify="formModel"
|
||||
:template="template"
|
||||
@change="(val) => onValChange(val, 'variables')"
|
||||
ref="variableRef"
|
||||
/>
|
||||
|
@ -119,11 +121,19 @@ const formModel = reactive({
|
|||
|
||||
const variable = ref([]);
|
||||
const variableRef = ref();
|
||||
const template = ref();
|
||||
|
||||
watch(
|
||||
() => props.value,
|
||||
(newVal) => {
|
||||
Object.assign(formModel, newVal);
|
||||
if(newVal?.templateId){
|
||||
Template.detail(newVal?.templateId).then((resp: any) => {
|
||||
if(resp.status === 200){
|
||||
template.value = resp.result
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
{ deep: true, immediate: true },
|
||||
);
|
||||
|
@ -193,8 +203,11 @@ const onCancel = () => {
|
|||
emit('cancel');
|
||||
};
|
||||
const onOk = async () => {
|
||||
const _data = await variableRef.value.onSave();
|
||||
formModel.variables = _data;
|
||||
let _data = undefined
|
||||
if(variable.value.length){
|
||||
_data = await variableRef.value.onSave()
|
||||
}
|
||||
formModel.variables = _data || [];
|
||||
const { options, ...extra } = formModel;
|
||||
emit('save', { ...extra }, { ...options });
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue