Browse Source

20230313_sun两个大量的导出从前端导

15143018065 2 years ago
parent
commit
8ce4ab13b6

+ 7 - 8
ruoyi-modules/mz-business/src/main/java/com/ruoyi/business/controller/YljgKhJbxxController.java

@@ -117,21 +117,20 @@ public class YljgKhJbxxController extends BaseController
     @RequiresPermissions(value = {"business:rzjg:export", "search:rzjg:export"}, logical = Logical.OR)
     @Log(title = "养老机构_客户_基本信息", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
-    public void export(HttpServletResponse response, YljgKhJbxx yljgKhJbxx)
+    public AjaxResult export(YljgKhJbxx yljgKhJbxx)
     {
-        List<YljgKhJbxx> list = yljgKhJbxxService.selectBusinessYljgKhJbxxList(yljgKhJbxx);
-        ExcelUtil<YljgKhJbxx> util = new ExcelUtil<YljgKhJbxx>(YljgKhJbxx.class);
-        util.exportExcel(response, list, "养老机构_客户_基本信息数据");
+        return AjaxResult.success(yljgKhJbxxService.selectBusinessYljgKhJbxxList(yljgKhJbxx));
+//        List<YljgKhJbxx> list = yljgKhJbxxService.selectBusinessYljgKhJbxxList(yljgKhJbxx);
+//        ExcelUtil<YljgKhJbxx> util = new ExcelUtil<YljgKhJbxx>(YljgKhJbxx.class);
+//        util.exportExcel(response, list, "养老机构_客户_基本信息数据");
     }
 
     @RequiresPermissions(value = {"business:rzjg:export", "search:rzjg:export"}, logical = Logical.OR)
     @Log(title = "养老机构_客户_基本信息", businessType = BusinessType.EXPORT)
     @PostMapping("/sq/export")
-    public void sqExport(HttpServletResponse response, YljgKhJbxx yljgKhJbxx)
+    public AjaxResult sqExport(YljgKhJbxx yljgKhJbxx)
     {
-        List<YljgKhJbxx> list = yljgKhJbxxService.selectBusinessYljgKhJbxxSqList(yljgKhJbxx);
-        ExcelUtil<YljgKhJbxx> util = new ExcelUtil<YljgKhJbxx>(YljgKhJbxx.class);
-        util.exportExcel(response, list, "养老机构_客户_基本信息数据");
+        return AjaxResult.success(yljgKhJbxxService.selectBusinessYljgKhJbxxSqList(yljgKhJbxx));
     }
 
     /**

+ 10 - 15
ruoyi-modules/mz-organization-khgl/src/main/java/com/ruoyi/organization/service/impl/YljgKhJbxxServiceImpl.java

@@ -12,6 +12,7 @@ import com.ruoyi.common.core.web.domain.AjaxResult;
 import com.ruoyi.common.core.web.page.PageDomain;
 import com.ruoyi.common.core.web.page.TableDataInfo;
 import com.ruoyi.common.security.utils.SecurityUtils;
+import com.ruoyi.common.security.utils.SysDeptJlUtils;
 import com.ruoyi.organization.domain.*;
 import com.ruoyi.organization.mapper.YljgKhHtxxMapper;
 import com.ruoyi.organization.mapper.YljgKhJbxxMapper;
@@ -23,8 +24,7 @@ import com.ruoyi.system.api.enums.DataStatus;
 import com.ruoyi.system.api.enums.ResultStatus;
 import com.ruoyi.system.api.enums.WhetherStatus;
 import com.ruoyi.system.domain.SysDeptJl;
-;import com.ruoyi.system.mapper.SysDeptJlMapper;
-import com.ruoyi.common.security.utils.SysDeptJlUtils;
+import com.ruoyi.system.mapper.SysDeptJlMapper;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -39,6 +39,8 @@ import java.util.stream.Collectors;
 
 import static com.ruoyi.common.core.utils.DateUtils.YYYYMMDD;
 
+;
+
 /**
  * 养老机构_客户_基本信息Service业务层处理
  *
@@ -278,11 +280,11 @@ public class YljgKhJbxxServiceImpl implements IYljgKhJbxxService
     {
         List<YljgKhJbxx> res = yljgKhJbxxMapper.selectBusinessYljgKhJbxxList(yljgKhJbxx);
         res.forEach(r -> {
-            try {
-                r.setAge(DateUtils.getCurrentAge(DateUtils.dateTime(YYYYMMDD, r.getCsrq())) + "岁");
-            } catch (Exception e) {
-                r.setAge("0岁");
-            }
+//            try {
+//                r.setAge(DateUtils.getCurrentAge(DateUtils.dateTime(YYYYMMDD, r.getCsrq())) + "岁");
+//            } catch (Exception e) {
+//                r.setAge("0岁");
+//            }
             r.setXjdxzqy(SysDeptJlUtils.getDeptCache(r.getXzqhId()));
         });
         return res;
@@ -370,14 +372,7 @@ public class YljgKhJbxxServiceImpl implements IYljgKhJbxxService
     public List<YljgKhJbxx> selectBusinessYljgKhJbxxSqList(YljgKhJbxx yljgKhJbxx)
     {
         List<YljgKhJbxx> res = yljgKhJbxxMapper.selectBusinessYljgKhJbxxSqList(yljgKhJbxx);
-        res.forEach(r -> {
-            try {
-                r.setAge(DateUtils.getCurrentAge(DateUtils.dateTime(YYYYMMDD, r.getCsrq())) + "岁");
-            } catch (Exception e) {
-                r.setAge("0岁");
-            }
-            r.setXjdxzqy(SysDeptJlUtils.getDeptCache(r.getXzqhId()));
-        });
+        res.forEach(r -> r.setXjdxzqy(SysDeptJlUtils.getDeptCache(r.getXzqhId())));
         return res;
     }
 

+ 16 - 0
ruoyi-ui/src/api/search/xxcx/lrxx/rzjg.js

@@ -63,3 +63,19 @@ export function advancedListKhxxByJg(query) {
     params: query
   })
 }
+
+export function exportSqExcel(query) {
+  return request({
+    url: '/business/lrxxcx/sq/export',
+    method: 'post',
+    params: query
+  })
+}
+
+export function exportExcel(query) {
+  return request({
+    url: '/business/lrxxcx/export',
+    method: 'post',
+    params: query
+  })
+}

+ 58 - 13
ruoyi-ui/src/views/search/xxcx/lrxx/rzjg/index.vue

@@ -57,7 +57,7 @@
 
         <el-row :gutter="10" class="mb8">
           <el-col :span="1.5">
-            <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
+            <el-button type="warning" plain icon="el-icon-download" size="mini" @click="exportExcel"
               v-hasPermi="['business:rzjg:export']">导出
             </el-button>
           </el-col>
@@ -557,10 +557,11 @@
 </template>
 
 <script>
-import { getKhxxByJg, listChxxx, listJtxx, listKhxxByJg, advancedListKhxxByJg } from '@/api/search/xxcx/lrxx/rzjg'
+import { getKhxxByJg, listChxxx, listJtxx, listKhxxByJg, advancedListKhxxByJg, exportExcel } from '@/api/search/xxcx/lrxx/rzjg'
 import Treeselect from '@riophae/vue-treeselect'
 import { mapState } from 'vuex'
 import { decryptData_ECB, decryptRowData_ECB } from "@/api/tool/sm4";
+import { Loading } from 'element-ui';
 
 export default {
   name: 'Khjbxx',
@@ -584,7 +585,8 @@ export default {
     'CH029',
     'CH047',
     'CZ028',
-    'XZ114'
+    'XZ114',
+    "C0034",
   ],
   data() {
     return {
@@ -605,6 +607,7 @@ export default {
       // 显示高级查询
       showDrawer: false,
       editJtxxAndChxxx: true,
+      downloadLoadingInstance: null,
       // 总条数
       total: 0,
       jtxxTotal: 0,
@@ -694,6 +697,24 @@ export default {
         pageSize:10,
         createuserType:'01',
       },
+      // 导出数据
+	    excelData:{
+				keys:[
+					{ label: '姓名', prop: 'xm', width: '' },
+					{ label: '性别', prop: 'xb', width: '' },
+					{ label: '身份证件类型', prop: 'zjlx', width: '' },
+					{ label: '公民身份证号码', prop: 'zjhm', width: '' },
+					{ label: '民族', prop: 'mz', width: '' },
+					{ label: '国籍', prop: 'gj', width: '' },
+					{ label: '户籍类别', prop: 'hjlb', width: '' },
+					{ label: '婚姻状况', prop: 'hyzk', width: '' },
+          { label: '居住地行政区划', prop: 'xjdxzqy', width: '' },
+          { label: '居住地址', prop: 'xjd', width: '' },
+          { label: '身体能力评估等级', prop: 'nlpg', width: '' },
+          { label: '人员状态', prop: 'ryzt', width: '' },
+				],
+		    vales:[]
+	    },
       // 表单参数
       form: {},
       familyForm: {},
@@ -949,18 +970,42 @@ export default {
     rowYljgKhChxxxIndex({ row, rowIndex }) {
       row.index = rowIndex + 1
     },
-    /** 导出按钮操作 */
-    handleExport() {
-      this.download(
-        'business/lrxxcx/export',
-        {
-          ...this.queryParams
-        },
-        `入住养老机构老年人信息.xlsx`
-      )
+    // /** 导出按钮操作 */
+    // handleExport() {
+    //   this.download(
+    //     'business/lrxxcx/export',
+    //     {
+    //       ...this.queryParams
+    //     },
+    //     `入住养老机构老年人信息.xlsx`
+    //   )
+    // },
+    exportExcel() {
+      this.downloadLoadingInstance = Loading.service({ text: "正在下载数据,请稍候", spinner: "el-icon-loading", background: "rgba(0, 0, 0, 0.7)", })
+      exportExcel(this.queryParams).then((res) => {
+        res.data.map((item) => {
+          if (item) {
+            item = decryptData_ECB(item, ["xm", "zjhm", "xjd"], [1, 2, 4]);
+            item.xb = this.translateDict("C0007", item.xb)
+            item.zjlx = this.translateDict("C0015", item.zjlx)
+            item.mz = this.translateDict("C0009", item.mz)
+            item.gj = this.translateDict("XZ002", item.gj)
+            item.hjlb = this.translateDict("C0031", item.hjlb)
+            item.hyzk = this.translateDict("C0010", item.hyzk)
+            item.nlpg = this.translateDict("CZ036", item.nlpg)
+            item.ryzt = this.translateDict("C0034", item.ryzt)
+          }
+        });
+        console.log(res.data)
+        this.excelData.vales = res.data;
+        this.handleExport(this.excelData,'入住养老机构老年人')
+        this.downloadLoadingInstance.close();
+      }).catch((r) => {
+        this.$modal.msgError(r);
+        this.downloadLoadingInstance.close();
+      });
     },
     /**  */
-
     particulars(row) {
       this.dataDetails = {}
       getKhxxByJg(row.id).then((response) => {

+ 46 - 10
ruoyi-ui/src/views/search/xxcx/lrxx/sqfw/index.vue

@@ -45,7 +45,7 @@
 
         <el-row :gutter="10" class="mb8">
           <el-col :span="1.5">
-            <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
+            <el-button type="warning" plain icon="el-icon-download" size="mini" @click="exportExcel"
               v-hasPermi="['business:rzjg:export']">导出
             </el-button>
           </el-col>
@@ -539,8 +539,9 @@
 </template>
 
 <script>
-import { getKhxxByJg, listChxxx, listJtxx, listKhxxByJg, listKhxxBySqJg, advancedListKhxxBySqJg } from '@/api/search/xxcx/lrxx/rzjg'
+import { getKhxxByJg, listChxxx, listJtxx, listKhxxByJg, listKhxxBySqJg, advancedListKhxxBySqJg, exportSqExcel } from '@/api/search/xxcx/lrxx/rzjg'
 import Treeselect from "@riophae/vue-treeselect";
+import { Loading } from 'element-ui';
 import { mapGetters, mapState } from "vuex";
 import { decryptData_ECB, decryptRowData_ECB } from "@/api/tool/sm4";
 
@@ -566,6 +567,7 @@ export default {
     "CH029",
     "CH047",
     "CZ028",
+    "C0034",
   ],
   data() {
     return {
@@ -580,6 +582,7 @@ export default {
       single: true,
       // 非多个禁用
       multiple: true,
+      downloadLoadingInstance: null,
       expands: [],
       // 显示搜索条件
       showSearch: true,
@@ -670,6 +673,24 @@ export default {
         children: "children",
         label: "name"
       },
+      // 导出数据
+	    excelData:{
+				keys:[
+					{ label: '姓名', prop: 'xm', width: '' },
+					{ label: '性别', prop: 'xb', width: '' },
+					{ label: '身份证件类型', prop: 'zjlx', width: '' },
+					{ label: '公民身份证号码', prop: 'zjhm', width: '' },
+					{ label: '民族', prop: 'mz', width: '' },
+					{ label: '国籍', prop: 'gj', width: '' },
+					{ label: '户籍类别', prop: 'hjlb', width: '' },
+					{ label: '婚姻状况', prop: 'hyzk', width: '' },
+          { label: '居住地行政区划', prop: 'xjdxzqy', width: '' },
+          { label: '居住地址', prop: 'xjd', width: '' },
+          { label: '身体能力评估等级', prop: 'nlpg', width: '' },
+          { label: '人员状态', prop: 'ryzt', width: '' },
+				],
+		    vales:[]
+	    },
       // 表单参数
       form: {},
       familyForm: {},
@@ -916,14 +937,29 @@ export default {
       row.index = rowIndex + 1;
     },
     /** 导出按钮操作 */
-    handleExport() {
-      this.download(
-        "business/lrxxcx/sq/export",
-        {
-          ...this.queryParams,
-        },
-        `享受社区服务老年人信息.xlsx`
-      );
+    exportExcel() {
+      this.downloadLoadingInstance = Loading.service({ text: "正在下载数据,请稍候", spinner: "el-icon-loading", background: "rgba(0, 0, 0, 0.7)", })
+      exportSqExcel(this.queryParams).then((res) => {
+        res.data.map((item) => {
+          if (item) {
+            item = decryptData_ECB(item, ["xm", "zjhm", "xjd"], [1, 2, 4]);
+            item.xb = this.translateDict("C0007", item.xb)
+            item.zjlx = this.translateDict("C0015", item.zjlx)
+            item.mz = this.translateDict("C0009", item.mz)
+            item.gj = this.translateDict("XZ002", item.gj)
+            item.hjlb = this.translateDict("C0031", item.hjlb)
+            item.hyzk = this.translateDict("C0010", item.hyzk)
+            item.nlpg = this.translateDict("CZ036", item.nlpg)
+            item.ryzt = this.translateDict("C0034", item.ryzt)
+          }
+        });
+        this.excelData.vales = res.data;
+        this.handleExport(this.excelData,'享受社区服务老年人')
+        this.downloadLoadingInstance.close();
+      }).catch((r) => {
+        this.$modal.msgError(r);
+        this.downloadLoadingInstance.close();
+      });
     },
     /**  */