fix: 修改边缘网关

This commit is contained in:
100011797 2023-03-28 17:59:40 +08:00
parent 7da4678231
commit e3bcf52641
9 changed files with 96 additions and 45 deletions

View File

@ -7,10 +7,10 @@
:headers="{ :headers="{
'X-Access-Token': LocalStore.get(TOKEN_KEY), 'X-Access-Token': LocalStore.get(TOKEN_KEY),
}" }"
accept=".xlsx,.csv"
:maxCount="1" :maxCount="1"
:showUploadList="false" :showUploadList="false"
@change="uploadChange" @change="uploadChange"
:accept="props?.file?.fileType ? `.${props?.file?.fileType}` : '.xlsx'"
> >
<j-button> <j-button>
<template #icon><AIcon type="UploadOutlined" /></template> <template #icon><AIcon type="UploadOutlined" /></template>

View File

@ -90,8 +90,8 @@ const props: JUploadProps = defineProps({
default: '', default: '',
}, },
accept:{ accept:{
type:Array, type: String,
default:()=>[], default: undefined
} }
}); });

View File

@ -13,7 +13,7 @@
<j-row type="flex"> <j-row type="flex">
<j-col flex="180px"> <j-col flex="180px">
<j-form-item name="photoUrl"> <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-form-item>
</j-col> </j-col>
<j-col flex="auto"> <j-col flex="auto">

View File

@ -13,7 +13,7 @@
<j-row type="flex"> <j-row type="flex">
<j-col flex="180px"> <j-col flex="180px">
<j-form-item name="photoUrl"> <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-form-item>
</j-col> </j-col>
<j-col flex="auto"> <j-col flex="auto">

View File

