Browse Source

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

zs 7 months ago
parent
commit
8d5ca7ace7

+ 8 - 1
src/lang/package/zh-cn/pages.js

@@ -753,6 +753,13 @@ export default {
     source_name: '数据来源标题',
     exam_admin: '审核的管理员',
     status: '状态',
-    examTitle: '信息审核',
+    examTitle: '信息审核'
+  },
+  export: {
+    user: '操作人',
+    user_type: '操作人用户类型',
+    progress: '进度',
+    reExecute: '重导出',
+    download: '下载'
   }
 }

+ 2 - 0
src/router/index.js

@@ -10,6 +10,7 @@ import { routes as message_routes } from './modules/message'
 import { routes as journal_routes } from './modules/journal'
 import { routes as center_routes } from './modules/center'
 import { routes as exam_routes } from './modules/exam'
+import { routes as export_routes } from './modules/export'
 export const homeIndex = () => import('@/views/home/index.vue')
 export const Layout = () => import('@/layout/index.vue')
 
@@ -74,6 +75,7 @@ export const constantRoutes = [
       ...journal_routes,
       ...center_routes,
       ...exam_routes,
+      ...export_routes,
     ]
   }
 ]

+ 14 - 0
src/router/modules/export.js

@@ -0,0 +1,14 @@
+import i18n from '@/lang'
+export const routes = [
+  {
+    path: '/export/index',
+    name: 'export_index',
+    meta: {
+      title: i18n.global.t('menus.export'),
+      affix: true,
+      keepAlive: true,
+      alwaysShow: false
+    },
+    component: () => import('@/views/export/index.vue')
+  }
+]

+ 15 - 2
src/store/api/exportConfig.js

@@ -14,14 +14,27 @@ export const ExportConfigStore = defineStore('exportConfig', () => {
     return res
   }
   const fetch = async (payload) => {
-    console.log(payload)
     const res = await axios.$get(`${url}/${payload}`)
     return res
   }
+  const query = async ({ skip = 0, limit = undefined, ...info } = {}) => {
+    let cond = {}
+    if (skip) cond.skip = skip
+    if (limit) cond.limit = limit
+    cond = { ...cond, ...info }
+    const res = await axios.$get(`/asyncExport`, cond)
+    return res
+  }
+  const reExecute = async (payload) => {
+    const res = await axios.$post(`/asyncExport/reExecute`, { id: payload })
+    return res
+  }
 
   return {
     update,
     dict,
-    fetch
+    fetch,
+    query,
+    reExecute
   }
 })

+ 64 - 0
src/views/export/index.vue

@@ -0,0 +1,64 @@
+<template>
+  <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-table :data="list" :fields="fields" @query="search" :total="total" :opera="opera" @reExecute="reExecute" @download="download" height="75vh"> </custom-table>
+  </div>
+</template>
+<script setup>
+import { ExportConfigStore } from '@/store/api/exportConfig'
+import { get } from 'lodash-es'
+import { onMounted } from 'vue'
+const { t } = useI18n()
+const store = ExportConfigStore()
+const dialogShow = ref(false)
+const loading = ref(false)
+const $checkRes = inject('$checkRes')
+const searchForm = ref({})
+const list = ref([])
+let skip = 0
+let limit = inject('limit')
+const tabs = ref('1')
+onMounted(async () => {
+  loading.value = true
+  await search({ skip, limit })
+  loading.value = false
+})
+const search = async (query = { skip, limit }) => {
+  skip = query.skip
+  limit = query.limit
+  const info = { skip: query.skip, limit: query.limit, ...searchForm.value }
+  const res = await store.query(info)
+  if ($checkRes(res)) {
+    list.value = res.data
+    total.value = res.total
+  }
+}
+
+const total = ref(0)
+const fields = [
+  { label: t('pages.export.user'), model: 'user_name' }, // , isSearch: true
+  { label: t('pages.export.user_type'), model: 'user_type_name' },
+  { label: t('pages.export.progress'), model: 'progress' }
+]
+const opera = [
+  { label: t('pages.export.reExecute'), method: 'reExecute', confirm: true },
+  { label: t('pages.export.download'), method: 'download', display: (i) => i.uri }
+]
+
+const reExecute = async (data) => {
+  console.log(data)
+  const id = get(data, 'id')
+  const result = await store.reExecute(id)
+  if ($checkRes(result, true, result.errmsg)) search({ skip, limit })
+}
+const download = (data) => {
+  const uri = get(data, 'uri')
+  window.open(uri)
+}
+
+const toReset = async () => {
+  searchForm.value = {}
+  await search({ skip, limit })
+}
+</script>
+<style scoped lang="scss"></style>