|
@@ -11,17 +11,29 @@
|
|
|
<Height :height="30" />
|
|
<Height :height="30" />
|
|
|
<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.lg">
|
|
|
<EvaluationFormBlock
|
|
<EvaluationFormBlock
|
|
|
:currentForm="(currentForm as SelfAssessmentDetail)"
|
|
:currentForm="(currentForm as SelfAssessmentDetail)"
|
|
|
:formOptions="formOptions"
|
|
:formOptions="formOptions"
|
|
|
:checkItemList="(checkItemList as CheckItemInfo[])"
|
|
:checkItemList="(checkItemList as CheckItemInfo[])"
|
|
|
:currentFormCheckItems="(currentFormCheckItems as SelfAssessmentCheckItemAnswer[])"
|
|
:currentFormCheckItems="(currentFormCheckItems as SelfAssessmentCheckItemAnswer[])"
|
|
|
/>
|
|
/>
|
|
|
- <FlexRow align="center" justify="space-between">
|
|
|
|
|
|
|
+ <FlexRow align="flex-end" justify="space-between">
|
|
|
<H3>自评总分</H3>
|
|
<H3>自评总分</H3>
|
|
|
- <Text fontSize="44rpx" fontFamily="HUNdin1451" :text="`${totalPoints}分`" />
|
|
|
|
|
|
|
+ <Text fontSize="50rpx" color="#315816" fontFamily="HUNdin1451" :text="`${totalPoints}分`" />
|
|
|
</FlexRow>
|
|
</FlexRow>
|
|
|
|
|
+ <Divider />
|
|
|
|
|
+ <H3>佐证资料上传</H3>
|
|
|
|
|
+ <Result v-if="!currentForm?.id" status="info" title="请先保存评估表后再上传佐证资料" />
|
|
|
|
|
+ <Uploader
|
|
|
|
|
+ v-else
|
|
|
|
|
+ :upload="assessmentAnnexUpload"
|
|
|
|
|
+ :max-upload-count="9"
|
|
|
|
|
+ :max-file-size="20 * 1024 * 1024"
|
|
|
|
|
+ list-type="list"
|
|
|
|
|
+ />
|
|
|
|
|
+ <Height :height="30" />
|
|
|
|
|
+ <Divider />
|
|
|
<Button type="primary" block :loading="submitLoading" @click="saveForm">保存评估表</Button>
|
|
<Button type="primary" block :loading="submitLoading" @click="saveForm">保存评估表</Button>
|
|
|
<Button :loading="submitLoading" @click="downloadForm">下载评估表PDF</Button>
|
|
<Button :loading="submitLoading" @click="downloadForm">下载评估表PDF</Button>
|
|
|
</FlexCol>
|
|
</FlexCol>
|
|
@@ -37,12 +49,14 @@ 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 { assertNotNull, formatError, waitTimeOut } from '@imengyu/imengyu-utils';
|
|
|
|
|
|
|
+import { useAliOssUploadCo } from '@/common/components/upload/AliOssUploadCo';
|
|
|
|
|
+import { assertNotNull, formatError, StringUtils, 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,
|
|
|
CheckItemInfo,
|
|
CheckItemInfo,
|
|
|
SelfAssessmentCheckItemAnswer,
|
|
SelfAssessmentCheckItemAnswer,
|
|
|
|
|
+ getCheckAnnexType,
|
|
|
} from '@/api/collect/AssessmentContent';
|
|
} from '@/api/collect/AssessmentContent';
|
|
|
import CommonRoot from '@/components/dialog/CommonRoot.vue';
|
|
import CommonRoot from '@/components/dialog/CommonRoot.vue';
|
|
|
import Button from '@/components/basic/Button.vue';
|
|
import Button from '@/components/basic/Button.vue';
|
|
@@ -60,6 +74,9 @@ 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 EvaluationFormBlock from './components/EvaluationFormBlock.vue';
|
|
import EvaluationFormBlock from './components/EvaluationFormBlock.vue';
|
|
|
|
|
+import Uploader from '@/components/form/Uploader.vue';
|
|
|
|
|
+import { getMimeType } from '@/common/components/upload/mimes';
|
|
|
|
|
+import Divider from '@/components/display/Divider.vue';
|
|
|
|
|
|
|
|
let loaded = false;
|
|
let loaded = false;
|
|
|
|
|
|
|
@@ -76,8 +93,22 @@ const currentForm = ref<SelfAssessmentDetail | null>(null);
|
|
|
const currentFormCheckItems = ref<SelfAssessmentCheckItemAnswer[]>([]);
|
|
const currentFormCheckItems = ref<SelfAssessmentCheckItemAnswer[]>([]);
|
|
|
const authStore = useAuthStore();
|
|
const authStore = useAuthStore();
|
|
|
|
|
|
|
|
-const formRef = ref<IDynamicFormRef | null>(null);
|
|
|
|
|
|
|
+const assessmentAnnexUpload = useAliOssUploadCo('assessment/annex', async (res, item) => {
|
|
|
|
|
+ assertNotNull(currentForm.value, 'currentForm is null');
|
|
|
|
|
+ const mimetype = getMimeType(item.filePath);
|
|
|
|
|
+ await AssessmentContentApi.saveAnnex({
|
|
|
|
|
+ name: '佐证资料' + StringUtils.path.getFileName(item.filePath),
|
|
|
|
|
+ formId: currentForm.value.id,
|
|
|
|
|
+ url: res,
|
|
|
|
|
+ type: getCheckAnnexType(mimetype),
|
|
|
|
|
+ mimetype: mimetype,
|
|
|
|
|
+ fileSize: item.size
|
|
|
|
|
+ ? Math.max(1, Math.ceil(item.size / 1024))
|
|
|
|
|
+ : undefined,
|
|
|
|
|
+ });
|
|
|
|
|
+});
|
|
|
|
|
|
|
|
|
|
+const formRef = ref<IDynamicFormRef | null>(null);
|
|
|
const formOptions : IDynamicFormOptions = {
|
|
const formOptions : IDynamicFormOptions = {
|
|
|
formAdditionaProps: {
|
|
formAdditionaProps: {
|
|
|
labelFlex: 4,
|
|
labelFlex: 4,
|
|
@@ -219,6 +250,9 @@ const formOptions : IDynamicFormOptions = {
|
|
|
},
|
|
},
|
|
|
additionalProps: {
|
|
additionalProps: {
|
|
|
upload: useImageSimpleUploadCo(),
|
|
upload: useImageSimpleUploadCo(),
|
|
|
|
|
+ previewImageProps: {
|
|
|
|
|
+ width: '400rpx',
|
|
|
|
|
+ }
|
|
|
} as SignatureFieldProps,
|
|
} as SignatureFieldProps,
|
|
|
}
|
|
}
|
|
|
],
|
|
],
|
|
@@ -294,18 +328,30 @@ async function saveForm() {
|
|
|
assertNotNull(detail, 'currentForm is null');
|
|
assertNotNull(detail, 'currentForm is null');
|
|
|
await AssessmentContentApi.saveSelfAssessment(detail as SelfAssessmentDetail);
|
|
await AssessmentContentApi.saveSelfAssessment(detail as SelfAssessmentDetail);
|
|
|
toast('保存评估表成功');
|
|
toast('保存评估表成功');
|
|
|
|
|
+
|
|
|
|
|
+ await waitTimeOut(1000);
|
|
|
|
|
+ await loader.reload();
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
alert({
|
|
alert({
|
|
|
title: '保存评估表失败',
|
|
title: '保存评估表失败',
|
|
|
content: formatError(error),
|
|
content: formatError(error),
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
submitLoading.value = false;
|
|
submitLoading.value = false;
|
|
|
}
|
|
}
|
|
|
async function downloadForm() {
|
|
async function downloadForm() {
|
|
|
|
|
+ if (!currentForm.value?.id) {
|
|
|
|
|
+ toast('请先保存评估表后再下载PDF');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
try {
|
|
try {
|
|
|
assertNotNull(currentForm.value, 'currentForm is null');
|
|
assertNotNull(currentForm.value, 'currentForm is null');
|
|
|
- throw new Error('没这个接口');
|
|
|
|
|
|
|
+ const pdfPath = await AssessmentContentApi.downloadSelfAssessmentPdf(currentForm.value.id);
|
|
|
|
|
+ uni.openDocument({
|
|
|
|
|
+ filePath: pdfPath,
|
|
|
|
|
+ fileType: 'pdf',
|
|
|
|
|
+ });
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
alert({
|
|
alert({
|
|
|
title: '下载评估表失败',
|
|
title: '下载评估表失败',
|
|
@@ -316,7 +362,6 @@ async function downloadForm() {
|
|
|
|
|
|
|
|
const loader = useSimpleDataLoader(async () => {
|
|
const loader = useSimpleDataLoader(async () => {
|
|
|
await waitTimeOut(1000);
|
|
await waitTimeOut(1000);
|
|
|
- console.log('load');
|
|
|
|
|
|
|
|
|
|
if (querys.value.id > 0) {
|
|
if (querys.value.id > 0) {
|
|
|
const detail = await AssessmentContentApi.getSelfAssessmentDetail(querys.value.id);
|
|
const detail = await AssessmentContentApi.getSelfAssessmentDetail(querys.value.id);
|
|
@@ -331,10 +376,10 @@ const loader = useSimpleDataLoader(async () => {
|
|
|
if (list.data.length > 0) {
|
|
if (list.data.length > 0) {
|
|
|
const detail = await AssessmentContentApi.getSelfAssessmentDetail(list.data[0].id);
|
|
const detail = await AssessmentContentApi.getSelfAssessmentDetail(list.data[0].id);
|
|
|
currentForm.value = detail;
|
|
currentForm.value = detail;
|
|
|
|
|
+ console.log('load', currentForm.value);
|
|
|
await loadCheckItems();
|
|
await loadCheckItems();
|
|
|
} else {
|
|
} else {
|
|
|
currentForm.value = null;
|
|
currentForm.value = null;
|
|
|
- createForm();
|
|
|
|
|
}
|
|
}
|
|
|
return currentForm.value;
|
|
return currentForm.value;
|
|
|
}, false);
|
|
}, false);
|