ZaiZai há 3 meses atrás
pai
commit
284ac91fce

+ 57 - 0
src/api/system/announcement.js

@@ -0,0 +1,57 @@
+import request from '@/router/axios';
+
+export const getList = (params) => {
+  return request({
+    url: '/api/blade-manager/systemMsg/page',
+    method: 'get',
+    params: params
+  })
+}
+
+export const getAwaitMsg = () => {
+  return request({
+    url: '/api/blade-manager/systemMsg/getAwaitMsg',
+    method: 'get',
+    params: {}
+  })
+}
+
+export const remove = (ids) => {
+  return request({
+    url: '/api/blade-manager/systemMsg/remove',
+    method: 'get',
+    params: {ids: ids}
+  })
+}
+
+export const add = (row) => {
+  return request({
+    url: '/api/blade-manager/systemMsg/add',
+    method: 'post',
+    data: row
+  })
+}
+
+export const update = (row) => {
+  return request({
+    url: '/api/blade-manager/systemMsg/update',
+    method: 'post',
+    data: row
+  })
+}
+
+export const cancelPush = (id) => {
+  return request({
+    url: '/api/blade-manager/systemMsg/cancelPush',
+    method: 'get',
+    params: {id}
+  })
+}
+
+export const getClinetAll = (row) => {
+  return request({
+    url: '/api/blade-system/client/getClinetAll',
+    method: 'get',
+    params: {}
+  })
+}

+ 3 - 2
src/config/index.json

@@ -1,10 +1,11 @@
 {
   "target1": "http://39.108.216.210:8090",
-  "target": "http://127.0.0.1:8090",
+  "target2": "http://127.0.0.1:8090",
+  "target": "http://192.168.0.125:8090",
   "dev": {
     "port": 1888
   },
   "version": "20240827163559",
   "smsPhone": "",
   "vite": {}
-}
+}

+ 19 - 45
src/styles/announcement.scss

@@ -1,27 +1,14 @@
 .hc-system-announcement-box {
   position: relative;
-  height: calc(100% - 10px);
-  display: flex;
-  .classify-card {
-    position: relative;
-    height: 100%;
-    width: 240px;
-    margin-right: 10px;
-  }
-  .data-card {
-    position: relative;
-    height: 100%;
-    flex: 1;
-  }
+  height: 100%;
   .card-body {
     position: absolute;
     inset: 0;
-    bottom: 10px;
     .card-main {
       position: relative;
       background: white;
-      height: 100%;
-      padding: 4px;
+      height: calc(100% - 14px);
+      margin: 0 10px 10px;
       border-radius: 5px;
       .header {
         position: relative;
@@ -44,9 +31,23 @@
       }
       .content {
         position: relative;
-        height: calc(100% - 50px);
         box-sizing: border-box;
         overflow: auto;
+        height: calc(100% - 98px);
+        padding: 10px;
+        .el-table th.el-table__cell {
+          background-color: #f7f7f7;
+          padding: 8px 0;
+          .el-checkbox:last-of-type {
+            margin-right: 0;
+          }
+        }
+        .el-table .el-table__cell {
+          padding: 4px 0;
+          .el-checkbox:last-of-type {
+            margin-right: 0;
+          }
+        }
       }
       .action {
         position: relative;
@@ -58,26 +59,6 @@
       }
     }
   }
-  .classify-card .card-body .card-main .content {
-    height: calc(100% - 50px);
-  }
-  .data-card .card-body .card-main .content {
-    height: calc(100% - 98px);
-    padding: 10px;
-    .el-table th.el-table__cell {
-      background-color: #f7f7f7;
-      padding: 8px 0;
-      .el-checkbox:last-of-type {
-        margin-right: 0;
-      }
-    }
-    .el-table .el-table__cell {
-      padding: 4px 0;
-      .el-checkbox:last-of-type {
-        margin-right: 0;
-      }
-    }
-  }
 }
 
 //通用弹窗
@@ -127,7 +108,7 @@
 }
 .el-dialog__wrapper.hc-system-announcement-dialog.black-card .el-dialog {
   margin-top: 15vh !important;
-  height: calc(100% - 30vh) !important;
+  height: calc(100% - 39vh) !important;
   .el-dialog__body {
     height: calc(100% - 73px);
     overflow: auto;
@@ -236,10 +217,3 @@
     margin-top:5px !important;
   }
 }
-
-.el-form.hc-system-announcement-form .el-form-item {
-  .el-form-item__label {
-    line-height: unset;
-    padding-bottom: 5px;
-  }
-}

+ 317 - 323
src/views/system/announcement.vue

@@ -1,184 +1,88 @@
 <template>
   <div class="hc-system-announcement-box">
