Browse Source

填报管理填报人填报状态

yangyuxuan 1 tháng trước cách đây
mục cha
commit
596d23427f

+ 3 - 0
src/types/components.d.ts

@@ -41,6 +41,7 @@ declare module 'vue' {
     ElForm: typeof import('element-plus/es')['ElForm']
     ElFormItem: typeof import('element-plus/es')['ElFormItem']
     ElIcon: typeof import('element-plus/es')['ElIcon']
+    ElImage: typeof import('element-plus/es')['ElImage']
     ElInput: typeof import('element-plus/es')['ElInput']
     ElMenu: typeof import('element-plus/es')['ElMenu']
     ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
@@ -56,6 +57,8 @@ declare module 'vue' {
     ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
     ElTag: typeof import('element-plus/es')['ElTag']
     ElText: typeof import('element-plus/es')['ElText']
+    ElTimeline: typeof import('element-plus/es')['ElTimeline']
+    ElTimelineItem: typeof import('element-plus/es')['ElTimelineItem']
     ElTooltip: typeof import('element-plus/es')['ElTooltip']
     ElTree: typeof import('element-plus/es')['ElTree']
     ElUpload: typeof import('element-plus/es')['ElUpload']

+ 20 - 31
src/views/dataFilling/fillingAdd.vue

@@ -176,39 +176,28 @@ const rules = {
   ],
   user_ids: [{ required: true, message: '请选择填报人', trigger: 'blur' }],
 }
-const handleSaveTemporarily = async (formEl,statuCode) => {
-  if (!formEl) return;
-  await formEl.validate((valid, fields) => {
-    if (valid) {
-      if (hotData.value && hotData.value[0] && hotData.value[0].length > 0) {
-        const data2 = [];
-        hotData.value[0].forEach((item) => {
-          if (!!item) {
-            data2.push(item);
-          }
-        })
-        form.value.field_names = data2;
+const handleSaveTemporarily = async (statuCode) => {
+  if (!!form.value.creator_phone) {
+    const phoneRegex = /^1[3-9]\d{9}$/;
+    if(!phoneRegex.test(form.value.creator_phone)) {
+      proxy.$modal.msgError('请输入正确格式的电话号码');
+      return;
+    }
+  }
+  if (hotData.value && hotData.value[0] && hotData.value[0].length > 0) {
+    const data2 = [];
+    hotData.value[0].forEach((item) => {
+      if (!!item) {
+        data2.push(item);
       }
+    })
+    form.value.field_names = data2;
+  }
 
-      form.value.issued_status = statuCode;
-      fillingAdd(form.value).then(() => {
-        proxy.$modal.msgSuccess('暂存成功');
-        emits('close');
-      });
-    } else {
-      nextTick(() => {
-        let isError = document.getElementsByClassName('is-error');
-        isError[0].scrollIntoView({
-          // 滚动到指定节点
-          // 值有start,center,end,nearest,当前显示在视图区域中间
-          block: 'center',
-          // 值有auto、instant,smooth,缓动动画(当前是慢速的)
-          behavior: 'smooth'
-        });
-      });
-      proxy.$modal.msgError('表单校验失败');
-      return false;
-    }
+  form.value.issued_status = statuCode;
+  fillingAdd(form.value).then(() => {
+    proxy.$modal.msgSuccess('暂存成功');
+    emits('close');
   });
 };
 

+ 45 - 5
src/views/dataFilling/tableDetails.vue

@@ -76,6 +76,12 @@
                 </el-form-item>
               </el-form-item>
             </el-col>
+            <el-col :span="8" v-if="reportInfo.issued_status === 2">
+              <el-form-item>
+                应填报{{reportInfo.num_reporters}}人,已填报{{reportInfo.num_reported}}人,未填报{{reportInfo.num_unreported}}人
+                <el-text class="common-btn-text-primary" @click="viewSituation">完成情况</el-text>
+              </el-form-item>
+            </el-col>
           </el-row>
         </el-col>
       </el-row>
@@ -85,6 +91,18 @@
     <hot-table v-if="showTable" ref="wrapper" :data="hotData" :settings="hotSettings" />
   </div>
   <informantSelect v-model="isShowSelect" :tree-data="treeData" :default-check-data="reportInfo.user_ids" @confirm="handleContactSelectData" />
+  <el-dialog v-if="popUp" v-model="reportInfo.user_filling_status" @close="handleDialogClose">
+    <el-table :data="reportInfo.user_filling_status">
+      <el-table-column label="序号" align="center" type="index" width="50px" />
+      <el-table-column label="姓名" align="center" prop="name" />
+      <el-table-column label="填报状态" align="center" prop="submission_status">
+        <template #default="scope">
+          {{ scope.row.submission_status == 0 ? '未填报' : '已填报' }}
+        </template>
+      </el-table-column>
+
+    </el-table>
+  </el-dialog>
 </template>
 
 <script setup lang="ts">
@@ -123,7 +141,8 @@ const reportInfo = ref({
   num_reported: 0,
   num_unreported: 0,
   field_names: [], //表格内容
-  user_ids: []
+  user_ids: [],
+  user_filling_status: []
 });
 const rules = {
   table_name: [{ required: true, message: '表名不能为空', trigger: 'blur' }],
@@ -138,6 +157,7 @@ const rules = {
 const is_filling_ended = ref(0);
 const selectedReporter = ref(null);
 const router = useRouter();
+const personNum = ref();
 
 const props = defineProps({
   eventId: String
@@ -161,7 +181,14 @@ onMounted(async () => {
 const fetchReportDetails = (reportId) => {
   return fillingList(reportId).then((res: any) => {
     reportInfo.value = res.report_info;
-    const headers = Object.keys(res.table_data["0"]);
+    reportInfo.value.user_filling_status = res.report_info.user_filling_status;
+    personNum.value = reportInfo.value.user_ids.length;  //统计需要填报的总人数
+    let headers = [];
+    if (!res.table_data["0"]) {
+      return;
+    } else {
+      headers = Object.keys(res.table_data["0"]);
+    }
     const result = [
       headers.map(header => res.table_data["0"][header])
     ];
@@ -346,9 +373,15 @@ const handleSaveTemporarily = async (formEl,statuCode) => {
       }
 
       reportInfo.value.issued_status = statuCode;
-      const tempHead = reportInfo.value.field_names.flatMap(obj =>
-        Object.values(obj).filter(value => typeof value === "string")
-      );
+      let tempHead = [];
+      if (!reportInfo.value.field_names) {
+        tempHead = [];
+      } else {
+        tempHead = reportInfo.value.field_names.flatMap(obj =>
+          Object.values(obj).filter(value => typeof value === "string")
+        );
+      }
+
       let data = {
         creator_name: reportInfo.value.creator_name,
         creator_phone: reportInfo.value.creator_phone,
@@ -440,4 +473,11 @@ function findNodeById(data, targetId) {
   }
   return null; // 未找到返回 null
 }
+const popUp = ref(false);
+const viewSituation = () => {
+  popUp.value = true;
+}
+const handleDialogClose = () => {
+  popUp.value = false;
+};
 </script>