提交 ea794496 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

add work dir in header, show file name in list

上级 1dfe730a
......@@ -370,6 +370,10 @@ func (s *Server) admin(writer http.ResponseWriter, req *http.Request) {
ret := model.ResData{Code: 1, Msg: "success"}
switch reqData.Action {
// common
case "getWorkDir":
ret.WorkDir = vari.WorkDir
// def
case "syncData":
s.syncService.SyncData(reqData.Mode)
......
......@@ -6,6 +6,14 @@ const api = {
export default api
export function getWorkDir () {
return request({
url: api.admin,
method: 'post',
data: {'action': 'getWorkDir'}
})
}
export function listDef (keywords, page) {
return request({
url: api.admin,
......
import {config} from '../utils/vari'
const PageSize = 15
const ResTypeDef = "def"
const ResTypeRanges = "ranges"
......@@ -44,6 +46,11 @@ export function checkDirIsUsers (rule, value, callback){
callback()
}
export function pathToRelated (path){
const name = path.substr(config.workDir.length)
return name
}
export function sectionStrToArr (str){
str = str.substring(1, str.length - 1)
let arr = str.split(',')
......
......@@ -5,23 +5,36 @@
</h2>
<div class="center"></div>
<div class="right">
<span class="dir">工作目录:{{workDir}}</span>
<a href="https://www.zendata.cn/book/zendata/" target="_blank">帮助</a>
</div>
</div>
</template>
<script>
import {getWorkDir} from "../api/manage";
import {config} from "../utils/vari";
export default {
name: 'Header',
components: {
},
data () {
return {
workDir: '',
}
},
computed: {
},
created () {
getWorkDir().then(json => {
console.log('getWorkDir', json)
const that = this
that.defs = json.data
this.workDir = json.workDir
config.workDir = this.workDir
})
},
mounted () {
},
......@@ -50,8 +63,13 @@ export default {
}
.right {
margin: 0 15px;
width: 100px;
width: 500px;
text-align: right;
.dir {
display: inline-block;
padding-right: 20px;
}
}
}
</style>
let config = {}
export { config }
......@@ -16,7 +16,7 @@
<template slot="title">
<span>{{record.path}}</span>
</template>
<a>{{record.folder}}</a>
<a>{{record.path | pathToRelated}}</a>
</a-tooltip>
</span>
......@@ -57,7 +57,7 @@
<script>
import {listConfig, removeConfig} from "../../../../api/manage";
import {PageSize} from "../../../../api/utils";
import {PageSize, pathToRelated} from "../../../../api/utils";
import debounce from "lodash.debounce"
const columns = [
......@@ -66,7 +66,7 @@ const columns = [
dataIndex: 'title',
},
{
title: '目录',
title: '文件',
dataIndex: 'folder',
scopedSlots: { customRender: 'folderWithPath' },
},
......@@ -104,6 +104,11 @@ export default {
},
mounted () {
},
filters: {
pathToRelated: function (path) {
return pathToRelated(path)
}
},
methods: {
create() {
this.$router.push({path: '/data/buildin/config/edit/0'});
......
......@@ -16,7 +16,7 @@
<template slot="title">
<span>{{record.path}}</span>
</template>
<a>{{record.folder}}</a>
<a>{{record.path | pathToRelated}}</a>
</a-tooltip>
</span>
......@@ -60,7 +60,7 @@
<script>
import {listExcel, removeExcel} from "../../../../api/manage";
import {PageSize} from "../../../../api/utils";
import {PageSize, pathToRelated} from "../../../../api/utils";
import debounce from "lodash.debounce"
const columns = [
......@@ -69,7 +69,7 @@ const columns = [
dataIndex: 'title',
},
{
title: '目录',
title: '文件',
dataIndex: 'folder',
scopedSlots: { customRender: 'folderWithPath' },
},
......@@ -107,6 +107,11 @@ export default {
},
mounted () {
},
filters: {
pathToRelated: function (path) {
return pathToRelated(path)
}
},
methods: {
create() {
this.$router.push({path: '/data/buildin/excel/edit/0'});
......
......@@ -16,7 +16,7 @@
<template slot="title">
<span>{{record.path}}</span>
</template>
<a>{{record.folder}}</a>
<a>{{record.path | pathToRelated}}</a>
</a-tooltip>
</span>
......@@ -73,7 +73,7 @@
import {listInstances, removeInstances} from "../../../../api/manage";
import { DesignComponent } from '../../../../components'
import {PageSize, ResTypeInstances} from "../../../../api/utils";
import {PageSize, ResTypeInstances, pathToRelated} from "../../../../api/utils";
import debounce from "lodash.debounce"
const columns = [
......@@ -82,7 +82,7 @@ const columns = [
dataIndex: 'title',
},
{
title: '目录',
title: '文件',
dataIndex: 'folder',
scopedSlots: { customRender: 'folderWithPath' },
},
......@@ -122,6 +122,11 @@ export default {
},
mounted () {
},
filters: {
pathToRelated: function (path) {
return pathToRelated(path)
}
},
methods: {
create() {
this.$router.push({path: '/data/buildin/instances/edit/0'});
......
......@@ -16,7 +16,7 @@
<template slot="title">
<span>{{record.path}}</span>
</template>
<a>{{record.folder}}</a>
<a>{{record.path | pathToRelated}}</a>
</a-tooltip>
</span>
......@@ -73,7 +73,7 @@
import {listRanges, removeRanges} from "../../../../api/manage";
import { DesignComponent } from '../../../../components'
import {PageSize} from "../../../../api/utils";
import {PageSize, pathToRelated} from "../../../../api/utils";
import debounce from "lodash.debounce"
const columns = [
......@@ -82,7 +82,7 @@ const columns = [
dataIndex: 'title',
},
{
title: '目录',
title: '文件',
dataIndex: 'folder',
scopedSlots: { customRender: 'folderWithPath' },
},
......@@ -121,6 +121,11 @@ export default {
},
mounted () {
},
filters: {
pathToRelated: function (path) {
return pathToRelated(path)
}
},
methods: {
create() {
this.$router.push({path: '/data/buildin/ranges/edit/0'});
......
......@@ -16,7 +16,7 @@
<template slot="title">
<span>{{record.path}}</span>
</template>
<a>{{record.folder}}</a>
<a>{{record.path | pathToRelated}}</a>
</a-tooltip>
</span>
......@@ -58,7 +58,7 @@
<script>
import {listText, removeText} from "../../../../api/manage";
import {PageSize} from "../../../../api/utils";
import {PageSize, pathToRelated} from "../../../../api/utils";
import debounce from "lodash.debounce"
const columns = [
......@@ -67,7 +67,7 @@ const columns = [
dataIndex: 'title',
},
{
title: '目录',
title: '文件',
dataIndex: 'folder',
scopedSlots: { customRender: 'folderWithPath' },
},
......@@ -105,6 +105,11 @@ export default {
},
mounted () {
},
filters: {
pathToRelated: function (path) {
return pathToRelated(path)
}
},
methods: {
create() {
this.$router.push({path: '/data/buildin/text/edit/0'});
......
......@@ -16,7 +16,7 @@
<template slot="title">
<span>{{record.path}}</span>
</template>
<a>{{record.folder}}</a>
<a>{{record.path | pathToRelated}}</a>
</a-tooltip>
</span>
......@@ -67,7 +67,7 @@
import { listDef, removeDef, previewDefData } from "../../../api/manage";
import { DesignComponent } from '../../../components'
import {PageSize, ResTypeDef} from "../../../api/utils";
import {PageSize, ResTypeDef, pathToRelated} from "../../../api/utils";
import debounce from "lodash.debounce"
const columns = [
......@@ -76,7 +76,7 @@ const columns = [
dataIndex: 'title',
},
{
title: '目录',
title: '文件',
dataIndex: 'folder',
scopedSlots: { customRender: 'folderWithPath' },
},
......@@ -117,6 +117,11 @@ export default {
},
mounted () {
},
filters: {
pathToRelated: function (path) {
return pathToRelated(path)
}
},
methods: {
loadData() {
listDef(this.keywords, this.page).then(json => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册