receiveTreatmentAsses.vue 6.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  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="receive_treatment_asses_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. v-if="scope.row.is_write!=undefined&&scope.row.is_write == 0"
  66. size="small"
  67. type="primary"
  68. icon="el-icon-view"
  69. :disabled="scope.row.is_second_menu!=undefined&&scope.row.is_second_menu ==0?false:true"
  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: "receiveTreatmentAsses",
  83. props: {
  84. receive_treatment_asses_data: {
  85. type: Array
  86. }
  87. },
  88. methods: {
  89. handleHide: function(index, row) {
  90. this.$confirm("是否将该字段设为不可见?", "提示", {
  91. confirmButtonText: "确 定",
  92. cancelButtonText: "取 消",
  93. type: "warning"
  94. })
  95. .then(() => {
  96. updateFieldIsShow(row.id, 2,row.is_write).then(response => {
  97. if (response.data.state == 1) {
  98. let params = {
  99. id: response.data.data.id,
  100. is_show: response.data.data.is_show
  101. };
  102. store.dispatch("updateFiledConfigList", params).then(() => {});
  103. this.$emit("change", params);
  104. }
  105. });
  106. this.$message({
  107. type: "success",
  108. message: "设置成功!"
  109. });
  110. })
  111. .catch(() => {});
  112. },
  113. handleShow: function(index, row) {
  114. this.$confirm("是否将该字段设为可见?", "提示", {
  115. confirmButtonText: "确 定",
  116. cancelButtonText: "取 消",
  117. type: "warning"
  118. })
  119. .then(() => {
  120. updateFieldIsShow(row.id, 1,row.is_write).then(response => {
  121. if (response.data.state == 1) {
  122. let params = {
  123. id: response.data.data.id,
  124. is_show: response.data.data.is_show
  125. };
  126. store.dispatch("updateFiledConfigList", params).then(() => {});
  127. this.$emit("change", params);
  128. }
  129. });
  130. this.$message({
  131. type: "success",
  132. message: "设置成功!"
  133. });
  134. })
  135. .catch(() => {});
  136. },
  137. handleHideOne: function(index, row) {
  138. this.$confirm("是否将该字段设为不必填?", "提示", {
  139. confirmButtonText: "确 定",
  140. cancelButtonText: "取 消",
  141. type: "warning"
  142. })
  143. .then(() => {
  144. updateFieldIsShow(row.id,row.is_show,0).then(response => {
  145. if (response.data.state == 1) {
  146. this.is_write = response.data.data.is_write
  147. let params = {
  148. id: response.data.data.id,
  149. is_show: response.data.data.is_show,
  150. is_write:response.data.data.is_write,
  151. };
  152. store.dispatch("updateFiledConfigList", params).then(() => {});
  153. this.$emit("change", params);
  154. }
  155. });
  156. this.$message({
  157. type: "success",
  158. message: "设置成功!"
  159. });
  160. })
  161. .catch(() => {});
  162. },
  163. handleShowOne: function(index, row) {
  164. this.$confirm("是否将该字段设为必填?", "提示", {
  165. confirmButtonText: "确 定",
  166. cancelButtonText: "取 消",
  167. type: "warning"
  168. }).then(() => {
  169. updateFieldIsShow(row.id,row.is_show,1).then(response => {
  170. if (response.data.state == 1) {
  171. this.is_write = response.data.data.is_write
  172. let params = {
  173. id: response.data.data.id,
  174. is_show: response.data.data.is_show,
  175. is_write:response.data.data.is_write,
  176. };
  177. store.dispatch("updateFiledConfigList", params).then(() => {});
  178. this.$emit("change", params);
  179. }
  180. });
  181. this.$message({
  182. type: "success",
  183. message: "设置成功!"
  184. });
  185. })
  186. .catch(() => {});
  187. }
  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>