6565 @on-click =" configLogPanel" >
6666 <Icon type =" md-list" />
6767 <DropdownMenu slot =" list" >
68- <DropdownItem name =" fullScreen" >全屏</DropdownItem >
69- <DropdownItem name =" releaseFullScreen" >取消全屏</DropdownItem >
70- <DropdownItem name =" min" >最小化</DropdownItem >
71- <DropdownItem name =" releaseMin" >取消最小化</DropdownItem >
68+ <DropdownItem
69+ name =" fullScreen"
70+ v-if =" !isBottomPanelFull" >全屏</DropdownItem >
71+ <DropdownItem
72+ name =" releaseFullScreen"
73+ v-else >取消全屏</DropdownItem >
74+ <DropdownItem
75+ name =" min"
76+ v-if =" !scriptViewState.bottomPanelMin" >最小化</DropdownItem >
77+ <DropdownItem
78+ name =" releaseMin"
79+ v-else >取消最小化</DropdownItem >
7280 </DropdownMenu >
7381 </Dropdown >
7482 </div >
@@ -153,6 +161,7 @@ export default {
153161 saveLoading: false ,
154162 isLogShow: false ,
155163 autoSaveTimer: null ,
164+ isBottomPanelFull: false ,
156165 };
157166 },
158167 computed: {
@@ -235,11 +244,13 @@ export default {
235244 if (resultList) {
236245 this .script .result = resultList[resultList .resultSet ].result ;
237246 this .script .resultList = _ .dropRight (_ .toArray (resultList), 3 );
238- this .$nextTick (() => {
239- this .$refs .result .resultSet = resultList .resultSet ;
240- this .$refs .result .initPage ();
241- });
242247 this .showPanelTab (resultList .showPanel );
248+ if (this .$refs .result ) {
249+ this .$nextTick (() => {
250+ this .$refs .result .resultSet = resultList .resultSet ;
251+ this .$refs .result .initPage ();
252+ });
253+ }
243254 }
244255 } });
245256 this .dispatch (' IndexedDB:getLog' , { tabId: this .script .id ,
@@ -403,6 +414,10 @@ export default {
403414 // 执行
404415 this .execute = new Execute (data);
405416 this .isLogShow = false ;
417+ this .localLog = {
418+ log: { all: ' ' , error: ' ' , warning: ' ' , info: ' ' },
419+ logLine: 1 ,
420+ };
406421 if (option && option .isRestore ) {
407422 this .execute .restore (option);
408423 } else {
@@ -456,16 +471,16 @@ export default {
456471 Object .keys (convertLogs).forEach ((key ) => {
457472 const convertLog = convertLogs[key];
458473 if (convertLog) {
459- this .script .log [key] += convertLog + ' \n ' ;
474+ this .localLog .log [key] += convertLog + ' \n ' ;
460475 }
461476 if (key === ' all' ) {
462- this .script .logLine += convertLog .split (' \n ' ).length ;
477+ this .localLog .logLine += convertLog .split (' \n ' ).length ;
463478 }
464479 });
465- this . dispatch ( ' IndexedDB:appendLog ' , {
466- tabId : this .script . id ,
467- rst : this .script . log ,
468- });
480+
481+ if ( this .scriptViewState . showPanel === ' log ' ) {
482+ this .localLogShow ();
483+ }
469484 });
470485
471486 this .execute .on (' history' , (ret ) => {
@@ -526,7 +541,6 @@ export default {
526541 }
527542 });
528543 this .execute .on (' result' , (ret ) => {
529- this .script .running = false ;
530544 this .showPanelTab (' result' );
531545 const storeResult = {
532546 ' headRows' : ret .metadata ,
@@ -650,10 +664,18 @@ export default {
650664 this .showPanelTab (' history' );
651665 this .isLogShow = true ;
652666 }
667+ this .dispatch (' IndexedDB:appendLog' , {
668+ tabId: this .script .id ,
669+ rst: this .script .log ,
670+ });
653671 });
654672 this .execute .on (' stateEnd' , () => {
655673 // 执行成功的时候resolve,用于改变modal框中的loading状态
656674 cb && cb (' end' );
675+ this .dispatch (' IndexedDB:appendLog' , {
676+ tabId: this .script .id ,
677+ rst: this .localLog .log ,
678+ });
657679 });
658680 this .execute .on (' querySuccess' , ({ type, task }) => {
659681 const costTime = util .convertTimestamp (task .costTime );
@@ -747,9 +769,11 @@ export default {
747769 },
748770 autoSave () {
749771 clearTimeout (this .autoSaveTimer );
750- this .autoSaveTimer = setTimeout (() => {
751- this .save ();
752- }, 1000 * 60 * 3 );
772+ if (! this .work .saveAs ) {
773+ this .autoSaveTimer = setTimeout (() => {
774+ this .save ();
775+ }, 1000 * 60 * 5 );
776+ }
753777 },
754778 save () {
755779 const params = {
@@ -804,10 +828,28 @@ export default {
804828 },
805829 showPanelTab (type ) {
806830 this .scriptViewState .showPanel = type;
831+ if (type === ' log' ) {
832+ this .localLogShow ();
833+ }
834+ },
835+ localLogShow () {
836+ if (this .localLog ) {
837+ this .script .log = this .localLog .log ;
838+ this .script .logLine = this .localLog .logLine ;
839+ }
807840 },
808841 configLogPanel (name ) {
809- if (name == ' fullScreen' || name == ' releaseFullScreen' ) {
810- this .$refs .bottomPanel [name]();
842+ if (name == ' fullScreen' ) {
843+ this .isBottomPanelFull = true ;
844+ this .$refs .bottomPanel [name]({
845+ isDiy: false ,
846+ });
847+ }
848+ if (name == ' releaseFullScreen' ) {
849+ this .isBottomPanelFull = false ;
850+ this .$refs .bottomPanel [name]({
851+ isDiy: false ,
852+ });
811853 }
812854 if (name == ' min' ) {
813855 this .scriptViewState .bottomPanelHeight = 32 ;
@@ -823,9 +865,8 @@ export default {
823865 },
824866 changeResultSet (data , cb ) {
825867 const resultSet = _ .isUndefined (data .currentSet ) ? this .script .resultSet : data .currentSet ;
826- // this.$set(this.script.resultList[resultSet], 'result', data.lastResult);
827- // 拿到index对应的result
828- const resultPath = this .script .resultList [resultSet].path ;
868+ const findResult = this .script .resultList .find ((item ) => item .name === ` _${ resultSet} .dolphin` );
869+ const resultPath = findResult && findResult .path ;
829870 const hasResult = this .script .resultList [resultSet].hasOwnProperty (' result' );
830871 if (! hasResult) {
831872 const pageSize = 5000 ;
@@ -861,7 +902,6 @@ export default {
861902 });
862903 cb ();
863904 }).catch ((err ) => {
864- this .$refs .result .resultSet = data .lastSet ;
865905 cb ();
866906 });
867907 } else {
0 commit comments