|
@@ -91,9 +91,26 @@
|
|
|
<el-button type="primary" :loading="loading" @click="toCalc">{{
|
|
|
loading ? "正在计算中" : "开始试算"
|
|
|
}}</el-button>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ :loading="publishing"
|
|
|
+ :disabled="!modalForm.id"
|
|
|
+ @click="toPublish"
|
|
|
+ >发布</el-button
|
|
|
+ >
|
|
|
</div>
|
|
|
- <p v-if="calcErrorMsg" class="tips-info tips-error">
|
|
|
- 错误信息:{{ calcErrorMsg }}
|
|
|
+ <div>
|
|
|
+ <span
|
|
|
+ >计算状态:<i>{{ ASSIGN_CALC_STATUS[detailData.status] }}</i></span
|
|
|
+ >
|
|
|
+ <span class="ml-4"
|
|
|
+ >发布状态:<i :class="{ 'color-success': detailData.publish }">{{
|
|
|
+ detailData.publish ? "已发布" : "未发布"
|
|
|
+ }}</i></span
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ <p v-if="detailData.errorMsg" class="tips-info tips-error">
|
|
|
+ 计算结果:失败,错误信息:{{ detailData.errorMsg }}
|
|
|
</p>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
@@ -102,7 +119,12 @@
|
|
|
|
|
|
<script>
|
|
|
import timeMixin from "@/mixins/timeMixin";
|
|
|
-import { assignmentDetailInfo, assignmentCalculate } from "../../api";
|
|
|
+import {
|
|
|
+ assignmentDetailInfo,
|
|
|
+ assignmentCalculate,
|
|
|
+ assignmentPublish,
|
|
|
+} from "../../api";
|
|
|
+import { ASSIGN_CALC_STATUS } from "@/constants/enumerate";
|
|
|
|
|
|
export default {
|
|
|
name: "assign-config",
|
|
@@ -134,6 +156,7 @@ export default {
|
|
|
FORMULA1: "公式1",
|
|
|
FORMULA2: "公式2",
|
|
|
},
|
|
|
+ ASSIGN_CALC_STATUS,
|
|
|
rules: {
|
|
|
formula: [
|
|
|
{
|
|
@@ -155,9 +178,10 @@ export default {
|
|
|
},
|
|
|
],
|
|
|
},
|
|
|
- calcErrorMsg: "",
|
|
|
loading: false,
|
|
|
+ publishing: false,
|
|
|
statusPeriod: 5000,
|
|
|
+ detailData: {},
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
@@ -169,7 +193,7 @@ export default {
|
|
|
this.modalForm.value = coefficient.value;
|
|
|
this.modalForm.detail = coefficient.detail || [];
|
|
|
}
|
|
|
- this.calcErrorMsg = this.detailInfo.errorMsg;
|
|
|
+ this.detailData = { ...this.detailInfo };
|
|
|
if (!this.modalForm.detail.length) {
|
|
|
this.modalForm.detail = this.detailInfo.inspectCollege.map((item) => {
|
|
|
return {
|
|
@@ -193,9 +217,9 @@ export default {
|
|
|
const res = await assignmentDetailInfo(this.assignInfo, true);
|
|
|
this.loading = res.status === "RUNNING";
|
|
|
this.modalForm.id = res.id;
|
|
|
+ this.detailData = res;
|
|
|
|
|
|
if (!this.loading) {
|
|
|
- this.calcErrorMsg = res.errorMsg;
|
|
|
this.$message.success("计算完成!");
|
|
|
return;
|
|
|
}
|
|
@@ -216,6 +240,23 @@ export default {
|
|
|
item.value = val;
|
|
|
});
|
|
|
},
|
|
|
+ async toPublish() {
|
|
|
+ if (!this.modalForm.id || this.detailData.status !== "FINISH") {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const result = await this.$confirm(`确定要发布赋分成绩吗?`, "提示", {
|
|
|
+ type: "warning",
|
|
|
+ });
|
|
|
+ if (result !== "confirm") return;
|
|
|
+
|
|
|
+ if (this.publishing) return;
|
|
|
+ this.publishing = true;
|
|
|
+
|
|
|
+ const res = await assignmentPublish(this.modalForm.id).catch(() => {});
|
|
|
+ this.publishing = false;
|
|
|
+ if (!res) return;
|
|
|
+ this.$message.success("发布成功!");
|
|
|
+ },
|
|
|
async toCalc() {
|
|
|
const valid = await this.$refs.modalFormComp.validate().catch(() => {});
|
|
|
if (!valid) return;
|
|
@@ -229,7 +270,7 @@ export default {
|
|
|
formula: this.modalForm.formula,
|
|
|
coefficient: this.modalForm,
|
|
|
};
|
|
|
- this.calcErrorMsg = "";
|
|
|
+ this.detailData.errorMsg = "";
|
|
|
const data = await assignmentCalculate(datas).catch(() => {});
|
|
|
if (!data) {
|
|
|
this.loading = false;
|