You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

133 lines
3.7 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div>
  3. <el-table :data="doctorCheck.checkItemList" style="width: 100%" height="350" border @row-click="rowClick">
  4. <el-table-column prop="itemName" label="项目" width="180" />
  5. <el-table-column prop="result" label="结果" width="500">
  6. <template slot-scope="scope">
  7. <el-autocomplete style="width: 480px" class="inline-input" type="textarea"
  8. v-model="doctorCheck.checkItemList[scope.$index].result" :fetch-suggestions="querySearch"
  9. placeholder="请输入结果值" @select="handleSelect" />
  10. </template>
  11. </el-table-column>
  12. <el-table-column prop="unit" label="单位" width="80" />
  13. <el-table-column prop="referenceRangeValue" label="参考范围" width="120" />
  14. </el-table>
  15. </div>
  16. </template>
  17. <script>
  18. import { mapState } from 'vuex';
  19. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  20. export default {
  21. components: {},
  22. data() {
  23. return {
  24. restaurants:[], //结果模版
  25. currentRow: -1, //当前操作的行
  26. };
  27. },
  28. created() { },
  29. //挂载完成
  30. mounted() { },
  31. computed: {
  32. ...mapState(['dict', 'doctorCheck']),
  33. },
  34. methods: {
  35. //选择组合项目
  36. rowClick(row) {
  37. //registerCheckId
  38. // "itemResultTemplates": [
  39. // {
  40. // "itemId": "3a0c6555-0dad-55b4-b59f-b11e8074cfdd",
  41. // "result": "阳性",
  42. // "diagnosisId": "db34f48c-8c2f-9311-076d-302dc31930e7",
  43. // "isNameIntoSummary": "Y",
  44. // "isResultIntoSummary": "Y",
  45. // "resultStatusId": "08",
  46. // "simpleCode": null
  47. // },
  48. // {
  49. // "itemId": "3a0c6555-0dad-55b4-b59f-b11e8074cfdd",
  50. // "result": "阴性",
  51. // "diagnosisId": "db34f48c-8c2f-9311-076d-302dc31930e7",
  52. // "isNameIntoSummary": "Y",
  53. // "isResultIntoSummary": "Y",
  54. // "resultStatusId": "08",
  55. // "simpleCode": null
  56. // }
  57. // ],
  58. this.restaurants = row.itemResultTemplates
  59. },
  60. //检查组合项目下所包含的明细项目
  61. checkItemList(RegisterCheckId) {
  62. console.log(`/api/app/registercheckitem/getlistinregistercheckid?RegisterCheckId=${RegisterCheckId}`)
  63. getapi(`/api/app/registercheckitem/getlistinregistercheckid?RegisterCheckId=${RegisterCheckId}`)
  64. .then((res) => {
  65. console.log("checkItemList", res.data);
  66. if (res.code == 1) {
  67. this.doctorCheck.checkItemList = res.data;
  68. }
  69. })
  70. .catch((err) => {
  71. this.$message({ type: "error", message: `操作失败,原因:${err}` });
  72. });
  73. },
  74. querySearch(queryString, cb) {
  75. var restaurants = [...this.restaurants] //[{ value: '阴性' },{ value: '阳性' }]
  76. restaurants.forEach((item) =>{
  77. return item.value = item.result
  78. })
  79. console.log('restaurants',restaurants)
  80. var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
  81. // 调用 callback 返回建议列表的数据
  82. cb(results);
  83. },
  84. createFilter(queryString) {
  85. return (restaurant) => {
  86. return (restaurant['value'].toLowerCase().indexOf(queryString.toLowerCase()) === 0);
  87. };
  88. },
  89. handleSelect(item) {
  90. console.log(item);
  91. },
  92. },
  93. //监听事件
  94. watch: {
  95. //检查项目切换
  96. "doctorCheck.RegisterCheckId"(newVal, oldVal) {
  97. console.log("watch doctorCheck.RegisterCheckId newVal:", newVal, " oldVal:", oldVal);
  98. if (newVal != oldVal && newVal != '') {
  99. this.checkItemList(newVal)
  100. }
  101. },
  102. },
  103. };
  104. </script>
  105. <style scoped>
  106. .el-table .warning-row {
  107. background: rgb(240, 125, 125);
  108. }
  109. .el-table .refuse-row {
  110. background: rgb(192, 192, 192);
  111. }
  112. </style>