1
This commit is contained in:
@@ -376,6 +376,9 @@ export default {
|
||||
else { this.$modal.msgError(res.msg || '加载属性失败'); }
|
||||
} catch(e) { this.$modal.msgError('加载属性失败'); }
|
||||
},
|
||||
onPvChange() {
|
||||
// 属性值变更时的回调(可用于调试或联动逻辑)
|
||||
},
|
||||
submitPublish() {
|
||||
this.$refs.publishForm.validate(valid => {
|
||||
if (!valid) return;
|
||||
@@ -389,10 +392,26 @@ export default {
|
||||
try { channelPv = JSON.parse(f.channelPvJson); }
|
||||
catch(e) { this.$modal.msgError('属性JSON格式不正确'); return; }
|
||||
} else if (this.selectedPv && Object.keys(this.selectedPv).length) {
|
||||
channelPv = Object.keys(this.selectedPv).map(pid => ({
|
||||
property_id: isNaN(Number(pid)) ? pid : Number(pid),
|
||||
value_id: this.selectedPv[pid]
|
||||
}));
|
||||
// 从 pvOptions 中获取完整的属性信息(property_id, property_name, value_id, value_name)
|
||||
channelPv = [];
|
||||
Object.keys(this.selectedPv).forEach(pid => {
|
||||
const valueId = this.selectedPv[pid];
|
||||
if (!valueId) return; // 跳过未选择的属性
|
||||
// 从 pvOptions 中找到对应的属性
|
||||
const property = this.pvOptions.find(p => String(p.propertyId) === String(pid));
|
||||
if (!property) return;
|
||||
// 从属性的 values 中找到对应的值
|
||||
const value = property.values && property.values.find(v => String(v.valueId) === String(valueId));
|
||||
if (!value) return;
|
||||
// 构建完整的4个字段
|
||||
channelPv.push({
|
||||
property_id: pid,
|
||||
property_name: property.propertyName,
|
||||
value_id: valueId,
|
||||
value_name: value.valueName
|
||||
});
|
||||
});
|
||||
if (channelPv.length === 0) channelPv = undefined;
|
||||
}
|
||||
const payload = {
|
||||
appid: f.appid || undefined,
|
||||
|
||||
Reference in New Issue
Block a user