healthSetting.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <template>
  2. <el-table :data="bmConfigData" border style="width: 100%">
  3. <el-table-column label="对像类型" width="120">
  4. <template #default="scope">
  5. <dict-tag :options="biz_type" :value="scope.row.objType"/>
  6. </template>
  7. </el-table-column>
  8. <el-table-column label="业务对象" >
  9. <template #default="scope">
  10. <el-button type="primary" link @click="selectObj(scope.row)">
  11. <span v-for="(item,index) in scope.row.hlObjList" :key="`${scope.$index}_${item.hlObjId}`">
  12. {{item.objName}}<span v-if="index != scope.row.hlObjList.length-1">,</span>
  13. </span>
  14. </el-button>
  15. </template>
  16. </el-table-column>
  17. <el-table-column label="分值" width="120" align="center">
  18. <template #default="scope">
  19. <el-input v-model="scope.row.hlScore" size="small" />
  20. </template>
  21. </el-table-column>
  22. <el-table-column label="指标细项" width="120" align="center">
  23. <template #default="scope">
  24. </template>
  25. </el-table-column>
  26. <el-table-column label="操作" width="220">
  27. <template #default="scope">
  28. <el-button type="primary" link icon="Position">健康指标管理</el-button>
  29. <el-button type="primary" link icon="delete">删除</el-button>
  30. </template>
  31. </el-table-column>
  32. </el-table>
  33. <el-dialog title="选择对象" v-model="visible" >
  34. <el-button type="primary" plain @click="handleAddHl">选择对象</el-button>
  35. <el-table :data="hlData" border style="width: 100%;margin-top:10px;">
  36. <el-table-column label="对象名称" prop="objName"/>
  37. <el-table-column label="操作" width="120" align="center">
  38. <template #default="scope">
  39. <el-button type="primary" link icon="delete" @click="handleHlDelete(scope.row)">删除</el-button>
  40. </template>
  41. </el-table-column>
  42. </el-table>
  43. </el-dialog>
  44. <el-dialog title="添加对象" v-model="visibleHl">
  45. <el-table :data="selectHlData" border style="width: 100%;margin-top:10px;" @selection-change="handleSelectionChange">
  46. <el-table-column type="selection" width="55" align="center" />
  47. <el-table-column label="对象名称">
  48. <template #default="scope">
  49. {{scope.row.bizObj.objName}}
  50. </template>
  51. </el-table-column>
  52. </el-table>
  53. <div class="btn-row">
  54. <el-button type="primary" @click="handleHlAdd">添加</el-button>
  55. <el-button @click="visibleHl=false">取消</el-button>
  56. </div>
  57. </el-dialog>
  58. </template>
  59. <script setup lang="ts">
  60. import {getBmConfig} from "@/api/hl/bm"
  61. import {hlClassList,deleteHlClass,selectHlList,addHoList} from "@/api/hl/ho"
  62. import {onMounted} from "vue";
  63. const {proxy} = getCurrentInstance()
  64. const props = defineProps(['modelId'])
  65. const {biz_type} = proxy.useDict('biz_type');
  66. const bmConfigData = ref([])
  67. const hlData = ref([])
  68. const selectHlData = ref([])
  69. const visible = ref(false)
  70. const hlId = ref(null)
  71. const hlIds = ref([])
  72. const visibleHl = ref(false)
  73. onMounted(()=>{
  74. bmConfigList(props.modelId)
  75. })
  76. function handleSelectionChange(selection){
  77. hlIds.value = selection.map(item => item.objId);
  78. }
  79. async function bmConfigList(modelId){
  80. const res = await getBmConfig(modelId)
  81. bmConfigData.value = res.data
  82. }
  83. async function selectObj({hlClassId}){
  84. const res = await hlClassList(hlClassId)
  85. hlId.value = hlClassId
  86. hlData.value = res.data
  87. visible.value = true
  88. }
  89. async function handleAddHl(){
  90. const res = await selectHlList(hlId.value)
  91. visibleHl.value = true
  92. selectHlData.value = res.data
  93. }
  94. async function handleHlDelete({hlObjId,hlClassId}){
  95. await deleteHlClass(hlObjId)
  96. await selectObj({hlClassId})
  97. await bmConfigList(props.modelId)
  98. }
  99. async function handleHlAdd(){
  100. if(!hlIds.value.length) return proxy.$modal.msgError("请选择对象")
  101. await addHoList(hlId.value,{objIds:[...hlIds.value].join(",")})
  102. await handleAddHl()
  103. await selectObj({hlClassId:hlId.value})
  104. await bmConfigList(props.modelId)
  105. visibleHl.value = false
  106. hlIds.value = []
  107. }
  108. </script>
  109. <style scoped lang="scss">
  110. .btn-row{
  111. margin-top: 20px;
  112. display: flex;
  113. justify-content: center;
  114. }
  115. </style>