dialysisComputer.vue 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <div class="">
  3. <el-table
  4. :row-style="{ color: '#303133' }"
  5. :header-cell-style="{
  6. backgroundColor: 'rgb(245, 247, 250)',
  7. color: '#606266'
  8. }"
  9. :data="dialysis_computer_data"
  10. border
  11. fit
  12. highlight-current-row
  13. style="width: 100%;min-height:500px;"
  14. >
  15. <el-table-column align="center" label="字段名">
  16. <template slot-scope="scope">
  17. <span>{{ scope.row.filed_name_cn }}</span>
  18. </template>
  19. </el-table-column>
  20. <el-table-column align="center" label="字段">
  21. <template slot-scope="scope">
  22. <span>{{ scope.row.filed_name }}</span>
  23. </template>
  24. </el-table-column>
  25. <el-table-column align="center" label="是否显示">
  26. <template slot-scope="scope">
  27. <span v-if="scope.row.is_show == 1">是</span>
  28. <span v-if="scope.row.is_show == 2">否</span>
  29. </template>
  30. </el-table-column>
  31. <el-table-column label="操作" align="center">
  32. <template slot-scope="scope">
  33. <el-tooltip
  34. class="item"
  35. effect="dark"
  36. content="不展示"
  37. placement="top"
  38. v-if="scope.row.is_show == 1"
  39. >
  40. <el-button
  41. size="small"
  42. type="danger"
  43. icon="el-icon-remove-outline"
  44. @click="handleHide(scope.$index, scope.row)"
  45. >
  46. </el-button>
  47. </el-tooltip>
  48. <el-tooltip
  49. class="item"
  50. effect="dark"
  51. content="展示"
  52. placement="top"
  53. v-if="scope.row.is_show == 2"
  54. >
  55. <el-button
  56. size="small"
  57. type="primary"
  58. icon="el-icon-view"
  59. @click="handleShow(scope.$index, scope.row)"
  60. >
  61. </el-button>
  62. </el-tooltip>
  63. </template>
  64. </el-table-column>
  65. </el-table>
  66. </div>
  67. </template>
  68. <script>
  69. import { updateFieldIsShow } from "@/api/data";
  70. import store from "@/store";
  71. export default {
  72. name: "dialysisComputer",
  73. props: {
  74. dialysis_computer_data: {
  75. type: Array
  76. }
  77. },
  78. methods: {
  79. handleHide: function(index, row) {
  80. this.$confirm("是否将该字段设为不可见?", "提示", {
  81. confirmButtonText: "确 定",
  82. cancelButtonText: "取 消",
  83. type: "warning"
  84. })
  85. .then(() => {
  86. updateFieldIsShow(row.id, 2,0).then(response => {
  87. if (response.data.state == 1) {
  88. let params = {
  89. id: response.data.data.id,
  90. is_show: response.data.data.is_show
  91. };
  92. store.dispatch("updateFiledConfigList", params).then(() => {});
  93. this.$emit("change", params);
  94. }
  95. });
  96. this.$message({
  97. type: "success",
  98. message: "设置成功!"
  99. });
  100. })
  101. .catch(() => {});
  102. },
  103. handleShow: function(index, row) {
  104. this.$confirm("是否将该字段设为可见?", "提示", {
  105. confirmButtonText: "确 定",
  106. cancelButtonText: "取 消",
  107. type: "warning"
  108. })
  109. .then(() => {
  110. updateFieldIsShow(row.id, 1,1).then(response => {
  111. if (response.data.state == 1) {
  112. let params = {
  113. id: response.data.data.id,
  114. is_show: response.data.data.is_show
  115. };
  116. store.dispatch("updateFiledConfigList", params).then(() => {});
  117. this.$emit("change", params);
  118. }
  119. });
  120. this.$message({
  121. type: "success",
  122. message: "设置成功!"
  123. });
  124. })
  125. .catch(() => {});
  126. }
  127. },
  128. watch: {
  129. },
  130. };
  131. </script>
  132. <style scoped></style>
  133. <style>
  134. .el-table td,
  135. .el-table th.is-leaf,
  136. .el-table--border,
  137. .el-table--group {
  138. border-color: #d0d3da;
  139. }
  140. .el-table--border::after,
  141. .el-table--group::after,
  142. .el-table::before {
  143. background-color: #d0d3da;
  144. }
  145. </style>