-    <div class="classify-card">
-      <div class="card-body">
-        <div class="card-main">
-          <div class="header">
-            <div class="title">系统分类</div>
-            <div class="extra">
-              <el-button icon="el-icon-plus" size="mini" type="primary" @click="addSystemClick"></el-button>
-            </div>
-          </div>
-          <div class="content">
-            <el-menu :default-active="systemClassify" class="classify-data" @select="systemClassifySelect">
-              <el-submenu index="1">
-                <div slot="title">
-                  <div @contextmenu.prevent="editSystemClick($event, '1')">电子档案系统</div>
-                </div>
-                <el-menu-item index="1-1"  @contextmenu.native.prevent="editSystemClick($event, '1-1')">质检系统</el-menu-item>
-                <el-menu-item index="1-2"  @contextmenu.native.prevent="editSystemClick($event, '1-2')">档案系统</el-menu-item>
-                <el-menu-item index="1-3"  @contextmenu.native.prevent="editSystemClick($event, '1-3')">计量系统</el-menu-item>
-              </el-submenu>
-              <el-submenu index="2">
-                <div slot="title">
-                  <div @contextmenu.prevent="editSystemClick($event, '2')">规发中心</div>
-                </div>
-                <el-menu-item index="2-1"  @contextmenu.native.prevent="editSystemClick($event, '2-1')">数据分析系统</el-menu-item>
-              </el-submenu>
-            </el-menu>
-          </div>
-        </div>
-      </div>
-    </div>
-    <div class="data-card">
-      <div class="card-body">
-        <div class="card-main">
-          <div class="header">
-            <div class="title">
-              <div style="width: 140px">
-                <el-select v-model="searchForm.type" class="block" clearable filterable placeholder="请选择公告类型" size="small">
-                  <el-option label="系统发布公告" value="1"></el-option>
-                  <el-option label="系统说明公告" value="2"></el-option>
-                </el-select>
-              </div>
-              <div style="width: 100px; margin-left: 12px; margin-right: 12px;">
-                <el-select v-model="searchForm.state" class="block" clearable filterable placeholder="发布状态" size="small">
-                  <el-option label="已发布" value="1"></el-option>
-                  <el-option label="待发布" value="2"></el-option>
-                  <el-option label="已取消" value="3"></el-option>
-                </el-select>
-              </div>
-              <el-button size="small" type="primary">搜索</el-button>
+    <div class="card-body">
+      <div class="card-main">
+        <div class="header">
+          <div class="title">
+            <div style="width: 140px">
+              <el-select v-model="searchForm.msgType" class="block" clearable filterable placeholder="请选择公告类型" size="small">
+                <el-option label="更新公告" value="1"></el-option>
+                <el-option label="普通公告" value="2"></el-option>
+              </el-select>
             </div>
-            <div class="extra">
-              <el-badge :value="3" style="margin-right: 18px;">
-                <el-button size="small" @click="releasedShow">待发布</el-button>
-              </el-badge>
-              <el-button size="small" type="primary" @click="generalShow">发布普通公告</el-button>
-              <el-button size="small" type="warning" @click="systemUpdateShow">发布系统公告</el-button>
-              <el-button size="small" type="danger">批量删除公告</el-button>
+            <div style="width: 100px; margin-left: 12px; margin-right: 12px;">
+              <el-select v-model="searchForm.pushStatus" class="block" clearable filterable placeholder="发布状态" size="small">
+                <el-option label="待发布" value="1"></el-option>
+                <el-option label="已发布" value="2"></el-option>
+                <el-option label="已取消" value="3"></el-option>
+              </el-select>
             </div>
+            <el-button size="small" type="primary" @click="searchClick">搜索</el-button>
           </div>
-          <div class="content">
-            <el-table ref="tableRef" :data="tableData" border style="width: 100%;" height="100%" @selection-change="tableSelection">
-              <el-table-column type="selection" width="50" align="center" fixed="left"></el-table-column>
-              <el-table-column type="index" label="序号" width="50" align="center"></el-table-column>
-              <el-table-column prop="type" label="公告类型" width="140"></el-table-column>
-              <el-table-column prop="name" label="公告内容" min-width="240"></el-table-column>
-              <el-table-column prop="address" label="发布备注" width="300"></el-table-column>
-              <el-table-column prop="time" label="创建时间" width="180"></el-table-column>
-              <el-table-column prop="user" label="创建人" width="100"></el-table-column>
-              <el-table-column prop="date" label="取消时间" width="180"></el-table-column>
-              <el-table-column prop="state" label="发布状态" width="100" align="center">
-                <template slot-scope="{row}">
-                  <el-tag type="danger" effect="dark" v-if="row.state==='已取消'">{{ row.state }}</el-tag>
-                  <el-tag type="success" effect="dark" v-if="row.state==='已发布'">{{ row.state }}</el-tag>
-                  <el-tag type="info" effect="dark" v-if="row.state==='待发布'">{{ row.state }}</el-tag>
-                </template>
-              </el-table-column>
-              <el-table-column prop="action" label="操作" width="150" align="center" fixed="right">
-                <template slot-scope="{row, $index}">
-                  <el-button size="mini" @click="handleEdit($index, row)">编辑</el-button>
-                  <el-button size="mini" type="danger" @click="handleDelete($index, row)">删除</el-button>
-                </template>
-              </el-table-column>
-            </el-table>
-          </div>
-          <div class="action">
-            <el-pagination
-              @size-change="handleSizeChange"
-              @current-change="handleCurrentChange"
-              :current-page="searchForm.current"
-              :page-sizes="[100, 200, 300, 400]"
-              :page-size="searchForm.size"
-              layout="total, prev, pager, next, sizes, jumper"
-              :total="searchForm.total"
-            >
-            </el-pagination>
+          <div class="extra">
+            <el-badge :value="releasedNum" style="margin-right: 18px;">
+              <el-button size="small" @click="releasedShow">待发布</el-button>
+            </el-badge>
+            <el-button size="small" type="primary" @click="generalShow">发布普通公告</el-button>
+            <el-button size="small" type="warning" @click="systemUpdateShow">发布系统公告</el-button>
+            <el-button size="small" type="danger" @click="handleDelete">批量删除公告</el-button>
           </div>
         </div>
