Commit ff8abbd3 authored by rockyl's avatar rockyl

行为编辑器关闭警告

parent 4e2a11fb
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
"Confirm": "Confirm", "Confirm": "Confirm",
"Cancel": "Cancel", "Cancel": "Cancel",
"Close": "Close", "Close": "Close",
"Still Close": "Still Close",
"Save": "Save", "Save": "Save",
"Copy": "Copy", "Copy": "Copy",
"Exit": "Exit", "Exit": "Exit",
...@@ -77,6 +78,7 @@ ...@@ -77,6 +78,7 @@
"This Meta ID is in use, can not save": "This Meta ID is in use, can not save!", "This Meta ID is in use, can not save": "This Meta ID is in use, can not save!",
"Custom node desc": "Custom node", "Custom node desc": "Custom node",
"Divider node desc": "Divider node, exit will be executed in sequence", "Divider node desc": "Divider node, exit will be executed in sequence",
"Save this behavior before": "Save this behavior before?",
"menu": { "menu": {
"save": "Save", "save": "Save",
"details": "Details", "details": "Details",
......
...@@ -60,9 +60,6 @@ export const behaviorStore = { ...@@ -60,9 +60,6 @@ export const behaviorStore = {
behavior_save(state) { behavior_save(state) {
state.originData.processes = state.data.processes; state.originData.processes = state.data.processes;
state.originBehaviors[0] = state.currentBehavior; state.originBehaviors[0] = state.currentBehavior;
},
behavior_cancel(state) {
}, },
updateProcesses(state, {targetMetaID, replaceMetaID}) { updateProcesses(state, {targetMetaID, replaceMetaID}) {
for (let process of state.data.processes) { for (let process of state.data.processes) {
......
<template> <template>
<el-dialog :title="$t('Behavior Editor')" :visible.sync="visible" @before-close="beforeClose" @opened="onOpened" <el-dialog :title="$t('Behavior Editor')" :visible.sync="visible" :before-close="beforeClose" @opened="onOpened"
:fullscreen="true" :fullscreen="true"
:append-to-body="true" :close-on-click-modal="false" custom-class="behavior-editor-dialog"> :append-to-body="true" :close-on-click-modal="false" custom-class="behavior-editor-dialog">
<behavior-editor v-if="editorReady" ref="behaviorEditor" class="full-size"></behavior-editor> <behavior-editor v-if="editorReady" ref="behaviorEditor" class="full-size"></behavior-editor>
...@@ -42,10 +42,21 @@ ...@@ -42,10 +42,21 @@
this.visible = false; this.visible = false;
this.$emit('change'); this.$emit('change');
}, },
beforeClose() { beforeClose(done) {
this.behavior_cancel(); this.$confirm(this.$t('Save this behavior before?'), this.$t('Alert'), {
this.visible = false; showClose: false,
this.$emit('cancel'); closeOnClickModal: false,
closeOnPressEscape: false,
confirmButtonText: this.$t('Confirm'),
cancelButtonText: this.$t('Still Close'),
type: 'warning'
}).then(() => {
this.onSave();
done();
}).catch((e) => {
this.$emit('cancel');
done();
});
}, },
onOpened() { onOpened() {
this.editorReady = true; this.editorReady = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment