zhangjie 2 роки тому
батько
коміт
d3e06bfda8

+ 2 - 2
src/modules/base/api.js

@@ -175,8 +175,8 @@ export const assignmentDetailInfo = (datas, silence = false) => {
 export const assignmentCalculate = (datas) => {
   return $post("/api/assign/calc", datas);
 };
-export const assignmentPublish = (id) => {
-  return $postParam("/api/assign/publish", { id });
+export const assignmentPublish = (datas) => {
+  return $postParam("/api/assign/publish", datas);
 };
 export const assignmentCalcResult = (datas) => {
   // required: semesterId,examTypeId,courseCode,openCollege,

+ 2 - 2
src/modules/base/components/assignment/AssignConfig.vue

@@ -91,13 +91,13 @@
           <el-button type="primary" :loading="loading" @click="toCalc">{{
             loading ? "正在计算中" : "开始试算"
           }}</el-button>
-          <el-button
+          <!-- <el-button
             type="primary"
             :loading="publishing"
             :disabled="!modalForm.id"
             @click="toPublish"
             >发布</el-button
-          >
+          > -->
         </div>
         <div>
           <span

+ 60 - 8
src/modules/base/views/AssignmentCalculate.vue

@@ -47,15 +47,31 @@
         </el-table-column>
         <el-table-column prop="openCollege" label="开课学院"></el-table-column>
         <el-table-column prop="actualCount" label="有效人数"></el-table-column>
-        <el-table-column class-name="action-column" label="操作" width="200px">
+        <el-table-column prop="actualCount" label="发布状态">
+          <span
+            slot-scope="scope"
+            :class="{ 'color-success': scope.row.publish }"
+          >
+            {{ scope.row.publish ? "已发布" : "未发布" }}
+          </span>
+        </el-table-column>
+        <el-table-column class-name="action-column" label="操作" width="120">
           <template slot-scope="scope">
             <el-button
-              :class="scope.row.enable ? 'btn-danger' : 'btn-primary'"
+              class="btn-primary"
               type="text"
               @click="toCalc(scope.row)"
-              >{{ scope.row.enable ? "重算" : "试算" }}</el-button
             >
-            <!-- 查看 -->
+              试算</el-button
+            >
+            <el-button
+              v-if="isNotAssignUser"
+              class="btn-primary"
+              type="text"
+              @click="toPublish(scope.row)"
+            >
+              发布</el-button
+            >
           </template>
         </el-table-column>
       </el-table>
@@ -76,7 +92,7 @@
 </template>
 
 <script>
-import { assignmentDataList } from "../api";
+import { assignmentDataList, assignmentPublish } from "../api";
 
 export default {
   name: "assignment-calculate",
@@ -93,14 +109,17 @@ export default {
       size: this.GLOBAL.pageSize,
       total: 0,
       dataList: [],
+      publishing: false,
+      isAssignUser: [],
     };
   },
   async mounted() {
-    const orgId = this.$ls.get("user", { orgId: "" }).orgId;
-    if (orgId) {
-      this.filter.collegeId = orgId;
+    const user = this.$ls.get("user", { orgId: "", roleList: [] });
+    if (user.orgId) {
+      this.filter.collegeId = user.orgId;
       this.collegeDisabled = true;
     }
+    this.isNotAssignUser = user.roleList.some((item) => item !== "ASSIGN");
     await this.$refs.SemesterSelect.search();
   },
   methods: {
@@ -136,6 +155,39 @@ export default {
         name: "AssignmentCalculateDetail",
       });
     },
+    async toPublish(row) {
+      const canPublish =
+        !row.id || (row.id && row.formula && row.statue === "FINISH");
+      if (!canPublish) {
+        this.$message.error("赋分计算未完成,暂无法发布成绩!");
+        return;
+      }
+
+      const result = await this.$confirm(`确定要发布赋分成绩吗?`, "提示", {
+        type: "warning",
+      });
+      if (result !== "confirm") return;
+
+      if (this.publishing) return;
+      this.publishing = true;
+
+      let curAssignInfo = this.$objAssign(
+        {
+          semesterId: "",
+          examTypeId: "",
+          courseCode: "",
+          courseName: "",
+          openCollege: "",
+        },
+        row
+      );
+      curAssignInfo.collegeId = this.filter.collegeId;
+
+      const res = await assignmentPublish(curAssignInfo).catch(() => {});
+      this.publishing = false;
+      if (!res) return;
+      this.$message.success("发布成功!");
+    },
   },
 };
 </script>