浏览代码

Merge branch 'main' of http://git.cc-lotus.info/Information/cxyy-admin into main

zs 8 月之前
父节点
当前提交
45e6462c9e

+ 1 - 1
.env.development

@@ -8,7 +8,7 @@ VITE_APP_PORT = 3000
 
 # 代理前缀
 VITE_APP_BASE_API = '/cxyy/api'
-
+VITE_APP_ES_API = '/cxyy/es'
 VITE_APP_HOST = ""
 VITE_BASE_URL = "/cxyyAdmin"
 VITE_OUT_DIR = "cxyyAdmin"

+ 1 - 1
.env.production

@@ -7,7 +7,7 @@ VITE_APP_PORT = 3000
 VITE_USE_CRYPTO = false
 # 代理前缀
 VITE_APP_BASE_API = '/cxyy/api'
-
+VITE_APP_ES_API = '/cxyy/es'
 VITE_APP_HOST = ""
 
 VITE_BASE_URL = "/cxyyAdmin"

+ 1 - 1
src/components/custom/custom-table.vue

@@ -1,7 +1,7 @@
 <template>
   <el-row>
     <el-col>
-      <el-table :data="data" border :height="height" @selection-change="toSelect">
+      <el-table :data="data" border :height="height" @selection-change="toSelect" stripe>
         <el-table-column type="selection" width="55" v-if="select"> </el-table-column>
         <template v-for="f in fields" :key="f.model">
           <el-table-column v-if="f.custom" :label="f.label" :prop="f.model" align="center" v-bind="f.options">

+ 15 - 0
src/store/api/esDict.js

@@ -0,0 +1,15 @@
+import { defineStore } from 'pinia'
+import { AxiosWrapper } from '@/utils/axios-wrapper'
+const url = '/dict'
+const axios = new AxiosWrapper({ baseUrl: import.meta.env.VITE_APP_ES_API })
+export const EsDictStore = defineStore('esDict', () => {
+  const getDict = async (payload) => {
+    const res = await axios.$get(`${url}`)
+    return res
+  }
+  const updateDict = async (payload) => {
+    const res = await axios.$post(`${url}`, { data: payload })
+    return res
+  }
+  return { getDict, updateDict }
+})

+ 16 - 1
src/store/api/systemFunc.js

@@ -1,5 +1,6 @@
 import { defineStore } from 'pinia'
 import { AxiosWrapper } from '@/utils/axios-wrapper'
+import { indexOf } from 'lodash-es'
 const url = '/system/func'
 const axios = new AxiosWrapper()
 
@@ -29,12 +30,26 @@ export const SystemFuncStore = defineStore('systemFunc', () => {
     return res
   }
 
+  const dbRestore = async (payload) => {
+    const body = {}
+    if (payload) body.path = payload
+    const res = await axios.$post(`${url}/dbRestore`, body)
+    return res
+  }
+
+  const dbBackUp = async () => {
+    const res = await axios.$get(`${url}/dbBackUp`)
+    return res
+  }
+
   return {
     initES,
     correctImportData,
     initSystemMenus,
     initUserMenus,
     initRoleData,
-    initRoleMenus
+    initRoleMenus,
+    dbRestore,
+    dbBackUp
   }
 })

+ 6 - 1
src/store/api/user/contactApply.js

@@ -34,12 +34,17 @@ export const ContactApplyStore = defineStore('contactApply', () => {
     const res = await axios.$post(`${url}/examine`, payload)
     return res
   }
+  const getContacts = async (payload) => {
+    const res = await axios.$get(`${url}/contacts/${payload}`)
+    return res
+  }
   return {
     query,
     fetch,
     create,
     update,
     del,
-    examine
+    examine,
+    getContacts
   }
 })

+ 8 - 5
src/views/exam/parts/contact.vue

@@ -23,7 +23,7 @@
           <custom-desc v-model="form" :fields="statusFields"></custom-desc>
         </el-col>
       </el-row>
-      <custom-form v-if="form.source === 'sector'" v-model="contactsForm" :fields="contactsFields" :rules="contactsRules" style="margin: 10px 0" :useSave="false"></custom-form>
+      <custom-form v-model="contactsForm" :fields="contactsFields" :rules="contactsRules" style="margin: 10px 0" :useSave="false"></custom-form>
       <el-row style="text-align: center; padding-top: 20px" justify="center">
         <el-col :span="6" style="">
           <el-button type="success" @click="exam('1')" :disabled="getAgreeDisabled">{{ $t('common.agree') }}</el-button>
