Ver código fonte

信用报告模版完成以及推进

nahida 1 ano atrás
pai
commit
509494d64f

+ 134 - 52
src/components/CreditReport/index.vue

@@ -1,23 +1,45 @@
 <script setup>
 import html2canvas from 'html2canvas';
-import { jsPDF } from 'jspdf';
+import {jsPDF} from 'jspdf';
+import {ElLoading} from "element-plus";
+import request from "@/utils/request.js";
+
+const props = defineProps({
+  creditCode: String,
+});
 
 const printContent = async () => {
+  const loading = ElLoading.service({
+    lock: true,
+    text: '处理中',
+    background: 'rgba(0, 0, 0, 0.7)',
+  })
+  //每当加上下一个元素后如果内容超过了1188px则填充空白的div直到满足1188px
+  const e = document.querySelectorAll(".page .page-content");
+  let t = 0;
+  for (let j = 0; j < e.length; j++) {
+    t += e[j].scrollHeight;
+    if (j <= 1) continue;
+    if (t > 1188) {
+      const d = document.createElement("div");
+      d.classList.add("s");
+      d.style.height = 1188 - (t - e[j].scrollHeight) + 'px';
+      e[j - 1].appendChild(d);
+      t = e[j].scrollHeight;
+    }
+  }
   const elements = document.querySelectorAll('.page');
-
-  // 创建 jsPDF 实例
   const pdf = new jsPDF('p', 'mm', 'a4');
 
   const pdfWidth = pdf.internal.pageSize.getWidth();
   const pdfHeight = pdf.internal.pageSize.getHeight();
+  console.log(pdfHeight);
   for (let i = 0; i < elements.length; i++) {
     const element = elements[i];
-
     // 使用 html2canvas 将 HTML 元素截图
     const canvas = await html2canvas(element, {
       scale: 2, // 提高截图质量
     });
-
     // 将 canvas 转换为图片数据 URL
     const imgData = canvas.toDataURL('image/png');
     // 计算图片在 PDF 中的位置
@@ -28,7 +50,7 @@ const printContent = async () => {
       pdf.addPage();
     }
     pdf.addImage(imgData, 'PNG', 0, 0, pdfWidth, pageHeight);
-    if(canvas.height/2 >1188){
+    if (canvas.height / 2 > 1188) {
       //如果高度超过一页,则分页
       //将canvas对象分为(element.scrollHeight / 1188)份
       //每份高度1188
@@ -38,49 +60,47 @@ const printContent = async () => {
         const canvas2 = await html2canvas(element, {
           scale: 2, // 提高截图质量
         });
-        // console.log(canvas2);
         //将截取的图片转成图片数据 URL
         const imgData2 = canvas2.toDataURL('image/png');
         //添加图片到 PDF
         pdf.addPage();
-        console.log(pageHeight);
-        pdf.addImage(imgData2, 'PNG', 0, -297*j, pdfWidth, pageHeight);
+        pdf.addImage(imgData2, 'PNG', 0, -297 * j, pdfWidth, pageHeight);
       }
     }
   }
 
-  // 保存 PDF
+// 保存 PDF
   pdf.save('report.pdf');
+  const allS = document.querySelectorAll('.s');
+  // 删除所有s元素
+  allS.forEach((e) => e.remove());
+  loading.close();
 }
-
-const tableData = [
-  {
-    position: '法定代表人',
-    name: '性与暴力',
-    phone: '12345678910',
-  },
-  {
-    position: '董事长',
-    name: '性与暴力',
-    phone: '12345678910',
-  },
-  {
-    position: '总经理',
-    name: '性与暴力',
-    phone: '12345678910',
-  },
-  {
-    position: '财务负责人',
-    name: '性与暴力',
-    phone: '12345678910',
+const basicData = ref({
+  a:[],
+  b:{
+    addr:null,
+    site:null,
+    weixin:null
   },
-  {
-    position: '信用专干',
-    name: '性与暴力',
-    phone: '12345678910',
-  },
-]
-const columnData = [
+  c:{
+    enterpriseName:null,
+    uniCode:null,
+    addr:null,
+    registeredCapital:null,
+    paidInCapital:null,
+    legalRepresentative:null,
+    companyType:null,
+    establishedTime:null,
+    businessTerm:null,
+    sector:null,
+    industryCode:null,
+    compantStatus:null,
+    registrationAuthority:null,
+    businessScope:null
+  }
+});
+const CD1 = [
   {
     label: '序号',
     prop: 'id',
@@ -102,13 +122,32 @@ const columnData = [
     width: '150'
   }
 ]
+const getReport = async ()=>{
+  const res = await request.get('/report/queryByUniCode',{
+    params:{
+      uniCode:props.creditCode
+    }
+  });
+  basicData.value = res.data;
+  console.log(basicData.value);
+}
+const init = ()=>{
+  getReport()
+}
+init()
 </script>
 
 <template>
-  <el-row class="report-container w-840px w-100% h-1188px overflow-auto">
-    <el-col :span="24" class="page w-840px h-1188px border p-20px pb-0  font-songti  border-black border-solid border-7px justify-between">
-      <div class="w-full text-center h-150px line-height-150px mt-150px tracking-widest text-black font-black text-44px">性与暴力企业综合信用报告</div>
-      <div class="w-full text-center h-150px line-height-150px mt-30px tracking-wider font-500 text-black text-30px">湖南性与暴力有限公司</div>
+  <el-row class="report-container w-840px w-100% h-full overflow-auto">
+    <el-col :span="24"
+            class="page w-840px h-1188px border p-20px pb-0  font-songti  border-black border-solid border-7px justify-between">
+      <div
+          class="w-full text-center h-150px line-height-150px mt-150px tracking-widest text-black font-black text-44px">
+        性与暴力企业综合信用报告
+      </div>
+      <div class="w-full text-center h-150px line-height-150px mt-30px tracking-wider font-500 text-black text-30px">
+        湖南性与暴力有限公司
+      </div>
       <div class="w-full text-center h-100px mt-100px tracking-wider font-900 text-24px text-black">
         <div class="line-height-50px text-left pl-250px">企业信用等级: ZZZ级</div>
         <div class="line-height-50px text-left pl-250px">信用评分情况: 0分</div>
@@ -122,24 +161,67 @@ const columnData = [
       </div>
     </el-col>
     <el-col :span="24" class="page w-840px text-black p-20px tracking-widest font-songti">
-      <div v-for="q in 5"><!--测试-->
-        <div class="text-center text-30px mt-30px font-800">一、企业基本信息{{q}}</div>
+      <div class="page-content pt-30px">
+        <div class="text-center text-30px font-800">一、企业基本信息</div>
         <div class="w-80% mx-a line-height-50px text-24px text-black">1、联系信息</div>
-        <div class="w-80% mx-a line-height-24px text-16px">1.1&nbsp;实际经营地址:<span class="underline">麓谷诈骗园区</span></div>
-        <div class="w-80% mx-a line-height-24px text-16px">1.2&nbsp;企业网址:<span class="underline">www.zhapian.com</span>&nbsp;微信公众号:<span class="underline">割肾之家</span></div>
+        <div class="w-80% mx-a line-height-24px text-16px">1.1&nbsp;实际经营地址:<span
+            class="underline">{{basicData.b.addr}}</span></div>
+        <div class="w-80% mx-a line-height-24px text-16px">1.2&nbsp;企业网址:<span
+            class="underline">{{basicData.b.site}}</span>&nbsp;微信公众号:<span class="underline">{{basicData.b.weixin}}</span></div>
         <div class="w-80% mx-a line-height-24px text-16px">1.3&nbsp;主要人物联系信息</div>
         <div class="w-80% mx-a grid grid-cols-4 border-black border-solid border-1px">
-          <div v-for="(item, index) in columnData" :key="index" class="border-black border-solid border-1px text-center bg-gray">{{item.label}}</div>
+          <div v-for="(item, index) in CD1" :key="index"
+               class="border-black border-solid border-1px text-center bg-gray h-25px"><span
+              class="line-height-25px">{{ item.label }}</span>
+          </div>
         </div>
         <div class="w-80% mx-a">
-          <div v-for="(item, index) in tableData" :key="index" class="grid grid-cols-4 border-black border-solid border-1px text-center">
-            <div class="border-black border-b-solid border-l-solid border-r-solid border-0.1px">{{index + 1}}</div>
-            <div class="border-black border-b-solid border-l-solid border-r-solid border-0.1px">{{item.position}}</div>
-            <div class="border-black border-b-solid border-l-solid border-r-solid border-0.1px">{{item.name}}</div>
-            <div class="border-black border-b-solid border-l-solid border-r-solid border-0.1px">{{item.phone}}</div>
+          <div v-for="(item, index) in basicData.a" :key="index"
+               class="grid grid-cols-4 border-black border-solid border-1px text-center">
+            <div class="border-black border-b-solid border-l-solid border-r-solid border-0.1px h-25px"><span
+                class="line-height-25px">{{ index + 1 }}</span></div>
+            <div class="border-black border-b-solid border-l-solid border-r-solid border-0.1px h-25px"><span
+                class="line-height-25px">{{ item.position }}</span></div>
+            <div class="border-black border-b-solid border-l-solid border-r-solid border-0.1px h-25px"><span
+                class="line-height-25px">{{ item.name }}</span></div>
+            <div class="border-black border-b-solid border-l-solid border-r-solid border-0.1px h-25px"><span
+                class="line-height-25px">{{ item.phone }}</span></div>
           </div>
         </div>
       </div>
+      <div class="page-content pt-30px">
+        <div class="w-80% mx-a line-height-50px text-24px text-black">2、工商注册信息</div>
+        <div class="w-80% mx-a grid grid-cols-4 border-black border-solid border-1px">
+          <div class="line-height-25px border-black border-solid border-1px text-center bg-gray">企业名称</div>
+          <div class="line-height-25px border-black border-solid border-1px text-center">{{basicData.c.enterpriseName}}</div>
+          <div class="line-height-25px border-black border-solid border-1px text-center bg-gray">统一社会信用代码</div>
+          <div class="line-height-25px border-black border-solid border-1px text-center">{{basicData.c.uniCode}}</div>
+          <div class="line-height-25px border-black border-solid border-1px text-center bg-gray">住所</div>
+          <div class="line-height-25px border-black border-solid border-1px text-center col-span-3">{{basicData.c.addr}}</div>
+          <div class="line-height-25px border-black border-solid border-1px text-center bg-gray">注册资本</div>
+          <div class="line-height-25px border-black border-solid border-1px text-center">{{basicData.c.registeredCapital}}</div>
+          <div class="line-height-25px border-black border-solid border-1px text-center bg-gray">实收资本</div>
+          <div class="line-height-25px border-black border-solid border-1px text-center">{{basicData.c.paidInCapital}}</div>
+          <div class="line-height-25px border-black border-solid border-1px text-center bg-gray">法定代表人姓名</div>
+          <div class="line-height-25px border-black border-solid border-1px text-center">{{basicData.c.legalRepresentative}}</div>
+          <div class="line-height-25px border-black border-solid border-1px text-center bg-gray">公司类型</div>
+          <div class="line-height-25px border-black border-solid border-1px text-center">{{basicData.c.companyType}}</div>
+          <div class="line-height-25px border-black border-solid border-1px text-center bg-gray">成立日期</div>
+          <div class="line-height-25px border-black border-solid border-1px text-center">{{basicData.c.establishedTime}}</div>
+          <div class="line-height-25px border-black border-solid border-1px text-center bg-gray">营业期限</div>
+          <div class="line-height-25px border-black border-solid border-1px text-center">{{basicData.c.businessTerm}}</div>
+          <div class="line-height-25px border-black border-solid border-1px text-center bg-gray">所属行业</div>
+          <div class="line-height-25px border-black border-solid border-1px text-center">{{basicData.c.sector}}</div>
+          <div class="line-height-25px border-black border-solid border-1px text-center bg-gray">行业代码</div>
+          <div class="line-height-25px border-black border-solid border-1px text-center">{{basicData.c.industryCode}}</div>
+          <div class="line-height-25px border-black border-solid border-1px text-center bg-gray">企业状态</div>
+          <div class="line-height-25px border-black border-solid border-1px text-center">{{basicData.c.compantStatus}}</div>
+          <div class="line-height-25px border-black border-solid border-1px text-center bg-gray">登记机关</div>
+          <div class="line-height-25px border-black border-solid border-1px text-center">{{basicData.c.registrationAuthority}}</div>
+          <div class="line-height-25px border-black border-solid border-1px text-center bg-gray">经营范围</div>
+          <div class="line-height-25px border-black border-solid border-1px text-center col-span-3">{{basicData.c.businessScope}}</div>
+        </div>
+      </div>
     </el-col>
     <el-button @click="printContent">导出 PDF</el-button>
   </el-row>

+ 30 - 0
src/views/basicData/xcrAnnualReportBaseInfo/index.vue

@@ -93,6 +93,24 @@
                   <span>{{ parseTime(scope.row.sExtDatatime, '{y}-{m}-{d}') }}</span>
                 </template>
               </el-table-column>
+              <el-table-column label="数据更新时间戳" align="center" prop="sExtTimestamp" width="180">
+                <template #default="scope">
+                  <span>{{ parseTime(scope.row.sExtTimestamp, '{y}-{m}-{d}') }}</span>
+                </template>
+              </el-table-column>
+                  <el-table-column label="数据来源" align="center" prop="sExtFromnode" :show-overflow-tooltip='true' width="150"/>
+              <el-table-column label="插入时间" align="center" prop="iTime" width="180">
+                <template #default="scope">
+                  <span>{{ parseTime(scope.row.iTime, '{y}-{m}-{d}') }}</span>
+                </template>
+              </el-table-column>
+                  <el-table-column label="id" align="center" prop="ID" :show-overflow-tooltip='true' width="150"/>
+                  <el-table-column label="修改标识" align="center" prop="modFlag" :show-overflow-tooltip='true' width="150"/>
+              <el-table-column label="修改时间" align="center" prop="upTime" width="180">
+                <template #default="scope">
+                  <span>{{ parseTime(scope.row.upTime, '{y}-{m}-{d}') }}</span>
+                </template>
+              </el-table-column>
     </el-table>
 
     <div style="position: fixed;bottom: 20px;right: 10px;">
@@ -246,6 +264,12 @@
                         LASTUPDATETIME: null,
                         ENTCHEYEAR: null,
                         sExtDatatime: null,
+                        sExtTimestamp: null,
+                        sExtFromnode: null,
+                        iTime: null,
+                        ID: null,
+                        modFlag: null,
+                        upTime: null,
                         uniCode: ''
     },
     rules: {
@@ -320,6 +344,12 @@
                         LASTUPDATETIME: null,
                         ENTCHEYEAR: null,
                         sExtDatatime: null,
+                        sExtTimestamp: null,
+                        sExtFromnode: null,
+                        iTime: null,
+                        ID: null,
+                        modFlag: null,
+                        upTime: null,
                         uniCode: ''
     };
     proxy.resetForm("xcrAnnualReportBaseInfoRef");

+ 20 - 2
src/views/basicData/xcrEnterpriseAnnualReportShareholder/index.vue

@@ -48,14 +48,25 @@
                   <span>{{ parseTime(scope.row.ACCONDATE, '{y}-{m}-{d}') }}</span>
                 </template>
               </el-table-column>
-                  <el-table-column label="实缴出资方式" align="center" prop="ACCONFORM" :show-overflow-tooltip='true' width="150"/>
+                  <el-table-column label="实缴出资日期" align="center" prop="ACCONFORM" :show-overflow-tooltip='true' width="150"/>
                   <el-table-column label="实缴出资方式" align="center" prop="acconformCn" :show-overflow-tooltip='true' width="150"/>
-                  <el-table-column label="企业年报年份" align="center" prop="ENTCHEYEAR" :show-overflow-tooltip='true' width="150"/>
+                  <el-table-column label="年份" align="center" prop="ENTCHEYEAR" :show-overflow-tooltip='true' width="150"/>
               <el-table-column label="数据更新时间" align="center" prop="sExtDatatime" width="180">
                 <template #default="scope">
                   <span>{{ parseTime(scope.row.sExtDatatime, '{y}-{m}-{d}') }}</span>
                 </template>
               </el-table-column>
+              <el-table-column label="数据更新时间戳" align="center" prop="sExtTimestamp" width="180">
+                <template #default="scope">
+                  <span>{{ parseTime(scope.row.sExtTimestamp, '{y}-{m}-{d}') }}</span>
+                </template>
+              </el-table-column>
+              <el-table-column label="数据插入时间" align="center" prop="iTime" width="180">
+                <template #default="scope">
+                  <span>{{ parseTime(scope.row.iTime, '{y}-{m}-{d}') }}</span>
+                </template>
+              </el-table-column>
+                  <el-table-column label="数据来源" align="center" prop="sExtFromnode" :show-overflow-tooltip='true' width="150"/>
     </el-table>
 
     <div style="position: fixed;bottom: 20px;right: 10px;">
@@ -103,6 +114,7 @@
   import {getToken} from "@/utils/auth";
   import {ElMessage} from "element-plus";
   import {likeQueryMethod} from "@/utils/likeQueryMethod";
+  import {parseTime} from "../../../utils/ruoyi.js";
 
   const {proxy} = getCurrentInstance();
 
@@ -172,6 +184,9 @@
                         acconformCn: null,
                         ENTCHEYEAR: null,
                         sExtDatatime: null,
+                        sExtTimestamp: null,
+                        iTime: null,
+                        sExtFromnode: null,
                         uniCode: ''
     },
     rules: {
@@ -209,6 +224,9 @@
                         acconformCn: null,
                         ENTCHEYEAR: null,
                         sExtDatatime: null,
+                        sExtTimestamp: null,
+                        iTime: null,
+                        sExtFromnode: null,
                         uniCode: ''
     };
     proxy.resetForm("xcrEnterpriseAnnualReportShareholderRef");

+ 17 - 15
src/views/test/index.vue

@@ -5,25 +5,27 @@ const dialogVisible = ref(false);
 </script>
 
 <template>
-  <el-row>
-    <el-col :span="24">
-      <el-button type="primary" @click="dialogVisible = true" >下载性与暴力报告</el-button>
-    </el-col>
-  </el-row>
-  <el-dialog v-model="dialogVisible" width="860px">
-    <template #title>
-      <span class="dialog-title">下载与暴力报告11</span>
-    </template>
-    <template #default>
-      <CreditReport />
-    </template>
-    <template #footer>
+  <div>
+    <el-row>
+      <el-col :span="24">
+        <el-button type="primary" @click="dialogVisible = true" >下载性与暴力报告</el-button>
+      </el-col>
+    </el-row>
+    <el-dialog v-model="dialogVisible" width="860px">
+      <template #header>
+        <span class="dialog-title">下载与暴力报告11</span>
+      </template>
+      <template #default>
+        <CreditReport :credit-code="'91431227MA4LY5GC2Y'" />
+      </template>
+      <template #footer>
       <span class="dialog-footer">
         <el-button @click="dialogVisible = false">取 消</el-button>
         <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
       </span>
-    </template>
-  </el-dialog>
+      </template>
+    </el-dialog>
+  </div>
 </template>
 
 <style scoped lang="scss">

+ 1 - 1
vite.config.js

@@ -31,7 +31,7 @@ export default defineConfig(({ mode, command }) => {
       proxy: {
         // https://cn.vitejs.dev/config/#server-proxy
         '/dev-api': {
-          target: 'http://192.168.110.235:8900/background',
+          target: 'http://192.168.110.13:8900/background',
           changeOrigin: true,
           rewrite: (p) => p.replace(/^\/dev-api/, '')
         }