+        <div class="content" v-loading="isLoading">
+          <el-table ref="tableRef" :data="tableData" border style="width: 100%;" height="100%" @selection-change="tableSelection">
+            <el-table-column type="selection" width="50" align="center" fixed="left"></el-table-column>
+            <el-table-column type="index" label="序号" width="50" align="center"></el-table-column>
+            <el-table-column prop="msgType" label="公告类型" width="140">
+              <template slot-scope="{row}">
+                <span v-if="row.msgType===1">更新公告</span>
+                <span v-if="row.msgType===2">普通公告</span>
+              </template>
+            </el-table-column>
+            <el-table-column prop="pushSystem" label="推送系统" min-width="120"></el-table-column>
+            <el-table-column prop="msgContent" label="公告内容" min-width="240"></el-table-column>
+            <el-table-column prop="pushRemark" label="发布备注" width="300"></el-table-column>
+            <el-table-column prop="pushDateTime" label="创建时间" width="180"></el-table-column>
+            <el-table-column prop="creatUserName" label="创建人" width="100"></el-table-column>
+            <el-table-column prop="cancelDateTime" label="取消时间" width="180"></el-table-column>
+            <el-table-column prop="pushStatus" label="发布状态" width="100" align="center">
+              <template slot-scope="{row}">
+                <el-tag type="danger" effect="dark" v-if="row.pushStatus===3">已取消</el-tag>
+                <el-tag type="success" effect="dark" v-if="row.pushStatus===2">已发布</el-tag>
+                <el-tag type="info" effect="dark" v-if="row.pushStatus===1">待发布</el-tag>
+              </template>
+            </el-table-column>
+            <el-table-column prop="action" label="操作" width="180" align="center" fixed="right">
+              <template slot-scope="{row}">
+                <el-button size="mini" @click="handleEdit(row)">编辑</el-button>
+                <el-button size="mini" type="danger" @click="handleCancel(row)" :disabled="row.pushStatus!==1">取消发布</el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+        </div>
+        <div class="action">
+          <el-pagination
+            @size-change="handleSizeChange"
+            @current-change="handleCurrentChange"
+            :current-page="searchForm.current"
+            :page-sizes="[100, 200, 300, 400]"
+            :page-size="searchForm.size"
+            layout="total, prev, pager, next, sizes, jumper"
+            :total="searchForm.total"
+          >
+          </el-pagination>
+        </div>
       </div>
     </div>
 
