|
@@ -9,16 +9,16 @@
|
|
|
:rules="rules"
|
|
|
>
|
|
|
<template #label1></template>
|
|
|
+ <template #subject>
|
|
|
+ <div class="pr-5px">
|
|
|
+ <a-select
|
|
|
+ v-model:value="subjectCode"
|
|
|
+ :options="subjectOptions"
|
|
|
+ ></a-select>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
<template #paperTypeBarcodeContentItem>
|
|
|
<div class="flex items-center">
|
|
|
- <!-- <a-input-number
|
|
|
- style="width: 200px"
|
|
|
- v-model:value="params.paperTypeBarcodeContentItem"
|
|
|
- allow-clear
|
|
|
- :disabled="!canEdit"
|
|
|
- :min="0"
|
|
|
- :controls="false"
|
|
|
- /> -->
|
|
|
<a-input
|
|
|
style="width: 200px"
|
|
|
v-model:value="params.paperTypeBarcodeContentItem"
|
|
@@ -35,20 +35,28 @@
|
|
|
>新增</qm-button
|
|
|
>
|
|
|
</div>
|
|
|
- <div
|
|
|
- class="p-t-10px p-b-10px"
|
|
|
- v-if="!!params.paperTypeBarcodeContent.length"
|
|
|
- >
|
|
|
+ </template>
|
|
|
+ <template #paperTypeBarcodeContent>
|
|
|
+ <div class="p-b-10px" v-if="!!params.paperTypeBarcodeContent.length">
|
|
|
<div
|
|
|
- class="tag"
|
|
|
+ class="tags-row flex"
|
|
|
v-for="(item, index) in params.paperTypeBarcodeContent"
|
|
|
- :key="item"
|
|
|
- :style="{ color: token.colorPrimary }"
|
|
|
+ :key="index"
|
|
|
>
|
|
|
- {{ item }}
|
|
|
- <span class="close" v-if="canEdit" @click="delTag(index)"
|
|
|
- >×</span
|
|
|
- >
|
|
|
+ <span class="s-name">{{ getSubjectName(item.value) }}:</span>
|
|
|
+ <div class="flex-1">
|
|
|
+ <div
|
|
|
+ class="tag"
|
|
|
+ v-for="(v, i) in item.paperTypeBarcodeContent"
|
|
|
+ :key="item"
|
|
|
+ :style="{ color: token.colorPrimary }"
|
|
|
+ >
|
|
|
+ {{ v }}
|
|
|
+ <span class="close" v-if="canEdit" @click="delTag(index, i)"
|
|
|
+ >×</span
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -106,26 +114,45 @@ import useToken from "@/hooks/useToken";
|
|
|
import { EditOutlined } from "@ant-design/icons-vue";
|
|
|
import { getBaseDataConfig, saveBaseDataConfig } from "@/ap/baseDataConfig";
|
|
|
import { useUserStore } from "@/store";
|
|
|
+import { getSubjectList } from "@/ap/system";
|
|
|
+import { cloneDeep } from "lodash-es";
|
|
|
|
|
|
+const subjectOptions = ref<any>([]);
|
|
|
+const subjectCode = ref("");
|
|
|
const form = ref();
|
|
|
const canEdit = ref(false);
|
|
|
const userStore = useUserStore();
|
|
|
const { token } = useToken();
|
|
|
const getData = () => {
|
|
|
getBaseDataConfig({ examId: userStore.curExam?.id }).then((res: any) => {
|
|
|
- params.paperTypeBarcodeContent = res.paperTypeBarcodeContent || [];
|
|
|
+ if (res.paperTypeBarcodeContent?.length) {
|
|
|
+ params.paperTypeBarcodeContent = res.paperTypeBarcodeContent;
|
|
|
+ }
|
|
|
params.imageCheckRatio = res.imageCheckRatio * 100;
|
|
|
params.imageCheckOrder = res.imageCheckOrder;
|
|
|
params.enableSyncVerify = res.enableSyncVerify;
|
|
|
params.scannerAssignedMaxCount = res.scannerAssignedMaxCount;
|
|
|
params.scannerAssignedVerifyPassword = res.scannerAssignedVerifyPassword;
|
|
|
-
|
|
|
- oldParams = { ...params, paperTypeBarcodeContentItem: "" };
|
|
|
});
|
|
|
};
|
|
|
onMounted(() => {
|
|
|
- getData();
|
|
|
+ getSubjectList({ examId: userStore.curExam?.id }).then((res: any) => {
|
|
|
+ subjectOptions.value = (res || [])
|
|
|
+ .filter((item: any) => item.code == "1" || item.code == "2")
|
|
|
+ .map((item: any) => ({ label: item.name, value: item.code }));
|
|
|
+ if (subjectOptions.value.length) {
|
|
|
+ subjectCode.value = subjectOptions.value[0].value;
|
|
|
+ }
|
|
|
+ getData();
|
|
|
+ });
|
|
|
});
|
|
|
+const getSubjectName = (code: string) => {
|
|
|
+ if (!subjectOptions.value.length) {
|
|
|
+ return "";
|
|
|
+ } else {
|
|
|
+ return subjectOptions.value.find((item: any) => item.code == code)?.label;
|
|
|
+ }
|
|
|
+};
|
|
|
const params = reactive<any>({
|
|
|
paperTypeBarcodeContentItem: "",
|
|
|
paperTypeBarcodeContent: [],
|
|
@@ -144,12 +171,24 @@ const fields = computed(() => {
|
|
|
colSpan: 4,
|
|
|
labelWidth: 130,
|
|
|
},
|
|
|
+ {
|
|
|
+ cell: "subject",
|
|
|
+ colSpan: 6,
|
|
|
+ labelWidth: 60,
|
|
|
+ label: "科目",
|
|
|
+ },
|
|
|
{
|
|
|
prop: "paperTypeBarcodeContentItem",
|
|
|
cell: "paperTypeBarcodeContentItem",
|
|
|
label: "",
|
|
|
labelWidth: 0,
|
|
|
- colSpan: 20,
|
|
|
+ colSpan: 14,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ cell: "paperTypeBarcodeContent",
|
|
|
+ label: " ",
|
|
|
+ labelWidth: 130,
|
|
|
+ colSpan: 24,
|
|
|
},
|
|
|
{
|
|
|
cell: "label2",
|
|
@@ -228,12 +267,26 @@ const addTag = () => {
|
|
|
window.$message.error(params.paperTypeBarcodeContentItem + " 已存在!");
|
|
|
return;
|
|
|
}
|
|
|
- params.paperTypeBarcodeContent.push(params.paperTypeBarcodeContentItem);
|
|
|
+ // params.paperTypeBarcodeContent.push({
|
|
|
+ // code: subjectCode.value,
|
|
|
+ // paperTypeBarcodeContent: params.paperTypeBarcodeContentItem,
|
|
|
+ // });
|
|
|
+ let find = params.paperTypeBarcodeContent.find(
|
|
|
+ (item: any) => item.code == subjectCode.value
|
|
|
+ );
|
|
|
+ if (!find) {
|
|
|
+ params.paperTypeBarcodeContent.push({
|
|
|
+ code: subjectCode.value,
|
|
|
+ paperTypeBarcodeContent: [params.paperTypeBarcodeContentItem],
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ find.paperTypeBarcodeContent.push(params.paperTypeBarcodeContentItem);
|
|
|
+ }
|
|
|
params.paperTypeBarcodeContentItem = "";
|
|
|
form.value.formRef.clearValidate(["paperTypeBarcodeContentItem"]);
|
|
|
};
|
|
|
-const delTag = (index: number) => {
|
|
|
- params.paperTypeBarcodeContent.splice(index, 1);
|
|
|
+const delTag = (index: number, i: number) => {
|
|
|
+ params.paperTypeBarcodeContent[index].paperTypeBarcodeContent.splice(i, 1);
|
|
|
};
|
|
|
|
|
|
const rules = {
|
|
@@ -283,7 +336,7 @@ const save = () => {
|
|
|
});
|
|
|
};
|
|
|
const willEdit = () => {
|
|
|
- oldParams = { ...params, paperTypeBarcodeContentItem: "" };
|
|
|
+ oldParams = { ...cloneDeep(params), paperTypeBarcodeContentItem: "" };
|
|
|
canEdit.value = !canEdit.value;
|
|
|
};
|
|
|
const cancelEdit = () => {
|
|
@@ -302,6 +355,21 @@ const inputChange = (e: any) => {
|
|
|
width: 900px;
|
|
|
max-height: 100%;
|
|
|
overflow: auto;
|
|
|
+ :deep(.low-form-item-box) {
|
|
|
+ width: auto !important;
|
|
|
+ }
|
|
|
+ :deep(.other-rows) {
|
|
|
+ .ant-form-item:first-child {
|
|
|
+ .ant-col:first-child {
|
|
|
+ opacity: 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .tags-row {
|
|
|
+ .s-name {
|
|
|
+ line-height: 31px;
|
|
|
+ }
|
|
|
+ }
|
|
|
.btns {
|
|
|
padding-top: 60px;
|
|
|
text-align: right;
|