Correlation.vue 2.4 KB

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