config.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. import Common from '../common/Common';
  2. export const columns = [
  3. {
  4. title: '部门',
  5. dataIndex: 'organizationName',
  6. key: 'organizationName',
  7. width: 160,
  8. },
  9. {
  10. title: '保管人',
  11. dataIndex: 'depositoryUser',
  12. key: 'depositoryUser',
  13. width: 100,
  14. },
  15. {
  16. title: '资产名称',
  17. dataIndex: 'assetName',
  18. key: 'assetName',
  19. width: 120,
  20. },
  21. {
  22. title: '资产编号',
  23. dataIndex: 'assetNo',
  24. key: 'assetNo',
  25. width: 120,
  26. },
  27. {
  28. title: '二维码',
  29. dataIndex: 'barCode',
  30. key: 'barCode',
  31. width: 250,
  32. },
  33. {
  34. title: 'EPC',
  35. key: 'epc',
  36. dataIndex: 'epc',
  37. width: 140,
  38. },
  39. {
  40. title: '序号',
  41. key: 'printField',
  42. dataIndex: 'printField',
  43. width: 80,
  44. },
  45. {
  46. title: '标签类型',
  47. key: 'printField1',
  48. dataIndex: 'printField1',
  49. width: 180,
  50. },
  51. {
  52. title: '所属单位',
  53. key: 'printField2',
  54. dataIndex: 'printField2',
  55. width: 140,
  56. },
  57. {
  58. title: '图片',
  59. key: 'imageUrl',
  60. dataIndex: 'imageUrl',
  61. width: 150,
  62. },
  63. {
  64. title: '状态',
  65. key: 'labelPrintType',
  66. dataIndex: 'labelPrintType',
  67. width: 80,
  68. customCell: record => {
  69. if (record.labelPrintType === 'To_Be_Printed') {
  70. record.labelPrintType = '待打印';
  71. } else if (record.labelPrintType === 'Printing') {
  72. record.labelPrintType = '打印中';
  73. } else if (record.labelPrintType === 'Printed') {
  74. record.labelPrintType = '已打印';
  75. }
  76. },
  77. },
  78. {
  79. title: '打印次数',
  80. key: 'printCount',
  81. dataIndex: 'printCount',
  82. width: 75,
  83. },
  84. {
  85. title: '成本中心',
  86. dataIndex: 'costCenterName',
  87. key: 'costCenterName',
  88. width: 100,
  89. },
  90. {
  91. title: '公司',
  92. dataIndex: 'clientName',
  93. key: 'clientName',
  94. width: 120,
  95. },
  96. ].map(item => ({ ...item, align: 'center' }));
  97. export const multipleImageUpload = params => {
  98. var requestUrl = 'LabelPrintResource/multipleImageUpload';
  99. return new Promise((resolve, reject) => {
  100. $.ajax({
  101. url: Common.getApiURL(requestUrl),
  102. type: 'post',
  103. contentType: false,
  104. processData: false,
  105. data: params,
  106. beforeSend: function (request) {
  107. Common.addTokenToRequest(request);
  108. },
  109. success: function (data) {
  110. resolve(data);
  111. },
  112. error: function (XMLHttpRequest, textStatus, errorThrown) {
  113. reject(XMLHttpRequest);
  114. },
  115. });
  116. });
  117. };
  118. export const getTemplate = () => {
  119. var requestUrl = 'printPageResource/loadCustomerTemplateX6';
  120. return new Promise((resolve, reject) => {
  121. $.ajax({
  122. url: Common.getApiURL(requestUrl),
  123. type: 'get',
  124. dataType: 'json',
  125. beforeSend: function (request) {
  126. Common.addTokenToRequest(request);
  127. },
  128. success: function (data) {
  129. resolve(data);
  130. },
  131. error: function (XMLHttpRequest, textStatus, errorThrown) {
  132. reject(XMLHttpRequest);
  133. },
  134. });
  135. });
  136. };
  137. const plusZero = n => {
  138. return n > 10 ? n : '0' + n;
  139. };
  140. // 日期处理函数
  141. export const dateConvert = dateStr => {
  142. const date = new Date(dateStr);
  143. const year = date.getFullYear();
  144. const month = date.getMonth() + 1;
  145. const day = date.getDate();
  146. const hour = date.getHours();
  147. const minute = date.getMinutes();
  148. const second = date.getSeconds();
  149. return year + '-' + plusZero(month) + '-' + plusZero(day) + ' ' + plusZero(hour) + ':' + plusZero(minute) + ':' + plusZero(second);
  150. };