Merge branch 'dev' of github.com:jetlinks/jetlinks-ui-vue into dev

This commit is contained in:
leiqiaochu 2023-03-28 09:28:36 +08:00
commit 838987b9da
19 changed files with 132 additions and 69 deletions

View File

@ -1,17 +1,17 @@
<template>
<div class="notice-container">
<j-dropdown :trigger="['click']" @visible-change="visibleChange">
<j-dropdown
v-model:visible="visible"
:trigger="['click']"
@visible-change="visibleChange"
>
<div class="icon-content">
<AIcon
type="BellOutlined"
@click.prevent
style="font-size: 16px"
/>
<AIcon type="BellOutlined" style="font-size: 16px" />
<span class="unread" v-show="total > 0">{{ total }}</span>
</div>
<template #overlay>
<div>
<NoticeInfo :data="list" @on-action="getList" />
<NoticeInfo :data="list" @on-action="handleRead" />
</div>
</template>
</j-dropdown>
@ -106,6 +106,12 @@ watch(updateCount, () => getList());
const visibleChange = (bool: boolean) => {
bool && getList();
};
const visible = ref(false);
const handleRead = () => {
visible.value = false;
getList();
};
</script>
<style lang="less" scoped>

View File

@ -3,20 +3,23 @@
<j-tabs :activeKey="'default'">
<j-tab-pane key="default" tab="未读消息">
<div class="no-data" v-if="props.data.length === 0">
<img src="https://gw.alipayobjects.com/zos/rmsportal/sAuJeJzSKbUmHfBQRzmZ.svg" alt="" />
<img
src="https://gw.alipayobjects.com/zos/rmsportal/sAuJeJzSKbUmHfBQRzmZ.svg"
alt=""
/>
</div>
<div v-else class="content">
<ul class="list">
<li
<j-scrollbar class="list" max-height="400">
<div
class="list-item"
v-for="item in props.data"
@click="read(item.id)"
@click.stop="read(item.id)"
>
<h5>{{ item.topicName }}</h5>
<p>{{ item.message }}</p>
</li>
</ul>
</div>
</j-scrollbar>
<div class="btns">
<span @click="read()">当前标记为已读</span>
<span @click="jumpPage('account/NotificationRecord')"
@ -41,8 +44,13 @@ const { jumpPage } = useMenuStore();
const read = (id?: string) => {
const ids = id ? [id] : props.data.map((item) => item.id);
changeStatus_api('_read', ids).then((resp:any) => {
if (resp.status === 200) emits('onAction');
changeStatus_api('_read', ids).then((resp: any) => {
if (resp.status === 200) {
jumpPage('account/NotificationRecord', {
row: props.data.find((f: any) => f.id === id),
});
emits('onAction');
}
});
};
</script>
@ -97,7 +105,7 @@ const read = (id?: string) => {
color: rgba(0, 0, 0, 0.45);
}
&:hover{
&:hover {
background: #f0f5ff;
}
}

View File

@ -56,7 +56,7 @@
? '标为未读'
: '标为已读',
}"
>
>
<AIcon type="icon-a-PIZHU1" />
</PermissionButton>
<PermissionButton
@ -94,6 +94,7 @@ import { dictItemType } from '@/views/system/DataSource/typing';
import moment from 'moment';
import { message } from 'ant-design-vue';
import { useUserInfo } from '@/store/userInfo';
import { useRouterParams } from '@/utils/hooks/useParams';
const { updateAlarm } = useUserInfo();
const columns = [
@ -180,6 +181,7 @@ const table = {
});
},
view: (row: any) => {
console.log('row: ', row);
viewItem.value = row;
viewVisible.value = true;
},
@ -190,6 +192,13 @@ const table = {
const viewVisible = ref<boolean>(false);
const viewItem = ref<any>({});
const routerParams = useRouterParams();
onMounted(() => {
if (routerParams.params?.value.row) {
table.view(routerParams.params?.value.row);
}
});
</script>
<style lang="less" scoped>

View File

@ -218,7 +218,7 @@ const ManualInspection = defineComponent({
if (data.type === 'device') {
instanceStore.tabActiveKey = 'Info'
} else if (data.type === 'product') {
menuStory.jumpPage('device/Product/Detail', { id: data.productId, tab: 'access' });
menuStory.jumpPage('device/Product/Detail', { id: data.productId, tab: 'Device' });
} else {
menuStory.jumpPage('link/AccessConfig/Detail', { id: data.configuration?.id });
}

View File

@ -891,7 +891,7 @@ const Status = defineComponent({
name: `产品-${item?.name}`,
desc: '诊断产品MQTT认证配置是否正确错误的配置将导致连接失败',
data: { ...item },
configuration,
configuration: _configuration,
productId: unref(device).productId,
});
}}
@ -1052,7 +1052,7 @@ const Status = defineComponent({
name: `设备-${item?.name}`,
desc: '诊断设备MQTT认证配置是否正确错误的配置将导致连接失败',
data: { ...item },
configuration,
configuration: _configuration,
productId: unref(device).productId,
});
}}