-    <!--新增/编辑 系统-->
-    <el-dialog
-      class="hc-system-announcement-dialog"
-      :title="`${systemInfoData.id?'编辑':'新增'}系统`"
-      :visible.sync="isSystemInfoShow"
-      append-to-body center
-      destroy-on-close
-      width="400px"
-      @closed="systemFormCancel"
-    >
-      <el-form :model="systemInfoData" :rules="systemInfoRules" ref="systemInfoRef" label-width="auto">
-        <el-form-item label="数据类型:" prop="type">
-          <el-radio-group v-model="systemInfoData.type">
-            <el-radio label="1">系统分组</el-radio>
-            <el-radio label="2">项目系统</el-radio>
-          </el-radio-group>
-        </el-form-item>
-        <el-form-item label="分组名称:" prop="name" v-if="systemInfoData.type === '1'">
-          <el-input v-model="systemInfoData.name" placeholder="请输入分组名称"></el-input>
-        </el-form-item>
-        <el-form-item label="上级分组:" prop="groupId" v-if="systemInfoData.type === '2'">
-          <el-select v-model="systemInfoData.groupId" class="block" clearable filterable placeholder="请选择上级分组">
-            <el-option label="电子档案系统" value="1"></el-option>
-            <el-option label="规发中心" value="2"></el-option>
-          </el-select>
-        </el-form-item>
-        <el-form-item label="关联应用:" prop="client" v-if="systemInfoData.type === '2'">
-          <el-select v-model="systemInfoData.client" class="block" clearable filterable placeholder="请选择关联应用">
-            <el-option label="client(质检试验)" value="client"></el-option>
-            <el-option label="archives(档案管理)" value="archives"></el-option>
-            <el-option label="measure(计量系统)" value="measure"></el-option>
-          </el-select>
-        </el-form-item>
-        <el-form-item label="项目名称:" prop="title" v-if="systemInfoData.type === '2'">
-          <el-input v-model="systemInfoData.title" placeholder="请输入项目名称"></el-input>
-        </el-form-item>
-      </el-form>
-      <div slot="footer">
-        <el-button @click="systemFormCancel">取消</el-button>
-        <el-popconfirm title="确定要删除当前数据吗?" @confirm="systemFormDel" v-if="systemInfoData.id">
-          <el-button slot="reference" type="danger">删除</el-button>
-        </el-popconfirm>
-        <el-button type="primary" @click="systemFormSubmit">确定</el-button>
-      </div>
-    </el-dialog>
-
     <!--待发布-->
     <el-dialog
       class="hc-system-announcement-dialog black-card" title="待发布的公告" :visible.sync="isReleasedShow"
       append-to-body center destroy-on-close width="660px" @closed="releasedCancel"
     >
-      <el-divider content-position="left" class="hc-system-announcement-black-divider top">系统公告</el-divider>
-      <div class="hc-system-announcement-black-card">
-        <div class="icon-box">
-          <div class="name">前 端</div>
-          <div class="icon">
-            <i class="iconfont iconicon_notice"></i>
-          </div>
-        </div>
-        <div class="content">
-          <div class="top-box">
-            <div class="left">
-              <span class="name">待发布:</span>
-              <span class="num">1</span>
-            </div>
-            <div class="right">
-              <span class="name">创建人:</span>
-              <span class="user">黄飞鸿</span>
-            </div>
-          </div>
-          <div class="time-box">
-            <span class="name">发布时间:</span>
-            <span class="time">2024年7月31日 14:40:30</span>
-          </div>
-        </div>
-      </div>
-      <div class="hc-system-announcement-black-card">
+      <el-divider content-position="left" class="hc-system-announcement-black-divider top" v-if="releasedData.updateMsg.length > 0">更新公告</el-divider>
+      <div class="hc-system-announcement-black-card" v-for="(item, index) in releasedData.updateMsg" :key="index">
         <div class="icon-box">
-          <div class="name">后 端</div>
+          <div class="name">{{index === 0?'前 端':'后 端'}}</div>
           <div class="icon">
             <i class="iconfont iconicon_notice"></i>
           </div>
@@ -187,21 +91,21 @@
           <div class="top-box">
             <div class="left">
               <span class="name">待发布:</span>
-              <span class="num">1</span>
+              <span class="num">{{item.awaitMsgTotal}}</span>
             </div>
             <div class="right">
               <span class="name">创建人:</span>
-              <span class="user">祝炜</span>
+              <span class="user">{{item.creatUserName}}</span>
             </div>
           </div>
           <div class="time-box">
             <span class="name">发布时间:</span>
-            <span class="time">2024年7月31日 14:40:30</span>
+            <span class="time">{{item.pushDateTime}}</span>
           </div>
         </div>
       </div>
-      <el-divider content-position="left" class="hc-system-announcement-black-divider">普通公告</el-divider>
-      <div class="hc-system-announcement-black-card">
+      <el-divider content-position="left" class="hc-system-announcement-black-divider" v-if="releasedData.systemMsg.length > 0">普通公告</el-divider>
+      <div class="hc-system-announcement-black-card" v-for="(item, index) in releasedData.systemMsg" :key="index">
         <div class="icon-box">
           <div class="name">公 告</div>
           <div class="icon">
@@ -212,20 +116,16 @@
           <div class="top-box">
             <div class="left">
               <span class="name">待发布:</span>
-              <span class="num">1</span>
+              <span class="num">{{item.awaitMsgTotal}}</span>
             </div>
             <div class="right">
               <span class="name">创建人:</span>
-              <span class="user">豆海涛</span>
+              <span class="user">{{item.creatUserName}}</span>
             </div>
           </div>
-          <div class="text-box">
-            <div class="name">公告内容:</div>
-            <div class="text">系统xxxxxx</div>
-          </div>
           <div class="time-box">
             <span class="name">发布时间:</span>
-            <span class="time">2024年7月31日 14:40:30</span>
+            <span class="time">{{item.pushDateTime}}</span>
           </div>
         </div>
       </div>
