Bladeren bron

用户物品导出

wxxwjef 2 jaren geleden
bovenliggende
commit
55dd565e92

+ 4 - 4
api/src/main/java/com/wx/application/adapter/controller/GorseController.java

@@ -119,13 +119,13 @@ public class GorseController extends BaseController {
     }
 
     @PutMapping(value = "/bulk/{type}")
-    public ResponseData bulkUser(@RequestParam Map<String, String> data, @RequestParam("file") MultipartFile file, @PathVariable("type") String type) throws Exception {
+    public ResponseData bulkUserOrItem(@RequestParam Map<String, String> data, @RequestParam("file") MultipartFile file, @PathVariable("type") String type) throws Exception {
         return success(gorseService.bulkUserOrItem(data, file, type));
     }
 
-    @GetMapping(value = "/get_bulk_user")
-    public ResponseData getBulkUser() throws Exception {
-        return success(gorseService.getBulkUser());
+    @GetMapping(value = "/get_bulk/{type}")
+    public String getBulkUserOrItem(@PathVariable("type") String type) throws Exception {
+        return gorseService.getBulkUserOrItem(type);
     }
 
 

+ 5 - 2
api/src/main/java/com/wx/application/gorse4j/GorseService.java

@@ -127,8 +127,11 @@ public class GorseService {
     }
 
 
-    public File getBulkUser() throws IOException {
-        return this.request("GET", this.endpoint + "/api/bulk/users", null, File.class);
+    /**
+     * 导出用户或物品信息
+     */
+    public String getBulkUserOrItem(String type) {
+        return "redirect:" + this.endpoint + "/api/bulk/" + type;
     }
 
     public JSONObject sendPostFormData(String url, MultipartEntityBuilder builder) throws IOException {

+ 5 - 1
web/src/components/menus/EntrysManage.vue

@@ -19,6 +19,7 @@
       </div>
       <div style="margin: 0px 0 20px 0">
         <el-button type="primary" @click="createRow()" icon="el-icon-plus">添 加</el-button>
+        <el-button type="primary" @click="downloadItem()" icon="el-icon-download">导出条目</el-button>
         <el-button type="primary" @click="showImportItemPage()" icon="el-icon-upload2">导入条目</el-button>
       </div>
       <div>
@@ -144,7 +145,7 @@
 </template>
 
 <script>
-import request from '@/utils/request';
+import request, {getBaseUrl} from '@/utils/request';
 
 var _this;
 export default {
@@ -210,6 +211,9 @@ export default {
       _this.qo.pageNo = val;
       _this.queryData();
     },
+    downloadItem() {
+      window.open(getBaseUrl() + '/bulk/get_bulk/items');
+    },
     similarItem(item) {
       _this.$router.push({
         path: "similarItem", query: {

+ 2 - 6
web/src/components/menus/UserManage.vue

@@ -81,7 +81,7 @@
 </template>
 
 <script>
-import request from '@/utils/request';
+import request, {getBaseUrl} from '@/utils/request';
 
 var _this;
 export default {
@@ -139,11 +139,7 @@ export default {
       });
     },
     downloadUser() {
-      request({
-        url: '/gorse/get_bulk_user',
-        method: 'get'
-      }).then(res => {
-      });
+      window.open(getBaseUrl() + '/bulk/get_bulk/users');
     },
     linkUser(item) {
       _this.$router.push({