Browse Source

📦 自评报告拆分

快乐的梦鱼 1 day ago
parent
commit
3a0ee34b7a
2 changed files with 159 additions and 11 deletions
  1. 14 1
      src/api/collect/AssessmentContent.ts
  2. 145 10
      src/pages/collect/assessment/evaluation-form.vue

+ 14 - 1
src/api/collect/AssessmentContent.ts

@@ -218,6 +218,19 @@ export class SelfAssessmentDetail extends DataModel<SelfAssessmentDetail> {
       province: { clientSide: 'number', serverSide: 'number' },
       provincePoints: { clientSide: 'number', serverSide: 'number' },
       level: { clientSide: 'number', serverSide: 'string' },
+      content: { 
+        customToClientFn: (value) => {
+          try {
+            return JSON.parse(value as string);
+          } catch (error) {
+            return {};
+          } 
+        },
+        customToServerFn: (value) => {
+          return value;
+        },
+
+      },
       awardTime: {
         clientSide: 'date', 
         clientSideDateFormat: 'YYYY-MM-DD',
@@ -268,7 +281,7 @@ export class SelfAssessmentDetail extends DataModel<SelfAssessmentDetail> {
   idCard = '' as string|null;
   level = null as number|string|null;
   address = '' as string|null;
-  content = '' as string|null;
+  content : Record<string, any>|null = null;
   weigh = 0 as number;
   awardTime = new Date();
   deductContent = '' as string|null;

+ 145 - 10
src/pages/collect/assessment/evaluation-form.vue

@@ -156,6 +156,8 @@ const assessmentAnnexUpload = useAliOssUploadCo('assessment/annex', async (res,
   });
 });
 
+const currentYear = new Date().getFullYear();
+
 const uploaderRef = ref<UploaderInstance | null>(null);
 const formRef = ref<IDynamicFormRef | null>(null);
 const formOptions : IDynamicFormOptions = {
@@ -237,15 +239,126 @@ const formOptions : IDynamicFormOptions = {
         {
           label: '自评报告',
           name: 'content',
-          type: 'richtext2',
-          additionalProps: { 
-            placeholder: '请填写自评报告',
-            rows: 10,
-            showWordLimit: true,
-            maxLength: 3000,
-            multiline: true,
-            confirmType: "return",
-          } as FieldProps,
+          type: 'object',
+          children: [
+            {
+              label: '',
+              name: 'title',
+              type: 'static-text',
+            },
+            {
+              label: '(一)开展传承活动,培养后继人才情况;',
+              name: 'item0',
+              type: 'textarea',
+              formProps: {
+                labelPosition: 'top',
+              },
+              additionalProps: { 
+                placeholder: '请填写',
+                maxLength: 1000,
+                colon: false,
+                showWordLimit: true,
+              },
+            },
+            {
+              label: '(二)妥善保存相关实物、资料情况;',
+              name: 'item1',
+              type: 'textarea',
+              formProps: {
+                labelPosition: 'top',
+              },
+              additionalProps: { 
+                placeholder: '请填写',
+                maxLength: 1000,
+                colon: false,
+                showWordLimit: true,
+              },
+            },
+            {
+              label: '(三)配合进行非物质文化遗产调查情况;',
+              name: 'item2',
+              type: 'textarea',
+              formProps: {
+                labelPosition: 'top',
+              },
+              additionalProps: { 
+                placeholder: '请填写',
+                maxLength: 1000,
+                colon: false,
+                showWordLimit: true,
+              },
+            },
+            {
+              label: '(四)参加非物质文化遗产公益性宣传情况;',
+              name: 'item3',
+              type: 'textarea',
+              formProps: {
+                labelPosition: 'top',
+              },
+              additionalProps: { 
+                placeholder: '请填写',
+                maxLength: 1000,
+                colon: false,
+                showWordLimit: true,
+              },
+            },
+            {
+              label: '(五)补助经费使用情况;',
+              name: 'item4',
+              type: 'textarea',
+              formProps: {
+                labelPosition: 'top',
+              },
+              additionalProps: { 
+                placeholder: '请填写',
+                maxLength: 1000,
+                colon: false,
+                showWordLimit: true,
+              },
+            },
+            {
+              label: '(六)参加培训情况',
+              name: 'item5',
+              type: 'textarea',
+              formProps: {
+                labelPosition: 'top',
+              },
+              additionalProps: { 
+                placeholder: '请填写',
+                maxLength: 1000,
+                colon: false,
+                showWordLimit: true,
+              },
+            },
+            {
+              label: '(七)其他相关情况;',
+              name: 'item6',
+              type: 'textarea',
+              formProps: {
+                labelPosition: 'top',
+              },
+              additionalProps: { 
+                placeholder: '请填写',
+                maxLength: 1000,
+                colon: false,
+                showWordLimit: true,
+              } as FieldProps,
+            },  
+            {
+              label: '(八)存在的问题及原因分析。',
+              name: 'item7',
+              type: 'textarea',
+              formProps: {
+                labelPosition: 'top',
+              },
+              additionalProps: { 
+                placeholder: '请填写',
+                maxLength: 1000,
+                colon: false,
+                showWordLimit: true,
+              },
+            }
+          ],
         },
       ],
     },
@@ -327,6 +440,7 @@ const formOptions : IDynamicFormOptions = {
 };
 
 const checkItemList = ref<CheckItemInfo[]>([]);
+const editorTitle = ref('');
 let checkItemMap = new Map<number, CheckItemInfo>();
 
 const totalPoints = computed(() => {
@@ -340,7 +454,26 @@ const totalPoints = computed(() => {
     .reduce((acc, item) => acc + (item.count * item.points), 0)
     - (currentForm.value.deductPoints ?? 0);
 });
+const levelTitle = computed(() => {
+  if (currentForm.value?.level === 23) return '国家级';
+  if (currentForm.value?.level === 24) return '省级';
+  if (currentForm.value?.level === 25) return '市级';
+  return '国家级';
+});
 
+function loadEditorContent() {
+  if (!currentForm.value)
+    return;
+  if (typeof currentForm.value.content !== 'object' || currentForm.value.content === null) {
+    currentForm.value!.content = {};
+  }
+  currentForm.value!.content.title = `传承人填写${currentYear}年1月1日至${currentYear}年12月31日${levelTitle.value}非遗传承人义务履行和传承补助经费使用情况等,不超过1000字,如未履行职责请进行说明。参考提纲如下:`;
+  for (let i = 0; i < 8; i++) {
+    if (typeof currentForm.value.content[`item${i}`] !== 'string') {
+      currentForm.value.content[`item${i}`] = '';
+    }
+  }
+}
 async function loadBasicInfo() {
   const basicInfo = await AssessmentContentApi.getInheritorBasic(authStore.userInfo?.id);
   assertNotNull(currentForm.value, 'currentForm is null');
@@ -351,7 +484,6 @@ async function loadBasicInfo() {
   currentForm.value.level = basicInfo.level;
   currentForm.value.idCard = basicInfo.idCard;
   currentForm.value.address = basicInfo.address;
-
 }
 async function loadCheckItems() {
   assertNotNull(currentForm.value, 'currentForm is null');
@@ -379,6 +511,7 @@ async function createForm() {
   detail.year = new Date().getFullYear();
   detail.checkItems = [];
   currentForm.value = detail;
+  loadEditorContent();
   await loadBasicInfo();
   await loadCheckItems();
 }
@@ -436,6 +569,7 @@ const loader = useSimpleDataLoader(async () => {
   if (querys.value.id > 0) {
     const detail = await AssessmentContentApi.getSelfAssessmentDetail(querys.value.id, querys.value.userId);
     currentForm.value = detail;
+    loadEditorContent();
     await loadCheckItems();
     await loadAnnexList();
     return;
@@ -447,6 +581,7 @@ const loader = useSimpleDataLoader(async () => {
       authStore.userInfo?.id
     );
     currentForm.value = detail;
+    loadEditorContent();
     await loadAnnexList();
     await loadCheckItems();
   } else {