@ -6,7 +6,7 @@
@ok="onSave" @ok="onSave"
@cancel="onCancel" @cancel="onCancel"
> >
<div class="alert"> <div class="resource-issue-alert">
<AIcon <AIcon
type="InfoCircleOutlined" type="InfoCircleOutlined"
style="margin-right: 10px" style="margin-right: 10px"
@ -17,7 +17,7 @@
target="edge-resource-issue" target="edge-resource-issue"
@search="handleSearch" @search="handleSearch"
type="simple" type="simple"
class="search" class="resource-issue-search"
/> />
<JProTable <JProTable
ref="edgeResourceIssueRef" ref="edgeResourceIssueRef"
@ -31,6 +31,10 @@
selectedRowKeys: _selectedRowKeys, selectedRowKeys: _selectedRowKeys,
onChange: onSelectChange, onChange: onSelectChange,
}" }"
:pagination="{
showSizeChanger: true,
pageSizeOptions: ['10', '20', '50', '100'],
}"
> >
<template #state="slotProps"> <template #state="slotProps">
<j-badge <j-badge
@ -47,7 +51,12 @@
}}</span> }}</span>
</template> </template>
</JProTable> </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> </j-modal>
</template> </template>
@ -56,9 +65,11 @@ import { onlyMessage } from '@/utils/comm';
import { queryDeviceList } from '@/api/edge/resource'; import { queryDeviceList } from '@/api/edge/resource';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import Result from './Result.vue'; import Result from './Result.vue';
import { queryNoPagingPost } from '@/api/device/product';
const defaultParams = { const defaultParams = {
sorts: [{ name: 'createTime', order: 'desc' }], pageSize: 10,
sorts: [{ name: 'registerTime', order: 'desc' }],
terms: [ terms: [
{ {
terms: [ terms: [
@ -111,6 +122,18 @@ const columns = [
ellipsis: true, ellipsis: true,
search: { search: {
type: 'select', 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,
})),
);
});
}),
}, },
}, },
{ {
@ -156,9 +179,9 @@ const handleSearch = (v: any) => {
const onSave = () => { const onSave = () => {
if (_data.value.length) { if (_data.value.length) {
visible.value = true visible.value = true;
} else { } else {
onlyMessage('请选择设备', 'error') onlyMessage('请选择设备', 'error');
} }
}; };
@ -167,12 +190,12 @@ const onCancel = () => {
}; };
</script> </script>
<style lang="less" scoped> <style lang="less">
.search { .resource-issue-search {
padding: 0px; padding: 18px 0 0 0;
margin: 0px; margin: 0px;
} }
.alert { .resource-issue-alert {
height: 40px; height: 40px;
padding-left: 10px; padding-left: 10px;
color: rgba(0, 0, 0, 0.55); color: rgba(0, 0, 0, 0.55);

View File

@ -15,6 +15,7 @@
<template #card="slotProps"> <template #card="slotProps">
<CardBox <CardBox
:value="slotProps" :value="slotProps"
@click="handleView(slotProps)"
:actions="getActions(slotProps, 'card')" :actions="getActions(slotProps, 'card')"
:status="slotProps.state?.value" :status="slotProps.state?.value"
:statusText="slotProps.state?.text" :statusText="slotProps.state?.text"
@ -30,10 +31,7 @@
</template> </template>
<template #content> <template #content>
<Ellipsis style="width: calc(100% - 100px)"> <Ellipsis style="width: calc(100% - 100px)">
<span <span style="font-size: 16px; font-weight: 600">
style="font-size: 16px; font-weight: 600"
@click.stop="handleView(slotProps.id)"
>
{{ slotProps.name }} {{ slotProps.name }}
</span> </span>
</Ellipsis> </Ellipsis>
@ -120,7 +118,11 @@
type="link" type="link"
style="padding: 0 5px" style="padding: 0 5px"
:danger="i.key === 'delete'" :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> <template #icon><AIcon :type="i.icon" /></template>
</PermissionButton> </PermissionButton>
@ -213,17 +215,6 @@ const columns = [
new Promise((resolve) => { new Promise((resolve) => {
queryNoPagingPost({ queryNoPagingPost({
paging: false, paging: false,
terms: [
{
terms: [
{
column: 'productId$product-info',
value: 'accessProvider is official-edge-gateway',
},
],
type: 'and',
},
],
sorts: [ sorts: [
{ {
name: 'createTime', name: 'createTime',
@ -278,6 +269,17 @@ const getActions = (
): ActionsType[] => { ): ActionsType[] => {
if (!data) return []; if (!data) return [];
const actions = [ const actions = [
{
key: 'view',
text: '查看',
tooltip: {
title: '查看',
},
icon: 'EyeOutlined',
onClick: () => {
handleView(data);
},
},
{ {
key: 'update', key: 'update',
text: '编辑', text: '编辑',
@ -370,8 +372,8 @@ const handleSearch = (_params: any) => {
params.value = _params; params.value = _params;
}; };
const handleView = (id: string) => { const handleView = (dt: any) => {
menuStory.jumpPage('device/Instance/Detail', { id }); menuStory.jumpPage('device/Instance/Detail', { id: dt?.sourceId });
}; };
const saveBtn = () => { const saveBtn = () => {
@ -387,3 +389,4 @@ const onRefresh = () => {
<style lang="less" scoped> <style lang="less" scoped>
</style> </style>

View File

@ -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) => { const getLogo = (type: string, provider: string) => {
return MSG_TYPE[type].find((f: any) => f.value === provider)?.logo; return MSG_TYPE[type].find((f: any) => f.value === provider)?.logo;
@ -133,10 +133,12 @@ const handleClick = (dt: any) => {
_selectedRowKeys.value = []; _selectedRowKeys.value = [];
emit('update:value', undefined); emit('update:value', undefined);
emit('change', { templateName: undefined }); emit('change', { templateName: undefined });
emit('update:detail', undefined);
} else { } else {
_selectedRowKeys.value = [dt.id]; _selectedRowKeys.value = [dt.id];
emit('update:value', dt.id); emit('update:value', dt.id);
emit('change', { templateName: dt?.name }); emit('change', { templateName: dt?.name });
emit('update:detail', dt);
} }
}; };

View File

@ -75,6 +75,10 @@ const props = defineProps({
type: Object, type: Object,
default: () => {}, default: () => {},
}, },
template: {
type: Object,
default: () => {},
},
}); });
const emit = defineEmits(['update:value', 'change']); const emit = defineEmits(['update:value', 'change']);
@ -87,6 +91,12 @@ watchEffect(() => {
Object.assign(modelRef, props?.value); 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) => { const getType = (item: any) => {
return item.expands?.businessType || item.type; return item.expands?.businessType || item.type;
}; };
@ -180,16 +190,16 @@ const onChange = (val: any, type: any) => {
emit('change', { tagName: val }); emit('change', { tagName: val });
} else if (type === 'user') { } else if (type === 'user') {
emit('change', { sendTo: val }); emit('change', { sendTo: val });
} else if (type === 'build-in') {
// emit('change', { sendTo: val });
} }
}; };
const onSave = () => const onSave = () =>
new Promise((resolve) => { new Promise((resolve, reject) => {
formRef.value?.validate().then(async (_data: any) => { formRef.value?.validate().then((_data: any) => {
resolve(_data); resolve(_data);
}); }).catch(() => {
reject(false)
})
}); });
defineExpose({ onSave }); defineExpose({ onSave });

View File

@ -47,6 +47,7 @@
<j-form-item name="templateId"> <j-form-item name="templateId">
<NotifyTemplate <NotifyTemplate
v-model:value="formModel.templateId" v-model:value="formModel.templateId"
v-model:detail="template"
:notifierId="formModel.notifierId" :notifierId="formModel.notifierId"
@change="(val) => onValChange(val, 'templateId')" @change="(val) => onValChange(val, 'templateId')"
/> />
@ -58,6 +59,7 @@
:variableDefinitions="variable" :variableDefinitions="variable"
:value="formModel.variables" :value="formModel.variables"
:notify="formModel" :notify="formModel"
:template="template"
@change="(val) => onValChange(val, 'variables')" @change="(val) => onValChange(val, 'variables')"
ref="variableRef" ref="variableRef"
/> />
@ -119,11 +121,19 @@ const formModel = reactive({
const variable = ref([]); const variable = ref([]);
const variableRef = ref(); const variableRef = ref();
const template = ref();
watch( watch(
() => props.value, () => props.value,
(newVal) => { (newVal) => {
Object.assign(formModel, 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 }, { deep: true, immediate: true },
); );
@ -193,8 +203,11 @@ const onCancel = () => {
emit('cancel'); emit('cancel');
}; };
const onOk = async () => { const onOk = async () => {
const _data = await variableRef.value.onSave(); let _data = undefined
formModel.variables = _data; if(variable.value.length){
_data = await variableRef.value.onSave()
}
formModel.variables = _data || [];
const { options, ...extra } = formModel; const { options, ...extra } = formModel;
emit('save', { ...extra }, { ...options }); emit('save', { ...extra }, { ...options });
}; };