AssetLabelPrint.vue 28 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001
  1. <template>
  2. <div>
  3. <Navbar
  4. :title="$t('lang.AssetLabelPrint.assetLabelPrint')"
  5. :is-go-back="false"
  6. />
  7. <div>
  8. <div class="form-inline" style="margin-top: 0px !important">
  9. <ul class="ulStyle">
  10. <li class="listStyle">
  11. <label class="labelStyle">所属部门</label>
  12. <div class="form-inline-div">
  13. <SearchWidget
  14. style="width: 200px"
  15. :info-window-no="organizationWindowNo"
  16. :field="organizationField"
  17. :field-value="organizationFieldValue"
  18. :display-name="organizationField.listDisplayFieldName"
  19. :where-clause-source="organizationWCS"
  20. @value-changed="organizationValueChanged"
  21. />
  22. </div>
  23. </li>
  24. <li class="listStyle">
  25. <label class="labelStyle">责任人</label>
  26. <div class="form-inline-div">
  27. <SearchWidget
  28. style="width: 200px"
  29. :info-window-no="userWindowNo"
  30. :field="custodianNameField"
  31. :field-value="custodianNameFieldValue"
  32. :display-name="custodianNameField.listDisplayFieldName"
  33. :where-clause-source="custodianIdWhereClauseSource"
  34. @value-changed="custodianNameValueChanged"
  35. />
  36. </div>
  37. </li>
  38. <li class="listStyle">
  39. <label class="labelStyle">保管人</label>
  40. <div class="form-inline-div">
  41. <SearchWidget
  42. style="width: 200px"
  43. :info-window-no="userWindowNo"
  44. :field="userField"
  45. :field-value="userFieldValue"
  46. :display-name="userField.listDisplayFieldName"
  47. :where-clause-source="custodianIdWhereClauseSource"
  48. @value-changed="userValueChanged"
  49. />
  50. </div>
  51. </li>
  52. <li class="listStyle">
  53. <label class="labelStyle">申购人</label>
  54. <div class="form-inline-div">
  55. <SearchWidget
  56. style="width: 200px"
  57. :info-window-no="userWindowNo"
  58. :field="applyPurchaseUserField"
  59. :field-value="applyPurchaseUserFieldValue"
  60. :display-name="applyPurchaseUserField.listDisplayFieldName"
  61. :where-clause-source="custodianIdWhereClauseSource"
  62. @value-changed="applyPurchaseUserValueChanged"
  63. />
  64. </div>
  65. </li>
  66. <li class="listStyle">
  67. <label class="labelStyle">资产名称</label>
  68. <div class="form-inline-div">
  69. <a-input
  70. v-model:value="searchParams.assetInstanceName"
  71. style="width: 200px"
  72. />
  73. </div>
  74. </li>
  75. <li class="listStyle">
  76. <label class="labelStyle">资产编号</label>
  77. <div class="form-inline-div">
  78. <a-input
  79. v-model:value="searchParams.assetNo"
  80. style="width: 200px"
  81. />
  82. </div>
  83. </li>
  84. <li class="listStyle">
  85. <label class="labelStyle">规格型号</label>
  86. <div class="form-inline-div">
  87. <a-input v-model:value="searchParams.type" style="width: 200px" />
  88. </div>
  89. </li>
  90. <li class="listStyle">
  91. <label class="labelStyle">epc</label>
  92. <div class="form-inline-div">
  93. <a-input v-model:value="searchParams.epc" style="width: 200px" />
  94. </div>
  95. </li>
  96. <li class="listStyle">
  97. <label class="labelStyle">{{
  98. $t("lang.AssetLabelPrint.printStatus")
  99. }}</label>
  100. <div class="form-inline-div">
  101. <select
  102. v-model="searchParams.printStatus"
  103. class="form-control m-form-input"
  104. style="width: 15em"
  105. >
  106. <option value="">{{ $t("lang.AssetLabelPrint.all") }}</option>
  107. <option value="false">
  108. {{ $t("lang.AssetLabelPrint.notPrint") }}
  109. </option>
  110. <option value="true">
  111. {{ $t("lang.AssetLabelPrint.havePrint") }}
  112. </option>
  113. </select>
  114. </div>
  115. </li>
  116. </ul>
  117. </div>
  118. <div style="display: flex">
  119. <div style="margin-left: 18px">
  120. <button class="btn btn-default m-btn" @click="reQuery()">
  121. {{ $t("lang.AssetLabelPrint.query") }}
  122. </button>
  123. <button class="btn btn-default m-btn" @click="clearFilter()">
  124. {{ $t("lang.AssetLabelPrint.clear") }}
  125. </button>
  126. </div>
  127. </div>
  128. <div class="form-inline" style="margin-top: 0px !important">
  129. <div class="form-group m-form-group">
  130. <label for="assetNo" class="m-form-group-label" style="width: 100px;padding: 8px;">{{
  131. $t("lang.AssetLabelPrint.selectPrintTemplate")
  132. }}</label>
  133. <div class="form-inline-div">
  134. <select
  135. v-model="templateId"
  136. class="form-control m-form-input"
  137. style="width: 15em"
  138. >
  139. <option value="" />
  140. <option
  141. v-for="item in templates"
  142. :key="'templates' + item.name"
  143. :value="item.id"
  144. >
  145. {{ item.name }}
  146. </option>
  147. </select>
  148. </div>
  149. </div>
  150. <div class="form-group m-form-group">
  151. <label for="selectPrinter" class="m-form-group-label" style="width: 100px;padding: 8px;">{{
  152. $t("lang.AssetLabelPrint.selectPrinter")
  153. }}</label>
  154. <div class="form-inline-div">
  155. <select
  156. v-model="selectedPrinter"
  157. class="form-control m-form-input"
  158. style="width: 15em"
  159. >
  160. <option value="" />
  161. <option
  162. v-for="printer in printers"
  163. :key="printer.name"
  164. :value="printer.name"
  165. >
  166. {{ printer.name }}
  167. </option>
  168. </select>
  169. </div>
  170. </div>
  171. <div class="form-group m-form-group">
  172. <button class="btn btn-default m-btn" @click="print()">
  173. {{ $t("lang.AssetLabelPrint.print") }}
  174. </button>
  175. </div>
  176. <div class="form-group m-form-group">
  177. <PrintEpc
  178. ref="printEpc"
  179. v-model:visible="printEpcVisible"
  180. :printer-name="selectedPrinterCard"
  181. @ok="closePrintEpc"
  182. />
  183. <button class="btn btn-default m-btn" @click="cardEpc()">发卡</button>
  184. </div>
  185. </div>
  186. </div>
  187. <div class="grid-item-3">
  188. <table class="fixed-table table table-striped table-bordered">
  189. <thead>
  190. <tr>
  191. <td style="width: 50px">
  192. {{ $t("lang.AssetLabelPrint.serialNumber") }}
  193. </td>
  194. <th style="width: 30px">
  195. <input v-model="checked" type="checkbox" @change="selectAll()" />
  196. </th>
  197. <td style="width: 100px">部门</td>
  198. <td style="width: 100px">责任人</td>
  199. <td style="width: 100px">保管人</td>
  200. <td style="width: 100px">申购人</td>
  201. <td style="width: 150px">资产名称</td>
  202. <td style="width: 150px">资产编号</td>
  203. <td style="width: 150px">规格型号</td>
  204. <td style="width: 150px">使用状态</td>
  205. <td style="width: 220px">epc</td>
  206. <td style="width: 100px">打印状态</td>
  207. </tr>
  208. </thead>
  209. <tbody>
  210. <tr v-for="(item, index) in assetInstanceDtoList" :key="item.id">
  211. <td>
  212. {{
  213. index + 1 + (pagination.current_page - 1) * pagination.per_page
  214. }}
  215. </td>
  216. <td>
  217. <input
  218. v-model="item.checked"
  219. type="checkbox"
  220. @change="templateChange(item.id)"
  221. />
  222. </td>
  223. <td>{{ item.organizationName }}</td>
  224. <td>{{ item.custodianName }}</td>
  225. <td>{{ item.depositoryUserName }}</td>
  226. <td>{{ item.applyPurchaseUserName }}</td>
  227. <td>{{ item.assetInstanceName }}</td>
  228. <td>{{ item.assetNo }}</td>
  229. <td>{{ item.type }}</td>
  230. <td>{{ item.useStatusName }}</td>
  231. <td>{{ item.epc }}</td>
  232. <td>{{ item.printStatus == true ? "已打印" : "未打印" }}</td>
  233. </tr>
  234. </tbody>
  235. </table>
  236. </div>
  237. <div class="grid-item-4">
  238. <div class="m-row">
  239. <div class="col-md-12 col-sm-12 col-xs-12">
  240. <div class="table-header-left">
  241. <span>{{ $t("lang.AssetInstancePrint.the")
  242. }}{{ (pagination.current_page - 1) * pagination.per_page + 1 }}-{{
  243. pagination.current_page * pagination.per_page
  244. }}{{ $t("lang.AssetInstancePrint.strip") }},{{
  245. $t("lang.AssetInstancePrint.total")
  246. }}{{ pagination.total
  247. }}{{ $t("lang.AssetInstancePrint.strip") }},{{
  248. $t("lang.AssetInstancePrint.displayOnEachPage")
  249. }}</span>
  250. <PageSizeSelect @page-size-changed="gridSizeSelect" />
  251. <span>{{ $t("lang.AssetInstancePrint.strip") }}</span>
  252. </div>
  253. <div class="table-header-right">
  254. <VueBootstrapPagination
  255. :pagination="pagination"
  256. :callback="getAssetInstancePrint"
  257. />
  258. </div>
  259. </div>
  260. </div>
  261. </div>
  262. <Loading v-if="loading" />
  263. </div>
  264. </template>
  265. <script>
  266. import { Common, PrintUtil, Notify, PrintEpc } from 'pc-component-v3';
  267. export default {
  268. components: {
  269. PrintEpc,
  270. },
  271. data: function () {
  272. return {
  273. assetInstanceDtoList: [],
  274. checked: false, //全选,
  275. pagination: {
  276. total: 0, //总页数
  277. per_page: 20, // 每页大小
  278. current_page: 1, // 当前页数
  279. last_page: 0, // 最后一页编号
  280. },
  281. // 请求查询参数
  282. searchParams: {
  283. epc: null, // epc
  284. assetNo: null, // 资产编号
  285. assetInstanceName: null, // 资产名称
  286. printStatus: null, // 打印状态
  287. type: null, // 使用状态
  288. organizationId: null, // 部门id
  289. custodianId: null, //责任人id
  290. depositoryUserId: null, //保管人id
  291. applyPurchaseUserId: null, //申购人id
  292. },
  293. userWindowNo: '050408',
  294. organizationWindowNo: '20220420_233656',
  295. organizationField: {
  296. name: '',
  297. listDisplayFieldName: 'name',
  298. },
  299. organizationFieldValue: {
  300. id: null,
  301. displayValue: [''],
  302. fieldType: 'Key',
  303. },
  304. custodianNameField: {
  305. name: '',
  306. listDisplayFieldName: 'name',
  307. },
  308. custodianNameFieldValue: {
  309. id: null,
  310. displayValue: [''],
  311. fieldType: 'Key',
  312. },
  313. userField: {
  314. name: '',
  315. listDisplayFieldName: 'name',
  316. },
  317. userFieldValue: {
  318. id: null,
  319. displayValue: [''],
  320. fieldType: 'Key',
  321. },
  322. applyPurchaseUserField: {
  323. name: '',
  324. listDisplayFieldName: 'name',
  325. },
  326. applyPurchaseUserFieldValue: {
  327. id: null,
  328. displayValue: [''],
  329. fieldType: 'Key',
  330. },
  331. organizationWCS: {
  332. customerDataDimensions: [
  333. {
  334. fieldName: 'client.id',
  335. dataDimensionTypeNo: '202201191757',
  336. defaultDataDimensionTypeValueNo: '4',
  337. },
  338. ],
  339. },
  340. custodianIdWhereClauseSource: {
  341. customerDataDimensions: [
  342. {
  343. fieldName: 'client.id',
  344. dataDimensionTypeNo: '202201191757',
  345. defaultDataDimensionTypeValueNo: '4',
  346. },
  347. ],
  348. },
  349. templates: [], //打印模板
  350. printers: [], //打印机
  351. selectedPrinter: '', // 选择的打印机
  352. templateId: '',
  353. printPages: [],
  354. printPreviews: [],
  355. loading: false,
  356. modal: false,
  357. selectedPrinterCard: '发卡机',
  358. printEpcVisible: false,
  359. };
  360. },
  361. computed: {},
  362. watch: {},
  363. /**
  364. * 冻结表头
  365. */
  366. fixedTableHeader: function () {
  367. let _self = this;
  368. _self.$nextTick(function () {
  369. $('.fixed-table').tableFixer({
  370. left: 0,
  371. head: true,
  372. });
  373. });
  374. },
  375. mounted: function () {
  376. const _self = this;
  377. // $('.fixed-table').tableFixer({
  378. // 'left': 0,
  379. // 'head': true,
  380. // });
  381. // $('.fixed-table').colResizable({
  382. // resizeMode: 'overflow',
  383. // partialRefresh: true,
  384. // });
  385. _self.pagination.current_page = 1;
  386. _self.getAssetInstancePrint();
  387. _self.loadTemplateData();
  388. PrintUtil.getPrinters().then(
  389. successData => {
  390. if (successData != null && successData.length > 0) {
  391. successData.forEach(item => {
  392. _self.printers.push(item);
  393. });
  394. }
  395. },
  396. errorData => {
  397. console.log(errorData);
  398. },
  399. );
  400. },
  401. beforeUnmount: function () {},
  402. methods: {
  403. // 所属部门搜索框条件改变
  404. organizationValueChanged: function (newFieldValue) {
  405. this.organizationFieldValue = newFieldValue;
  406. this.searchParams.organizationId = newFieldValue.id;
  407. },
  408. // 责任人
  409. custodianNameValueChanged: function (newFieldValue) {
  410. this.custodianNameFieldValue = newFieldValue;
  411. this.searchParams.custodianId = newFieldValue.id;
  412. },
  413. // 保管人
  414. userValueChanged: function (newFieldValue) {
  415. this.userFieldValue = newFieldValue;
  416. this.searchParams.depositoryUserId = newFieldValue.id;
  417. },
  418. // 申购人
  419. applyPurchaseUserValueChanged: function (newFieldValue) {
  420. this.applyPurchaseUserFieldValue = newFieldValue;
  421. this.searchParams.applyPurchaseUserId = newFieldValue.id;
  422. },
  423. /**
  424. * 获取选择数据的id集合
  425. */
  426. getSelectedRecordIds: function () {
  427. const _self = this;
  428. let recordIds = [];
  429. for (let i = 0; i < _self.assetInstanceDtoList.length; i++) {
  430. if (_self.assetInstanceDtoList[i].checked == true) {
  431. recordIds.push(_self.assetInstanceDtoList[i].assetInstanceId);
  432. }
  433. }
  434. return recordIds;
  435. },
  436. getPrintData: function (recordIds) {
  437. const _self = this;
  438. let contents = [];
  439. $.ajax({
  440. url: Common.getApiURL(
  441. 'AssetInstanceResource/print?printPreview=' +
  442. false +
  443. '&templateId=' +
  444. _self.templateId,
  445. ),
  446. dataType: 'json',
  447. type: 'post',
  448. contentType: 'application/json',
  449. data: JSON.stringify(recordIds),
  450. beforeSend: function (request) {
  451. Common.addTokenToRequest(request);
  452. _self.loading = true;
  453. },
  454. success: function (datas) {
  455. datas.forEach(function (item) {
  456. var printItem = {
  457. id: null,
  458. name: null,
  459. content: item,
  460. };
  461. if (
  462. printItem.content == null ||
  463. printItem.content.printItems == null ||
  464. printItem.content.printItems.length == 0
  465. ) {
  466. Notify.error('错误', '打印模板无数据,不能打印。');
  467. return;
  468. }
  469. var content = JSON.stringify(printItem.content);
  470. if (content == null || content == '' || content == '{}') {
  471. Notify.error('错误', '请先选择模板,再点击下载。');
  472. return;
  473. }
  474. contents.push(printItem.content);
  475. });
  476. _self.loading = false;
  477. },
  478. error: function (XMLHttpRequest, textStatus, errorThrown) {
  479. _self.loading = false;
  480. Common.processException(XMLHttpRequest, textStatus, errorThrown);
  481. },
  482. });
  483. },
  484. /**
  485. * 打印文件
  486. */
  487. print: function () {
  488. const _self = this;
  489. let selectedPrinter = _self.selectedPrinter;
  490. if (selectedPrinter == null || selectedPrinter.length == 0) {
  491. Notify.error('提示', '请先选择打印机。', false);
  492. return;
  493. }
  494. let recordIds = _self.getSelectedRecordIds();
  495. if (recordIds == null || recordIds.length == 0) {
  496. Notify.error('提示', '请先选择打印数据。', false);
  497. return;
  498. }
  499. let contents = [];
  500. $.ajax({
  501. url: Common.getApiURL(
  502. 'AssetInstanceResource/print?printPreview=' +
  503. false +
  504. '&templateId=' +
  505. _self.templateId,
  506. ),
  507. dataType: 'json',
  508. type: 'post',
  509. contentType: 'application/json',
  510. data: JSON.stringify(recordIds),
  511. beforeSend: function (request) {
  512. Common.addTokenToRequest(request);
  513. _self.loading = true;
  514. },
  515. success: function (datas) {
  516. datas.forEach(function (item) {
  517. var printItem = {
  518. id: null,
  519. name: null,
  520. content: item,
  521. };
  522. if (
  523. printItem.content == null ||
  524. printItem.content.printItems == null ||
  525. printItem.content.printItems.length == 0
  526. ) {
  527. Notify.error('错误', '打印模板无数据,不能打印。');
  528. return;
  529. }
  530. var content = JSON.stringify(printItem.content);
  531. if (content == null || content == '' || content == '{}') {
  532. Notify.error('错误', '请先选择模板,再点击下载。');
  533. return;
  534. }
  535. contents.push(printItem.content);
  536. });
  537. PrintUtil.printPrintPages(contents, selectedPrinter).then(
  538. success => {
  539. // 补充提示信息
  540. console.log(success);
  541. },
  542. error => {
  543. // 补充提示信息
  544. console.log(error);
  545. },
  546. );
  547. _self.loading = false;
  548. },
  549. error: function (XMLHttpRequest, textStatus, errorThrown) {
  550. _self.loading = false;
  551. Common.processException(XMLHttpRequest, textStatus, errorThrown);
  552. },
  553. });
  554. },
  555. cardEpc: function () {
  556. const _self = this;
  557. let recordIds = _self.getSelectedRecordIds();
  558. if (recordIds == null || recordIds.length == 0) {
  559. Notify.error('提示', '请先选择发卡数据。', false);
  560. return;
  561. }
  562. if (recordIds.length > 1) {
  563. Notify.error('提示', '请先选择至多一条发卡数据。', false);
  564. return;
  565. }
  566. let contents = [];
  567. let contentCards = [];
  568. $.ajax({
  569. url: Common.getApiURL(
  570. 'AssetInstanceResource/print?printPreview=' +
  571. false +
  572. '&templateId=' +
  573. _self.templateId,
  574. ),
  575. dataType: 'json',
  576. type: 'post',
  577. contentType: 'application/json',
  578. data: JSON.stringify(recordIds),
  579. beforeSend: function (request) {
  580. Common.addTokenToRequest(request);
  581. _self.loading = true;
  582. },
  583. success: function (datas) {
  584. datas.forEach(function (item) {
  585. var printItem = {
  586. id: null,
  587. name: null,
  588. content: item,
  589. };
  590. if (
  591. printItem.content == null ||
  592. printItem.content.printItems == null ||
  593. printItem.content.printItems.length == 0
  594. ) {
  595. Notify.error('错误', '打印模板无数据,不能打印。');
  596. return;
  597. }
  598. var content = JSON.stringify(printItem.content);
  599. if (content == null || content == '' || content == '{}') {
  600. Notify.error('错误', '请先选择模板,再点击下载。');
  601. return;
  602. }
  603. contents.push(printItem.content);
  604. });
  605. _self.printEpcVisible = true;
  606. _self.$refs.printEpc.printPrintPages(contents);
  607. _self.loading = false;
  608. },
  609. error: function (XMLHttpRequest, textStatus, errorThrown) {
  610. _self.loading = false;
  611. Common.processException(XMLHttpRequest, textStatus, errorThrown);
  612. },
  613. });
  614. },
  615. closePrintEpc: function () {
  616. const _self = this;
  617. _self.printEpcVisible = false;
  618. },
  619. /**
  620. * 打印模板change
  621. */
  622. templateChange: function (assetInstanceId) {
  623. const _self = this;
  624. let templateId = _self.templateId;
  625. if (templateId == '' || templateId == null) {
  626. _self.templateId = '';
  627. Notify.error('错误', '未请先选择打印模板', false);
  628. return;
  629. }
  630. // let selectedPrinter = _self.selectedPrinter;
  631. // if (selectedPrinter == null || selectedPrinter.length == 0) {
  632. // Notify.error("提示", "请先选择打印机。", false);
  633. // return;
  634. // }
  635. this.setTemplate(assetInstanceId, _self.templateId);
  636. },
  637. /**
  638. * 设置模板
  639. */
  640. setTemplate: function (assetInstanceId, templateId) {
  641. var _self = this;
  642. _self.loading = true;
  643. $.ajax({
  644. url: Common.getApiURL('AssetInstanceResource/setPrintTemplate'),
  645. type: 'get',
  646. beforeSend: function (request) {
  647. Common.addTokenToRequest(request);
  648. },
  649. data: {
  650. assetInstanceId: assetInstanceId,
  651. templateId: templateId,
  652. },
  653. success: function (data) {
  654. _self.loading = false;
  655. },
  656. error: function (XMLHttpRequest, textStatus, errorThrown) {
  657. _self.loading = false;
  658. Common.processException(XMLHttpRequest, textStatus, errorThrown);
  659. },
  660. });
  661. },
  662. /**
  663. * 加载打印模板数据
  664. */
  665. loadTemplateData: function () {
  666. var _self = this;
  667. $.ajax({
  668. url: Common.getApiURL('printPageResource/loadCustomerTemplate'),
  669. type: 'get',
  670. dataType: 'json',
  671. beforeSend: function (request) {
  672. Common.addTokenToRequest(request);
  673. },
  674. success: function (baseListResponse) {
  675. if (baseListResponse.errorCode == 0) {
  676. if (
  677. baseListResponse.datas != undefined &&
  678. baseListResponse.datas.length > 0
  679. ) {
  680. baseListResponse.datas.forEach(function (item) {
  681. item.label = item.name;
  682. item.value = item.id;
  683. });
  684. }
  685. _self.templates = baseListResponse.datas;
  686. }
  687. },
  688. error: function (XMLHttpRequest, textStatus, errorThrown) {
  689. Common.processException(XMLHttpRequest, textStatus, errorThrown);
  690. },
  691. });
  692. },
  693. /**
  694. * 20200615
  695. * 点击全选
  696. */
  697. selectAll: function () {
  698. var _self = this;
  699. for (var i = 0; i < _self.assetInstanceDtoList.length; i++) {
  700. _self.assetInstanceDtoList[i].checked = _self.checked;
  701. }
  702. },
  703. /**
  704. * 重新查询
  705. */
  706. reQuery: function () {
  707. let _self = this;
  708. _self.pagination.current_page = 1;
  709. _self.getAssetInstancePrint();
  710. },
  711. /**
  712. * 查询资产卡片打印的数据
  713. */
  714. getAssetInstancePrint: function () {
  715. var _self = this;
  716. _self.loading = true;
  717. _self.checked = false;
  718. const range = {
  719. start: (_self.pagination.current_page - 1) * _self.pagination.per_page,
  720. length: _self.pagination.per_page,
  721. };
  722. const searchParams = _self.searchParams;
  723. const params = { ...searchParams, ...{ range } };
  724. $.ajax({
  725. url: Common.getApiURL(
  726. 'AssetInstancePrintResource/findByAssetInstancePrintRequest',
  727. ),
  728. type: 'post',
  729. contentType: 'application/json',
  730. dataType: 'json',
  731. data: JSON.stringify(params),
  732. beforeSend: function (request) {
  733. Common.addTokenToRequest(request);
  734. },
  735. success: function (successData) {
  736. if (successData.errorCode == 0) {
  737. _self.assetInstanceDtoList = successData.datas;
  738. _self.assetInstanceDtoList.forEach(function (item) {
  739. item.checked = false;
  740. });
  741. _self.pagination.total = successData.total;
  742. _self.pagination.last_page = Math.ceil(
  743. successData.total / successData.length,
  744. );
  745. }
  746. _self.loading = false;
  747. },
  748. error: function (XMLHttpRequest, textStatus, errorThrown) {
  749. Common.processException(XMLHttpRequest, textStatus, errorThrown);
  750. _self.loading = false;
  751. },
  752. });
  753. },
  754. /**
  755. * 清空条件
  756. */
  757. clearFilter: function () {
  758. const _self = this;
  759. (_self.searchParams = {
  760. epc: null,
  761. assetNo: null,
  762. assetInstanceName: null,
  763. printStatus: null,
  764. type: null,
  765. organizationId: null,
  766. custodianId: null,
  767. depositoryUserId: null,
  768. applyPurchaseUserId: null,
  769. }),
  770. (_self.organizationFieldValue = {});
  771. _self.custodianNameFieldValue = {};
  772. _self.userFieldValue = {};
  773. _self.applyPurchaseUserFieldValue = {};
  774. _self.reQuery();
  775. },
  776. /**
  777. * 修改页Size
  778. */
  779. gridSizeSelect: function (newPageSize) {
  780. this.pagination.per_page = newPageSize;
  781. this.pagination.current_page = 1;
  782. this.getAssetInstancePrint();
  783. },
  784. },
  785. };
  786. </script>
  787. <style scoped>
  788. .grid-container {
  789. display: grid;
  790. grid-template-columns: 100%;
  791. /*将视图分为四个模块,每个模块的高度*/
  792. grid-template-rows: 53px min-content auto 40px;
  793. /*视口被均分为 100 单位的 vh 占据整个窗口,扣掉顶部 topNav 的距离后,计算得到 responseOrgnizationSelect 的高度*/
  794. height: calc(100vh - 90px);
  795. width: 100%;
  796. overflow: hidden;
  797. }
  798. .grid-item-1 {
  799. grid-column: 1 / 2;
  800. grid-row: 1 / 2;
  801. }
  802. .grid-item-2 {
  803. grid-column: 1 / 2;
  804. grid-row: 2 / 3;
  805. }
  806. .grid-item-3 {
  807. padding-top: 0px;
  808. padding-right: 10px;
  809. overflow: hidden;
  810. grid-column: 1 / 2;
  811. grid-row: 3/4;
  812. height: 100%;
  813. }
  814. .grid-item-4 {
  815. padding-top: 10px;
  816. grid-column: 1 / 2;
  817. grid-row: 4/5;
  818. }
  819. </style>
  820. <style scoped>
  821. .fixed-table {
  822. table-layout: fixed;
  823. width: 800px !important;
  824. min-width: 800px !important;
  825. border-top: 1px solid #ddd;
  826. }
  827. table.fixed-table tr {
  828. height: 40px;
  829. font-size: small;
  830. }
  831. table.fixed-table th,
  832. table.fixed-table td {
  833. overflow: hidden;
  834. white-space: nowrap;
  835. text-overflow: ellipsis;
  836. border: 1px solid #ddd;
  837. }
  838. </style>
  839. <style scoped>
  840. .m-form-group {
  841. margin-left: 5px !important;
  842. margin-right: 5px !important;
  843. margin-bottom: 5px !important;
  844. }
  845. @media (max-width: 768px) {
  846. .m-form-group-label {
  847. text-align: left;
  848. padding-right: 10px;
  849. }
  850. }
  851. @media (min-width: 768px) {
  852. .m-form-group-label {
  853. width: 100px;
  854. text-align: center;
  855. padding-right: 10px;
  856. }
  857. .input-switches {
  858. width: 100%;
  859. }
  860. }
  861. .form-control-complex {
  862. width: 200px !important;
  863. }
  864. .form-input {
  865. border-radius: 4px !important;
  866. }
  867. .m-form-input {
  868. border-radius: 4px !important;
  869. width: 200px !important;
  870. }
  871. .form-inline-div {
  872. display: inline-block;
  873. height: 34px;
  874. }
  875. .m-btn {
  876. margin-left: 5px !important;
  877. margin-right: 5px !important;
  878. margin-bottom: 5px !important;
  879. }
  880. .table-header-left {
  881. float: left;
  882. /* margin: 20px 0;*/
  883. }
  884. .table-header-right {
  885. float: right;
  886. }
  887. </style>
  888. <style scoped>
  889. .room_img {
  890. width: 150px;
  891. height: 100px;
  892. float: left;
  893. margin-right: 10px;
  894. }
  895. .room_img img {
  896. width: 100%;
  897. height: 100%;
  898. }
  899. .room_img span {
  900. position: relative;
  901. right: -130px;
  902. top: -100px;
  903. font-size: 20px;
  904. color: red;
  905. }
  906. .modal-img-box {
  907. width: 100%;
  908. height: 400px;
  909. text-align: center;
  910. overflow: auto;
  911. }
  912. .m-small-img {
  913. cursor: pointer;
  914. }
  915. .m-img {
  916. width: 100%;
  917. }
  918. .labelStyle {
  919. width: 100px;
  920. text-align: center;
  921. padding: 8px;
  922. }
  923. .ulStyle {
  924. width: 100%;
  925. display: flex;
  926. flex-direction: row;
  927. flex-wrap: wrap;
  928. margin: 0;
  929. padding: 0;
  930. }
  931. .listStyle {
  932. width: 32%;
  933. margin-top: 8px;
  934. list-style: none;
  935. }
  936. </style>