Explorar o código

feat(web): 报告管理展示采集完整度列与明细

Xiaogang Liao hai 3 días
pai
achega
e5d26f5633
Modificáronse 1 ficheiros con 25 adicións e 0 borrados
  1. 25 0
      cfc-web/src/views/admin/ReportManagement.vue

+ 25 - 0
cfc-web/src/views/admin/ReportManagement.vue

@@ -64,6 +64,16 @@
             <el-tag size="small">{{ scope.row.status }}</el-tag>
           </template>
         </el-table-column>
+        <el-table-column label="采集完整度" width="120">
+          <template slot-scope="scope">
+            <el-tag
+              v-if="scope.row.collectValidation"
+              size="small"
+              :type="collectPass(scope.row) ? 'success' : 'danger'"
+            >{{ collectText(scope.row) }}</el-tag>
+            <span v-else>-</span>
+          </template>
+        </el-table-column>
         <el-table-column prop="createdAt" label="创建时间" width="160">
           <template slot="header">
             <span class="sort-header" @click.stop="onSortClick('createdAt', $event)">创建时间{{ sortIcon('createdAt') }}</span>
@@ -175,12 +185,18 @@ export default {
       }).then(function(res) {
         if (res.data && res.data.data) {
           var d = res.data.data
+          var cv = null
+          try { cv = d.collectValidation ? JSON.parse(d.collectValidation) : null } catch (e) { cv = null }
+          var cvLine = '<p>采集完整度: ' + (cv
+            ? (cv.matched + '/' + cv.expected + (cv.pass ? '(通过)' : '(缺失: ' + ((cv.missing || []).join('、') || '-') + ')'))
+            : '-') + '</p>'
           self.$alert(
             '<p>标题: ' + d.title + '</p>' +
             '<p>类型: ' + d.reportTypeName + '</p>' +
             '<p>主体: ' + d.subjectName + '</p>' +
             '<p>日期: ' + d.reportDate + '</p>' +
             '<p>评分: ' + (d.overallScore || '-') + '</p>' +
+            cvLine +
             '<p>状态: ' + d.status + '</p>',
             '报告详情',
             { dangerouslyUseHTMLString: true }
@@ -188,6 +204,15 @@ export default {
         }
       })
     },
+    parseCollect(row) {
+      if (!row || !row.collectValidation) return null
+      try { return JSON.parse(row.collectValidation) } catch (e) { return null }
+    },
+    collectPass(row) { const c = this.parseCollect(row); return !!(c && c.pass === true) },
+    collectText(row) {
+      const c = this.parseCollect(row)
+      return c ? (c.matched + '/' + c.expected) : '-'
+    },
     getTypeTag(type) {
       var map = { gut_flora: 'success', physical_exam: 'primary', dan: 'warning', insurance: 'info', fortune: 'danger' }
       return map[type] || 'info'