ChipPrintScreenCheck.vue 59 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859
  1. <template>
  2. <div>
  3. <Modal v-model="fullscreenModals" fullscreen title="工位屏-补打" @on-cancel='cancel'>
  4. <div slot="header">
  5. <span style="font-size: 0.5rem">工位屏-补打</span>
  6. <div class="fullscreen-title-btn">
  7. <Button
  8. @click="handleWideScreenClick"
  9. size="large"
  10. id="full_screen_btn"
  11. type="primary"
  12. style="margin-right: 1rem"
  13. >
  14. {{ isWideScreen ? "完整模式" : "简单模式" }}
  15. </Button>
  16. <Button
  17. @click="handlePrint"
  18. size="large"
  19. type="primary"
  20. style="margin-right: 1rem"
  21. >
  22. 打 印
  23. </Button>
  24. <Button @click="back" size="large" type="primary">
  25. 返 回
  26. </Button>
  27. </div>
  28. </div>
  29. <div class="fullscreen-content">
  30. <div class="fullscreen-content-select">
  31. <div class="fullscreen-content-select-block">
  32. <Button
  33. @click="handleSelection(ordernoObj, 1)"
  34. size="large"
  35. type="primary"
  36. style="margin-right: 10px"
  37. >
  38. 项目选择
  39. </Button>
  40. <div class="icon-wrapper" v-show="selectedInfo.order_no">
  41. <Icon
  42. class="icon-close"
  43. @click="handleCancelSelected('order_no')"
  44. size="24"
  45. type="md-close"
  46. />
  47. <div>
  48. <span>订单编号:</span>
  49. <span>{{ selectedInfo.order_no }}</span>
  50. </div>
  51. <div>
  52. <span>项目名称:</span>
  53. <span>{{ selectedInfo.residential_name }}</span>
  54. </div>
  55. </div>
  56. </div>
  57. <div class="fullscreen-content-select-block">
  58. <Button
  59. @click="handleSelection(urlObj, 2)"
  60. size="large"
  61. type="primary"
  62. style="margin-right: 10px"
  63. >
  64. 图号选择
  65. </Button>
  66. <div style="display: flex; align-items: center">
  67. <div class="icon-wrapper">
  68. <div v-show="selectedInfo.url_number">
  69. <Icon
  70. class="icon-close"
  71. @click="handleCancelSelected('product_id')"
  72. size="24"
  73. type="md-close"
  74. />
  75. <span>图号:</span>
  76. <span>{{ selectedInfo.url_number }}</span>
  77. </div>
  78. </div>
  79. </div>
  80. </div>
  81. <div class="fullscreen-content-select-block">
  82. <Button
  83. @click="handleSelectionRowno(rownoObj)"
  84. size="large"
  85. type="primary"
  86. style="margin-right: 10px"
  87. >
  88. 行号选择
  89. </Button>
  90. <div
  91. class="icon-wrapper"
  92. v-show="selectedInfo.rows.length != 0"
  93. style="display: flex; align-items: center"
  94. >
  95. <span>行号:</span>
  96. <div style="display: flex; justify-content: flex-start">
  97. <div v-for="(item, index) in selectedInfo.rows" :key="item.key">
  98. <div class="icon-wrapper" style="margin-right: 0.35rem">
  99. <Icon
  100. class="icon-close"
  101. @click="handleCancelSelected(index, 1)"
  102. size="24"
  103. type="md-close"
  104. />
  105. <span style="display: inline-block"
  106. >{{ item.start }}-{{ item.end }}</span
  107. >
  108. </div>
  109. </div>
  110. </div>
  111. </div>
  112. </div>
  113. </div>
  114. <div class="fullscreen-content-choose">
  115. <div
  116. :class="[
  117. choose.isChoosed
  118. ? 'fullscreen-content-choose-block fullscreen-content-choose-block-choosen'
  119. : 'fullscreen-content-choose-block fullscreen-content-choose-block-unchoosen',
  120. isWideScreen ? 'fullscreen-content-choose-block-wide' : '',
  121. ]"
  122. v-for="choose in contentData"
  123. :key="choose.row"
  124. @click="handleChooseBlockClick(choose)"
  125. >
  126. <div :class="[isWideScreen ? 'chip-tag-choosed' : 'chip-tag']">
  127. 芯片
  128. <Icon
  129. size="20px"
  130. :style="
  131. isWideScreen
  132. ? 'font-size: 1rem; transform: translate(0, -50%)'
  133. : 'font-size: 1rem; transform: translate(0, -40%)'
  134. "
  135. style="font-size: 1rem; transform: translate(0, -40%)"
  136. :color="choose.isChoosed ? '#2d8cf0' : 'white'"
  137. type="md-arrow-dropup"
  138. />
  139. </div>
  140. <div v-show="!isWideScreen">
  141. <span>行号</span>
  142. <span>{{ choose.row_no }}</span>
  143. </div>
  144. <div v-show="!isWideScreen">
  145. <span>部件</span>
  146. <span>{{ choose.part_title }}</span>
  147. </div>
  148. <div v-show="!isWideScreen">
  149. <span>材料</span>
  150. <span>{{ choose.sub_part_title }}</span>
  151. </div>
  152. <div v-show="!isWideScreen">
  153. <span>毛料尺寸</span>
  154. <span>{{ choose.wool_size }}</span>
  155. </div>
  156. <div v-show="!isWideScreen">
  157. <span>精裁尺寸</span>
  158. <span>{{ choose.cut_size }}</span>
  159. </div>
  160. <div v-show="isWideScreen" class="wide-screen-rowno">
  161. <span
  162. :class="[
  163. choose.isChoosed
  164. ? 'wide-screen-rowno-span-choosed'
  165. : 'wide-screen-rowno-span',
  166. ]"
  167. >{{ choose.row_no }}</span
  168. >
  169. </div>
  170. <div>
  171. <span>未完成数量</span>
  172. <span>
  173. {{ choose.un_complete }}(总数:{{
  174. choose.on_complete + choose.un_complete
  175. }})
  176. </span>
  177. </div>
  178. <div>
  179. <span>未打印数量</span>
  180. <span
  181. >{{ choose.un_print }}(总数:{{
  182. choose.on_print + choose.un_print
  183. }})</span
  184. >
  185. </div>
  186. </div>
  187. </div>
  188. <div class="fullscreen-content-page">
  189. <Page
  190. @on-change="changePage"
  191. :page-size="page_size"
  192. :current="page_index"
  193. :total="total"
  194. />
  195. </div>
  196. </div>
  197. <div slot="footer"></div>
  198. <Modal
  199. class="selection-modal"
  200. v-model="selectionModal"
  201. :title="currencySelectedObj.title"
  202. width="80%"
  203. >
  204. <van-number-keyboard
  205. :show="show"
  206. @blur="show = false"
  207. @input="onInput"
  208. @delete="onDelete"
  209. z-index="99999"
  210. />
  211. <div class="selection-modal-top">
  212. <Input
  213. :placeholder="currencySelectedObj.title"
  214. v-model="currentSearchValue"
  215. @on-focus="show = true"
  216. @on-change="
  217. handleCurrentSearch(currencySelectedObj, currentSearchValue)
  218. "
  219. style="width: 80%"
  220. >
  221. <Icon
  222. @click="
  223. handleCurrentSearch(currencySelectedObj, currentSearchValue)
  224. "
  225. type="ios-search"
  226. slot="suffix"
  227. />
  228. </Input>
  229. </div>
  230. <div class="selection-modal-body">
  231. <div
  232. :class="[
  233. block.isCurrent
  234. ? 'selection-modal-body-block selection-modal-body-block-choosen'
  235. : 'selection-modal-body-block selection-modal-body-block-unchoosen',
  236. ]"
  237. v-for="(block, index) in currencySelectedObj.list"
  238. :key="index"
  239. @click="handleSelectionClick(currencySelectedObj, block)"
  240. >
  241. <div v-show="currencySelectedObj.type == 1">
  242. <span>订单编号:</span>
  243. <span>{{ block.order_no }}</span>
  244. </div>
  245. <div v-show="currencySelectedObj.type == 2">
  246. <span>{{ block.title }}</span>
  247. </div>
  248. <div v-show="currencySelectedObj.type == 1">
  249. <span>项目名称:</span>
  250. <span>{{ block.residential_name }}</span>
  251. </div>
  252. </div>
  253. <div
  254. style="font-size: 1rem"
  255. v-show="currencySelectedObj.list.length == 0"
  256. >
  257. 暂无数据
  258. </div>
  259. </div>
  260. <div class="fullscreen-content-page">
  261. <Page
  262. @on-change="changeModalPage"
  263. :current="
  264. currencySelectedObj.type == 1
  265. ? modal_1_page_index
  266. : modal_2_page_index
  267. "
  268. :page-size="
  269. currencySelectedObj.type == 1
  270. ? modal_1_page_size
  271. : modal_2_page_size
  272. "
  273. :total="currencySelectedObj.type == 1 ? modal_1_total : modal_2_total"
  274. />
  275. </div>
  276. <div slot="footer">
  277. <Button
  278. @click="selectionModal = false"
  279. type="primary"
  280. style="margin-right: 10px"
  281. >
  282. 返回
  283. </Button>
  284. <!-- <Button
  285. v-show="currencySelectedObj.type == 1"
  286. @click="handleSelectionComfirm(currencySelectedObj)"
  287. type="primary"
  288. >
  289. 确认
  290. </Button> -->
  291. </div>
  292. </Modal>
  293. <Modal
  294. class="selection-modal"
  295. v-model="selectionDetailModal"
  296. :title="currencySelectedObj.title"
  297. width="80%"
  298. >
  299. <div class="selection-modal-body" v-if="currencySelectedObj.hasChild">
  300. <div
  301. :class="[
  302. block.isCurrent
  303. ? 'selection-modal-body-block-detail selection-modal-body-block-detail-choosen'
  304. : 'selection-modal-body-block-detail selection-modal-body-block-detail-unchoosen',
  305. ]"
  306. v-for="(block, index) in chooseDetailUrlNo.children"
  307. :key="index"
  308. @click="handleSelectionDetailClick(chooseDetailUrlNo, block)"
  309. >
  310. <div>
  311. <span>{{ block.url_number }}</span>
  312. </div>
  313. </div>
  314. </div>
  315. <div slot="footer">
  316. <Button
  317. @click="
  318. selectionDetailModal = false;
  319. selectionModal = true;
  320. "
  321. type="primary"
  322. style="margin-right: 10px"
  323. >
  324. 返回
  325. </Button>
  326. <!-- <Button
  327. @click="handleSelectionComfirm(currencySelectedObj)"
  328. type="primary"
  329. >
  330. 确认
  331. </Button> -->
  332. </div>
  333. </Modal>
  334. <Modal
  335. class="selection-rowno-modal"
  336. v-model="selectionRownolModal"
  337. width="80%"
  338. >
  339. <div slot="header"><h1>行号选择</h1></div>
  340. <div class="selection-rowno-modal-body">
  341. <van-number-keyboard
  342. :show="show2"
  343. @blur="show2 = false"
  344. @input="keyboardTap"
  345. @delete="keyboardDele"
  346. z-index="99999"
  347. />
  348. <div
  349. class="selection-rowno-modal-body-block"
  350. v-for="(block, index) in chooseLineNo"
  351. :key="index"
  352. >
  353. <span style="font-size:2em;">行号区间:</span>
  354. <Input
  355. v-model="block.start"
  356. @on-focus="handleRowNoInput(block, 1)"
  357. clearable
  358. style="width: 20%; margin: 0 10px"
  359. size="large"
  360. />
  361. -
  362. <Input
  363. v-model="block.end"
  364. @on-focus="handleRowNoInput(block, 2)"
  365. clearable
  366. style="width: 20%; margin: 0 10px"
  367. size="large"
  368. />
  369. <Button
  370. @click="handleAddRow(block, index)"
  371. type="primary"
  372. size="large"
  373. v-show="index == 0"
  374. style="margin-right: 10px"
  375. >
  376. 添加
  377. </Button>
  378. <Button
  379. @click="handleDeleRow(block, index)"
  380. type="primary"
  381. size="large"
  382. v-show="index != 0"
  383. style="margin-right: 10px"
  384. >
  385. 删除
  386. </Button>
  387. </div>
  388. </div>
  389. <div slot="footer">
  390. <Button
  391. @click="selectionRownolModal = false"
  392. type="primary"
  393. style="margin-right: 10px"
  394. >
  395. 返回
  396. </Button>
  397. <Button @click="handleRowNoComfirm(chooseLineNo)" type="primary">
  398. 确认
  399. </Button>
  400. </div>
  401. </Modal>
  402. <Modal
  403. class="selection-print-modal"
  404. v-model="printModal"
  405. width="60%"
  406. >
  407. <div slot="header" style="text-align:center;font-weight:bold"><h1>打 印</h1></div>
  408. <div class="selection-print-modal-body">
  409. <div class="selection-print-modal-body-top">
  410. <div>
  411. <span>行号:</span>
  412. <span>{{ selectedObj.row_no }}</span>
  413. </div>
  414. <div>
  415. <span>部件名称:</span>
  416. <span>{{ selectedObj.part_title }}</span>
  417. </div>
  418. <div>
  419. <span>数量:</span>
  420. <InputNumber
  421. :max="selectedObj.on_print"
  422. :min="1"
  423. size="large"
  424. @on-focus="handlePrintInput"
  425. v-model="selectedObj.print_num"
  426. ></InputNumber>
  427. <van-number-keyboard
  428. :show="show3"
  429. @blur="show3 = false"
  430. @input="keyboardPrintTap"
  431. @delete="keyboardPrintDele"
  432. z-index="99999"
  433. />
  434. </div>
  435. </div>
  436. <div class="selection-print-modal-body-info">
  437. <!-- {{
  438. selectedObj.isFinished
  439. ? "该部件已打印,是否再次打印?"
  440. : "请确认打印数量是否正确!"
  441. }} -->
  442. {{
  443. "该部件已打印,是否再次打印?"
  444. }}
  445. <div>
  446. <!-- v-show="selectedObj.isFinished" -->
  447. <Button
  448. @click="handleSelectionRoom"
  449. type="primary"
  450. >
  451. 选择房间号
  452. </Button>
  453. </div>
  454. </div>
  455. </div>
  456. <div slot="footer" class="selection-print-modal-body-footer">
  457. <Button
  458. @click="printModal = false"
  459. type="primary"
  460. style="margin-right: 10px"
  461. >
  462. 返回
  463. </Button>
  464. <Button @click="handlePrintComfirm(selectedObj)" type="primary">
  465. 芯片打印
  466. </Button>
  467. <Button @click="Print(selectedObj)" type="primary">
  468. 标签打印
  469. </Button>
  470. </div>
  471. </Modal>
  472. <Modal
  473. class="selection-modal"
  474. v-model="roomModal"
  475. @on-cancel='handleRoomCancel'
  476. title="选择房间号"
  477. width="80%"
  478. >
  479. <div class="selection-modal-body">
  480. <div
  481. :class="[
  482. block.isCurrent
  483. ? 'selection-modal-body-block selection-modal-body-block-choosen'
  484. : 'selection-modal-body-block selection-modal-body-block-unchoosen',
  485. ]"
  486. v-for="(block, index) in modalRoomList"
  487. :key="index"
  488. @click="handleSelectedRoomClick(modalRoomList, block)"
  489. >
  490. <div>
  491. <span>{{ block.house }}</span>
  492. </div>
  493. </div>
  494. </div>
  495. <div class="fullscreen-content-page">
  496. <Page
  497. @on-change="changeRoomPage"
  498. :current="modal_room_page_index"
  499. :page-size="modal_room_page_size"
  500. :total="modal_room_total"
  501. />
  502. </div>
  503. <div slot="footer" style="display:flex;justify-content: space-around;">
  504. <Button
  505. @click="handleRoomCancel"
  506. type="primary"
  507. style="margin-right: 10px;width:20%;height:60px;font-size:29px"
  508. >
  509. 返回
  510. </Button>
  511. <Button @click="handlePrintComfirm(selectedObj, 1)" type="primary"
  512. style="width:20%;height:60px;font-size:29px">
  513. 芯片打印
  514. </Button>
  515. <Button @click="Print(selectedObj, 1)" type="primary" style="width:20%;height:60px;font-size:29px">
  516. 标签打印
  517. </Button>
  518. </div>
  519. </Modal>
  520. </Modal>
  521. <div ref='printRow' class="printRow">
  522. <div v-for="(item,index) in tagPrintList" :key="index" class="printRow_content" style="width:380px">
  523. <div style="display:flex"><span style="width:140px">项目:{{item.client_name}}</span><span>区域:{{item.house ? item.house + "-" : ""}}{{item.layer ? item.layer : ""}}{{item.position ? item.position : ""}}</span></div>
  524. <div style="display:flex"><span style="width:140px">房号:{{item.number_detail}}</span><span>产品:{{item.product_title}}</span></div>
  525. <div style="display:flex"><span style="width:140px">图号:{{item.url_number}}</span><span>部件:{{item.part_title}}</span></div>
  526. <div><span>尺寸:{{item.measure}}</span></div>
  527. <div><span>木皮:{{item.color_title}}</span></div>
  528. </div>
  529. </div>
  530. </div>
  531. </template>
  532. <script>
  533. // 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  534. // 例如:import 《组件名称》 from '《组件路径》';
  535. import "@vant/touch-emulator";
  536. import $ from "jquery";
  537. export default {
  538. name: "",
  539. components: {},
  540. props: {},
  541. // import引入的组件需要注入到对象中才能使用
  542. data() {
  543. // 这里存放数据
  544. return {
  545. tagPrintList:[],
  546. show: false,
  547. show2: false,
  548. show3: false,
  549. isFullScreen: false,
  550. fullscreenModals: true,
  551. selectionModal: false,
  552. selectionRownolModal: false,
  553. selectionDetailModal: false,
  554. printModal: false,
  555. roomModal: false,
  556. contentData: [],
  557. selectedObj: {},
  558. ordernoObj: {
  559. title: "订单编号/项目名称选择",
  560. currentSearchValue: "",
  561. list: [],
  562. hasChild: false,
  563. },
  564. urlObj: {
  565. title: "图号选择",
  566. list: [],
  567. hasChild: true,
  568. },
  569. rownoObj: {},
  570. currencySelectedObj: {
  571. title: "订单编号/项目名称选择",
  572. currentSearchValue: "",
  573. type: 1,
  574. list: [],
  575. },
  576. selectedInfo: {
  577. order_no: "",
  578. residential_name: "",
  579. url_number: "",
  580. product_id: "",
  581. rows: [],
  582. },
  583. page_index: 1,
  584. // page_size: 6,
  585. total: 0,
  586. currentSearchValue: "",
  587. modal_1_page_index: 1,
  588. modal_1_page_size: 6,
  589. modal_1_total: 0,
  590. modal_room_page_index: 1,
  591. modal_room_page_size: 9,
  592. modal_room_total: 0,
  593. modal_2_page_index: 1,
  594. modal_2_page_size: 60,
  595. modal_2_total: 0,
  596. chooseOrderNo: {},
  597. chooseUrlNo: {},
  598. chooseDetailUrlNo: {},
  599. chooseLineNo: [{ start: "", end: "" }],
  600. keyboardObj: {},
  601. keyboardVal: "",
  602. modalRoomList: [],
  603. modalRoomListSelected: [],
  604. isWideScreen: localStorage.getItem("isWideScreen") || false,
  605. };
  606. },
  607. // 生命周期 - 创建完成(可以访问当前this实例)
  608. created() {},
  609. // 生命周期 - 挂载完成(可以访问DOM元素)
  610. mounted() {
  611. this.selectedInfo = JSON.parse(localStorage.getItem("printInfo"));
  612. this.getChipDetail();
  613. },
  614. methods: {
  615. Print(row,type){
  616. if (
  617. type &&
  618. this.modalRoomListSelected.length != this.selectedObj.print_num
  619. ) {
  620. return this.$Message.warning("与打印数量不符");
  621. }
  622. let ids = this.modalRoomListSelected.map((v) => {
  623. return v.id;
  624. });
  625. let data = type
  626. ? {
  627. order_no: this.selectedInfo.order_no,
  628. product_id: this.selectedInfo.product_id,
  629. rows: this.selectedInfo.rows,
  630. num: this.selectedObj.print_num,
  631. id: row.id,
  632. ids,
  633. type,
  634. }
  635. : {
  636. order_no: this.selectedInfo.order_no,
  637. product_id: this.selectedInfo.product_id,
  638. rows: this.selectedInfo.rows,
  639. num: this.selectedObj.print_num,
  640. id: row.id,
  641. };
  642. // 获取打印数据
  643. this.axios({
  644. method: "post",
  645. url: "/api/station_print",
  646. data,
  647. }).then((resp) => {
  648. if (resp.code == 200) {
  649. console.log(resp)
  650. this.tagPrintList = resp.data;
  651. setTimeout(()=>{
  652. this.$print(this.$refs.printRow);
  653. })
  654. }
  655. });
  656. },
  657. cancel(){
  658. this.fullscreenModals = false;
  659. this.$forceUpdate();
  660. },
  661. back() {
  662. this.$router.go(-1);
  663. },
  664. handleSelection(obj, type) {
  665. if (type == 2 && this.selectedInfo.order_no == "") {
  666. return this.$Message.warning("请先选择项目");
  667. }
  668. this.currentSearchValue = "";
  669. this.currentSearchValue = obj.currentSearchValue;
  670. this.currencySelectedObj = obj;
  671. this.selectionModal = true;
  672. this.total = 0;
  673. this.currencySelectedObj.type = type;
  674. if (this.currencySelectedObj.list.length == 0 || type == 2) {
  675. this.handleCurrentSearch(
  676. this.currencySelectedObj,
  677. this.currentSearchValue
  678. );
  679. }
  680. },
  681. handleSelectionRowno(row) {
  682. if (this.selectedInfo.rows.length > 0) {
  683. this.chooseLineNo = JSON.parse(JSON.stringify(this.selectedInfo.rows));
  684. } else {
  685. this.chooseLineNo = [{ start: null, end: null }];
  686. }
  687. this.selectionRownolModal = true;
  688. },
  689. handleCancelSelected(v, type) {
  690. if (type) {
  691. this.selectedInfo.rows.splice(v, 1);
  692. } else if (v == "product_id") {
  693. this.selectedInfo.url_number = "";
  694. this.selectedInfo.product_id = "";
  695. } else {
  696. this.selectedInfo[v] = "";
  697. }
  698. if (v != "order_no") {
  699. this.getChipDetail();
  700. } else {
  701. this.selectedInfo.residential_name = "";
  702. this.selectedInfo.url_number = "";
  703. this.selectedInfo.product_id = "";
  704. this.selectedInfo.rows = [];
  705. this.contentData = [];
  706. this.total = 0;
  707. }
  708. },
  709. handleChooseBlockClick(row) {
  710. console.log(`row`, row);
  711. if (row.isChoosed) {
  712. row.isChoosed = false;
  713. } else {
  714. this.contentData.map((v) => {
  715. v.isChoosed = false;
  716. });
  717. row.isChoosed = true;
  718. }
  719. if (row.un_print == 0) {
  720. row.isFinished = true;
  721. }
  722. this.selectedObj = row;
  723. },
  724. handleSelectionClick(row, obj) {
  725. row.list.map((v) => (v.isCurrent = false));
  726. obj.isCurrent = true;
  727. if (row.hasChild) {
  728. // 行号
  729. this.selectionModal = false;
  730. this.selectionDetailModal = true;
  731. this.chooseDetailUrlNo = obj;
  732. this.currentSearchValue = this.rownoObj.currentSearchValue;
  733. this.contentData = [];
  734. this.total = 0;
  735. } else {
  736. // 订单号
  737. this.chooseOrderNo = obj;
  738. this.currentSearchValue = this.ordernoObj.currentSearchValue;
  739. }
  740. if (row.type == 1) {
  741. this.handleSelectionComfirm(this.currencySelectedObj);
  742. }
  743. this.$forceUpdate();
  744. },
  745. handleAddRow(row, index) {
  746. this.chooseLineNo.push({
  747. start: "",
  748. end: "",
  749. });
  750. },
  751. handleDeleRow(row, index) {
  752. this.chooseLineNo.splice(index, 1);
  753. },
  754. handleSelectionDetailClick(row, obj) {
  755. row.children.map((v) => (v.isCurrent = false));
  756. obj.isCurrent = true;
  757. this.chooseUrlNo = obj;
  758. this.handleSelectionComfirm(this.currencySelectedObj);
  759. this.$forceUpdate();
  760. },
  761. handleFullScreenClick() {
  762. this.isFullScreen = !this.isFullScreen;
  763. if (this.isFullScreen) {
  764. this.enterFullScreen();
  765. } else {
  766. this.exitFullScreen();
  767. }
  768. },
  769. handleWideScreenClick() {
  770. this.isWideScreen = !this.isWideScreen;
  771. localStorage.setItem("isWideScreen", this.isWideScreen);
  772. if (this.isWideScreen) {
  773. this.page_size = 12;
  774. } else {
  775. this.page_size = 6;
  776. }
  777. this.getChipDetail();
  778. },
  779. enterFullScreen() {
  780. let el = document.documentElement;
  781. let rfs =
  782. el.requestFullScreen ||
  783. el.webkitRequestFullScreen ||
  784. el.mozRequestFullScreen ||
  785. el.msRequestFullscreen;
  786. if (rfs) {
  787. rfs.call(el);
  788. } else if (typeof window.ActiveXObject !== "undefined") {
  789. // for IE,这里其实就是模拟了按下键盘的F11,使浏览器全屏
  790. let wscript = new ActiveXObject("WScript.Shell");
  791. if (wscript != null) {
  792. wscript.SendKeys("{F11}");
  793. }
  794. }
  795. },
  796. exitFullScreen() {
  797. let el = document;
  798. let cfs =
  799. el.cancelFullScreen ||
  800. el.mozCancelFullScreen ||
  801. el.msExitFullscreen ||
  802. el.webkitExitFullscreen ||
  803. el.exitFullscreen;
  804. if (cfs) {
  805. // typeof cfs != "undefined" && cfs
  806. cfs.call(el);
  807. } else if (typeof window.ActiveXObject !== "undefined") {
  808. // for IE,这里和fullScreen相同,模拟按下F11键退出全屏
  809. let wscript = new ActiveXObject("WScript.Shell");
  810. if (wscript != null) {
  811. wscript.SendKeys("{F11}");
  812. }
  813. }
  814. },
  815. handleCurrentSearch(row, val) {
  816. //type 1项目选择 2图号选择
  817. let url =
  818. row.type == 1
  819. ? "/api/station_get_order"
  820. : "/api/station_get_url_number";
  821. this.axios({
  822. method: "post",
  823. url,
  824. data: {
  825. page_index:
  826. row.type == 1 ? this.modal_1_page_index : this.modal_2_page_index,
  827. page_size:
  828. row.type == 1 ? this.modal_1_page_size : this.modal_2_page_size,
  829. order_no: row.type == 1 ? val : this.selectedInfo.order_no,
  830. url_number: row.type == 1 ? "" : val,
  831. },
  832. }).then((res) => {
  833. if (res.code == 200) {
  834. if (row.type == 1) {
  835. row.list = res.data.data;
  836. this.modal_1_total = res.data.total;
  837. } else {
  838. row.list = [];
  839. this.modal_2_total = res.data.total;
  840. let length = Math.ceil(res.data.data.length / 10);
  841. for (let index = 0; index < length; index++) {
  842. row.list.push({
  843. //最后一位不一定刚好10个
  844. title:
  845. length - index == 1
  846. ? `${res.data.data[10 * index].url_number}~${
  847. res.data.data[res.data.data.length - 1].url_number
  848. }`
  849. : `${res.data.data[10 * index].url_number}~${
  850. res.data.data[10 * index + 10].url_number
  851. }`,
  852. children: res.data.data.slice(10 * index, 10 * index + 10),
  853. });
  854. }
  855. }
  856. }
  857. });
  858. },
  859. changeRoomPage(e) {
  860. this.modal_room_page_index = e;
  861. this.getModalRoomList();
  862. },
  863. handleSelectionRoom() {
  864. this.getModalRoomList();
  865. this.roomModal = true;
  866. },
  867. getModalRoomList() {
  868. this.axios({
  869. method: "post",
  870. url: "/api/station_get_print_house",
  871. data: {
  872. order_no: this.selectedInfo.order_no,
  873. product_id: this.selectedInfo.product_id,
  874. rows: this.selectedInfo.rows,
  875. page_index: this.modal_room_page_index,
  876. page_size: this.modal_room_page_size,
  877. id: this.selectedObj.id,
  878. },
  879. }).then((res) => {
  880. if (res.code == 200) {
  881. res.data.data.map((v) => {
  882. v.isCurrent = false;
  883. this.modalRoomListSelected &&
  884. this.modalRoomListSelected.map((w) => {
  885. if (w.id == v.id) {
  886. v.isCurrent = true;
  887. }
  888. });
  889. });
  890. this.modalRoomList = res.data.data;
  891. this.modal_room_total = res.data.total;
  892. }
  893. });
  894. },
  895. handleSelectedRoomClick(list, block) {
  896. if (block.isCurrent) {
  897. this.modalRoomListSelected = this.modalRoomListSelected.filter(
  898. (v) => v.id != block.id
  899. );
  900. block.isCurrent = !block.isCurrent;
  901. } else {
  902. if (this.modalRoomListSelected.length < this.selectedObj.print_num) {
  903. block.isCurrent = !block.isCurrent;
  904. this.modalRoomListSelected = this.modalRoomListSelected.concat(
  905. this.modalRoomList.filter((v) => v.isCurrent)
  906. );
  907. } else {
  908. this.$Message.warning("与打印数量不符,请重新选择");
  909. }
  910. }
  911. this.modalRoomListSelected = Array.from(
  912. new Set([...this.modalRoomListSelected])
  913. );
  914. },
  915. //项目、图号确认
  916. handleSelectionComfirm(row) {
  917. console.log(`row`, row);
  918. // 这里需要把弹框关闭之后赋值到selectedInfo上
  919. // this.selectedInfo.order_no;
  920. // 1 项目选择 2图号选择
  921. if (row.type == 1) {
  922. this.selectedInfo.order_no = this.chooseOrderNo.order_no;
  923. this.selectedInfo.residential_name = this.chooseOrderNo.residential_name;
  924. this.selectionModal = false;
  925. } else if (row.type == 2) {
  926. this.selectedInfo.url_number = this.chooseUrlNo.url_number;
  927. this.selectedInfo.product_id = this.chooseUrlNo.product_id;
  928. this.selectionDetailModal = false;
  929. this.getChipDetail();
  930. }
  931. // order_no: "20211010",
  932. // residential_name: "2",
  933. // url_number: "3",
  934. // row_no: [],
  935. },
  936. // 获取具体详情
  937. getChipDetail() {
  938. if(!this.selectedInfo.order_no&&!this.selectedInfo.product_id){
  939. return
  940. }else{
  941. this.axios({
  942. method: "post",
  943. url: "/api/station_get_order_on_product_pr",
  944. data: {
  945. order_no: this.selectedInfo.order_no,
  946. product_id: this.selectedInfo.product_id,
  947. rows: this.selectedInfo.rows,
  948. page_index: this.page_index,
  949. page_size: this.page_size,
  950. },
  951. }).then((res) => {
  952. if (res.code == 200) {
  953. console.log(`res`, res);
  954. res.data.data.map((v) => (v.isChoosed = false));
  955. this.contentData = res.data.data;
  956. this.total = res.data.total;
  957. }
  958. });
  959. }
  960. },
  961. handlePrint() {
  962. if (!this.selectedObj.isChoosed) {
  963. return this.$Message.warning("请选择数据");
  964. }
  965. if (this.selectedObj.un_print == 0) {
  966. this.selectedObj.print_num = this.selectedObj.on_print;
  967. } else {
  968. this.selectedObj.print_num = this.selectedObj.on_print;
  969. }
  970. this.printModal = true;
  971. },
  972. handlePrintComfirm(row, type) {
  973. if (
  974. type &&
  975. this.modalRoomListSelected.length != this.selectedObj.print_num
  976. ) {
  977. return this.$Message.warning("与打印数量不符");
  978. }
  979. let ids = this.modalRoomListSelected.map((v) => {
  980. return v.id;
  981. });
  982. let data = type
  983. ? {
  984. order_no: this.selectedInfo.order_no,
  985. product_id: this.selectedInfo.product_id,
  986. rows: this.selectedInfo.rows,
  987. num: this.selectedObj.print_num,
  988. id: row.id,
  989. ids,
  990. type,
  991. }
  992. : {
  993. order_no: this.selectedInfo.order_no,
  994. product_id: this.selectedInfo.product_id,
  995. rows: this.selectedInfo.rows,
  996. num: this.selectedObj.print_num,
  997. id: row.id,
  998. };
  999. this.axios({
  1000. method: "post",
  1001. url: "/api/station_print",
  1002. data,
  1003. }).then((resp) => {
  1004. if (resp.code == 200) {
  1005. this.axios.get("/api/get_print_local_url").then((res) => {
  1006. console.log(res);
  1007. if (res.code == 200) {
  1008. if (res.data.state) {
  1009. this.handlePrintChipsUsb(resp.data, res.data.type);
  1010. } else {
  1011. this.handlePrintChipsIp(resp.data, res.data.type);
  1012. }
  1013. }
  1014. });
  1015. this.modalRoomList.map((v) => {
  1016. v.isCurrent = false;
  1017. });
  1018. this.modalRoomListSelected = [];
  1019. this.printModal = false;
  1020. this.roomModal = false;
  1021. }
  1022. });
  1023. },
  1024. handlePrintChipsUsb(contents, type) {
  1025. this.axios.get("/api/get_print_url").then((res) => {
  1026. let data = {};
  1027. // let url = "http://192.168.0.145:888/postek/print"; //request_url
  1028. let url = `http://${res.data.request_url}:888/postek/print`; //request_url
  1029. data.reqParam = "1"; //这个一般不用改,如需改,查api
  1030. let printparamsJsonArray = [];
  1031. // let IP = "192.168.1.58";//print_url
  1032. // let IP = "192.168.0.199"; //print_url
  1033. printparamsJsonArray.push({ PTK_OpenUSBPort: 255 });
  1034. printparamsJsonArray.push({ PTK_ClearBuffer: "" });
  1035. printparamsJsonArray.push({ PTK_SetDirection: "B" });
  1036. printparamsJsonArray.push({ PTK_SetPrintSpeed: "4" });
  1037. printparamsJsonArray.push({ PTK_SetDarkness: "10" });
  1038. printparamsJsonArray.push({
  1039. PTK_SetLabelHeight: 624 + "," + 24 + ",0,false",
  1040. });
  1041. printparamsJsonArray.push({ PTK_SetLabelWidth: 1080 });
  1042. // 打印类型 1江山 2贝斯特
  1043. if (type == 1) {
  1044. contents.map((content) => {
  1045. //江山打印格式
  1046. //上
  1047. const printContent_l1 = `单号:${content.order_no}`;
  1048. printparamsJsonArray.push({
  1049. PTK_DrawText_TrueType:
  1050. "100,40,60,0,微软雅黑,1,700,0,0,0," + printContent_l1,
  1051. });
  1052. const printContent_l1_2 = `型号:${content.product_title}`;
  1053. printparamsJsonArray.push({
  1054. PTK_DrawText_TrueType:
  1055. "600,40,60,0,微软雅黑,1,700,0,0,0," + printContent_l1_2,
  1056. });
  1057. const printContent_l2 = `尺寸:${content.measure}`;
  1058. printparamsJsonArray.push({
  1059. PTK_DrawText_TrueType:
  1060. "100,110,60,0,微软雅黑,1,700,0,0,0," + printContent_l2,
  1061. });
  1062. const printContent_l2_2 = `工艺:${content.process_title}`;
  1063. printparamsJsonArray.push({
  1064. PTK_DrawText_TrueType:
  1065. "600,110,60,0,微软雅黑,1,700,0,0,0," + printContent_l2_2,
  1066. });
  1067. const printContent_l3 = `颜色:${content.color_title}`;
  1068. printparamsJsonArray.push({
  1069. PTK_DrawText_TrueType:
  1070. "100,250,60,0,微软雅黑,1,700,0,0,0," + printContent_l3,
  1071. });
  1072. const printContent_l3_2 = `部件:${content.part_title}`;
  1073. printparamsJsonArray.push({
  1074. PTK_DrawText_TrueType:
  1075. "100,180,60,0,微软雅黑,1,700,0,0,0," + printContent_l3_2,
  1076. });
  1077. //下
  1078. printparamsJsonArray.push({
  1079. PTK_DrawText_TrueType:
  1080. "100,435,45,0,微软雅黑,1,700,0,0,0," + printContent_l1,
  1081. });
  1082. printparamsJsonArray.push({
  1083. PTK_DrawText_TrueType:
  1084. "600,435,45,0,微软雅黑,1,700,0,0,0," + printContent_l1_2,
  1085. });
  1086. printparamsJsonArray.push({
  1087. PTK_DrawText_TrueType:
  1088. "100,480,45,0,微软雅黑,1,700,0,0,0," + printContent_l2,
  1089. });
  1090. printparamsJsonArray.push({
  1091. PTK_DrawText_TrueType:
  1092. "600,480,45,0,微软雅黑,1,700,0,0,0," + printContent_l2_2,
  1093. });
  1094. printparamsJsonArray.push({
  1095. PTK_DrawText_TrueType:
  1096. "100,525,45,0,微软雅黑,1,700,0,0,0," + printContent_l3,
  1097. });
  1098. printparamsJsonArray.push({
  1099. PTK_DrawText_TrueType:
  1100. "600,525,45,0,微软雅黑,1,700,0,0,0," + printContent_l3_2,
  1101. });
  1102. printparamsJsonArray.push({
  1103. PTK_RWRFIDLabel:
  1104. "1,0,0," + content.chip.length / 2 + ",1," + content.chip,
  1105. });
  1106. printparamsJsonArray.push({ PTK_PrintLabel: "1,1" });
  1107. });
  1108. } else {
  1109. contents.map((content) => {
  1110. console.log(content)
  1111. //贝斯特打印格式
  1112. //上
  1113. const printContent_l1 = `项目:${content.client_name}`;
  1114. printparamsJsonArray.push({
  1115. PTK_DrawText_TrueType:
  1116. "150,40,60,0,微软雅黑,1,700,0,0,0," + printContent_l1,
  1117. });
  1118. const printContent_l1_2 = `区域:${
  1119. content.house ? content.house + "-" : ""
  1120. }${content.layer ? content.layer : ""}${
  1121. content.position ? content.position : ""
  1122. }`;
  1123. printparamsJsonArray.push({
  1124. PTK_DrawText_TrueType:
  1125. "650,40,60,0,微软雅黑,1,700,0,0,0," + printContent_l1_2,
  1126. });
  1127. const printContent_l2 = `房号:${content.number_detail}`;
  1128. printparamsJsonArray.push({
  1129. PTK_DrawText_TrueType:
  1130. "150,110,60,0,微软雅黑,1,700,0,0,0," + printContent_l2,
  1131. });
  1132. const printContent_l2_2 = `产品:${content.product_title}`;
  1133. printparamsJsonArray.push({
  1134. PTK_DrawText_TrueType:
  1135. "650,110,60,0,微软雅黑,1,700,0,0,0," + printContent_l2_2,
  1136. });
  1137. const printContent_l3 = `图号:${content.url_number}`;
  1138. printparamsJsonArray.push({
  1139. PTK_DrawText_TrueType:
  1140. "150,180,60,0,微软雅黑,1,700,0,0,0," + printContent_l3,
  1141. });
  1142. const printContent_l3_2 = `部件:${content.part_title}`;
  1143. printparamsJsonArray.push({
  1144. PTK_DrawText_TrueType:
  1145. "650,180,60,0,微软雅黑,1,700,0,0,0," + printContent_l3_2,
  1146. });
  1147. const printContent_l4 = `木皮:${content.color_title}`;
  1148. printparamsJsonArray.push({
  1149. PTK_DrawText_TrueType:
  1150. "150,320,60,0,微软雅黑,1,700,0,0,0," + printContent_l4,
  1151. });
  1152. const printContent_l4_2 = `尺寸:${content.measure}`;
  1153. printparamsJsonArray.push({
  1154. PTK_DrawText_TrueType:
  1155. "150,250,60,0,微软雅黑,1,700,0,0,0," + printContent_l4_2,
  1156. });
  1157. // const printContent_l5 = `芯片编码:${content.chip}`;
  1158. // console.log(this.hexCharCodeToStr(content.chip))
  1159. let space_str = '\u0000'
  1160. let printContent_l5_data=this.hexCharCodeToStr(content.chip);
  1161. printContent_l5_data = printContent_l5_data.replace(space_str,'')
  1162. const printContent_l5 = `芯片编码:${printContent_l5_data}`;
  1163. // console.log(printContent_l5_data)
  1164. printparamsJsonArray.push({
  1165. PTK_DrawText_TrueTypeEx:
  1166. "1000,330,25,0,微软雅黑,1,700,0,0,0,10,0,0,0," + printContent_l5,
  1167. });
  1168. //下
  1169. printparamsJsonArray.push({
  1170. PTK_DrawText_TrueType:
  1171. "150,435,45,0,微软雅黑,1,700,0,0,0," + printContent_l1,
  1172. });
  1173. printparamsJsonArray.push({
  1174. PTK_DrawText_TrueType:
  1175. "650,435,45,0,微软雅黑,1,700,0,0,0," + printContent_l1_2,
  1176. });
  1177. printparamsJsonArray.push({
  1178. PTK_DrawText_TrueType:
  1179. "150,480,45,0,微软雅黑,1,700,0,0,0," + printContent_l2,
  1180. });
  1181. printparamsJsonArray.push({
  1182. PTK_DrawText_TrueType:
  1183. "650,480,45,0,微软雅黑,1,700,0,0,0," + printContent_l2_2,
  1184. });
  1185. printparamsJsonArray.push({
  1186. PTK_DrawText_TrueType:
  1187. "150,525,45,0,微软雅黑,1,700,0,0,0," + printContent_l3,
  1188. });
  1189. printparamsJsonArray.push({
  1190. PTK_DrawText_TrueType:
  1191. "650,525,45,0,微软雅黑,1,700,0,0,0," + printContent_l3_2,
  1192. });
  1193. printparamsJsonArray.push({
  1194. PTK_DrawText_TrueType:
  1195. "150,570,45,0,微软雅黑,1,700,0,0,0," + printContent_l4,
  1196. });
  1197. printparamsJsonArray.push({
  1198. PTK_DrawText_TrueType:
  1199. "650,570,45,0,微软雅黑,1,700,0,0,0," + printContent_l4_2,
  1200. });
  1201. printparamsJsonArray.push({
  1202. PTK_DrawText_TrueTypeEx:
  1203. "1000,530,25,0,微软雅黑,1,700,0,0,0,10,0,0,0," + printContent_l5,
  1204. });
  1205. // 17,35 420
  1206. printparamsJsonArray.push({
  1207. PTK_RWRFIDLabel:
  1208. "1,0,0," + content.chip.length / 2 + ",1," + content.chip,
  1209. });
  1210. printparamsJsonArray.push({ PTK_PrintLabel: "1,1" });
  1211. });
  1212. }
  1213. printparamsJsonArray.push({ PTK_CloseUSBPort: "" });
  1214. data.printparams = printparamsJsonArray;
  1215. let sub_data = JSON.parse(JSON.stringify(data));
  1216. sub_data.printparams = JSON.stringify(sub_data.printparams);
  1217. let _this = this;
  1218. $.ajax({
  1219. type: "post",
  1220. url,
  1221. data: sub_data,
  1222. dataType: "json",
  1223. timeout: 5000,
  1224. success: function(result) {
  1225. _this.getChipDetail();
  1226. if (result.retval == "0") {
  1227. _this.$Message.success("发送成功");
  1228. } else {
  1229. _this.$Message.error("发送失败,返回结果:" + result.msg);
  1230. }
  1231. },
  1232. error: function() {
  1233. _this.getChipDetail();
  1234. },
  1235. });
  1236. });
  1237. },
  1238. hexCharCodeToStr(hexCharCodeStr) {
  1239. let trimedStr = hexCharCodeStr.trim();
  1240. let rawStr = trimedStr.substr(0,2).toLowerCase() === "0x"?trimedStr.substr(2):trimedStr;
  1241. let len = rawStr.length;
  1242. if(len % 2 !== 0) {
  1243. alert("Illegal Format ASCII Code!");
  1244. return "";}
  1245. let curCharCode;
  1246. let resultStr = [];
  1247. for(var i = 0; i < len;i = i + 2) {
  1248. curCharCode = parseInt(rawStr.substr(i, 2), 16); // ASCII Code Value
  1249. resultStr.push(String.fromCharCode(curCharCode));
  1250. }
  1251. return resultStr.join("");
  1252. },
  1253. handleOk() {
  1254. if (!this.selectedObj.isChoosed) {
  1255. return this.$Message.warning("请选择数据");
  1256. }
  1257. if (this.selectedObj.type == 1 && this.selectedObj.un_print == 0) {
  1258. return this.$Message.warning("部件存在未打印芯片,请先打印");
  1259. }
  1260. this.selectedObj.ok_num =
  1261. this.selectedObj.on_print - this.selectedObj.on_complete;
  1262. this.okModal = true;
  1263. },
  1264. handleRoomCancel() {
  1265. this.modalRoomList.map((v) => {
  1266. v.isCurrent = false;
  1267. });
  1268. this.modalRoomListSelected = [];
  1269. this.roomModal = false;
  1270. },
  1271. handleOkComfirm(row) {
  1272. if (this.modalRoomListSelected.length != this.selectedObj.print_num) {
  1273. return this.$Message.warning("与打印数量不符,请重新选择");
  1274. }
  1275. this.axios({
  1276. method: "post",
  1277. url: "/api/station_complete",
  1278. data: {
  1279. order_no: this.selectedInfo.order_no,
  1280. product_id: this.selectedInfo.product_id,
  1281. rows: this.selectedInfo.rows,
  1282. num: this.selectedObj.ok_num,
  1283. id: row.id,
  1284. },
  1285. }).then((res) => {
  1286. if (res.code == 200) {
  1287. this.okModal = false;
  1288. this.getChipDetail();
  1289. }
  1290. });
  1291. },
  1292. //行号确认
  1293. handleRowNoComfirm() {
  1294. let data =[];
  1295. this.chooseLineNo.map((v)=>{
  1296. if(v.start&&v.end){
  1297. data.push(v)
  1298. }
  1299. })
  1300. this.selectedInfo.rows = JSON.parse(JSON.stringify(data));
  1301. this.selectionRownolModal = false;
  1302. this.page_index = 1;
  1303. this.getChipDetail();
  1304. },
  1305. onInput(value) {
  1306. this.currentSearchValue = this.currentSearchValue + "" + value;
  1307. this.handleCurrentSearch(
  1308. this.currencySelectedObj,
  1309. this.currentSearchValue
  1310. );
  1311. },
  1312. onDelete() {
  1313. this.currentSearchValue = this.currentSearchValue.substring(
  1314. 0,
  1315. this.currentSearchValue.length - 1
  1316. );
  1317. this.handleCurrentSearch(
  1318. this.currencySelectedObj,
  1319. this.currentSearchValue
  1320. );
  1321. },
  1322. handlePrintInput() {
  1323. this.show3 = true;
  1324. },
  1325. keyboardPrintTap(value) {
  1326. let max = this.selectedObj.on_print + this.selectedObj.un_print;
  1327. this.selectedObj.print_num =
  1328. Number((this.selectedObj.print_num ? this.selectedObj.print_num : "") +
  1329. "" +
  1330. value);
  1331. if (this.selectedObj.print_num * 1 > max) {
  1332. this.selectedObj.print_num = max;
  1333. }
  1334. this.$forceUpdate();
  1335. },
  1336. keyboardPrintDele() {
  1337. this.selectedObj.print_num = Number((this.selectedObj.print_num + "").substring(
  1338. 0,
  1339. this.selectedObj.print_num.length - 1
  1340. ));
  1341. this.$forceUpdate();
  1342. },
  1343. keyboardTap(value) {
  1344. this.keyboardObj[this.keyboardVal] =
  1345. (this.keyboardObj[this.keyboardVal]
  1346. ? this.keyboardObj[this.keyboardVal]
  1347. : "") +
  1348. "" +
  1349. value;
  1350. },
  1351. keyboardDele() {
  1352. this.keyboardObj[this.keyboardVal] = this.keyboardObj[
  1353. this.keyboardVal
  1354. ].substring(0, this.keyboardObj[this.keyboardVal].length - 1);
  1355. },
  1356. handleRowNoInput(row, type) {
  1357. if (type == 1) {
  1358. this.keyboardVal = "start";
  1359. } else {
  1360. this.keyboardVal = "end";
  1361. }
  1362. this.keyboardObj = row;
  1363. this.show2 = true;
  1364. },
  1365. changePage(e) {
  1366. this.page_index = e;
  1367. this.getChipDetail();
  1368. },
  1369. changeModalPage(e) {
  1370. this.currencySelectedObj.type == 1
  1371. ? (this.modal_1_page_index = e)
  1372. : (this.modal_2_page_index = e);
  1373. this.handleCurrentSearch(
  1374. this.currencySelectedObj,
  1375. this.currentSearchValue
  1376. );
  1377. },
  1378. handlePrintChipsIp(contents, type) {
  1379. this.axios.get("/api/get_print_url").then((res) => {
  1380. let data = {};
  1381. // let url = "http://192.168.0.145:888/postek/print"; //request_url
  1382. let url = `http://${res.data.request_url}:888/postek/print`; //request_url
  1383. data.reqParam = "1"; //这个一般不用改,如需改,查api
  1384. let printparamsJsonArray = [];
  1385. // let IP = "192.168.1.58";//print_url
  1386. // let IP = "192.168.0.199"; //print_url
  1387. let IP = res.data.print_url;
  1388. let port = 9100;
  1389. let IP_Port = IP + "," + port;
  1390. printparamsJsonArray.push({ PTK_Connect_Timer: IP_Port + ",1" });
  1391. printparamsJsonArray.push({ PTK_ClearBuffer: "" });
  1392. printparamsJsonArray.push({ PTK_SetDirection: "B" });
  1393. printparamsJsonArray.push({ PTK_SetPrintSpeed: "4" });
  1394. printparamsJsonArray.push({ PTK_SetDarkness: "10" });
  1395. printparamsJsonArray.push({
  1396. PTK_SetLabelHeight: 624 + "," + 24 + ",0,false",
  1397. });
  1398. printparamsJsonArray.push({ PTK_SetLabelWidth: 1080 });
  1399. console.log(`contents`, contents);
  1400. if (type == 1) {
  1401. contents.map((content) => {
  1402. //江山打印格式
  1403. //上
  1404. const printContent_l1 = `单号:${content.order_no}`;
  1405. printparamsJsonArray.push({
  1406. PTK_DrawText_TrueType:
  1407. "100,40,60,0,微软雅黑,1,700,0,0,0," + printContent_l1,
  1408. });
  1409. const printContent_l1_2 = `型号:${content.product_title}`;
  1410. printparamsJsonArray.push({
  1411. PTK_DrawText_TrueType:
  1412. "600,40,60,0,微软雅黑,1,700,0,0,0," + printContent_l1_2,
  1413. });
  1414. const printContent_l2 = `尺寸:${content.measure}`;
  1415. printparamsJsonArray.push({
  1416. PTK_DrawText_TrueType:
  1417. "100,110,60,0,微软雅黑,1,700,0,0,0," + printContent_l2,
  1418. });
  1419. const printContent_l2_2 = `工艺:${content.process_title}`;
  1420. printparamsJsonArray.push({
  1421. PTK_DrawText_TrueType:
  1422. "600,110,60,0,微软雅黑,1,700,0,0,0," + printContent_l2_2,
  1423. });
  1424. const printContent_l3 = `颜色:${content.color_title}`;
  1425. printparamsJsonArray.push({
  1426. PTK_DrawText_TrueType:
  1427. "100,250,60,0,微软雅黑,1,700,0,0,0," + printContent_l3,
  1428. });
  1429. const printContent_l3_2 = `部件:${content.part_title}`;
  1430. printparamsJsonArray.push({
  1431. PTK_DrawText_TrueType:
  1432. "100,180,60,0,微软雅黑,1,700,0,0,0," + printContent_l3_2,
  1433. });
  1434. //下
  1435. printparamsJsonArray.push({
  1436. PTK_DrawText_TrueType:
  1437. "100,435,45,0,微软雅黑,1,700,0,0,0," + printContent_l1,
  1438. });
  1439. printparamsJsonArray.push({
  1440. PTK_DrawText_TrueType:
  1441. "600,435,45,0,微软雅黑,1,700,0,0,0," + printContent_l1_2,
  1442. });
  1443. printparamsJsonArray.push({
  1444. PTK_DrawText_TrueType:
  1445. "100,480,45,0,微软雅黑,1,700,0,0,0," + printContent_l2,
  1446. });
  1447. printparamsJsonArray.push({
  1448. PTK_DrawText_TrueType:
  1449. "600,480,45,0,微软雅黑,1,700,0,0,0," + printContent_l2_2,
  1450. });
  1451. printparamsJsonArray.push({
  1452. PTK_DrawText_TrueType:
  1453. "100,525,45,0,微软雅黑,1,700,0,0,0," + printContent_l3,
  1454. });
  1455. printparamsJsonArray.push({
  1456. PTK_DrawText_TrueType:
  1457. "600,525,45,0,微软雅黑,1,700,0,0,0," + printContent_l3_2,
  1458. });
  1459. printparamsJsonArray.push({
  1460. PTK_RWRFIDLabel:
  1461. "1,0,0," + content.chip.length / 2 + ",1," + content.chip,
  1462. });
  1463. printparamsJsonArray.push({ PTK_PrintLabel: "1,1" });
  1464. });
  1465. } else {
  1466. contents.map((content) => {
  1467. //贝斯特打印格式
  1468. //上
  1469. const printContent_l1 = `项目:${content.client_name}`;
  1470. printparamsJsonArray.push({
  1471. PTK_DrawText_TrueType:
  1472. "300,40,60,0,微软雅黑,1,700,0,0,0," + printContent_l1,
  1473. });
  1474. const printContent_l1_2 = `区域:${
  1475. content.house ? content.house + "-" : ""
  1476. }${content.layer ? content.layer : ""}${
  1477. content.position ? content.position : ""
  1478. }`;
  1479. printparamsJsonArray.push({
  1480. PTK_DrawText_TrueType:
  1481. "800,40,60,0,微软雅黑,1,700,0,0,0," + printContent_l1_2,
  1482. });
  1483. const printContent_l2 = `房号:${content.number_detail}`;
  1484. printparamsJsonArray.push({
  1485. PTK_DrawText_TrueType:
  1486. "300,110,60,0,微软雅黑,1,700,0,0,0," + printContent_l2,
  1487. });
  1488. const printContent_l2_2 = `产品:${content.product_title}`;
  1489. printparamsJsonArray.push({
  1490. PTK_DrawText_TrueType:
  1491. "800,110,60,0,微软雅黑,1,700,0,0,0," + printContent_l2_2,
  1492. });
  1493. const printContent_l3 = `图号:${content.url_number}`;
  1494. printparamsJsonArray.push({
  1495. PTK_DrawText_TrueType:
  1496. "300,180,60,0,微软雅黑,1,700,0,0,0," + printContent_l3,
  1497. });
  1498. const printContent_l3_2 = `部件:${content.part_title}`;
  1499. printparamsJsonArray.push({
  1500. PTK_DrawText_TrueType:
  1501. "800,180,60,0,微软雅黑,1,700,0,0,0," + printContent_l3_2,
  1502. });
  1503. const printContent_l4 = `木皮:${content.color_title}`;
  1504. printparamsJsonArray.push({
  1505. PTK_DrawText_TrueType:
  1506. "300,320,60,0,微软雅黑,1,700,0,0,0," + printContent_l4,
  1507. });
  1508. const printContent_l4_2 = `尺寸:${content.measure}`;
  1509. printparamsJsonArray.push({
  1510. PTK_DrawText_TrueType:
  1511. "300,250,60,0,微软雅黑,1,700,0,0,0," + printContent_l4_2,
  1512. });
  1513. //下
  1514. printparamsJsonArray.push({
  1515. PTK_DrawText_TrueType:
  1516. "300,435,45,0,微软雅黑,1,700,0,0,0," + printContent_l1,
  1517. });
  1518. printparamsJsonArray.push({
  1519. PTK_DrawText_TrueType:
  1520. "800,435,45,0,微软雅黑,1,700,0,0,0," + printContent_l1_2,
  1521. });
  1522. printparamsJsonArray.push({
  1523. PTK_DrawText_TrueType:
  1524. "300,480,45,0,微软雅黑,1,700,0,0,0," + printContent_l2,
  1525. });
  1526. printparamsJsonArray.push({
  1527. PTK_DrawText_TrueType:
  1528. "800,480,45,0,微软雅黑,1,700,0,0,0," + printContent_l2_2,
  1529. });
  1530. printparamsJsonArray.push({
  1531. PTK_DrawText_TrueType:
  1532. "300,525,45,0,微软雅黑,1,700,0,0,0," + printContent_l3,
  1533. });
  1534. printparamsJsonArray.push({
  1535. PTK_DrawText_TrueType:
  1536. "800,525,45,0,微软雅黑,1,700,0,0,0," + printContent_l3_2,
  1537. });
  1538. printparamsJsonArray.push({
  1539. PTK_DrawText_TrueType:
  1540. "300,570,45,0,微软雅黑,1,700,0,0,0," + printContent_l4,
  1541. });
  1542. printparamsJsonArray.push({
  1543. PTK_DrawText_TrueType:
  1544. "800,570,45,0,微软雅黑,1,700,0,0,0," + printContent_l4_2,
  1545. });
  1546. // 17,35 420
  1547. printparamsJsonArray.push({
  1548. PTK_RWRFIDLabel:
  1549. "1,0,0," + content.chip.length / 2 + ",1," + content.chip,
  1550. });
  1551. printparamsJsonArray.push({ PTK_PrintLabel: "1,1" });
  1552. });
  1553. }
  1554. printparamsJsonArray.push({ PTK_CloseConnect: "" });
  1555. data.printparams = printparamsJsonArray;
  1556. let sub_data = JSON.parse(JSON.stringify(data));
  1557. sub_data.printparams = JSON.stringify(sub_data.printparams);
  1558. let _this = this;
  1559. $.ajax({
  1560. type: "post",
  1561. url,
  1562. data: sub_data,
  1563. dataType: "json",
  1564. timeout: 5000,
  1565. success: function(result) {
  1566. _this.getChipDetail();
  1567. if (result.retval == "0") {
  1568. _this.$Message.success("发送成功");
  1569. } else {
  1570. _this.$Message.error("发送失败,返回结果:" + result.msg);
  1571. }
  1572. },
  1573. error: function() {
  1574. _this.getChipDetail();
  1575. },
  1576. });
  1577. });
  1578. },
  1579. },
  1580. // 监听属性 类似于data概念
  1581. computed: {
  1582. page_size(){
  1583. if(this.isWideScreen){
  1584. return 12
  1585. }else{
  1586. return 6
  1587. }
  1588. }
  1589. },
  1590. // 监控data中的数据变化
  1591. watch: {},
  1592. beforeCreate() {}, // 生命周期 - 创建之前
  1593. beforeMount() {}, // 生命周期 - 挂载之前
  1594. beforeUpdate() {}, // 生命周期 - 更新之前
  1595. updated() {}, // 生命周期 - 更新之后
  1596. beforeDestroy() {}, // 生命周期 - 销毁之前
  1597. destroyed() {}, // 生命周期 - 销毁完成
  1598. activated() {}, // 如果页面有keep-alive缓存功能,这个函数会触发
  1599. };
  1600. </script>
  1601. <style lang="scss" scoped>
  1602. .fullscreen-title-btn {
  1603. position: absolute;
  1604. right: 100px;
  1605. top: 0.175rem;
  1606. }
  1607. .fullscreen-content {
  1608. font-size: 26px;
  1609. font-family: "Microsoft YaHei", 微软雅黑;
  1610. font-weight: bold;
  1611. .fullscreen-content-select {
  1612. display: flex;
  1613. justify-content: space-around;
  1614. padding-bottom: 0.1rem;
  1615. border-bottom: 1px solid #e8eaec;
  1616. .fullscreen-content-select-block {
  1617. display: flex;
  1618. justify-content: flex-start;
  1619. align-items: center;
  1620. }
  1621. .fullscreen-content-select-block:nth-child(1) {
  1622. width: 30%;
  1623. }
  1624. .fullscreen-content-select-block:nth-child(2) {
  1625. width: 30%;
  1626. }
  1627. .fullscreen-content-select-block:nth-child(3) {
  1628. width:30%
  1629. }
  1630. }
  1631. .fullscreen-content-choose {
  1632. display: flex;
  1633. justify-content: flex-start;
  1634. flex-wrap: wrap;
  1635. padding-top: 0.1rem;
  1636. margin-bottom: 0.5rem;
  1637. .fullscreen-content-choose-block {
  1638. width: 33.33%;
  1639. border-radius: 5px;
  1640. border: 1px solid #2d8cf0;
  1641. // margin: 0.1rem 1%;
  1642. padding: 1%;
  1643. position: relative;
  1644. div {
  1645. display: flex;
  1646. justify-content: space-between;
  1647. // margin-top: 5px;
  1648. }
  1649. .chip-tag {
  1650. display: inline-block;
  1651. position: absolute;
  1652. width: 1rem;
  1653. top: 0;
  1654. left: 50%;
  1655. font-size: 18px;
  1656. background-color: #fadb14;
  1657. color: black;
  1658. height: 0.75rem;
  1659. border-radius: 15%;
  1660. text-align: center;
  1661. padding-top: 0.15rem;
  1662. transform: translate(-50%, -10%);
  1663. }
  1664. .chip-tag-choosed {
  1665. display: inline-block;
  1666. position: absolute;
  1667. width: 1rem;
  1668. top: 0;
  1669. left: 15%;
  1670. font-size: 18px;
  1671. background-color: #fadb14;
  1672. color: black;
  1673. height: 0.75rem;
  1674. border-radius: 15%;
  1675. text-align: center;
  1676. padding-top: 0.15rem;
  1677. transform: translate(-10%, -10%) !important;
  1678. }
  1679. }
  1680. .fullscreen-content-choose-block-wide {
  1681. width: 24.5%;
  1682. }
  1683. .fullscreen-content-choose-block-choosen {
  1684. color: white;
  1685. background-color: #2d8cf0;
  1686. }
  1687. .fullscreen-content-choose-block-unchoosen {
  1688. color: #2d8cf0;
  1689. background-color: white;
  1690. }
  1691. }
  1692. }
  1693. .fullscreen-content-page {
  1694. display: flex;
  1695. justify-content: center;
  1696. }
  1697. .selection-modal {
  1698. .selection-modal-top {
  1699. display: flex;
  1700. justify-content: center;
  1701. }
  1702. .selection-modal-body {
  1703. display: flex;
  1704. justify-content: center;
  1705. flex-wrap: wrap;
  1706. .selection-modal-body-block {
  1707. cursor: pointer;
  1708. width: 30%;
  1709. margin: 1%;
  1710. padding: 3% 1%;
  1711. background-color: #e9ecef;
  1712. div {
  1713. display: flex;
  1714. justify-content: center;
  1715. }
  1716. }
  1717. .selection-modal-body-block-detail {
  1718. cursor: pointer;
  1719. width: 17%;
  1720. margin: 1%;
  1721. padding: 3% 1%;
  1722. background-color: #e9ecef;
  1723. div {
  1724. display: flex;
  1725. justify-content: center;
  1726. }
  1727. }
  1728. .selection-modal-body-block-choosen,
  1729. .selection-modal-body-block-detail-choosen {
  1730. background-color: #fadb14;
  1731. }
  1732. .selection-modal-body-block-unchoosen,
  1733. .selection-modal-body-block-detail-unchoosen {
  1734. background-color: #e9ecef;
  1735. }
  1736. }
  1737. }
  1738. .selection-rowno-modal {
  1739. .selection-rowno-modal-body {
  1740. max-height: 7rem;
  1741. overflow: auto;
  1742. .selection-rowno-modal-body-block {
  1743. margin: 0.5rem 0;
  1744. text-align: center;
  1745. }
  1746. }
  1747. }
  1748. .selection-print-modal {
  1749. .selection-print-modal-body {
  1750. .selection-print-modal-body-top {
  1751. display: flex;
  1752. justify-content: space-around;
  1753. align-items: center;
  1754. margin: 0.5rem 0;
  1755. }
  1756. .selection-print-modal-body-info {
  1757. padding-top: 16px;
  1758. border-top: 1px solid #e8eaec;
  1759. text-align: center;
  1760. button{
  1761. height: 2em;
  1762. font-size: 1em;
  1763. }
  1764. }
  1765. .selection-print-modal-body-footer{
  1766. height: 1rem;
  1767. display: flex;
  1768. justify-content: space-around;
  1769. button{
  1770. height: 1.5em;
  1771. font-size: 3em;
  1772. }
  1773. }
  1774. }}
  1775. .icon-wrapper {
  1776. position: relative;
  1777. font-size: 0.25rem;
  1778. }
  1779. .icon-close {
  1780. position: absolute;
  1781. right: -0.35rem;
  1782. top: -0.2rem;
  1783. }
  1784. /deep/.ivu-page-item {
  1785. display: inline-block;
  1786. font-size: 0.5rem;
  1787. height: 1rem;
  1788. line-height: 1rem;
  1789. width: 1rem;
  1790. }
  1791. /deep/.ivu-modal-close {
  1792. border: 1px solid black;
  1793. }
  1794. /deep/.ivu-page-prev,
  1795. /deep/.ivu-page-next {
  1796. display: inline-block;
  1797. font-size: 0.5rem;
  1798. height: 1rem;
  1799. line-height: 1rem;
  1800. width: 1rem;
  1801. a {
  1802. font-size: 0.5rem;
  1803. }
  1804. }
  1805. /deep/.fullscreen-content-page {
  1806. display: flex;
  1807. justify-content: space-around;
  1808. }
  1809. .wide-screen-rowno {
  1810. display: flex;
  1811. justify-content: center !important;
  1812. span {
  1813. display: inline-block;
  1814. text-align: center;
  1815. width: 3rem;
  1816. height: 3rem;
  1817. line-height: 3rem;
  1818. border-radius: 50%;
  1819. font-size: 1.5rem;
  1820. }
  1821. .wide-screen-rowno-span-choosed {
  1822. color: #2d8cf0;
  1823. background-color: white;
  1824. }
  1825. .wide-screen-rowno-span {
  1826. color: white;
  1827. background-color: #2d8cf0;
  1828. }
  1829. }
  1830. .printRow{
  1831. display: none;
  1832. }
  1833. @media print {
  1834. .printRow{
  1835. display: block;
  1836. width: 100%;
  1837. margin-top: 10mm;
  1838. .printRow_content{
  1839. page-break-after: always;
  1840. }
  1841. }
  1842. @page{
  1843. margin:10mm 1mm
  1844. }
  1845. }
  1846. </style>