View File

@ -270,13 +270,12 @@ const getDetailFn = async () => {
getStatus(String(_id));
list.value = [...initList];
getDetail();
instanceStore.tabActiveKey = routerParams.params.value.tab || 'Info';
}
instanceStore.tabActiveKey = routerParams.params.value.tab || 'Info';
}
onMounted(() => {
getDetailFn()
instanceStore.tabActiveKey = routerParams.params.value.tab || 'Info';
});
const onBack = () => {

View File

@ -325,6 +325,20 @@ const isCheck = ref<boolean>(false);
const routerParams = useRouterParams()
const menuStory = useMenuStore();
const transformData = (arr: any[]): any[] => {
if(Array.isArray(arr) && arr.length){
return (arr || []).map((item: any) => {
return {
...item,
id: `classifiedId is ${item.id}`,
children: transformData(item.children)
}
})
} else {
return []
}
}
const columns = [
{
title: 'ID',
@ -398,10 +412,11 @@ const columns = [
hideInTable: true,
search: {
type: 'treeSelect',
rename: 'productId$product-info',
options: () =>
new Promise((resolve) => {
queryTree({ paging: false }).then((resp: any) => {
resolve(resp.result);
resolve(transformData(resp.result));
});
}),
},
@ -423,12 +438,6 @@ const columns = [
...item,
value: `accessProvider is ${item.id}`
})))
// resolve(
// resp.result.map((item: any) => ({
// label: item.name,
// value: `accessProvider is ${item.id}`,
// })),
// );
});
}),
},

View File

