CzRger 1 gadu atpakaļ
vecāks
revīzija
17e7d76441

+ 2 - 1
src/api/interceptors.ts

@@ -41,7 +41,8 @@ export class Interceptors {
       // 请求成功
       // 请求成功
       (res: any) => {
       (res: any) => {
         if (res.status === 200) {
         if (res.status === 200) {
-          if (res.data?.status === 500) {
+          //
+          if (res.data?.code === 402) {
             ElMessage.warning(res.data.message)
             ElMessage.warning(res.data.message)
             sessionStorage.removeItem('sg_token')
             sessionStorage.removeItem('sg_token')
             toLogin()
             toLogin()

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

@@ -0,0 +1,16 @@
+import { handle } from '../index'
+
+const suffix = 'api'
+// 文件上传
+export const commonUpload = (params: any) => handle({
+  url: `/${suffix}/common/upload`,
+  method: 'post',
+  params,
+})
+// 文件下载
+export const commonDownload = (params: any) => handle({
+  url: `/${suffix}/common/download`,
+  method: 'get',
+  params,
+  config: {responseType: 'blob'}
+})

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

@@ -14,3 +14,27 @@ export const addNoticeSave = (params: any) => handle({
   method: 'post',
   method: 'post',
   params
   params
 })
 })
+//  通知公告 > 编辑
+export const editNoticeEdit = (params: any) => handle({
+  url: `/${suffix}/notice/edit`,
+  method: 'put',
+  params
+})
+//  通知公告 > 查看
+export const getNoticeSearch = (params: any) => handle({
+  url: `/${suffix}/notice/search`,
+  method: 'get',
+  params
+})
+//  通知公告 > 发布
+export const getNoticePublish = (params: any) => handle({
+  url: `/${suffix}/notice/publish`,
+  method: 'get',
+  params
+})
+//  通知公告 > 撤回
+export const getNoticeRevoke = (params: any) => handle({
+  url: `/${suffix}/notice/revoke`,
+  method: 'get',
+  params
+})

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 10 - 0
src/assets/svg/back.svg


+ 41 - 19
src/components/cus/cus-form-link/upload.vue

@@ -38,7 +38,8 @@
           <el-tooltip placement="top" :content="file[nameKey] ?? file[urlKey]">
           <el-tooltip placement="top" :content="file[nameKey] ?? file[urlKey]">
             <div class="upload-layout-card_item" :class="{'item-view': isViewCpt || !delRule(file)}" @mouseenter="file.hover = true" @mouseleave="file.hover = false">
             <div class="upload-layout-card_item" :class="{'item-view': isViewCpt || !delRule(file)}" @mouseenter="file.hover = true" @mouseleave="file.hover = false">
               <template v-if="validImgByUrl(file[urlKey])">
               <template v-if="validImgByUrl(file[urlKey])">
-                <img class="img __hover" :src="$util.proxyNginxUrl(file[urlKey])" @click="viewImg(file[urlKey])"/>
+                <img class="img __hover" :src="$util.proxyNginxUrl(file[urlKey])" @click="downloadFileByUrl(file[urlKey])"/>
+<!--                <img class="img __hover" :src="$util.proxyNginxUrl(file[urlKey])" @click="viewImg(file[urlKey])"/>-->
               </template>
               </template>
               <template v-else-if="validVideoByUrl(file[urlKey])">
               <template v-else-if="validVideoByUrl(file[urlKey])">
                 <video class="video __hover" controls :src="$util.proxyNginxUrl(file[urlKey])"/>
                 <video class="video __hover" controls :src="$util.proxyNginxUrl(file[urlKey])"/>
@@ -51,7 +52,8 @@
           </el-tooltip>
           </el-tooltip>
         </template>
         </template>
         <template v-else>
         <template v-else>
-          <div class="upload-layout-list_item __hover" :class="{'item-view': isViewCpt || !delRule(file)}" @click="validImgByUrl(file[urlKey]) ? viewImg(file[urlKey]) : downloadFileByUrl(file[urlKey], file[nameKey])">
+<!--          <div class="upload-layout-list_item __hover" :class="{'item-view': isViewCpt || !delRule(file)}" @click="validImgByUrl(file[urlKey]) ? viewImg(file[urlKey]) : downloadFileByUrl(file[urlKey], file[nameKey])">-->
+          <div class="upload-layout-list_item __hover" :class="{'item-view': isViewCpt || !delRule(file)}" @click="downloadFileByUrl(file[urlKey], file[nameKey])">
             <img class="file-type-img" :src="getFileImgByUrl(file[urlKey])"/>
             <img class="file-type-img" :src="getFileImgByUrl(file[urlKey])"/>
             <CusEllipsis v-if="file[nameKey] ?? file[urlKey]" class="label" :value="file[nameKey] ?? file[urlKey]"/>
             <CusEllipsis v-if="file[nameKey] ?? file[urlKey]" class="label" :value="file[nameKey] ?? file[urlKey]"/>
             <SvgIcon v-if="!isViewCpt && delRule(file)" class="close" name="close_2" size="12" @click.stop="ref_upload.handleRemove(file)"/>
             <SvgIcon v-if="!isViewCpt && delRule(file)" class="close" name="close_2" size="12" @click.stop="ref_upload.handleRemove(file)"/>
@@ -95,6 +97,7 @@ import FileRARImg from '@/assets/images/file-type/file-type_rar.png'
 import FileTXTImg from '@/assets/images/file-type/file-type_txt.png'
 import FileTXTImg from '@/assets/images/file-type/file-type_txt.png'
 import FileWORDImg from '@/assets/images/file-type/file-type_word.png'
 import FileWORDImg from '@/assets/images/file-type/file-type_word.png'
 import FileEXCELImg from '@/assets/images/file-type/file-type_excel.png'
 import FileEXCELImg from '@/assets/images/file-type/file-type_excel.png'
+import {downLoadBlob} from "@/utils/downLoadUrl";
 
 
 export default defineComponent({
 export default defineComponent({
   name: '',
   name: '',
@@ -265,7 +268,7 @@ export default defineComponent({
       return file
       return file
     }
     }
     const handleRequest = async (options) => {
     const handleRequest = async (options) => {
-      // state.loading = true
+      state.loading = true
       if (that.$util.isValue(props.acceptType)) {
       if (that.$util.isValue(props.acceptType)) {
         const result: any = await props.acceptFunc(options)
         const result: any = await props.acceptFunc(options)
         if (result?.[props.urlKey] && result?.[props.nameKey]) {
         if (result?.[props.urlKey] && result?.[props.nameKey]) {
@@ -275,6 +278,19 @@ export default defineComponent({
         }
         }
         state.loading = false
         state.loading = false
       } else {
       } else {
+        const formData = new FormData();
+        formData.append("fileList", options.file);
+        that.$api.commonUpload(formData).then(res => {
+          if (res?.code === 200) {
+            state.paramVal = [...state.paramVal, {
+              [props.urlKey]: res.data[0],
+              [props.nameKey]: options.file.name
+            }]
+          }
+          state.loading = false
+        }).catch(() => {
+          state.loading = false
+        })
         // if (store.state.app.uploadConfig.imgType.split(',').some(v => options.file.name.includes(v))) {
         // if (store.state.app.uploadConfig.imgType.split(',').some(v => options.file.name.includes(v))) {
         //   const formData = new FormData();
         //   const formData = new FormData();
         //   formData.append("file", options.file);
         //   formData.append("file", options.file);
@@ -334,24 +350,30 @@ export default defineComponent({
     }
     }
     const downloadFileByUrl = (url, name) => {
     const downloadFileByUrl = (url, name) => {
       ElMessage.info('开始下载!')
       ElMessage.info('开始下载!')
-      const xhr = new XMLHttpRequest();
-      xhr.open('GET', url, true);
-      xhr.responseType = 'blob';
-      xhr.onload = function () {
-        if (xhr.status === 200) {
-          const blob = xhr.response;
-          const url = window.URL.createObjectURL(blob);
-          const a = document.createElement('a');
-          a.href = url;
-          a.download = name || 'default';
-          a.click();
-          ElMessage.success('下载成功!')
-          window.URL.revokeObjectURL(url);
-        }
-      };
-      xhr.send();
+      that.$api.commonDownload({filePath: url}).then(res => {
+        downLoadBlob(res, name)
+      }).catch(() => {
+        ElMessage.error('下载失败!')
+      })
+      // const xhr = new XMLHttpRequest();
+      // xhr.open('GET', url, true);
+      // xhr.responseType = 'blob';
+      // xhr.onload = function () {
+      //   if (xhr.status === 200) {
+      //     const blob = xhr.response;
+      //     const url = window.URL.createObjectURL(blob);
+      //     const a = document.createElement('a');
+      //     a.href = url;
+      //     a.download = name || 'default';
+      //     a.click();
+      //     ElMessage.success('下载成功!')
+      //     window.URL.revokeObjectURL(url);
+      //   }
+      // };
+      // xhr.send();
     }
     }
     const viewImg = (url) => {
     const viewImg = (url) => {
+      console.log(url)
       state.currentImg.url = url
       state.currentImg.url = url
       state.currentImg.show = true
       state.currentImg.show = true
     }
     }

+ 13 - 1
src/style/cus.scss

@@ -353,7 +353,19 @@
     }
     }
   }
   }
 }
 }
-
+.__cus-table_column-view {
+  color: #2EB8FF;
+  width: 100%;
+  display: block;
+  >span {
+    display: block;
+    width: 100%;
+    white-space: nowrap;
+    overflow: hidden;
+    text-overflow: ellipsis;
+    word-break: break-all;
+  }
+}
 // 确认小弹窗
 // 确认小弹窗
 .is-message-box {
 .is-message-box {
   .el-overlay-message-box {
   .el-overlay-message-box {

+ 34 - 14
src/views/staging/zbgly/right/notice-com.vue

@@ -3,12 +3,12 @@
     <template #title>
     <template #title>
       <div class="more __hover" @click="$router.push({name: 'fc9664b6-69f3-4dc8-bedb-a391fdc3a0db'})">查看更多》</div>
       <div class="more __hover" @click="$router.push({name: 'fc9664b6-69f3-4dc8-bedb-a391fdc3a0db'})">查看更多》</div>
     </template>
     </template>
-    <div class="list">
+    <div class="list" v-loading="loading">
       <template v-for="item in list">
       <template v-for="item in list">
         <div class="item __hover" @click="onView(item)">
         <div class="item __hover" @click="onView(item)">
-          <div class="type" :class="`type-${item.type}`">{{item.type === 1 ? '消息' : '通知'}}</div>
+          <div class="type" :class="`type-${item.type}`">{{item.type === '1' ? '通知' : '消息'}}</div>
           <div class="title __text-ellipsis">{{item.title}}</div>
           <div class="title __text-ellipsis">{{item.title}}</div>
-          <div class="time">{{Handle.formatDate(item.time)}}</div>
+          <div class="time">{{Handle.formatDate(item.publishTime)}}</div>
         </div>
         </div>
       </template>
       </template>
     </div>
     </div>
@@ -27,13 +27,14 @@ import {
   getCurrentInstance,
   getCurrentInstance,
   ComponentInternalInstance,
   ComponentInternalInstance,
   toRefs,
   toRefs,
-  nextTick
+  nextTick, onActivated
 } from 'vue'
 } from 'vue'
 import {useStore} from 'vuex'
 import {useStore} from 'vuex'
 import {useRouter, useRoute} from 'vue-router'
 import {useRouter, useRoute} from 'vue-router'
 import BaseBlockCom from '../../common/base-block.vue'
 import BaseBlockCom from '../../common/base-block.vue'
 import * as Handle from '../../common/handle'
 import * as Handle from '../../common/handle'
 import NoticeDetailCom from '@/views/system/notice-announcement/detail.vue'
 import NoticeDetailCom from '@/views/system/notice-announcement/detail.vue'
+import {ElMessage} from "element-plus";
 
 
 export default defineComponent({
 export default defineComponent({
   name: '',
   name: '',
@@ -48,17 +49,10 @@ export default defineComponent({
     const that = (getCurrentInstance() as ComponentInternalInstance).appContext.config.globalProperties
     const that = (getCurrentInstance() as ComponentInternalInstance).appContext.config.globalProperties
     const state = reactive({
     const state = reactive({
       Handle: Handle,
       Handle: Handle,
-      list: [
-        {type: 1, title: '系统新版本升级V1.1通知,新功能系统新版本升级V1.1通知,新功能', time: '2023-09-01 13:22:33'},
-        {type: 2, title: '系统新版本升级V1.1通知,新功能系统新版本升级V1.1通知,新功能', time: '2023-11-22 13:22:33'},
-        {type: 1, title: '系统新版本升级V1.1通知', time: '2023-11-01 13:22:33'},
-        {type: 1, title: '系统新版本升级V1.1通知', time: '2023-11-01 13:22:33'},
-        {type: 1, title: '系统新版本升级V1.1通知', time: '2023-11-01 13:22:33'},
-        {type: 2, title: '系统新版本升级V1.1通知', time: '2023-11-01 13:22:33'},
-        {type: 1, title: '系统新版本升级V1.1通知', time: '2023-11-01 13:22:33'},
-      ],
+      list: [],
       showDetail: false,
       showDetail: false,
-      transfer: {}
+      transfer: {},
+      loading: false
     })
     })
     const onView = (val) => {
     const onView = (val) => {
       state.transfer = {
       state.transfer = {
@@ -67,6 +61,32 @@ export default defineComponent({
       }
       }
       state.showDetail = true
       state.showDetail = true
     }
     }
+    const initData = () => {
+      //  添加分页参数
+      const queryParams: any = {
+        pageNum: 1,
+        pageSize: 7,
+        status: '1'
+      }
+      state.loading = true
+      that.$api.getNoticeList(queryParams).then((res: any) => {
+        if (res.code === 200) {
+          state.list = res.rows
+        } else {
+          ElMessage.error(res.message)
+        }
+        state.loading = false
+      }).catch(() => {
+        state.loading = false
+      })
+    }
+    const initDictionary = () => {
+      store.dispatch('dictionary/LOAD_DICT_LIST', 'notice_type')
+    }
+    onActivated(() => {
+      initData()
+      initDictionary()
+    })
     return {
     return {
       ...toRefs(state),
       ...toRefs(state),
       onView
       onView

+ 38 - 21
src/views/staging/zby/right/notice-com.vue

@@ -3,19 +3,19 @@
     <template #title>
     <template #title>
       <div class="more __hover" @click="$router.push({name: 'fc9664b6-69f3-4dc8-bedb-a391fdc3a0db'})">查看更多》</div>
       <div class="more __hover" @click="$router.push({name: 'fc9664b6-69f3-4dc8-bedb-a391fdc3a0db'})">查看更多》</div>
     </template>
     </template>
-    <div class="list">
+    <div class="list" v-loading="loading">
       <template v-for="item in list">
       <template v-for="item in list">
         <div class="item __hover" @click="onView(item)">
         <div class="item __hover" @click="onView(item)">
           <div class="type" :class="`type-${item.type}`">
           <div class="type" :class="`type-${item.type}`">
-            {{item.type === 1 ? '消息' : '通知'}}
-            <div v-if="!item.read" class="read"/>
+            {{item.type === '1' ? '通知' : '消息'}}
+            <div v-if="item.readStatus === 0" class="read"/>
           </div>
           </div>
           <div class="title __text-ellipsis">{{item.title}}</div>
           <div class="title __text-ellipsis">{{item.title}}</div>
-          <div class="time">{{Handle.formatDate(item.time)}}</div>
+          <div class="time">{{Handle.formatDate(item.publishTime)}}</div>
         </div>
         </div>
       </template>
       </template>
     </div>
     </div>
-    <NoticeDetailCom v-model:show="showDetail" :transfer="transfer"/>
+    <NoticeDetailCom v-model:show="showDetail" :transfer="transfer" @onView="initData"/>
   </BaseBlockCom>
   </BaseBlockCom>
 </template>
 </template>
 
 
@@ -30,13 +30,14 @@ import {
   getCurrentInstance,
   getCurrentInstance,
   ComponentInternalInstance,
   ComponentInternalInstance,
   toRefs,
   toRefs,
-  nextTick
+  nextTick, onActivated
 } from 'vue'
 } from 'vue'
 import {useStore} from 'vuex'
 import {useStore} from 'vuex'
 import {useRouter, useRoute} from 'vue-router'
 import {useRouter, useRoute} from 'vue-router'
 import BaseBlockCom from '../../common/base-block.vue'
 import BaseBlockCom from '../../common/base-block.vue'
 import * as Handle from '../../common/handle'
 import * as Handle from '../../common/handle'
 import NoticeDetailCom from '@/views/system/notice-announcement/detail.vue'
 import NoticeDetailCom from '@/views/system/notice-announcement/detail.vue'
+import {ElMessage} from "element-plus";
 
 
 export default defineComponent({
 export default defineComponent({
   name: '',
   name: '',
@@ -51,21 +52,10 @@ export default defineComponent({
     const that = (getCurrentInstance() as ComponentInternalInstance).appContext.config.globalProperties
     const that = (getCurrentInstance() as ComponentInternalInstance).appContext.config.globalProperties
     const state = reactive({
     const state = reactive({
       Handle: Handle,
       Handle: Handle,
-      list: [
-        {type: 1, read: false, title: '系统新版本升级V1.1通知,新功能系统新版本升级V1.1通知,新功能', time: '2023-09-01 13:22:33'},
-        {type: 2, read: false, title: '系统新版本升级V1.1通知,新功能系统新版本升级V1.1通知,新功能', time: '2023-11-22 13:22:33'},
-        {type: 1, read: false, title: '系统新版本升级V1.1通知', time: '2023-11-01 13:22:33'},
-        {type: 1, read: true, title: '系统新版本升级V1.1通知', time: '2023-11-01 13:22:33'},
-        {type: 1, read: false, title: '系统新版本升级V1.1通知', time: '2023-11-01 13:22:33'},
-        {type: 2, read: true, title: '系统新版本升级V1.1通知', time: '2023-11-01 13:22:33'},
-        {type: 1, read: true, title: '系统新版本升级V1.1通知', time: '2023-11-01 13:22:33'},
-        {type: 1, read: true, title: '系统新版本升级V1.1通知', time: '2023-11-01 13:22:33'},
-        {type: 1, read: true, title: '系统新版本升级V1.1通知', time: '2023-11-01 13:22:33'},
-        {type: 1, read: true, title: '系统新版本升级V1.1通知', time: '2023-11-01 13:22:33'},
-        {type: 1, read: true, title: '系统新版本升级V1.1通知', time: '2023-11-01 13:22:33'},
-      ],
+      list: [],
       showDetail: false,
       showDetail: false,
-      transfer: {}
+      transfer: {},
+      loading: false
     })
     })
     const onView = (val) => {
     const onView = (val) => {
       state.transfer = {
       state.transfer = {
@@ -74,9 +64,36 @@ export default defineComponent({
       }
       }
       state.showDetail = true
       state.showDetail = true
     }
     }
+    const initData = () => {
+      //  添加分页参数
+      const queryParams: any = {
+        pageNum: 1,
+        pageSize: 11,
+        status: '1'
+      }
+      state.loading = true
+      that.$api.getNoticeList(queryParams).then((res: any) => {
+        if (res.code === 200) {
+          state.list = res.rows
+        } else {
+          ElMessage.error(res.message)
+        }
+        state.loading = false
+      }).catch(() => {
+        state.loading = false
+      })
+    }
+    const initDictionary = () => {
+      store.dispatch('dictionary/LOAD_DICT_LIST', 'notice_type')
+    }
+    onActivated(() => {
+      initData()
+      initDictionary()
+    })
     return {
     return {
       ...toRefs(state),
       ...toRefs(state),
-      onView
+      onView,
+      initData
     }
     }
   },
   },
 })
 })

+ 76 - 26
src/views/system/notice-announcement/detail.vue

@@ -4,9 +4,10 @@
       :show="show"
       :show="show"
       @close="$emit('update:show', false)"
       @close="$emit('update:show', false)"
       @submit="onSubmit"
       @submit="onSubmit"
-      submitText="确认发布"
       height="500px"
       height="500px"
       :closeConfirm="!isViewCpt"
       :closeConfirm="!isViewCpt"
+      :loading="loading"
+      :showSubmit="!isViewCpt"
   >
   >
     <div class="__normal-form">
     <div class="__normal-form">
       <CusForm labelWidth="100px" ref="ref_form" :formView="isViewCpt">
       <CusForm labelWidth="100px" ref="ref_form" :formView="isViewCpt">
@@ -14,33 +15,27 @@
             :span="24"
             :span="24"
             required
             required
             label="标题:"
             label="标题:"
-            v-model:param="cusDetail.p1"/>
+            v-model:param="cusDetail.title"/>
         <CusFormColumn
         <CusFormColumn
             :span="24"
             :span="24"
             required
             required
             label="内容:"
             label="内容:"
             type="textarea"
             type="textarea"
             :rows="8"
             :rows="8"
-            v-model:param="cusDetail.p2"/>
+            v-model:param="cusDetail.noticeBody"/>
         <CusFormColumn
         <CusFormColumn
             :span="24"
             :span="24"
             required
             required
             label="类型:"
             label="类型:"
             link="select"
             link="select"
-            static
-            v-model:param="cusDetail.p3"
-            labelKey="label"
-            valueKey="value"
-            :options="[
-                {label: '类型一', value: '1'},
-                {label: '类型二', value: '2'},
-                {label: '类型三', value: '3'},
-            ]"/>
+            v-model:param="cusDetail.type"
+            :options="$store.state.dictionary.noticeTypeList"/>
         <CusFormColumn
         <CusFormColumn
             :span="24"
             :span="24"
             label="上传附件:"
             label="上传附件:"
             link="upload"
             link="upload"
-            v-model:param="cusDetail.fileList"/>
+            v-model:param="fileList"
+            :delRule="(file) => true"/>
       </CusForm>
       </CusForm>
     </div>
     </div>
   </CusDialog>
   </CusDialog>
@@ -61,6 +56,7 @@ import {
 } from 'vue'
 } from 'vue'
 import {useStore} from 'vuex'
 import {useStore} from 'vuex'
 import {useRouter, useRoute} from 'vue-router'
 import {useRouter, useRoute} from 'vue-router'
+import {ElMessage, ElMessageBox} from "element-plus";
 
 
 export default defineComponent({
 export default defineComponent({
   name: '',
   name: '',
@@ -75,25 +71,43 @@ export default defineComponent({
     const route = useRoute();
     const route = useRoute();
     const that = (getCurrentInstance() as ComponentInternalInstance).appContext.config.globalProperties
     const that = (getCurrentInstance() as ComponentInternalInstance).appContext.config.globalProperties
     const state = reactive({
     const state = reactive({
-      cusDetail: {
-        p1: null,
-        p2: null,
-        p3: null,
-        fileList: [
-          { "url": "http://8.140.240.182:18085/profile/upload/2023/10/23/6b7bf3b4-592a-4e2f-ba92-11923671ce3b.doc", "name": "迁移案例.doc"},],
-        }
+      loading: false,
+      cusDetail: {},
+      fileList: []
     })
     })
     watch(() => props.show, (n) => {
     watch(() => props.show, (n) => {
       if (n) {
       if (n) {
+        state.loading = false
+        state.fileList = []
         state.cusDetail = {
         state.cusDetail = {
-          p1: null,
-          p2: null,
-          p3: null,
-          fileList: [],
+          deptId: store.state.app.userInfo.dept.id,
+          deptName: store.state.app.userInfo.dept.organizationName,
+          status: '1',
+          publisher: store.state.app.userInfo.displayName,
+          publishTime: that.$util.YMDHms(new Date(store.state.app.timestamp)),
         }
         }
         if (props.transfer.method !== 'add') {
         if (props.transfer.method !== 'add') {
-          state.cusDetail.p1 = props.transfer.detail.p1
-          state.cusDetail.fileList = props.transfer.detail.fileList
+          state.loading = true
+          that.$api.getNoticeSearch({id: props.transfer.detail.id}).then((res) => {
+            if (res.code === 200) {
+              state.cusDetail = res.data
+              const urlArr = state.cusDetail.fileUrl.split(',')
+              const nameArr = state.cusDetail.fileName.split(',')
+              state.fileList = urlArr.map((v, i) => {
+                return {
+                  name: nameArr?.[i] || v,
+                  url: v
+                }
+              })
+              emit('onView')
+            } else {
+              ElMessage.error(res.message)
+              emit('update:show', false)
+            }
+            state.loading = false
+          }).catch(() => {
+            ElMessage.error('请求失败')
+          })
         }
         }
         nextTick(() => {
         nextTick(() => {
           ref_form.value.reset()
           ref_form.value.reset()
@@ -105,6 +119,42 @@ export default defineComponent({
       return props.transfer.method === 'view'
       return props.transfer.method === 'view'
     })
     })
     const onSubmit = () => {
     const onSubmit = () => {
+      ref_form.value.submit().then(() => {
+        ElMessageBox.confirm("是否提交?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning",
+        }).then(() => {
+          state.loading = true
+          const params = state.cusDetail
+          if (state.fileList?.length > 0) {
+            params.fileName = state.fileList.map(v => v.name).join(',')
+            params.fileUrl = state.fileList.map(v => v.url).join(',')
+          } else {
+            params.fileName = ''
+            params.fileUrl = ''
+          }
+          const apiHandle = props.transfer.method === 'edit' ? that.$api.editNoticeEdit(params) : that.$api.addNoticeSave(params)
+          apiHandle.then(res => {
+            if (res.code === 200) {
+              ElMessage.success(res.message)
+              emit('update:show', false)
+              emit('refresh')
+            } else {
+              ElMessage.error(res.message)
+            }
+            state.loading = false
+          }).catch(() => {
+            state.loading = false
+          })
+        }).catch(() => {})
+      }).catch((e) => {
+        ElMessage({
+          message: e[0].message,
+          grouping: true,
+          type: 'warning',
+        })
+      })
     }
     }
     return {
     return {
       ...toRefs(state),
       ...toRefs(state),

+ 83 - 12
src/views/system/notice-announcement/index.vue

@@ -56,6 +56,12 @@
               :pageSize="queryPage.pageSize"
               :pageSize="queryPage.pageSize"
               @handlePage="handlePage"
               @handlePage="handlePage"
           >
           >
+            <template #title-column-value="{ scope }">
+              <template v-if="scope.row.status === '1'">
+                <el-link class="__cus-table_column-view" @click="onView(scope.row)">{{scope.row.title}}</el-link>
+              </template>
+              <template v-else>{{scope.row.title}}</template>
+            </template>
             <template #publishTime-column-value="{ scope }">
             <template #publishTime-column-value="{ scope }">
               {{scope.row.publishTime ? $util.YMDHms(scope.row.publishTime) : scope.row.publishTime}}
               {{scope.row.publishTime ? $util.YMDHms(scope.row.publishTime) : scope.row.publishTime}}
             </template>
             </template>
@@ -67,16 +73,19 @@
             </template>
             </template>
             <template #do-column-value="{ scope }">
             <template #do-column-value="{ scope }">
               <div class="__cus-table_do">
               <div class="__cus-table_do">
-                <div class="__cus-table_do-green __hover" @click="onView(scope.row)">
+                <div class="__cus-table_do-green __hover" @click="onView(scope.row)" v-if="scope.row.status === '1'">
                   <SvgIcon name="view" size="16"/>查看
                   <SvgIcon name="view" size="16"/>查看
                 </div>
                 </div>
-                <div class="__cus-table_do-blue __hover" @click="onEdit(scope.row)">
+                <div class="__cus-table_do-blue __hover" @click="onEdit(scope.row)" v-if="scope.row.status === '2'">
                   <SvgIcon name="edit" size="16"/>编辑
                   <SvgIcon name="edit" size="16"/>编辑
                 </div>
                 </div>
-<!--                <div class="__cus-table_do-green __hover">-->
-<!--                  <SvgIcon name="publish" size="16"/>发布-->
-<!--                </div>-->
-                <div class="__cus-table_do-red __hover">
+                <div class="__cus-table_do-green __hover" @click="onPublish(scope.row)" v-if="scope.row.status === '2'">
+                  <SvgIcon name="publish" size="16"/>发布
+                </div>
+                <div class="__cus-table_do-blue __hover" @click="onRevoke(scope.row)" v-if="scope.row.status === '1'">
+                  <SvgIcon name="back" size="16"/>撤回
+                </div>
+                <div class="__cus-table_do-red __hover" @click="onDel(scope.row)" v-if="scope.row.status === '2'">
                   <SvgIcon name="del" size="16"/>删除
                   <SvgIcon name="del" size="16"/>删除
                 </div>
                 </div>
               </div>
               </div>
@@ -85,7 +94,7 @@
         </template>
         </template>
       </CusContent>
       </CusContent>
     </div>
     </div>
-    <DetailCom v-model:show="showDetail" :transfer="transfer"/>
+    <DetailCom v-model:show="showDetail" :transfer="transfer" @refresh="handleSearch()"/>
   </div>
   </div>
 </template>
 </template>
 
 
@@ -105,8 +114,7 @@ import {
 import {useStore} from 'vuex'
 import {useStore} from 'vuex'
 import {useRouter, useRoute} from 'vue-router'
 import {useRouter, useRoute} from 'vue-router'
 import DetailCom from './detail.vue'
 import DetailCom from './detail.vue'
-import {getNoticeList} from "@/api/modules/notice";
-import { ElMessage } from 'element-plus';
+import {ElMessage, ElMessageBox} from 'element-plus';
 
 
 export default defineComponent({
 export default defineComponent({
   name: '',
   name: '',
@@ -143,7 +151,7 @@ export default defineComponent({
         {value: "publishTime", label: "发布时间", show: true, width: 180},
         {value: "publishTime", label: "发布时间", show: true, width: 180},
         {value: "type", label: "类型", show: true},
         {value: "type", label: "类型", show: true},
         {value: "status", label: "状态", show: true},
         {value: "status", label: "状态", show: true},
-        {value: "do", label: "操作", show: true, width: 260},
+        {value: "do", label: "操作", show: true, popover: true, width: 260},
       ],
       ],
       showDetail: false,
       showDetail: false,
       transfer: {}
       transfer: {}
@@ -178,8 +186,8 @@ export default defineComponent({
       for (const [k, v] of Object.entries(state.back_queryForm)) {
       for (const [k, v] of Object.entries(state.back_queryForm)) {
         if (that.$util.isValue(v)) {
         if (that.$util.isValue(v)) {
           if (k === 'publishDate') {
           if (k === 'publishDate') {
-            queryParams['bTime'] = v[0]
-            queryParams['eTime'] = v[1]
+            queryParams['beginTime'] = v[0]
+            queryParams['endTime'] = v[1]
           } else {
           } else {
             queryParams[k] = v
             queryParams[k] = v
           }
           }
@@ -225,6 +233,66 @@ export default defineComponent({
       }
       }
       state.showDetail = true
       state.showDetail = true
     }
     }
+    const onDel = (val) => {
+      ElMessageBox.confirm(`是否删除${val.title}?`, "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      }).then(() => {
+        state.loading = true
+        that.$api.delNoticeDelete({id: val.id}).then(res => {
+          if (res.code === 200) {
+            ElMessage.success(res.message)
+            handleSearch()
+          } else {
+            ElMessage.error(res.message)
+            state.loading = false
+          }
+        }).catch(() => {
+          state.loading = false
+        })
+      }).catch(() => {})
+    }
+    const onPublish = (val) => {
+      ElMessageBox.confirm(`是否发布${val.title}?`, "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      }).then(() => {
+        state.loading = true
+        that.$api.getNoticePublish({id: val.id}).then(res => {
+          if (res.code === 200) {
+            ElMessage.success(res.message)
+            handleSearch()
+          } else {
+            ElMessage.error(res.message)
+            state.loading = false
+          }
+        }).catch(() => {
+          state.loading = false
+        })
+      }).catch(() => {})
+    }
+    const onRevoke = (val) => {
+      ElMessageBox.confirm(`是否撤回${val.title}?`, "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      }).then(() => {
+        state.loading = true
+        that.$api.getNoticeRevoke({id: val.id}).then(res => {
+          if (res.code === 200) {
+            ElMessage.success(res.message)
+            handleSearch()
+          } else {
+            ElMessage.error(res.message)
+            state.loading = false
+          }
+        }).catch(() => {
+          state.loading = false
+        })
+      }).catch(() => {})
+    }
     onMounted(() => {
     onMounted(() => {
       state.back_queryForm = JSON.parse(JSON.stringify(state.queryForm))
       state.back_queryForm = JSON.parse(JSON.stringify(state.queryForm))
       initDictionary()
       initDictionary()
@@ -240,6 +308,9 @@ export default defineComponent({
       onAdd,
       onAdd,
       onEdit,
       onEdit,
       onView,
       onView,
+      onDel,
+      onRevoke,
+      onPublish
     }
     }
   },
   },
 })
 })