血透系统PC前端

printTemplate.vue 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs='crumbs'></bread-crumb>
  5. </div>
  6. <div class="app-container" style="text-align: center">
  7. <p style="margin-top: 10px;margin-bottom: 30px">请选择你需要打印的血液透析护理记录单样式</p>
  8. <el-row :gutter="20" type="flex" justify="center">
  9. <el-col :span="6" style="text-align: center">
  10. <div>
  11. <el-tooltip class="item" effect="dark" :hide-after='2000' content="点击查看大图" placement="top-start">
  12. <el-image
  13. style="width: 200px; height: 200px"
  14. :src="require('@/assets/home/1.jpg')"
  15. :preview-src-list="imgs_one"
  16. ></el-image>
  17. </el-tooltip>
  18. </div>
  19. <el-radio v-model="radio" label="1" @change="change">模版一</el-radio>
  20. </el-col>
  21. <el-col :span="6" style="margin-left: 100px;margin-right: 100px;text-align: center">
  22. <div>
  23. <el-tooltip class="item" effect="dark" content="点击查看大图" placement="top-start" :hide-after='2000'>
  24. <el-image
  25. style="width: 200px; height: 200px"
  26. :src="require('@/assets/home/2.jpg')"
  27. :preview-src-list="imgs_two"
  28. ></el-image>
  29. </el-tooltip>
  30. </div>
  31. <el-radio v-model="radio" label="2" @change="change">模版二</el-radio>
  32. </el-col>
  33. <el-col :span="6" style="text-align: center">
  34. <div class="demo-image__preview">
  35. <el-tooltip class="item" effect="dark" content="点击查看大图" placement="top-start" :hide-after='2000'>
  36. <el-image
  37. style="width: 200px; height: 200px"
  38. :src="require('@/assets/home/5.jpg')"
  39. :preview-src-list="imgs_five"
  40. ></el-image>
  41. </el-tooltip>
  42. </div>
  43. <el-radio v-model="radio" label="5" @change="change">模版三</el-radio>
  44. </el-col>
  45. </el-row>
  46. </div>
  47. </div>
  48. </template>
  49. <script>
  50. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  51. import { getPrintTemplate, postPrintTemplate } from '@/api/data'
  52. export default {
  53. name: 'printTemplate',
  54. components: { BreadCrumb },
  55. data() {
  56. return {
  57. crumbs: [
  58. { path: false, name: '系统管理' },
  59. { path: 'data/print', name: '打印模版' }
  60. ],
  61. imgUrl_One: require('@/assets/home/1.jpg'),
  62. imgUrl_Two: require('@/assets/home/2.jpg'),
  63. imgUrl_Five: require('@/assets/home/5.jpg'),
  64. url: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
  65. imgs_one: [
  66. // 'https://images.shengws.com/template_one.jpg'
  67. 'https://images.shengws.com/fangji.jpg'
  68. ],
  69. imgs_two: [
  70. 'https://images.shengws.com/template_two.jpg'
  71. ],
  72. imgs_five: [
  73. 'https://images.shengws.com/template_five.jpg'
  74. ],
  75. delay:500,
  76. radio: 0,
  77. tempRadio: 0
  78. }
  79. }, methods: {
  80. change: function(val) {
  81. this.$confirm('是否切换模版', '提示', {
  82. confirmButtonText: '确定',
  83. cancelButtonText: '取消',
  84. type: 'info'
  85. }).then(() => {
  86. postPrintTemplate(val).then(response => {
  87. if (response.data.state == 1) {
  88. var template_id = response.data.data.template_id
  89. this.radio = template_id.toString()
  90. this.tempRadio = template_id.toString()
  91. //同步
  92. this.$message({
  93. type: 'success',
  94. message: '切换成功'
  95. })
  96. }
  97. })
  98. }).catch(() => {
  99. this.radio = this.tempRadio
  100. })
  101. }
  102. }, created() {
  103. getPrintTemplate().then(response => {
  104. if (response.data.state == 0) {
  105. this.$message.error(response.data.msg)
  106. return false
  107. } else {
  108. var template = response.data.data.template
  109. this.radio = template.template_id.toString()
  110. this.tempRadio = template.template_id.toString()
  111. }
  112. })
  113. }
  114. }
  115. </script>
  116. <style scoped>
  117. .el-row {
  118. margin-bottom: 20px;
  119. &
  120. :last-child {
  121. margin-bottom: 0;
  122. }
  123. }
  124. .el-col {
  125. border-radius: 4px;
  126. }
  127. </style>