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