PrintInSbInfoBatch.vue 8.5 KB

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