print.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <template>
  2. <!--订单打印【弹窗】-->
  3. <el-dialog v-model="visibie" title="生产订单打印" style="width: 40%">
  4. <el-row>
  5. <el-form-item label="订单号:" prop="currentProcess" class="mab">
  6. <el-input v-model="form['gdbh']" @keydown="cp_print_ProductValue" style="width: 200px" />
  7. </el-form-item>
  8. </el-row>
  9. <!-- <el-row>
  10. <el-form-item label="印件号:" prop="yjno" class="mab" label-width="70">
  11. <el-select v-model="form['yjno']" placeholder="请选择印件号" style="width: 120px;" @change="getmc">
  12. <el-option
  13. v-for="item in yjlist"
  14. :label="item.印件号"
  15. :value="item.印件号"
  16. />
  17. </el-select>
  18. </el-form-item>
  19. <el-form-item label="终止工序号:" prop="currentProcess" class="mab" label-width="100">
  20. <el-select v-model="form['gxh']" placeholder="请选择工序号" style="width: 120px;">
  21. <el-option
  22. v-for="item in gxlist"
  23. :label="item.工序号"
  24. :value="item.工序号"
  25. />
  26. </el-select>
  27. </el-form-item>
  28. </el-row> -->
  29. <!-- <el-row>
  30. <el-form-item label="印件名称:" prop="currentProcess" class="mab" >
  31. <el-input v-model="form['yjmc']" placeholder="" style="width: 500px;" />
  32. </el-form-item>
  33. </el-row>
  34. <el-row>
  35. <el-form-item label="制单:" prop="currentProcess" class="mab" label-width="70">
  36. <el-input v-model="form['zd']" placeholder="" style="width: 500px;" />
  37. </el-form-item>
  38. </el-row>
  39. <el-row>
  40. <el-form-item label="审核:" prop="currentProcess" class="mab" label-width="70">
  41. <el-input v-model="form['sh']" placeholder="" style="width: 500px;"/>
  42. </el-form-item>
  43. </el-row> -->
  44. <div class="dialog-footer" style="text-align: right; margin-top: 30px;">
  45. <el-button @click="() => visibie = false">取消</el-button>
  46. <el-button type="primary" @click="cp_print_handleConfirm">确认</el-button>
  47. </div>
  48. </el-dialog>
  49. </template>
  50. <script setup>
  51. import { ref, reactive } from 'vue'
  52. import {ElMessage} from "element-plus";
  53. import {PrintCodeList, PrintJobOrder, ProcessCodeList} from "@/api/yunyin/yunying";
  54. import {hiprint} from "vue-plugin-hiprint";
  55. const visibie = ref(false)
  56. const form = reactive({})
  57. // const id = ref()
  58. // const yjlist = ref([])
  59. // const gxlist = ref([])
  60. const open = (gongdanId) => {
  61. // console.log(gongdanId)
  62. if (gongdanId == null) {
  63. ElMessage({type: 'warning',message: '请选择具体的工单后,再操作此功能'});
  64. } else {
  65. form['gdbh'] = gongdanId;
  66. visibie.value = true;
  67. }
  68. }
  69. //工单打印回车
  70. const cp_print_ProductValue = async (e) => {
  71. }
  72. //{"width":88.46074598983488,"title":" 颜色","field":"ys","checked":true,"columnId":"ys","fixed":false,"rowspan":1,"colspan":1},
  73. //{ "width": 156.58838324924145, "title": "条码", "field": "barcode", "checked": true, "columnId": "barcode", "fixed": false, "rowspan": 1, "colspan": 1, "tableTextType": "barcode", "barcodeType": "code128", "barcodeWidth": 2, "barcodeHeight": 100, "text": true, "textPosition": "bottom", "textAlign": "center", "fontSize": 12 },
  74. //json打印表格数据
  75. const jsondata =
  76. {"panels":[{"index":0,"name":1,"height":297,"width":210,"paperHeader":357,"paperFooter":774,"printElements":[{"options":{"left":501,"top":13.5,"height":80,"width":80,"title":"二维码","qrcodeType":"qrcode","testData":"qrcode","right":579.5,"bottom":93.5,"vCenter":539.5,"hCenter":53.5,"qrCodeLevel":0,"coordinateSync":false,"widthHeightSync":false,"field":"ewm","hideTitle":true},"printElementType":{"title":"二维码","type":"qrcode"}},{"options":{"left":120,"top":35,"height":30,"width":350,"title":"浙江达成凯锐纺织服装有限公司","right":423.75,"bottom":54,"vCenter":290.25,"hCenter":45,"coordinateSync":false,"widthHeightSync":false,"fontSize":18,"fontWeight":"bold","letterSpacing":6,"textAlign":"center","textContentVerticalAlign":"middle","qrCodeLevel":0},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":123,"top":64.5,"height":20,"width":350,"title":"ZHE JIANG REACHING KAYO TEXTILE & GARMENTS CO LTD","right":455.25,"bottom":45.75,"vCenter":288.75,"hCenter":38.25,"coordinateSync":false,"widthHeightSync":false,"fontSize":9.75,"textAlign":"center","textContentVerticalAlign":"middle","qrCodeLevel":0},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":67.5,"top":98.5,"height":138,"width":9,"coordinateSync":false,"widthHeightSync":false},"printElementType":{"title":"竖线","type":"vline"}},{"options":{"left":580,"top":98.5,"height":204,"width":9,"right":594.99609375,"bottom":302.49609375,"vCenter":590.49609375,"hCenter":200.49609375,"coordinateSync":false,"widthHeightSync":false},"printElementType":{"title":"竖线","type":"vline"}},{"options":{"left":12,"top":98.5,"height":9,"width":569,"borderWidth":"0.75","coordinateSync":false,"widthHeightSync":false,"right":589.25,"bottom":117.75,"vCenter":294.25,"hCenter":113.25},"printElementType":{"title":"横线","type":"hline"}},{"options":{"left":229.5,"top":99,"height":101,"width":9,"right":237.75,"bottom":185.49374771118164,"vCenter":233.25,"hCenter":140.49374771118164,"coordinateSync":false,"widthHeightSync":false},"printElementType":{"title":"竖线","type":"vline"}},{"options":{"left":303,"top":99,"height":65,"width":9,"right":309,"bottom":164.49374771118164,"vCenter":304.5,"hCenter":134.49374771118164,"coordinateSync":false,"widthHeightSync":false},"printElementType":{"title":"竖线","type":"vline"}},{"options":{"left":12,"top":99,"height":202.5,"width":9,"right":21,"bottom":301.5,"vCenter":16.5,"hCenter":200.25,"coordinateSync":false,"widthHeightSync":false},"printElementType":{"title":"竖线","type":"vline"}},{"options":{"left":72,"top":100.5,"height":27,"width":150,"field":"ddh","coordinateSync":false,"widthHeightSync":false,"hideTitle":true,"fontSize":12,"textAlign":"left","textContentVerticalAlign":"middle","qrCodeLevel":0,"right":222,"bottom":123,"vCenter":147,"hCenter":109.5,"title":"文本"},"printElementType":{"title":"文本","type":"text"}},{"options":{"left":237,"top":100.5,"height":27,"width":52,"title":"生产款号","coordinateSync":false,"widthHeightSync":false,"qrCodeLevel":0,"right":291.25,"bottom":123,"vCenter":265.25,"hCenter":109.5,"fontSize":12,"textAlign":"center","textContentVerticalAlign":"middle"},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":18.5,"top":101.5,"height":27,"width":47,"title":"订单号","coordinateSync":false,"widthHeightSync":false,"qrCodeLevel":0,"right":48.75,"bottom":123,"vCenter":27,"hCenter":118.125,"fontSize":12,"textAlign":"center","textContentVerticalAlign":"middle"},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":312,"top":102,"height":28,"width":271.5,"right":464.25,"bottom":125.5,"vCenter":389.25,"hCenter":111.5,"field":"sckh","coordinateSync":false,"widthHeightSync":false,"qrCodeLevel":0,"qid":"ks_1","fontSize":12,"textAlign":"left","textContentVerticalAlign":"middle","hideTitle":true},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":12,"top":130.5,"height":9,"width":569,"borderWidth":"0.75","right":586.75,"bottom":140.49375915527344,"vCenter":301.25,"hCenter":135.99375915527344,"coordinateSync":false,"widthHeightSync":false},"printElementType":{"title":"横线","type":"hline"}},{"options":{"left":72,"top":132,"height":30,"width":150,"right":221.25,"bottom":158.25,"vCenter":146.25,"hCenter":143.25,"field":"kh","coordinateSync":false,"widthHeightSync":false,"qrCodeLevel":0,"fontSize":12,"textAlign":"left","textContentVerticalAlign":"middle","hideTitle":true},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":312,"top":133.5,"height":28,"width":271.5,"right":462,"bottom":157,"vCenter":387,"hCenter":143,"field":"lhrq","coordinateSync":false,"widthHeightSync":false,"qrCodeLevel":0,"qid":"sckh_1","fontSize":12,"textAlign":"left","textContentVerticalAlign":"middle","hideTitle":true},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":237,"top":135,"height":27,"width":52,"title":"落货日期","coordinateSync":false,"widthHeightSync":false,"qrCodeLevel":0,"right":354.75,"bottom":149.25,"vCenter":331.5,"hCenter":144.375,"fontSize":12,"textAlign":"center","textContentVerticalAlign":"middle"},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":18,"top":135,"height":27,"width":47,"title":"客户","coordinateSync":false,"widthHeightSync":false,"qrCodeLevel":0,"right":37.5,"bottom":153,"vCenter":24.75,"hCenter":148.125,"fontSize":12,"textAlign":"center","textContentVerticalAlign":"middle"},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":12,"top":163,"height":9,"width":569,"borderWidth":"0.75","right":590,"bottom":120.75,"vCenter":295,"hCenter":116.25,"coordinateSync":false,"widthHeightSync":false},"printElementType":{"title":"横线","type":"hline"}},{"options":{"left":232.5,"top":166.5,"height":31,"width":349.5,"coordinateSync":false,"widthHeightSync":false,"fontSize":12,"fontWeight":"bold","textAlign":"left","qrCodeLevel":0,"lineHeight":12.75,"right":580.5,"bottom":189,"vCenter":408,"hCenter":175.5,"field":"bz","hideTitle":true,"textContentVerticalAlign":"middle"},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":18,"top":168,"height":27,"width":47,"title":"款式","coordinateSync":false,"widthHeightSync":false,"qrCodeLevel":0,"right":39.75,"bottom":183.75,"vCenter":25.5,"hCenter":177,"fontSize":12.75,"textAlign":"center","textContentVerticalAlign":"middle"},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":72,"top":168,"height":30,"width":150,"right":284.7468795776367,"bottom":189.24375915527344,"vCenter":209.74687957763672,"hCenter":174.24375915527344,"field":"ks","coordinateSync":false,"widthHeightSync":false,"qrCodeLevel":0,"qid":"kehu_1","fontSize":12,"textAlign":"left","textContentVerticalAlign":"middle","hideTitle":true},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":12,"top":199.5,"height":9,"width":569,"borderWidth":"0.75","right":585.25,"bottom":223.5,"vCenter":299.75,"hCenter":219,"coordinateSync":false,"widthHeightSync":false},"printElementType":{"title":"横线","type":"hline"}},{"options":{"left":18,"top":202.5,"height":27,"width":47,"title":"面料","coordinateSync":false,"widthHeightSync":false,"qrCodeLevel":0,"right":40.5,"bottom":212.25,"vCenter":28.5,"hCenter":207.375,"fontSize":12,"textAlign":"center","textContentVerticalAlign":"middle"},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":69,"top":204,"height":30,"width":511.5,"right":586.5,"bottom":225.75,"vCenter":330.75,"hCenter":210.75,"field":"ml","coordinateSync":false,"widthHeightSync":false,"qrCodeLevel":0,"qid":"ks_1","fontSize":12,"textAlign":"left","textContentVerticalAlign":"middle","hideTitle":true},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":550,"top":236,"height":66,"width":9,"coordinateSync":false,"widthHeightSync":false},"printElementType":{"title":"竖线","type":"vline"}},{"options":{"left":12,"top":237,"height":9,"width":569,"borderWidth":"0.75","coordinateSync":false,"widthHeightSync":false,"right":584.5,"bottom":308.49375915527344,"vCenter":299,"hCenter":303.99375915527344},"printElementType":{"title":"横线","type":"hline"}},{"options":{"left":10.5,"top":238.5,"height":25,"width":504,"title":"色码分配表","right":506.25,"bottom":263.2500057220459,"vCenter":263.25,"hCenter":249.7500057220459,"coordinateSync":false,"widthHeightSync":false,"fontSize":12,"letterSpacing":5.25,"textAlign":"center","textContentVerticalAlign":"middle","qrCodeLevel":0},"printElementType":{"title":"文本","type":"text"}},{"options":{"left":549,"top":246,"height":38,"width":36,"title":"合计(件)","coordinateSync":false,"widthHeightSync":false,"qrCodeLevel":0,"right":567.75,"bottom":283,"vCenter":551.25,"hCenter":263,"fontSize":12,"textAlign":"center","textContentVerticalAlign":"middle","lineHeight":15},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":350,"top":265.5,"height":36,"width":9,"right":234,"bottom":297.75,"vCenter":229.5,"hCenter":279.75,"coordinateSync":false,"widthHeightSync":false},"printElementType":{"title":"竖线","type":"vline"}},{"options":{"left":475,"top":265.5,"height":36,"width":9,"right":403.74609375,"bottom":297,"vCenter":399.24609375,"hCenter":279,"coordinateSync":false,"widthHeightSync":false},"printElementType":{"title":"竖线","type":"vline"}},{"options":{"left":450,"top":265.5,"height":36,"width":9,"right":386.49609375,"bottom":299.25,"vCenter":381.99609375,"hCenter":281.25,"coordinateSync":false,"widthHeightSync":false},"printElementType":{"title":"竖线","type":"vline"}},{"options":{"left":525,"top":265.5,"height":36,"width":9,"right":528.99609375,"bottom":302.25,"vCenter":524.49609375,"hCenter":284.25,"coordinateSync":false,"widthHeightSync":false},"printElementType":{"title":"竖线","type":"vline"}},{"options":{"left":13.5,"top":265.5,"height":9,"width":538,"borderWidth":"0.75","coordinateSync":false,"widthHeightSync":false,"right":544.5,"bottom":270.24374198913574,"vCenter":279,"hCenter":265.74374198913574},"printElementType":{"title":"横线","type":"hline"}},{"options":{"left":425,"top":266,"height":36,"width":9,"right":372.75,"bottom":301.5,"vCenter":368.25,"hCenter":283.5,"coordinateSync":false,"widthHeightSync":false},"printElementType":{"title":"竖线","type":"vline"}},{"options":{"left":400,"top":266,"height":36,"width":9,"right":336,"bottom":301.5,"vCenter":331.5,"hCenter":283.5,"coordinateSync":false,"widthHeightSync":false},"printElementType":{"title":"竖线","type":"vline"}},{"options":{"left":375,"top":266,"height":36,"width":9,"right":301.74609375,"bottom":303,"vCenter":297.24609375,"hCenter":285,"coordinateSync":false,"widthHeightSync":false},"printElementType":{"title":"竖线","type":"vline"}},{"options":{"left":501.5,"top":267,"height":36,"width":9,"right":471.75,"bottom":298.5,"vCenter":467.25,"hCenter":280.5,"coordinateSync":false,"widthHeightSync":false},"printElementType":{"title":"竖线","type":"vline"}},{"options":{"left":249,"top":271.5,"height":13,"width":26,"title":"尺码","coordinateSync":false,"widthHeightSync":false,"qrCodeLevel":0,"right":131,"bottom":278.5,"vCenter":118,"hCenter":272,"fontSize":12,"textAlign":"center","textContentVerticalAlign":"middle"},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":425,"top":274.5,"height":20,"width":25,"title":"10","coordinateSync":false,"widthHeightSync":false,"fontSize":12,"textAlign":"center","textContentVerticalAlign":"middle","qrCodeLevel":0,"qid":"cm1_3","right":401.25,"bottom":291.5,"vCenter":386.25,"hCenter":281.5},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":400,"top":274.5,"height":20,"width":25,"title":"8","coordinateSync":false,"widthHeightSync":false,"fontSize":12,"textAlign":"center","textContentVerticalAlign":"middle","qrCodeLevel":0,"qid":"cm1_2","right":423.75,"bottom":293,"vCenter":408.75,"hCenter":283},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":375,"top":275,"height":20,"width":25,"title":"6","coordinateSync":false,"widthHeightSync":false,"fontSize":12,"textAlign":"center","textContentVerticalAlign":"middle","qrCodeLevel":0,"qid":"cm1_6","right":327,"bottom":290,"vCenter":312,"hCenter":280},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":475,"top":275,"height":20,"width":25,"title":"14","coordinateSync":false,"widthHeightSync":false,"fontSize":12,"textAlign":"center","textContentVerticalAlign":"middle","qrCodeLevel":0,"qid":"cm1_4","right":193.5,"bottom":44.75,"vCenter":178.5,"hCenter":34.75},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":450,"top":275,"height":20,"width":25,"title":"12","coordinateSync":false,"widthHeightSync":false,"fontSize":12,"textAlign":"center","textContentVerticalAlign":"middle","qrCodeLevel":0,"qid":"cm1_1","right":437.25,"bottom":287.75,"vCenter":422.25,"hCenter":277.75},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":500,"top":275,"height":20,"width":25,"title":"16","coordinateSync":false,"widthHeightSync":false,"fontSize":12,"textAlign":"center","textContentVerticalAlign":"middle","qrCodeLevel":0,"qid":"cm1_5","right":493.5,"bottom":191,"vCenter":478.5,"hCenter":181},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":350,"top":275,"height":20,"width":25,"title":"4","coordinateSync":false,"widthHeightSync":false,"fontSize":12,"textAlign":"center","textContentVerticalAlign":"middle","qrCodeLevel":0},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":525,"top":275,"height":20,"width":25,"title":"18","coordinateSync":false,"widthHeightSync":false,"fontSize":12,"textAlign":"center","textContentVerticalAlign":"middle","qrCodeLevel":0,"qid":"cm1_7","right":552,"bottom":294.5,"vCenter":537,"hCenter":284.5},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":12,"top":275.5,"height":9,"width":340,"transform":186,"borderWidth":"0.75","coordinateSync":false,"widthHeightSync":false,"right":74.24999631369556,"bottom":273.00002797246907,"vCenter":44.249996313695554,"hCenter":268.50002797246907,"borderColor":"#000000"},"printElementType":{"title":"横线","type":"hline"}},{"options":{"left":46.5,"top":283.5,"height":13,"width":26,"title":"颜色","coordinateSync":false,"widthHeightSync":false,"qrCodeLevel":0,"right":40.5,"bottom":301.2500057220459,"vCenter":27,"hCenter":291.2500057220459,"fontSize":12,"textAlign":"left","textContentVerticalAlign":"middle"},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":12,"top":301.5,"height":9,"width":568,"borderWidth":"0.75","coordinateSync":false,"widthHeightSync":false,"right":584.25,"bottom":306.0000057220459,"vCenter":298.5,"hCenter":301.5000057220459},"printElementType":{"title":"横线","type":"hline"}},{"options":{"left":12,"top":301.5,"height":57,"width":568.5,"field":"table","groupFieldsFormatter":"function(type,options,data){ return [\"name\"] }","qid":"table","coordinateSync":false,"widthHeightSync":false,"tableFooterRepeat":"no","tableHeaderRepeat":"none","maxRows":2,"tableBodyRowHeight":36,"right":583.5,"bottom":360.75,"vCenter":299.25,"hCenter":332.25,"columns":[[
  77. {"width":88.46074598983488,"title":" 颜色","field":"ys","checked":true,"columnId":"ys","fixed":false,"rowspan":1,"colspan":1},
  78. {"width":87.28599085617263,"title":"订单子编号","field":"ddzbh","checked":true,"columnId":"ddzbh","fixed":false,"rowspan":1,"colspan":1},
  79. { "width": 156.58838324924145, "title": "条码", "field": "barcode", "checked": true, "columnId": "barcode", "fixed": false, "rowspan": 1, "colspan": 1, "tableTextType": "barcode", "barcodeType": "code128", "barcodeWidth": 2, "barcodeHeight": 100, "text": true, "textPosition": "bottom", "textAlign": "center", "fontSize": 12 },
  80. {"width":25.024758343082915,"title":"数量1","field":"sl1","checked":true,"columnId":"sl1","fixed":false,"rowspan":1,"colspan":1},{"width":25.034512395182652,"title":"数量2","field":"sl2","checked":true,"columnId":"sl2","fixed":false,"rowspan":1,"colspan":1},{"width":25.02219252634024,"title":"数量3","field":"sl3","checked":true,"columnId":"sl3","fixed":false,"rowspan":1,"colspan":1},{"width":25.021941008649204,"title":"数量4","field":"sl4","checked":true,"columnId":"sl4","fixed":false,"rowspan":1,"colspan":1},{"width":25.03354998562632,"title":"数量5","field":"sl5","checked":true,"columnId":"sl5","fixed":false,"rowspan":1,"colspan":1},{"width":27.025335866262424,"title":"数量6","field":"sl6","checked":true,"columnId":"sl6","fixed":false,"rowspan":1,"colspan":1},{"width":23.024360602094333,"title":"数量7","field":"sl7","checked":true,"columnId":"sl7","fixed":false,"rowspan":1,"colspan":1},{"width":26.021330551877316,"title":"数量8","field":"sl8","checked":true,"columnId":"sl8","fixed":false,"rowspan":1,"colspan":1},{"width":29.089528765741086,"title":"合计","field":"hj","checked":true,"columnId":"hj","fixed":false,"rowspan":1,"colspan":1}]]},"printElementType":{"title":"表格","type":"table","editable":true,"columnDisplayEditable":true,"columnDisplayIndexEditable":true,"columnTitleEditable":true,"columnResizable":true,"columnAlignEditable":true,"isEnableEditField":true,"isEnableContextMenu":true,"isEnableInsertRow":true,"isEnableDeleteRow":true,"isEnableInsertColumn":true,"isEnableDeleteColumn":true,"isEnableMergeCell":true}},{"options":{"left":12,"top":351,"height":364,"width":12,"coordinateSync":false,"widthHeightSync":false,"right":24.75,"bottom":695.99609375,"vCenter":20.25,"hCenter":520.99609375},"printElementType":{"title":"竖线","type":"vline"}},{"options":{"left":580,"top":357,"height":358,"width":9,"coordinateSync":false,"widthHeightSync":false,"right":588.75,"bottom":711,"vCenter":584.25,"hCenter":529.5},"printElementType":{"title":"竖线","type":"vline"}},{"options":{"left":18,"top":376.5,"height":20,"width":40,"right":102.25,"bottom":394.25,"vCenter":82.25,"hCenter":384.25,"field":"yq","coordinateSync":false,"widthHeightSync":false,"fontSize":12,"textAlign":"left","textContentVerticalAlign":"middle","qrCodeLevel":0,"hideTitle":true},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":12,"top":402,"height":9,"width":569,"borderWidth":"0.75","coordinateSync":false,"widthHeightSync":false,"right":579.25,"bottom":396.75,"vCenter":293.75,"hCenter":392.25},"printElementType":{"title":"横线","type":"hline"}},{"options":{"left":18,"top":409.5,"height":20,"width":40,"right":103.75,"bottom":425.75,"vCenter":83.75,"hCenter":415.75,"field":"gx","coordinateSync":false,"widthHeightSync":false,"fontSize":12,"textAlign":"left","textContentVerticalAlign":"middle","qrCodeLevel":0,"qid":"yq_1","hideTitle":true},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":12,"top":435.5,"height":9,"width":569,"borderWidth":"0.75","right":584.5,"bottom":469.5,"vCenter":299,"hCenter":465,"coordinateSync":false,"widthHeightSync":false},"printElementType":{"title":"横线","type":"hline"}},{"options":{"left":67.5,"top":436.5,"height":43,"width":9,"right":76.5,"bottom":459.75,"vCenter":72,"hCenter":444.75,"coordinateSync":false,"widthHeightSync":false},"printElementType":{"title":"竖线","type":"vline"}},{"options":{"left":540,"top":436.5,"height":43,"width":9,"right":549,"bottom":474.25,"vCenter":544.5,"hCenter":452.75,"coordinateSync":false,"widthHeightSync":false},"printElementType":{"title":"竖线","type":"vline"}},{"options":{"left":76.5,"top":442.5,"height":30,"width":166.5,"coordinateSync":false,"widthHeightSync":false,"fontSize":12,"fontWeight":"bold","textAlign":"left","textContentVerticalAlign":"middle","qrCodeLevel":0,"right":199.5,"bottom":468.75,"vCenter":139.5,"hCenter":453.75,"field":"cy","hideTitle":true},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":541.5,"top":444,"height":28,"width":37.5,"field":"cys","coordinateSync":false,"widthHeightSync":false,"fontSize":12,"textAlign":"center","textContentVerticalAlign":"middle","qrCodeLevel":0,"right":582,"bottom":467.5,"vCenter":563.25,"hCenter":453.5,"qid":"zhj_1","hideTitle":true},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":21,"top":448.5,"height":20,"width":40,"title":"船样","coordinateSync":false,"widthHeightSync":false,"fontSize":12,"textAlign":"center","textContentVerticalAlign":"middle","qrCodeLevel":0,"right":58.75,"bottom":465.5,"vCenter":38.75,"hCenter":455.5},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":540,"top":477,"height":239,"width":9,"right":549,"bottom":504,"vCenter":544.5,"hCenter":490.5,"coordinateSync":false,"widthHeightSync":false},"printElementType":{"title":"竖线","type":"vline"}},{"options":{"left":12,"top":478.5,"height":9,"width":569,"borderWidth":"0.75","right":588.25,"bottom":489,"vCenter":302.75,"hCenter":484.5,"coordinateSync":false,"widthHeightSync":false},"printElementType":{"title":"横线","type":"hline"}},{"options":{"left":102,"top":480,"height":232.5,"width":325.5,"right":426,"bottom":710.25,"vCenter":263.25,"hCenter":594,"field":"tupian","fit":"","coordinateSync":false,"widthHeightSync":false},"printElementType":{"title":"图片","type":"image"}},{"options":{"left":543,"top":684,"height":20,"width":37.5,"field":"zhj","coordinateSync":false,"widthHeightSync":false,"fontSize":12,"textAlign":"center","textContentVerticalAlign":"middle","qrCodeLevel":0,"right":579.75,"bottom":704,"vCenter":561,"hCenter":694,"qid":"hj_1","hideTitle":true},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":12,"top":715,"height":9,"width":569,"borderWidth":"0.75","right":586,"bottom":723.75,"vCenter":300.5,"hCenter":719.25,"coordinateSync":false,"widthHeightSync":false},"printElementType":{"title":"横线","type":"hline"}},{"options":{"left":424.5,"top":724.5,"height":15,"width":40,"title":"日期:","right":463,"bottom":741,"vCenter":443,"hCenter":733.5,"coordinateSync":false,"widthHeightSync":false,"fontSize":12,"textAlign":"left","textContentVerticalAlign":"middle","qrCodeLevel":0},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":370.5,"top":724.5,"height":15,"width":40,"right":410.5,"bottom":738.75,"vCenter":390.5,"hCenter":731.25,"field":"sh","coordinateSync":false,"widthHeightSync":false,"fontSize":12,"textAlign":"left","textContentVerticalAlign":"middle","qrCodeLevel":0,"hideTitle":true},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":468,"top":724.5,"height":15,"width":100,"right":567.25,"bottom":739.5,"vCenter":517.25,"hCenter":732,"field":"rq","coordinateSync":false,"widthHeightSync":false,"fontSize":12,"textAlign":"left","textContentVerticalAlign":"middle","qrCodeLevel":0,"hideTitle":true},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":330,"top":724.5,"height":15,"width":40,"title":"审核:","right":370,"bottom":739.5,"vCenter":350,"hCenter":732,"coordinateSync":false,"widthHeightSync":false,"fontSize":12,"textAlign":"left","textContentVerticalAlign":"middle","qrCodeLevel":0},"printElementType":{"title":"这是更新后的元素","type":"text"}}],"paperNumberLeft":565.5,"paperNumberTop":819,"paperNumberContinue":true,"watermarkOptions":{"content":"vue-plugin-hiprint","rotate":25,"timestamp":true,"format":"YYYY-MM-DD HH:mm"},"panelLayoutOptions":{}}]}
  81. hiprint.init()
  82. const hiprintTemplate = new hiprint.PrintTemplate({ template: jsondata })
  83. const _gdlx = ref('')
  84. // 工单打印确认按钮
  85. const cp_print_handleConfirm = async () => {
  86. let params = {};
  87. // params.workOrder = form['gdbh'];
  88. //调用打印接口【打印作业通知单】
  89. // const print_PrintJobOrder = await PrintJobOrder(params);
  90. // console.log(print_PrintJobOrder)
  91. // if(print_PrintJobOrder.data === null || print_PrintJobOrder.data === undefined || print_PrintJobOrder.data === ''){
  92. // ElMessage({type: 'error',message: print_PrintJobOrder.msg});
  93. // return false;
  94. // }
  95. const workOrderDetaildata = [
  96. {
  97. '颜色':'红色',
  98. '订单子编号':'2408001-1',
  99. 'name':'2408001-1',
  100. '数量1':'10',
  101. '数量2':'20',
  102. '数量3':'30',
  103. '数量4':'20',
  104. '数量5':'50',
  105. '数量6':'40',
  106. '数量7':'70',
  107. '数量8':'50',
  108. '合计':'290',
  109. },
  110. {
  111. '颜色':'蓝色',
  112. 'name':'2408001-2',
  113. '订单子编号':'2408001-2',
  114. '数量1':'50',
  115. '数量2':'45',
  116. '数量3':'65',
  117. '数量4':'25',
  118. '数量5':'55',
  119. '数量6':'10',
  120. '数量7':'20',
  121. '数量8':'30',
  122. '合计':'300',
  123. },
  124. ];
  125. // 获取当前日期
  126. const today = new Date();
  127. const year = today.getFullYear();
  128. const month = String(today.getMonth() + 1).padStart(2, '0'); // 月份从 0 开始,需要补零
  129. const day = String(today.getDate()).padStart(2, '0');
  130. const hours = String(today.getHours()).padStart(2, '0');
  131. const minutes = String(today.getMinutes()).padStart(2, '0');
  132. const seconds = String(today.getSeconds()).padStart(2, '0');
  133. const currentDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  134. const currentDates = `${year}-${month}-${day}`;
  135. const printdata = {
  136. 'ewm':form['gdbh'],
  137. "ddh":form['gdbh'],
  138. "sckh":'2401-1622款',
  139. "kh":'DC-7',
  140. "lhrq":'2024-07-16',
  141. "ks":'连衣裙',
  142. "bz": 'MA开头的挂装出货,其它折装。MA01单可增加2%,其它全部不可多不可少。',
  143. "ml": '弹力涤布里布:假捻丝缎面',
  144. 'table': workOrderDetaildata.map(item => ({
  145. 'ys': item['颜色'],
  146. 'ddzbh': item['订单子编号'],
  147. 'barcode': item['name'],
  148. 'sl1': item['数量1'],
  149. 'sl2': item['数量2'],
  150. 'sl3': item['数量3'],
  151. 'sl4': item['数量4'],
  152. 'sl5': item['数量5'],
  153. 'sl6': item['数量6'],
  154. 'sl7': item['数量7'],
  155. 'sl8': item['数量8'],
  156. 'hj': item['合计'],
  157. })),
  158. "yq":'',
  159. "gx":'',
  160. "cy":'8码/3件,10码1件',
  161. "cys":'4',
  162. "tupian": "http://xq.lhra.top/assets/img/yifu.png",
  163. "zhj":'594',
  164. "shr":'',
  165. "rq":currentDates,
  166. }
  167. console.log(printdata)
  168. hiprintTemplate.print(printdata);
  169. // hiprintTemplate.print(printdata);
  170. // cp_print_gdlist.value = false;
  171. }
  172. defineExpose({ open })
  173. </script>
  174. <style scoped>
  175. :deep(.el-table td .cell) {
  176. line-height: 20px !important;
  177. }
  178. :deep(.el-tabs__header){
  179. margin-bottom: 0;
  180. }
  181. .search{
  182. margin-left: 0px !important;
  183. margin-right: 10px !important;
  184. }
  185. .bt{
  186. margin-left: 2px !important;
  187. padding: 3px !important;
  188. font-size: 12px;
  189. }
  190. .el-tabs__header{
  191. margin: 0px !important;
  192. }
  193. .gva-table-box{
  194. padding: 0px !important;
  195. }
  196. .el-pagination{
  197. margin-top: 0px !important;
  198. }
  199. .mab{
  200. margin-bottom: 5px;
  201. }
  202. </style>