血透系统PC前端

printTemplate.vue 6.0KB

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