|
@@ -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>
|