zhangwenya 10 сар өмнө
parent
commit
f776bdfbce

+ 7 - 0
src/api/hl/bm.js

@@ -75,3 +75,10 @@ export function getCheckModel(modelId){
     })
 }
 
+// 健康度配置
+export function getBmConfig(modelId){
+    return request({
+        url: '/hl/bm/config/' + modelId,
+        method: 'get'
+    })
+}

+ 29 - 0
src/api/hl/ho.js

@@ -0,0 +1,29 @@
+import request from '@/utils/request'
+export function hlClassList(hlClassId) {
+    return request({
+        url: '/hl/ho/list/' + hlClassId,
+        method: 'get',
+    })
+}
+
+export function deleteHlClass(hlClassId) {
+    return request({
+        url: '/hl/ho/' + hlClassId,
+        method: 'delete',
+    })
+}
+
+export function selectHlList(hlClassId){
+    return request({
+        url: '/hl/ho/select/' + hlClassId,
+        method: 'get',
+    })
+}
+
+export function addHoList(hlClassId,query){
+    return request({
+        url: '/hl/ho/add/' + hlClassId,
+        method: 'get',
+        params: query
+    })
+}

+ 97 - 140
src/views/hl/bm/component/healthSetting.vue

@@ -1,168 +1,125 @@
 <template>
-  <div style="font-size: 14px;margin-bottom: 20px" v-if="!details">
-    当前总分:{{countEs}} <span style="margin:0 20px">/</span> 细项总分:{{countIz}}
-  </div>
-  <el-table
-      :data="hlbData"
-      :span-method="objectSpanMethod"
-      border
-      style="width: 100%;"
-  >
-    <el-table-column prop="bri" label="业务风险项" width="100" />
-    <el-table-column prop="es" label="评价分值" width="80" align="center">
+  <el-table :data="bmConfigData" border style="width: 100%">
+    <el-table-column label="对像类型" width="120">
       <template #default="scope">
-        <el-input v-model="scope.row.es" @change="changeEs(scope.row)" v-if="!details"/>
-        <span v-else>{{scope.row.es}}</span>
+        <dict-tag :options="biz_type" :value="scope.row.objType"/>
       </template>
     </el-table-column>
-    <el-table-column prop="cs" label="实际得分" width="80" align="center" v-if="details"/>
-    <el-table-column prop="eo" label="评价对象" width="120" />
-    <el-table-column prop="ri" label="风险指标" width="180" />
-    <el-table-column prop="pds" label="扣分标准" width="180" />
-    <el-table-column prop="iz" label="细项分" width="100" align="center"/>
-    <el-table-column label="当前健康评分标准" width="200">
+    <el-table-column label="业务对象" >
       <template #default="scope">
-        <div v-html="scope.row.chss" />
+        <el-button type="primary" link @click="selectObj(scope.row)">
+          <span v-for="(item,index) in scope.row.hlObjList" :key="`${scope.$index}_${item.hlObjId}`">
+            {{item.objName}}<span v-if="index != scope.row.hlObjList.length-1">,</span>
+          </span>
+        </el-button>
       </template>
     </el-table-column>
-    <el-table-column label="日健康评分标准">
+    <el-table-column label="分值" width="120" align="center">
       <template #default="scope">
-        <div v-html="scope.row.stand" />
+        <el-input v-model="scope.row.hlScore" size="small"  />
+      </template>
+    </el-table-column>
+    <el-table-column label="指标细项" width="120" align="center">
+      <template #default="scope">
+      </template>
+    </el-table-column>
+    <el-table-column label="操作" width="220">
+      <template #default="scope">
+        <el-button type="primary" link icon="Position">健康指标管理</el-button>
+        <el-button type="primary" link icon="delete">删除</el-button>
       </template>
     </el-table-column>
   </el-table>
