ChipPrintScreen.vue 58 KB

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