优化
部署生产环境 / 发布版本 (push) Successful in 19s Details
部署生产环境 / 编译发布 (push) Successful in 2m38s Details

This commit is contained in:
yj 2024-06-13 16:23:10 +08:00
parent 36f66440ac
commit 7f49c5d68e
2 changed files with 72 additions and 28 deletions

View File

@ -9,7 +9,7 @@
> >
<div> <div>
<div style="font-size: 20px; margin-bottom: 20px; font-weight: bold"> <div style="font-size: 20px; margin-bottom: 20px; font-weight: bold">
锁定模板后无法修改请确认模板信息后操作 锁定模板后仅可调整位置和大小无法增删题目请确认模板信息后操作
</div> </div>
<div style="height: 70vh; overflow-y: auto"> <div style="height: 70vh; overflow-y: auto">
<el-collapse v-model="activeNames"> <el-collapse v-model="activeNames">
@ -17,7 +17,7 @@
<div v-if="item.key !== 'otherPoint'"> <div v-if="item.key !== 'otherPoint'">
<div v-if="item.data.length"> <div v-if="item.data.length">
<div v-for="row in item.data"> <div v-for="row in item.data">
{{ row.questionBefore }}-{{ row.questionAfter }} 总分{{ row.score }} {{ row.questionBefore }}-{{ row.questionAfter }} 每题{{ row.score }}
</div> </div>
</div> </div>
<div v-else> <div v-else>

View File