+
+  <el-dialog title="选择对象" v-model="visible" >
+    <el-button type="primary" plain @click="handleAddHl">选择对象</el-button>
+    <el-table :data="hlData" border style="width: 100%;margin-top:10px;">
+      <el-table-column label="对象名称" prop="objName"/>
+      <el-table-column label="操作" width="120" align="center">
+        <template #default="scope">
+          <el-button type="primary" link icon="delete"  @click="handleHlDelete(scope.row)">删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+  </el-dialog>
+
+  <el-dialog title="添加对象" v-model="visibleHl">
+    <el-table :data="selectHlData" border style="width: 100%;margin-top:10px;" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="对象名称">
+        <template #default="scope">
+          {{scope.row.bizObj.objName}}
+        </template>
+      </el-table-column>
+    </el-table>
+    <div class="btn-row">
+      <el-button type="primary" @click="handleHlAdd">添加</el-button>
+      <el-button @click="visibleHl=false">取消</el-button>
+    </div>
+  </el-dialog>
 </template>
 <script setup lang="ts">
-import { watchEffect} from "vue";
-import {hlScore} from "@/api/hl/hlScore"
-import {hlbDetails} from "@/api/hl/hlb"
-import {hlDay} from "@/api/hl/hlDay"
-import {updateHld} from "@/api/hl/hld"
-const props = defineProps({
-  modelId:{
-    type:Number,
-    required:true
-  },
-  details:{
-    type:Boolean,
-    default:false
-  },
-  dialogType:{
-    type:String,
-    default:"history"
-  }
-})
-const hlbData = ref([])
-const countEs=ref(0)
-const countIz=ref(0)
-watchEffect(()=>{
-  getHtlData()
+import {getBmConfig} from "@/api/hl/bm"
+import {hlClassList,deleteHlClass,selectHlList,addHoList} from "@/api/hl/ho"
+import {onMounted} from "vue";
+const {proxy} = getCurrentInstance()
+const props = defineProps(['modelId'])
+const {biz_type} = proxy.useDict('biz_type');
+const bmConfigData = ref([])
+const hlData = ref([])
+const selectHlData = ref([])
+const visible = ref(false)
+const hlId = ref(null)
+const hlIds = ref([])
+const visibleHl = ref(false)
+
+onMounted(()=>{
+  bmConfigList(props.modelId)
 })
 
-function  calcCountEs(){
-  let count = 0;
-  hlbData.value.forEach(p=>{
-    if(p.length === p.lowLength){
-      count += Number(p.es)
-    }
-  })
-  countEs.value = count
+function handleSelectionChange(selection){
+  hlIds.value = selection.map(item => item.objId);
 }
 
-async function changeEs(row){
-  const {hlDetailId,es} = row;
-  await updateHld({hlDetailId,hlDetailScore:Number(es)})
-  calcCountEs()
+async function bmConfigList(modelId){
+  const res = await getBmConfig(modelId)
+  bmConfigData.value = res.data
 }
 
-function  objectSpanMethod ({row,column,rowIndex,columnIndex,})  {
-  if (columnIndex === 0||columnIndex === 1||columnIndex === 2||(props.details && columnIndex === 3)||(props.details?columnIndex===7:columnIndex===6)) {
-    const f=row.length===row.lowLength
-      if(f){
-        return {
-          rowspan: row.length,
-          colspan: 1
-        }
-      }else{
-        return {
-          rowspan: 0,
-          colspan: 0
-        }
-      }
-  }
-  if(props.details?columnIndex===8:columnIndex===7){
-    if(rowIndex===0){
-      return {
-        rowspan: hlbData.value.length,
-        colspan: 1
-      }
-    }else{
-      return {
-        rowspan: 0,
-        colspan: 0
-      }
-    }
-  }
+async function selectObj({hlClassId}){
+  const res = await hlClassList(hlClassId)
+  hlId.value = hlClassId
+  hlData.value = res.data
+  visible.value = true
 }
 
-function getHtlData(){
-  const request = props.details ? (props.dialogType==="day"? hlDay:hlScore) : hlbDetails
-  request(props.modelId).then(res=>{
-    if(res.data){
-      countEs.value = 0
-      hlbData.value = []
-      formattedData(res.data)
-    }
-  })
+async function handleAddHl(){
+  const res = await selectHlList(hlId.value)
+  visibleHl.value = true
+  selectHlData.value = res.data
 }
 
-function formattedData(data) {
-  countIz.value = 0
-  data.hlClassList.forEach(item=>{
-    if(item.hlObjList.length){
-      item.hlObjList.forEach((cItem,cIndex)=>{
-        if(cItem.hlDetailList.length){
-          cItem.hlDetailList.forEach((ccItem,ccIndex)=>{
-            hlbData.value.push({
-              es:cItem.hlObjScore,
-              eo:cItem.hlObjName,
-              cs:ccItem.currScore || 0,
-              length:cItem.hlDetailList.length,
-              lowLength:cItem.hlDetailList.length-ccIndex,
-              chss:cItem.hlObjStand.replace(/\n/g, '<br/>'),
-              bri:item.className,
-              data:item,
-              ri:ccItem.hlDetailName,
-              pds:ccItem.remark,
-              iz:ccItem.hlDetailScore,
-              stand:data.stand.replace(/\n/g, '<br/>'),
-              hlDetailId:ccItem.hlDetailId
-            })
-            countIz.value+=ccItem.hlDetailScore
-          })
-        }else{
-          hlbData.value.push({
-            es:cItem.hlObjScore,
-            bri:item.className,
-            data:item,
-            eo:cItem.hlObjName,
-            length:cItem.hlDetailList.length,
-            lowLength:cItem.hlDetailList.length-cIndex,
-            chss:cItem.hlObjStand,
-            stand:data.stand.replace(/\n/g, '<br/>')
-          })
-        }
-      })
-    }else{
-      hlbData.value.push({
-        bri:item.className,
-        data:item
-      })
-    }
-  })
-  calcCountEs()
+async function handleHlDelete({hlObjId,hlClassId}){
+  await deleteHlClass(hlObjId)
+  await selectObj({hlClassId})
+  await bmConfigList(props.modelId)
+}
+
+async function handleHlAdd(){
+  if(!hlIds.value.length) return proxy.$modal.msgError("请选择对象")
+  await addHoList(hlId.value,{objIds:[...hlIds.value].join(",")})
+  await handleAddHl()
+  await selectObj({hlClassId:hlId.value})
+  await bmConfigList(props.modelId)
+  visibleHl.value = false
+  hlIds.value = []
 }
 
 </script>
 <style scoped lang="scss">
+.btn-row{
+  margin-top: 20px;
+  display: flex;
+  justify-content: center;
+}
 </style>

+ 1 - 2
src/views/hl/bm/index.vue

@@ -76,8 +76,7 @@
     />
 
     <!-- 添加或修改业务模型对话框 -->
-    <el-dialog :title="title" v-model="open" :width="dialogType ==='health'?'1200px':'800px'" append-to-body
-               :style="dialogType ==='health'?'margin-top:2px!important;':''">
+    <el-dialog :title="title" v-model="open" width="1000" append-to-body>
       <add-bm-info ref="bmRef" @cancel="open = false" @success="getList" v-if="dialogType==='add'"/>
       <component :is="activeComponent[currentActive]" v-else-if="dialogType!=='add' && open" :modelId="modelId"
                  :dialogType="dialogType"/>

+ 7 - 7
src/views/ms/def/index.vue

@@ -60,13 +60,13 @@
         </template>
       </el-table-column>
       <el-table-column label="指标编码" align="left" prop="metricsCode" width="160"/>
-      <el-table-column label="指标获取公式" align="left" prop="metricsExp"  width="330"/>
-      <el-table-column label="更新时间" align="center" prop="updateTime" width="180">
-        <template #default="scope">
-          <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d} {h}:{mi}:{s}') }}</span>
-        </template>
-      </el-table-column>
-      <el-table-column label="操作" align="left" class-name="small-padding fixed-width" width="200">
+      <el-table-column label="指标获取公式" align="left" prop="metricsExp"  width="130"/>
+<!--      <el-table-column label="更新时间" align="center" prop="updateTime" width="180">-->
+<!--        <template #default="scope">-->
+<!--          <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d} {h}:{mi}:{s}') }}</span>-->
+<!--        </template>-->
+<!--      </el-table-column>-->
+      <el-table-column label="操作" align="left" class-name="small-padding fixed-width" width="150">
         <template #default="scope">
           <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['metrics:def:edit']">
             修改

+ 9 - 1
src/views/obj/obj/component/addComponent.vue

@@ -9,17 +9,25 @@
   </div>
   <div class="step-row">
     <el-button type="primary" @click="active--" v-if="active > 0">上一步</el-button>
-    <el-button type="primary" @click="handleSave">{{ stepArray.length - 1 === active ? '完成' : '下一步' }}</el-button>
+    <el-button type="primary" @click="handleSave">{{ stepArray.length - 1 === active ? '提交' : '下一步' }}</el-button>
+    <el-button type="primary" @click="visible=true" v-if="stepArray.length - 1 === active">导入接口配置</el-button>
   </div>
+
+  <el-dialog v-model="visible" title="接口导入配置" width="600">
+    <setting-file v-model:visible="visible"/>
+  </el-dialog>
+
 </template>
 <script setup lang="ts">
 import step1 from "./step1.vue"
 import step2 from "./step2.vue"
 import step3 from "./step3.vue"
 import step4 from "./step4.vue"
+import settingFile from "./settingFile.vue"
 
 import {nextTick, ref} from "vue";
 const comRef = ref(null)
+const visible = ref(false)
 
 const {proxy,emit} = getCurrentInstance();
 const props=defineProps({

+ 11 - 1
src/views/obj/obj/component/metricsConfig.vue

@@ -10,9 +10,11 @@
       {{form?.metricsCode || '-'}}
     </el-form-item>
     <el-form-item label="数据接口配置">
-      <el-input type="textarea" placeholder="请输入数据接口配置" v-model="form.dataExp" :autosize="{ minRows: 4, maxRows: 6 }"/>
+      <el-input type="textarea" placeholder="请输入数据接口配置" v-model="form.dataExp" show-word-limit maxlength="900" :autosize="{ minRows: 4, maxRows: 6 }" />
+
     </el-form-item>
     <el-form-item label="">
+      <el-button type="primary" @click="handleConfigKey">公式组装</el-button>
       <el-button type="primary" @click="onTest">测试</el-button>
       <span v-if="validateError===1" style="color:#1ab394;margin-left:10px;">
         数据获取正常,当前值:{{currentValue}}
@@ -57,6 +59,14 @@ watchEffect(()=>{
   }
 })
 
+
+const handleConfigKey=()=>{
+  proxy.getConfigKey("pm.url").then(res=>{
+    if(res.code===200){
+      window.open(res.msg, '_blank');
+    }
+  })
+}
 const onTest=()=>{
   const {dataExp} = form.value
   validateError.value = 0

+ 34 - 0
src/views/obj/obj/component/settingFile.vue

@@ -0,0 +1,34 @@
+<template>
+  <el-upload class="upload-demo" drag action="https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15" multiple>
+    <el-icon class="el-icon--upload"><upload-filled /></el-icon>
+    <div class="el-upload__text">
+      将文件拖到此处,或<el-button type="primary" link>点击上传</el-button>
+    </div>
+    <template #tip>
+      <div class="el-upload__tip">
+        仅允许导入xls,xlsx格式文件.<el-button type="primary" link>下载模版</el-button>
+      </div>
+    </template>
+  </el-upload>
+  <div class="setting-btn">
+    <el-button type="primary" @click="emit('update:visible',false)">确定</el-button>
+    <el-button @click="emit('update:visible',false)">取消</el-button>
+  </div>
+</template>
+<script setup lang="ts">
+import { UploadFilled } from '@element-plus/icons-vue'
+const emit = defineEmits(['update:visible'])
+const props = defineProps({
+  visible: Boolean
+})
+</script>
+<style scoped lang="scss">
+.setting-btn{
+  margin: 20px -20px 0 -20px;
+  border-top: 1px solid #f1f1f1;
+  padding-top: 20px;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+}
+</style>