qinchao 4 éve
szülő
commit
70dfcdc880
2 módosított fájl, 24 hozzáadás és 17 törlés
  1. 1 0
      src/constants/constants.js
  2. 23 17
      src/modules/examwork/view/notice.vue

+ 1 - 0
src/constants/constants.js

@@ -81,6 +81,7 @@ export const PUBLISH_STATUS = [
   { code: "TO_BE_PUBLISHED", name: "待发布" },
   { code: "PUBLISHING", name: "发布中" },
   { code: "PUBLISHED", name: "已发布" },
+  { code: "RECALLED", name: "已撤回" },
 ];
 //公告接受规则类型
 export const NOTICE_RECEIVER_RULE_TYPE = [

+ 23 - 17
src/modules/examwork/view/notice.vue

@@ -121,19 +121,11 @@
               <el-button
                 v-if="scope.row.publishStatus == 'DRAFT'"
                 size="mini"
-                type="warning"
+                type="primary"
                 icon="el-icon-message"
-                @click="sendMsg(scope.row.id, 'TO_BE_PUBLISHED')"
+                @click="sendMsg(scope.row.id)"
                 >发送</el-button
               >
-              <el-button
-                v-if="scope.row.publishStatus == 'PUBLISHED'"
-                size="mini"
-                type="danger"
-                icon="el-icon-back"
-                @click="sendMsg(scope.row.id, 'DRAFT')"
-                >撤回</el-button
-              >
               <el-dropdown
                 style="margin-left: 10px"
                 :disabled="scope.row.publishStatus != 'DRAFT'"
@@ -163,6 +155,16 @@
                       >删除</el-button
                     >
                   </el-dropdown-item>
+                  <el-dropdown-item>
+                    <el-button
+                      v-if="scope.row.publishStatus == 'PUBLISHED'"
+                      size="mini"
+                      type="warning"
+                      icon="el-icon-back"
+                      @click="recallMsg(scope.row.id)"
+                      >撤回</el-button
+                    >
+                  </el-dropdown-item>
                 </el-dropdown-menu>
               </el-dropdown>
             </div>
@@ -892,15 +894,19 @@ export default {
         });
       }
     },
-    sendMsg(id, status) {
-      let msg = "发送成功";
-      if (status === "DRAFT") {
-        msg = "撤回成功";
-      }
+    sendMsg(id) {
+      this.$httpWithMsg
+        .get(EXAM_WORK_API + "/notice/sendMsg/" + id)
+        .then(() => {
+          this.success("发送成功");
+          this.searchForm();
+        });
+    },
+    recallMsg(id) {
       this.$httpWithMsg
-        .get(EXAM_WORK_API + "/notice/sendMsg/" + status + "/" + id)
+        .get(EXAM_WORK_API + "/notice/recallMsg/" + id)
         .then(() => {
-          this.success(msg);
+          this.success("撤回成功");
           this.searchForm();
         });
     },