@@ -236,42 +136,24 @@
       class="hc-system-announcement-dialog w-700px" title="发布普通公告" :visible.sync="isGeneralShow"
       width="700px" append-to-body center destroy-on-close @closed="generalCancel"
     >
-      <el-form :model="generalFormModel" :rules="generalFormRules" ref="generalFormRef" class="hc-system-announcement-form" label-position="top">
-        <el-form-item label="公告内容:" prop="key">
-          <el-input type="textarea" v-model="generalFormModel.key" rows="3"></el-input>
+      <el-form :model="generalFormModel" :rules="generalFormRules" ref="generalFormRef" class="hc-system-announcement-form" label-width="auto">
+        <el-form-item label="公告内容:" prop="msgContent">
+          <el-input type="textarea" v-model="generalFormModel.msgContent" rows="3"></el-input>
         </el-form-item>
-        <el-form-item label="发布备注:" prop="desc">
-          <el-input type="textarea" v-model="generalFormModel.desc"></el-input>
+        <el-form-item label="发布备注:" prop="pushRemark">
+          <el-input type="textarea" v-model="generalFormModel.pushRemark"></el-input>
         </el-form-item>
-        <el-form-item label="发布配置:" prop="key1">
-          <el-radio-group v-model="generalFormModel.key1">
-            <el-radio label="0">现在</el-radio>
-            <el-radio label="3">三分钟后</el-radio>
-            <el-radio label="5">五分钟后</el-radio>
-            <el-radio label="10">十分钟后</el-radio>
-            <el-radio label="999">
-              <el-date-picker v-model="generalFormModel.key1Val" type="datetime" placeholder="选择日期时间" size="small"></el-date-picker>
-            </el-radio>
-          </el-radio-group>
+        <el-form-item label="发布配置:" prop="pushDateTime">
+          <el-date-picker v-model="generalFormModel.pushDateTime" type="datetime" placeholder="选择日期时间" :picker-options="pickerOptions" format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
         </el-form-item>
-        <el-form-item label="公告停留时间:" prop="key2">
-          <el-radio-group v-model="generalFormModel.key2">
-            <el-radio label="1">一分钟</el-radio>
-            <el-radio label="3">三分钟</el-radio>
-            <el-radio label="5">五分钟</el-radio>
-            <el-radio label="10">十分钟</el-radio>
-            <el-radio label="999">
-              <el-select v-model="generalFormModel.key2Val" clearable filterable size="small" style="width: 90px;">
-                <el-option v-for="i in 60" :label="`${i}分钟`" :value="i"></el-option>
-              </el-select>
-            </el-radio>
-          </el-radio-group>
+        <el-form-item label="停留时间:" prop="msgShowTime">
+          <el-select v-model="generalFormModel.msgShowTime" clearable filterable style="width: 190px;">
+            <el-option v-for="i in 60" :label="`${i}分钟`" :value="i"></el-option>
+          </el-select>
         </el-form-item>
-        <el-form-item label="涉及系统:" prop="key3">
-          <el-checkbox-group v-model="generalFormModel.key3">
-            <el-checkbox label="1">质检系统</el-checkbox>
-            <el-checkbox label="2">档案系统</el-checkbox>
-            <el-checkbox label="3">计量系统</el-checkbox>
+        <el-form-item label="涉及系统:" prop="pushSystem">
+          <el-checkbox-group v-model="generalFormModel.pushSystem">
+            <el-checkbox v-for="item in systemClinet" :label="item.clientId">{{item.name || item.clientId}}</el-checkbox>
           </el-checkbox-group>
         </el-form-item>
       </el-form>
@@ -286,62 +168,52 @@
       class="hc-system-announcement-dialog h-full w-700px" title="发布系统公告" :visible.sync="isSystemUpdateShow"
       width="700px" append-to-body center destroy-on-close @closed="systemUpdateCancel"
     >
-      <el-form :model="updateFormModel" :rules="updateFormRules" ref="updateFormRef" class="hc-system-announcement-form" label-position="top">
-        <el-form-item label="公告内容:" prop="key">
-          <el-input type="textarea" v-model="updateFormModel.key" rows="3"></el-input>
+      <el-form :model="updateFormModel" :rules="updateFormRules" ref="updateFormRef" class="hc-system-announcement-form" label-width="auto">
+        <el-form-item label="公告内容:" prop="msgContent">
+          <el-input type="textarea" v-model="updateFormModel.msgContent" rows="3"></el-input>
         </el-form-item>
-        <el-form-item label="发布备注:" prop="desc">
-          <el-input type="textarea" v-model="updateFormModel.desc"></el-input>
+        <el-form-item label="发布备注:" prop="pushRemark">
+          <el-input type="textarea" v-model="updateFormModel.pushRemark"></el-input>
         </el-form-item>
