{{ $t('device.instruction-parsing.830424-15') }}
-
@@ -352,6 +357,12 @@
+
+
+ 产品指令(同类产品通用)
+ 设备指令(仅本设备)
+
+
@@ -604,8 +615,10 @@ export default {
/**打开编辑名字的框 */
openEditName(item) {
this.editNameForm = {
+ id: item.id,
name: item.name || '',
command: item.command,
+ isProductCommand: item.productId != null, // 通过 productId 判断是否为产品指令
};
this.editName = true;
this.editDialog = true;
@@ -712,18 +725,23 @@ export default {
if (this.editName) {
try {
this.saveLoading = true;
+ // 根据选择决定传 productId 还是 serialNumber
+ const isProductCommand = this.editNameForm.isProductCommand;
+
if (this.editNameForm.id) {
await editPreferences({
command: this.editNameForm.command,
name: this.editNameForm.name,
- serialNumber: this.device.serialNumber,
+ serialNumber: isProductCommand ? null : this.device.serialNumber,
+ productId: isProductCommand ? this.device.productId : null,
id: this.editNameForm.id,
});
} else {
await addPreferences({
command: this.editNameForm.command,
name: this.editNameForm.name,
- serialNumber: this.device.serialNumber,
+ serialNumber: isProductCommand ? null : this.device.serialNumber,
+ productId: isProductCommand ? this.device.productId : null,
});
}
this.$message({
@@ -744,10 +762,13 @@ export default {
this.saveLoading = false;
this.editDialog = false;
},
- /**获取指令列表 */
+ /**获取指令列表(产品指令+设备指令) */
async getPreferencesList() {
try {
- const { rows } = await preferencesList({ serialNumber: this.device.serialNumber });
+ const { rows } = await preferencesList({
+ serialNumber: this.device.serialNumber,
+ productId: this.device.productId
+ });
this.quickParsing = rows;
} catch (err) {
console.log('🚀 ~ getPreferencesList ~ err:', err);
@@ -1045,10 +1066,21 @@ $right-btn-color: #1890ff;
color: $right-btn-color;
cursor: pointer;
border-radius: 4px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: 0 8px;
+ box-sizing: border-box;
&:first-child {
margin-top: 12px;
}
+
+ &.product-command {
+ border-color: #67c23a;
+ color: #67c23a;
+ background-color: rgba(103, 194, 58, 0.05);
+ }
}
.right-bottom {