config.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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. // 图片上传
  98. export const multipleImageUpload = params => {
  99. var requestUrl = 'LabelPrintResource/multipleImageUpload';
  100. return new Promise((resolve, reject) => {
  101. $.ajax({
  102. url: Common.getApiURL(requestUrl),
  103. type: 'post',
  104. contentType: false,
  105. processData: false,
  106. data: params,
  107. beforeSend: function (request) {
  108. Common.addTokenToRequest(request);
  109. },
  110. success: function (data) {
  111. resolve(data);
  112. },
  113. error: function (XMLHttpRequest, textStatus, errorThrown) {
  114. reject(XMLHttpRequest);
  115. },
  116. });
  117. });
  118. };
  119. // 获取模板信息
  120. export const getTemplate = () => {
  121. var requestUrl = 'printPageResource/loadCustomerTemplateX6';
  122. return new Promise((resolve, reject) => {
  123. $.ajax({
  124. url: Common.getApiURL(requestUrl),
  125. type: 'get',
  126. dataType: 'json',
  127. beforeSend: function (request) {
  128. Common.addTokenToRequest(request);
  129. },
  130. success: function (data) {
  131. resolve(data);
  132. },
  133. error: function (XMLHttpRequest, textStatus, errorThrown) {
  134. reject(XMLHttpRequest);
  135. },
  136. });
  137. });
  138. };
  139. // 图片下载 zip
  140. export const downloadZip = params => {
  141. var requestUrl = 'LabelPrintResource/batchImageDownload';
  142. return new Promise((resolve, reject) => {
  143. $.ajax({
  144. url: Common.getApiURL(requestUrl),
  145. type: 'get',
  146. data: params,
  147. // dataType: 'octet-stream',
  148. beforeSend: function (request) {
  149. Common.addTokenToRequest(request);
  150. },
  151. success: function (data) {
  152. resolve(data);
  153. },
  154. error: function (XMLHttpRequest, textStatus, errorThrown) {
  155. reject(XMLHttpRequest);
  156. },
  157. });
  158. });
  159. };
  160. const plusZero = n => {
  161. return n > 10 ? n : '0' + n;
  162. };
  163. // 日期处理函数
  164. export const dateConvert = dateStr => {
  165. const date = new Date(dateStr);
  166. const year = date.getFullYear();
  167. const month = date.getMonth() + 1;
  168. const day = date.getDate();
  169. const hour = date.getHours();
  170. const minute = date.getMinutes();
  171. const second = date.getSeconds();
  172. return year + '-' + plusZero(month) + '-' + plusZero(day) + ' ' + plusZero(hour) + ':' + plusZero(minute) + ':' + plusZero(second);
  173. };