Merge branch 'dev' of github.com:jetlinks/jetlinks-ui-vue into dev
This commit is contained in:
commit
1dc252d6f2
|
@ -274,6 +274,8 @@ const beginAction = () => {
|
|||
};
|
||||
const stopAction = () => {
|
||||
isBeginning.value = true;
|
||||
console.log(ws.value)
|
||||
debugger
|
||||
if (ws.value) {
|
||||
ws.value.unsubscribe?.();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
export const createScript = (src: string) => {
|
||||
return new Promise((resolve) => {
|
||||
const script = document.createElement('script')
|
||||
script.onload = () => {
|
||||
resolve(true)
|
||||
}
|
||||
script.setAttribute('type', 'text/javascript')
|
||||
script.setAttribute('src', src)
|
||||
document.body.appendChild(script)
|
||||
})
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
<ResizeObserver @resize="onResize">
|
||||
<div class="tag-box" ref="box">
|
||||
<div v-for="(item, i) in value" :key="item.id" ref="tags">
|
||||
<div v-if="i != _index" class="tag">
|
||||
<div v-if="i !== _index" class="tag">
|
||||
{{ item?.name }}
|
||||
</div>
|
||||
<div
|
||||
|
@ -21,7 +21,7 @@
|
|||
: {}
|
||||
"
|
||||
>
|
||||
{{ offWidth ? item?.name : '...' }}
|
||||
{{ offWidth ? item?.name + (_index < value.length ? '...' : '') : '...' }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -51,6 +51,7 @@ const onResize = ({ width }: { width: number }) => {
|
|||
if (total >= width) {
|
||||
_index.value = i;
|
||||
offWidth.value = val > 40 ? val : 0;
|
||||
console.log(i, offWidth.value)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -81,6 +82,7 @@ const onResize = ({ width }: { width: number }) => {
|
|||
margin-right: 8px;
|
||||
padding: 0 14px;
|
||||
color: #333333;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -105,9 +105,7 @@ const updateIframeStyle = () => {
|
|||
const iframe = document.querySelector(
|
||||
'#notifier_iframe',
|
||||
) as HTMLIFrameElement;
|
||||
console.log(iframe)
|
||||
iframe.onload = () => {
|
||||
console.log(iframe?.contentWindow, '123')
|
||||
const currentUrl = iframe?.contentWindow?.location?.search || '';
|
||||
let authCode = '';
|
||||
if (currentUrl.startsWith('?')) {
|
||||
|
|
|
@ -187,7 +187,7 @@ const handleOk = () => {
|
|||
return;
|
||||
}
|
||||
btnLoading.value = true;
|
||||
queryDeviceMapping(instanceStore.current.id)
|
||||
queryDeviceMapping(instanceStore.current.id, )
|
||||
.then(res => {
|
||||
const arr = bindDeviceRef.value?._dataSource.filter(item => {
|
||||
return !res.result?.[0]?.find(val => val.deviceId === item.id) && _selectedRowKeys.value.includes(item.id);
|
||||
|
|
|
@ -19,11 +19,7 @@
|
|||
:maxCount="1"
|
||||
:showUploadList="false"
|
||||
@change="uploadChange"
|
||||
:accept="
|
||||
modelRef?.file?.fileType
|
||||
? `.${modelRef?.file?.fileType}`
|
||||
: '.xlsx'
|
||||
"
|
||||
:accept="'.xlsx,.csv'"
|
||||
:before-upload="beforeUpload"
|
||||
:disabled="disabled"
|
||||
@drop="handleDrop"
|
||||
|
@ -117,18 +113,19 @@ const downFile = async (type: string) => {
|
|||
};
|
||||
|
||||
const beforeUpload = (_file: any) => {
|
||||
const fileType = modelRef.file?.fileType === 'csv' ? 'csv' : 'xlsx';
|
||||
// const fileType = modelRef.file?.fileType === 'csv' ? 'csv' : 'xlsx';
|
||||
const isCsv = _file.type === 'text/csv';
|
||||
const isXlsx =
|
||||
_file.type ===
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
|
||||
if (!isCsv && fileType !== 'xlsx') {
|
||||
onlyMessage('请上传.csv格式文件', 'warning');
|
||||
if (!isCsv && !isXlsx) {
|
||||
onlyMessage('请上传.xlsx或.csv格式文件', 'warning');
|
||||
}
|
||||
if (!isXlsx && fileType !== 'csv') {
|
||||
onlyMessage('请上传.xlsx格式文件', 'warning');
|
||||
}
|
||||
return (isCsv && fileType !== 'xlsx') || (isXlsx && fileType !== 'csv');
|
||||
// if (!isXlsx) {
|
||||
// onlyMessage('请上传.xlsx格式文件', 'warning');
|
||||
// }
|
||||
// return (isCsv && fileType !== 'xlsx') || (isXlsx && fileType !== 'csv');
|
||||
return isCsv || isXlsx;
|
||||
};
|
||||
|
||||
const handleDrop = () => {};
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
|
||||
<script setup lang="ts" name="Rule">
|
||||
import FRuleEditor from '@/components/FRuleEditor/index.vue';
|
||||
import {Form} from "jetlinks-ui-components";
|
||||
|
||||
const formItemContext = Form.useInjectFormItemContext();
|
||||
|
||||
interface Emits {
|
||||
(e: 'update:value', data: string | undefined): void;
|
||||
|
@ -26,6 +29,7 @@ const visible = ref<boolean>(false);
|
|||
const onChange = (val: string | undefined) => {
|
||||
emit('change', val)
|
||||
emit('update:value', val)
|
||||
formItemContext.onFieldChange()
|
||||
onClose()
|
||||
}
|
||||
|
||||
|
|
|
@ -44,10 +44,7 @@
|
|||
通讯协议
|
||||
</div>
|
||||
<Ellipsis>{{
|
||||
options.find(
|
||||
(i) =>
|
||||
i.value === slotProps.category,
|
||||
)?.label || slotProps.category
|
||||
slotProps.category
|
||||
}}</Ellipsis>
|
||||
</j-col>
|
||||
<j-col :span="12">
|
||||
|
@ -97,8 +94,7 @@
|
|||
</template>
|
||||
<template #category="slotProps">
|
||||
{{
|
||||
options.find((i) => i.value === slotProps.category)
|
||||
?.label || slotProps.category
|
||||
slotProps.category
|
||||
}}
|
||||
</template>
|
||||
<template #createTime="slotProps">
|
||||
|
@ -173,14 +169,6 @@ const statusMap = new Map();
|
|||
statusMap.set('enabled', 'processing');
|
||||
statusMap.set('disabled', 'error');
|
||||
|
||||
const options = [
|
||||
{ label: 'UA接入', value: 'OPC_UA' },
|
||||
{ label: 'Modbus TCP接入', value: 'MODBUS_TCP' },
|
||||
{ label: 'S7-200接入', value: 'snap7' },
|
||||
{ label: 'BACnet接入', value: 'BACNetIp' },
|
||||
{ label: 'MODBUS_RTU接入', value: 'MODBUS_RTU' },
|
||||
];
|
||||
|
||||
const params = ref<Record<string, any>>({});
|
||||
const edgeResourceRef = ref<Record<string, any>>({});
|
||||
const settingVisible = ref<boolean>(false);
|
||||
|
@ -218,9 +206,8 @@ const columns = [
|
|||
}).then((resp: any) => {
|
||||
const arrMap = new Map()
|
||||
resp.result.data.forEach((item: any) => {
|
||||
const labelItem = options.find(a => a.value === item.category)
|
||||
arrMap.set(item.category, {
|
||||
label: labelItem?.label || item.category,
|
||||
label: item.category,
|
||||
value: item.category,
|
||||
})
|
||||
})
|
||||
|
|
|
@ -973,10 +973,6 @@ export default [
|
|||
permission: 'gb28181-cascade',
|
||||
actions: ['query'],
|
||||
},
|
||||
{
|
||||
permission: 'plugin-driver',
|
||||
actions: ['query'],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -1019,10 +1015,6 @@ export default [
|
|||
permission: 'gb28181-cascade',
|
||||
actions: ['query'],
|
||||
},
|
||||
{
|
||||
permission: 'plugin-driver',
|
||||
actions: ['query'],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
@ -1437,7 +1429,12 @@ export default [
|
|||
url: '/iot/link/plugin',
|
||||
icon: 'BoxPlotOutlined',
|
||||
showPage: ['plugin-driver'],
|
||||
permissions: [],
|
||||
permissions: [
|
||||
{
|
||||
permission: 'plugin-driver',
|
||||
actions: ['query'],
|
||||
},
|
||||
],
|
||||
buttons: [
|
||||
{
|
||||
id: 'view',
|
||||
|
|
|
@ -95,7 +95,7 @@ const handleChange = async (info: UploadChangeParam) => {
|
|||
Notification.error({
|
||||
// key: '403',
|
||||
message: '系统提示',
|
||||
description: '系统未知错误,请反馈给管理员',
|
||||
description: info.file.response?.message,
|
||||
});
|
||||
// emit('update:modelValue', { err:'file_upload_error'});
|
||||
loading.value = false;
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
</template>
|
||||
<!-- 表格内容 -->
|
||||
<template #bodyCell="{ column, record }">
|
||||
<div :id="record.id"></div>
|
||||
<div v-if="column.key === 'menu'">
|
||||
<j-checkbox
|
||||
v-model:checked="record.granted"
|
||||
|
@ -110,6 +111,7 @@ import {
|
|||
USER_CENTER_MENU_CODE
|
||||
} from '@/utils/consts'
|
||||
import { isNoCommunity } from '@/utils/utils'
|
||||
import {permissionsGranted, useIndirectMenusMap} from "@/views/system/Role/Detail/components/util";
|
||||
|
||||
const emits = defineEmits(['update:selectItems']);
|
||||
const route = useRoute();
|
||||
|
@ -270,6 +272,8 @@ const init = () => {
|
|||
};
|
||||
init();
|
||||
|
||||
const { PermissionsMap } = useIndirectMenusMap(tableData)
|
||||
|
||||
function getAllPermiss() {
|
||||
const id = route.params.id as string;
|
||||
getPrimissTree_api(id).then((resp) => {
|
||||
|
@ -297,6 +301,24 @@ function getAllPermiss() {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
const hasIndirectMenus = (data: any) => {
|
||||
let indirectMenus = []
|
||||
if (data.children) {
|
||||
const item = data.children.find(item => item.indirectMenus)
|
||||
indirectMenus = item.indirectMenus
|
||||
} else if (data?.indirectMenus) {
|
||||
indirectMenus = data.indirectMenus
|
||||
}
|
||||
|
||||
if (indirectMenus.length) {
|
||||
const ids = permissionsGranted(tableData.value)
|
||||
console.log(ids, indirectMenus)
|
||||
const inMenu = false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 菜单权限改变事件
|
||||
* @param row 触发的项
|
||||
|
@ -306,7 +328,9 @@ function menuChange(
|
|||
row: tableItemType,
|
||||
setButtonBool: boolean = true,
|
||||
): undefined {
|
||||
console.log('menuChange', row)
|
||||
// 判断是否需要对子菜单及操作权限进行选择
|
||||
// hasIndirectMenus(row)
|
||||
if (setButtonBool) {
|
||||
if (row.buttons && row.buttons.length > 0)
|
||||
row.buttons.forEach((button) => {
|
||||
|
@ -358,7 +382,7 @@ function menuChange(
|
|||
}
|
||||
|
||||
emits('update:selectItems', selectList); // 选中的项传回父组件
|
||||
treeRef.value.$forceUpdate();
|
||||
proxy?.$forceUpdate?.();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
import type {Ref} from "vue";
|
||||
import {watch} from "vue";
|
||||
|
||||
const handlePermissionsMap = (data: any, map: Map<string, any>, parentId: string[] = []) => {
|
||||
data.forEach((item: any) => {
|
||||
if (item.children) {
|
||||
handlePermissionsMap(item.children,map, parentId.concat(item.id) )
|
||||
} else {
|
||||
map.set(item.id, {
|
||||
parentIds: parentId,
|
||||
name: item.name
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const useIndirectMenusMap = (tableData: Ref<any[]>) => {
|
||||
const PermissionsMap = ref<Map<string, any>>(new Map())
|
||||
|
||||
watch(() => tableData.value, () => {
|
||||
PermissionsMap.value.clear()
|
||||
if (tableData.value?.length) {
|
||||
handlePermissionsMap(tableData.value, PermissionsMap.value)
|
||||
}
|
||||
}, { immediate: true})
|
||||
|
||||
return {
|
||||
PermissionsMap
|
||||
}
|
||||
}
|
||||
|
||||
export const permissionsGranted = (data: any[]) => {
|
||||
return data.reduce((prev,current) => {
|
||||
let ids = current.granted ? [...prev, current.id] : prev
|
||||
if (current.children) {
|
||||
const _ids = permissionsGranted(current.children)
|
||||
ids = ids.concat(_ids)
|
||||
}
|
||||
return ids
|
||||
}, [])
|
||||
}
|
|
@ -3837,8 +3837,8 @@ jetlinks-ui-components@^1.0.23:
|
|||
|
||||
jetlinks-ui-components@^1.0.24:
|
||||
version "1.0.24"
|
||||
resolved "http://registry.jetlinks.cn/jetlinks-ui-components/-/jetlinks-ui-components-1.0.24.tgz#a1262b3a735a01cd1fd9801406d16291b5070367"
|
||||
integrity sha512-P4aolPQb1/wq4edN0AZ6WSavVAvQ+KEOEFzAarL/0dy6Oz3tTVemZmtgu20TsGbrNnEe/LheMu0QpvmkOq+3dg==
|
||||
resolved "http://registry.jetlinks.cn/jetlinks-ui-components/-/jetlinks-ui-components-1.0.24.tgz#e15551fb114e4cb8752db962423b3ca17d9389c1"
|
||||
integrity sha512-TGyQ9SmdkoNkZScfYvfBF1/P1oBzXkxMuzR+DiNnof6CbSlYfPrkRsJIpOIZUjqg2o/6dyKLDK8gOxbxWm8wjA==
|
||||
dependencies:
|
||||
"@vueuse/core" "^9.12.0"
|
||||
"@vueuse/router" "^9.13.0"
|
||||
|
|
Loading…
Reference in New Issue