Browse Source

feat: 对接操作记录

aXin-0810 2 years ago
parent
commit
0a7e5acc86

+ 0 - 1
src/App.vue

@@ -10,7 +10,6 @@ export default {
   data() {
     return {}
   },
-
   methods: {}
 }
 </script>

+ 8 - 0
src/api/common.js

@@ -1,5 +1,13 @@
 import request from '@/utils/request'
 
+export function commonLogList(params) {
+  return request({
+    url: '/common/log/list',
+    method: 'get',
+    params
+  })
+}
+
 // 字典列表
 export function getDictList(params) {
   return request({

+ 56 - 2
src/components/template/template-page-1.vue

@@ -34,10 +34,21 @@
         <el-button size="mini" type="primary" @click="onSavePlanqd">确 定</el-button>
       </span>
     </el-dialog>
+    <el-dialog title="操作记录" :visible.sync="logDialogVisible" width="800px">
+      <zj-table
+        :columns="pgxxColumns"
+        :tableData="pgxxTableData"
+        :tableAttributes="{
+          height: '100%',
+          border: true
+        }"
+      ></zj-table>
+    </el-dialog>
   </div>
 </template>
 
 <script>
+import { commonLogList } from '@/api/common.js'
 import { zfireSave, zfireDel } from '@/api/fieldMan.js'
 import { dictListDict } from '@/api/dataDictionary2.js'
 import { zfireParamList, zfireParamSave, zfireParamDelete } from '@/api/zfireParam.js'
@@ -119,6 +130,7 @@ export default {
   },
   data() {
     return {
+      logDialogVisible: false,
       dialogVisible: false,
       // 搜索的参数
       parameter: {},
@@ -147,7 +159,40 @@ export default {
         }
       ],
       paramList: [],
-      timePlan: []
+      timePlan: [],
+      pgxxColumns: [
+        {
+          columnAttributes: {
+            label: '帐号',
+            prop: 'userName'
+          }
+        },
+        {
+          columnAttributes: {
+            label: '操作内容',
+            prop: 'content'
+          }
+        },
+        {
+          columnAttributes: {
+            label: 'ip',
+            prop: 'ip'
+          }
+        },
+        {
+          columnAttributes: {
+            label: '万能id',
+            prop: 'objId'
+          }
+        },
+        {
+          columnAttributes: {
+            label: '模块名称',
+            prop: 'moduleName'
+          }
+        }
+      ],
+      pgxxTableData: []
     }
   },
   computed: {
@@ -278,7 +323,16 @@ export default {
             size="mini"
             type="text"
             onClick={() => {
-              console.log(row[this.operationRecordkey || this.pk || 'id'])
+              if (row[this.operationRecordkey || this.pk || 'id']) {
+                commonLogList({
+                  objId: row[this.operationRecordkey || this.pk || 'id'],
+                  pageNum: 1,
+                  pageSize: -1
+                }).then(res => {
+                  this.pgxxTableData = res.data.records
+                  this.logDialogVisible = true
+                })
+              }
             }}
           >
             操作记录

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

@@ -14,7 +14,7 @@
 
 <script>
 import { mapGetters } from 'vuex'
-
+import { setModuleId } from '@/utils/request'
 export default {
   name: 'AppMain',
   computed: {
@@ -28,6 +28,14 @@ export default {
     str() {
       return this.$store.state?.user?.name
     }
+  },
+  watch: {
+    $route() {
+      setModuleId(this.$route.meta.moduleId)
+    }
+  },
+  beforeCreate() {
+    setModuleId(this.$route.meta.moduleId)
   }
 }
 </script>

+ 3 - 12
src/layout/components/Navbar.vue

@@ -79,13 +79,7 @@
       </div>
     </el-dialog>
 
-    <el-dialog
-      title="到货通知"
-      :modal="false"
-      width="70%"
-      :visible.sync="hasNotice"
-      @close="handleNotice(false)"
-    >
+    <el-dialog title="到货通知" :modal="false" width="70%" :visible.sync="hasNotice" @close="handleNotice(false)">
       <div class="mymain-container">
         <el-form ref="form" :model="form" label-width="80px" label-position="left" size="mini">
           <el-row>
@@ -358,7 +352,7 @@ export default {
       areaOpti: [
         { label: '弘格', value: '1' },
         { label: '广州', value: '2' },
-        { label: '佛山', value: '3'}
+        { label: '佛山', value: '3' }
       ]
     }
   },
@@ -382,9 +376,6 @@ export default {
   beforeDestroy() {
     window.clearInterval(this.intivalId)
     window.clearInterval(this.timer)
-
-    console.log('退出清理定时器' + this.timer)
-
     this.websocketOnclose()
   },
   computed: {
@@ -856,7 +847,7 @@ export default {
     }
   }
 }
-.tip{
+.tip {
   margin: 50px auto;
   text-align: center;
 }

+ 11 - 0
src/utils/request.js

@@ -3,6 +3,13 @@ import { MessageBox, Message } from 'element-ui'
 import store from '@/store'
 import { getToken } from '@/utils/auth'
 
+var moduleId = ''
+
+export function setModuleId(val) {
+  console.log(val)
+  moduleId = val
+}
+
 // create an axios instance
 const service = axios.create({
   baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
@@ -21,6 +28,7 @@ service.interceptors.request.use(
       // ['X-Token'] is a custom headers key
       // please modify it according to the actual situation
       config.headers['x-token'] = getToken()
+      config.headers['moduleId'] = moduleId
     }
     return config
   },
@@ -92,6 +100,7 @@ export function postBlob(data) {
       url: process.env.VUE_APP_BASE_API + data.url, // 后端接口地址
       responseType: 'blob', // bolb格式的请求方式
       headers: {
+        moduleId,
         'x-token': getToken() // 请求头
       },
       data: data.data // 需要传给后端的请求参数体
@@ -126,6 +135,7 @@ export function getBlob(data) {
       responseType: 'blob',
       params: data.data, // 与post传参方式不同之处
       headers: {
+        moduleId,
         'x-token': getToken() // 请求头
       }
     })
@@ -163,6 +173,7 @@ export async function handleImport(url, formData, id = '') {
     axios
       .post(process.env.VUE_APP_BASE_API + url, formData, {
         headers: {
+          moduleId,
           'Content-Type': 'multipart/form-data',
           'x-token': getToken(),
           id