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

This commit is contained in:
easy 2023-03-17 11:51:18 +08:00
commit 8dd84e062d
9 changed files with 76 additions and 45 deletions

View File

@ -40,7 +40,7 @@
</j-button>
</template>
</template>
<j-tooltip v-else title="没有权限">
<j-tooltip v-else title="暂无权限,请联系管理员">
<slot v-if="noButton"></slot>
<j-button v-else v-bind="props" :disabled="_isPermission" :style="props.style">
<slot></slot>

View File

@ -49,7 +49,7 @@
<j-input
v-model:value="form.id"
placeholder="请输入ID"
:disabled="disabled"
:disabled="idDisabled"
/>
</j-form-item>
<j-form-item label="名称" name="name">
@ -149,6 +149,7 @@ import { Form } from 'ant-design-vue';
import { getImage } from '@/utils/comm.ts';
import { message } from 'ant-design-vue';
import DialogTips from '../DialogTips/index.vue';
import { useProductStore } from '@/store/product';
import { filterTreeSelectNode, filterSelectNode } from '@/utils/comm';
import { FILE_UPLOAD } from '@/api/comm';
import { isInput } from '@/utils/regular';
@ -159,7 +160,7 @@ import {
CheckOutlined,
DeleteOutlined,
} from '@ant-design/icons-vue';
const productStore = useProductStore();
const emit = defineEmits(['success']);
const props = defineProps({
title: {
@ -178,6 +179,7 @@ const visible = ref<boolean>(false);
const logoLoading = ref<boolean>(false);
const formRef = ref();
const disabled = ref<boolean>(false);
const idDisabled = ref<boolean>(false);
const useForm = Form.useForm;
const _selectedRowKeys = ref([]);
const photoValue = ref('/images/device-product.png');
@ -296,6 +298,7 @@ watch(
*/
const show = (data: any) => {
if (props.isAdd === 2) {
productStore.refresh(data.id);
form.name = data.name;
form.classifiedId = data.classifiedId;
form.classifiedName = data.classifiedName;
@ -303,7 +306,8 @@ const show = (data: any) => {
form.deviceType = data.deviceType.value;
form.describe = form.describe;
form.id = data.id;
disabled.value = true;
disabled.value = productStore.current?.accessId ? true : false;
idDisabled.value = true;
} else if (props.isAdd === 1) {
form.name = '';
form.classifiedId = '';
@ -313,6 +317,7 @@ const show = (data: any) => {
form.describe = undefined;
form.id = undefined;
disabled.value = false;
disabled.vlaue = false;
}
visible.value = true;
};

View File

@ -395,7 +395,7 @@ const beforeUpload = (file: any) => {
}
return true;
} catch {
message.error('请上传json格式文件');
// message.error('json');
}
return true;
};

View File

@ -317,9 +317,14 @@ watch(
() => _vis.value,
(val) => {
if (!val) {
formRef.value.resetFields();
formRef.value?.resetFields(); // resetFields
// ,
formData.value.id = undefined;
Object.keys(formData.value).forEach((key: string) => {
if (key === 'id') formData.value.id = undefined;
else if (key === 'deviceId')
formData.value.deviceId = route.query.id;
else formData.value[key] = '';
});
}
},
);

View File

@ -53,7 +53,7 @@
>
<j-input
v-model:value="formData.id"
placeholder="请输入"
placeholder="请输入ID"
:disabled="!!route.query.id"
/>
</j-form-item>

View File

@ -1,6 +1,6 @@
export const PROVIDER_OPTIONS = [
{ label: '固定地址', value: 'fixed-media' },
{ label: 'GB/T28181', value: 'gb28181-2016' },
{ label: '固定地址', value: 'fixed-media' },
]
export const streamMode = [
{ label: 'UDP', value: 'UDP' },

View File

@ -78,7 +78,12 @@
...item.tooltip,
}"
@click="item.onClick"
:hasPermission="'media/Device:' + item.key"
:hasPermission="
'media/Device:' +
(item.key !== 'updateChannel'
? item.key
: 'update')
"
>
<AIcon
type="DeleteOutlined"
@ -124,7 +129,10 @@
@click="i.onClick"
type="link"
style="padding: 0px"
:hasPermission="'media/Device:' + i.key"
:hasPermission="
'media/Device:' +
(i.key !== 'updateChannel' ? i.key : 'update')
"
>
<template #icon><AIcon :type="i.icon" /></template>
</PermissionButton>
@ -318,7 +326,7 @@ const getActions = (
},
},
{
key: 'view', // updateChannel
key: 'updateChannel',
text: '更新通道',
tooltip: {
title:
@ -366,6 +374,8 @@ const getActions = (
icon: 'DeleteOutlined',
},
];
return actions;
return data.provider === 'fixed-media'
? actions.filter((f: any) => f.key !== 'updateChannel')
: actions;
};
</script>

View File

@ -43,8 +43,8 @@ interface DataNode {
/**
* 点击节点
* @param _
* @param param1
* @param _
* @param param1
*/
const onSelect = (_: any, { node }: any) => {
emit('onSelect', { dId: node.deviceId, cId: node.channelId });
@ -68,23 +68,25 @@ const treeData = ref<any[]>([]);
const getDeviceList = async () => {
const res = await cascadeApi.getMediaTree({ paging: false });
if (res.success) {
treeData.value = res.result.map((m: any) => {
const extra: any = {};
extra.isLeaf = isLeaf(m);
return {
...m,
...extra,
};
});
treeData.value = res.result
.sort((a: any, b: any) => a.createTime - b.createTime)
.map((m: any) => {
const extra: any = {};
extra.isLeaf = isLeaf(m);
return {
...m,
...extra,
};
});
}
};
getDeviceList();
/**
* 更新数据
* @param list
* @param key
* @param children
* @param list
* @param key
* @param children
*/
const updateTreeData = (
list: DataNode[],
@ -146,7 +148,7 @@ const getChildren = (key: any, params: any): Promise<any> => {
/**
* 异步加载子节点数据
* @param param0
* @param param0
*/
const onLoadData = ({ key, children }: any): Promise<void> => {
return new Promise(async (resolve) => {

View File

@ -271,21 +271,31 @@ const getActions = (
/**
* 自动绑定
*/
const handleAutoBind = () => {
const arr = dataSource.value
.filter((item: any) => item.userId && item.status.value === 'error')
.map((i: any) => {
return {
userId: i.userId,
providerName: i.userName,
thirdPartyUserId: i.thirdPartyUserId,
};
});
const handleAutoBind = async () => {
await getTableData([
{
column: `id$user-third$${props.data.type}_${props.data.provider}$not`,
},
]);
const params = dataSource.value
.filter((f: any) => f.userId && f.status.value === 'error')
.map((m: any) => ({
userId: m.userId,
providerName: m.thirdPartyUserName,
thirdPartyUserId: m.thirdPartyUserId,
}));
configApi.dingTalkBindUser(arr, props.data.id).then(() => {
message.success('操作成功');
getTableData();
});
if (props.data.type === 'dingTalk') {
configApi.dingTalkBindUser(params, props.data.id).then(() => {
message.success('操作成功');
getTableData();
});
} else if (props.data.type === 'weixin') {
configApi.weChatBindUser(params, props.data.id).then(() => {
message.success('操作成功');
getTableData();
});
}
};
/**
@ -335,9 +345,9 @@ const getAllUsers = async (terms?: any) => {
*/
const dataSource = ref<any>([]);
const tableLoading = ref(false);
const getTableData = () => {
const getTableData = (terms?: any) => {
tableLoading.value = true;
Promise.all<any>([getDeptUsers(), getBindUsers(), getAllUsers()])
Promise.all<any>([getDeptUsers(), getBindUsers(), getAllUsers(terms)])
.then((res) => {
dataSource.value = [];
const [deptUsers, bindUsers, unBindUsers] = res;
@ -359,7 +369,7 @@ const getTableData = () => {
thirdPartyUserId: deptUser.id,
thirdPartyUserName: deptUser.name,
bindId: bindUser?.id,
userId: bindUser?.userId,
userId: unBindUser?.id,
userName: unBindUser
? `${unBindUser.name}(${unBindUser.username})`
: bindUser?.providerName,
@ -420,7 +430,6 @@ const handleBind = (row: any) => {
getAllUsers([
{
column: `id$user-third$${props.data.type}_${props.data.provider}$not`,
// value: props.data.id,
},
]);
};