Commit 55826096 authored by rockyl's avatar rockyl

标记当前过程

parent fc6d9569
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
"Still Close": "Still Close", "Still Close": "Still Close",
"Save": "Save", "Save": "Save",
"Save And Preview": "Save And Preview", "Save And Preview": "Save And Preview",
"Save And Close": "Save And Close",
"Reset": "Reset", "Reset": "Reset",
"Copy": "Copy", "Copy": "Copy",
"Exit": "Exit", "Exit": "Exit",
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
"Still Close": "仍然关闭", "Still Close": "仍然关闭",
"Save": "保存", "Save": "保存",
"Save And Preview": "保存并预览", "Save And Preview": "保存并预览",
"Save And Close": "保存并关闭",
"Reset": "重置", "Reset": "重置",
"Copy": "复制", "Copy": "复制",
"Exit": "退出", "Exit": "退出",
......
...@@ -17,6 +17,7 @@ export const behaviorStore = { ...@@ -17,6 +17,7 @@ export const behaviorStore = {
originData: null, originData: null,
originBehaviors: null, originBehaviors: null,
behaviors: null, behaviors: null,
currentProcess: null,
processStack: [], processStack: [],
editable: false, editable: false,
...@@ -96,14 +97,18 @@ export const behaviorStore = { ...@@ -96,14 +97,18 @@ export const behaviorStore = {
clearProcessStack(state) { clearProcessStack(state) {
state.processStack.splice(0); state.processStack.splice(0);
updatePropsEditable(state); updatePropsEditable(state);
state.currentProcess = null;
}, },
pushProcessStack(state, process) { pushProcessStack(state, process) {
state.processStack.push(process); state.processStack.push(process);
updatePropsEditable(state); updatePropsEditable(state);
state.currentProcess = process;
console.log(state.currentProcess);
}, },
popProcessStack(state, index) { popProcessStack(state, index) {
state.processStack.splice(index); state.processStack.splice(index);
updatePropsEditable(state); updatePropsEditable(state);
state.currentProcess = state.processStack[state.processStack.length - 1];
}, },
setScale(state, value) { setScale(state, value) {
let scale = state.drawState.boardScale; let scale = state.drawState.boardScale;
...@@ -173,7 +178,7 @@ export const behaviorStore = { ...@@ -173,7 +178,7 @@ export const behaviorStore = {
addProcessMeta(commit, isInline, masterProcess, meta); addProcessMeta(commit, isInline, masterProcess, meta);
return meta; return meta;
}, },
addProcessFromPrefab({commit, state}, {masterProcess, isInline, meta: pMeta}){ addProcessFromPrefab({commit, state}, {masterProcess, isInline, meta: pMeta}) {
let meta = clonePureObj(pMeta); let meta = clonePureObj(pMeta);
meta.id = generateUUID(); meta.id = generateUUID();
meta.isInline = isInline; meta.isInline = isInline;
...@@ -189,7 +194,7 @@ function updatePropsEditable(state) { ...@@ -189,7 +194,7 @@ function updatePropsEditable(state) {
state.editable = state.processStack.filter(item => item.meta.type === 'builtin') <= 0; state.editable = state.processStack.filter(item => item.meta.type === 'builtin') <= 0;
} }
function addProcessMeta(commit, isInline, masterProcess, meta){ function addProcessMeta(commit, isInline, masterProcess, meta) {
if (isInline) { if (isInline) {
if (!masterProcess.meta.metas) { if (!masterProcess.meta.metas) {
Vue.set(masterProcess.meta, 'metas', []); Vue.set(masterProcess.meta, 'metas', []);
......
...@@ -35,8 +35,14 @@ export const envStore = { ...@@ -35,8 +35,14 @@ export const envStore = {
return groupProcesses(state.processes, process => process.isPrefab); return groupProcesses(state.processes, process => process.isPrefab);
}, },
builtinProcessTree: state => { builtinProcessTree: state => {
const tree = groupProcesses(state.processes, process => !process.isPrefab); const builtin = groupProcesses(state.processes, process => !process.isPrefab);
let tree = [
{
name: 'builtin',
children: builtin,
}
];
const dividerProcess = { const dividerProcess = {
id: 'divider', id: 'divider',
name: i18n.t('Divider'), name: i18n.t('Divider'),
......
...@@ -36,6 +36,13 @@ $dock-pin-width: 9px; ...@@ -36,6 +36,13 @@ $dock-pin-width: 9px;
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
font-size: 14px; font-size: 14px;
.current-node{
background-color: $--color-text-secondary;
color: $--color-white;
border-radius: 5px;
padding: 0 2px;
}
} }
.edit-button { .edit-button {
......
...@@ -4,20 +4,20 @@ ...@@ -4,20 +4,20 @@
<split-panes splitpanes-min="10" :splitpanes-size="10" horizontal> <split-panes splitpanes-min="10" :splitpanes-size="10" horizontal>
<process-list @edit-meta="onEditMeta" @delete-meta="onDeleteMeta" :data="prefabProcessTree" <process-list @edit-meta="onEditMeta" @delete-meta="onDeleteMeta" :data="prefabProcessTree"
class="background full-size" splitpanes-min="20" class="background full-size" splitpanes-min="20"
:splitpanes-size="30"/> :splitpanes-size="20"/>
<process-list @edit-meta="onEditMeta" @delete-meta="onDeleteMeta" :data="normalProcessTree" <process-list @edit-meta="onEditMeta" @delete-meta="onDeleteMeta" :data="normalProcessTree"
class="background full-size" splitpanes-min="20" class="background full-size" splitpanes-min="20"
:splitpanes-size="70"/> :splitpanes-size="80"/>
</split-panes> </split-panes>
<div class="center full-size background" splitpanes-min="20" :splitpanes-size="70"> <div class="center full-size background" splitpanes-min="20" :splitpanes-size="70">
<edit-path :processStack="processStack" @pop="onPop"/> <edit-path :processStack="processStack" @pop="onPop"/>
<div class="operate-bar"> <!--<div class="operate-bar">
<!--<el-button-group> <el-button-group>
<el-button size="mini" icon="el-icon-zoom-out" @click="setScale(-0.1)"/> <el-button size="mini" icon="el-icon-zoom-out" @click="setScale(-0.1)"/>
<el-button size="mini" @click="setScale(0)">1:1</el-button> <el-button size="mini" @click="setScale(0)">1:1</el-button>
<el-button size="mini" icon="el-icon-zoom-in" @click="setScale(0.1)"/> <el-button size="mini" icon="el-icon-zoom-in" @click="setScale(0.1)"/>
</el-button-group>--> </el-button-group>
</div> </div>-->
<board ref="board" @select-process-node="onSelectProcessNode" @edit-process="editProcess" @edit-meta="onEditMeta"/> <board ref="board" @select-process-node="onSelectProcessNode" @edit-process="editProcess" @edit-meta="onEditMeta"/>
</div> </div>
<div class="properties background full-size" splitpanes-min="20" :splitpanes-size="20"> <div class="properties background full-size" splitpanes-min="20" :splitpanes-size="20">
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
</el-button-group> </el-button-group>
<el-button size="mini" plain @click="cancel">{{$t('Cancel')}}</el-button> <el-button size="mini" plain @click="cancel">{{$t('Cancel')}}</el-button>
<el-button size="mini" plain @click="save(true)">{{$t('Save And Preview')}}</el-button> <el-button size="mini" plain @click="save(true)">{{$t('Save And Preview')}}</el-button>
<el-button size="mini" plain @click="save(false)">{{$t('Save')}}</el-button> <el-button size="mini" type="primary" plain @click="save(false)">{{$t('Save')}}</el-button>
</div> </div>
</div> </div>
<props-editor-dialog ref="propsEditorDialog"/> <props-editor-dialog ref="propsEditorDialog"/>
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
> >
<div slot-scope="{ node, data }" class="process-tree-node"> <div slot-scope="{ node, data }" class="process-tree-node">
<div class="node-name"> <div class="node-name">
<span :draggable="draggable(data)" @dragstart.stop="dragProcessStart(data, $event)">{{data.name}}</span> <span :class="{'current-node': isCurrentProcess(data)}" :draggable="draggable(data)" @dragstart.stop="dragProcessStart(data, $event)">{{data.name}}</span>
</div> </div>
<el-dropdown v-if="nodeMenu(data)" class="more-button" size="mini" trigger="click" <el-dropdown v-if="nodeMenu(data)" class="more-button" size="mini" trigger="click"
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
</template> </template>
<script> <script>
import {mapState} from 'vuex'
const editableIds = ['custom', 'divider']; const editableIds = ['custom', 'divider'];
export default { export default {
...@@ -59,6 +61,13 @@ ...@@ -59,6 +61,13 @@
deep: true deep: true
} }
}, },
computed: {
...mapState({
currentProcess(state){
return state.behavior.currentProcess;
}
}),
},
methods: { methods: {
updateFilter(){ updateFilter(){
if(this.$refs.tree){ if(this.$refs.tree){
...@@ -99,6 +108,13 @@ ...@@ -99,6 +108,13 @@
let filterDivider = data.isDivider !== true; let filterDivider = data.isDivider !== true;
if (!value) return filterDivider; if (!value) return filterDivider;
return filterDivider && !data.hasOwnProperty('children') && data.name.toUpperCase().indexOf(value.toUpperCase()) >= 0; return filterDivider && !data.hasOwnProperty('children') && data.name.toUpperCase().indexOf(value.toUpperCase()) >= 0;
},
isCurrentProcess(data){
let yes= this.currentProcess && this.currentProcess.meta && data.id && data.id === this.currentProcess.meta.id;
if(yes){
console.log();
}
return yes;
} }
}, },
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
:append-to-body="true" custom-class="behavior-editor-dialog"> :append-to-body="true" 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>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button size="mini" type="primary" @click="onSave(false)">{{$t('Save')}}</el-button> <el-button size="mini" @click="onSave(true)">{{$t('Save And Preview')}}</el-button>
<el-button size="mini" type="primary" @click="onSave(true)">{{$t('Save And Preview')}}</el-button> <el-button size="mini" type="primary" @click="onSave(false)">{{$t('Save And Close')}}</el-button>
</div> </div>
</el-dialog> </el-dialog>
</template> </template>
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
import BehaviorEditor from "../behavior-editor/BehaviorEditor"; import BehaviorEditor from "../behavior-editor/BehaviorEditor";
import events from "@/global-events.js" import events from "@/global-events.js"
export default { export default {
name: "BehaviorEditorDialog", name: "BehaviorEditorDialog",
components: {BehaviorEditor}, components: {BehaviorEditor},
...@@ -31,8 +30,8 @@ ...@@ -31,8 +30,8 @@
}), }),
}, },
created(){ created() {
events.$on('behaviorSave',(isPreview)=>{ events.$on('behaviorSave', (isPreview) => {
this.onSave(isPreview) this.onSave(isPreview)
}); });
}, },
...@@ -48,7 +47,11 @@ ...@@ -48,7 +47,11 @@
}, },
onSave(isPreview) { onSave(isPreview) {
this.behavior_save(); this.behavior_save();
this.$emit('change',isPreview); if(isPreview){
this.$emit('change', isPreview);
}else{
this.visible = false;
}
}, },
beforeClose(done) { beforeClose(done) {
this.$confirm(this.$t('Save this behavior before'), this.$t('Alert'), { this.$confirm(this.$t('Save this behavior before'), this.$t('Alert'), {
......
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