Browse Source

UPDATE API

zhaobao 1 year ago
parent
commit
c215a30f62

+ 1 - 0
package.json

@@ -8,6 +8,7 @@
     "lint": "vue-cli-service lint"
   },
   "dependencies": {
+    "axios": "^1.6.8",
     "core-js": "^3.8.3",
     "element-ui": "^2.15.6",
     "js-cookie": "^3.0.5",

+ 45 - 0
src/api/index.js

@@ -0,0 +1,45 @@
+import request from '@/utils/request'
+
+// 1、获取所有上报公司信息
+export function getAllReportcompanys() {
+  return request({
+    url: '/report2plat/GetAllReportcompanys'
+  })
+}
+
+// 2、上报安全风险单元数据
+// 参数:Long cId;//上报企业的id,在本系统中的
+export function getReceiveUnitListByList(data) {
+  return request({
+    url: '/report2plat/receiveUnitList',
+    method: 'GET',
+    params: data
+  })
+}
+// 3、上报安全风险事件数据
+// 参数:Long cId;//上报企业的id,在本系统中的
+export function getReceiveEventListByList(data) {
+  return request({
+    url: '/report2plat/receiveEventList',
+    method: 'GET',
+    params: data
+  })
+}
+// 4、按批次id查询处理结果
+// 参数:String batchId;//用户输入
+export function getLogById(data) {
+  return request({
+    url: '/report2plat/getLog',
+    method: 'GET',
+    params: data
+  })
+}
+// 5、按错误id查询错误详细信息
+// 参数:String errorId;//用户输入
+export function getErrLogById(data) {
+  return request({
+    url: '/report2plat/getErrLog',
+    method: 'GET',
+    params: data
+  })
+}

+ 6 - 1
src/layout/components/AppMain.vue

@@ -1,6 +1,9 @@
 <template>
   <section class="app-main">
-    <transition name="fade-transform" mode="out-in">
+    <transition
+      name="fade-transform"
+      mode="out-in"
+    >
       <keep-alive>
         <router-view :key="key" />
       </keep-alive>
@@ -29,6 +32,8 @@ $navHeight:75px;
   position: relative;
   overflow: hidden;
   background-color: #071A29;
+  padding: 20px;
+  box-sizing: border-box;
 }
 
 .fixed-header+.app-main {

+ 28 - 0
src/router/index.js

@@ -70,6 +70,34 @@ export var routeViews = [
         meta: { title: '上报安全风险事件数据', icon: 'el-icon-document', affix: true }
       }
     ]
