PrintInSbInfoBatch.vue 8.4 KB

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