dialysisOff.vue 8.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  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_off_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_write!=undefined&&scope.row.is_write == 1"
  49. size="small"
  50. type="danger"
  51. icon="el-icon-remove-outline"
  52. @click="handleHideOne(scope.$index, scope.row)"
  53. >
  54. </el-button>
  55. <el-button
  56. v-if="scope.row.is_show == 2"
  57. size="small"
  58. type="primary"
  59. icon="el-icon-view"
  60. @click="handleShow(scope.$index, scope.row)"
  61. >
  62. </el-button>
  63. <el-button
  64. v-if="scope.row.is_write!=undefined&&scope.row.is_write == 0"
  65. size="small"
  66. type="primary"
  67. icon="el-icon-view"
  68. @click="handleShowOne(scope.$index, scope.row)"
  69. >
  70. </el-button>
  71. <!-- <el-tooltip
  72. class="item"
  73. effect="dark"
  74. content="不展示"
  75. placement="top"
  76. v-if="scope.row.is_show == 1"
  77. >
  78. <el-button
  79. size="small"
  80. type="danger"
  81. icon="el-icon-remove-outline"
  82. @click="handleHide(scope.$index, scope.row)"
  83. >
  84. </el-button>
  85. </el-tooltip>
  86. <el-tooltip
  87. class="item"
  88. effect="dark"
  89. content="不必填"
  90. placement="top"
  91. v-if="scope.row.is_write == 1"
  92. >
  93. <el-button
  94. size="small"
  95. type="danger"
  96. icon="el-icon-remove-outline"
  97. @click="handleHideOne(scope.$index, scope.row)"
  98. >
  99. </el-button>
  100. </el-tooltip>
  101. <el-tooltip
  102. class="item"
  103. effect="dark"
  104. content="展示"
  105. placement="top"
  106. v-if="scope.row.is_show == 2"
  107. >
  108. <el-button
  109. size="small"
  110. type="primary"
  111. icon="el-icon-view"
  112. @click="handleShow(scope.$index, scope.row)"
  113. >
  114. </el-button>
  115. </el-tooltip>
  116. <el-tooltip
  117. class="item"
  118. effect="dark"
  119. content="必填"
  120. placement="top"
  121. v-if="scope.row.is_write == 2"
  122. >
  123. <el-button
  124. size="small"
  125. type="primary"
  126. icon="el-icon-view"
  127. @click="handleShowOne(scope.$index, scope.row)"
  128. >
  129. </el-button>
  130. </el-tooltip> -->
  131. </template>
  132. </el-table-column>
  133. </el-table>
  134. </div>
  135. </template>
  136. <script>
  137. import { updateFieldIsShow } from "@/api/data";
  138. import store from "@/store";
  139. export default {
  140. name: "dialysisAfter",
  141. props: {
  142. dialysis_off_data: {
  143. type: Array
  144. }
  145. },
  146. data(){
  147. return {
  148. is_show:2,
  149. is_write:0,
  150. }
  151. },
  152. methods: {
  153. handleHide: function(index, row) {
  154. this.$confirm("是否将该字段设为不可见?", "提示", {
  155. confirmButtonText: "确 定",
  156. cancelButtonText: "取 消",
  157. type: "warning"
  158. })
  159. .then(() => {
  160. updateFieldIsShow(row.id, 2,row.is_write).then(response => {
  161. if (response.data.state == 1) {
  162. this.is_show = response.data.data.is_show
  163. let params = {
  164. id: response.data.data.id,
  165. is_show: response.data.data.is_show,
  166. is_write:response.data.data.is_write,
  167. };
  168. store.dispatch("updateFiledConfigList", params).then(() => {});
  169. this.$emit("change", params);
  170. }
  171. });
  172. this.$message({
  173. type: "success",
  174. message: "设置成功!"
  175. });
  176. })
  177. .catch(() => {});
  178. },
  179. handleHideOne: function(index, row) {
  180. this.$confirm("是否将该字段设为不必填?", "提示", {
  181. confirmButtonText: "确 定",
  182. cancelButtonText: "取 消",
  183. type: "warning"
  184. })
  185. .then(() => {
  186. updateFieldIsShow(row.id,row.is_show,0).then(response => {
  187. if (response.data.state == 1) {
  188. this.is_write = response.data.data.is_write
  189. let params = {
  190. id: response.data.data.id,
  191. is_show: response.data.data.is_show,
  192. is_write:response.data.data.is_write,
  193. };
  194. store.dispatch("updateFiledConfigList", params).then(() => {});
  195. this.$emit("change", params);
  196. }
  197. });
  198. this.$message({
  199. type: "success",
  200. message: "设置成功!"
  201. });
  202. })
  203. .catch(() => {});
  204. },
  205. handleShow: function(index, row) {
  206. this.$confirm("是否将该字段设为可见?", "提示", {
  207. confirmButtonText: "确 定",
  208. cancelButtonText: "取 消",
  209. type: "warning"
  210. }).then(() => {
  211. updateFieldIsShow(row.id, 1,row.is_write).then(response => {
  212. if (response.data.state == 1) {
  213. this.is_show = response.data.data.is_show
  214. let params = {
  215. id: response.data.data.id,
  216. is_show: response.data.data.is_show,
  217. is_write:response.data.data.is_write,
  218. };
  219. store.dispatch("updateFiledConfigList", params).then(() => {});
  220. this.$emit("change", params);
  221. }
  222. });
  223. this.$message({
  224. type: "success",
  225. message: "设置成功!"
  226. });
  227. })
  228. .catch(() => {});
  229. },
  230. handleShowOne: function(index, row) {
  231. this.$confirm("是否将该字段设为必填?", "提示", {
  232. confirmButtonText: "确 定",
  233. cancelButtonText: "取 消",
  234. type: "warning"
  235. }).then(() => {
  236. updateFieldIsShow(row.id,row.is_show,1).then(response => {
  237. if (response.data.state == 1) {
  238. this.is_write = response.data.data.is_write
  239. let params = {
  240. id: response.data.data.id,
  241. is_show: response.data.data.is_show,
  242. is_write:response.data.data.is_write,
  243. };
  244. store.dispatch("updateFiledConfigList", params).then(() => {});
  245. this.$emit("change", params);
  246. }
  247. });
  248. this.$message({
  249. type: "success",
  250. message: "设置成功!"
  251. });
  252. })
  253. .catch(() => {});
  254. }
  255. },
  256. created(){
  257. console.log("dialysis_off_data",this.dialysis_off_data)
  258. }
  259. };
  260. </script>
  261. <style scoped></style>
  262. <style>
  263. .el-table td,
  264. .el-table th.is-leaf,
  265. .el-table--border,
  266. .el-table--group {
  267. border-color: #d0d3da;
  268. }
  269. .el-table--border::after,
  270. .el-table--group::after,
  271. .el-table::before {
  272. background-color: #d0d3da;
  273. }
  274. </style>