-        <el-form-item label="更新类型:" prop="key4">
-          <el-checkbox-group v-model="updateFormModel.key4">
+        <el-form-item label="更新类型:" prop="updateServerType">
+          <el-checkbox-group v-model="updateFormModel.updateServerType">
             <el-checkbox label="1">前端页面</el-checkbox>
             <el-checkbox label="2">后端接口</el-checkbox>
           </el-checkbox-group>
         </el-form-item>
-        <el-form-item label="更新原因:" prop="key5">
-          <el-radio-group v-model="updateFormModel.key5">
+        <el-form-item label="更新原因:" prop="updateCodeType">
+          <el-radio-group v-model="updateFormModel.updateCodeType">
             <el-radio label="1">新功能需求</el-radio>
             <el-radio label="2">bug修复</el-radio>
           </el-radio-group>
         </el-form-item>
-        <el-form-item label="发布配置:" prop="key1">
-          <el-radio-group v-model="updateFormModel.key1">
-            <el-radio label="0">现在</el-radio>
-            <el-radio label="3">三分钟后</el-radio>
-            <el-radio label="5">五分钟后</el-radio>
-            <el-radio label="10">十分钟后</el-radio>
-            <el-radio label="999">
-              <el-date-picker v-model="updateFormModel.key1Val" type="datetime" placeholder="选择日期时间" size="small"></el-date-picker>
-            </el-radio>
-          </el-radio-group>
+        <el-form-item label="发布配置:" prop="pushDateTime">
+          <el-date-picker v-model="updateFormModel.pushDateTime" type="datetime" placeholder="选择日期时间" :picker-options="pickerOptions" format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
         </el-form-item>
         <el-form-item label="时间配置:" prop="key2">
           <span>剩余</span>
           <span style="margin-left: 5px">
-            <el-select v-model="updateFormModel.key2Val" clearable filterable size="small" style="width: 90px;" placeholder="分钟">
+            <el-select v-model="updateFormModel.key2Val" clearable filterable size="small" style="width: 90px;" placeholder="分钟" disabled>
                 <el-option v-for="i in 60" :label="`${i}分钟`" :value="i"></el-option>
               </el-select>
           </span>
           <span style="margin-left: 5px">进行提醒,</span>
           <span style="margin-left: 5px">
-            <el-select v-model="updateFormModel.key2Val1" clearable filterable size="small" style="width: 70px;" placeholder="时间">
+            <el-select v-model="updateFormModel.key2Val1" clearable filterable size="small" style="width: 70px;" placeholder="时间" disabled>
                 <el-option v-for="i in 60" :label="i" :value="i"></el-option>
               </el-select>
           </span>
           <span style="margin-left: 5px">
-            <el-select v-model="updateFormModel.key2Val2" clearable filterable size="small" style="width: 80px;" placeholder="单位">
+            <el-select v-model="updateFormModel.key2Val2" clearable filterable size="small" style="width: 80px;" placeholder="单位" disabled>
                 <el-option label="分钟" value="1"></el-option>
                 <el-option label="秒钟" value="2"></el-option>
               </el-select>
           </span>
           <span style="margin-left: 5px">开始进入倒计时</span>
         </el-form-item>
-        <el-form-item label="涉及系统:" prop="key3">
-          <el-checkbox-group v-model="updateFormModel.key3">
-            <el-checkbox label="1">质检系统</el-checkbox>
-            <el-checkbox label="2">档案系统</el-checkbox>
-            <el-checkbox label="3">计量系统</el-checkbox>
+        <el-form-item label="涉及系统:" prop="pushSystem">
+          <el-checkbox-group v-model="updateFormModel.pushSystem">
+            <el-checkbox v-for="item in systemClinet" :label="item.clientId">{{item.name || item.clientId}}</el-checkbox>
           </el-checkbox-group>
         </el-form-item>
       </el-form>
@@ -355,100 +227,117 @@
 
 <script>
 import '@/styles/announcement.scss'
