Correlation.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <template>
  2. <div class="importDisWrapper clearfix">
  3. <crumbs title="关联维护设置" class="topBack" style="min-width: 980px"></crumbs>
  4. <div class="importDisBox">
  5. <el-form ref="form" :model="form" label-width="120px">
  6. <el-form-item label="术语关联:">
  7. <el-switch
  8. v-model="form.value"
  9. active-color="#4BC4D7"
  10. inactive-color="#ff4949"
  11. @change="handleChange($event,form.value)"
  12. :disabled="disabled"
  13. ></el-switch>
  14. </el-form-item>
  15. </el-form>
  16. </div>
  17. </div>
  18. </template>
  19. <script>
  20. import api from '@api/icss.js';
  21. import config from '@api/config.js';
  22. import utils from '@api/utils.js';
  23. export default {
  24. data() {
  25. return {
  26. form: {
  27. value: true
  28. },
  29. hospitalId: '',
  30. disabled: false
  31. };
  32. },
  33. created() {
  34. this.getHospitalId();
  35. },
  36. methods: {
  37. // 关联
  38. handleChange($event, isCorre) {
  39. this.disabled = true;
  40. let params = {
  41. id: this.hospitalId,
  42. connect: $event ? 1 : 0 //0-不对接,1-对接
  43. };
  44. api
  45. .saveHospitalInfoRecord(params)
  46. .then(res => {
  47. if (res.data.code === '0') {
  48. this.$message({
  49. showClose: true,
  50. message: '操作成功!',
  51. type: 'success'
  52. });
  53. setTimeout(() => {
  54. this.disabled = false;
  55. }, 1500);
  56. }
  57. })
  58. .catch(err => {
  59. this.$message({
  60. showClose: true,
  61. message: '操作失败!',
  62. type: 'error'
  63. });
  64. this.disabled = false;
  65. });
  66. },
  67. // 获取医院id
  68. getHospitalId() {
  69. api.getHospitalInfo().then(res => {
  70. this.hospitalId = res.data.data.id;
  71. });
  72. }
  73. }
  74. };
  75. </script>
  76. <style lang="less">
  77. .importDisWrapper {
  78. min-width: 940px;
  79. color: #606266;
  80. .topBack {
  81. top: 0;
  82. }
  83. .importDisBox {
  84. padding: 80px 60px 120px 60px;
  85. margin: 70px 20px 0 20px;
  86. background: #fff;
  87. }
  88. }
  89. </style>