dialysisBefore.vue 6.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  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_before_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 align="center" label="是否必填">
  32. <template slot-scope="scope">
  33. <span v-if="scope.row.is_write!=undefined &&scope.row.is_write == 1">是</span>
  34. <span v-if="scope.row.is_write!=undefined &&scope.row.is_write == 0">否</span>
  35. </template>
  36. </el-table-column>
  37. <el-table-column label="操作" align="center">
  38. <template slot-scope="scope">
  39. <el-button
  40. v-if="scope.row.is_show == 1"
  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-button
  48. v-if="scope.row.is_show == 2"
  49. size="small"
  50. type="primary"
  51. icon="el-icon-view"
  52. @click="handleShow(scope.$index, scope.row)"
  53. >
  54. </el-button>
  55. <el-button
  56. v-if="scope.row.is_write!=undefined&&scope.row.is_write == 1"
  57. size="small"
  58. type="danger"
  59. icon="el-icon-remove-outline"
  60. :disabled="scope.row.is_second_menu!=undefined&&scope.row.is_second_menu ==0?false:true"
  61. @click="handleHideOne(scope.$index, scope.row)"
  62. >
  63. </el-button>
  64. <el-button
  65. :disabled="scope.row.is_second_menu!=undefined&&scope.row.is_second_menu ==0?false:true"
  66. v-if="scope.row.is_write!=undefined&&scope.row.is_write == 0"
  67. size="small"
  68. type="primary"
  69. icon="el-icon-view"
  70. @click="handleShowOne(scope.$index, scope.row)"
  71. >
  72. </el-button>
  73. </template>
  74. </el-table-column>
  75. </el-table>
  76. </div>
  77. </template>
  78. <script>
  79. import { updateFieldIsShow } from '@/api/data'
  80. import store from '@/store'
  81. export default {
  82. name: 'dialysisBefore',
  83. props: {
  84. dialysis_before_data: {
  85. type: Array
  86. }
  87. }, methods: {
  88. handleHide: function(index, row) {
  89. this.$confirm('是否将该字段设为不可见?', '提示', {
  90. confirmButtonText: '确 定',
  91. cancelButtonText: '取 消',
  92. type: 'warning'
  93. }).then(() => {
  94. updateFieldIsShow(row.id, 2,row.is_write).then(response => {
  95. if (response.data.state == 1) {
  96. const params = {
  97. id: response.data.data.id,
  98. is_show: response.data.data.is_show
  99. }
  100. store.dispatch('updateFiledConfigList', params).then(() => {
  101. })
  102. this.$emit('change', params)
  103. }
  104. })
  105. this.$message({
  106. type: 'success',
  107. message: '设置成功!'
  108. })
  109. }).catch(() => {
  110. })
  111. },
  112. handleShow: function(index, row) {
  113. this.$confirm('是否将该字段设为可见?', '提示', {
  114. confirmButtonText: '确 定',
  115. cancelButtonText: '取 消',
  116. type: 'warning'
  117. }).then(() => {
  118. updateFieldIsShow(row.id, 1,row.is_write).then(response => {
  119. if (response.data.state == 1) {
  120. const params = {
  121. id: response.data.data.id,
  122. is_show: response.data.data.is_show
  123. }
  124. store.dispatch('updateFiledConfigList', params).then(() => {
  125. })
  126. this.$emit('change', params)
  127. }
  128. })
  129. this.$message({
  130. type: 'success',
  131. message: '设置成功!'
  132. })
  133. }).catch(() => {
  134. })
  135. },
  136. handleHideOne: function(index, row) {
  137. this.$confirm("是否将该字段设为不必填?", "提示", {
  138. confirmButtonText: "确 定",
  139. cancelButtonText: "取 消",
  140. type: "warning"
  141. })
  142. .then(() => {
  143. updateFieldIsShow(row.id,row.is_show,0).then(response => {
  144. if (response.data.state == 1) {
  145. this.is_write = response.data.data.is_write
  146. let params = {
  147. id: response.data.data.id,
  148. is_show: response.data.data.is_show,
  149. is_write:response.data.data.is_write,
  150. };
  151. store.dispatch("updateFiledConfigList", params).then(() => {});
  152. this.$emit("change", params);
  153. }
  154. });
  155. this.$message({
  156. type: "success",
  157. message: "设置成功!"
  158. });
  159. })
  160. .catch(() => {});
  161. },
  162. handleShowOne: function(index, row) {
  163. this.$confirm("是否将该字段设为必填?", "提示", {
  164. confirmButtonText: "确 定",
  165. cancelButtonText: "取 消",
  166. type: "warning"
  167. }).then(() => {
  168. updateFieldIsShow(row.id,row.is_show,1).then(response => {
  169. if (response.data.state == 1) {
  170. this.is_write = response.data.data.is_write
  171. let params = {
  172. id: response.data.data.id,
  173. is_show: response.data.data.is_show,
  174. is_write:response.data.data.is_write,
  175. };
  176. store.dispatch("updateFiledConfigList", params).then(() => {});
  177. this.$emit("change", params);
  178. }
  179. });
  180. this.$message({
  181. type: "success",
  182. message: "设置成功!"
  183. });
  184. }).catch(() => {});
  185. }
  186. },
  187. created() {
  188. }
  189. }
  190. </script>
  191. <style scoped></style>
  192. <style>
  193. .el-table td,
  194. .el-table th.is-leaf,
  195. .el-table--border,
  196. .el-table--group {
  197. border-color: #d0d3da;
  198. }
  199. .el-table--border::after,
  200. .el-table--group::after,
  201. .el-table::before {
  202. background-color: #d0d3da;
  203. }
  204. </style>