Kaynağa Gözat

命题计划统计表修改

zhangjie 3 yıl önce
ebeveyn
işleme
d0ffe6abb6

+ 1 - 1
src/components/UploadButton.vue

@@ -11,7 +11,7 @@
     :http-request="upload"
     :disabled="disabled"
     :show-file-list="false"
-    style="display:inline-block;margin: 0 18px;"
+    style="display:inline-block;margin: 0 10px;"
     ref="UploadComp"
   >
     <el-button

+ 6 - 0
src/modules/exam/api.js

@@ -216,3 +216,9 @@ export const removeDataTask = ({ ids, type }) => {
 export const statisticsList = datas => {
   return $postParam("/api/admin/statistics/list", datas);
 };
+export const statisticsDelete = ids => {
+  return $post("/api/admin/statistics/delete", { ids });
+};
+export const statisticsFreshen = () => {
+  return $postParam("/api/admin/statistics/freshen", {});
+};

+ 63 - 2
src/modules/exam/views/StatisticsManage.vue

@@ -65,6 +65,22 @@
         </el-form-item>
       </el-form>
       <div class="part-box-action">
+        <el-button
+          v-if="checkPrivilege('button', 'Delete')"
+          type="danger"
+          icon="el-icon-delete"
+          :loading="loading"
+          @click="toBatDelete"
+          >批量删除</el-button
+        >
+        <el-button
+          v-if="checkPrivilege('button', 'Freshen')"
+          type="primary"
+          icon="el-icon-refresh"
+          :loading="loading"
+          @click="toFresh"
+          >刷新数据</el-button
+        >
         <el-button
           type="success"
           icon="el-icon-download"
@@ -85,7 +101,16 @@
       </div>
     </div>
     <div class="part-box part-box-pad">
-      <el-table ref="TableList" :data="dataList">
+      <el-table
+        ref="TableList"
+        :data="dataList"
+        @selection-change="handleSelectionChange"
+      >
+        <el-table-column
+          type="selection"
+          width="55"
+          align="center"
+        ></el-table-column>
         <el-table-column
           type="index"
           label="序号"
@@ -125,7 +150,7 @@
 </template>
 
 <script>
-import { statisticsList } from "../api";
+import { statisticsList, statisticsDelete, statisticsFreshen } from "../api";
 import { organizationFindByTypeList } from "../../base/api";
 import UploadButton from "../../../components/UploadButton";
 
@@ -141,12 +166,14 @@ export default {
         teacherName: "",
         status: ""
       },
+      loading: false,
       current: 1,
       size: this.GLOBAL.pageSize,
       total: 0,
       dataList: [],
       curRow: {},
       teachingRooms: [],
+      multipleSelection: [],
       FINISH_STATUS: { UN_FINISH: "未完成", FINISH: "已完成" },
       // import
       uploadUrl: "/api/admin/statistics/import",
@@ -188,6 +215,40 @@ export default {
       if (!val) return;
       this.getTeachingRooms();
     },
+    handleSelectionChange(val) {
+      this.multipleSelection = val.map(item => item.id);
+    },
+    async toBatDelete() {
+      if (this.loading) return;
+
+      if (!this.multipleSelection.length) {
+        this.$message.error("请选择要删除的数据");
+        return;
+      }
+      const result = await this.$confirm("确定要删除选择的数据吗?", "提示", {
+        type: "warning"
+      }).catch(() => {});
+      if (result !== "confirm") return;
+
+      this.loading = true;
+      const data = await statisticsDelete(
+        this.multipleSelection
+      ).catch(() => {});
+      this.loading = false;
+      if (!data) return;
+
+      this.$message.success("提交成功!");
+      this.toPage(this.current);
+    },
+    async toFresh() {
+      this.loading = true;
+      const data = await statisticsFreshen().catch(() => {});
+      this.loading = false;
+      if (!data) return;
+
+      this.$message.success("刷新成功!");
+      this.toPage(1);
+    },
     // import
     uplaodError(errorData) {
       this.$notify.error({ title: "错误提示", message: errorData.message });