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

This commit is contained in:
jackhoo_98 2023-03-28 10:58:16 +08:00
commit 2aaa3ae945
36 changed files with 531 additions and 404 deletions

View File

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

View File

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

View File

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

View File

@ -218,7 +218,7 @@ const ManualInspection = defineComponent({
if (data.type === 'device') { if (data.type === 'device') {
instanceStore.tabActiveKey = 'Info' instanceStore.tabActiveKey = 'Info'
} else if (data.type === 'product') { } 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 { } else {
menuStory.jumpPage('link/AccessConfig/Detail', { id: data.configuration?.id }); menuStory.jumpPage('link/AccessConfig/Detail', { id: data.configuration?.id });
} }

View File

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

View File

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

View File

@ -325,6 +325,20 @@ const isCheck = ref<boolean>(false);
const routerParams = useRouterParams() const routerParams = useRouterParams()
const menuStory = useMenuStore(); 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 = [ const columns = [
{ {
title: 'ID', title: 'ID',
@ -398,10 +412,11 @@ const columns = [
hideInTable: true, hideInTable: true,
search: { search: {
type: 'treeSelect', type: 'treeSelect',
rename: 'productId$product-info',
options: () => options: () =>
new Promise((resolve) => { new Promise((resolve) => {
queryTree({ paging: false }).then((resp: any) => { queryTree({ paging: false }).then((resp: any) => {
resolve(resp.result); resolve(transformData(resp.result));
}); });
}), }),
}, },
@ -423,12 +438,6 @@ const columns = [
...item, ...item,
value: `accessProvider is ${item.id}` 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 visible = ref<boolean>(false);
const current = ref<Record<string, any>>({}); 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 = [ const columns = [
{ {
title: 'ID', title: 'ID',
@ -216,6 +230,7 @@ const columns = [
key: 'productName', key: 'productName',
search: { search: {
type: 'select', type: 'select',
rename: 'productId',
options: () => options: () =>
new Promise((resolve) => { new Promise((resolve) => {
queryNoPagingPost({ paging: false }).then((resp: any) => { queryNoPagingPost({ paging: false }).then((resp: any) => {
@ -253,8 +268,8 @@ const columns = [
}, },
}, },
{ {
key: 'classifiedId', key: 'productId$product-info',
dataIndex: 'classifiedId', dataIndex: 'productId$product-info',
title: '产品分类', title: '产品分类',
hideInTable: true, hideInTable: true,
search: { search: {
@ -262,7 +277,7 @@ const columns = [
options: () => options: () =>
new Promise((resolve) => { new Promise((resolve) => {
queryTree({ paging: false }).then((resp: any) => { queryTree({ paging: false }).then((resp: any) => {
resolve(resp.result); resolve(transformData(resp.result));
}); });
}), }),
}, },

View File

@ -187,7 +187,7 @@
</div> </div>
<div class="upload-tips">推荐尺寸64*64</div> <div class="upload-tips">推荐尺寸64*64</div>
<div class="upload-tips">支持icon格式</div> <div class="upload-tips">支持ico格式</div>
</j-form-item> </j-form-item>
</j-col> </j-col>
</j-row> </j-row>
@ -329,7 +329,7 @@ const { resetFields, validate, validateInfos } = useForm(
* 提交数据 * 提交数据
*/ */
const saveBasicInfo = () => { const saveBasicInfo = () => {
return new Promise(async (resolve) => { return new Promise(async (resolve,reject) => {
validate() validate()
.then(async () => { .then(async () => {
const item = [ const item = [

View File

@ -13,13 +13,13 @@
<script lang="ts" setup> <script lang="ts" setup>
import { getImage } from '@/utils/comm'; import { getImage } from '@/utils/comm';
import BaseMenu from '../data/baseMenu'; import BaseMenu from '../data/baseMenu';
import { getSystemPermission , updateMenus } from '@/api/initHome'; import { getSystemPermission, updateMenus } from '@/api/initHome';
/** /**
* 获取菜单数据 * 获取菜单数据
*/ */
const menuDatas = reactive({ const menuDatas = reactive({
count: 0, count: 0,
current:undefined, current: undefined,
}); });
/** /**
* 获取当前系统权限信息 * 获取当前系统权限信息
@ -68,18 +68,21 @@ const menuCount = (menus: any[]) => {
/** /**
* 初始化菜单 * 初始化菜单
*/ */
const initMenu = () =>{ const initMenu = async () => {
return new Promise((resolve) => { return new Promise(async (resolve) => {
updateMenus(menuDatas.current).then((res) => { const res = await updateMenus(menuDatas.current);
resolve(res.status === 200); if (res.status === 200) {
}) resolve(true);
}) } else {
} resolve(false);
}
});
};
const { count } = toRefs(menuDatas); const { count } = toRefs(menuDatas);
getSystemPermissionData(); getSystemPermissionData();
defineExpose({ defineExpose({
updataMenu:initMenu updataMenu: initMenu,
}) });
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.menu-style { .menu-style {

View File

@ -142,6 +142,8 @@ const addRoleData = async () => {
} else if (index === keys.value.length - 1) { } else if (index === keys.value.length - 1) {
resolve(Count === keys.value.length); resolve(Count === keys.value.length);
roleData.isSucessRole = 2; roleData.isSucessRole = 2;
}else{
resolve(false);
} }
}); });
}); });

View File

@ -98,12 +98,28 @@ const jump = () => {
const submitData = async () => { const submitData = async () => {
loading.value = true; loading.value = true;
const basicRes = await basicRef.value.submitBasic(); const basicRes = await basicRef.value.submitBasic();
if (!basicRes) {
loading.value = false;
return;
}
const menuRes = await menuRef.value.updataMenu(); const menuRes = await menuRef.value.updataMenu();
if (!menuRes) {
loading.value = false;
return;
}
const roleRes = await roleRef.value.submitRole(); const roleRes = await roleRef.value.submitRole();
if (!roleRes) {
loading.value = false;
return;
}
const initDataRes = await initDataRef.value.save(); const initDataRes = await initDataRef.value.save();
if (!initDataRes) {
loading.value = false;
return;
}
loading.value = false; loading.value = false;
// //
if (basicRes && menuRes && roleRes && initDataRes ) { if (basicRes && menuRes && roleRes && initDataRes) {
message.success('保存成功'); message.success('保存成功');
// // // //
const res = await saveInit(); const res = await saveInit();

View File

@ -181,15 +181,15 @@
</j-row> </j-row>
<j-divider style="margin: 12px 0" /> <j-divider style="margin: 12px 0" />
<div class="content-bottom"> <div class="content-bottom">
<div v-if="slotProps.usedFlow === 0"> <!-- <div v-if="slotProps.usedFlow === 0">-->
<span class="flow-text"> <!-- <span class="flow-text">-->
{{ slotProps.totalFlow }} <!-- {{ slotProps.totalFlow }}-->
</span> <!-- </span>-->
<span class="card-item-content-text"> <!-- <span class="card-item-content-text">-->
M 使用流量</span <!-- M 使用流量</span-->
> <!-- >-->
</div> <!-- </div>-->
<div v-else> <div>
<div class="progress-text"> <div class="progress-text">
<div> <div>
{{ {{
@ -755,7 +755,7 @@ const getActions = (
const handleSearch = (e: any) => { const handleSearch = (e: any) => {
const newParams = (e?.terms as any[])?.map(item1 => { const newParams = (e?.terms as any[])?.map(item1 => {
item1.terms = item1.terms.map((item2: any) => { 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' item2.termType = 'nin'
} }
return item2 return item2

View File

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

View File

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

View File

@ -10,7 +10,14 @@
ref="RecordRef" ref="RecordRef"
:columns="columns" :columns="columns"
:request="queryList" :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" :params="params"
:model="'TABLE'" :model="'TABLE'"
> >

View File

@ -58,8 +58,12 @@ const typeList = [
const select = (s: string) => { const select = (s: string) => {
selectorModel.value = s selectorModel.value = s
devices.value = []
orgIds.value = []
emit('update:selector', s) emit('update:selector', s)
emit('update:selectorValues', []) emit('update:selectorValues', [])
emit('update:deviceKeys', [])
emit('update:orgId', [])
} }
const updateDevice = (d: any[]) => { const updateDevice = (d: any[]) => {
@ -69,7 +73,6 @@ const updateDevice = (d: any[]) => {
} }
const updateOrg = (d: any[]) => { const updateOrg = (d: any[]) => {
console.log('updateOrg', d)
orgIds.value = d orgIds.value = d
emit('update:orgId', d) emit('update:orgId', d)
emit('update:selectorValues', d) emit('update:selectorValues', d)

View File

@ -75,6 +75,18 @@ const formModel = reactive({
functionData: props.functionParameters functionData: props.functionParameters
}) })
const handlePropertiesOptions = (propertiesItem: any) => {
const _type = propertiesItem?.valueType.type
if (_type === 'boolean') {
return [
{ label: propertiesItem.valueType.falseText || '是', value: propertiesItem.valueType.falseValue || false },
{ label: propertiesItem.valueType.trueText || '否', value: propertiesItem.valueType.trueValue || true },
]
}
return propertiesItem.valueType?.elements
}
/** /**
* 获取当前选择功能属性 * 获取当前选择功能属性
*/ */
@ -90,7 +102,7 @@ const functionData = computed(() => {
name: datum.name, name: datum.name,
type: datum.valueType ? datum.valueType.type : '-', type: datum.valueType ? datum.valueType.type : '-',
format: datum.valueType ? datum.valueType.format : undefined, format: datum.valueType ? datum.valueType.format : undefined,
options: datum.valueType ? datum.valueType.elements : undefined, options: handlePropertiesOptions(datum),
value: undefined, value: undefined,
}); });
} }
@ -101,10 +113,13 @@ const functionData = computed(() => {
const rules = [{ const rules = [{
validator(_: string, value: any) { validator(_: string, value: any) {
console.log(value)
debugger
if (!value?.length && functionData.value.length) { if (!value?.length && functionData.value.length) {
return Promise.reject('请输入功能值') return Promise.reject('请输入功能值')
} else { } else {
let hasValue = value.find((item: { name: string, value: any}) => !item.value) let hasValue = value.find((item: { name: string, value: any}) => item.value === undefined)
console.log('hasValue', hasValue)
if (hasValue) { if (hasValue) {
const functionItem = functionData.value.find((item: any) => item.id === hasValue.name) const functionItem = functionData.value.find((item: any) => item.id === hasValue.name)
return Promise.reject(functionItem?.name ? `请输入${functionItem?.name}` : '请输入功能值') return Promise.reject(functionItem?.name ? `请输入${functionItem?.name}` : '请输入功能值')

View File

@ -14,8 +14,9 @@
:columns="columns" :columns="columns"
:request="query" :request="query"
:scroll="{ :scroll="{
y: 350 y: 200
}" }"
:bodyStyle='{ padding: "16px 0 0 0"}'
:expandable='{ :expandable='{
expandedRowKeys: openKeys, expandedRowKeys: openKeys,
onExpandedRowsChange: expandedRowChange, onExpandedRowsChange: expandedRowChange,

View File

@ -192,28 +192,30 @@ const columns = [
hideInTable: true, hideInTable: true,
search: { search: {
type: 'treeSelect', type: 'treeSelect',
options: getTreeData_api({ paging: false }).then((resp: any) => { options: () => new Promise((resolve) => {
const formatValue = (list: any[]) => { getTreeData_api({ paging: false }).then((resp: any) => {
return list.map((item: any) => { const formatValue = (list: any[]) => {
if (item.children) { return list.map((item: any) => {
item.children = formatValue(item.children); if (item.children) {
} item.children = formatValue(item.children);
return { }
...item, return {
value: JSON.stringify({ ...item,
assetType: 'product', value: JSON.stringify({
targets: [ assetType: 'product',
{ targets: [
type: 'org', {
id: item.id, type: 'org',
}, id: item.id,
], },
}), ],
} }),
}) }
} })
return formatValue(resp.result) }
}), resolve(formatValue(resp.result) || [])
})
})
} }
} }
] ]

View File

@ -2,15 +2,6 @@
<div :class='["trigger-options-content", isAdd ? "is-add" : ""]'> <div :class='["trigger-options-content", isAdd ? "is-add" : ""]'>
<span v-if='!isAdd'> 点击配置定时触发 </span> <span v-if='!isAdd'> 点击配置定时触发 </span>
<template v-else> <template v-else>
<div class='center-item'>
<AIcon v-if='options.selectorIcon' :type='options.selectorIcon' class='icon-padding-right' />
<span class='trigger-options-name'>
<Ellipsis style='max-width: 310px'>
{{ options.name }}
</Ellipsis>
</span>
<span v-if='options.extraName'>{{ options.extraName }}</span>
</div>
<div v-if='options.when'> <div v-if='options.when'>
<span className='trigger-options-when'>{{ options.when }}</span> <span className='trigger-options-when'>{{ options.when }}</span>
</div> </div>

View File

@ -1,261 +1,269 @@
<template> <template>
<pro-search <pro-search
:columns="columns" :columns='columns'
type="simple" type='simple'
@search="handleSearch" @search='handleSearch'
class="scene-search" class='scene-search'
target="scene-trigger-device-product" target='scene-trigger-device-product'
/> />
<j-divider style="margin: 0" /> <j-divider style='margin: 0' />
<j-pro-table <j-pro-table
ref="actionRef" ref='actionRef'
model="CARD" model='CARD'
:columns="columns" :columns='columns'
:params="params" :params='params'
:request="productQuery" :request='productQuery'
:gridColumn="2" :gridColumn='2'
:bodyStyle="{ :bodyStyle='{
paddingRight: 0, paddingRight: 0,
paddingLeft: 0, paddingLeft: 0,
}" }'
> >
<template #card="slotProps"> <template #card='slotProps'>
<CardBox <CardBox
:value="slotProps" :value='slotProps'
:active="rowKey === slotProps.id" :active='rowKey === slotProps.id'
:status="String(slotProps.state)" :status='String(slotProps.state)'
:statusText="slotProps.state === 1 ? '正常' : '禁用'" :statusText="slotProps.state === 1 ? '正常' : '禁用'"
:statusNames="{ '1': 'processing', '0': 'error' }" :statusNames="{ '1': 'processing', '0': 'error' }"
@click="handleClick(slotProps)" @click='handleClick(slotProps)'
> >
<template #img> <template #img>
<slot name="img"> <slot name='img'>
<img <img
:width="88" :width='88'
:height="88" :height='88'
:src=" :src="
slotProps.photoUrl || slotProps.photoUrl ||
getImage('/device-product.png') getImage('/device-product.png')
" "
/> />
</slot> </slot>
</template> </template>
<template #content> <template #content>
<div style="width: calc(100% - 100px)"> <div style='width: calc(100% - 100px)'>
<Ellipsis> <Ellipsis>
<span style="font-size: 16px; font-weight: 600"> <span style='font-size: 16px; font-weight: 600'>
{{ slotProps.name }} {{ slotProps.name }}
</span> </span>
</Ellipsis> </Ellipsis>
</div> </div>
<j-row> <j-row>
<j-col :span="12"> <j-col :span='12'>
<div class="card-item-content-text">设备类型</div> <div class='card-item-content-text'>设备类型</div>
<Ellipsis>{{ slotProps.deviceType?.text }}</Ellipsis> <Ellipsis>{{ slotProps.deviceType?.text }}</Ellipsis>
</j-col> </j-col>
<j-col :span="12"> <j-col :span='12'>
<div class="card-item-content-text">接入方式</div> <div class='card-item-content-text'>接入方式</div>
<Ellipsis>{{ slotProps?.accessName || '未接入' }}</Ellipsis> <Ellipsis>{{ slotProps?.accessName || '未接入' }}</Ellipsis>
</j-col> </j-col>
</j-row> </j-row>
</template>
</CardBox>
</template> </template>
</j-pro-table> </CardBox>
</template>
</j-pro-table>
</template> </template>
<script setup lang='ts' name='Product'> <script setup lang='ts' name='Product'>
import { import {
getProviders, getProviders,
queryGatewayList, queryGatewayList,
queryProductList, queryProductList
} from '@/api/device/product'; } from '@/api/device/product'
import { queryTree } from '@/api/device/category'; import { queryTree } from '@/api/device/category'
import { getTreeData_api } from '@/api/system/department'; import { getTreeData_api } from '@/api/system/department'
import { isNoCommunity } from '@/utils/utils'; import { isNoCommunity } from '@/utils/utils'
import { getImage } from '@/utils/comm'; import { getImage } from '@/utils/comm'
import { accessConfigTypeFilter } from '@/utils/setting' import { accessConfigTypeFilter } from '@/utils/setting'
type Emit = { type Emit = {
(e: 'update:rowKey', data: string): void; (e: 'update:rowKey', data: string): void;
(e: 'update:detail', data: string): void; (e: 'update:detail', data: string): void;
(e: 'change', data: string): void; (e: 'change', data: string): void;
}; };
const actionRef = ref(); const actionRef = ref()
const params = ref({}); const params = ref({})
const props = defineProps({ const props = defineProps({
rowKey: { rowKey: {
type: String, type: String,
default: '', default: ''
}, },
detail: { detail: {
type: Object, type: Object,
default: () => ({}), default: () => ({})
}, }
}); })
const emit = defineEmits<Emit>(); const emit = defineEmits<Emit>()
const columns = [ const columns = [
{ {
title: 'ID', title: 'ID',
dataIndex: 'id', dataIndex: 'id',
width: 300, width: 300,
ellipsis: true, ellipsis: true,
fixed: 'left', fixed: 'left',
search: { search: {
type: 'string', type: 'string'
}, }
}, },
{ {
title: '名称', title: '名称',
dataIndex: 'name', dataIndex: 'name',
width: 200, width: 200,
ellipsis: true, ellipsis: true,
search: { search: {
type: 'string', type: 'string',
first: true, first: true
}, }
}, },
{ {
title: '网关类型', title: '网关类型',
dataIndex: 'accessProvider', dataIndex: 'accessProvider',
width: 150, width: 150,
ellipsis: true, ellipsis: true,
hideInTable: true, hideInTable: true,
search: { search: {
type: 'select', type: 'select',
options: () => options: () =>
getProviders().then((resp: any) => { getProviders().then((resp: any) => {
const data = resp.result || [] const data = resp.result || []
return accessConfigTypeFilter(data) return accessConfigTypeFilter(data)
}), })
}, }
}, },
{ {
title: '接入方式', title: '接入方式',
dataIndex: 'accessName', dataIndex: 'accessName',
width: 150, width: 150,
ellipsis: true, ellipsis: true,
search: { search: {
type: 'select', type: 'select',
options: () => options: () =>
queryGatewayList().then((resp: any) => queryGatewayList().then((resp: any) =>
resp.result.map((item: any) => ({ resp.result.map((item: any) => ({
label: item.name, label: item.name,
value: item.id, value: item.id
})), }))
), )
}, }
}, },
{ {
title: '设备类型', title: '设备类型',
dataIndex: 'deviceType', dataIndex: 'deviceType',
width: 150, width: 150,
search: { search: {
type: 'select', type: 'select',
options: [ options: [
{ label: '直连设备', value: 'device' }, { label: '直连设备', value: 'device' },
{ label: '网关子设备', value: 'childrenDevice' }, { label: '网关子设备', value: 'childrenDevice' },
{ label: '网关设备', value: 'gateway' }, { label: '网关设备', value: 'gateway' }
], ]
}, }
}, },
{ {
title: '状态', title: '状态',
dataIndex: 'state', dataIndex: 'state',
width: '90px', width: '90px',
search: { search: {
type: 'select', type: 'select',
options: [ options: [
{ label: '禁用', value: 0 }, { label: '禁用', value: 0 },
{ label: '正常', value: 1 }, { label: '正常', value: 1 }
], ]
}, }
}, },
{ {
title: '说明', title: '说明',
dataIndex: 'describe', dataIndex: 'describe',
ellipsis: true, ellipsis: true,
width: 300, width: 300
}, },
{ {
dataIndex: 'classifiedId', dataIndex: 'classifiedId',
title: '分类', title: '分类',
hideInTable: true, hideInTable: true,
search: { search: {
type: 'treeSelect', type: 'treeSelect',
options: queryTree({ paging: false }).then((resp) => resp.result), options: () => {
componentProps: { return new Promise((res => {
fieldNames: { queryTree({ paging: false }).then(resp => {
label: 'name', res(resp.result)
value: 'id', })
}, }))
}, },
}, componentProps: {
}, fieldNames: {
{ label: 'name',
dataIndex: 'id$dim-assets', value: 'id'
title: '所属组织', }
hideInTable: true, }
search: { }
type: 'treeSelect', },
options: getTreeData_api({ paging: false }).then((resp: any) => { {
const formatValue = (list: any[]) => { dataIndex: 'id$dim-assets',
return list.map((item: any) => { title: '所属组织',
if (item.children) { hideInTable: true,
item.children = formatValue(item.children); search: {
} type: 'treeSelect',
return { options: () => new Promise((resolve) => {
...item, getTreeData_api({ paging: false }).then((resp: any) => {
value: JSON.stringify({ const formatValue = (list: any[]) => {
assetType: 'product', return list.map((item: any) => {
targets: [ if (item.children) {
{ item.children = formatValue(item.children)
type: 'org', }
id: item.id, return {
}, ...item,
], value: JSON.stringify({
}), assetType: 'product',
}; targets: [
}); {
}; type: 'org',
return formatValue(resp.result); id: item.id
}), }
}, ]
}, })
]; }
})
}
resolve(formatValue(resp.result) || [])
})
})
}
}
]
const handleSearch = (p: any) => { const handleSearch = (p: any) => {
params.value = p; params.value = p
}; }
const productQuery = (p: any) => { const productQuery = (p: any) => {
const sorts: any = []; const sorts: any = []
if (props.rowKey) { if (props.rowKey) {
sorts.push({ sorts.push({
name: 'id', name: 'id',
value: props.rowKey, value: props.rowKey
}); })
} }
sorts.push({ name: 'createTime', order: 'desc' }); sorts.push({ name: 'createTime', order: 'desc' })
p.sorts = sorts; p.sorts = sorts
return queryProductList(p); return queryProductList(p)
}; }
const handleClick = (detail: any) => { const handleClick = (detail: any) => {
emit('update:rowKey', detail.id); emit('update:rowKey', detail.id)
emit('update:detail', detail); emit('update:detail', detail)
emit('change', detail); emit('change', detail)
}; }
</script> </script>
<style scoped lang='less'> <style scoped lang='less'>
.search { .search {
margin-bottom: 0; margin-bottom: 0;
padding-right: 0px; padding-right: 0px;
padding-left: 0px; padding-left: 0px;
} }
</style> </style>

View File

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

View File

@ -175,14 +175,14 @@ const handOptionByColumn = (option: any) => {
termTypeOptions.value = option.termTypes || [] termTypeOptions.value = option.termTypes || []
tabsOptions.value[0].component = option.type tabsOptions.value[0].component = option.type
if (option.type === 'boolean') { if (option.type === 'boolean') {
valueOptions.value = [ valueOptions.value = option.options?.map((item: any) => ({ ...item, label: item.name, value: item.id})) || [
{ name: '是', id: true }, { label: '是', value: true },
{ name: '否', id: false }, { label: '否', value: false },
] ]
} else if(option.type === 'enum') { } else if(option.type === 'enum') {
valueOptions.value = option.options?.map((item: any) => ({ ...item, label: item.name, value: item.id})) || [] valueOptions.value = option.options?.map((item: any) => ({ ...item, label: item.name, value: item.id})) || []
} else{ } else{
valueOptions.value = option.options || [] valueOptions.value = (option.options || []).map((item: any) => ({ ...item, label: item.name, value: item.id}))
} }
valueColumnOptions.value = treeFilter(cloneDeep(columnOptions.value), option.type, 'type') valueColumnOptions.value = treeFilter(cloneDeep(columnOptions.value), option.type, 'type')
} else { } else {

View File

@ -265,7 +265,7 @@
<Ellipsis style='max-width: 400px;'> <Ellipsis style='max-width: 400px;'>
{{data?.options?.propertiesName}} {{data?.options?.propertiesName}}
</Ellipsis> </Ellipsis>
<span v-if='!isBoolean(data?.options?.propertiesValue) && data?.options?.propertiesValue'> </span>
<Ellipsis style='max-width: 200px;'> <Ellipsis style='max-width: 200px;'>
{{ {{
`${ `${
@ -276,7 +276,7 @@
? true ? true
: data?.options?.propertiesValue : data?.options?.propertiesValue
) )
? `${data?.options?.propertiesValue}` ? `${data?.options?.propertiesValue}`
: '' : ''
}` }`
}} }}

View File

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

View File

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

View File

@ -88,23 +88,19 @@ const handleOptions = (record: any) => {
case 'enum': case 'enum':
return (record?.options?.elements || []).map((item: any) => ({ label: item.text, value: item.value })) return (record?.options?.elements || []).map((item: any) => ({ label: item.text, value: item.value }))
case 'boolean': case 'boolean':
return [ return record?.options
{ label: '是', value: true },
{ label: '否', value: false },
]
default: default:
return undefined return undefined
} }
} }
const valueChange = debounce(() => { const valueChange = () => {
const _value = dataSource.value.map(item => ({ const _value = dataSource.value.map(item => ({
name: item.id, value: item.value name: item.id, value: item.value
})) }))
console.log(_value)
emit('change', _value) emit('change', _value)
emit('update:value', _value) emit('update:value', _value)
}, 500) }
watch(() => props.data, () => { watch(() => props.data, () => {
dataSource.value = props.data.map((item: any) => { dataSource.value = props.data.map((item: any) => {

View File

@ -176,14 +176,14 @@ const handOptionByColumn = (option: any) => {
} }
if (option.dataType === 'boolean') { if (option.dataType === 'boolean') {
valueOptions.value = [ valueOptions.value = option.options?.map((item: any) => ({ ...item, label: item.name, value: item.id})) || [
{ label: '是', value: true }, { label: '是', value: true },
{ label: '否', value: false }, { label: '否', value: false },
] ]
} else if(option.dataType === 'enum') { } else if(option.dataType === 'enum') {
valueOptions.value = option.options?.map((item: any) => ({ ...item, label: item.name, value: item.id})) || [] valueOptions.value = option.options?.map((item: any) => ({ ...item, label: item.name, value: item.id})) || []
} else{ } else{
valueOptions.value = option.options || [] valueOptions.value = (option.options || []).map((item: any) => ({ ...item, label: item.name, value: item.id}))
} }
} else { } else {
termTypeOptions.value = [] termTypeOptions.value = []

View File

@ -18,21 +18,7 @@
@change='updateValue' @change='updateValue'
/> />
</j-form-item> </j-form-item>
<j-form-item v-if='showCron' name='cron' :rules="[ <j-form-item v-if='showCron' name='cron' :rules="cronRules">
{ max: 64, message: '最多可输入64个字符' },
{
validator: async (_, v) => {
if (v) {
if (!isCron(v)) {
return Promise.reject(new Error('请输入正确的cron表达式'));
}
} else {
return Promise.reject(new Error('请输入cron表达式'));
}
return Promise.resolve();
}
}
]">
<j-input placeholder='corn表达式' v-model:value='formModel.cron' @change='updateValue' /> <j-input placeholder='corn表达式' v-model:value='formModel.cron' @change='updateValue' />
</j-form-item> </j-form-item>
<template v-else> <template v-else>
@ -139,6 +125,22 @@ const props = defineProps({
const emit = defineEmits<Emit>() const emit = defineEmits<Emit>()
const cronRules = [
{ max: 64, message: '最多可输入64个字符' },
{
validator: async (_: any, v: string) => {
if (v) {
if (!isCron(v)) {
return Promise.reject(new Error('请输入正确的cron表达式'));
}
} else {
return Promise.reject(new Error('请输入cron表达式'));
}
return Promise.resolve();
}
}
]
const formModel = reactive<OperationTimer>({ const formModel = reactive<OperationTimer>({
trigger: 'week', trigger: 'week',
when: props.value.when || [], when: props.value.when || [],

View File

@ -53,13 +53,17 @@
</span> </span>
</Ellipsis> </Ellipsis>
<div class="subTitle"> <div class="subTitle">
<span class='subTitle-title'>
说明 说明
<Ellipsis :lineClamp="2"> </span>
{{ <span class='subTitle-content'>
slotProps?.description || <Ellipsis :lineClamp="2">
typeMap.get(slotProps.triggerType)?.tip {{
}} slotProps?.description ||
</Ellipsis> typeMap.get(slotProps.triggerType)?.tip
}}
</Ellipsis>
</span>
</div> </div>
</template> </template>
<template #actions="item"> <template #actions="item">
@ -378,10 +382,21 @@ const handleView = (id: string, triggerType: string) => {
}; };
</script> </script>
<style scoped> <style scoped lang='less'>
.subTitle { .subTitle {
position: relative;
margin-top: 10px;
.subTitle-title {
position: absolute;
top: 0;
left: 0;
}
.subTitle-content {
color: rgba(0, 0, 0, 0.65); color: rgba(0, 0, 0, 0.65);
font-size: 14px; font-size: 14px;
margin-top: 10px; text-indent: 38px;
}
} }
</style> </style>

View File

@ -204,7 +204,7 @@
</div> </div>
<div class="upload-tips">推荐尺寸64*64</div> <div class="upload-tips">推荐尺寸64*64</div>
<div class="upload-tips">支持icon格式</div> <div class="upload-tips">支持ico格式</div>
</j-form-item> </j-form-item>
</j-col> </j-col>
</j-row> </j-row>

View File

@ -220,18 +220,21 @@ const table: any = {
// //
if (bulkBool.value) { if (bulkBool.value) {
// //
let newPermission = uniq([ // let newPermission = uniq([
...item.selectPermissions, // ...item.selectPermissions,
...bulkList.value, // ...bulkList.value,
]); // ]);
const allPermissions = item.permissionList.map( // const allPermissions = item.permissionList.map(
(item: any) => item.value, // (item: any) => item.value,
); // );
newPermission = intersection( // newPermission = intersection(
newPermission, // newPermission,
allPermissions, // allPermissions,
); // );
item.selectPermissions = newPermission; // item.selectPermissions = newPermission;
// fix: bug#10756
item.selectPermissions = n[1];
// //
item.permissionList.forEach((permission: any) => { item.permissionList.forEach((permission: any) => {
permission.disabled = true; permission.disabled = true;

View File

@ -487,6 +487,7 @@ const table = {
}, },
clickEdit: (row?: any) => { clickEdit: (row?: any) => {
const ids = row ? [row.id] : [...tableData._selectedRowKeys]; const ids = row ? [row.id] : [...tableData._selectedRowKeys];
if (ids.length < 1) return message.warning('请勾选需要编辑的数据');
if (row || tableData.selectedRows.length === 1) { if (row || tableData.selectedRows.length === 1) {
const permissionList = const permissionList =
@ -542,6 +543,13 @@ const dialogs = reactive({
editShow: false, editShow: false,
nextShow: false, nextShow: false,
}); });
watch(
() => props.parentId,
() => {
tableData._selectedRowKeys = [];
},
);
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>

View File

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

View File

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