fix: 修改设备物模型-属性来源可以选择规则
This commit is contained in:
parent
2eb8031386
commit
8ff3297523
|
@ -86,6 +86,7 @@ import Markdown from 'vue3-markdown-it';
|
|||
|
||||
const props = defineProps({
|
||||
id: String,
|
||||
propertiesOptions: Array
|
||||
});
|
||||
|
||||
interface Emits {
|
||||
|
@ -121,16 +122,14 @@ const lastClick = (node: OperatorItem) => {
|
|||
emit('addOperatorValue', `$lastState("${node.id}")`);
|
||||
};
|
||||
const addClick = (node: OperatorItem) => {
|
||||
console.log(node)
|
||||
emit('addOperatorValue', node.code);
|
||||
};
|
||||
|
||||
const productStore = useProductStore();
|
||||
|
||||
const getData = async (id?: string) => {
|
||||
const metadata = productStore.current.metadata || '{}';
|
||||
const _properties =
|
||||
JSON.parse(metadata).properties || ([] as PropertyMetadata[]);
|
||||
// const metadata = productStore.current.metadata || '{}';
|
||||
const _properties = props.propertiesOptions as PropertyMetadata[]
|
||||
const properties = {
|
||||
id: 'property',
|
||||
name: '属性',
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<div class="box">
|
||||
<div class="left">
|
||||
<div>
|
||||
<Operator :id="id" @add-operator-value="addOperatorValue" />
|
||||
<Operator :id="id" :propertiesOptions="propertiesOptions" @add-operator-value="addOperatorValue" />
|
||||
</div>
|
||||
<div style="margin-top: 10px;">
|
||||
<Editor
|
||||
|
@ -70,7 +70,8 @@ const props = defineProps({
|
|||
value: String,
|
||||
id: String,
|
||||
virtualRule: Object,
|
||||
aggList: Array
|
||||
aggList: Array,
|
||||
propertiesOptions: Array
|
||||
});
|
||||
|
||||
const _value = ref<string | undefined>(props.value);
|
||||
|
|
|
@ -212,3 +212,7 @@ body {
|
|||
margin: 16px 0;
|
||||
}
|
||||
}
|
||||
|
||||
.ant-notification {
|
||||
z-index: 1100;
|
||||
}
|
||||
|
|
|
@ -43,9 +43,7 @@ export const initWebSocket = () => {
|
|||
const data = JSON.parse(msg.data)
|
||||
|
||||
if (data.type === 'error') {
|
||||
notification.error({ key: 'wserr', message: data.message, style: {
|
||||
zIndex: 1040
|
||||
} })
|
||||
notification.error({ key: 'error', message: data.message })
|
||||
}
|
||||
|
||||
if (subs[data.requestId]) {
|
||||
|
|
|
@ -419,14 +419,7 @@ export const useColumns = (type?: MetadataType, target?: 'device' | 'product', n
|
|||
}
|
||||
},
|
||||
doubleClick(record){
|
||||
if (target !== 'device') {
|
||||
return true
|
||||
} else {
|
||||
if (record.expands.source === 'rule') {
|
||||
return true
|
||||
}
|
||||
return !isExtendsProdcut(record._sortIndex, productNoEdit?.value, 'expands')
|
||||
}
|
||||
return !isExtendsProdcut(record._sortIndex, productNoEdit?.value, 'expands')
|
||||
},
|
||||
form: {
|
||||
required: true,
|
||||
|
|
|
@ -105,9 +105,9 @@ const type = ref<string>('');
|
|||
const virtualRuleRef = ref<any>(null);
|
||||
|
||||
const disabled = computed(() => {
|
||||
if (props.target === 'device') {
|
||||
return true;
|
||||
}
|
||||
// if (props.target === 'device') {
|
||||
// return true;
|
||||
// }
|
||||
return props.noEdit?.length
|
||||
? props.noEdit.includes(props.value._sortIndex)
|
||||
: false;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<j-button @click="visible = true" style="width: 100%" type="dashed">
|
||||
编辑规则
|
||||
</j-button>
|
||||
<FRuleEditor :aggList="aggList" @close="onClose" v-if="visible" :value="value" @save="onChange" :id="id" :virtualRule="virtualRule" />
|
||||
<FRuleEditor v-if="visible" :id="id" :aggList="aggList" :propertiesOptions="propertiesOptions" :value="value" :virtualRule="virtualRule" @close="onClose" @save="onChange" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="Rule">
|
||||
|
@ -21,7 +21,8 @@ const props = defineProps({
|
|||
value: String,
|
||||
id: String,
|
||||
virtualRule: Object,
|
||||
aggList: Array
|
||||
aggList: Array,
|
||||
propertiesOptions: Array
|
||||
});
|
||||
|
||||
const visible = ref<boolean>(false);
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
<Rule
|
||||
v-model:value="formData.virtualRule.script"
|
||||
:virtualRule="_virtualRule.virtualRule"
|
||||
:propertiesOptions="options"
|
||||
:id="value.id"
|
||||
:aggList="aggList"
|
||||
/>
|
||||
|
|
Loading…
Reference in New Issue