xuwenqiang1992 2 years atrás
parent
commit
e8ac8f336d

+ 72 - 0
src/api/system/index.ts

@@ -1,5 +1,77 @@
 // @ts-nocheck
 import request from "@/utils/request";
+//删除日志
+export function deleteOpLogList(data) {
+  return request({
+    url: '/system/deleteOpLogList',
+    method: 'post',
+    params: data
+  })
+}
+//查看日志详情
+export function viewOpLog(data) {
+  return request({
+    url: '/system/viewOpLog',
+    method: 'post',
+    params: data
+  })
+}
+
+//获取操作日志列表
+export function getOpLogList(data) {
+  return request({
+    url: '/system/getOpLogList',
+    method: 'post',
+    params: data
+  })
+}
+// 禁用启用
+export function voidDictData(data) {
+  return request({
+    url: '/system/voidDictData',
+    method: 'post',
+    params: data
+  })
+}
+// 修改字典数据
+export function updateDictData(data) {
+  return request({
+    url: '/system/updateDictData',
+    method: 'post',
+    params: data
+  })
+}
+// 新增字典数据
+export function addDictData(data) {
+  return request({
+    url: '/system/addDictData',
+    method: 'post',
+    params: data
+  })
+}
+// 根据字典类型查询字典数据信息
+export function getDictDataInfo(data) {
+  return request({
+    url: '/system/getDictDataInfo',
+    method: 'post',
+    params: data
+  })
+}
+// 查询字典数据详细
+export function getData(dictCode) {
+  return request({
+    url: '/system/dict/data/' + dictCode,
+    method: 'get'
+  })
+}
+// 查询字典数据列表
+export function getDictDataList(query) {
+  return request({
+    url: '/system/getDictDataList',
+    method: 'post',
+    params: query
+  })
+}
 // 禁用启用字典
 export function voidDictType(data) {
   return request({

+ 22 - 10
src/views/system/dictType/compt/childDialog.vue

@@ -14,8 +14,18 @@
       >
         <el-row>
           <el-col :span="24">
-            <el-form-item prop="paperTypeName" label="分类名称">
-              <el-input v-model="formData.paperTypeName"/>
+            <el-form-item prop="dictName" label="字典名称">
+              <el-input v-model="formData.dictName"/>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item prop="dictType" label="字典类型">
+              <el-input v-model="formData.dictType"/>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item prop="remark" label="备注">
+              <el-input v-model="formData.remark"/>
             </el-form-item>
           </el-col>
         </el-row>
@@ -32,7 +42,7 @@
   </div>
 </template>
 <script setup lang="ts">
-import {addPaperInfoType, getPaperInfoType, updatePaperInfoType} from "@/api/baseInfo";
+import {addDictType, getDictTypeInfoById, updateDictType} from "@/api/system";
 import type {FormInstance} from 'element-plus'
 
 let dialogVisible = ref(false)
@@ -40,11 +50,13 @@ let dialogTitle = ref("")
 const formRef = ref<FormInstance>()
 const emit = defineEmits(['dialogChange'])
 const formData = reactive({
-  paperTypeName: '',
+  dictName: '',
+  dictType: '',
+  remark: '',
   id: ""
 })
 const rules = reactive({
-  paperTypeName: [{required: true, message: "请输入产品分类名称", trigger: "blur"}],
+  dictName: [{required: true, message: "请输入字典名称", trigger: "blur"}],
 });
 
 function handleSubmit() {
@@ -55,9 +67,9 @@ function handleSubmit() {
         //修改
         const postData = JSON.stringify(formData)
         const params = {
-          "infoType": postData,
+          "dictType": postData,
         }
-        updatePaperInfoType(params).then((response) => {
+        updateDictType(params).then((response) => {
           dialogVisible.value = false
           if (response.httpCode == 200) {
             emit('dialogChange');
@@ -68,9 +80,9 @@ function handleSubmit() {
         //增加
         const postData = JSON.stringify(formData)
         const params = {
-          "infoType": postData,
+          "dictType": postData,
         }
-        addPaperInfoType(params).then((response) => {
+        addDictType(params).then((response) => {
           dialogVisible.value = false
           if (response.httpCode == 200) {
             emit('dialogChange');
@@ -86,7 +98,7 @@ function getItemData(item) {
   const data = {
     id: item
   }
-  getPaperInfoType(data).then(response => {
+  getDictTypeInfoById(data).then(response => {
     if (response.httpCode == 200) {
       const data = response.data
       Object.assign(formData, {...data});

+ 13 - 6
src/views/system/dictType/index.vue

@@ -12,7 +12,7 @@
       </div>
       <el-button @click="openDialog()" color="#11a983">
         <i-ep-plus/>
-        增加纸张分类
+        增加字典
       </el-button>
       <el-button type="primary" @click="refreshTableInfo">
         <i-ep-refresh/>
@@ -44,8 +44,15 @@
             <span>{{ scope.$index + 1 }}</span>
           </template>
         </el-table-column>
-        <el-table-column prop="paperName" width="250" label="分类名称"/>
-        <el-table-column prop="paperTypeName" width="300" label="纸张类型名称"/>
+        <el-table-column prop="dictName" width="250" label="字典名称"/>
+        <el-table-column
+          width="150px"
+          label="字典类型">
+          <template #default="{row}">
+            <el-button @click="router.push({path: '/system/dictData/' + row.id,query: { 'id':row.id, 'dictType': row.dictType }})" size="small" link type="primary">{{row.dictType}}</el-button>
+          </template>
+        </el-table-column>
+        <el-table-column prop="remark" width="250" label="备注"/>
         <el-table-column
           prop="status"
           label="状态">
@@ -82,11 +89,11 @@
 </template>
 <script setup lang="ts">
 import {getDictTypeList, voidDictType} from "@/api/system";
-import ChildDialog from './compt/childDialog.vue'
+import ChildDialog from './compt/ChildDialog.vue'
+import {useTable} from '@/hooks/useTable'
 import {useRouter} from "vue-router";
+import {ref} from "vue";
 const router = useRouter();
-import {useTable} from '@/hooks/useTable'
-
 let disableLock = ref('')
 const childDialog = ref<any>()
 

+ 11 - 0
src/views/system/log/loginLog/index.vue

@@ -0,0 +1,11 @@
+<script setup lang="ts">
+
+</script>
+
+<template>
+
+</template>
+
+<style scoped lang="scss">
+
+</style>

+ 105 - 0
src/views/system/log/operlog/compt/childDialog.vue

@@ -0,0 +1,105 @@
+<template>
+  <div class="dialog">
+    <el-dialog
+        v-model="dialogVisible"
+        :title="dialogTitle"
+        width="600px"
+        @close="closeDialog()"
+    >
+      <el-form
+          ref="formRef"
+          :model="formData"
+          label-width="120px"
+      >
+        <el-row>
+          <el-col :span="24">
+            <el-form-item prop="url" label="请求地址">
+              <el-input disabled v-model="formData.url"/>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item prop="header" label="请求头部">
+              <el-input type="textarea" rows="10" disabled v-model="formData.header"/>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item prop="params" label="请求参数">
+              <el-input type="textarea" rows="10" disabled v-model="formData.params"/>
+            </el-form-item>
+          </el-col>
+        </el-row>
+
+      </el-form>
+
+      <template #footer>
+        <div class="dialog-footer">
+          <el-button @click="closeDialog()">关 闭</el-button>
+        </div>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+<script setup lang="ts">
+import {viewOpLog} from "@/api/system";
+import type {FormInstance} from 'element-plus'
+
+let dialogVisible = ref(false)
+let dialogTitle = ref("")
+const formRef = ref<FormInstance>()
+const emit = defineEmits(['dialogChange'])
+const formData = reactive({
+  params: '',
+  header: '',
+  url: '',
+  id: ""
+})
+
+function getItemData(item) {
+  console.log(item);
+  const data = {
+    id: item.esId,
+    esIndex: item.esIndex
+  }
+  viewOpLog(data).then(response => {
+    if (response.httpCode == 200) {
+      const data = response.data
+      formData.url = data.url
+      var headerValue = ''
+      data.headers.forEach(item => {
+        headerValue += item.key + '=' + item.value + '\n'
+      })
+      formData.header = headerValue
+      var paramsValue = ''
+      data.params.forEach(item => {
+        paramsValue += item.key + '=' + item.value + '\n'
+      })
+      formData.params = paramsValue
+    }
+  })
+}
+
+/**  重置表单 */
+function resetForm() {
+  formRef.value.resetFields();
+  formData.id = ''
+}
+
+/**关闭弹窗 */
+function closeDialog() {
+  dialogVisible.value = false
+  formRef.value.resetFields();
+  formData.id = undefined;
+}
+
+defineExpose({
+  dialogVisible,
+  dialogTitle,
+  getItemData,
+  resetForm
+})
+</script>
+
+
+<style scoped lang="scss">
+
+</style>

+ 139 - 0
src/views/system/log/operlog/index.vue

@@ -0,0 +1,139 @@
+<template>
+  <div class="app-container">
+    <div class="filter-container">
+      <el-input @keyup.enter="handleSearch" class="w200px mr5px" v-model="queryForm.userName" placeholder="操作人员"/>
+      <el-input @keyup.enter="handleSearch" class="w200px mr5px" v-model="queryForm.url" placeholder="请求地址"/>
+      <el-date-picker
+          @change="dateChange"
+          class="w200px mr5px"
+          v-model="searchTime"
+          type="datetimerange"
+          start-placeholder="开始时间"
+          end-placeholder="结束时间"
+          format="YYYY-MM-DD HH:mm:ss"
+          value-format="x"
+      />
+      <el-button type="primary" @click="handleSearch">
+        <i-ep-search/>
+        搜索
+      </el-button>
+      <el-button @click="deleteLog()" type="warning">
+        <i-ep-Delete/>
+        删除
+      </el-button>
+      <el-button type="primary" @click="refreshTableInfo">
+        <i-ep-refresh/>
+      </el-button>
+    </div>
+    <div class="table-con">
+      <el-table
+          :max-height="tableHeight"
+          v-loading="loading"
+          :data="tableData"
+          highlight-current-row
+          border
+      >
+        <el-table-column label="操作" width="70">
+          <template #default="{row}">
+            <el-button link @click="openDialog(row)" type="primary">
+              详情
+            </el-button>
+          </template>
+        </el-table-column>
+        <el-table-column
+            prop="userName"
+            label="操作人员">
+        </el-table-column>
+        <el-table-column
+            prop="clientIp"
+            label="主机IP">
+        </el-table-column>
+        <el-table-column
+            prop="url"
+            label="请求地址">
+        </el-table-column>
+        <el-table-column
+            prop="opDateStr"
+            label="操作时间">
+        </el-table-column>
+        <el-table-column
+            prop="esIndex"
+            label="ES索引">
+        </el-table-column>
+      </el-table>
+      <pagination
+          v-if="total > 0"
+          v-model:total="total"
+          v-model:page="queryPage.pageIndex"
+          v-model:limit="queryPage.pageSize"
+          @pagination="getTableData"
+      />
+    </div>
+    <child-dialog ref="childDialog" @dialogChange="dialogChange"></child-dialog>
+  </div>
+</template>
+<script setup lang="ts">
+import {getOpLogList,deleteOpLogList} from "@/api/system";
+import ChildDialog from './compt/ChildDialog.vue'
+import {useTable} from '@/hooks/useTable'
+let searchTime = ref('')
+const childDialog = ref<any>()
+
+//增加编辑
+function openDialog(item?: any) {
+  childDialog.value.dialogVisible =true
+  nextTick(() => {
+    childDialog.value.dialogTitle = "查看详情";
+    childDialog.value.getItemData(item)
+  });
+}
+
+
+
+//修改成功后传递事件
+function dialogChange() {
+  getTableData()
+}
+function dateChange() {
+  console.log(searchTime.value);
+  queryForm.beginTimeLong = searchTime.value[0]
+  queryForm.endTimeLong = searchTime.value[1]
+}
+const queryForm = reactive({
+  userName: '',
+  url: '',
+  beginTimeLong: '',
+  endTimeLong: ''
+})
+//禁用删除
+function deleteLog() {
+  ElMessageBox.confirm("确认操作?", "警告", {
+    confirmButtonText: "确定",
+    cancelButtonText: "取消",
+    type: "warning",
+  }).then(() => {
+    const queryData = {
+      'params': JSON.stringify({...queryForm}),
+    }
+    deleteOpLogList(queryData).then((response) => {
+      if (response.httpCode == 200) {
+        ElMessage.success("删除成功");
+        getTableData();
+      }
+
+    })
+  })
+}
+const {
+  tableData,
+  queryPage,
+  total,
+  loading,
+  getTableData,
+  tableHeight,
+  handleSearch,//搜索
+  refreshTableInfo,//刷新
+} = useTable(getOpLogList, queryForm);
+</script>
+
+