修复修改模式时索引相同时修改失败的BUG

This commit is contained in:
fangxiang 2022-02-12 13:41:17 +08:00
parent 0702704e0a
commit a7950f1359
3 changed files with 11 additions and 1 deletions

View File

@ -202,6 +202,7 @@ export default defineComponent({
let show_dialog = ref(false); let show_dialog = ref(false);
let type = ref(1); let type = ref(1);
let name = ref(null); let name = ref(null);
let backup_index = 0;
let index = ref(0); let index = ref(0);
let uuid = ref(""); let uuid = ref("");
const selected: any = ref(null); const selected: any = ref(null);
@ -274,9 +275,11 @@ export default defineComponent({
selected.value = options.data?.item_data?.group_uuid ?? null; selected.value = options.data?.item_data?.group_uuid ?? null;
uuid.value = options.data?.item_data?.uuid ?? null; uuid.value = options.data?.item_data?.uuid ?? null;
index.value = options.data?.item_data?.number ?? 0; index.value = options.data?.item_data?.number ?? 0;
backup_index = index.value;
} else { } else {
selected.value = options.data?.uuid ?? null; selected.value = options.data?.uuid ?? null;
uuid.value = options.data?.uuid ?? null; uuid.value = options.data?.uuid ?? null;
index.value = 0;
} }
} }
show_dialog.value = true; show_dialog.value = true;
@ -285,6 +288,7 @@ export default defineComponent({
loading.value = false; loading.value = false;
(selected.value = null), (name.value = null); (selected.value = null), (name.value = null);
type.value = 1; type.value = 1;
backup_index = 0;
}, },
treeNodesFilter(node: any, filter: any) { treeNodesFilter(node: any, filter: any) {
return node.is_group; return node.is_group;
@ -309,8 +313,11 @@ export default defineComponent({
response = false; response = false;
} }
} }
if (index.value == backup_index) {
response = true;
}
if (!response) { if (!response) {
resolve($t.t("index exised!")); resolve($t.t("index exised") + "!");
} else { } else {
resolve(true); resolve(true);
} }

View File

@ -3,6 +3,7 @@ import BaseEntity from "./BaseEntity";
export class ModeEntity extends BaseEntity { export class ModeEntity extends BaseEntity {
group_uuid: string = ""; group_uuid: string = "";
name: string = ""; name: string = "";
number: number = 0;
public static copy(dest: ModeEntity, src?: ModeEntity) { public static copy(dest: ModeEntity, src?: ModeEntity) {
if (!src) { if (!src) {
@ -13,6 +14,7 @@ export class ModeEntity extends BaseEntity {
dest.base_note = src.base_note; dest.base_note = src.base_note;
dest.name = src.name; dest.name = src.name;
dest.group_uuid = src.group_uuid; dest.group_uuid = src.group_uuid;
dest.number = src.number;
} }
} }

View File

@ -316,4 +316,5 @@ export default {
"new signal source": "新建信号源", "new signal source": "新建信号源",
"lower window": "置底窗口", "lower window": "置底窗口",
"top window": "置顶窗口", "top window": "置顶窗口",
"index exised": "索引已经存在",
}; };