@@ -75,9 +75,14 @@ const contactsFields = ref([
   { label: '联系人', model: 'person' },
   { label: '联系电话', model: 'phone' }
 ])
-const toExam = (data) => {
+const toExam = async (data) => {
   form.value = cloneDeep(data)
-  dialog.value = { type: '2', show: true, title: t('pages.contactApply.examTitle') }
+  const id = get(data, 'id')
+  const result = await store.getContacts(id)
+  if ($checkRes(result, null, result.errmsg)) {
+    contactsForm.value = get(result, 'data', {})
+    dialog.value = { type: '2', show: true, title: t('pages.contactApply.examTitle') }
+  }
 }
 const toClose = () => {
   form.value = {}
@@ -86,8 +91,6 @@ const toClose = () => {
 }
 const getAgreeDisabled = computed(() => {
   const source = get(form.value, 'source')
-  // 非产业集群,不需要限制
-  if (source !== 'sector') return false
   const contacts = contactsForm.value
   const person = get(contacts, 'person')
   const phone = get(contacts, 'phone')

+ 1 - 1
src/views/information/parts/match/score/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div id="index">
     <el-row>
-      <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
+      <el-col :span="24" class="main" v-loading="loading">
         <el-row justify="center">
           <el-col :span="16">
             <el-steps style="max-width: 600px" :active="active" finish-status="success">

+ 1 - 1
src/views/information/parts/match/sign/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div id="index">
     <el-row>
-      <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
+      <el-col :span="24" class="main" v-loading="loading">
         <el-col :span="24" class="one">
           <custom-search-bar :fields="fields.filter((f) => f.isSearch)" v-model="searchForm" @search="search" @reset="toReset"></custom-search-bar>
           <custom-table :data="data" :fields="fields" @query="search" :total="total" :opera="opera" @view="toView" @exam="toExam">

+ 1 - 2
src/views/journal/index.vue

@@ -2,7 +2,7 @@
   <div class="main animate__animated animate__backInRight" v-loading="loading">
     <custom-search-bar :fields="fields.filter((f) => f.isSearch)" v-model="searchForm" @search="search" @reset="toReset"> </custom-search-bar>
     <custom-button-bar :fields="buttonFields" @add="toAdd" @select="toMoreDelect"></custom-button-bar>
-    <custom-table :data="data" :fields="fields" @query="search" :total="total" :opera="opera" @journal="toJournal" @exam="toExam" @edit="toEdit" @delete="toDelete" @toSelect="toSelect" :select="true">
+    <custom-table :data="data" :fields="fields" @query="search" :total="total" :opera="opera" @journal="toJournal" @exam="toExam" @edit="toEdit" @delete="toDelete" @toSelect="toSelect">
       <template #is_use="{ row }">
         <el-tag v-if="row.is_use == '0'" type="success" @click="toUse(row, '1')">启用</el-tag>
         <el-tag v-else type="info" @click="toUse(row, '0')">禁用</el-tag>
@@ -58,7 +58,6 @@ const opera = [
 ]
 const buttonFields = [
   { label: t('common.create'), method: 'add' },
-  { label: t('common.select'), method: 'select', type: 'danger' }
 ]
 let skip = 0
 let limit = inject('limit')

+ 1 - 0
src/views/platform/index.vue

@@ -25,6 +25,7 @@ const componentList = ref({
   tags: defineAsyncComponent(() => import('./parts/tags.vue')),
   sector: defineAsyncComponent(() => import('./parts/sector.vue')),
   friend: defineAsyncComponent(() => import('./parts/friend.vue')),
+  'es-dict': defineAsyncComponent(() => import('./parts/es-dict.vue')),
   import: defineAsyncComponent(() => import('./parts/import.vue'))
 })
 const value = ref()

+ 65 - 0
src/views/platform/parts/es-dict.vue

@@ -0,0 +1,65 @@
+<template>
+  <div id="es-dict">
+    <el-row justify="space-between" style="margin-bottom:10px">
+      <el-col :span="6" style="text-align: left">
+        <el-button type="success" @click="toSave">保存</el-button>
+      </el-col>
+      <el-col :span="6" style="text-align: right">
+        <el-button type="primary" @click="toAdd">添加字典</el-button>
+      </el-col>
+    </el-row>
+    <el-row>
+      <el-col :span="24">
+        <el-table :data="data" height="70vh" border stripe>
+          <el-table-column align="center" label="字典项">
+            <template #default="{ row }">{{ row }}</template>
+          </el-table-column>
+          <el-table-column align="center" label="操作" width="150px">
+            <template #default="{ $index }">
+              <el-button text type="danger" @click="toDelete($index)">删除</el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script setup>
+const $checkRes = inject('$checkRes')
+import { get, cloneDeep } from 'lodash-es'
+import { EsDictStore } from '@/store/api/esDict'
+const store = EsDictStore()
+const data = ref([])
+const search = async () => {
+  const result = await store.getDict()
+  if ($checkRes(result)) {
+    data.value = get(result, 'data', [])
+  }
+}
+const toAdd = () =>{
+  ElMessageBox.prompt('请填写字典项', '添加字典项', {
+    confirmButtonText: '确认',
+    cancelButtonText: '取消',
+  })
+    .then(({ value }) => {
+      data.value.push(value)
+    })
+    .catch(() => {
+    })
+}
+const toDelete = (index) => {
+  data.value.splice(index, 1)
+}
+const toSave = async () => {
+  const updateData = cloneDeep(data.value)
+  const result = store.updateDict(updateData)
+  if ($checkRes(result, true, result.errmsg)) {
+    search()
+  }
+}
+onMounted(() => {
+  search()
+})
+</script>
+<style scoped></style>

+ 37 - 2
src/views/system/parts/system-func.vue

@@ -18,10 +18,17 @@
     <el-col :span="4">
       <el-button type="primary" @click="toMethod('irm')">{{ $t('pages.systemFunc.irm') }}</el-button>
     </el-col>
+    <el-col :span="4">
+      <el-button type="primary" @click="toMethod('dbBackUp')">数据库备份</el-button>
+    </el-col>
+    <el-col :span="4">
+      <el-button type="primary" @click="toMethod('dbRestore')">数据库还原</el-button>
+    </el-col>
   </el-row>
 </template>
 
 <script setup>
+import { ElMessage, ElMessageBox } from 'element-plus'
 import { SystemFuncStore } from '@/store/api/systemFunc'
 const $checkRes = inject('$checkRes')
 const store = SystemFuncStore()
@@ -30,26 +37,54 @@ const toMethod = async (method) => {
   switch (method) {
     case 'initES':
       res = await store.initES()
+      $checkRes(res, true, res.errmsg)
       break
     case 'cid':
       res = await store.correctImportData()
+      $checkRes(res, true, res.errmsg)
       break
     case 'ism':
       res = await store.initSystemMenus()
+      $checkRes(res, true, res.errmsg)
       break
     case 'ium':
       res = await store.initUserMenus()
+      $checkRes(res, true, res.errmsg)
       break
     case 'ir':
       res = await store.initRoleData()
+      $checkRes(res, true, res.errmsg)
       break
     case 'irm':
       res = await store.initRoleMenus()
+      $checkRes(res, true, res.errmsg)
+      break
+    case 'dbBackUp':
+      res = await store.dbBackUp()
+      $checkRes(res, true, res.errmsg)
+      break
+    case 'dbRestore':
+      // 需要输入还原文件夹
+      ElMessageBox.prompt('请输入json文件所在目录地址,默认地址为备份地址', '数据库还原', {
+        confirmButtonText: '确认',
+        cancelButtonText: '取消'
+      })
+        .then(async ({ value }) => {
+          res = await store.dbRestore(value)
+          console.log(res)
+          $checkRes(res, true, res.errmsg)
+        })
+        .catch(() => {})
+      //
       break
     default:
       break
   }
-  $checkRes(res, true, res.errmsg)
+  
 }
 </script>
-<style scoped></style>
+<style scoped>
+.el-col {
+  margin-top: 10px;
+}
+</style>

+ 4 - 0
vite.config.js

@@ -42,6 +42,10 @@ export default defineConfig(({ mode }) => {
         [env.VITE_APP_BASE_API]: {
           changeOrigin: true,
           target: 'http://127.0.0.1:19700'
+        },
+        [env.VITE_APP_ES_API]: {
+          changeOrigin: true,
+          target: 'http://127.0.0.1:19700'
         }
       }
     },