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