|
@@ -12,48 +12,11 @@
|
|
|
<Button type="primary" @click="createForm">去填写评估表</Button>
|
|
<Button type="primary" @click="createForm">去填写评估表</Button>
|
|
|
</Result>
|
|
</Result>
|
|
|
<FlexCol v-else gap="gap.md">
|
|
<FlexCol v-else gap="gap.md">
|
|
|
- <DynamicForm
|
|
|
|
|
- ref="form1Ref"
|
|
|
|
|
- :model="currentForm"
|
|
|
|
|
- :options="formOptions"
|
|
|
|
|
- />
|
|
|
|
|
- <Button @click="navTo('/pages/test/test')">test</Button>
|
|
|
|
|
- <H3>自查项目选择</H3>
|
|
|
|
|
- <FlexCol v-if="checkItemList && checkItemList.length > 0" gap="gap.md">
|
|
|
|
|
- <FlexCol v-for="(item, index) in checkItemList" :key="item.id" gap="gap.md">
|
|
|
|
|
- <Text fontConfig="subTitleText" :text="`${index + 1}. ${item.name}`" />
|
|
|
|
|
- <FlexCol v-if="item.checkType == 2" gap="gap.sm">
|
|
|
|
|
- <FlexRow v-for="child in item.children" :key="child.id" justify="space-between">
|
|
|
|
|
- <CheckBox
|
|
|
|
|
- :text="`${child.name} (${child.points}分)`"
|
|
|
|
|
- :modelValue="hasCheckedItem(child.id)"
|
|
|
|
|
- @update:modelValue="setCheckedItem(item as CheckItemInfo, child as CheckItemInfo, $event)"
|
|
|
|
|
- />
|
|
|
|
|
- <Stepper
|
|
|
|
|
- v-if="hasCheckedItem(child.id)"
|
|
|
|
|
- :min="0"
|
|
|
|
|
- :max="20"
|
|
|
|
|
- :step="1"
|
|
|
|
|
- :modelValue="getCheckedItemCount(child.id) ?? 0"
|
|
|
|
|
- @update:modelValue="setCheckedItem(item as CheckItemInfo, child as CheckItemInfo, $event)"
|
|
|
|
|
- />
|
|
|
|
|
- <view v-else></view>
|
|
|
|
|
- </FlexRow>
|
|
|
|
|
- </FlexCol>
|
|
|
|
|
- <FlexCol v-else gap="gap.sm">
|
|
|
|
|
- <CheckBox
|
|
|
|
|
- v-for="child in item.children" :key="child.id"
|
|
|
|
|
- :text="`${child.name} (${child.points}分)`"
|
|
|
|
|
- :modelValue="hasCheckedItem(child.id)"
|
|
|
|
|
- @update:modelValue="setCheckedItem(item as CheckItemInfo, child as CheckItemInfo, $event)"
|
|
|
|
|
- />
|
|
|
|
|
- </FlexCol>
|
|
|
|
|
- </FlexCol>
|
|
|
|
|
- </FlexCol>
|
|
|
|
|
- <DynamicForm
|
|
|
|
|
- ref="form3Ref"
|
|
|
|
|
- :model="currentForm"
|
|
|
|
|
- :options="formOptionsEnd"
|
|
|
|
|
|
|
+ <EvaluationFormBlock
|
|
|
|
|
+ :currentForm="(currentForm as SelfAssessmentDetail)"
|
|
|
|
|
+ :formOptions="formOptions"
|
|
|
|
|
+ :checkItemList="(checkItemList as CheckItemInfo[])"
|
|
|
|
|
+ :currentFormCheckItems="(currentFormCheckItems as SelfAssessmentCheckItemAnswer[])"
|
|
|
/>
|
|
/>
|
|
|
<FlexRow align="center" justify="space-between">
|
|
<FlexRow align="center" justify="space-between">
|
|
|
<H3>自评总分</H3>
|
|
<H3>自评总分</H3>
|
|
@@ -74,7 +37,7 @@ import { computed, ref } from 'vue';
|
|
|
import { useSimpleDataLoader } from '@/components/composeabe/loader/SimpleDataLoader';
|
|
import { useSimpleDataLoader } from '@/components/composeabe/loader/SimpleDataLoader';
|
|
|
import { useAuthStore } from '@/store/auth';
|
|
import { useAuthStore } from '@/store/auth';
|
|
|
import { useLoadQuerys } from '@/components/composeabe/LoadQuerys';
|
|
import { useLoadQuerys } from '@/components/composeabe/LoadQuerys';
|
|
|
-import { ArrayUtils, assertNotNull, formatError, waitTimeOut } from '@imengyu/imengyu-utils';
|
|
|
|
|
|
|
+import { assertNotNull, formatError, waitTimeOut } from '@imengyu/imengyu-utils';
|
|
|
import { toast, alert } from '@/components/dialog/CommonRoot';
|
|
import { toast, alert } from '@/components/dialog/CommonRoot';
|
|
|
import AssessmentContentApi, {
|
|
import AssessmentContentApi, {
|
|
|
SelfAssessmentDetail,
|
|
SelfAssessmentDetail,
|
|
@@ -87,19 +50,16 @@ import Result from '@/components/feedback/Result.vue';
|
|
|
import FlexCol from '@/components/layout/FlexCol.vue';
|
|
import FlexCol from '@/components/layout/FlexCol.vue';
|
|
|
import Height from '@/components/layout/space/Height.vue';
|
|
import Height from '@/components/layout/space/Height.vue';
|
|
|
import SimplePageContentLoader from '@/components/loader/SimplePageContentLoader.vue';
|
|
import SimplePageContentLoader from '@/components/loader/SimplePageContentLoader.vue';
|
|
|
-import DynamicForm from '@/components/dynamic/DynamicForm.vue';
|
|
|
|
|
import H3 from '@/components/typography/H3.vue';
|
|
import H3 from '@/components/typography/H3.vue';
|
|
|
import FlexRow from '@/components/layout/FlexRow.vue';
|
|
import FlexRow from '@/components/layout/FlexRow.vue';
|
|
|
import Text from '@/components/basic/Text.vue';
|
|
import Text from '@/components/basic/Text.vue';
|
|
|
import XBarSpace from '@/components/layout/space/XBarSpace.vue';
|
|
import XBarSpace from '@/components/layout/space/XBarSpace.vue';
|
|
|
-import CheckBox from '@/components/form/CheckBox.vue';
|
|
|
|
|
-import Stepper from '@/components/form/Stepper.vue';
|
|
|
|
|
import type { IDynamicFormOptions, IDynamicFormRef } from '@/components/dynamic';
|
|
import type { IDynamicFormOptions, IDynamicFormRef } from '@/components/dynamic';
|
|
|
import type { RadioValueProps } from '@/components/dynamic/wrappers/RadioValue';
|
|
import type { RadioValueProps } from '@/components/dynamic/wrappers/RadioValue';
|
|
|
import type { FieldProps } from '@/components/form/Field.vue';
|
|
import type { FieldProps } from '@/components/form/Field.vue';
|
|
|
import type { SignatureFieldProps } from '@/components/form/SignatureField.vue';
|
|
import type { SignatureFieldProps } from '@/components/form/SignatureField.vue';
|
|
|
import { useImageSimpleUploadCo } from '@/common/components/upload/ImageUploadCo';
|
|
import { useImageSimpleUploadCo } from '@/common/components/upload/ImageUploadCo';
|
|
|
-import { navTo } from '@/components/utils/PageAction';
|
|
|
|
|
|
|
+import EvaluationFormBlock from './components/EvaluationFormBlock.vue';
|
|
|
|
|
|
|
|
let loaded = false;
|
|
let loaded = false;
|
|
|
|
|
|
|
@@ -116,10 +76,9 @@ const currentForm = ref<SelfAssessmentDetail | null>(null);
|
|
|
const currentFormCheckItems = ref<SelfAssessmentCheckItemAnswer[]>([]);
|
|
const currentFormCheckItems = ref<SelfAssessmentCheckItemAnswer[]>([]);
|
|
|
const authStore = useAuthStore();
|
|
const authStore = useAuthStore();
|
|
|
|
|
|
|
|
-const form1Ref = ref<IDynamicFormRef | null>(null);
|
|
|
|
|
-const form3Ref = ref<IDynamicFormRef | null>(null);
|
|
|
|
|
|
|
+const formRef = ref<IDynamicFormRef | null>(null);
|
|
|
|
|
|
|
|
-const formOptions = ref<IDynamicFormOptions>({
|
|
|
|
|
|
|
+const formOptions : IDynamicFormOptions = {
|
|
|
formAdditionaProps: {
|
|
formAdditionaProps: {
|
|
|
labelFlex: 4,
|
|
labelFlex: 4,
|
|
|
inputFlex: 8,
|
|
inputFlex: 8,
|
|
@@ -188,24 +147,10 @@ const formOptions = ref<IDynamicFormOptions>({
|
|
|
},
|
|
},
|
|
|
],
|
|
],
|
|
|
},
|
|
},
|
|
|
- ],
|
|
|
|
|
- formRules: {
|
|
|
|
|
- inheritor: [{ required: true, message: '请输入传承人名称' }],
|
|
|
|
|
- unit: [{ required: true, message: '请输入项目保护单位' }],
|
|
|
|
|
- ichName: [{ required: true, message: '请输入项目名称' }],
|
|
|
|
|
- mobile: [{ required: true, message: '请输入联系电话' }],
|
|
|
|
|
- idCard: [{ required: true, message: '请输入身份证号' }],
|
|
|
|
|
- level: [{ required: true, message: '请选择级别' }],
|
|
|
|
|
- address: [{ required: true, message: '请输入家庭住址' }],
|
|
|
|
|
- content: [{ required: true, message: '请填写自评报告' }],
|
|
|
|
|
- self: [{ required: true, message: '请选择自我评估' }],
|
|
|
|
|
- },
|
|
|
|
|
-});
|
|
|
|
|
-const formOptionsEnd = ref<IDynamicFormOptions>({
|
|
|
|
|
- formAdditionaProps: {
|
|
|
|
|
- labelPosition: 'top',
|
|
|
|
|
- },
|
|
|
|
|
- formItems: [
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+ type: 'insertion',
|
|
|
|
|
+ name: 'insertCheckList',
|
|
|
|
|
+ },
|
|
|
{
|
|
{
|
|
|
type: 'flat-group',
|
|
type: 'flat-group',
|
|
|
label: '传承人自查评估',
|
|
label: '传承人自查评估',
|
|
@@ -262,10 +207,19 @@ const formOptionsEnd = ref<IDynamicFormOptions>({
|
|
|
},
|
|
},
|
|
|
],
|
|
],
|
|
|
formRules: {
|
|
formRules: {
|
|
|
|
|
+ inheritor: [{ required: true, message: '请输入传承人名称' }],
|
|
|
|
|
+ unit: [{ required: true, message: '请输入项目保护单位' }],
|
|
|
|
|
+ ichName: [{ required: true, message: '请输入项目名称' }],
|
|
|
|
|
+ mobile: [{ required: true, message: '请输入联系电话' }],
|
|
|
|
|
+ idCard: [{ required: true, message: '请输入身份证号' }],
|
|
|
|
|
+ level: [{ required: true, message: '请选择级别' }],
|
|
|
|
|
+ address: [{ required: true, message: '请输入家庭住址' }],
|
|
|
|
|
+ content: [{ required: true, message: '请填写自评报告' }],
|
|
|
self: [{ required: true, message: '请选择自我评估' }],
|
|
self: [{ required: true, message: '请选择自我评估' }],
|
|
|
sign: [{ required: true, message: '请传承人签名' }],
|
|
sign: [{ required: true, message: '请传承人签名' }],
|
|
|
},
|
|
},
|
|
|
-});
|
|
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
const checkItemList = ref<CheckItemInfo[]>([]);
|
|
const checkItemList = ref<CheckItemInfo[]>([]);
|
|
|
|
|
|
|
|
const totalPoints = computed(() => {
|
|
const totalPoints = computed(() => {
|
|
@@ -291,44 +245,6 @@ async function loadCheckItems() {
|
|
|
checkItemList.value = await AssessmentContentApi.getCheckItems(Number(currentForm.value.level));
|
|
checkItemList.value = await AssessmentContentApi.getCheckItems(Number(currentForm.value.level));
|
|
|
currentFormCheckItems.value = currentForm.value.checkItems.concat();
|
|
currentFormCheckItems.value = currentForm.value.checkItems.concat();
|
|
|
}
|
|
}
|
|
|
-function hasCheckedItem(id: number) {
|
|
|
|
|
- return currentFormCheckItems.value.some(item => item.id === id);
|
|
|
|
|
-}
|
|
|
|
|
-function getCheckedItemCount(id: number) {
|
|
|
|
|
- console.log('getCheckedItemCount', id);
|
|
|
|
|
- return currentFormCheckItems.value.find(item => item.id === id)?.count;
|
|
|
|
|
-}
|
|
|
|
|
-function setCheckedItem(checkItem: CheckItemInfo, childItem: CheckItemInfo, count: number|boolean) {
|
|
|
|
|
- if (!currentForm.value)
|
|
|
|
|
- return;
|
|
|
|
|
- if (typeof count === 'boolean') {
|
|
|
|
|
- count = count ? 1 : 0;
|
|
|
|
|
- }
|
|
|
|
|
- console.log('setCheckedItem', childItem.id, count);
|
|
|
|
|
- let item = currentFormCheckItems.value.find(item => item.id === childItem.id);
|
|
|
|
|
- if (!item) {
|
|
|
|
|
- item = new SelfAssessmentCheckItemAnswer();
|
|
|
|
|
- currentFormCheckItems.value.push(item);
|
|
|
|
|
- }
|
|
|
|
|
- if (item.count === count)
|
|
|
|
|
- return;
|
|
|
|
|
- item.id = childItem.id;
|
|
|
|
|
- item.points = childItem.points;
|
|
|
|
|
- item.count = count;
|
|
|
|
|
- switch (checkItem.checkType) {
|
|
|
|
|
- case 1: {
|
|
|
|
|
- /** 单选,清除其他选项 */
|
|
|
|
|
- const allChildren = checkItem.children.map(child => child.id);
|
|
|
|
|
- currentFormCheckItems.value.forEach(item => {
|
|
|
|
|
- if (allChildren.includes(item.id) && item.id !== childItem.id)
|
|
|
|
|
- item.count = 0;
|
|
|
|
|
- });
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- if (item.count === 0)
|
|
|
|
|
- ArrayUtils.remove(currentFormCheckItems.value, item);
|
|
|
|
|
-}
|
|
|
|
|
|
|
|
|
|
const submitLoading = ref(false);
|
|
const submitLoading = ref(false);
|
|
|
|
|
|
|
@@ -343,10 +259,8 @@ async function createForm() {
|
|
|
}
|
|
}
|
|
|
async function saveForm() {
|
|
async function saveForm() {
|
|
|
const detail = currentForm.value;
|
|
const detail = currentForm.value;
|
|
|
-
|
|
|
|
|
try {
|
|
try {
|
|
|
- await form1Ref.value?.validate();
|
|
|
|
|
- await form3Ref.value?.validate();
|
|
|
|
|
|
|
+ await formRef.value?.validate();
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
toast('请填写完整信息');
|
|
toast('请填写完整信息');
|
|
|
return;
|
|
return;
|
|
@@ -354,7 +268,6 @@ async function saveForm() {
|
|
|
|
|
|
|
|
submitLoading.value = true;
|
|
submitLoading.value = true;
|
|
|
currentForm.value!.checkItems = currentFormCheckItems.value;
|
|
currentForm.value!.checkItems = currentFormCheckItems.value;
|
|
|
-
|
|
|
|
|
try {
|
|
try {
|
|
|
assertNotNull(detail, 'currentForm is null');
|
|
assertNotNull(detail, 'currentForm is null');
|
|
|
await AssessmentContentApi.saveSelfAssessment(detail as SelfAssessmentDetail);
|
|
await AssessmentContentApi.saveSelfAssessment(detail as SelfAssessmentDetail);
|