PrintInSbInfoBatch.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. <template>
  2. <div class="print-content" v-show="visible">
  3. <a-row :gutter="48" slot="extra">
  4. <a-col :md="48" :sm="48">
  5. <span class="table-page-search-submitButtons" style="float: right">
  6. <a-button type="dashed" @click="handleEdit()">保存参数</a-button>
  7. <a-button type="primary" style="margin-left: 8px" v-print="'#print-container-batch'" :disabled="disabled">打印</a-button>
  8. <a-button style="margin-left: 8px" @click="handleCancel()">返回列表</a-button>
  9. </span>
  10. </a-col>
  11. </a-row>
  12. <a-row>
  13. <a-col :span="4">
  14. 标签纸宽度(黑色背景)
  15. </a-col>
  16. <a-col :span="12">
  17. <a-slider v-model="labelWidth" :min="1" :max="1000" />
  18. </a-col>
  19. <a-col :span="2">
  20. <a-input-number v-model="labelWidth" style="marginLeft: 8px" />
  21. </a-col>
  22. </a-row>
  23. <a-row>
  24. <a-col :span="4">
  25. 标签表格宽度
  26. </a-col>
  27. <a-col :span="12">
  28. <a-slider v-model="labelContentWidth" :min="1" :max="1000" />
  29. </a-col>
  30. <a-col :span="2">
  31. <a-input-number v-model="labelContentWidth" suffix="px" style="marginLeft: 8px" />
  32. </a-col>
  33. </a-row>
  34. <a-row>
  35. <a-col :span="4">
  36. 标签表格高度
  37. </a-col>
  38. <a-col :span="12">
  39. <a-slider v-model="labelContentHeight" :min="1" :max="1000" />
  40. </a-col>
  41. <a-col :span="2">
  42. <a-input-number v-model="labelContentHeight" suffix="px" style="marginLeft: 8px" />
  43. </a-col>
  44. </a-row>
  45. <a-row>
  46. <a-col :span="4">
  47. 二维码宽度
  48. </a-col>
  49. <a-col :span="12">
  50. <a-slider v-model="imgWidth" :min="1" :max="1000" />
  51. </a-col>
  52. <a-col :span="2">
  53. <a-input-number v-model="imgWidth" suffix="px" style="marginLeft: 8px" />
  54. </a-col>
  55. </a-row>
  56. <div class="container" :style="labelWidthProgress" id="print-container-batch">
  57. <table class="gridtable list" :style="labelContentWidthProgress" :id="'printDiv' + record.id" v-for="record in sbInfoList" :key="record.id">
  58. <tbody>
  59. <tr>
  60. <td class="text-center">名称</td>
  61. <td class="text-center">{{ record.name }}</td>
  62. <td rowspan="4" style="padding: 0 !important;" class="text-center"><img :style="imageProgress" :src="record.qrCode"></img></td>
  63. </tr>
  64. <tr>
  65. <td class="text-center">编号</td>
  66. <td class="text-center">{{ record.no }}</td>
  67. </tr>
  68. <tr>
  69. <td class="text-center">等级</td>
  70. <td class="text-center">{{ BaseTool.Object.getField(levelMap,record.level) }}</td>
  71. </tr>
  72. <tr>
  73. <td class="text-center" width='17%'>维护人</td>
  74. <td class="text-center">{{ record.repairUserName }}</td>
  75. </tr>
  76. </tbody>
  77. </table>
  78. </div>
  79. </div>
  80. </template>
  81. <script>
  82. import { formatDate } from '@/utils/util'
  83. import { configData, updateSysConfigBatch } from '@/api/upms/config'
  84. export default {
  85. name: 'PrintInStoreForm',
  86. components: { },
  87. data () {
  88. return {
  89. visible: false,
  90. disabled: true,
  91. sbInfoList: [],
  92. count: 0,
  93. levelMap: {},
  94. user: this.$store.getters.userInfo,
  95. labelWidth: 200,
  96. labelContentWidth: 100,
  97. labelContentHeight: 100,
  98. imgWidth: 50,
  99. configMap: {}
  100. // 下拉框map
  101. }
  102. },
  103. computed: {
  104. labelWidthProgress () {
  105. const style = {}
  106. style.width = this.labelWidth + 'px'
  107. style.backgroundColor = 'black'
  108. style.textAlign = 'center'
  109. return style
  110. },
  111. labelContentWidthProgress () {
  112. const style = {}
  113. style.width = this.labelContentWidth + 'px'
  114. style.height = this.labelContentHeight + 'px'
  115. style.backgroundColor = 'white'
  116. style.textAlign = 'center'
  117. style.margin = '4px auto'
  118. return style
  119. },
  120. imageProgress () {
  121. const style = {}
  122. style.width = this.imgWidth + 'px'
  123. return style
  124. }
  125. },
  126. props: {},
  127. created () {
  128. // 下拉框map
  129. this.moneyTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.MONEY_TYPE)
  130. this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_LEVEL)
  131. configData().then(res => {
  132. this.configMap = res.data['config:open:value']
  133. this.labelWidth = parseInt(this.configMap[this.DictCache.TYPE.SB_QR_CODE_LABEL_WIDTH])
  134. this.labelContentWidth = parseInt(this.configMap[this.DictCache.TYPE.SB_QR_CODE_LABEL_CONTENT_WIDTH])
  135. this.labelContentHeight = parseInt(this.configMap[this.DictCache.TYPE.SB_QR_CODE_LABEL_CONTENT_HEIGHT])
  136. this.imgWidth = parseInt(this.configMap[this.DictCache.TYPE.SB_QR_CODE_LABEL_IMG_WIDTH])
  137. })
  138. },
  139. methods: {
  140. base (sbInfoList) {
  141. this.disabled = true
  142. this.visible = true
  143. this.sbInfoList = sbInfoList
  144. this.disabled = false
  145. },
  146. formatDateEn (value) {
  147. return formatDate(new Date(value), 'yyyy-MM-dd')
  148. },
  149. formatDateCh (value) {
  150. return formatDate(new Date(value), 'yyyy年MM月dd日')
  151. },
  152. handleCancel (values) {
  153. this.visible = false
  154. this.$emit('ok', values)
  155. },
  156. print () {
  157. this.count = this.count + 1
  158. },
  159. handleEdit () {
  160. const parameter = []
  161. parameter.push({ code: this.DictCache.TYPE.SB_QR_CODE_LABEL_WIDTH, content: this.labelWidth })
  162. parameter.push({ code: this.DictCache.TYPE.SB_QR_CODE_LABEL_CONTENT_WIDTH, content: this.labelContentWidth })
  163. parameter.push({ code: this.DictCache.TYPE.SB_QR_CODE_LABEL_CONTENT_HEIGHT, content: this.labelContentHeight })
  164. parameter.push({ code: this.DictCache.TYPE.SB_QR_CODE_LABEL_IMG_WIDTH, content: this.imgWidth })
  165. updateSysConfigBatch(parameter).then(res => {
  166. this.$message.info('更新成功, 退出,重新登录后全局生效')
  167. })
  168. }
  169. }
  170. }
  171. </script>
  172. <style media=print>
  173. /* 应用这个样式的在打印时隐藏 */
  174. .noPrint {
  175. display: none;
  176. }
  177. /* 应用这个样式的,从那个标签结束开始另算一页,之后在遇到再起一页,以此类推 */
  178. .page {
  179. page-break-after: always;
  180. }
  181. </style>
  182. <style>
  183. .print-content{
  184. margin: 0 auto;
  185. width: 1000px;
  186. background-color: #fff;
  187. }
  188. .container {
  189. width: 100%;
  190. padding-right: 15px;
  191. padding-left: 15px;
  192. margin-right: auto;
  193. margin-left: auto;
  194. }
  195. .col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 {
  196. position: relative;
  197. min-height: 1px;
  198. padding-right: 15px;
  199. padding-left: 15px;
  200. }
  201. .text-left {
  202. text-align: left;
  203. }
  204. .text-right {
  205. text-align: right;
  206. }
  207. .text-center {
  208. text-align: center;
  209. }
  210. table.gridtable {
  211. width: 100%;
  212. font-family: verdana, arial, sans-serif;
  213. font-size: 11px;
  214. color: #333333;
  215. border-width: 1px;
  216. border-color: #666666;
  217. border-collapse: collapse;
  218. page-break-after: always;
  219. }
  220. table.gridtable th {
  221. border-width: 1px;
  222. padding: 8px 0px;
  223. border-style: solid;
  224. border-color: #666666;
  225. background-color: #dedede;
  226. }
  227. table.gridtable td {
  228. border-width: 1px;
  229. padding: 0;
  230. border-style: solid;
  231. color: black;
  232. font-weight: bold;
  233. border-color: #666666;
  234. background-color: #ffffff;
  235. }
  236. .row {
  237. margin-right: -15px;
  238. margin-left: -15px;
  239. }
  240. .container:before,
  241. .container:after,
  242. .row:before, .row:after {
  243. display: table;
  244. content: " ";
  245. }
  246. .container:after, .row:after {
  247. clear: both;
  248. }
  249. .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 {
  250. float: left;
  251. }
  252. .col-md-12 {
  253. width: 100%;
  254. }
  255. .col-md-11 {
  256. width: 91.66666667%;
  257. }
  258. .col-md-10 {
  259. width: 83.33333333%;
  260. }
  261. .col-md-9 {
  262. width: 75%;
  263. }
  264. .col-md-8 {
  265. width: 66.66666667%;
  266. }
  267. .col-md-7 {
  268. width: 58.33333333%;
  269. }
  270. .col-md-6 {
  271. width: 50%;
  272. }
  273. .col-md-5 {
  274. width: 41.66666667%;
  275. }
  276. .col-md-4 {
  277. width: 33.33333333%;
  278. }
  279. .col-md-3 {
  280. width: 25%;
  281. }
  282. .col-md-2 {
  283. width: 16.66666667%;
  284. }
  285. .col-md-1 {
  286. width: 8.33333333%;
  287. }
  288. .node-line{
  289. position: absolute;
  290. width: 60px;
  291. height: 10px;
  292. left:20%;
  293. }
  294. </style>