浏览代码

公共配置

CzRger 1 年之前
父节点
当前提交
b69a172d49

+ 16 - 0
src/api/modules/config.ts

@@ -0,0 +1,16 @@
+import { handle } from '../index'
+
+const suffix = 'api'
+
+//  公共配置 > 获取对应详情
+// 签到管理-签到时间	sign.begin.time
+// 签到管理-签到提醒时间	sign.remind.time
+// 签到管理-签退时间	sign.end.time
+// 日志管理-截止提交时间	log.submit.time
+// 日志管理-日志提交提醒时间	log.remind.time
+// 周报管理-截止提交时间	week.submit.time
+// 周报管理-日志提交提醒时间	week.remind.time
+export const getConfigConfigKey = (key: any) => handle({
+  url: `/${suffix}/config/configKey/${key}`,
+  method: 'get',
+})

+ 3 - 2
src/api/modules/login-log.ts

@@ -8,9 +8,10 @@ export const getLoginLogList = (params: any) => handle({
   method: 'post',
   params
 })
-//  登录日志 > 列表
+//  登录日志 > 导出
 export const loginLogExport = (params: any) => handle({
   url: `/${suffix}/login/log/export`,
   method: 'post',
-  params
+  params,
+  config: {responseType: 'blob'}
 })

+ 16 - 0
src/api/modules/notice.ts

@@ -0,0 +1,16 @@
+import { handle } from '../index'
+
+const suffix = 'api'
+
+//  通知公告 > 列表
+export const getNoticeList = (params: any) => handle({
+  url: `/${suffix}/notice/list`,
+  method: 'post',
+  params
+})
+//  通知公告 > 新增
+export const addNoticeSave = (params: any) => handle({
+  url: `/${suffix}/notice/save`,
+  method: 'post',
+  params
+})

+ 2 - 2
src/router/modules/system.ts

