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) { if (show) {
Notification.error({ Notification.error({
key, key,
message, message: '',
description description
}) })
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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