| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- import Common from '../common/Common';
- export const columns = [
- {
- title: '部门',
- dataIndex: 'organizationName',
- key: 'organizationName',
- width: 160,
- },
- {
- title: '保管人',
- dataIndex: 'depositoryUser',
- key: 'depositoryUser',
- width: 100,
- },
- {
- title: '资产名称',
- dataIndex: 'assetName',
- key: 'assetName',
- width: 120,
- },
- {
- title: '资产编号',
- dataIndex: 'assetNo',
- key: 'assetNo',
- width: 120,
- },
- {
- title: '二维码',
- dataIndex: 'barCode',
- key: 'barCode',
- width: 250,
- },
- {
- title: 'EPC',
- key: 'epc',
- dataIndex: 'epc',
- width: 140,
- },
- {
- title: '序号',
- key: 'printField',
- dataIndex: 'printField',
- width: 80,
- },
- {
- title: '标签类型',
- key: 'printField1',
- dataIndex: 'printField1',
- width: 180,
- },
- {
- title: '所属单位',
- key: 'printField2',
- dataIndex: 'printField2',
- width: 140,
- },
- {
- title: '图片',
- key: 'imageUrl',
- dataIndex: 'imageUrl',
- width: 150,
- },
- {
- title: '状态',
- key: 'labelPrintType',
- dataIndex: 'labelPrintType',
- width: 80,
- customCell: record => {
- if (record.labelPrintType === 'To_Be_Printed') {
- record.labelPrintType = '待打印';
- } else if (record.labelPrintType === 'Printing') {
- record.labelPrintType = '打印中';
- } else if (record.labelPrintType === 'Printed') {
- record.labelPrintType = '已打印';
- }
- },
- },
- {
- title: '打印次数',
- key: 'printCount',
- dataIndex: 'printCount',
- width: 75,
- },
- {
- title: '成本中心',
- dataIndex: 'costCenterName',
- key: 'costCenterName',
- width: 100,
- },
- {
- title: '公司',
- dataIndex: 'clientName',
- key: 'clientName',
- width: 120,
- },
- ].map(item => ({ ...item, align: 'center' }));
- // 图片上传
- export const multipleImageUpload = params => {
- var requestUrl = 'LabelPrintResource/multipleImageUpload';
- return new Promise((resolve, reject) => {
- $.ajax({
- url: Common.getApiURL(requestUrl),
- type: 'post',
- contentType: false,
- processData: false,
- data: params,
- beforeSend: function (request) {
- Common.addTokenToRequest(request);
- },
- success: function (data) {
- resolve(data);
- },
- error: function (XMLHttpRequest, textStatus, errorThrown) {
- reject(XMLHttpRequest);
- },
- });
- });
- };
- // 获取模板信息
- export const getTemplate = () => {
- var requestUrl = 'printPageResource/loadCustomerTemplateX6';
- return new Promise((resolve, reject) => {
- $.ajax({
- url: Common.getApiURL(requestUrl),
- type: 'get',
- dataType: 'json',
- beforeSend: function (request) {
- Common.addTokenToRequest(request);
- },
- success: function (data) {
- resolve(data);
- },
- error: function (XMLHttpRequest, textStatus, errorThrown) {
- reject(XMLHttpRequest);
- },
- });
- });
- };
- // 图片下载 zip
- export const downloadZip = params => {
- var requestUrl = 'LabelPrintResource/batchImageDownload';
- return new Promise((resolve, reject) => {
- $.ajax({
- url: Common.getApiURL(requestUrl),
- type: 'get',
- data: params,
- // dataType: 'octet-stream',
- beforeSend: function (request) {
- Common.addTokenToRequest(request);
- },
- success: function (data) {
- resolve(data);
- },
- error: function (XMLHttpRequest, textStatus, errorThrown) {
- reject(XMLHttpRequest);
- },
- });
- });
- };
- const plusZero = n => {
- return n > 10 ? n : '0' + n;
- };
- // 日期处理函数
- export const dateConvert = dateStr => {
- const date = new Date(dateStr);
- const year = date.getFullYear();
- const month = date.getMonth() + 1;
- const day = date.getDate();
- const hour = date.getHours();
- const minute = date.getMinutes();
- const second = date.getSeconds();
- return year + '-' + plusZero(month) + '-' + plusZero(day) + ' ' + plusZero(hour) + ':' + plusZero(minute) + ':' + plusZero(second);
- };
|