提交 18786f92 编写于 作者: Z zhaoke

* add script tree list

上级 527ba533
......@@ -9,5 +9,5 @@ VUE_APP_MOCK = true
#api接口域名
VUE_APP_APIHOST_MOCK = /api
VUE_APP_APIHOST = http://127.0.0.1:8085/api/v1
VUE_APP_APIHOST = http://app.me:8085/api/v1
# VUE_APP_APIHOST = http://192.168.0.112:8085/api/v1
\ No newline at end of file
......@@ -15,7 +15,7 @@
<script setup lang="ts">
import {useI18n} from "vue-i18n";
const { t } = useI18n();
const { t,te } = useI18n();
import {defineProps, computed, defineEmits} from 'vue';
import Button, {ButtonProps} from './Button.vue';
......@@ -40,6 +40,7 @@ const buttonPropsList = computed(() => {
}
return props.buttons.map((x, i) => {
let item: (ButtonProps | Record<string, any>) & {key: string | number | symbol};
if (props.replaceFields && Button.props) {
item = Object.keys(Button.props).reduce((item, propName) => {
const replacePropName = props.replaceFields ? props.replaceFields[propName] : null;
......@@ -58,6 +59,10 @@ const buttonPropsList = computed(() => {
...x
};
}
if(te(item.hint)){
item.hint = t(item.hint)
}
return item;
});
});
......
<template>
<div class="ztf-script-main">
<div id="editor-panel" class="tab-page-script">
<div id="editor-panel" class="tab-page-script editor-panel">
<MonacoEditor v-if="scriptCode !== '' && scriptCode !== ScriptFileNotExist" v-model:value="scriptCode"
:language="lang" :options="editorOptions" class="editor" ref="editorRef" @change="editorChange" />
</div>
......@@ -23,7 +23,6 @@ const props = defineProps<{
tab: PageTab
}>();
let tabMap = ref({})
const scriptStore = useStore<{ Script: ScriptData }>();
let script = computed<any>(() => scriptStore.state.Script.detail);
let scriptCode = ref('')
......@@ -45,7 +44,8 @@ watch(script, () => {
scriptCode.value = script.value.code ? script.value.code : t('empty')
lang.value = script.value.lang
setTimeout(() => {
resizeHeight('editor-panel',100)
resizeHeight('ztf-script-main', 'editor-panel', 'splitter-v', 'logs-panel',
100, 100, 90)
}, 600)
} else {
scriptCode.value = ''
......
......@@ -29,6 +29,7 @@ withDefaults(defineProps<{
defaultIconSize: '1.4em',
gap: 0
});
</script>
<style scoped>
......
......@@ -74,6 +74,8 @@ export default {
'dir': 'Dir',
'create_workspace': 'Create WorkDir',
'edit_workspace': 'Edit WorkDir',
'create_file': 'Create file',
'del_file': 'Delete File',
'duration': 'Duration',
'duration_sec': 'Duration(sec)',
......
......@@ -84,6 +84,8 @@ export default {
'dir': '目录',
'create_workspace': '新建工作目录',
'edit_workspace': '编辑工作目录',
'create_file': '新建脚本',
'del_file': '删除脚本',
'duration': '耗时',
'duration_sec': '耗时(秒)',
......
......@@ -207,4 +207,30 @@ export const getFileNodesUnderParent = (node): string[] => {
export function getSyncToInfoFromMenu(key: string, node: any): any {
return
}
export function scriptTreeAddAttr(treeData) {
if(treeData == undefined){
return treeData;
}
treeData = treeData.map((item, index) => {
item.id = item.path;
if (item.isLeaf) {
item.toolbarItems = [
// { hint: 'Add sub folder', icon: 'folder-add' },
{ hint: 'create_file', icon: 'file-add'},
];
} else {
item.toolbarItems = [
{hint: 'create_workspace', icon: 'folder-add'},
// {hint: 'Add file', icon: 'file-add'},
];
}
if (item.children != undefined && item.children.length > 0) {
item.children = scriptTreeAddAttr(item.children)
}
return item;
})
return treeData
}
\ No newline at end of file
......@@ -3,7 +3,7 @@ import { StoreModuleType } from "@/utils/store";
import { ResponseData } from '@/utils/request';
import {
list, get, extract, create, update, remove, loadChildren, updateCode, syncFromZentao, syncToZentao, move
list, get, extract, create, update, remove, loadChildren, updateCode, syncFromZentao, syncToZentao, move, scriptTreeAddAttr
} from './service';
import {ScriptFileNotExist} from "@/utils/const";
......@@ -70,7 +70,9 @@ const StoreModel: ModuleType = {
actions: {
async listScript({ commit }, playload: any ) {
const response: ResponseData = await list(playload);
const { data } = response;
const data = response.data;
data.id = data.path;
data.children = scriptTreeAddAttr(data.children);
commit('setList', [data]);
commit('setQueryParams', playload);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册