| | |
| | | var baseUrl = "/crm"; |
| | | // var baseUrl = "/crm"; |
| | | var baseUrl = ""; |
| | | |
| | | // 详情窗口-高度 |
| | | var detailHeight = '80%'; |
| | |
| | | var s = time.getSeconds(); |
| | | s = s < 10 ? ("0" + s) : s; |
| | | return y + "-" + M + "-" + d + " " + h + ":" + m + ":" + s; |
| | | } |
| | | |
| | | // 时间 ==>> 字符串 |
| | | function dateToStr2(date) { |
| | | var time = new Date(date); |
| | | var y = time.getFullYear(); |
| | | var M = time.getMonth() + 1; |
| | | M = M < 10 ? ("0" + M) : M; |
| | | var d = time.getDate(); |
| | | d = d < 10 ? ("0" + d) : d; |
| | | var h = time.getHours(); |
| | | h = h < 10 ? ("0" + h) : h; |
| | | var m = time.getMinutes(); |
| | | m = m < 10 ? ("0" + m) : m; |
| | | var s = time.getSeconds(); |
| | | s = s < 10 ? ("0" + s) : s; |
| | | return y + "" + "" + M + "" + d + "" + h + "" + "" + m + "" + s; |
| | | } |
| | | |
| | | // 字符串 ===>> 时间 |
| | |
| | | }) : "object" == typeof module && module.exports ? module.exports = http : n.http = http |
| | | }(this); |
| | | |
| | | function requireTip(el) { |
| | | let oldBorderByCss = el.css("border"); |
| | | el.css("border", "1px solid #FF5722"); |
| | | setTimeout(function () { |
| | | el.css("border", oldBorderByCss); |
| | | }, 2000) |
| | | } |
| | | |
| | | function arrRemove(arr, key, val) { |
| | | for(var i=arr.length-1; i>=0; i--){ |
| | |
| | | } |
| | | } |
| | | |
| | | var matCols = [ |
| | | {field: 'matnr', align: 'center',title: '商品编号', width: 180} |
| | | ,{field: 'maktx', align: 'center',title: '商品名称', width: 200} |
| | | ,{field: 'name', align: 'center',title: '名称', hide: true} |
| | | ,{field: 'specs', align: 'center',title: '规格'} |
| | | ,{field: 'model', align: 'center',title: '型号', hide: true} |
| | | ,{field: 'unit', align: 'center',title: '单位', hide: true} |
| | | ,{field: 'barcode', align: 'center',title: 'SKC',hide: true} |
| | | // ,{field: 'docId', align: 'center',title: '单据类型', hide: true} |
| | | // ,{field: 'docNum', align: 'center',title: '单据编号', hide: true} |
| | | ,{field: 'custName', align: 'center',title: '客户名称', hide: true} |
| | | ,{field: 'itemNum', align: 'center',title: '品项数', hide: true} |
| | | ,{field: 'count', align: 'center',title: '数量', hide: true} |
| | | ,{field: 'price', align: 'center',title: '单价'} |
| | | ,{field: 'weight', align: 'center',title: '重量', hide: true} |
| | | // ,{field: 'status', align: 'center',title: '状态'} |
| | | // ,{field: 'createBy$', align: 'center',title: '添加人员'} |
| | | // ,{field: 'createTime$', align: 'center',title: '添加时间'} |
| | | // ,{field: 'updateBy$', align: 'center',title: '修改人员'} |
| | | // ,{field: 'updateTime$', align: 'center',title: '修改时间'} |
| | | ,{field: 'memo', align: 'center',title: '备注', hide: true} |
| | | ] |
| | | |
| | | var detlCols = [ |
| | | {field: 'matnr', align: 'center',title: '商品编号', width: 180} |
| | | ,{field: 'maktx', align: 'center',title: '商品名称', width: 200} |
| | | ,{field: 'anfme', align: 'center',title: '库存数量', style: 'font-weight: bold'} |
| | | ,{field: 'name', align: 'center',title: '名称', hide: true} |
| | | ,{field: 'specs', align: 'center',title: '规格'} |
| | | ,{field: 'model', align: 'center',title: '型号', hide: true} |
| | | ,{field: 'batch', align: 'center',title: '批号'} |
| | | ,{field: 'unit', align: 'center',title: '单位', hide: true} |
| | | ,{field: 'barcode', align: 'center',title: 'SKC',hide: true} |
| | | ,{field: 'docId', align: 'center',title: '单据类型', hide: true} |
| | | ,{field: 'docNum', align: 'center',title: '单据编号', hide: true} |
| | | ,{field: 'custName', align: 'center',title: '客户名称', hide: true} |
| | | ,{field: 'itemNum', align: 'center',title: '品项数', hide: true} |
| | | ,{field: 'count', align: 'center',title: '数量', hide: true} |
| | | ,{field: 'price', align: 'center',title: '单价', hide: true} |
| | | ,{field: 'weight', align: 'center',title: '重量', hide: true} |
| | | ,{field: 'zpallet', align: 'center',title: '托盘码'} |
| | | // ,{field: 'createBy$', align: 'center',title: '添加人员'} |
| | | // ,{field: 'createTime$', align: 'center',title: '添加时间'} |
| | | // ,{field: 'updateBy$', align: 'center',title: '修改人员'} |
| | | // ,{field: 'updateTime$', align: 'center',title: '修改时间'} |
| | | ,{field: 'memo', align: 'center',title: '备注', hide: true} |
| | | ] |
| | | |
| | | |
| | | var popupRight; |
| | | var cstmrByMore; |
| | | var orderByMore; |
| | | var planByMore; |
| | | var priQuoteByMore; |
| | | var reimburseOnlineByMore; |
| | | |
| | | function getQueryVariable(variable) |
| | | { |
| | | var query = window.location.search.substring(1); |
| | | var vars = query.split("&"); |
| | | for (var i=0;i<vars.length;i++) { |
| | | var pair = vars[i].split("="); |
| | | if(pair[0] == variable){return pair[1];} |
| | | } |
| | | return(false); |
| | | } |
| | | var businessTripByMore; |
| | | var priOnlineByMore; |
| | | var priSalesByMore; |
| | | var priQuoteBudgetByMore; |
| | | var contractByMore; |
| | | |
| | | |
| | | function getOssClient() { |
| | | // const client = new OSS({ |
| | | // // yourRegion填写Bucket所在地域。以华东1(杭州)为例,yourRegion填写为oss-cn-hangzhou。 |
| | | // region: "", |
| | | // // 从STS服务获取的临时访问密钥(AccessKey ID和AccessKey Secret)。 |
| | | // accessKeyId: "", |
| | | // accessKeySecret: "", |
| | | // // 从STS服务获取的安全令牌(SecurityToken)。 |
| | | // // stsToken: "yourSecurityToken", |
| | | // // 填写Bucket名称。 |
| | | // bucket: "", |
| | | // }); |
| | | |
| | | let data |
| | | $.ajax({ |
| | | url: baseUrl + "/open/getOssClient", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: {}, |
| | | method: 'POST', |
| | | async: false, |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | data = res.data; |
| | | } |
| | | } |
| | | }); |
| | | return new OSS(data); |
| | | } |
| | | |
| | | //上传文件至OSS |
| | | async function putObject(file, uploadProgress) { |
| | | var client = getOssClient() |
| | | if (client == null) { |
| | | return false; |
| | | } |
| | | |
| | | var filename = dateToStr2(new Date()) + "_" + file.name |
| | | |
| | | // // 填写Object完整路径。Object完整路径中不能包含Bucket名称。 |
| | | // // 您可以通过自定义文件名(例如exampleobject.txt)或文件完整路径(例如exampledir/exampleobject.txt)的形式实现将数据上传到当前Bucket或Bucket中的指定目录。 |
| | | // // data对象可以自定义为file对象、Blob数据或者OSS Buffer。 |
| | | // const options = { |
| | | // meta: {temp: "demo"}, |
| | | // mime: "json", |
| | | // headers: {"Content-Type": "text/plain"}, |
| | | // }; |
| | | // |
| | | // return await client.put(filename, file, options); |
| | | |
| | | const options = { |
| | | // 获取分片上传进度、断点和返回值。 |
| | | progress: (p, cpt, res) => { |
| | | // console.log(p); |
| | | uploadProgress(p)//回调上传进度 |
| | | }, |
| | | // 设置并发上传的分片数量。 |
| | | parallel: 4, |
| | | // 设置分片大小。默认值为1 MB,最小值为100 KB。 |
| | | partSize: 1024 * 1024, |
| | | // headers, |
| | | // 自定义元数据,通过HeadObject接口可以获取Object的元数据。 |
| | | meta: {year: 2020, people: "test"}, |
| | | mime: "text/plain", |
| | | }; |
| | | |
| | | return await client.multipartUpload(filename, file, {...options}); |
| | | } |
| | | |
| | | //获取OSS文件URL |
| | | function getObjectUrl(filepath) { |
| | | var client = getOssClient() |
| | | if (client == null) { |
| | | return null; |
| | | } |
| | | const domain = filepath.match(/^(?:https?:\/\/)?(?:[^@\n]+@)?(?:www\.)?([^:\/\n]+)/im)[0] + "/";//域名部分 |
| | | // 配置响应头实现通过URL访问时自动下载文件,并设置下载后的文件名。 |
| | | const filename = filepath.split(domain)[1]; |
| | | const response = { |
| | | "content-disposition": `attachment; filename=${encodeURIComponent( |
| | | filename |
| | | )}`, |
| | | }; |
| | | // 填写Object完整路径。Object完整路径中不能包含Bucket名称。 |
| | | const url = client.signatureUrl(filename,{response}); |
| | | return url; |
| | | } |