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.

119 lines
3.4 KiB

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