瀏覽代碼

通知功能优化

songxy 1 年之前
父節點
當前提交
d10fbd2c0f

+ 0 - 1
client/src/layout/components/AppView.vue

@@ -4,7 +4,6 @@ import { useAppStore } from '@/store/modules/app'
 import { Footer } from '@/layout/components/Footer'
 
 defineOptions({ name: 'AppView' })
-
 const appStore = useAppStore()
 
 const layout = computed(() => appStore.getLayout)

+ 20 - 3
client/src/router/modules/remaining.ts

@@ -160,12 +160,21 @@ const remainingRouter: AppRouteRecordRaw[] = [
           title: '新闻详情'
         }
       },
+      {
+        path: 'noticeAdd',
+        component: () => import('@/views/OaSystem/officeCenter/noticeAndLearn/addoreditor.vue'),
+        name: 'noticeAdd',
+        meta: {
+          title: '通知公告新增'
+        }
+      },
       {
         path: 'noticeEditor',
-        component: () => import('@/views/OaSystem/officeCenter/noticeAndLearn/editor.vue'),
+        component: () => import('@/views/OaSystem/officeCenter/noticeAndLearn/addoreditor.vue'),
         name: 'noticeEditor',
         meta: {
-          title: '通知公告编辑'
+          title: '通知公告编辑',
+          keepAlive: false
         }
       },
       {
@@ -176,9 +185,17 @@ const remainingRouter: AppRouteRecordRaw[] = [
           title: '通知公告详情'
         }
       },