@ -191,6 +191,20 @@ const importVisible = ref<boolean>(false);
const visible = ref<boolean>(false);
const current = ref<Record<string, any>>({});
const transformData = (arr: any[]): any[] => {
if(Array.isArray(arr) && arr.length){
return (arr || []).map((item: any) => {
return {
...item,
id: `classifiedId is ${item.id}`,
children: transformData(item.children)
}
})
} else {
return []
}
}
const columns = [
{
title: 'ID',
@ -216,6 +230,7 @@ const columns = [
key: 'productName',
search: {
type: 'select',
rename: 'productId',
options: () =>
new Promise((resolve) => {
queryNoPagingPost({ paging: false }).then((resp: any) => {
@ -253,8 +268,8 @@ const columns = [
},
},
{
key: 'classifiedId',
dataIndex: 'classifiedId',
key: 'productId$product-info',
dataIndex: 'productId$product-info',
title: '产品分类',
hideInTable: true,
search: {
@ -262,7 +277,7 @@ const columns = [
options: () =>
new Promise((resolve) => {
queryTree({ paging: false }).then((resp: any) => {
resolve(resp.result);
resolve(transformData(resp.result));
});
}),
},

View File

@ -755,7 +755,7 @@ const getActions = (
const handleSearch = (e: any) => {
const newParams = (e?.terms as any[])?.map(item1 => {
item1.terms = item1.terms.map((item2: any) => {
if (['cardStateType'].includes(item2.column)) {
if (['cardStateType'].includes(item2.column) && !(['using', 'toBeActivated', 'deactivate'].includes(item2.value))) { //
item2.termType = 'nin'
}
return item2

View File

@ -197,9 +197,9 @@ const rules = {
{ required: true, message: '请输入用户 ID' },
{ max: 64, message: '最多可输入64个字符' },
],
secretKey: [{ required: true, message: '请输入secretKey' }],
appSecret: [{ required: true, message: '请输入App Secret' }],
openId: [{ required: true, message: '请输入创建者ID' }],
secretKey: [{ required: true, message: '请输入secretKey' }, { max: 64, message: '最多可输入64个字符' },],
appSecret: [{ required: true, message: '请输入App Secret' }, { max: 64, message: '最多可输入64个字符' },],
openId: [{ required: true, message: '请输入创建者ID' }, { max: 64, message: '最多可输入64个字符' },],
explain: [{ required: false, max: 200, message: '最多可输入200个字符' }],
};

View File

@ -38,7 +38,7 @@
</j-col>
<j-col :span="12">
<div class="card-item-content-text">说明</div>
<div>{{ slotProps.explain }}</div>
<Ellipsis>{{ slotProps.explain }}</Ellipsis>
</j-col>
</j-row>
</template>

View File

@ -10,7 +10,14 @@
ref="RecordRef"
:columns="columns"
:request="queryList"
:defaultParams="{ sorts: [{ name: 'time', order: 'desc' }] }"
:defaultParams="{
pageSize: 10,
sorts: [{ name: 'time', order: 'desc' }],
}"
:pagination="{
showSizeChanger: true,
pageSizeOptions: ['10', '20', '50', '100'],
}"
:params="params"
:model="'TABLE'"
>

View File

@ -171,11 +171,12 @@ const handleClick = (_detail: any) => {
}
};
watch(() => props.value, async (newVal) => {
if(newVal[0]?.value){
const { result } = await detail(newVal[0]?.value)
emit('update:value', [{ value: result?.id, name: result?.name }]);
emit('change', result);
watch(() => props.value?.[0]?.value, (newVal) => {
console.log(newVal, '123')
if(newVal){
detail(newVal[0]?.value).then(resp => {
emit('change', resp.result);
})
}
}, {
deep: true,

View File

@ -259,13 +259,13 @@
type="icon-mubiao"
style="padding:0 4px"
/>
<Ellipsis style='max-width: 200px;margin-right: 12px;'>
< style='max-width: 200px;margin-right: 12px;'>
{{data?.options?.name}}
</Ellipsis>
</>
<Ellipsis style='max-width: 400px;'>
{{data?.options?.propertiesName}}
</Ellipsis>
<span v-if='!isBoolean(data?.options?.propertiesValue) && data?.options?.propertiesValue'> </span>
<Ellipsis style='max-width: 200px;'>
{{
`${
@ -276,7 +276,7 @@
? true
: data?.options?.propertiesValue
)
? `${data?.options?.propertiesValue}`
? `${data?.options?.propertiesValue}`
: ''
}`
}}

View File

@ -4,7 +4,7 @@
type="simple"
target="action-notice-config"
@search="handleSearch"
class="search"
class="action-search"
/>
<div style="height: 400px; overflow-y: auto">
<JProTable
@ -12,8 +12,7 @@
:request="query"
model="CARD"
:bodyStyle="{
paddingRight: 0,
paddingLeft: 0,
padding: 0,
}"
:params="params"
:gridColumn="2"
@ -155,9 +154,15 @@ const onSelectChange = (keys: string[]) => {
};
const handleClick = (dt: any) => {
_selectedRowKeys.value = [dt.id];
emit('update:value', dt.id);
emit('change', { provider: dt?.provider });
if (_selectedRowKeys.value.includes(dt.id)) {
_selectedRowKeys.value = [];
emit('update:value', undefined);
emit('change', { provider: undefined });
} else {
_selectedRowKeys.value = [dt.id];
emit('update:value', dt.id);
emit('change', { provider: dt?.provider });
}
};
watch(
@ -176,11 +181,9 @@ watch(
);
</script>
<style lang="less" scoped>
.search {
margin-bottom: 0;
padding-right: 0px;
padding-left: 0px;
<style lang="less">
.action-search {
padding: 0 0 24px 0;
}
.logo {

View File

@ -4,7 +4,7 @@
type="simple"
target="action-notice-template"
@search="handleSearch"
class="search"
class="action-search"
/>
<div style="height: 400px; overflow-y: auto">
<JProTable
@ -12,8 +12,7 @@
:request="(e) => handleData(e)"
model="CARD"
:bodyStyle="{
paddingRight: 0,
paddingLeft: 0,
padding: 0
}"
:params="params"
:gridColumn="2"
@ -130,9 +129,15 @@ const handleSearch = (_params: any) => {
};
const handleClick = (dt: any) => {
_selectedRowKeys.value = [dt.id];
emit('update:value', dt.id);
emit('change', { templateName: dt?.name });
if (_selectedRowKeys.value.includes(dt.id)) {
_selectedRowKeys.value = [];
emit('update:value', undefined);
emit('change', { templateName: undefined });
} else {
_selectedRowKeys.value = [dt.id];
emit('update:value', dt.id);
emit('change', { templateName: dt?.name });
}
};
const onSelectChange = (keys: string[]) => {
@ -176,10 +181,9 @@ watch(
);
</script>
<style lang="less" scoped>
.search {
margin-bottom: 0;
padding: 0;
<style lang="less">
.action-search {
padding: 0 0 24px 0;
}
.logo {

View File

@ -487,6 +487,7 @@ const table = {
},
clickEdit: (row?: any) => {
const ids = row ? [row.id] : [...tableData._selectedRowKeys];
if (ids.length < 1) return message.warning('请勾选需要编辑的数据');
if (row || tableData.selectedRows.length === 1) {
const permissionList =

View File

@ -46,7 +46,7 @@
<AIcon type="DisconnectOutlined" />批量解绑
</PermissionButton>
</template>
<template #state="slotProps">
<template #status="slotProps">
<BadgeStatus
:status="slotProps.status"
:text="slotProps.status ? '正常' : '禁用'"

View File

@ -154,6 +154,7 @@ const form = reactive({
*/
checkUnique: () => {
if (
props.data?.id ||
!form.data.relation ||
!form.data.objectType ||
!form.data.targetType