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.

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