|
@@ -0,0 +1,229 @@
|
|
|
+<template>
|
|
|
+ <div :class="['assign-config', { 'is-disabled': loading }]">
|
|
|
+ <el-form
|
|
|
+ ref="modalFormComp"
|
|
|
+ :model="modalForm"
|
|
|
+ :rules="rules"
|
|
|
+ label-width="100px"
|
|
|
+ >
|
|
|
+ <el-form-item label="赋分公式:" prop="formula">
|
|
|
+ <el-select
|
|
|
+ v-model="modalForm.formula"
|
|
|
+ placeholder="请选择"
|
|
|
+ @change="formulaChange"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="(val, key) in formulas"
|
|
|
+ :key="key"
|
|
|
+ :label="val"
|
|
|
+ :value="key"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ <div v-if="modalForm.formula">
|
|
|
+ <div v-if="modalForm.formula === 'FORMULA1'">
|
|
|
+ <p>赋值分=卷面成绩+ (100- 卷面成绩)/赋分系数</p>
|
|
|
+ </div>
|
|
|
+ <div v-if="modalForm.formula === 'FORMULA2'">
|
|
|
+ <p>
|
|
|
+ 赋值分=ROUND(IF(初始卷面>=参数,55+(初始卷面-参数)/(初始卷面最高分-参数)*(x-55),初始卷面*50/参数)*2,0)/2
|
|
|
+ </p>
|
|
|
+ <div>
|
|
|
+ <span style="float: left">说明:</span>
|
|
|
+ <div>
|
|
|
+ <p>1.如果初始卷面最高的大于99时,则x=100,否则x=99;</p>
|
|
|
+ <p>2.参数根据每次总体初始成绩的不及格率进行调整。</p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item
|
|
|
+ v-if="modalForm.formula === 'FORMULA1'"
|
|
|
+ label="赋分系数:"
|
|
|
+ prop="detail"
|
|
|
+ >
|
|
|
+ <el-radio-group v-model="modalForm.all">
|
|
|
+ <el-radio :label="true">统一设置</el-radio>
|
|
|
+ <el-radio :label="false">按考查学院设置</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ <br />
|
|
|
+ <el-input-number
|
|
|
+ v-if="modalForm.all"
|
|
|
+ v-model.number="modalForm.value"
|
|
|
+ :min="0"
|
|
|
+ :controls="false"
|
|
|
+ placeholder="请填写赋分系数"
|
|
|
+ @change="allRateChange"
|
|
|
+ ></el-input-number>
|
|
|
+ <div v-else class="rate-details">
|
|
|
+ <div
|
|
|
+ class="rate-detail"
|
|
|
+ v-for="item in modalForm.detail"
|
|
|
+ :key="item.college"
|
|
|
+ >
|
|
|
+ <div class="rate-detail-label">{{ item.college }}</div>
|
|
|
+ <div class="rate-detail-content">
|
|
|
+ <el-input-number
|
|
|
+ v-model.number="item.value"
|
|
|
+ :min="0"
|
|
|
+ :controls="false"
|
|
|
+ placeholder="请填写赋分系数"
|
|
|
+ ></el-input-number>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item
|
|
|
+ v-if="modalForm.formula === 'FORMULA2'"
|
|
|
+ label="参数:"
|
|
|
+ prop="detail"
|
|
|
+ >
|
|
|
+ <el-input-number
|
|
|
+ v-model.number="modalForm.value"
|
|
|
+ :min="0"
|
|
|
+ :controls="false"
|
|
|
+ placeholder="请填写参数"
|
|
|
+ @change="allRateChange"
|
|
|
+ ></el-input-number>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" :loading="loading" @click="toCalc">{{
|
|
|
+ loading ? "正在计算中" : "开始试算"
|
|
|
+ }}</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import timeMixin from "@/mixins/timeMixin";
|
|
|
+import { assignmentDetailInfo, assignmentCalculate } from "../../api";
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "assign-config",
|
|
|
+ mixins: [timeMixin],
|
|
|
+ props: {
|
|
|
+ detailInfo: {
|
|
|
+ type: Object,
|
|
|
+ default() {
|
|
|
+ return {};
|
|
|
+ },
|
|
|
+ },
|
|
|
+ assignInfo: {
|
|
|
+ type: Object,
|
|
|
+ default() {
|
|
|
+ return {};
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ modalForm: {
|
|
|
+ formula: "",
|
|
|
+ all: true,
|
|
|
+ value: undefined,
|
|
|
+ detail: [],
|
|
|
+ },
|
|
|
+ formulas: {
|
|
|
+ FORMULA1: "公式1",
|
|
|
+ FORMULA2: "公式2",
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ formula: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "请选择赋分公式",
|
|
|
+ trigger: "change",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ detail: [
|
|
|
+ {
|
|
|
+ validator: (rule, value, callback) => {
|
|
|
+ if (value.some((item) => !item.value)) {
|
|
|
+ return callback(new Error(`完成参数设置`));
|
|
|
+ }
|
|
|
+
|
|
|
+ callback();
|
|
|
+ },
|
|
|
+ trigger: "change",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ loading: false,
|
|
|
+ statusPeriod: 5000,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.modalForm.formula = this.detailInfo.formula;
|
|
|
+ this.modalForm.all = this.detailInfo.coefficient.all;
|
|
|
+ this.modalForm.value = this.detailInfo.coefficient.value;
|
|
|
+ this.modalForm.detail = this.detailInfo.coefficient.detail || [];
|
|
|
+ if (!this.modalForm.detail.length) {
|
|
|
+ this.modalForm.detail = this.detailInfo.inspectCollege.map((item) => {
|
|
|
+ return {
|
|
|
+ college: item,
|
|
|
+ value: undefined,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.loading = this.detailInfo.status === "RUNNING";
|
|
|
+ if (!this.loading) return;
|
|
|
+ this.addSetTime(() => {
|
|
|
+ this.getData();
|
|
|
+ }, this.statusPeriod);
|
|
|
+ },
|
|
|
+ beforeDestroy() {
|
|
|
+ this.clearSetTs();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ async getData() {
|
|
|
+ this.clearSetTs();
|
|
|
+ const res = await assignmentDetailInfo(this.assignInfo);
|
|
|
+ this.loading = res.status === "RUNNING";
|
|
|
+
|
|
|
+ if (!this.loading) {
|
|
|
+ this.$message.success("计算完成!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.addSetTime(() => {
|
|
|
+ this.getData();
|
|
|
+ }, this.statusPeriod);
|
|
|
+ },
|
|
|
+ formulaChange(val) {
|
|
|
+ if (val === "FORMULA2") {
|
|
|
+ this.modalForm.all = true;
|
|
|
+ }
|
|
|
+ this.modalForm.value = undefined;
|
|
|
+ this.allRateChange(this.modalForm.value);
|
|
|
+ },
|
|
|
+ allRateChange(val) {
|
|
|
+ this.modalForm.detail.forEach((item) => {
|
|
|
+ item.value = val;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ async toCalc() {
|
|
|
+ const valid = await this.$refs.modalFormComp.validate().catch(() => {});
|
|
|
+ if (!valid) return;
|
|
|
+
|
|
|
+ if (this.loading) return;
|
|
|
+ this.loading = true;
|
|
|
+
|
|
|
+ const datas = {
|
|
|
+ ...this.assignInfo,
|
|
|
+ formula: this.modalForm.formula,
|
|
|
+ coefficient: this.modalForm,
|
|
|
+ };
|
|
|
+ const data = await assignmentCalculate(datas).catch(() => {});
|
|
|
+ if (!data) {
|
|
|
+ this.loading = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.$message.success("提交成功,正在计算中……");
|
|
|
+ this.addSetTime(() => {
|
|
|
+ this.getData();
|
|
|
+ }, this.statusPeriod);
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|