@@ -31,7 +31,7 @@ export const systemRouterMap = new Map([
     component: () => import('@/views/system/dict-manage/index.vue'),
   }],
   ['59848b4b-3ef3-4fa6-be81-6944a663d084', {
-    title: '登日志',
+    title: '登日志',
     component: () => import('@/views/system/login-log/index.vue'),
   }],
   ['a54c0986-4de8-46f4-88cc-94903f103bf9', {
@@ -101,7 +101,7 @@ export const systemRouter: any = {
       menuCode: '59848b4b-3ef3-4fa6-be81-6944a663d084',
       path: 'login-log',
       meta: {
-        title: '登日志'
+        title: '登日志'
       },
     },
     {

+ 2 - 0
src/store/modules/dictionary-define.ts

@@ -1,6 +1,8 @@
 export const dictionaryDefine = {
 	//接口参数 : [ '字典数据下拉', '字典数据直接翻译', '字典数据翻译对象' ],
 	login_status: ['loginStatusList', 'loginStatusMap', 'loginStatusObjMap'], //	登录日志-登录状态
+	notice_type: ['noticeTypeList', 'noticeTypeMap', 'noticeTypeObjMap'], //	通知公告-消息类型
+	notice_status: ['noticeStatusList', 'noticeStatusMap', 'noticeStatusObjMap'], //	通知公告-消息状态
 }
 
 const stateMap = {}

+ 10 - 2
src/utils/downLoadUrl.ts

@@ -1,4 +1,4 @@
-export function downLoadUrl(url, name) {
+export const downLoadUrl = (url, name) => {
   const a = document.createElement("a");
   fetch(url)
     .then((res) => res.blob())
@@ -8,4 +8,12 @@ export function downLoadUrl(url, name) {
       document.body.appendChild(a);
       a.click();
     });
-}
+}
+
+export const downLoadBlob = (data, name) => {
+  let b = new Blob([data], { type: data.type })
+  let link = document.createElement('a')
+  link.href = window.URL.createObjectURL(b)
+  link.download = name
+  link.click()
+}

+ 22 - 27
src/views/system/login-log/index.vue

@@ -17,7 +17,7 @@
                 v-model:param="queryForm.deptId"
                 :options="$store.state.dictionary.deptList"/>
             <CusFormColumn
-                label="登时间:"
+                label="登时间:"
                 link="datetime"
                 type="datetimerange"
                 v-model:param="queryForm.loginDate"/>
@@ -59,7 +59,6 @@
               :pageSize="queryPage.pageSize"
               v-model:selected="selected"
               @handlePage="handlePage"
-              @handleSort="handleSort"
           >
             <template #loginTime-column-value="{ scope }">
               {{scope.row.loginTime ? $util.YMDHms(scope.row.loginTime) : scope.row.loginTime}}
@@ -93,7 +92,7 @@ import {
 import {useStore} from 'vuex'
 import {useRouter, useRoute} from 'vue-router'
 import { ElMessage } from 'element-plus';
-import {getLoginLogList, loginLogExport} from "@/api/modules/login-log";
+import {downLoadBlob} from "@/utils/downLoadUrl";
 
 export default defineComponent({
   name: '',
@@ -120,15 +119,13 @@ export default defineComponent({
       queryForm: <any>{},
       //  查询表单参数备份
       back_queryForm: {},
-      //  查询表格排序
-      querySort: {},
       //  表格表头
       tableHead: [
         {value: "userName", label: "账号", show: true},
         {value: "deptName", label: "单位", show: true},
-        {value: "loginTime", label: "登陆时间", show: true},
+        {value: "loginTime", label: "登录时间", show: true, width: 180},
         {value: "status", label: "状态", show: true},
-        {value: "exitTime", label: "注销时间", show: true},
+        {value: "exitTime", label: "注销时间", show: true, width: 180},
         {value: "ipaddr", label: "设备IP", show: true},
         {value: "browser", label: "浏览器", show: true},
         {value: "duration", label: "时长", show: true},
@@ -147,11 +144,6 @@ export default defineComponent({
       state.queryPage.pageSize = pageSize
       handleSearch(page, pageSize)
     }
-    //  查询排序参数改变处理方法
-    const handleSort = ({key, value}: any) => {
-      state.querySort = key ? {key: value} : {}
-      handleSearch()
-    }
     //  重置查询表单方法
     const handleReset = () => {
       state.queryForm = {}
@@ -203,23 +195,27 @@ export default defineComponent({
       const queryParams: any = {
       }
       if (state.selected.length > 0) {
-
-      }
-      //  添加表单参数
-      for (const [k, v] of Object.entries(state.back_queryForm)) {
-        if (that.$util.isValue(v)) {
-          if (k === 'loginDate') {
-            queryParams['bloginTime'] = v[0]
-            queryParams['eloginTime'] = v[1]
-          } else if (k === 'exitDate') {
-            queryParams['bexitTime'] = v[0]
-            queryParams['eexitTime'] = v[1]
-          } else {
-            queryParams[k] = v
+        queryParams['ids'] = state.selected.map(v => v.id)
+      } else {
+        //  添加表单参数
+        for (const [k, v] of Object.entries(state.back_queryForm)) {
+          if (that.$util.isValue(v)) {
+            if (k === 'loginDate') {
+              queryParams['bloginTime'] = v[0]
+              queryParams['eloginTime'] = v[1]
+            } else if (k === 'exitDate') {
+              queryParams['bexitTime'] = v[0]
+              queryParams['eexitTime'] = v[1]
+            } else {
+              queryParams[k] = v
+            }
           }
         }
       }
-      that.$api.loginLogExport(queryParams)
+      that.$api.loginLogExport(queryParams).then(res => {
+        downLoadBlob(res, '登录日志.xlsx')
+        console.log(res)
+      })
     }
     onMounted(() => {
       state.back_queryForm = JSON.parse(JSON.stringify(state.queryForm))
@@ -231,7 +227,6 @@ export default defineComponent({
       ...toRefs(state),
       handleSearch,
       handlePage,
-      handleSort,
       handleReset,
       onSearch,
       onExport,

+ 49 - 73
src/views/system/notice-announcement/index.vue

@@ -10,43 +10,30 @@
           <CusForm labelWidth="100px" @handleEnter="onSearch">
             <CusFormColumn
                 label="标题:"
-                v-model:param="queryForm.shipId"/>
+                v-model:param="queryForm.title"/>
             <CusFormColumn
                 label="发布单位:"
-                link="dept"
-                v-model:param="queryForm.shipId"/>
+                link="select"
+                v-model:param="queryForm.deptId"
+                :options="$store.state.dictionary.deptList"/>
             <CusFormColumn
                 label="发布人:"
-                v-model:param="queryForm.shipId"/>
+                v-model:param="queryForm.publisher"/>
             <CusFormColumn
                 label="发布时间:"
                 link="datetime"
                 type="datetimerange"
-                v-model:param="queryForm.shipId"/>
+                v-model:param="queryForm.publishDate"/>
             <CusFormColumn
                 label="类型:"
                 link="select"
-                static
-                v-model:param="queryForm.shipId"
-                labelKey="label"
-                valueKey="value"
-                :options="[
-                    {label: '类型一', value: '1'},
-                    {label: '类型二', value: '2'},
-                    {label: '类型三', value: '3'},
-                ]"/>
+                v-model:param="queryForm.type"
+                :options="$store.state.dictionary.noticeTypeList"/>
             <CusFormColumn
                 label="状态:"
                 link="select"
-                static
-                v-model:param="queryForm.shipId"
-                labelKey="label"
-                valueKey="value"
-                :options="[
-                    {label: '类型一', value: '1'},
-                    {label: '类型二', value: '2'},
-                    {label: '类型三', value: '3'},
-                ]"/>
+                v-model:param="queryForm.status"
+                :options="$store.state.dictionary.noticeStatusList"/>
             <CusSearchButtons
                 @handleReset="handleReset"
                 @handleSearch="onSearch"
@@ -68,8 +55,16 @@
               :page="queryPage.pageNum"
               :pageSize="queryPage.pageSize"
               @handlePage="handlePage"
-              @handleSort="handleSort"
           >
+            <template #publishTime-column-value="{ scope }">
+              {{scope.row.publishTime ? $util.YMDHms(scope.row.publishTime) : scope.row.publishTime}}
+            </template>
+            <template #type-column-value="{ scope }">
+              {{$store.state.dictionary.noticeTypeMap.get(scope.row.type) || scope.row.type}}
+            </template>
+            <template #status-column-value="{ scope }">
+              {{$store.state.dictionary.noticeStatusMap.get(scope.row.status) || scope.row.status}}
+            </template>
             <template #do-column-value="{ scope }">
               <div class="__cus-table_do">
                 <div class="__cus-table_do-green __hover" @click="onView(scope.row)">
@@ -110,6 +105,8 @@ import {
 import {useStore} from 'vuex'
 import {useRouter, useRoute} from 'vue-router'
 import DetailCom from './detail.vue'
+import {getNoticeList} from "@/api/modules/notice";
+import { ElMessage } from 'element-plus';
 
 export default defineComponent({
   name: '',
@@ -138,16 +135,14 @@ export default defineComponent({
       queryForm: <any>{},
       //  查询表单参数备份
       back_queryForm: {},
-      //  查询表格排序
-      querySort: {},
       //  表格表头
       tableHead: [
-        {value: "p1", label: "标题", show: true},
-        {value: "p1", label: "发布单位", show: true},
-        {value: "p1", label: "发布人", show: true},
-        {value: "p1", label: "发布时间", show: true},
-        {value: "p1", label: "类型", show: true},
-        {value: "p1", label: "状态", show: true},
+        {value: "title", label: "标题", show: true},
+        {value: "deptName", label: "发布单位", show: true},
+        {value: "publisher", label: "发布人", show: true},
+        {value: "publishTime", label: "发布时间", show: true, width: 180},
+        {value: "type", label: "类型", show: true},
+        {value: "status", label: "状态", show: true},
         {value: "do", label: "操作", show: true, width: 260},
       ],
       showDetail: false,
@@ -156,6 +151,9 @@ export default defineComponent({
     const ref_cusTable = ref()
     //  获取字典
     const initDictionary = () => {
+      store.dispatch('dictionary/LOAD_DEPT')
+      store.dispatch('dictionary/LOAD_DICT_LIST', 'notice_type')
+      store.dispatch('dictionary/LOAD_DICT_LIST', 'notice_status')
     }
     //  查询分页参数改变处理方法
     const handlePage = ({page, pageSize}: any) => {
@@ -163,11 +161,6 @@ export default defineComponent({
       state.queryPage.pageSize = pageSize
       handleSearch(page, pageSize)
     }
-    //  查询排序参数改变处理方法
-    const handleSort = ({key, value}: any) => {
-      state.querySort = key ? {key: value} : {}
-      handleSearch()
-    }
     //  重置查询表单方法
     const handleReset = () => {
       state.queryForm = {}
@@ -180,46 +173,30 @@ export default defineComponent({
       const queryParams: any = {
         pageNum: page,
         pageSize: pageSize,
-        sort: {},
-        text: ''
-      }
-      //  添加排序参数
-      for (const [k, v] of Object.entries(state.querySort)) {
-        that.$util.isValue(v) ? (queryParams.sort[k] = v) : null;
       }
       //  添加表单参数
       for (const [k, v] of Object.entries(state.back_queryForm)) {
-        that.$util.isValue(v) ? (queryParams[k] = v) : null;
+        if (that.$util.isValue(v)) {
+          if (k === 'publishDate') {
+            queryParams['bTime'] = v[0]
+            queryParams['eTime'] = v[1]
+          } else {
+            queryParams[k] = v
+          }
+        }
       }
-      //  添加复合查询参数
       state.loading = true
-
-      // mock
-      const arr: any = []
-      for (let i = 0; i < 77; i++) {
-        arr.push({
-          p1: '阿三顶顶顶顶顶顶顶顶顶顶顶顶顶' + i,
-          fileList: [
-            { "url": "http://8.140.240.182:18085/profile/upload/2023/10/23/6b7bf3b4-592a-4e2f-ba92-11923671ce3b.doc", "name": "迁移案例.doc"},
-          ],
-        })
-      }
-      state.queryResult.tableData = arr
-      state.queryResult.total = arr.length
-      state.loading = false
-      // that.$api.patrolBoatList(that.$util.formatGetParam(queryParams)).then((res: { code: number; rows: never[]; total: number; }) => {
-      //   if (res.code === 200) {
-      //     state.queryResult.tableData = res.rows
-      //     state.queryResult.total = res.total
-      //   }
-      //   setTimeout(() => {
-      //     state.loading = false
-      //   }, 1000)
-      // }).catch(() => {
-      //   setTimeout(() => {
-      //     state.loading = false
-      //   }, 1000)
-      // })
+      that.$api.getNoticeList(queryParams).then((res: any) => {
+        if (res.code === 200) {
+          state.queryResult.tableData = res.rows
+          state.queryResult.total = res.total
+        } else {
+          ElMessage.error(res.message)
+        }
+        state.loading = false
+      }).catch(() => {
+        state.loading = false
+      })
     }
     //  点击查询按钮后
     const onSearch = () => {
@@ -258,7 +235,6 @@ export default defineComponent({
       ...toRefs(state),
       handleSearch,
       handlePage,
-      handleSort,
       handleReset,
       onSearch,
       onAdd,

+ 64 - 17
src/views/system/public-configuration/index.vue

@@ -9,22 +9,22 @@
         <div class="block-content">
           <div class="item">
             <div class="item-label">签到时间:</div>
-            <div class="item-form">
+            <div class="item-form" v-loading="loading['sign.begin.time']">
               <CusFormColumn
                   :span="24"
                   link="time"
-                  v-model:param="signForm.p1"
+                  v-model:param="form['sign.begin.time']"
                   :clearable="false"/>
             </div>
           </div>
           <div class="item">
             <div class="item-label">签到提醒时间:</div>
-            <div class="item-form">
+            <div class="item-form" v-loading="loading['sign.remind.time']">
               <CusFormColumn
                   :span="24"
                   link="select"
                   static
-                  v-model:param="signForm.p2"
+                  v-model:param="form['sign.remind.time']"
                   labelKey="label"
                   valueKey="value"
                   :options="[
@@ -37,11 +37,11 @@
           </div>
           <div class="item">
             <div class="item-label">签退时间:</div>
-            <div class="item-form">
+            <div class="item-form" v-loading="loading['sign.end.time']">
               <CusFormColumn
                   :span="24"
                   link="time"
-                  v-model:param="signForm.p3"
+                  v-model:param="form['sign.end.time']"
                   :clearable="false"/>
             </div>
           </div>
@@ -55,22 +55,22 @@
         <div class="block-content">
           <div class="item">
             <div class="item-label">截止提交时间:</div>
-            <div class="item-form">
+            <div class="item-form" v-loading="loading['log.submit.time']">
               <CusFormColumn
                   :span="24"
                   link="time"
-                  v-model:param="dailyForm.p1"
+                  v-model:param="form['log.submit.time']"
                   :clearable="false"/>
             </div>
           </div>
           <div class="item">
             <div class="item-label">日志提交提醒时间:</div>
-            <div class="item-form">
+            <div class="item-form" v-loading="loading['log.remind.time']">
               <CusFormColumn
                   :span="24"
                   link="select"
                   static
-                  v-model:param="dailyForm.p2"
+                  v-model:param="form['log.remind.time']"
                   labelKey="label"
                   valueKey="value"
                   :options="[
@@ -92,12 +92,12 @@
           <div class="item">
             <div class="item-label">截止提交时间:</div>
             <div class="item-form">
-              <div class="col">
+              <div class="col" v-loading="loading['week.submit.date']">
                 <CusFormColumn
                     :span="24"
                     link="select"
                     static
-                    v-model:param="weeklyForm.p1"
+                    v-model:param="form['week.submit.date']"
                     labelKey="label"
                     valueKey="value"
                     :options="[
@@ -107,23 +107,23 @@
                     ]"
                     :clearable="false"/>
               </div>
-             <div class="col">
+             <div class="col" v-loading="loading['week.submit.time']">
                <CusFormColumn
                    :span="24"
                    link="time"
-                   v-model:param="weeklyForm.p2"
+                   v-model:param="form['week.submit.time']"
                    :clearable="false"/>
              </div>
             </div>
           </div>
           <div class="item">
             <div class="item-label">周报提交提醒时间:</div>
-            <div class="item-form">
+            <div class="item-form" v-loading="loading['week.remind.time']">
               <CusFormColumn
                   :span="24"
                   link="select"
                   static
-                  v-model:param="weeklyForm.p3"
+                  v-model:param="form['week.remind.time']"
                   labelKey="label"
                   valueKey="value"
                   :options="[
@@ -155,6 +155,8 @@ import {
 } from 'vue'
 import {useStore} from 'vuex'
 import {useRouter, useRoute} from 'vue-router'
+import {getConfigConfigKey} from "@/api/modules/config";
+import { ElMessage } from 'element-plus';
 
 export default defineComponent({
   name: '',
@@ -165,9 +167,54 @@ export default defineComponent({
     const route = useRoute();
     const that = (getCurrentInstance() as ComponentInternalInstance).appContext.config.globalProperties
     const state = reactive({
-      signForm: {},
+      form: {
+        'sign.begin.time': '',
+        'sign.remind.time': '',
+        'sign.end.time': '',
+        'log.submit.time': '',
+        'log.remind.time': '',
+        'week.submit.date': '',
+        'week.submit.time': '',
+        'week.remind.time': '',
+      },
+      signForm: {
+      },
       dailyForm: {},
       weeklyForm: {},
+      loading: {
+        'sign.begin.time': false,
+        'sign.remind.time': false,
+        'sign.end.time': false,
+        'log.submit.time': false,
+        'log.remind.time': false,
+        'week.submit.date': false,
+        'week.submit.time': false,
+        'week.remind.time': false,
+      }
+    })
+    const initKey = (key) => {
+      state.loading[key] = true
+      state.form[key] = ''
+      that.$api.getConfigConfigKey(key).then(res => {
+        if (res.code === 200) {
+          state.form[key] = res.message
+        } else {
+          ElMessage.error(res.message)
+        }
+        state.loading[key] = false
+      }).catch(() => {
+        state.loading[key] = false
+      })
+    }
+    onMounted(() => {
+      initKey('sign.begin.time')
+      initKey('sign.remind.time')
+      initKey('sign.end.time')
+      initKey('log.submit.time')
+      initKey('log.remind.time')
+      initKey('week.submit.date')
+      initKey('week.submit.time')
+      initKey('week.remind.time')
     })
     return {
       ...toRefs(state)