@ -24,7 +24,12 @@
<img src="@/assets/image/icon1.png" alt="" v-if="item.index !== 5" /> <img src="@/assets/image/icon1.png" alt="" v-if="item.index !== 5" />
</div> </div>
</div> </div>
<div class="warp-nav-tab-delete" title="清空全部痕迹" @click="clearFabricGroup"> <div
class="warp-nav-tab-delete"
title="清空全部痕迹"
@click="clearFabricGroup"
v-if="!isLockStatus"
>
<img src="@/assets/image/icon2.png" alt="" /> <img src="@/assets/image/icon2.png" alt="" />
<span>清空全部痕迹</span> <span>清空全部痕迹</span>
</div> </div>
@ -168,8 +173,8 @@
type="primary" type="primary"
size="large" size="large"
@click="btnClick('lock')" @click="btnClick('lock')"
:disabled="isLock" :disabled="isLockStatus || isLockDisabled"
> </el-button >{{ isLockStatus ? "已锁定" : "锁 定" }}</el-button
> >
</div> </div>
</div> </div>
@ -237,6 +242,7 @@
<span>考号长度</span> <span>考号长度</span>
<div> <div>
<el-input-number <el-input-number
:disabled="isLockStatus"
:min="4" :min="4"
:max="12" :max="12"
v-model="drawerForm.examId.examIdLength" v-model="drawerForm.examId.examIdLength"
@ -273,7 +279,7 @@
<FabricSize <FabricSize
:change="changeFabricPositionNumber" :change="changeFabricPositionNumber"
ref="FabricSizeRef" ref="FabricSizeRef"
v-if="ctx.getActiveObject()" v-if="currentFabric"
/> />
</div> </div>
<div class="drawer-custom-style-body-footer"> <div class="drawer-custom-style-body-footer">
@ -311,7 +317,10 @@
<div> <div>
<span>排列</span> <span>排列</span>
<div> <div>
<el-radio-group v-model="drawerForm.objective.range"> <el-radio-group
v-model="drawerForm.objective.range"
:disabled="isLockStatus"
>
<el-radio :value="0">横向</el-radio> <el-radio :value="0">横向</el-radio>
<el-radio :value="1">竖向</el-radio> <el-radio :value="1">竖向</el-radio>
</el-radio-group> </el-radio-group>
@ -324,7 +333,7 @@
style="width: 164px" style="width: 164px"
v-model="drawerForm.objective.optionNumber" v-model="drawerForm.objective.optionNumber"
:min="2" :min="2"
:disabled="drawerForm.objective.questionTypeValue === 2" :disabled="drawerForm.objective.questionTypeValue === 2 || isLockStatus"
:step-strictly="true" :step-strictly="true"
:max="24" :max="24"
/> />
@ -334,6 +343,7 @@
<span>题量</span> <span>题量</span>
<div> <div>
<el-input-number <el-input-number
:disabled="isLockStatus"
style="width: 164px" style="width: 164px"
v-model="drawerForm.objective.questionNumber" v-model="drawerForm.objective.questionNumber"
:min="1" :min="1"
@ -346,6 +356,7 @@
<span>题号</span> <span>题号</span>
<div> <div>
<el-input-number <el-input-number
:disabled="isLockStatus"
v-model="drawerForm.objective.questionBefore" v-model="drawerForm.objective.questionBefore"
:min="1" :min="1"
:controls="false" :controls="false"
@ -365,6 +376,7 @@
<span>每题分数</span> <span>每题分数</span>
<div> <div>
<el-input-number <el-input-number
:disabled="isLockStatus"
style="width: 164px" style="width: 164px"
v-model="drawerForm.objective.score" v-model="drawerForm.objective.score"
:min="0" :min="0"
@ -405,7 +417,7 @@
<FabricSize <FabricSize
:change="changeFabricPositionNumber" :change="changeFabricPositionNumber"
ref="FabricSizeRef" ref="FabricSizeRef"
v-if="ctx.getActiveObject()" v-if="currentFabric"
/> />
</div> </div>
<div class="drawer-custom-style-body-footer"> <div class="drawer-custom-style-body-footer">
@ -450,6 +462,7 @@
<div> <div>
<el-input-number <el-input-number
v-model="drawerForm.subjective.questionBefore" v-model="drawerForm.subjective.questionBefore"
:disabled="isLockStatus"
:min="1" :min="1"
:controls="false" :controls="false"
:step-strictly="true" :step-strictly="true"
@ -462,6 +475,7 @@
<el-input-number <el-input-number
v-model="drawerForm.subjective.questionAfter" v-model="drawerForm.subjective.questionAfter"
:disabled="isLockStatus"
:min="1" :min="1"
:controls="false" :controls="false"
:step-strictly="true" :step-strictly="true"
@ -474,6 +488,7 @@
<div> <div>
<el-input-number <el-input-number
v-model="drawerForm.subjective.score" v-model="drawerForm.subjective.score"
:disabled="isLockStatus"
style="width: 152px" style="width: 152px"
:min="0" :min="0"
:precision="1" :precision="1"
@ -484,7 +499,7 @@
<FabricSize <FabricSize
:change="changeFabricPositionNumber" :change="changeFabricPositionNumber"
ref="FabricSizeRef" ref="FabricSizeRef"
v-if="ctx.getActiveObject()" v-if="currentFabric"
/> />
</div> </div>
<div class="drawer-custom-style-body-footer"> <div class="drawer-custom-style-body-footer">
@ -717,7 +732,8 @@ const templateInfo = reactive<any>({
questionList: [], questionList: [],
otherData: [], otherData: [],
}); });
const isLock = ref<boolean>(false); const isLockStatus = ref<boolean>(false);
const isLockDisabled = ref<boolean>(false);
const currentNavListIndex = ref<number>(3); const currentNavListIndex = ref<number>(3);
// //
const ctx = ref<any>(null); const ctx = ref<any>(null);
@ -728,7 +744,8 @@ const currentFabric = ref<any>(null);
onMounted(() => { onMounted(() => {
GetOcrDetail(router.currentRoute.value.query.mid as string).then((res: any) => { GetOcrDetail(router.currentRoute.value.query.mid as string).then((res: any) => {
if (res.code === 200) { if (res.code === 200) {
const { mainName, hasPosition, paperType, detail } = res.data; const { mainName, hasPosition, paperType, detail, isLock } = res.data;
isLockStatus.value = isLock;
templateInfo.name = mainName; templateInfo.name = mainName;
templateInfo.hasPosition = hasPosition; templateInfo.hasPosition = hasPosition;
templateInfo.type = paperType === 1 ? "A3" : "A4"; templateInfo.type = paperType === 1 ? "A3" : "A4";
@ -749,31 +766,31 @@ watch(
() => templateInfo, () => templateInfo,
(_new, _old) => { (_new, _old) => {
if (!_new.headList[2].point.length && !_new.tailsList[2].point.length) { if (!_new.headList[2].point.length && !_new.tailsList[2].point.length) {
isLock.value = true; isLockDisabled.value = true;
currentNavListIndex.value = 2; currentNavListIndex.value = 2;
return; return;
} }
if (!_new.headList[1].point.length && !_new.tailsList[1].point.length) { if (!_new.headList[1].point.length && !_new.tailsList[1].point.length) {
isLock.value = true; isLockDisabled.value = true;
currentNavListIndex.value = 1; currentNavListIndex.value = 1;
return; return;
} }
if (_new.hasPosition) { if (_new.hasPosition) {
if (_new.imgSrc.length === 2) { if (_new.imgSrc.length === 2) {
if (_new.headList[0].point.length !== 4 || _new.tailsList[0].point.length !== 4) { if (_new.headList[0].point.length !== 4 || _new.tailsList[0].point.length !== 4) {
isLock.value = true; isLockDisabled.value = true;
currentNavListIndex.value = 0; currentNavListIndex.value = 0;
return; return;
} }
} else { } else {
if (_new.headList[0].point.length !== 4) { if (_new.headList[0].point.length !== 4) {
isLock.value = true; isLockDisabled.value = true;
currentNavListIndex.value = 0; currentNavListIndex.value = 0;
return; return;
} }
} }
} }
isLock.value = false; isLockDisabled.value = false;
}, },
{ deep: true } { deep: true }
); );
@ -802,6 +819,10 @@ const initCanvas = (): void => {
height: imgDom.value.clientHeight, height: imgDom.value.clientHeight,
}); });
ctx.value.on("mouse:down", (e: any) => { ctx.value.on("mouse:down", (e: any) => {
if (isLockStatus.value && !e.target) {
ElMessage.error("已锁定,无法新增!");
return;
}
const templateInfoItem = getTemplateInfo(true); const templateInfoItem = getTemplateInfo(true);
if (templateInfoItem[0].point.length === 4) { if (templateInfoItem[0].point.length === 4) {
if (isMoveOutView()) { if (isMoveOutView()) {
@ -818,6 +839,9 @@ const initCanvas = (): void => {
} }
} }
} }
if (e.target) {
setStepClick(e.target.get("fabricType"));
}
canvasMouseDown(e.e, e.target, e.subTargets); canvasMouseDown(e.e, e.target, e.subTargets);
}); });
ctx.value.on("mouse:move", (e: any) => { ctx.value.on("mouse:move", (e: any) => {
@ -906,9 +930,15 @@ const canvasMouseDown = (e: MouseEvent, target: any, subTargets: any): void => {
const itemTarget = target const itemTarget = target
.getObjects() .getObjects()
.find((i: any) => i.fabricId === row.fabricId); .find((i: any) => i.fabricId === row.fabricId);
itemTarget && row.fabricId === itemTarget.fabricId if (itemTarget && row.fabricId === itemTarget.fabricId) {
? itemTarget.set({ visible: true }) if (isLockStatus.value && itemTarget.get("text") === "删除") {
: row.set({ visible: false }); row.set({ visible: false });
} else {
itemTarget.set({ visible: true });
}
} else {
row.set({ visible: false });
}
} else { } else {
row.set({ visible: false }); row.set({ visible: false });
} }
@ -974,7 +1004,7 @@ const canvasMouseUp = async (): Promise<void> => {
hasControls: false, hasControls: false,
subTargetCheck: true, subTargetCheck: true,
borderColor: "transparent", borderColor: "transparent",
selectionBackgroundColor: "transparent", selectionBackgroundColor: "red",
fabricType: navListIndex.value, fabricType: navListIndex.value,
fabricId: cteatedNumber(), fabricId: cteatedNumber(),
}).on("mousemove", (e: any) => { }).on("mousemove", (e: any) => {
@ -1017,9 +1047,13 @@ const canvasMouseUp = async (): Promise<void> => {
}).then((res) => { }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
const rectTitle = ["右上角", "右下角"]; const rectTitle = ["右上角", "右下角"];
const rectFooterTitle = ["左下角", "右下角"];
if (rectTitle.includes(getCurrentText())) { if (rectTitle.includes(getCurrentText())) {
res.data.x = res.data.x + res.data.width; res.data.x = res.data.x + res.data.width;
} }
if (rectFooterTitle.includes(getCurrentText())) {
res.data.y = res.data.y - res.data.height;
}
addFabric( addFabric(
"rect", "rect",
{ ...obj, title: getTextTitle(), rectPosition: res.data }, { ...obj, title: getTextTitle(), rectPosition: res.data },
@ -1027,7 +1061,9 @@ const canvasMouseUp = async (): Promise<void> => {
left: rectTitle.includes(getCurrentText()) left: rectTitle.includes(getCurrentText())
? res.data.x - res.data.width ? res.data.x - res.data.width
: res.data.x, : res.data.x,
top: res.data.y, top: rectFooterTitle.includes(getCurrentText())
? res.data.y + res.data.height
: res.data.y,
width: res.data.width, width: res.data.width,
height: res.data.height, height: res.data.height,
stroke: "red", stroke: "red",
@ -1450,7 +1486,7 @@ const isDisabledDraw = (): boolean => {
fabricItem.forEach((item: any) => { fabricItem.forEach((item: any) => {
let row = item.getObjects().filter((obj: any) => obj.get("text") === "缺考"); let row = item.getObjects().filter((obj: any) => obj.get("text") === "缺考");
if (row) { if (row) {
hasQueKao.push(row); hasQueKao.push(...row);
} }
}); });
isDisabledDrawStatus = hasQueKao.length === 0; isDisabledDrawStatus = hasQueKao.length === 0;
@ -1611,7 +1647,7 @@ const showFabricData = (): void => {
hasControls: false, hasControls: false,
subTargetCheck: true, subTargetCheck: true,
borderColor: "transparent", borderColor: "transparent",
selectionBackgroundColor: "transparent", selectionBackgroundColor: "rgba(255,0,0,0.5)",
fabricType: item.fabricType, fabricType: item.fabricType,
left: item.left, left: item.left,
top: item.top, top: item.top,
@ -2261,11 +2297,11 @@ const objectiveNumber = (
): void => { ): void => {
// //
const obj = { const obj = {
fontSize: 14, fontSize: 12,
fill: "black", fill: "black",
fontWeight: "bold", fontWeight: "normal",
fabricId: cteatedNumber(), fabricId: cteatedNumber(),
backgroundColor: "rgba(255,255,255,0.7)", backgroundColor: "transparent",
}; };
if (drawerForm.objective.range) { if (drawerForm.objective.range) {
// //
@ -2498,6 +2534,10 @@ const isQuestionNumerRepeat = (): boolean => {
// //
const changeExamType = (type: number): void => { const changeExamType = (type: number): void => {
if (isLockStatus.value) {
ElMessage.error("已锁定,无法修改!");
return;
}
drawerForm.examId.examType = type; drawerForm.examId.examType = type;
}; };
@ -2538,6 +2578,10 @@ const changeQuestion = (e?: any): void => {
// //
const changeObjectiveQuestionType = (item: { value: number; text: string }): void => { const changeObjectiveQuestionType = (item: { value: number; text: string }): void => {
if (isLockStatus.value) {
ElMessage.error("已锁定,无法修改!");
return;
}
if (navListIndex.value === 3) { if (navListIndex.value === 3) {
drawerForm.objective.questionTypeValue = item.value; drawerForm.objective.questionTypeValue = item.value;
drawerForm.objective.optionNumber = drawerForm.objective.optionNumber =
@ -2892,7 +2936,7 @@ const changeData = (): any => {
return { return {
...row.customFrom, ...row.customFrom,
width: row.width, width: row.width,
height: row.height, height: row.height - 36.16 / 2,
top: row.top + 17, top: row.top + 17,
left: row.left, left: row.left,
}; };