Commit d25de266 authored by chuan.liu's avatar chuan.liu

附件上传联调

parent 6f678f58
...@@ -48,6 +48,10 @@ ...@@ -48,6 +48,10 @@
apiUpdateNoQuotaOrder apiUpdateNoQuotaOrder
} from '@/servers/noQuotaOrder.js' } from '@/servers/noQuotaOrder.js'
import {
formatToUnit16Array
} from '@/utils/index.js'
import { import {
mapMutations, mapMutations,
mapState mapState
...@@ -61,10 +65,11 @@ ...@@ -61,10 +65,11 @@
OBJECT_ID: '' OBJECT_ID: ''
}, },
fileList: [], fileList: [],
imgFileBase64: []
} }
}, },
computed: { computed: {
...mapState(['noQuotaOrder']), ...mapState(['noQuotaOrder', 'userInfo']),
imageStyles() { imageStyles() {
return { return {
width: 64, width: 64,
...@@ -80,8 +85,10 @@ ...@@ -80,8 +85,10 @@
const { const {
INFO, INFO,
ITEM, ITEM,
ATTACHMENT
} = this.noQuotaOrder } = this.noQuotaOrder
let ATTACHMENT = this.noQuotaOrder.ATTACHMENT
ATTACHMENT = [...ATTACHMENT, ...this.imgFileBase64]
const params = { const params = {
"MODE": "SAVE", "MODE": "SAVE",
...@@ -114,7 +121,7 @@ ...@@ -114,7 +121,7 @@
INFO: INFO3, INFO: INFO3,
ITEM: ITEM3, ITEM: ITEM3,
ATTACHMENT: ATTACHMENT3, ATTACHMENT: ATTACHMENT3,
} = res2 } = res2.DATA
this.orderInfo = INFO3 this.orderInfo = INFO3
let noQuotaOrder = { let noQuotaOrder = {
INFO: INFO3, INFO: INFO3,
...@@ -135,8 +142,26 @@ ...@@ -135,8 +142,26 @@
console.log('上传进度:', e) console.log('上传进度:', e)
}, },
// 选择文件 // 选择文件
select(e) { async select(e) {
console.log('选择文件:', e, this.fileList) console.log('选择文件:', e, this.fileList)
let _this = this
const unit16Array = await formatToUnit16Array(e.tempFiles[0].file)
let reader = new FileReader();
let fileObj = {
FILENAME: e.tempFiles[0].name,
MIMETYPE: '',
DOC_TYPE: e.tempFiles[0].fileType,
XCONTENT: unit16Array,
FILELENGTH: e.tempFiles[0].size,
ZZFLD00002D: this.userInfo.code,
ZZFLD00002D_DSCR: this.userInfo.name,
}
reader.readAsDataURL(e.tempFiles[0].file);
reader.onload = function(e) {
// fileObj.XCONTENT = e.target.result;
_this.imgFileBase64.push(fileObj);
console.log('2222', e)
}
}, },
// 上传成功 // 上传成功
success(e) { success(e) {
......
...@@ -88,9 +88,13 @@ ...@@ -88,9 +88,13 @@
<view class="block-detal"> <view class="block-detal">
<view class="block-detal-item"> <view class="block-detal-item">
<view class="detal-item-file"> <view class="detal-item-file">
<!-- <image class="icon-file" :src="formateToStream(ATTACHMENT[0].XCONTENT)"
mode="widthFix">
</image> -->
<image class="icon-file" src="@/static/image/logo@3x.png" mode="widthFix"> <image class="icon-file" src="@/static/image/logo@3x.png" mode="widthFix">
</image> </image>
<text class="detal-item-label">开票要求.docx</text> <text
class="detal-item-label">{{ATTACHMENT[0]&&ATTACHMENT[0].FILENAME}}</text>
</view> </view>
<button class="btn" type="default"> <button class="btn" type="default">
<text class="btn-text">下载</text> <text class="btn-text">下载</text>
...@@ -115,6 +119,10 @@ ...@@ -115,6 +119,10 @@
apiGetSalesOrderDetail apiGetSalesOrderDetail
} from '@/servers/salesOrder.js' } from '@/servers/salesOrder.js'
// import {
// sapDownloadFile
// } from '@/utils/index.js'
export default { export default {
data() { data() {
return { return {
...@@ -175,6 +183,12 @@ ...@@ -175,6 +183,12 @@
this.receiveInfoHeight = '145' this.receiveInfoHeight = '145'
} }
}, },
formateToStream(unit16Array) {
// let stream = sapDownloadFile(unit16Array)
// console.log('formateToStream--', stream)
// return URL.createObjectURL(stream)
return ''
}
} }
} }
</script> </script>
...@@ -205,7 +219,6 @@ ...@@ -205,7 +219,6 @@
flex-direction: column; flex-direction: column;
margin-top: -164rpx; margin-top: -164rpx;
padding: 0 16rpx; padding: 0 16rpx;
overflow-y: scroll;
} }
.list-wrapper { .list-wrapper {
......
...@@ -121,7 +121,7 @@ ...@@ -121,7 +121,7 @@
ITEM_INNER: ITEM_INNER3, ITEM_INNER: ITEM_INNER3,
ITEM_OUTER: ITEM_OUTER3, ITEM_OUTER: ITEM_OUTER3,
ATTACHMENT: ATTACHMENT3, ATTACHMENT: ATTACHMENT3,
} = res2 } = res2.DATA
this.orderInfo = INFO3 this.orderInfo = INFO3
let quotaOrder = { let quotaOrder = {
INFO: INFO3, INFO: INFO3,
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
{"@platforms":["android","iPhone","iPad"],"id":"__UNI__343534B","name":"五粮液APP","version":{"name":"1.0.0","code":"100"},"description":"订货系统","launch_path":"","developer":{"name":"","email":"","url":""},"permissions":{"UniNView":{"description":"UniNView原生渲染"}},"plus":{"useragent":{"value":"uni-app","concatenate":true},"splashscreen":{"target":"id:1","autoclose":true,"waiting":true,"delay":0},"popGesture":"close","launchwebview":{"id":"1","kernel":"WKWebview","render":"always","uniNView":{"path":"pages/login/login.js"}},"statusbar":{"immersed":"supportedDevice","style":"dark","background":"#fff"},"usingComponents":true,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","nvue":{"flex-direction":"row"},"distribute":{"icons":{"android":{"hdpi":"unpackage/res/icons/72x72.png","xhdpi":"unpackage/res/icons/96x96.png","xxhdpi":"unpackage/res/icons/144x144.png","xxxhdpi":"unpackage/res/icons/192x192.png"},"ios":{"appstore":"unpackage/res/icons/1024x1024.png","ipad":{"app":"unpackage/res/icons/76x76.png","app@2x":"unpackage/res/icons/152x152.png","notification":"unpackage/res/icons/20x20.png","notification@2x":"unpackage/res/icons/40x40.png","proapp@2x":"unpackage/res/icons/167x167.png","settings":"unpackage/res/icons/29x29.png","settings@2x":"unpackage/res/icons/58x58.png","spotlight":"unpackage/res/icons/40x40.png","spotlight@2x":"unpackage/res/icons/80x80.png"},"iphone":{"app@2x":"unpackage/res/icons/120x120.png","app@3x":"unpackage/res/icons/180x180.png","notification@2x":"unpackage/res/icons/40x40.png","notification@3x":"unpackage/res/icons/60x60.png","settings@2x":"unpackage/res/icons/58x58.png","settings@3x":"unpackage/res/icons/87x87.png","spotlight@2x":"unpackage/res/icons/80x80.png","spotlight@3x":"unpackage/res/icons/120x120.png"}}},"google":{"permissions":["<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>","<uses-permission android:name=\"android.permission.VIBRATE\"/>","<uses-permission android:name=\"android.permission.READ_LOGS\"/>","<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>","<uses-feature android:name=\"android.hardware.camera.autofocus\"/>","<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.CAMERA\"/>","<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>","<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>","<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>","<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>","<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>","<uses-feature android:name=\"android.hardware.camera\"/>","<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"],"abiFilters":["armeabi-v7a"]},"apple":{},"plugins":{"ad":{},"audio":{"mp3":{"description":"Android平台录音支持MP3格式文件"}}}},"arguments":"{\"name\":\"me\",\"query\":\"uuid=c4bba940-f69e-11ea-a419-6bafda9d095e&__id__=1\",\"id\":0,\"pathName\":\"pages/login/login\"}","allowsInlineMediaPlayback":true,"safearea":{"background":"rgba(250,250,250,0.90)","bottom":{"offset":"auto"}},"uni-app":{"compilerVersion":"3.4.7","control":"uni-v3","nvueCompiler":"uni-app","renderer":"auto","nvue":{"flex-direction":"row"},"nvueLaunchMode":"normal"},"tabBar":{"iconWidth":"19px","spacing":"4px","color":"#999999","selectedColor":"#FF1D32","borderStyle":"rgba(250,250,250,0.90)","backgroundColor":"rgba(250,250,250,0.90)","list":[{"pagePath":"pages/home/home","iconPath":"static/image/home@3x.png","selectedIconPath":"static/image/home_red@3x.png","text":"首页"},{"pagePath":"pages/go-order/go-order","iconPath":"static/image/tab_order@3x.png","selectedIconPath":"static/image/tab_order_red@3x.png","text":"下单"},{"pagePath":"pages/purchase/purchase","iconPath":"static/image/tab_purchase@3x.png","selectedIconPath":"static/image/tab_purchase_red@3x.png","text":"要货"},{"pagePath":"pages/message/message","iconPath":"static/image/tab_message@3x.png","selectedIconPath":"static/image/tab_message_red@3x.png","text":"消息"},{"pagePath":"pages/usercenter/usercenter","iconPath":"static/image/tab_my@3x.png","selectedIconPath":"static/image/tab_my_red@3x.png","text":"我的"}],"height":"50px"}}} {"@platforms":["android","iPhone","iPad"],"id":"__UNI__343534B","name":"五粮液APP","version":{"name":"1.0.0","code":"100"},"description":"订货系统","launch_path":"","developer":{"name":"","email":"","url":""},"permissions":{"UniNView":{"description":"UniNView原生渲染"}},"plus":{"useragent":{"value":"uni-app","concatenate":true},"splashscreen":{"target":"id:1","autoclose":true,"waiting":true,"delay":0},"popGesture":"close","launchwebview":{"id":"1","kernel":"WKWebview","render":"always","uniNView":{"path":"pages/login/login.js"}},"statusbar":{"immersed":"supportedDevice","style":"dark","background":"#fff"},"usingComponents":true,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","nvue":{"flex-direction":"row"},"distribute":{"icons":{"android":{"hdpi":"unpackage/res/icons/72x72.png","xhdpi":"unpackage/res/icons/96x96.png","xxhdpi":"unpackage/res/icons/144x144.png","xxxhdpi":"unpackage/res/icons/192x192.png"},"ios":{"appstore":"unpackage/res/icons/1024x1024.png","ipad":{"app":"unpackage/res/icons/76x76.png","app@2x":"unpackage/res/icons/152x152.png","notification":"unpackage/res/icons/20x20.png","notification@2x":"unpackage/res/icons/40x40.png","proapp@2x":"unpackage/res/icons/167x167.png","settings":"unpackage/res/icons/29x29.png","settings@2x":"unpackage/res/icons/58x58.png","spotlight":"unpackage/res/icons/40x40.png","spotlight@2x":"unpackage/res/icons/80x80.png"},"iphone":{"app@2x":"unpackage/res/icons/120x120.png","app@3x":"unpackage/res/icons/180x180.png","notification@2x":"unpackage/res/icons/40x40.png","notification@3x":"unpackage/res/icons/60x60.png","settings@2x":"unpackage/res/icons/58x58.png","settings@3x":"unpackage/res/icons/87x87.png","spotlight@2x":"unpackage/res/icons/80x80.png","spotlight@3x":"unpackage/res/icons/120x120.png"}}},"google":{"permissions":["<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>","<uses-permission android:name=\"android.permission.VIBRATE\"/>","<uses-permission android:name=\"android.permission.READ_LOGS\"/>","<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>","<uses-feature android:name=\"android.hardware.camera.autofocus\"/>","<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.CAMERA\"/>","<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>","<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>","<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>","<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>","<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>","<uses-feature android:name=\"android.hardware.camera\"/>","<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"],"abiFilters":["armeabi-v7a"]},"apple":{},"plugins":{"ad":{},"audio":{"mp3":{"description":"Android平台录音支持MP3格式文件"}}}},"arguments":"{\"name\":\"me\",\"query\":\"uuid=c4bba940-f69e-11ea-a419-6bafda9d095e&__id__=1\",\"id\":0,\"pathName\":\"pages/login/login\"}","allowsInlineMediaPlayback":true,"safearea":{"background":"rgba(250,250,250,0.90)","bottom":{"offset":"auto"}},"uni-app":{"compilerVersion":"3.4.14","control":"uni-v3","nvueCompiler":"uni-app","renderer":"auto","nvue":{"flex-direction":"row"},"nvueLaunchMode":"normal"},"tabBar":{"iconWidth":"19px","spacing":"4px","color":"#999999","selectedColor":"#FF1D32","borderStyle":"rgba(250,250,250,0.90)","backgroundColor":"rgba(250,250,250,0.90)","list":[{"pagePath":"pages/home/home","iconPath":"static/image/home@3x.png","selectedIconPath":"static/image/home_red@3x.png","text":"首页"},{"pagePath":"pages/go-order/go-order","iconPath":"static/image/tab_order@3x.png","selectedIconPath":"static/image/tab_order_red@3x.png","text":"下单"},{"pagePath":"pages/purchase/purchase","iconPath":"static/image/tab_purchase@3x.png","selectedIconPath":"static/image/tab_purchase_red@3x.png","text":"要货"},{"pagePath":"pages/message/message","iconPath":"static/image/tab_message@3x.png","selectedIconPath":"static/image/tab_message_red@3x.png","text":"消息"},{"pagePath":"pages/usercenter/usercenter","iconPath":"static/image/tab_my@3x.png","selectedIconPath":"static/image/tab_my_red@3x.png","text":"我的"}],"height":"50px"}}}
\ No newline at end of file \ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
// 判断arr是否为一个数组,返回一个bool值 // 判断arr是否为一个数组,返回一个bool值
function isArray (arr) { function isArray(arr) {
return Object.prototype.toString.call(arr) === '[object Array]'; return Object.prototype.toString.call(arr) === '[object Array]';
} }
// 深度克隆 // 深度克隆
function deepClone (obj) { function deepClone(obj) {
// 对常见的“非”值,直接返回原来值 // 对常见的“非”值,直接返回原来值
if([null, undefined, NaN, false].includes(obj)) return obj; if ([null, undefined, NaN, false].includes(obj)) return obj;
if(typeof obj !== "object" && typeof obj !== 'function') { if (typeof obj !== "object" && typeof obj !== 'function') {
//原始类型直接返回 //原始类型直接返回
return obj; return obj;
} }
var o = isArray(obj) ? [] : {}; var o = isArray(obj) ? [] : {};
for(let i in obj) { for (let i in obj) {
if(obj.hasOwnProperty(i)){ if (obj.hasOwnProperty(i)) {
o[i] = typeof obj[i] === "object" ? deepClone(obj[i]) : obj[i]; o[i] = typeof obj[i] === "object" ? deepClone(obj[i]) : obj[i];
} }
} }
return o; return o;
} }
// JS对象深度合并 // JS对象深度合并
...@@ -47,7 +47,48 @@ function deepMerge(target = {}, source = {}) { ...@@ -47,7 +47,48 @@ function deepMerge(target = {}, source = {}) {
return target; return target;
} }
export { // 转成十六进制
deepClone, function formatToUnit16Array(file) {
deepMerge, return new Promise((resolve, reject) => {
}; const _this = this
\ No newline at end of file const reader = new FileReader()
reader.readAsArrayBuffer(file)
let strArr = []
reader.onload = function(e) {
let unitArray = new Uint8Array(this.result)
for (let i = 0; i < unitArray.length; i++) {
let u_arr16 = unitArray[i].toString(16).toLocaleUpperCase()
if (u_arr16.length < 2) {
u_arr16 = '0' + u_arr16
}
strArr.push(u_arr16)
}
resolve(strArr.join(''))
}
})
}
// 16 进制字符串转换成整型数组
function hexToBytes(hexStr) {
let bytes = []
for (let c = 0; c < hexStr.length; c += 2) {
bytes.push(parseInt(hexStr.substr(c, 2), 16))
}
return bytes
}
// 取得 16 进制字符串 file
function sapDownloadFile(file, filename) {
let uint8Array = new Uint8Array(hexToBytes(file))
let blob = new Blob([uint8Array], {
type: 'application/octet-stream'
})
return blob
}
export {
deepClone,
deepMerge,
formatToUnit16Array,
sapDownloadFile
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment