From f26f29d84e0a68831a6af14dab3eec5500496d2e Mon Sep 17 00:00:00 2001 From: spring <2396852758@qq.com> Date: 星期三, 28 五月 2025 16:48:52 +0800 Subject: [PATCH] 初始化项目 --- pages/daily/tag-list/index.vue | 876 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 876 insertions(+), 0 deletions(-) diff --git a/pages/daily/tag-list/index.vue b/pages/daily/tag-list/index.vue new file mode 100644 index 0000000..cdbbb34 --- /dev/null +++ b/pages/daily/tag-list/index.vue @@ -0,0 +1,876 @@ +<template> + <view class="tag-list"> + <u-navbar title="鏍囩鍒楄〃" :border-bottom="false" + :background="background" + :title-size="40" + :title-bold="true" title-color="#FFFFFF" + back-icon-color="#fff"> + <view class="navbar-right" slot="right" @click="goTagListAdd" v-if="this.info.workCenter === 'ZZ-03' || this.info.workCenter === 'WK-01' && '鎵撳寘'.includes(this.info.operationName)"> + 鐢熸垚鏍囩 + </view> + </u-navbar> +<!-- <view class="search">--> +<!-- <u-search placeholder="璇疯緭鍏ユ爣绛剧紪鐮佹悳绱�" v-model="keyword" bgColor="#fff" placeholderColor="#999999"--> +<!-- :showAction="false" style="margin: 35rpx;" searchIconColor="#6A6A6A" height="74"--> +<!-- @search="search"></u-search>--> +<!-- </view>--> + <scroll-view class="list" scroll-y="true" :scroll-top="20"> + <view v-for="(item,index) in list" :key="'item'+index" class="list-item" @click="choose(item,index)" + :class="{active:current==index && item.state!==1,print:item.state==1 }"><span> + {{ item.labelNo }} + </span> + <span v-if="item.state==1">宸叉墦鍗�</span> + <u-icon class="icon_choose" size="20rpx" v-if="current==index && item.state!==1"/> + </view> + <u-loading mode="circle" :show="loadingList" class="loading"></u-loading> + <p v-if="list.length===0" style="text-align: center;margin-top: 100rpx;color: rgb(96, 98, 102);font-size: 28rpx;">鏆傛棤鏁版嵁</p> + </scroll-view> + <view class="bottom"> + <u-button type="primary" style="margin: 30rpx;" :loading="loading" @click="weighPrintHandle" class="u-button">鏍囩鎵撳嵃</u-button> + </view> + + <view v-if="maskShow" class="uni-mask" @touchmove.stop.prevent="moveHandle" @click="maskclose"> + <scroll-view class="uni-scroll_box" scroll-y @touchmove.stop.prevent="moveHandle" @click.stop="moveHandle"> + <view + class="uni-list-box" + v-for="(item, index) in listDevice" + :key="index" + @click="tapQuery(item)" + > + <view> + <view class="uni-list_name">鍚嶇О锛歿{ item.name }}</view> + <view class="uni-list_item">UUID:{{ item.address }}</view> + </view> + </view> + </scroll-view> + <u-toast ref="uToast" /> + </view> + <uni-fab :pattern="pattern" horizontal="right" vertical="bottom" :popMenu="false" @fabClick="searchDevice" :doc="doc"> + </uni-fab> + </view> +</template> + +<script> + import UIcon from "../../../uview-ui/components/u-icon/u-icon.vue"; + + const jcapi = uni.requireNativePlugin("JCSDK-JCApiModule"); + // 浜岀淮鐮佺被鍨� + const QrCodeType = { + QrCode: 31, + PDF417: 32, + DataMatrix: 33, + AZTEC: 34 + } + // 绾挎潯绫诲瀷 + const LineType = { + Solid: 1, // 瀹炵嚎 + Dotted: 2, // 铏氱嚎锛堥粯璁よ櫄瀹�1:1鐩搁棿锛� + } + // 鎹㈣鏂瑰紡 + const LineModeType = { + Justified: 1, // 瀹介珮鍥哄畾锛屽唴瀹硅嚜閫傚簲锛堝瓧鍙�/瀛楅棿璺�/琛岄棿璺濇寜姣斾緥缂╂斁锛� + AutoHeight: 2, // 瀹藉害鍥哄畾锛岄珮搴﹁嚜閫傚簲 + Fixed: 4, // 瀹介珮鍥哄畾锛岃秴鍑洪儴鍒嗚鍓� + Adapt: 6, // 瀹介珮鍥哄畾锛屽唴瀹硅秴杩囨椂棰勮瀹介珮鑷姩缂╁皬 + } + export default { + components: {UIcon}, + onLoad(options) { + this.info = JSON.parse(decodeURIComponent(options.info)) + this.loadList(); + + let _this = this; + // 鍒濆鍖朣DK + jcapi.initSDK() + // 鐩戝惉椤电爜鍥炶皟 + jcapi.didReadPrintCountInfo(function(r) { + console.log(r) + }) + + // 鐩戝惉閿欒鍥炶皟 + jcapi.didReadPrintErrorInfo(function(r) { + console.log(r) + if(r.code == 23) { + uni.showToast({ + icon: 'none', + title: '璇烽噸鏂拌繛鎺ユ墦鍗版満锛�', + duration: 2 * 1000 + }) + // 鎵撳嵃鏈烘柇寮�杩炴帴 + _this.connectedDevice = null + } + }) + }, + onShow () { + this.loadList(); + }, + data() { + return { + background: { + backgroundColor: '#214DED', + }, + keyword: '', + list: [{ + name: '123' + }], + current: 0, + currentItem: {}, + loadingList: false, + loading: false, + //钃濈墮鐩稿叧 + doc:"钃濈墮", + pattern: { + color: '#7A7E83', + backgroundColor: '#fff', + selectedColor: '#007AFF', + buttonColor: '#007AFF', + iconColor: '#fff' + }, + maskShow: false, + listDevice:[],//钃濈墮璁惧鏁版嵁 + printDensity: 5, + labelType: 1, + printMode: 2,//printModeData: [{name : '鐑晱', value: 1}, {name: '鐑浆鍗�', value: 2}], + info: {} + } + }, + methods: { + moveHandle() { + + }, + maskclose() { + + }, + // 鍒ゆ柇宸ュ崟鏄惁绛変簬 + isShowWorkCenter(workCenter) { + if(workCenter.includes(this.info.workCenter)) { + return true + } else { + return false + } + }, + isOperationName(workCenter, operationName) { + // 鍒ゆ柇鏄惁涓鸿宸ヤ綔绔� + if(workCenter.includes(this.info.workCenter)) { + // 鍒ゆ柇鏄惁鍖呭惈宸ュ簭鍚嶇О + if(operationName.includes(this.info.operationName)) { + return true + } else { + return false + } + } else { + return false + } + }, + isNotOperationName(workCenter, operationName) { + // 鍒ゆ柇鏄惁涓鸿宸ヤ綔绔� + if(workCenter.includes(this.info.workCenter)) { + // 鍒ゆ柇鏄惁鍖呭惈宸ュ簭鍚嶇О + if(!operationName.includes(this.info.operationName)) { + return true + } else { + return false + } + } else { + return false + } + }, + // 鍦ㄦ鍔犺浇鍒楄〃 + loadList() { + this.loadingList = true; + let url = '' + // 鏍规嵁涓嶅悓杞﹂棿璋冨彇鎺ュ彛 + if (this.info.workCenter === 'ZZ-03') { // 鎴愬杞﹂棿(绠卞彉) + url = 'listReportChengtao' + } else if ((this.info.workCenter === 'ZZ-01' && !'缁勮'.includes(this.info.operationName)) || (this.info.workCenter === 'ZZ-02' && !'浜岃,娉ㄦ补'.includes(this.info.operationName))) { + url = 'listReportOther' + } else if (this.info.workCenter === 'TX-02' && '鍙犺'.includes(this.info.operationName)) { + url = 'listReportDieZhuang' + } else if (this.info.workCenter === 'TX-01' && '绾靛壀'.includes(this.info.operationName)) { + url = 'listReportZongjian' + } else if (this.info.workCenter === 'WK-01' && '鎵撳寘'.includes(this.info.operationName)) { + url = 'listReportWaike' + } + this.getlistReport(url) + this.loadingList = false + }, + getlistReport (url) { + this.$u.api.dailyPaper[url]({id: this.info.id}).then(res => { + if (res.code === 0 && res.data.length > 0) { + this.list = res.data + this.choose(this.list[0], 0) + } + }); + }, + // 鎼滅储 + search(e) {}, + choose(item, index) { + this.current = index; + this.currentItem = item + }, + submit() { + this.loading = true; + }, + goTagListAdd(e) { + uni.navigateTo({ + url: '/pages/daily/tag-list/add?info='+ encodeURIComponent(JSON.stringify(this.info)) + }) + }, + //鎵撳嵃鐩稿叧 + searchDevice(){ + let _this = this + uni.openBluetoothAdapter({ // 纭钃濈墮鏄惁鎵撳紑 + success(r) { + uni.showLoading({ + title: "鎼滅储涓�..." + }) + // 鏈巿浜堣摑鐗欑浉鍏虫潈闄愬拰鏈墦寮�鎵嬫満瀹氫綅浼氭悳绱笉鍒拌澶� + jcapi.getBluetoothDevices(function(r){ + // 鎼滅储鍒拌澶囧洖璋� + uni.hideLoading() + _this.listDevice = r; + _this.maskShow = true + }) + }, + fail(e) { + uni.showModal({ + confirmText: "鎵撳紑钃濈墮澶辫触" + }) + } + }) + }, + tapQuery(item) { + this.maskShow = false + // 杩炴帴鎵撳嵃鏈� + let _this = this; + console.log(item) + jcapi.openPrinterByDevice({ + address: item.address, + name: item.name, + deviceType: item.deviceType // 璁惧绫诲瀷锛�0-钃濈墮锛�1-缃戠粶 + }, function(r) { + uni.showToast({ + title: (r.code == 0) ? "杩炴帴鎴愬姛" : "杩炴帴澶辫触", + duration: 2 * 1000 + }) + if(r.code == 0) { + _this.connectedDevice = item + } + }) + }, + weighPrintHandle() { + let _this = this + if (this.currentItem.state == 1) { + this.$u.toast('璇烽�夋嫨闇�瑕佹墦鍗扮殑鏍囩') + } else { + const params = { + operationTaskId: this.info.id + '', + workstationId: this.info.workstationId, + labelNo: this.currentItem.labelNo + } + // 澶栧3杞﹂棿-鏈�鍚庝竴閬撳伐搴� + if(this.isShowWorkCenter('WK-01') && this.info.operationId === this.info.lastOperationId) { + params.type = 'WAIKE_PRODUCT_REPORT' + this.$u.api.dailyPaper.labelInfo(params).then(res => { + let print = res.data + if(print) { + this.WKLastOperation(print.ParamList[0]) + } else { + this.$refs.uToast.show({ + title: '鏈煡璇㈠埌璇ユ爣绛句俊鎭紒', + type: 'warning ' + }) + } + _this.printQrCode() + }) + } + // 閾佽姱杞﹂棿-绾靛壀 + if(this.isOperationName('TX-01', '绾靛壀')) { + params.type = 'ZONGJIAN_PRODUCT_REPORT' + this.$u.api.dailyPaper.labelInfo(params).then(res => { + let print = res.data + if(print) { + this.TXOperationName(print.ParamList[0], this.currentItem) + } else { + this.$refs.uToast.show({ + title: '鏈煡璇㈠埌璇ユ爣绛句俊鎭紒', + type: 'warning ' + }) + } + _this.printQrCode() + }) + } + // 閾佽姱杞﹂棿-鍙犺 + if(this.isOperationName('TX-02', '鍙犺')) { + params.type = "DIEZHUANG_PRODUCT_REPORT" + console.log(`output->params`,params) + this.$u.api.dailyPaper.labelInfo(params).then(res => { + let print = res.data + if(print) { + this.TXClosedAssembly(print.ParamList[0]) + } else { + this.$refs.uToast.show({ + title: '鏈煡璇㈠埌璇ユ爣绛句俊鎭紒', + type: 'warning ' + }) + } + _this.printQrCode() + }) + } + // 绠卞彉杞﹂棿(鎴愬杞﹂棿) 闇�瑕佸尯鍒嗙浣撹繕鏄煖浣� + if(this.isShowWorkCenter('ZZ-03')) { + params.type = "CHENGTAO_PRODUCT_REPORT" + this.$u.api.dailyPaper.labelInfo(params).then(res => { + let print = res.data + if(print) { + if(this.currentItem.labelType === 'XT' || this.currentItem.labelType === '绠变綋') { + this.XTZZPrintQrCode(print.ParamList[0]) + } else { // 鍚﹀垯涓烘煖浣� + this.GYZZPrintQrCode(print.ParamList[0]) + } + _this.printQrCode() + } else { + this.$refs.uToast.show({ + title: '鏈煡璇㈠埌璇ユ爣绛句俊鎭紒', + type: 'warning ' + }) + } + }) + } + // 濂楄杞﹂棿 + if(this.isNotOperationName('ZZ-01,ZZ-02', '缁勮,浜岃,娉ㄦ补')) { + this.$u.api.dailyPaper.taozhuangLabelInfo(params).then(res => { + let print = res.data + if(print) { + this.suitWorkshop(print.ParamList[0], this.currentItem) + _this.printQrCode() + } else { + this.$refs.uToast.show({ + title: '鏈煡璇㈠埌璇ユ爣绛句俊鎭紒', + type: 'warning ' + }) + } + }) + } + } + }, + // 缁樺埗妯嚎 瀹炵嚎 + getDrawLabelLine(x, y, width, height, rotate, lineType) { + jcapi.drawLabelLine({ + x: x, + y: y, + width: width, + height: height, + rotate: rotate, + lineType: lineType + }); + }, + // 濉啿鏂囧瓧鏍囬 + getDrawLabelText(x, y, width, height, value, fontSize, rotate, lineMode, lineSpace, letterSpace, textAlignHorizontal, textAlignVertical) { + jcapi.drawLabelText({ + x: x, + y: y, + width: width, + height: height, + value: value, + fontSize: fontSize, + rotate: rotate, + lineMode: lineMode, + lineSpace: lineSpace, + letterSpace: letterSpace, + textAlignHorizontal: textAlignHorizontal, + textAlignVertical: textAlignVertical + }) + }, + // 澶栧3杞﹂棿-鏈�鍚庝竴閬撳伐搴� + WKLastOperation(printData) { + // 鍙朓D + let json = JSON.parse(printData.body) + // // 缁樺埗浜岀淮鐮� + // var jsonString = JSON.stringify(json.ID); + jcapi.drawLabelQrCode({ + x: 14.5, + y: 68, + width: 20, + height: 20, + value: json, + rotate: 0, + codeType: QrCodeType.QrCode, + }); + // 缁樺埗妯嚎 瀹炵嚎8鏉� + let sum = 4; + for(let i = 1; i < 8; i++) { + this.getDrawLabelLine(4, sum, 46, 0.5, 0, LineType.Solid) // 瀹炵嚎 + sum = (i * 10) + 4 + } + // 浜岀淮鐮佸ぇ妗� + this.getDrawLabelLine(4, 92, 46, 0.5, 0, LineType.Solid) // 瀹炵嚎9 + + //缁樺埗绔栫嚎 + this.getDrawLabelLine(4, 4, 0.5, 88.5, 0, LineType.Solid) // 绔栫嚎1 + this.getDrawLabelLine(20, 4, 0.5, 60.5, 0, LineType.Solid) // 绔栫嚎2 + this.getDrawLabelLine(44.5, 4, 0.5, 88.5, 0, LineType.Solid) // 绔栫嚎3 + + // 濉啿鏂囧瓧鏍囬 + this.getDrawLabelText(5, 8, 20, 20, '缂� 鍙�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 18, 20, 20, '闀垮楂�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 28, 20, 20, '宸ュ崟鍙�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 38, 20, 20, '鍥� 鍙�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 48, 20, 20, '瑙勬牸鍨嬪彿:', 3.4, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 58, 20, 20, '鐢熶骇鏃ユ湡:', 3.4, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + + let labelNo = JSON.stringify(printData.labelNo).replace(/"/g, "") + let operationTaskNo = JSON.stringify(printData.operationTaskNo).replace(/"/g, "") + let lwh = JSON.stringify(printData.lwh ? printData.lwh : '').replace(/"/g, "") + let specificationModel = JSON.stringify(printData.specificationModel ? printData.specificationModel : '').replace(/"/g, "") + let drawNo = JSON.stringify(printData.drawNo ? printData.drawNo : '').replace(/"/g, "") + let createTime = JSON.stringify(printData.createTime).replace(/"/g, "") + + // 濉啿鍙傛暟鍊� + this.getDrawLabelText(22, 8, 35, 12, labelNo, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 18, 35, 12, lwh, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 28, 35, 12, operationTaskNo, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 38, 35, 12, drawNo, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 48, 35, 12, specificationModel, 3, 1, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 58, 35, 12, createTime, 2, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + }, + // 閾佽姱杞﹂棿-绾靛壀 + TXOperationName(printData, currentItem) { + // 缁樺埗浜岀淮鐮� + let json = JSON.parse(printData.body) + // 鍙朓D + // var jsonString = JSON.stringify(json.ID); + jcapi.drawLabelQrCode({ + x: 14.5, + y: 74, + width: 20, + height: 20, + value: json, + rotate: 0, + codeType: QrCodeType.QrCode, + }); + // 缁樺埗妯嚎 瀹炵嚎8鏉� + let sum = 4; + for(let i = 1; i < 13; i++) { + this.getDrawLabelLine(4, sum, 46, 0.5, 0, LineType.Solid) // 瀹炵嚎 + sum = (i * 6) + 4 + } + // 浜岀淮鐮佸ぇ妗� + this.getDrawLabelLine(4, 97, 46, 0.5, 0, LineType.Solid) // 瀹炵嚎9 + + //缁樺埗绔栫嚎 + this.getDrawLabelLine(4, 4, 0.5, 97, 0, LineType.Solid) // 绔栫嚎1 + this.getDrawLabelLine(20, 4, 0.5, 66, 0, LineType.Solid) // 绔栫嚎2 + this.getDrawLabelLine(44.5, 4, 0.5, 97, 0, LineType.Solid) // 绔栫嚎2 + + // 濉啿鏂囧瓧鏍囬 + this.getDrawLabelText(5, 5, 20, 20, '缂� 鍙�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 11, 20, 20, '宸ュ崟鍙�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 17, 20, 20, '鐗� 鍙�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 23, 20, 20, '鐗囧锛坢m锛�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 29, 20, 20, '鍘氬害锛坢m锛�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 35, 20, 20, '閲嶉噺锛圞G锛�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 41, 20, 20, '闀垮害锛坢锛�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 47, 20, 20, '鐢熶骇浜�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 53, 20, 20, '鐢熶骇鏃堕棿:', 3.4, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 59, 20, 20, '鍘傚:', 3.4, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 65, 20, 20, '閾佹崯:', 3.4, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + + let labelNo = JSON.stringify(printData.labelNo).replace(/"/g, "") + let optaskNo = JSON.stringify(printData.optaskNo).replace(/"/g, "") + let sliceWidth = JSON.stringify(printData.sliceWidth ? printData.sliceWidth : '').replace(/"/g, "") + let thickness = JSON.stringify(printData.thickness ? printData.thickness : '').replace(/"/g, "") + let wweight = JSON.stringify(printData.wweight ? printData.wweight : '').replace(/"/g, "") + let llength = JSON.stringify(printData.llength ? printData.llength : '').replace(/"/g, "") + let reportTime = JSON.stringify(currentItem.reportTime).replace(/"/g, "") + let reportName = JSON.stringify(currentItem.reportName).replace(/"/g, "") + let grade = JSON.stringify(printData.grade ? printData.grade : '').replace(/"/g, "") + let ironLoss = JSON.stringify(printData.ironLoss ? printData.ironLoss : '').replace(/"/g, "") + let supplierVenderName = JSON.stringify(printData.supplierVenderName ? printData.supplierVenderName : '').replace(/"/g, "") + + // // 濉啿鍙傛暟鍊� + this.getDrawLabelText(22, 5, 35, 12, labelNo, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 11, 35, 12, optaskNo, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 17, 35, 12, grade, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 23, 35, 12, sliceWidth, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 29, 35, 12, thickness, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 35, 35, 12, wweight, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 41, 35, 12, llength, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 47, 35, 12, reportName, 2, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 53, 35, 12, reportTime, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 59, 35, 12, supplierVenderName, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 65, 35, 12, ironLoss, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + }, + // 閾佽姱杞﹂棿-鍙犺 + TXClosedAssembly(printData) { + // 鍙朓D + let json = JSON.parse(printData.body) + // 缁樺埗浜岀淮鐮� + // var jsonString = JSON.stringify(json.ID); + jcapi.drawLabelQrCode({ + x: 14.5, + y: 68, + width: 20, + height: 20, + value: json, + rotate: 0, + codeType: QrCodeType.QrCode, + }); + // 缁樺埗妯嚎 瀹炵嚎8鏉� + let sum = 4; + for(let i = 1; i < 8; i++) { + this.getDrawLabelLine(4, sum, 46, 0.5, 0, LineType.Solid) // 瀹炵嚎 + sum = (i * 10) + 4 + } + // 浜岀淮鐮佸ぇ妗� + this.getDrawLabelLine(4, 92, 46, 0.5, 0, LineType.Solid) // 瀹炵嚎9 + + //缁樺埗绔栫嚎 + this.getDrawLabelLine(4, 4, 0.5, 88.5, 0, LineType.Solid) // 绔栫嚎1 + this.getDrawLabelLine(20, 4, 0.5, 60.5, 0, LineType.Solid) // 绔栫嚎2 + this.getDrawLabelLine(44.5, 4, 0.5, 88.5, 0, LineType.Solid) // 绔栫嚎2 + + // 濉啿鏂囧瓧鏍囬 + this.getDrawLabelText(5, 8, 20, 20, '缂� 鍙�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 18, 20, 20, '宸ュ崟鍙�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 28, 20, 20, '鍥� 鍙�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 38, 20, 20, '瑙勬牸鍨嬪彿:', 3.4, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 48, 20, 20, '鐢熶骇浜�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 58, 20, 20, '鐢熶骇鏃ユ湡:', 3.4, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + + let labelNo = JSON.stringify(printData.labelNo).replace(/"/g, "") + let operationTaskNo = JSON.stringify(printData.operationTaskNo).replace(/"/g, "") + let drawNo = JSON.stringify(printData.drawNo).replace(/"/g, "") + let specificationModel = JSON.stringify(printData.specificationModel).replace(/"/g, "") + let staffNameJoin = JSON.stringify(this.info.staffNameJoin).replace(/"/g, "") + let createTime = JSON.stringify(printData.createTime ? printData.createTime : '').replace(/"/g, "") + + // 濉啿鍙傛暟鍊� + this.getDrawLabelText(22, 8, 35, 12, labelNo, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 18, 35, 12, operationTaskNo, 2.5, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 28, 35, 12, drawNo, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 38, 35, 12, specificationModel, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 48, 35, 12, staffNameJoin, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 58, 35, 12, createTime, 2, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + }, + // 绠卞彉杞﹂棿(鎴愬杞﹂棿) 楂樺帇 + GYZZPrintQrCode(printData) { + // 缁樺埗浜岀淮鐮� + let json = JSON.parse(printData.body) + // 鍙朓D + // var jsonString = JSON.stringify(json.ID); + jcapi.drawLabelQrCode({ + x: 14.5, + y: 58, + width: 20, + height: 20, + value: json, + rotate: 0, + codeType: QrCodeType.QrCode, + }); + // 缁樺埗妯嚎 瀹炵嚎8鏉� + let sum = 4; + for(let i = 1; i < 7; i++) { + this.getDrawLabelLine(4, sum, 46, 0.5, 0, LineType.Solid) // 瀹炵嚎 + sum = (i * 10) + 4 + } + // 浜岀淮鐮佸ぇ妗� + this.getDrawLabelLine(4, 82, 46, 0.5, 0, LineType.Solid) // 瀹炵嚎9 + + //缁樺埗绔栫嚎 + this.getDrawLabelLine(4, 4, 0.5, 78.5, 0, LineType.Solid) // 绔栫嚎1 + this.getDrawLabelLine(20, 4, 0.5, 50.5, 0, LineType.Solid) // 绔栫嚎2 + this.getDrawLabelLine(44.5, 4, 0.5, 78.5, 0, LineType.Solid) // 绔栫嚎2 + + // 濉啿鏂囧瓧鏍囬 + this.getDrawLabelText(5, 8, 20, 22, '缂� 鍙�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 18, 20, 22, '宸ュ崟鍙�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 28, 20, 20, '绫� 鍨�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 38, 20, 20, '瑙勬牸鍨嬪彿:', 3.4, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 48, 20, 20, '鐢熶骇鏃ユ湡:', 3.4, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + + let labelNo = JSON.stringify(printData.labelNo).replace(/"/g, "") + let operationTaskNo = JSON.stringify(printData.operationTaskNo ? printData.operationTaskNo : '').replace(/"/g, "") + let specificationModel = JSON.stringify(printData.specificationModel ? printData.specificationModel : '').replace(/"/g, "") + let type = JSON.stringify(printData.type ? printData.type : '').replace(/"/g, "") + let reportTime = JSON.stringify(printData.reportTime).replace(/"/g, "") + // 濉啿鍙傛暟鍊� + this.getDrawLabelText(22, 8, 35, 12, labelNo, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 18, 35, 12, operationTaskNo, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 28, 35, 12, type, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 38, 35, 12, specificationModel, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 48, 35, 12, reportTime, 2, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + }, + // 绠卞彉杞﹂棿(鎴愬杞﹂棿) 绠变綋 + XTZZPrintQrCode(printData) { + // 缁樺埗浜岀淮鐮� + let json = JSON.parse(printData.body) + // 鍙朓D + // var jsonString = JSON.stringify(json.ID); + jcapi.drawLabelQrCode({ + x: 14.5, + y: 65, + width: 20, + height: 20, + value: json, + rotate: 0, + codeType: QrCodeType.QrCode, + }); + // 缁樺埗妯嚎 瀹炵嚎8鏉� + let sum = 4; + for(let i = 1; i < 9; i++) { + this.getDrawLabelLine(4, sum, 46, 0.5, 0, LineType.Solid) // 瀹炵嚎 + sum = (i * 8) + 4 + } + // 浜岀淮鐮佸ぇ妗� + this.getDrawLabelLine(4, 90.5, 46, 0.5, 0, LineType.Solid) // 瀹炵嚎9 + + //缁樺埗绔栫嚎 + this.getDrawLabelLine(4, 4, 0.5, 86.5, 0, LineType.Solid) // 绔栫嚎1 + this.getDrawLabelLine(20, 4, 0.5, 56, 0, LineType.Solid) // 绔栫嚎2 + this.getDrawLabelLine(44.5, 4, 0.5, 86.5, 0, LineType.Solid) // 绔栫嚎2 + + // 濉啿鏂囧瓧鏍囬 + this.getDrawLabelText(5, 6, 20, 20, '缂� 鍙�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 14, 20, 20, '宸ュ崟鍙�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 22, 20, 20, '瑙勬牸鍨嬪彿:', 3.4, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 30, 20, 20, '楂樺帇鏌滀綋:', 3.4, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 38, 20, 20, '浣庡帇鏌滀綋:', 3.4, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 46, 20, 20, '鏈綋:', 3.4, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 54, 20, 20, '鐢熶骇鏃ユ湡:', 3.4, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + + let labelNo = JSON.stringify(printData.labelNo).replace(/"/g, "") + let operationTaskNo = JSON.stringify(printData.operationTaskNo).replace(/"/g, "") + let specificationModel = JSON.stringify(printData.specificationModel ? printData.specificationModel : '').replace(/"/g, "") + let gy = JSON.stringify(printData.gy ? printData.gy : '').replace(/"/g, "") + let dy = JSON.stringify(printData.dy ? printData.dy : '').replace(/"/g, "") + let bt = JSON.stringify(printData.bt ? printData.bt : '').replace(/"/g, "") + let reportTime = JSON.stringify(printData.reportTime).replace(/"/g, "") + // // 濉啿鍙傛暟鍊� + this.getDrawLabelText(22, 6, 35, 12, labelNo, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 14, 35, 12, operationTaskNo, 2.5, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 22, 35, 12, specificationModel, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 30, 35, 12, gy, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 38, 35, 12, dy, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 46, 35, 12, bt, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 54, 35, 12, reportTime, 2, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + }, + // 濂楄杞﹂棿 + suitWorkshop(printData, currentItem) { + // 缁樺埗浜岀淮鐮� + let json = JSON.parse(printData.body) + // 鍙朓D + // var jsonString = JSON.stringify(json.ID); + jcapi.drawLabelQrCode({ + x: 17, + y: 50, + width: 20, + height: 20, + value: json, + rotate: 0, + codeType: QrCodeType.QrCode, + }); + // 缁樺埗妯嚎 瀹炵嚎8鏉� + let sum = 4; + for(let i = 1; i < 6; i++) { + this.getDrawLabelLine(4, sum, 46, 0.5, 0, LineType.Solid) // 瀹炵嚎 + sum = (i * 10) + 4 + } + // 浜岀淮鐮佸ぇ妗� + this.getDrawLabelLine(4, 72, 46, 0.5, 0, LineType.Solid) // 瀹炵嚎9 + + //缁樺埗绔栫嚎 + this.getDrawLabelLine(4, 4, 0.5, 68.5, 0, LineType.Solid) // 绔栫嚎1 + this.getDrawLabelLine(20, 4, 0.5, 40.5, 0, LineType.Solid) // 绔栫嚎2 + this.getDrawLabelLine(44.5, 4, 0.5, 68.5, 0, LineType.Solid) // 绔栫嚎2 + + // 濉啿鏂囧瓧鏍囬 + this.getDrawLabelText(5, 8, 24, 22, '閾佽姱缂栧彿:', 3, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 18, 12, 22, '绾垮湀缂栧彿:', 3, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 28, 24, 20, '鐢熶骇鏃ユ湡:', 3, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 38, 24, 20, '鐢熶骇浜哄憳:', 3, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + + let labelNo = JSON.stringify(printData.labelNo).replace(/"/g, "") + let coilNo = JSON.stringify(printData.coilNo).replace(/"/g, "") + let reportTime = JSON.stringify(currentItem.reportTime).replace(/"/g, "") + let reportName = JSON.stringify(currentItem.reportName).replace(/"/g, "") + + // 濉啿鍙傛暟鍊� + this.getDrawLabelText(22, 8, 40, 12, labelNo, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 18, 40, 12, coilNo, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 28, 40, 12, reportTime, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 38, 40, 12, reportName, 2, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + }, + //鎵撳嵃浜岀淮鐮� + printQrCode() { + // 鍒濆鍖栫敾鏉� + jcapi.initDrawingBoard({ + width: 45, + height: 100, + rotate: 0 + }); + + // 鐢熸垚鎵撳嵃鏁版嵁 + let imageJsonObj = jcapi.generateLabelJson() + // 璁剧疆鎵撳嵃浠诲姟 + jcapi.startJob({ + totalCount: 1, + density: this.printDensity, + labelType: this.labelType, + printMode: this.printMode, + },function(r){ + if(r.code == 0) { + // 鎵撳嵃鏁版嵁 + jcapi.printData(imageJsonObj, { + "printQuantity": 1, + }, function(r) { + if (r.code == 0) { + console.log("鎵撳嵃鎴愬姛") + } else { + console.log("鎵撳嵃澶辫触") + } + }) + } else { + console.log("璁剧疆鎵撳嵃浠诲姟澶辫触") + } + }) + } + } + } +</script> + +<style lang="scss" scoped> +::v-deep .uni-fab__circle{ + position:fixed; + bottom: 140rpx; +} + .tag-list { + width: 100%; + height: 100vh; + background: #E6EFFF; + overflow-y: auto; + box-sizing: border-box; + padding-bottom: 24rpx; + position: relative; + display: flex; + flex-direction: column; + + ::v-deep.navbar-right { + font-weight: 500; + font-size: 28rpx; + color: #FFFFFF; + line-height: 36rpx; + margin-right: 32rpx; + } + //.search { + // //position: fixed; + // width: 100%; + // z-index: 99; + // height: 140rpx; + // background: #E6EFFF; + //} + + .list { + padding: 40rpx 32rpx 120rpx; + width: 100%; + height: 100%; + overflow-y: auto; + box-sizing: border-box; + + .list-item { + background: #FFFFFF; + border-radius: 10rpx; + box-sizing: border-box; + padding: 22rpx 43rpx; + margin-bottom: 20rpx; + font-weight: 500; + font-size: 30rpx; + color: #333333; + display: flex; + align-items: center; + justify-content: space-between; + .icon_choose { + background-image: url('~@/static/custom/daily/icon_choose.png'); + background-repeat: no-repeat; + background-size: cover; + height: 20rpx; + width: 20rpx; + position: relative; + } + + &.print { + background: #F3FFF8; + border: 1px solid #ABE3C4; + color: #0AA04D; + } + + &.active { + background: #F4F9FF; + border: 1px solid #ACBDF8; + color: #214DED; + } + } + + .loading { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + } + } + .bottom { + width: 100vw; + position:fixed; + bottom: 0; + background: #E6EFFF; + .u-button { + width: 690rpx; + height: 80rpx; + background: #214DED; + border-radius: 8rpx; + font-weight: 500; + font-size: 34rpx; + color: #FFFFFF; + z-index: 99; + } + } + + .uni-mask { + position: fixed; + top: 0; + left: 0; + bottom: 0; + display: flex; + align-items: center; + width: 100%; + background: rgba(0, 0, 0, 0.6); + padding: 0 30rpx; + box-sizing: border-box; + } + + + .uni-scroll_box { + height: 70%; + background: #fff; + border-radius: 20rpx; + } + .uni-list-box { + margin: 0 20rpx; + padding: 15rpx 0; + border-bottom: 1px #f5f5f5 solid; + box-sizing: border-box; + } + .uni-list:last-child { + border: none; + } + .uni-list_name { + font-size: 30rpx; + color: #333; + } + .uni-list_item { + font-size: 24rpx; + color: #555; + line-height: 1.5; + } + } +</style> -- Gitblit v1.9.3