update: 优化数据权限

This commit is contained in:
xieyonghong 2023-03-29 23:01:24 +08:00
parent d0c53252ec
commit 4447e11d7c
7 changed files with 38 additions and 23 deletions

View File

@ -122,7 +122,7 @@ const showNotification = (message: string, description: string, key?: string, sh
if (show) {
Notification.error({
key,
message,
message: '',
description
})
}

View File

@ -1688,7 +1688,7 @@ export default [
],
accessSupport: { text: "支持", value: "support" },
supportDataAccess: true,
assetType: 'ataCollectCollector'
assetType: 'dataCollectCollector'
},
],
},

View File

@ -114,7 +114,6 @@ const functionData = computed(() => {
const rules = [{
validator(_: string, value: any) {
console.log(value)
debugger
if (!value?.length && functionData.value.length) {
return Promise.reject('请输入功能值')
} else {
@ -137,6 +136,7 @@ const onSelect = (v: string, item: any) => {
}
const callDataChange = (v: any[]) => {
console.log('callDataChange',v)
emit('update:functionParameters', v)
}

View File

@ -35,7 +35,10 @@ const rules = [{
validator(_: any, v?: ActionsType) {
console.log('validator',v)
if (v?.executor === 'device') {
if(!v.device?.productId || !v.device?.selectorValues) {
if(
!v.device?.productId || //
!v.device?.selectorValues //
) {
return Promise.reject(new Error('该数据已发生变更,请重新配置'))
}
}
@ -53,12 +56,13 @@ const formTouchOff = () => {
const checkDeviceDelete = async () => {
const item = _data.value.branches![props.branchesName].then[props.thenName].actions[props.name].device
const proResp = await queryProductList({ terms: [{ terms: [{ column: 'id', termType: 'eq', value: item!.productId }]}]})
if (proResp.success && (proResp.result as any)?.total === 0) { //
if (proResp.success && (proResp.result as any)?.total === 0 && item && item.productId) { //
_data.value.branches![props.branchesName].then[props.thenName].actions[props.name].device!.productId = undefined
formTouchOff()
return
}
if (item?.selector === 'fixed') {
console.log(item)
const deviceList = item!.selectorValues?.map(item => item.value) || []
const deviceResp = await deviceQuery({ terms: [{ terms: [{ column: 'id', termType: 'in', value: deviceList.toString() }]}]})
if (deviceResp.success && (deviceResp.result as any)?.total < (item!.selectorValues?.length || 0)) { //

View File

@ -1,9 +1,11 @@
<template>
<j-menu class='scene-dropdown-menus' @click='click' :selectedKeys='[myValue]'>
<j-menu-item v-for='item in myOptions' :key='item.value' :title='item.label'>
<div>
<Ellipsis >
{{ item.label }}
</Ellipsis>
</div>
</j-menu-item>
</j-menu>
</template>

View File

@ -8,7 +8,9 @@
>
<template #bodyCell="{ column, record, index }">
<template v-if='column.dataIndex === "name"'>
<Ellipsis>
{{ record.name }}
</Ellipsis>
</template>
<template v-if='column.dataIndex === "type"'>
{{ record.type }}
@ -29,12 +31,14 @@
</j-tooltip>
</template>
<template v-if='column.dataIndex === "value"'>
<div style='max-width: 260px'>
<ValueItem
v-model:modelValue='record.value'
:itemType="record.type"
:options="handleOptions(record)"
@change='valueChange'
/>
</div>
</template>
</template>
</j-table>
@ -42,7 +46,6 @@
<script setup lang='ts' name='FunctionCall'>
import type { PropType } from 'vue'
import { debounce } from 'lodash-es'
type Emit = {
(e: 'change', data: Array<{ name: string, value: any}>): void
@ -69,7 +72,8 @@ const dataSource = reactive<{value: any[]}>({
const columns = [
{
title: '参数名称',
dataIndex: 'name'
dataIndex: 'name',
width: 300
},
{
title: '类型',
@ -95,11 +99,16 @@ const handleOptions = (record: any) => {
}
const valueChange = () => {
const _value = dataSource.value.map(item => ({
console.log('valueChange', dataSource.value)
const _value = dataSource.value.map(item => {
console.log(item.value)
return {
name: item.id, value: item.value
}))
emit('change', _value)
}
})
console.log('valueChange2', _value)
emit('update:value', _value)
emit('change', _value)
}
watch(() => props.data, () => {

View File

@ -3700,8 +3700,8 @@ jetlinks-store@^0.0.3:
jetlinks-ui-components@^1.0.5:
version "1.0.5"
resolved "http://47.108.170.157:9013/jetlinks-ui-components/-/jetlinks-ui-components-1.0.5.tgz#a8c912f424b8e6c3e0aa8e2aa9ddcc59fe13cd3a"
integrity sha512-zZsVbqG7sLfKsizK+8sT0bCmAz7rEu/qoS5yYSEUzGMvTGQU3Q5W6qdT/5o5v92BYFP+1Kud1l5CNhA3e3NtWQ==
resolved "http://47.108.170.157:9013/jetlinks-ui-components/-/jetlinks-ui-components-1.0.5.tgz#d5d2b919f89cede8e7236149afdb9ab1e5684e9b"
integrity sha512-vWNz2YT1bsfh0xAAnJLEfFcukeX4QE3HyloaJJp3xU9wVbwtS38sdKEQepHZdsDKwzgKWdL03/o/qE3hgBKpwQ==
dependencies:
"@vueuse/core" "^9.12.0"
ant-design-vue "^3.2.15"