username 3 years ago
parent
commit
d75ad1d779

+ 1 - 1
config/evn.staging.js

@@ -1,5 +1,5 @@
 /**测试地址配置 */
 export default {
-    BASE_URL: 'http://117.174.10.73:1111',
+    BASE_URL: 'http://192.168.2.242:1111',
     ISERVER_BASE_URL: 'http://117.174.10.73:8090/'
 }

+ 1 - 1
evn_setting.js

@@ -2,4 +2,4 @@ const dev = 'dev' // 开发环境
 const pro = 'pro' // 生产环境
 const staging = 'staging' // 测试环境
 
-export default dev
+export default staging

+ 3 - 481
src/api/base.js

@@ -6,490 +6,12 @@ import request from '@/utils/request'
   * post和put传值用data
   */
 
-// 修改密码
-export function changePassword(data) {
+// 获取服务器文件目录
+export function getFiles(data) {
   return request({
-    url: '/base/user/updatePassword',
-    method: 'put',
-    data
-  })
-}
-
-// 获取角色列表(分页)
-export function getRoleList(params) {
-  return request({
-    url: '/base/role/page',
-    method: 'get',
-    params
-  })
-}
-
-/**
-* 获取角色列表(不分页)
-*/
-export function getRoles(params) {
-  return request({
-    url: '/base/role/list',
-    method: 'get',
-    params
-  })
-}
-
-
-// 新增角色
-export function addRole(data) {
-  return request({
-    url: '/base/role',
-    method: 'post',
-    data
-  })
-}
-
-// 修改角色
-export function editRole(data) {
-  return request({
-    url: '/base/role',
-    method: 'put',
-    data
-  })
-}
-
-// 修改角色
-export function giveRoleMenus(data) {
-  return request({
-    url: '/base/role/giveRoleMenus',
-    method: 'post',
-    data
-  })
-}
-
-
-/**
- * 根据角色id,删除角色
- * 
- */
- export function delRoleByRoleId(data) {
-  return request({
-    url: '/base/role/'+ data,
-    method: 'delete',
-    data
-  })
-}
-
-// 删除角色
-export function deleteRole(params) {
-  return request({
-    url: '/base/role/removeByIds',
-    method: 'delete',
-    params
-  })
-}
-
-// 新增客户
-export function addUser(data) {
-  return request({
-    url: '/base/user',
-    method: 'post',
-    data
-  })
-}
-
-/**
- * 用户授权
- * 用户赋予角色 userId:角色ID(Long整数) ; roleIds:角色ids,以逗号隔开(字符串)
- */
-export function giveUserRole(data) {
-  return request({
-    url: '/base/user/giveUserRole',
+    url: '/toflyServer/system/getFiles',
     method: 'post',
     data
   })
 }
 
-/**
- * 根据用户id,查询用户可以授权的角色列表
- * 
- */
- export function getAuthRoles(data) {
-  return request({
-    url: '/base/role/getAuthRoles/'+ data,
-    method: 'get',
-    data
-  })
-}
-
-
-//获取全部系统菜单
-export function getSystemList() {
-  return request({
-    url: '/base/menu/list',///base/role/sysList
-    method: 'get'
-  })
-}
-
-//根据角色id获取菜单
-export function getMenuListByRoleId(data) {
-  return request({
-    url: '/base/role/menuList/' + data,
-    method: 'get',
-    data
-  })
-}
-
-// 根据角色id获取菜单
-export function getMenuListById(params) {
-  return request({
-    url: '/base/role/menuListById',
-    method: 'get',
-    params
-  })
-}
-
-// 修改客户
-export function editUser(data) {
-  return request({
-    url: '/base/user',
-    method: 'put',
-    data
-  })
-}
-
-// 获取客户列表
-export function getUserList(params) {
-  return request({
-    url: '/base/user/pageNew',
-    method: 'get',
-    params
-  })
-}
-
-// 删除客户
-export function deleteUser(data) {
-  return request({
-    url: '/base/user/' + data,
-    method: 'delete',
-    data
-  })
-}
-
-/**
- * 启用用户
-*/
-export function unStatusUser(data) {
-  return request({
-    url: '/base/user/unStatus/' + data,
-    method: 'put',
-    data
-  })
-}
-
-/**
- * 禁用加锁
-*/
-export function statusUser(data) {
-  return request({
-    url: '/base/user/status/' + data,
-    method: 'put',
-    data
-  })
-}
-
-/**
- * 用户加锁
-*/
-export function lockUser(data) {
-  return request({
-    url: '/base/user/lock/' + data,
-    method: 'put',
-    data
-  })
-}
-
-/**
- * 用户解锁
-*/
-export function unlockUser(data) {
-  return request({
-    url: '/base/user/unlock/' + data,
-    method: 'put',
-    data
-  })
-}
-
-// 角色绑定
-export function roleBind(data) {
-  return request({
-    url: '/base/userrole',
-    method: 'put',
-    data
-  })
-}
-
-// 解锁客户
-export function setUserUnlock(data) {
-  return request({
-    url: '/base/user/unlock',
-    method: 'put',
-    data
-  })
-}
-
-// 获取单位信息
-export function getCompany(data) {
-  return request({
-    url: '/base/department/list',
-    //url: '/tofly-admin/api.admin/v1/depts',
-    method: 'get',
-    data
-  })
-}
-
-// 部门列表
-export function getSectionList(params) {
-  return request({
-    url: '/base/department/page',
-    method: 'get',
-    params
-  })
-}
-
-// 新增部门
-export function addSection(data) {
-  return request({
-    url: '/base/department',
-    method: 'post',
-    data
-  })
-}
-
-// 修改部门
-export function editSection(data) {
-  return request({
-    url: '/base/department',
-    method: 'put',
-    data
-  })
-}
-
-// 删除部门
-export function deleteSection(params) {
-  return request({
-    url: '/base/department/removeByIds',
-    method: 'delete',
-    params
-  })
-}
-
-// 根据部门id获取角色
-export function getRolesById(params) {
-  return request({
-    url: '/base/department/deptRole/' + params + '',
-    method: 'get'
-  })
-}
-
-// 获取资源列表分页
-export function getSourceList(params) {
-  return request({
-    url: '/base/source/page',
-    method: 'get',
-    params
-  })
-}
-
-//获取资源列表
-export function getSourceLists(params) {
-  return request({
-    url: '/base/source/list',
-    method: 'get',
-    params
-  });
-}
-
-// 获取资源列表
-export function getSourceDictList(params) {
-  return request({
-    url: '/base/sourcedic/page',
-    method: 'get',
-    params
-  })
-}
-
-//根据角色id获取资源
-export function getSourceByRoleId(data) {
-  return request({
-    url: '/base/role/getRoleSources/' + data,
-    method: 'post',
-    data
-  })
-}
-
-/**
- * 用户赋予角色权限
- * 角色赋予数据权限 roleId:角色ID(Long整数) ; sourceIds:资源ids,以逗号隔开(字符串)
-*/
-export function giveRoleSources(data) {
-  return request({
-    url: '/base/role/giveRoleSources',
-    method: 'post',
-    data
-  })
-}
-
-
-
-// 日志列表
-export function getJournalPage(params) {
-  return request({
-    url: '/base/log/pageNew',
-    method: 'get',
-    params
-  })
-}
-
-
-// 查询条件日志列表
-export function queryListAllByPageParams(data) {
-  return request({
-    url: '/base/log/queryListAllByPageParams',
-    method: 'post',
-    data
-  })
-}
-
-
-// 公司列表
-export function getCompanyInfoList(params) {
-  return request({
-    url: '/tofly-xrtymis/gdglgsxx/page',
-    method: 'get',
-    params
-  })
-}
-
-// 删除公司
-export function delCompanyInfo(params) {
-  return request({
-    url: '/tofly-xrtymis/gdglgsxx/deleteByIds',
-    method: 'delete',
-    params
-  })
-}
-
-// 新增公司
-export function addCompanyInfo(data) {
-  return request({
-    url: '/tofly-xrtymis/gdglgsxx',
-    method: 'post',
-    data
-  })
-}
-
-// 修改公司
-export function editCompanyInfo(data) {
-  return request({
-    url: '/tofly-xrtymis/gdglgsxx',
-    method: 'put',
-    data
-  })
-}
-
-/****************字典管理******************/
-// 字典列表
-export function getDictionaryList(params) {
-  return request({
-    url: '/base/code/page',
-    method: 'get',
-    params
-  })
-}
-
-
-
-/**
- * 获取字典类型
-*/
-export function getKeyPage(params) {
-  return request({
-    url: '/base/code/keyPage',
-    method: 'get',
-    params
-  })
-}
-
-
-// 新增字典
-export function addDictionary(data) {
-  return request({
-    url: '/base/code',
-    method: 'post',
-    data
-  })
-}
-
-// 修改字典
-export function editDictionary(data) {
-  return request({
-    url: '/base/code',
-    method: 'put',
-    data
-  })
-}
-
-// 删除字典类型
-export function deleteDictionary(data) {
-  return request({
-    url: '/base/code/' + data,
-    method: 'delete',
-    data
-  })
-}
-
-/**
- * 通过Key获取字典value
-*/
-export function getDicValueByKeys(params) {
-  return request({
-    url: '/base/code/getByKeys',
-    method: 'get',
-    params
-  })
-}
-
-/****************模块管理******************/
-// 模块列表
-export function getModualList(params) {
-  return request({
-    url: '/tofly-admin/api.admin/v1/dicts',
-    method: 'get',
-    params
-  })
-}
-
-// 新增模块
-export function addModual(data) {
-  return request({
-    url: '/tofly-admin/api.admin/v1/dicts',
-    method: 'post',
-    data
-  })
-}
-
-// 修改模块
-export function editModual(data) {
-  return request({
-    url: '/tofly-admin/api.admin/v1/dicts',
-    method: 'put',
-    data
-  })
-}
-
-// 删除模块
-export function deleteModual(params) {
-  return request({
-    url: '/tofly-admin/api.admin/v1/dicts',
-    method: 'delete',
-    params
-  })
-}
-

+ 2 - 3
src/api/dataApi/dataStore.js

@@ -28,8 +28,7 @@ export function getDataStoreList(params) {
 
 export function getLayerListByDataStore(params) {
     return request({
-        url: '/toflyServer/dataSource/dataSourceLayerList',
-        method: 'get',
-        params
+        url: '/toflyServer/dataSource/publishStatus/'+params,
+        method: 'get'
     })
 }

+ 10 - 1
src/api/dataApi/previewlayer.js

@@ -6,7 +6,7 @@ import request from '@/utils/request'
 * post和put传值用data
 */
 
-/**图层预览相关api */
+/**图层相关api */
 
 // 获取工作空间列表
 export function getLayerList(params) {
@@ -23,4 +23,13 @@ export function getLayerByName(params) {
         url: '/toflyServer/layers/' + params,
         method: 'get'
     })
+}
+
+// 发布图层
+export function publishLayer(data) {
+    return request({
+        url: '/toflyServer/servicePublish',
+        method: 'post',
+        data
+    })
 }

+ 49 - 3
src/assets/iconfont/demo_index.html

@@ -54,6 +54,18 @@
       <div class="content unicode" style="display: block;">
           <ul class="icon_lists dib-box">
           
+            <li class="dib">
+              <span class="icon iconfont">&#xe69c;</span>
+                <div class="name">文件</div>
+                <div class="code-name">&amp;#xe69c;</div>
+              </li>
+          
+            <li class="dib">
+              <span class="icon iconfont">&#xe63a;</span>
+                <div class="name">BBD文件夹</div>
+                <div class="code-name">&amp;#xe63a;</div>
+              </li>
+          
             <li class="dib">
               <span class="icon iconfont">&#xe651;</span>
                 <div class="name">WFS</div>
@@ -228,9 +240,9 @@
 <pre><code class="language-css"
 >@font-face {
   font-family: 'iconfont';
-  src: url('iconfont.woff2?t=1639451880378') format('woff2'),
-       url('iconfont.woff?t=1639451880378') format('woff'),
-       url('iconfont.ttf?t=1639451880378') format('truetype');
+  src: url('iconfont.woff2?t=1642407571680') format('woff2'),
+       url('iconfont.woff?t=1642407571680') format('woff'),
+       url('iconfont.ttf?t=1642407571680') format('truetype');
 }
 </code></pre>
           <h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
@@ -256,6 +268,24 @@
       <div class="content font-class">
         <ul class="icon_lists dib-box">
           
+          <li class="dib">
+            <span class="icon iconfont icon-wenjian"></span>
+            <div class="name">
+              文件
+            </div>
+            <div class="code-name">.icon-wenjian
+            </div>
+          </li>
+          
+          <li class="dib">
+            <span class="icon iconfont icon-wenjianjia"></span>
+            <div class="name">
+              BBD文件夹
+            </div>
+            <div class="code-name">.icon-wenjianjia
+            </div>
+          </li>
+          
           <li class="dib">
             <span class="icon iconfont icon-WFS"></span>
             <div class="name">
@@ -517,6 +547,22 @@
       <div class="content symbol">
           <ul class="icon_lists dib-box">
           
+            <li class="dib">
+                <svg class="icon svg-icon" aria-hidden="true">
+                  <use xlink:href="#icon-wenjian"></use>
+                </svg>
+                <div class="name">文件</div>
+                <div class="code-name">#icon-wenjian</div>
+            </li>
+          
+            <li class="dib">
+                <svg class="icon svg-icon" aria-hidden="true">
+                  <use xlink:href="#icon-wenjianjia"></use>
+                </svg>
+                <div class="name">BBD文件夹</div>
+                <div class="code-name">#icon-wenjianjia</div>
+            </li>
+          
             <li class="dib">
                 <svg class="icon svg-icon" aria-hidden="true">
                   <use xlink:href="#icon-WFS"></use>

+ 11 - 3
src/assets/iconfont/iconfont.css

@@ -1,8 +1,8 @@
 @font-face {
   font-family: "iconfont"; /* Project id 2992017 */
-  src: url('iconfont.woff2?t=1639451880378') format('woff2'),
-       url('iconfont.woff?t=1639451880378') format('woff'),
-       url('iconfont.ttf?t=1639451880378') format('truetype');
+  src: url('iconfont.woff2?t=1642407571680') format('woff2'),
+       url('iconfont.woff?t=1642407571680') format('woff'),
+       url('iconfont.ttf?t=1642407571680') format('truetype');
 }
 
 .iconfont {
@@ -13,6 +13,14 @@
   -moz-osx-font-smoothing: grayscale;
 }
 
+.icon-wenjian:before {
+  content: "\e69c";
+}
+
+.icon-wenjianjia:before {
+  content: "\e63a";
+}
+
 .icon-WFS:before {
   content: "\e651";
 }

File diff suppressed because it is too large
+ 1 - 1
src/assets/iconfont/iconfont.js


+ 14 - 0
src/assets/iconfont/iconfont.json

@@ -5,6 +5,20 @@
   "css_prefix_text": "icon-",
   "description": "",
   "glyphs": [
+    {
+      "icon_id": "3758135",
+      "name": "文件",
+      "font_class": "wenjian",
+      "unicode": "e69c",
+      "unicode_decimal": 59036
+    },
+    {
+      "icon_id": "1222611",
+      "name": "BBD文件夹",
+      "font_class": "wenjianjia",
+      "unicode": "e63a",
+      "unicode_decimal": 58938
+    },
     {
       "icon_id": "26452386",
       "name": "WFS",

BIN
src/assets/iconfont/iconfont.ttf


BIN
src/assets/iconfont/iconfont.woff


BIN
src/assets/iconfont/iconfont.woff2


+ 110 - 0
src/views/system/common/filewindow.vue

@@ -0,0 +1,110 @@
+<template>
+  <el-dialog custom-class="tofly-dialog" title="选择图层" :visible.sync="dialogVisible" width="40%" :close-on-click-modal="false"
+             :before-close="beforClose">
+    <div class="window-header">
+      <el-breadcrumb separator="/">
+        <el-breadcrumb-item v-for="(item,index) in subPath" :key="index">
+          <span class="link-btn" v-cloak>{{item}}</span>
+        </el-breadcrumb-item>
+      </el-breadcrumb>
+    </div>
+    <el-table class="tofly-table" :data="tableData" stripe v-loading="loading" style="width: 100%" height="400">
+      <el-table-column prop="name" label="名称" sortable>
+        <template slot-scope="scope">
+          <span v-if="scope.row.type=='folder'" class="link-btn iconfont icon-wenjianjia" v-cloak
+                @click="clickFolder('folder',scope.row.name)">{{scope.row.name}}</span>
+          <span v-else-if="scope.row.type=='file'" class="link-btn iconfont icon-wenjian" v-cloak
+                @click="clickFolder('file',scope.row.name)">{{scope.row.name}}</span>
+        </template>
+      </el-table-column>
+    </el-table>
+    <span slot="footer" class="dialog-footer" v-if="type=='folder'">
+      <el-button size="small">取 消</el-button>
+      <el-button size="small" type="primary">确 定</el-button>
+    </span>
+  </el-dialog>
+</template>
+
+<script>
+import { getFiles } from '@/api/base'
+export default {
+  props: ["dialogVisible", "type", "fileType"],
+  data() {
+    return {
+      loading: false,
+      tableData: [],
+      subPath: ['data_dir'],
+      rootPath: ["home", "ogs", "geoserver"]
+    }
+  },
+  mounted() {
+    this.getFiles(this.rootPath.concat(['data_dir']).join("/"))
+  },
+  methods: {
+    /**
+     * 获取目录
+     */
+    getFiles(path) {
+      getFiles({ filePath: "/" + path }).then(res => {
+        this.tableData = res.result
+        this.loading = false
+      })
+    },
+    /**
+     * 点击获取目录
+     */
+    clickFolder(type, name) {
+      if (type == "folder") {
+        this.loading = true
+        this.subPath.push(name)
+        this.getFiles(this.rootPath.concat(this.subPath).join("/"))
+      } else if (type == "file") {
+        const index = name.lastIndexOf(".");
+        const ext = name.substr(index + 1); //获取后缀
+        if (ext == this.fileType) {
+          let arr = JSON.parse(JSON.stringify(this.subPath))
+          arr.shift()
+          const path = "file:" + arr.join('/') + '/' + name
+          console.log(path)
+          this.$emit("select", path)
+        }else{
+            this.$message.warning(`请选择${this.fileType}类型文件!`)
+        }
+      }
+    },
+    beforClose() {
+      this.$emit("select", null)
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.window-header {
+  height: 30px;
+  line-height: 30px;
+}
+.tofly-dialog {
+  .el-table >>> td,
+  .el-table >>> th {
+    text-align: left !important;
+  }
+  .el-table >>> td {
+    padding: 4px 0;
+  }
+}
+.link-btn.icon-wenjianjia {
+  text-decoration: none !important;
+  &::before {
+    margin-right: 5px;
+    color: #f4d785;
+  }
+}
+.link-btn.icon-wenjian {
+  text-decoration: none !important;
+  &::before {
+    margin-right: 5px;
+    color: #ccc;
+  }
+}
+</style>

+ 1 - 1
src/views/system/common/selectLayer.vue

@@ -24,7 +24,7 @@
 </template>
 
 <script>
-import { getLayerList, getLayerByName } from '@/api/dataApi/previewlayer'
+import { getLayerList, getLayerByName } from '@/api/dataApi/layerApi'
 export default {
   props: ['dialogVisible'],
   data() {

+ 33 - 15
src/views/system/data/datastore/shapefile/index.vue

@@ -27,11 +27,12 @@
         </el-form-item>
         <div class="tofly-line">连接参数</div>
         <el-form-item label="Shapefile文件的位置">
-          <el-input size="small" v-model="form1.url" style="width:400px" placeholder="Shapefile文件的位置"></el-input>
-          <el-upload class="upload-demo" ref="upload" action="#" :limit="1" :show-file-list="false" :http-request="handleRequest"
-                     accept=".shp" style="display:inline-block">
-            <span class="link-btn">选择文件…</span>
-          </el-upload>
+          <el-input size="small" v-model="form1.url" style="width:450px" placeholder="Shapefile文件的位置"></el-input>
+          <!-- <el-upload class="upload-demo" ref="upload" action="#" :limit="1" :show-file-list="false" :http-request="handleRequest"
+                     accept=".zip" style="display:inline-block">
+            
+          </el-upload> -->
+          <span class="link-btn" @click="openDialog()">上传文件…</span>
         </el-form-item>
         <el-form-item label="DBF文件的字符集">
           <el-select size="small" v-model="form1.charset" placeholder="DBF文件的字符集" style="width:300px">
@@ -54,6 +55,7 @@
         <el-button size="small">取 消</el-button>
       </div>
     </div>
+    <filewindow :dialogVisible="dialogVisible" :type="type" fileType="shp" @select="selectFile"></filewindow>
   </div>
 </template>
 
@@ -62,9 +64,15 @@ import { getWorkspaceList } from '@/api/dataApi/workSpace'
 import characteSets from '@/views/system/common/characteSets'
 import { uploadFile } from '@/api/dataApi/fileApi'
 import { addDataStore } from '@/api/dataApi/dataStore'
+
+import filewindow from '@/views/system/common/filewindow'
 export default {
+  components: {
+    filewindow
+  },
   data() {
     return {
+      dialogVisible: false,
       input1: '',
       form1: {
         charset: 'ISO-8859-1',
@@ -73,6 +81,7 @@ export default {
         memoryMapped: false,
         cacheMemoryMaps: true
       },
+      type: "file", // 选择文件还是文件夹
       workspaces: [],
       characteSets: [],
       formRules: {
@@ -99,17 +108,20 @@ export default {
       })
     },
     /**
-     * 上传shpfile文件
+     * 打开文件选择器
      */
-    handleRequest(fileobj) {
-      console.log(fileobj.file)
-      let param = new FormData();
-      param.append('file', fileobj.file)
-      uploadFile(param).then(res => {
-        console.log("文件上传成功", res)
-        this.form1.url = 'file:' + res.result + '/' + fileobj.file.name
-        this.$refs.upload.clearFiles(); //上传成功之后清除历史记录
-      })
+    openDialog() {
+      this.type = "file"
+      this.dialogVisible = true
+    },
+    /**
+     * 选择shpfile文件
+     */
+    selectFile(path) {
+      this.dialogVisible = false;
+      if (path) {
+        this.form1.url = path
+      }
     },
     /**
      * 提交
@@ -129,6 +141,12 @@ export default {
           else {
             addDataStore(param).then(res => {
               this.$message.success("添加数据存储成功")
+              this.$router.push({
+                path: '/layers/configurelayer/addLayer',
+                params: {
+                  store: this.form1.workSpaceName + ":" + this.form1.name
+                }
+              })
             })
           }
         } else {

+ 1 - 1
src/views/system/data/layergroup/configuregrouplayer/index.vue

@@ -95,7 +95,7 @@
 </template>
 
 <script>
-import { getLayerList, getLayerByName } from '@/api/dataApi/previewlayer'
+import { getLayerList, getLayerByName } from '@/api/dataApi/layerApi'
 
 import selectLayer from '@/views/system/common/selectLayer'
 export default {

+ 1 - 1
src/views/system/data/layergroup/index.vue

@@ -36,7 +36,7 @@
 </template>
 
 <script>
-import { getLayerList, getLayerByName } from '@/api/dataApi/previewlayer'
+import { getLayerList, getLayerByName } from '@/api/dataApi/layerApi'
 import { getLayerGroupList } from '@/api/dataApi/layergroup'
 export default {
   data() {

+ 29 - 12
src/views/system/data/layers/configurelayer/index.vue

@@ -7,24 +7,25 @@
     <div class="tofly-body">
       <div class="tofly-nav">
         添加图层
-        <el-select v-model="value" placeholder="请选择" size="small" clearable filterable @change="selectChange"
+        <el-select v-model="dataStore" placeholder="请选择" size="small" clearable filterable @change="selectChange"
                    style="width:230px;margin-left:10px">
           <el-option v-for="(item,index) in dataStoreOptions" :key="index" :label="item.workspace.name+':'+item.name"
-                     :value="item.featureTypes"></el-option>
+                     :value="item.workspace.name+':'+item.name"></el-option>
         </el-select>
         <el-input v-show="show" placeholder="请输入标题关键字" size="small" prefix-icon="el-icon-search" v-model="input1" clearable
                   @clear="searchByName" @keyup.enter.native="searchByName" style="width:230px;float:right;"></el-input>
       </div>
-      <el-table v-show="show" class="tofly-table" :data="tableData" style="width: 100%">
+      <el-table v-show="show" class="tofly-table" stripe :data="tableData" style="width: 100%">
         <el-table-column label="已发布?">
           <template slot-scope="scope">
-            <span></span>
+            <span v-if="scope.row.status=='true'" class="iconfont icon-gou" style="color:#67C23A;font-size:12px"></span>
           </template>
         </el-table-column>
         <el-table-column prop="name" label="图层"> </el-table-column>
         <el-table-column label="发布">
           <template slot-scope="scope">
-            <el-button type="text">发 布</el-button>
+            <span class="link-btn" v-if="scope.row.status=='true'" type="text" @click="publishLayer(scope.row)">再发布</span>
+            <span class="link-btn" v-else-if="scope.row.status=='false'" type="text" @click="publishLayer(scope.row)">发布</span>
           </template>
         </el-table-column>
       </el-table>
@@ -39,11 +40,12 @@
 
 <script>
 import { getDataStoreList, getLayerListByDataStore } from '@/api/dataApi/dataStore'
+import { publishLayer } from '@/api/dataApi/layerApi'
 export default {
   data() {
     return {
       show: false,
-      value: '',
+      dataStore: '',
       dataStoreOptions: [],
       input1: '',
       pagination: {
@@ -78,10 +80,8 @@ export default {
         return
       }
       this.show = true
-      getLayerListByDataStore({ featureJsonUrl: val }).then(res => {
-        const result = res.result.map(item => {
-          return item.featureType ? item.featureType : item.coverage
-        })
+      getLayerListByDataStore(val).then(res => {
+        const result = res.result
         this.resultsData = this.$golab.getResultsData(result, this.pagination.pagesize) // 分页
         this.tempData = this.resultsData
         this.pagination.total = this.tempData.length != 0 ?
@@ -98,8 +98,7 @@ export default {
         this.resultsData
           .reduce((a, b) => { return a.concat(b) })
           .filter(item => {
-            const layerName = item.namespace.name + ':' + item.name
-            return layerName.includes(this.input1)
+            return item.name.includes(this.input1)
           }) : []
       this.tempData = this.$golab.getResultsData(list, this.pagination.pagesize) // 分页
       this.pagination.total = this.tempData.length != 0 ?
@@ -112,6 +111,24 @@ export default {
      */
     handleCurrentChange(current) {
       this.tableData = this.tempData[current - 1]
+    },
+    /**
+     * 图层发布
+     */
+    publishLayer(featureType) {
+      if (featureType.hasOwnProperty("href")) {
+
+      } else {
+        // workSpace:工作空间、storeName:数据管理、datasetName:要发布的数据集名称
+        let data = {
+          workSpace: this.dataStore.split(':')[0],
+          storeName: this.dataStore.split(':')[1],
+          datasetName: featureType.name
+        }
+        publishLayer(data).then(res => {
+          console.log("分布结果", res)
+        })
+      }
     }
   }
 }

+ 62 - 27
src/views/system/data/layers/index.vue

@@ -30,49 +30,46 @@
         <el-table-column prop="srs" label="坐标系"></el-table-column>
       </el-table>
       <div class="tofly-pagination">
-        <el-pagination small :current-page="1" :page-size="20" layout="total, prev, pager, next, jumper" :total="400">
+        <el-pagination small :current-page="pagination.current" :page-size="pagination.pagesize" @current-change="handleCurrentChange"
+                       layout="total, prev, pager, next" :total="pagination.total">
         </el-pagination>
       </div>
     </div>
-
-    <!-- 选择数据源类型 -->
-    <el-dialog custom-class="tofly-dialog" title="新建数据源" :visible.sync="dialogVisible" width="40%" :modal-append-to-body="false" :modal="true">
-      <div class="dialog-body">
-        <div v-for="(item,index) in datasouce" :key="index">
-          <p class="data-souce-type">{{item.name}}</p>
-          <ul>
-            <li v-for="(souceType,n) in item.list" :key="n">
-              <span class="link-btn" @click="adddatasource(souceType)">{{souceType.name}}</span>
-              <span>{{souceType.description}}</span>
-            </li>
-          </ul>
-        </div>
-      </div>
-    </el-dialog>
   </div>
 </template>
 
 <script>
 import datasouce from '@/views/system/data/datastore/datasouce'
+
+import { getLayerList } from '@/api/dataApi/layerApi'
 export default {
   data() {
     return {
       datasouce: datasouce,
       dialogVisible: false,
-      tableData: []
+      input1: '',
+      pagination: {
+        pagesize: 15,
+        total: 0,
+        current: 1
+      },
+      resultsData: [],//后台数据
+      tempData: [], // 暂存数据
+      tableData: [] // 表格数据
     }
   },
   mounted() {
-    for (let index = 0; index < 10; index++) {
-      this.tableData.push({
-        dataType: '',
-        workspace: 'test' + index,
-        name: 'test' + index,
-        type: index % 3?'Shapefile':'GeoPackage',
-        enabled: index != 0 && index % 3 == 0 ? true : false,
-        srs:'EPSG:4326'
-      })
-    }
+    this.getLayerList()
+    // for (let index = 0; index < 10; index++) {
+    //   this.tableData.push({
+    //     dataType: '',
+    //     workspace: 'test' + index,
+    //     name: 'test' + index,
+    //     type: index % 3 ? 'Shapefile' : 'GeoPackage',
+    //     enabled: index != 0 && index % 3 == 0 ? true : false,
+    //     srs: 'EPSG:4326'
+    //   })
+    // }
   },
   methods: {
     /**
@@ -106,6 +103,44 @@ export default {
         });
       });
     },
+    /**
+     * 关键字搜索,回车事件
+     */
+    searchByName() {
+      const list = this.resultsData.length != 0 ?
+        this.resultsData
+          .reduce((a, b) => { return a.concat(b) })
+          .filter(item => {
+            const layerName = item.namespace.name + ':' + item.name
+            return layerName.includes(this.input1)
+          }) : []
+      this.tempData = this.$golab.getResultsData(list, this.pagination.pagesize) // 分页
+      this.pagination.total = this.tempData.length != 0 ?
+        this.tempData.reduce((a, b) => { return a.concat(b) }).length : 0 // 获取结果数量
+      this.pagination.current = 1
+      this.tableData = this.tempData[0]
+    },
+    /**
+     * 切换当前页
+     */
+    handleCurrentChange(current) {
+      this.tableData = this.tempData[current - 1]
+    },
+    /**
+     * 获取图层列表
+     */
+    getLayerList() {
+      getLayerList().then(res => {
+        const result = res.result.map(item => {
+          return item.featureType ? item.featureType : item.coverage
+        })
+        this.resultsData = this.$golab.getResultsData(result, this.pagination.pagesize) // 分页
+        this.tempData = this.resultsData
+        this.pagination.total = this.tempData.length != 0 ?
+          this.tempData.reduce((a, b) => { return a.concat(b) }).length : 0 // 获取结果数量
+        this.tableData = this.tempData[0] // 默认第一页
+      })
+    },
   }
 }
 </script>

+ 2 - 1
src/views/system/data/previewlayer/index.vue

@@ -37,7 +37,7 @@
 </template>
 
 <script>
-import { getLayerList, getLayerByName } from '@/api/dataApi/previewlayer'
+import { getLayerList, getLayerByName } from '@/api/dataApi/layerApi'
 export default {
   data() {
     return {
@@ -98,6 +98,7 @@ export default {
      * 通过openlayers预览图层
      */
     previewLayerByOl(layer) {
+      console.log("-----:::", layer)
       const unit = layer.nativeCRS['@class'] == 'projected' ? 'm' : 'degrees'
       const srs = layer.srs
       const workspace = layer.namespace.name