+      {
+        path: 'learnCenterAdd',
+        component: () => import('@/views/OaSystem/officeCenter/noticeAndLearn/addoreditor.vue'),
+        name: 'learnCenterAdd',
+        meta: {
+          title: '学习中心新增'
+        }
+      },
       {
         path: 'learnCenterEditor',
-        component: () => import('@/views/OaSystem/officeCenter/noticeAndLearn/editor.vue'),
+        component: () => import('@/views/OaSystem/officeCenter/noticeAndLearn/addoreditor.vue'),
         name: 'learnCenterEditor',
         meta: {
           title: '学习中心编辑'

+ 1 - 1
client/src/views/OaSystem/officeCenter/learnCenter/index.vue

@@ -148,7 +148,7 @@ const onAddEditorHandle = (idStr = null): void => {
       query: { id: idStr } as { id: number }
     })
   } else {
-    router.push('/learnCenterEditor')
+    router.push('/learnCenterAdd')
   }
 }
 const toLookDetail = (row: any): void => {

+ 1 - 1
client/src/views/OaSystem/officeCenter/notice/index.vue

@@ -147,7 +147,7 @@ const onAddEditorHandle = (idStr = null): void => {
       query: { id: idStr } as { id: number }
     })
   } else {
-    router.push('/noticeEditor')
+    router.push('/noticeAdd')
   }
 }
 const toLookDetail = (row: any): void => {

+ 0 - 197
client/src/views/OaSystem/officeCenter/noticeAndLearn/editor.vue

@@ -1,197 +0,0 @@
-<template>
-  <div class="newsSettingBox">
-    <el-form ref="ruleFormRef" :model="formData" :rules="rules" label-width="120px">
-      <el-form-item label="标题" prop="title">
-        <el-input v-model="formData.title" placeholder="请输入标题" />
-      </el-form-item>
-      <el-form-item label="附件">
-        <div class="uploadFileBox">
-          <span>
-            <el-button type="primary" @click="uploadHandle">上传</el-button>
-            <input type="file" style="display: none" ref="fileRef" @change="fileChangeHandle" />
-          </span>
-          <ul class="prviewFile">
-            <li v-for="(item, index) in fileUrls" :key="index">
-              <span>
-                <a href="javascript:void(0);" @click="downloadFile(item['url'])">{{
-                  item['name']
-                }}</a>
-              </span>
-              <el-button
-                type="text"
-                @click="
-                  deleteFile(item['id'], () => {
-                    ElMessage.success('文件删除成功!')
-                  })
-                "
-                >删除</el-button
-              >
-            </li>
-          </ul>
-        </div>
-      </el-form-item>
-      <el-form-item label="内容">
-        <Tinymce v-model="formData.content" width="100%" height="800px" />
-      </el-form-item>
-    </el-form>
-    <div class="btnGroup" style="text-align: right">
-      <span>
-        <el-button type="primary" @click="onSubmit(ruleFormRef)">保存</el-button>
-      </span>
-      <el-button @click="router.back()">取消</el-button>
-    </div>
-  </div>
-</template>
-
-<script setup lang="ts">
-import { useRoute } from 'vue-router'
-import { ElMessage, FormRules, FormInstance } from 'element-plus'
-import request from '@/config/axios'
-import router from '@/router'
-import { useFiles } from './mixins.ts'
-
-const { fileUrls, downloadFile, queryFiles, uploadFile, deleteFile } = useFiles(request)
-
-const route = useRoute()
-const initFormData: any = {
-  id: null,
-  title: '',
-  type: route.name === 'noticeEditor' ? 1 : 2,
-  studyType: null,
-  files: '',
-  userId: '',
-  nickname: '',
-  content: ''
-}
-const formData = ref(initFormData)
-/**
- * 获取详情
- * **/
-async function queryDetailById(idStr: any): Promise<void> {
-  const urlApi = `/adm/noticeAndLearn/query/detailById`
-  const params = {
-    id: idStr
-  }
-  const result = await request.get({ url: urlApi, params })
-  if (result) {
-    formData.value = result
-    queryFiles(result.files)
-  }
-}
-const ruleFormRef = ref<FormInstance>()
-const rules = reactive<
-  FormRules<{
-    title: string
-    content: string
-  }>
->({
-  title: {
-    required: true,
-    message: '标题不能为空! ',
-    trigger: 'change'
-  },
-  content: {
-    required: true,
-    message: '内容不能为空! ',
-    trigger: 'change'
-  }
-})
-const eTypeRef = ref<string>('add')
-function restForm() {
-  formData.value = initFormData
-}
-function onSubmit(formEl: FormInstance | undefined, num?: number): void {
-  if (!formEl) return
-  formEl.validate((valid, fields: any) => {
-    if (valid) {
-      let urlApi: string = ''
-      const sendData = {
-        ...formData.value
-      }
-      if (fileUrls.value.length > 0) {
-        sendData.files = fileUrls.value.map((item) => item.id).join(',')
-      }
-      if (eTypeRef.value === 'add') {
-        urlApi = '/adm/noticeAndLearn/add'
-      } else {
-        urlApi = '/adm/noticeAndLearn/update'
-      }
-      request.post({ url: urlApi, data: sendData }).then((result) => {
-        if (result) {
-          ElMessage({
-            showClose: true,
-            message: '保存成功.',
-            type: 'success'
-          })
-          if (num !== 0) {
-            const timer = setTimeout(() => {
-              clearTimeout(timer)
-              router.back()
-            })
-          }
-        }
-      })
-    } else {
-      const keys = Object.keys(fields)
-      ElMessage.error(fields[keys[0]][0]['message'])
-    }
-  })
-}
-const fileRef = ref()
-function uploadHandle() {
-  fileRef.value.click()
-}
-function fileChangeHandle(evt) {
-  const target = evt.target
-  uploadFile(target.files[0])
-}
-const query = route.query
-if (query.id) {
-  eTypeRef.value = 'edit'
-  queryDetailById(query.id)
-} else {
-  alert(1)
-  restForm()
-}
-</script>
-
-<style lang="scss" scoped>
-.newsSettingBox {
-  margin-top: 20px;
-  height: calc(100% - 20px);
-  background-color: #fff;
-  border-radius: 20px;
-  padding: 20px;
-  overflow-y: auto;
-  .prviewFile {
-    padding-left: 20px;
-    > li {
-      margin-bottom: 10px;
-      > span {
-        display: inline-block;
-        margin-right: 15px;
-      }
-    }
-  }
-  .switchGroup {
-    display: flex;
-  }
-  .btnGroup {
-    > span {
-      margin-right: 20px;
-    }
-  }
-  .uploadFileBox {
-    position: relative;
-    flex: 1;
-    display: flex;
-  }
-  .preImg {
-    margin-bottom: 20px;
-    margin-left: 120px;
-    > img {
-      width: 200px;
-    }
-  }
-}
-</style>