+  },
+  {
+    path: '/getLog',
+    component: Layout,
+    name: 'getLog-list',
+    redirect: '/getLog/list',
+    children: [
+      {
+        path: 'list',
+        component: () => import('@/views/getLog'),
+        name: 'getLog',
+        meta: { title: '处理结果', icon: 'el-icon-document', affix: true }
+      }
+    ]
+  },
+  {
+    path: '/getErrLog',
+    component: Layout,
+    name: 'getErrLog-list',
+    redirect: '/getErrLog/list',
+    children: [
+      {
+        path: 'list',
+        component: () => import('@/views/getErrLog'),
+        name: 'getErrLog',
+        meta: { title: '错误信息', icon: 'el-icon-document', affix: true }
+      }
+    ]
   }
 ]
 const createRouter = () => new Router({

+ 26 - 35
src/utils/request.js

@@ -1,8 +1,6 @@
 import axios from 'axios'
-import { MessageBox, Message } from 'element-ui'
-import store from '@/store'
-import { getToken } from '@/utils/auth'
-import { appID, appKey, appSecret, serverUrl, devServerUrl } from '@/settings'
+import { Message } from 'element-ui'
+import { serverUrl, devServerUrl } from '@/settings'
 
 const baseURL = process.env.NODE_ENV === 'development' ? devServerUrl : serverUrl
 
@@ -18,14 +16,7 @@ const service = axios.create({
 // request interceptor
 service.interceptors.request.use(
   config => {
-    // do something before request is sent
-    config.headers['AppID'] = appID
-    config.headers['AppKey'] = appKey
-    config.headers['AppSecret'] = appSecret
     // loadingInstance = Loading.service({ fullscreen: true })
-    if (store.getters.token) {
-      config.headers['Authorization'] = 'Bearer ' + getToken()
-    }
     return config
   },
   error => {
@@ -40,30 +31,30 @@ service.interceptors.response.use(
   response => {
     // loadingInstance.close()
     const res = response.data
-    if (res.code !== 200) {
-      // 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired;
-      if (res.code === 401) {
-        // to re-login
-        MessageBox.confirm('登录失效,请重新登录!', '温馨提示!', {
-          confirmButtonText: '确认',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
-          store.dispatch('user/resetToken').then(() => {
-            location.reload()
-          })
-        })
-      } else {
-        Message({
-          message: res.msg || 'Error',
-          type: 'error',
-          duration: 3 * 1000
-        })
-      }
-      return Promise.reject(new Error(res.message || 'Error'))
-    } else {
-      return res
-    }
+    return res
+    // if (res.code !== 200) {
+    //   if (res.code === 401) {
+    //     // to re-login
+    //     MessageBox.confirm('登录失效,请重新登录!', '温馨提示!', {
+    //       confirmButtonText: '确认',
+    //       cancelButtonText: '取消',
+    //       type: 'warning'
+    //     }).then(() => {
+    //       store.dispatch('user/resetToken').then(() => {
+    //         location.reload()
+    //       })
+    //     })
+    //   } else {
+    //     Message({
+    //       message: res.msg || 'Error',
+    //       type: 'error',
+    //       duration: 3 * 1000
+    //     })
+    //   }
+    //   return Promise.reject(new Error(res.message || 'Error'))
+    // } else {
+    //   return res
+    // }
   },
   error => {
     // loadingInstance.close()

+ 73 - 0
src/views/getErrLog/index.vue

@@ -0,0 +1,73 @@
+
+<template>
+  <el-card>
+    <div class="search-box">
+      <el-input
+        v-model="errorId"
+        placeholder="请输入错误id"
+        style="width:240px"
+        clearable
+      />
+      <el-button
+        type="primary"
+        style="margin-left: 10px;"
+        size="mini"
+        @click="search"
+      >查询</el-button>
+    </div>
+    <div class="cont">
+      <el-table
+        :data="tableData"
+        stripe
+        style="width: 100%"
+      >
+        <el-table-column
+          prop="date"
+          label="日期"
+          width="180"
+        />
+        <el-table-column
+          prop="name"
+          label="姓名"
+          width="180"
+        />
+        <el-table-column
+          prop="address"
+          label="地址"
+        />
+      </el-table>
+    </div>
+  </el-card>
+</template>
+<script>
+import { getErrLogById } from '@/api'
+export default {
+  name: 'ReceiveUnit',
+  data() {
+    return {
+      errorId: undefined,
+      companys: [],
+      tableData: []
+    }
+  },
+  methods: {
+    search() {
+      this.getErrLogById()
+    },
+    getErrLogById() {
+      getErrLogById({
+        errorId: this.errorId
+      }).then((result) => {
+        this.tableData = result.data
+      })
+    }
+  }
+}
+</script>
+<style lang="scss" scoped>
+.cont{
+  margin-top: 15px;
+  min-height: 81vh;
+  overflow-y: auto;
+}
+</style>

+ 72 - 0
src/views/getLog/index.vue

@@ -0,0 +1,72 @@
+
+<template>
+  <el-card>
+    <div class="search-box">
+      <el-input
+        v-model="batchId"
+        placeholder="请输入批次id查询处理结果"
+        style="width:240px"
+        clearable
+      />
+      <el-button
+        type="primary"
+        style="margin-left: 10px;"
+        size="mini"
+        @click="search"
+      >查询</el-button>
+    </div>
+    <div class="cont">
+      <el-table
+        :data="tableData"
+        stripe
+        style="width: 100%"
+      >
+        <el-table-column
+          prop="date"
+          label="日期"
+          width="180"
+        />
+        <el-table-column
+          prop="name"
+          label="姓名"
+          width="180"
+        />
+        <el-table-column
+          prop="address"
+          label="地址"
+        />
+      </el-table>
+    </div>
+  </el-card>
+</template>
+<script>
+import { getLogById } from '@/api'
+export default {
+  name: 'ReceiveUnit',
+  data() {
+    return {
+      batchId: undefined,
+      tableData: []
+    }
+  },
+  methods: {
+    search() {
+      this.getLogById()
+    },
+    getLogById() {
+      getLogById({
+        batchId: this.batchId
+      }).then((result) => {
+        this.tableData = result.data
+      })
+    }
+  }
+}
+</script>
+<style lang="scss" scoped>
+.cont{
+  margin-top: 15px;
+  min-height: 81vh;
+  overflow-y: auto;
+}
+</style>

+ 1 - 1
src/views/home/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <h1>我是首页</h1>
+  <h1>HAVE A FUNNY DAY ! </h1>
 </template>
 <script>
 export default {

+ 85 - 2
src/views/receiveEvent/index.vue

@@ -1,8 +1,91 @@
+
 <template>
-  <h1>3、上报安全风险事件数据</h1>
+  <el-card>
+    <div class="search-box">
+      <el-select
+        v-model="cId"
+        filterable
+        placeholder="公司名称"
+        style="width:240px"
+      >
+        <el-option
+          v-for=" item in companys"
+          :key="item.cId"
+          :label="item.qymc"
+          :value="item.cId"
+        />
+      </el-select>
+      <el-button
+        type="primary"
+        style="margin-left: 10px;"
+        size="mini"
+        @click="search"
+      >查询</el-button>
+    </div>
+    <div class="cont">
+      <el-table
+        :data="tableData"
+        stripe
+        style="width: 100%"
+      >
+        <el-table-column
+          prop="date"
+          label="日期"
+          width="180"
+        />
+        <el-table-column
+          prop="name"
+          label="姓名"
+          width="180"
+        />
+        <el-table-column
+          prop="address"
+          label="地址"
+        />
+      </el-table>
+    </div>
+  </el-card>
 </template>
 <script>
+import { getAllReportcompanys, getReceiveEventListByList } from '@/api'
 export default {
-  name: 'ReceiveEvent'
+  name: 'ReceiveUnit',
+  data() {
+    return {
+      cId: undefined,
+      companys: [],
+      tableData: []
+    }
+  },
+  created() {
+    this.init()
+  },
+  methods: {
+    init() {
+      this.getAllReportcompanys()
+    },
+    search() {
+      this.getReceiveEventListByList()
+    },
+    getAllReportcompanys() {
+      getAllReportcompanys().then((result) => {
+        this.companys = result.data
+      })
+    },
+    getReceiveEventListByList() {
+      getReceiveEventListByList({
+        cId: this.cId
+      }).then((result) => {
+        this.tableData = result.data
+      })
+    }
+  }
 }
 </script>
+<style lang="scss" scoped>
+.cont{
+  margin-top: 15px;
+  min-height: 81vh;
+  overflow-y: auto;
+}
+</style>

+ 84 - 2
src/views/receiveUnit/index.vue

@@ -1,9 +1,91 @@
 
 <template>
-  <h1>上报风险单元</h1>
+  <el-card>
+    <div class="search-box">
+      <el-select
+        v-model="cId"
+        filterable
+        placeholder="公司名称"
+        style="width:240px"
+      >
+        <el-option
+          v-for=" item in companys"
+          :key="item.cId"
+          :label="item.qymc"
+          :value="item.cId"
+        />
+      </el-select>
+      <el-button
+        type="primary"
+        style="margin-left: 10px;"
+        size="mini"
+        @click="search"
+      >查询</el-button>
+    </div>
+    <div class="cont">
+      <el-table
+        :data="tableData"
+        stripe
+        style="width: 100%"
+      >
+        <el-table-column
+          prop="date"
+          label="日期"
+          width="180"
+        />
+        <el-table-column
+          prop="name"
+          label="姓名"
+          width="180"
+        />
+        <el-table-column
+          prop="address"
+          label="地址"
+        />
+      </el-table>
+    </div>
+  </el-card>
 </template>
 <script>
+import { getAllReportcompanys, getReceiveUnitListByList } from '@/api'
 export default {
-  name: 'ReceiveUnit'
+  name: 'ReceiveUnit',
+  data() {
+    return {
+      cId: undefined,
+      companys: [],
+      tableData: []
+    }
+  },
+  created() {
+    this.init()
+  },
+  methods: {
+    init() {
+      this.getAllReportcompanys()
+    },
+    search() {
+      this.getReceiveUnitListByList()
+    },
+    getAllReportcompanys() {
+      getAllReportcompanys().then((result) => {
+        this.companys = result.data
+      })
+    },
+    getReceiveUnitListByList() {
+      getReceiveUnitListByList({
+        cId: this.cId
+      }).then((result) => {
+        this.tableData = result.data
+      })
+    }
+  }
 }
 </script>
+<style lang="scss" scoped>
+.cont{
+  margin-top: 15px;
+  min-height: 81vh;
+  overflow-y: auto;
+}
+</style>

+ 42 - 2
yarn.lock

@@ -2019,6 +2019,11 @@ async@^2.6.4:
   dependencies:
     lodash "^4.17.14"
 
+asynckit@^0.4.0:
+  version "0.4.0"
+  resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
+  integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==
+
 at-least-node@^1.0.0:
   version "1.0.0"
   resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2"
@@ -2036,6 +2041,15 @@ autoprefixer@^10.2.4:
     picocolors "^1.0.0"
     postcss-value-parser "^4.2.0"
 
+axios@^1.6.8:
+  version "1.6.8"
+  resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.8.tgz#66d294951f5d988a00e87a0ffb955316a619ea66"
+  integrity sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==
+  dependencies:
+    follow-redirects "^1.15.6"
+    form-data "^4.0.0"
+    proxy-from-env "^1.1.0"
+
 babel-helper-vue-jsx-merge-props@^2.0.0:
   version "2.0.3"
   resolved "https://registry.yarnpkg.com/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-2.0.3.tgz#22aebd3b33902328e513293a8e4992b384f9f1b6"
@@ -2416,6 +2430,13 @@ colorette@^2.0.10:
   resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.20.tgz#9eb793e6833067f7235902fcd3b09917a000a95a"
   integrity sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==
 
+combined-stream@^1.0.8:
+  version "1.0.8"
+  resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f"
+  integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==
+  dependencies:
+    delayed-stream "~1.0.0"
+
 commander@^2.20.0:
   version "2.20.3"
   resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
@@ -2773,6 +2794,11 @@ define-properties@^1.2.1:
     has-property-descriptors "^1.0.0"
     object-keys "^1.1.1"
 
+delayed-stream@~1.0.0:
+  version "1.0.0"
+  resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619"
+  integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==
+
 depd@2.0.0:
   version "2.0.0"
   resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df"
@@ -3379,11 +3405,20 @@ flatted@^3.2.9:
   resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.3.1.tgz#21db470729a6734d4997002f439cb308987f567a"
   integrity sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==
 
-follow-redirects@^1.0.0:
+follow-redirects@^1.0.0, follow-redirects@^1.15.6:
   version "1.15.6"
   resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.6.tgz#7f815c0cda4249c74ff09e95ef97c23b5fd0399b"
   integrity sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==
 
+form-data@^4.0.0:
+  version "4.0.0"
+  resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452"
+  integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==
+  dependencies:
+    asynckit "^0.4.0"
+    combined-stream "^1.0.8"
+    mime-types "^2.1.12"
+
 forwarded@0.2.0:
   version "0.2.0"
   resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811"
@@ -4277,7 +4312,7 @@ mime-db@1.52.0, "mime-db@>= 1.43.0 < 2":
   resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70"
   integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==
 
-mime-types@^2.1.27, mime-types@^2.1.31, mime-types@~2.1.17, mime-types@~2.1.24, mime-types@~2.1.34:
+mime-types@^2.1.12, mime-types@^2.1.27, mime-types@^2.1.31, mime-types@~2.1.17, mime-types@~2.1.24, mime-types@~2.1.34:
   version "2.1.35"
   resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a"
   integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==
@@ -5062,6 +5097,11 @@ proxy-addr@~2.0.7:
     forwarded "0.2.0"
     ipaddr.js "1.9.1"
 
+proxy-from-env@^1.1.0:
+  version "1.1.0"
+  resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2"
+  integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==
+
 pseudomap@^1.0.2:
   version "1.0.2"
   resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3"