+import {getList, getAwaitMsg, getClinetAll, add, update, cancelPush, remove} from "@/api/system/announcement";
 export default {
   data() {
     return {
-      //系统索引
-      systemClassify: '1-1',
-      //系统信息
-      isSystemInfoShow: false,
-      systemInfoData: {type: '1'},
-      systemInfoRules: {
-        type: [{ required: true, message: '请选择数据类型', trigger: 'blur' }],
-        name: [{ required: true, message: '请输入分组名称', trigger: 'blur' }],
-        groupId: [{ required: true, message: '请选择上级分组', trigger: 'blur' }],
-        client: [{ required: true, message: '请选择关联应用', trigger: 'blur' }],
-        title: [{ required: true, message: '请输入项目名称', trigger: 'blur' }],
-      },
       //搜索
       searchForm: {current: 1, size: 20, total: 0},
       //公告列表
-      tableData: [{
-        date: '2016-05-02',
-        name: '王小虎',
-        address: '上海市普陀区金沙江路 1518 弄',
-        state: '已取消'
-      }, {
-        date: '2016-05-04',
-        name: '王小虎',
-        address: '上海市普陀区金沙江路 1517 弄',
-        state: '待发布'
-      }, {
-        date: '2016-05-01',
-        name: '王小虎',
-        address: '上海市普陀区金沙江路 1519 弄',
-        state: '已发布'
-      }, {
-        date: '2016-05-03',
-        name: '王小虎',
-        address: '上海市普陀区金沙江路 1516 弄'
-      }],
+      isLoading: false,
+      tableData: [],
+      tableMultiple: [],
       //待发布
       isReleasedShow: false,
+      releasedNum: 0,
+      releasedData: {},
       //普通公告
       isGeneralShow: false,
       generalFormModel: {
-        key1Val: null,
-        key2Val: null,
-        key3: [],
+        pushSystem: [],
+      },
+      generalFormRules: {
+        msgContent: [
+          { required: true, message: '请填写公告内容', trigger: 'blur' }
+        ],
+        pushDateTime: [
+          { required: true, message: '请选择发布配置', trigger: 'blur' }
+        ],
+        msgShowTime: [
+          { required: true, message: '请选择停留时间', trigger: 'blur' }
+        ],
+        pushSystem: [
+          { required: true, message: '请选择涉及系统', trigger: 'blur' }
+        ]
       },
-      generalFormRules: {},
       //系统更新
       isSystemUpdateShow: false,
       updateFormModel: {
-        key3: [], key4: []
+        updateServerType: [],
+        pushSystem: []
+      },
+      updateFormRules: {
+        msgContent: [
+          { required: true, message: '请填写公告内容', trigger: 'blur' }
+        ],
+        updateServerType: [
+          { required: true, message: '请选择更新类型', trigger: 'blur' }
+        ],
+        updateCodeType: [
+          { required: true, message: '请选择更新原因', trigger: 'blur' }
+        ],
+        pushDateTime: [
+          { required: true, message: '请选择发布配置', trigger: 'blur' }
+        ],
+        pushSystem: [
+          { required: true, message: '请选择涉及系统', trigger: 'blur' }
+        ]
+      },
+      systemClinet: [],
+      //日期时间
+      pickerOptions: {
+        shortcuts: [{
+          text: '三分钟',
+          onClick(picker) {
+            const date = new Date();
+            date.setTime(date.getTime() + 3 * 60 * 1000);
+            picker.$emit('pick', date);
+          }
+        }, {
+          text: '五分钟',
+          onClick(picker) {
+            const date = new Date();
+            date.setTime(date.getTime() + 5 * 60 * 1000);
+            picker.$emit('pick', date);
+          }
+        }, {
+          text: '十分钟',
+          onClick(picker) {
+            const date = new Date();
+            date.setTime(date.getTime() + 10 * 60 * 1000);
+            picker.$emit('pick', date);
+          }
+        }, {
+          text: '三十分钟',
+          onClick(picker) {
+            const date = new Date();
+            date.setTime(date.getTime() + 30 * 60 * 1000);
+            picker.$emit('pick', date);
+          }
+        }]
       },
-      updateFormRules: {},
     }
-  },
-  computed: {
-
   },
   created() {
-
+    this.searchClick()
+    this.getAwaitMsgApi()
   },
   methods: {
-    //系统分类被选择
-    systemClassifySelect(index) {
-      this.systemClassify = index
-    },
-    //新增系统
-    addSystemClick() {
-      this.systemInfoData = {type: '1'}
-      this.isSystemInfoShow = true
-    },
-    //编辑系统
-    editSystemClick(event, index) {
-      // 阻止默认右键菜单
-      event.preventDefault();
-      console.log(index)
-      this.systemInfoData = {id:'11', type: '1'}
-      this.isSystemInfoShow = true
-    },
-    //确定新增编辑系统
-    async systemFormSubmit() {
-      const isForm = await this.getFormValidate('systemInfoRef')
-      if (!isForm) return
-      console.log(this.systemInfoData)
-    },
-    //删除系统分类
-    systemFormDel() {
-      console.log('操作删除')
-    },
-    //取消新增编辑系统
-    systemFormCancel() {
-      this.isSystemInfoShow = false
-      this.systemInfoData = {}
+    //获取待发布公告
+    async getAwaitMsgApi() {
+      const res = await getAwaitMsg()
+      const {code, data, msg} = res.data || {}
+      if (code!==200) {
+        this.$message.error(msg);
+      }
+      let num = 0
+      const arr = data || {}
+      arr.systemMsg = arr.systemMsg || []
+      arr.updateMsg = arr.updateMsg || []
+      this.releasedData = arr
+      num = num + arr.systemMsg.length
+      num = num + arr.updateMsg.length
+      this.releasedNum = num
     },
     handleSizeChange(val) {
       this.searchForm.size = val
@@ -456,17 +345,72 @@ export default {
     handleCurrentChange(val) {
       this.searchForm.current = val
     },
+    //搜索
+    searchClick() {
+      this.searchForm.current = 1
+      this.getTableData()
+    },
+    //获取表格数据
+    async getTableData() {
+      this.isLoading = true
+      const res = await getList(this.searchForm)
+      const {code, data, msg} = res.data || {}
+      const {records, total} = data || {}
+      this.tableData = records
+      this.searchForm.total = total
+      if (code!==200) {
+        this.$message.error(msg);
+      }
+      this.isLoading = false
+    },
     //表格多选
     tableSelection(val) {
-      console.log(val)
+      this.tableMultiple = val
     },
     //表格编辑
-    handleEdit(index, row) {
-      console.log(index, row);
+    handleEdit(row) {
+      const form = JSON.parse(JSON.stringify(row));
+      if (form.msgType === 1) {
+        form.updateServerType = form.updateServerType.split(',')
+        form.pushSystem = form.pushSystem.split(',')
+        this.updateFormModel = form
+        this.systemUpdateShow()
+      } else {
+        form.pushSystem = form.pushSystem.split(',')
+        this.generalFormModel = form
+        this.generalShow()
+      }
     },
     //表格删除
-    handleDelete(index, row) {
-      console.log(index, row);
+    async handleDelete() {
+      const arr = this.tableMultiple
+      if (arr.length<=0) {
+        this.$message.warning('请先勾选数据');
+        return
+      }
+      const ids = arr.flat().map(item => item.id).join(',');
+      const res = await remove(ids)
+      const {code, msg} = res.data || {}
+      if (code === 200) {
+        this.$message.success(msg || '操作成功');
+        this.tableMultiple = []
+        this.searchClick()
+        this.getAwaitMsgApi()
+      } else {
+        this.$message.error(msg || '操作失败');
+      }
+    },
+    //取消发布
+    async handleCancel(row) {
+      const res = await cancelPush(row.id)
+      const {code, msg} = res.data || {}
+      if (code === 200) {
+        this.$message.success(msg || '操作成功');
+        this.searchClick()
+        this.getAwaitMsgApi()
+      } else {
+        this.$message.error(msg || '操作失败');
+      }
     },
     //待发布打开
     releasedShow() {
@@ -479,25 +423,79 @@ export default {
     //打开普通公告
     generalShow() {
       this.isGeneralShow = true
+      this.getClinetAllApi()
     },
-    generalFormSubmit() {
-      this.generalCancel()
+    //获取应用列表
+    async getClinetAllApi() {
+      const res = await getClinetAll()
+      const {data} = res.data || []
+      this.systemClinet = data
+    },
+    async generalFormSubmit() {
+      const isForm = await this.getFormValidate('generalFormRef')
+      if (!isForm) return
+      let form = this.generalFormModel
+      form.pushSystem = form.pushSystem.join(',')
+      form.msgType = 2
+      let res
+      if (form.id) {
+        res = await update(form)
+      } else {
+        res = await add(form)
+      }
+      const {code, msg} = res.data || {}
+      if (code===200) {
+        this.$message.success(msg || '操作成功');
+        this.generalCancel()
+        this.searchClick()
+        this.getAwaitMsgApi()
+      } else {
+        this.$message.error(msg || '操作失败');
+      }
     },
     //普通公告关闭
     generalCancel() {
       this.isGeneralShow = false
+      this.generalFormModel = {
+        pushSystem: []
+      }
     },
-    //系统更新公告关闭
+    //系统更新公告
     systemUpdateShow() {
       this.isSystemUpdateShow = true
+      this.getClinetAllApi()
     },
     //系统更新公告提交
-    updateFormSubmit() {
-      this.systemUpdateCancel()
+    async updateFormSubmit() {
+      const isForm = await this.getFormValidate('updateFormRef')
+      if (!isForm) return
+      let form = this.updateFormModel
+      form.pushSystem = form.pushSystem.join(',')
+      form.updateServerType = form.updateServerType.join(',')
+      form.msgType = 1
+      let res
+      if (form.id) {
+        res = await update(form)
+      } else {
+        res = await add(form)
+      }
+      const {code, msg} = res.data || {}
+      if (code===200) {
+        this.$message.success(msg || '操作成功');
+        this.systemUpdateCancel()
+        this.searchClick()
+        this.getAwaitMsgApi()
+      } else {
+        this.$message.error(msg || '操作失败');
+      }
     },
     //系统更新公告关闭
     systemUpdateCancel() {
       this.isSystemUpdateShow = false
+      this.updateFormModel = {
+        updateServerType: [],
+        pushSystem: []
+      }
     },
     //验证表单
     async getFormValidate(ref) {
@@ -514,7 +512,3 @@ export default {
   },
 }
 </script>
-
-<style lang="scss">
-
-</style>