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>
<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

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

View File

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

View File

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

View File

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

View File

@ -181,15 +181,15 @@
</j-row>
<j-divider style="margin: 12px 0" />
<div class="content-bottom">
<div v-if="slotProps.usedFlow === 0">
<span class="flow-text">
{{ slotProps.totalFlow }}
</span>
<span class="card-item-content-text">
M 使用流量</span
>
</div>
<div v-else>
<!-- <div v-if="slotProps.usedFlow === 0">-->
<!-- <span class="flow-text">-->
<!-- {{ slotProps.totalFlow }}-->
<!-- </span>-->
<!-- <span class="card-item-content-text">-->
<!-- M 使用流量</span-->
<!-- >-->
<!-- </div>-->
<div>
<div class="progress-text">
<div>
{{
@ -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

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

View File

@ -75,6 +75,18 @@ const formModel = reactive({
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,
type: datum.valueType ? datum.valueType.type : '-',
format: datum.valueType ? datum.valueType.format : undefined,
options: datum.valueType ? datum.valueType.elements : undefined,
options: handlePropertiesOptions(datum),
value: undefined,
});
}
@ -101,10 +113,13 @@ const functionData = computed(() => {
const rules = [{
validator(_: string, value: any) {
console.log(value)
debugger
if (!value?.length && functionData.value.length) {
return Promise.reject('请输入功能值')
} 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) {
const functionItem = functionData.value.find((item: any) => item.id === hasValue.name)
return Promise.reject(functionItem?.name ? `请输入${functionItem?.name}` : '请输入功能值')

View File

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

View File

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

View File

@ -2,15 +2,6 @@
<div :class='["trigger-options-content", isAdd ? "is-add" : ""]'>
<span v-if='!isAdd'> 点击配置定时触发 </span>
<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'>
<span className='trigger-options-when'>{{ options.when }}</span>
</div>

View File

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

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

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

View File

@ -265,7 +265,7 @@
<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

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

View File

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

View File

@ -18,21 +18,7 @@
@change='updateValue'
/>
</j-form-item>
<j-form-item v-if='showCron' name='cron' :rules="[
{ 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-form-item v-if='showCron' name='cron' :rules="cronRules">
<j-input placeholder='corn表达式' v-model:value='formModel.cron' @change='updateValue' />
</j-form-item>
<template v-else>
@ -139,6 +125,22 @@ const props = defineProps({
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>({
trigger: 'week',
when: props.value.when || [],

View File

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

View File

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

View File

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

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 =
@ -542,6 +543,13 @@ const dialogs = reactive({
editShow: false,
nextShow: false,
});
watch(
() => props.parentId,
() => {
tableData._selectedRowKeys = [];
},
);
</script>
<style lang="less" scoped>

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