|
@@ -13,7 +13,6 @@
|
|
|
<tr>
|
|
|
<th>试卷类型</th>
|
|
|
<th>试卷文件</th>
|
|
|
- <th>答题卡创建方式</th>
|
|
|
<th>答题卡</th>
|
|
|
<th v-if="IS_APPLY">操作</th>
|
|
|
</tr>
|
|
@@ -56,36 +55,54 @@
|
|
|
<i>{{ attachment.filename }}</i>
|
|
|
</el-button>
|
|
|
</td>
|
|
|
- <td :rowspan="paperAttachments.length" v-if="index === 0">
|
|
|
- {{ createCardTypeName }}
|
|
|
- </td>
|
|
|
- <td :rowspan="paperAttachments.length" v-if="index === 0">
|
|
|
- <el-button
|
|
|
- type="text"
|
|
|
- class="btn-primary"
|
|
|
- v-if="!exposedMode && IS_APPLY"
|
|
|
- @click="toCreateOrViewCard"
|
|
|
- >{{ cardTodoName }}</el-button
|
|
|
- >
|
|
|
+ <td>
|
|
|
+ <template v-if="IS_APPLY">
|
|
|
+ <el-select
|
|
|
+ class="mr-2"
|
|
|
+ v-model="attachment.cardId"
|
|
|
+ placeholder="请选择"
|
|
|
+ style="width: 200px"
|
|
|
+ filterable
|
|
|
+ @change="cardChange(attachment)"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in cards"
|
|
|
+ :key="item.id"
|
|
|
+ :value="item.id"
|
|
|
+ :label="item.title"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ <el-button
|
|
|
+ class="btn-primary"
|
|
|
+ type="text"
|
|
|
+ :disabled="!attachment.cardId"
|
|
|
+ @click="toViewCard(attachment)"
|
|
|
+ >预览</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ class="btn-primary"
|
|
|
+ type="text"
|
|
|
+ :disabled="
|
|
|
+ !attachment.cardId || attachment.cardType === 'GENERIC'
|
|
|
+ "
|
|
|
+ @click="toEditCard(attachment)"
|
|
|
+ >编辑</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ class="btn-primary"
|
|
|
+ type="text"
|
|
|
+ :disabled="!canCreateCard"
|
|
|
+ @click="toCreateCard(attachment)"
|
|
|
+ >新建</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
<el-button
|
|
|
v-else
|
|
|
type="text"
|
|
|
class="btn-primary"
|
|
|
- @click="toViewCard"
|
|
|
- >
|
|
|
- 查看题卡
|
|
|
- </el-button>
|
|
|
- <el-button
|
|
|
- v-if="
|
|
|
- curTaskApply.makeMethod &&
|
|
|
- curTaskApply.makeMethod !== 'CUST' &&
|
|
|
- !exposedMode &&
|
|
|
- IS_APPLY
|
|
|
- "
|
|
|
- type="text"
|
|
|
- class="btn-danger"
|
|
|
- @click="changeCreateCardType"
|
|
|
- >切换题卡创建方式</el-button
|
|
|
+ @click="toViewCard(attachment)"
|
|
|
+ >{{ attachment.cardTitle || "预览" }}</el-button
|
|
|
>
|
|
|
</td>
|
|
|
<td v-if="IS_APPLY">
|
|
@@ -469,19 +486,14 @@ import CardOptionDialog from "./CardOptionDialog";
|
|
|
import {
|
|
|
taskApplyDetail,
|
|
|
updateTaskApply,
|
|
|
- // updateTaskReview,
|
|
|
taskAuditApply,
|
|
|
- switchCardCreateMethod
|
|
|
- // taskAllFlowSetups,
|
|
|
- // taskAllApproverPeople,
|
|
|
- // taskAllApproverExchangePeople,
|
|
|
- // taskApproverNextPeople
|
|
|
+ cardForSelectList
|
|
|
} from "../api";
|
|
|
import { attachmentPreview } from "../../login/api";
|
|
|
import SimpleImagePreview from "@/components/SimpleImagePreview";
|
|
|
import SelectUserDialog from "../../base/components/SelectUserDialog";
|
|
|
import ModifyCard from "../../card/components/ModifyCard";
|
|
|
-import { CARD_SOURCE_TYPE, TASK_AUDIT_RESULT } from "@/constants/enumerate";
|
|
|
+import { TASK_AUDIT_RESULT, COMMON_CARD_RULE_ID } from "@/constants/enumerate";
|
|
|
import {
|
|
|
taskFlowDetail,
|
|
|
taskFlowApproverExchange,
|
|
@@ -550,6 +562,7 @@ export default {
|
|
|
curUploadType: "paper",
|
|
|
attachmentLimitCount: 26,
|
|
|
abc: "abcdefghijklmnopqrstuvwxyz".toUpperCase(),
|
|
|
+ cards: [],
|
|
|
task: {},
|
|
|
reason: "",
|
|
|
TASK_AUDIT_RESULT: { ...TASK_AUDIT_RESULT, EXCHANGE: "转他人审批" },
|
|
@@ -635,29 +648,18 @@ export default {
|
|
|
: this.curTaskApply.setup > 1;
|
|
|
return IS_COMMON_AUDIT;
|
|
|
},
|
|
|
- cardTodoName() {
|
|
|
- let name = "创建答题卡";
|
|
|
- if (this.curTaskApply.cardId) {
|
|
|
- if (this.curTaskApply.makeMethod === "SELECT") {
|
|
|
- name = "选择题卡";
|
|
|
- } else if (this.curTaskApply.makeMethod === "SELF") {
|
|
|
- name = "编辑题卡";
|
|
|
- } else {
|
|
|
- // 已经审核的题卡可以自行编辑,未审核的题卡只能查看
|
|
|
- name =
|
|
|
- this.curTaskApply.status === "SUBMIT" ? "编辑题卡" : "查看题卡";
|
|
|
- }
|
|
|
- }
|
|
|
- return name;
|
|
|
- },
|
|
|
- createCardTypeName() {
|
|
|
- return CARD_SOURCE_TYPE[this.curTaskApply.makeMethod] || "";
|
|
|
- },
|
|
|
maxFetchCount() {
|
|
|
return this.paperAttachments.length < 1
|
|
|
? 1
|
|
|
: this.paperAttachments.length;
|
|
|
},
|
|
|
+ canCreateCard() {
|
|
|
+ return (
|
|
|
+ this.curTaskApply.courseCode &&
|
|
|
+ this.curTaskApply.examId &&
|
|
|
+ this.curTaskApply.cardRuleId !== COMMON_CARD_RULE_ID
|
|
|
+ );
|
|
|
+ },
|
|
|
exposedMode() {
|
|
|
return !!this.curTaskApply.exposedPaperType;
|
|
|
}
|
|
@@ -704,6 +706,9 @@ export default {
|
|
|
? JSON.parse(this.curTaskApply.paperConfirmAttachmentIds)
|
|
|
: [];
|
|
|
|
|
|
+ this.getCardList();
|
|
|
+
|
|
|
+ // flow
|
|
|
if (this.curTaskApply.flowStatus === "START") {
|
|
|
await this.getFlowList();
|
|
|
} else {
|
|
@@ -712,6 +717,14 @@ export default {
|
|
|
|
|
|
if (this.IS_AUDIT) this.getCurFlowNodeInfo();
|
|
|
},
|
|
|
+ async getCardList() {
|
|
|
+ if (!this.curTaskApply.courseCode || !this.curTaskApply.examId) return;
|
|
|
+ const data = await cardForSelectList({
|
|
|
+ courseCode: this.curTaskApply.courseCode,
|
|
|
+ examId: this.curTaskApply.examId
|
|
|
+ });
|
|
|
+ this.cards = data || [];
|
|
|
+ },
|
|
|
async getFlowHistory() {
|
|
|
if (!this.curTaskApply.flowId) return;
|
|
|
|
|
@@ -813,6 +826,8 @@ export default {
|
|
|
name,
|
|
|
attachmentId: "",
|
|
|
filename: "",
|
|
|
+ cardId: "",
|
|
|
+ cardType: "",
|
|
|
pages: 0,
|
|
|
canDelete: true,
|
|
|
isExposed: false
|
|
@@ -864,18 +879,19 @@ export default {
|
|
|
deletePaperConfirmAttachment(index) {
|
|
|
this.paperConfirmAttachments.splice(index, 1);
|
|
|
},
|
|
|
- toViewCard() {
|
|
|
+ toViewCard(attachment) {
|
|
|
window.open(
|
|
|
this.getRouterPath({
|
|
|
name: "CardPreview",
|
|
|
params: {
|
|
|
- cardId: this.curTaskApply.cardId,
|
|
|
+ cardId: attachment.cardId,
|
|
|
viewType: "view"
|
|
|
}
|
|
|
})
|
|
|
);
|
|
|
},
|
|
|
- toEditCard() {
|
|
|
+ toEditCard(attachment) {
|
|
|
+ this.curAttachment = { ...attachment };
|
|
|
this.$ls.set("prepareTcPCard", {
|
|
|
cardId: this.task.cardId,
|
|
|
examTaskId: this.task.examTaskId,
|
|
@@ -888,27 +904,45 @@ export default {
|
|
|
});
|
|
|
this.$refs.ModifyCard.open();
|
|
|
},
|
|
|
- async toCreateOrViewCard() {
|
|
|
- await this.silentSave();
|
|
|
- this.task = this.getTaskData();
|
|
|
- if (!this.curTaskApply.cardId) {
|
|
|
- this.$refs.CardOptionDialog.open();
|
|
|
- return;
|
|
|
+ async cardModified(cardId) {
|
|
|
+ if (!cardId) return;
|
|
|
+ let card = this.cards.find(item => item.id === cardId);
|
|
|
+ if (!card) {
|
|
|
+ await this.getCardList();
|
|
|
+ card = this.cards.find(item => item.id === cardId);
|
|
|
}
|
|
|
|
|
|
- if (this.curTaskApply.makeMethod === "SELECT") {
|
|
|
- this.$refs.CardOptionDialog.open();
|
|
|
- } else if (this.curTaskApply.makeMethod === "SELF") {
|
|
|
- this.toEditCard();
|
|
|
- } else {
|
|
|
- // 客服制卡:制作完毕则可以编辑,未制作完毕则可以查看
|
|
|
- if (this.curTaskApply.status === "SUBMIT") {
|
|
|
- this.toEditCard();
|
|
|
- } else {
|
|
|
- this.toViewCard();
|
|
|
- }
|
|
|
+ const aind = this.paperAttachments.findIndex(
|
|
|
+ item => item.name === this.curAttachment.name
|
|
|
+ );
|
|
|
+ if (aind !== -1) {
|
|
|
+ this.paperAttachments[aind].cardId = card && card.id;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ cardChange(attachment) {
|
|
|
+ const card = this.cards.find(item => item.id === attachment.cardId);
|
|
|
+ if (card) {
|
|
|
+ attachment.cardType = card.type;
|
|
|
+ attachment.cardTitle = card.title;
|
|
|
}
|
|
|
},
|
|
|
+ toCreateCard(attachment) {
|
|
|
+ if (!this.examTask.cardRuleId) {
|
|
|
+ this.$message.error("题卡规则缺失!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.curAttachment = { ...attachment };
|
|
|
+ this.$ls.set("prepareTcPCard", {
|
|
|
+ courseCode: this.examTask.courseCode,
|
|
|
+ courseName: this.examTask.courseName,
|
|
|
+ schoolName: this.$ls.get("schoolName"),
|
|
|
+ makeMethod: "SELF",
|
|
|
+ cardRuleId: this.examTask.cardRuleId,
|
|
|
+ type: "CUSTOM",
|
|
|
+ createMethod: "STANDARD"
|
|
|
+ });
|
|
|
+ this.$refs.ModifyCard.open();
|
|
|
+ },
|
|
|
cancel() {
|
|
|
this.$emit("cancel");
|
|
|
},
|
|
@@ -930,42 +964,6 @@ export default {
|
|
|
this.$refs.ModifyCard.open();
|
|
|
}
|
|
|
},
|
|
|
- async cardModified(cardId) {
|
|
|
- if (!cardId) return;
|
|
|
- this.curTaskApply = this.$objAssign(this.curTaskApply, {
|
|
|
- cardId,
|
|
|
- makeMethod: "SELF"
|
|
|
- });
|
|
|
- this.silentSave();
|
|
|
- },
|
|
|
- async changeCreateCardType() {
|
|
|
- const h = this.$createElement;
|
|
|
- const result = await this.$msgbox({
|
|
|
- title: "切换题卡操作说明",
|
|
|
- message: h("div", null, [
|
|
|
- h("p", null, "1、切换题卡会将之前选择题卡数据删除。"),
|
|
|
- h(
|
|
|
- "p",
|
|
|
- null,
|
|
|
- "2、之前选择专卡进行绘制,切换题卡后再次选择专卡,需要重新开始绘制。"
|
|
|
- )
|
|
|
- ]),
|
|
|
- showCancelButton: true,
|
|
|
- type: "warning"
|
|
|
- }).catch(() => {});
|
|
|
- if (result !== "confirm") return;
|
|
|
- await this.clearMakeMethod();
|
|
|
- this.toCreateOrViewCard();
|
|
|
- },
|
|
|
- async clearMakeMethod() {
|
|
|
- // 清除后台记录的题卡
|
|
|
- if (this.curTaskApply.cardId && this.curTaskApply.makeMethod !== "CUST") {
|
|
|
- await switchCardCreateMethod(this.examTask.id);
|
|
|
- }
|
|
|
-
|
|
|
- this.curTaskApply.makeMethod = "";
|
|
|
- this.curTaskApply.cardId = "";
|
|
|
- },
|
|
|
toSelectNextFlowUser() {
|
|
|
if (!this.IS_NEED_SELECT_APPROVE_USER) return;
|
|
|
|
|
@@ -1021,16 +1019,9 @@ export default {
|
|
|
// return;
|
|
|
// }
|
|
|
|
|
|
- if (!this.curTaskApply.cardId) {
|
|
|
- this.$message.error("请选择题卡创建方式!");
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- if (
|
|
|
- this.curTaskApply.makeMethod !== "SELECT" &&
|
|
|
- this.curTaskApply.status !== "SUBMIT"
|
|
|
- ) {
|
|
|
- this.$message.error("请先提交题卡!");
|
|
|
+ const cardValid = !this.paperAttachments.some(item => !item.cardId);
|
|
|
+ if (!cardValid) {
|
|
|
+ this.$message.error("有试卷类型未选择题卡!");
|
|
|
return;
|
|
|
}
|
|
|
|