Commit 80f0196c authored by 李晓兵's avatar 李晓兵

'附件上传'

parent d23d8f9a
......@@ -457,17 +457,18 @@ export default {
})
},
async verified () {
// let bpId = await this.saveWord()
// this.getBankInfo()
let bpId = await this.saveWord()
this.getBankInfo()
// 查询资料清单
this.loadItemList()
},
loadItemList () {
let vm = this
let bpId = window.localStorage.getItem('user_id')
let url = process.env.basePath + 'prj_cdd_check_list'
let param = {
master: {
'document_id': 7928,
'document_id': bpId,
'document_table': 'HLS_BP_MASTER',
'tab_group': 'HLS_NP',
},
......@@ -618,7 +619,6 @@ export default {
},
// 图片保存
save_picture (list) {
alert('图片待上传数组 ' + JSON.stringify(list))
let vm = this
if (list.length) {
// hlsPopup.showLoading('图片上传请稍候')
......@@ -629,7 +629,6 @@ export default {
clearInterval(recordUploadInterval)
hlsPopup.hideLoading()
hlsPopup.showLongCenter('图片上传成功')
alert('返回结果 ' + JSON.stringify(vm.upload_list))
}
}, 500)
for (var i = 0; i < list.length; i++) {
......
......@@ -291,28 +291,28 @@
<!-- 资产信息 -->
<div :class="{martop: flag,types:!flag}" class="userInfo">资产信息</div>
<div class="card2">
<span>房产证件</span>
<div v-if="cddItemList.length" :class="{martop: flag,types:!flag}" class="userInfo">资产信息</div>
<div v-for="(list, index) in cddItemList" :key="index" class="card2">
<span>{{ list.description }}</span>
<div class="img-content">
<div class="card-upload">
<img src="@/assets/userBind/camera.png" >
<!--待上传图片列表-->
<div v-for="(item, index) in upload_list" v-if="item.check_id==list.check_id" :key="index" class="card-upload">
<img :src="item.picture" >
<div class="close" @click="delete_pic(item.attachment_id)">
<img src="@/assets/userBind/deleteIcon.png">
</div>
</div>
</div>
</div>
<div class="card2">
<span>车辆证件</span>
<div class="img-content">
<div class="card-upload">
<img src="@/assets/userBind/camera.png" >
<!--从服务器上下载的图片-->
<div v-for="item in dowload_list" >
<div v-for="(pic, index) in item" v-if="pic.check_id==list.check_id" :key="index" class="card-upload">
<img :src="pic.url" >
<div class="close" @click="delete_pic(pic.attachment_id)">
<img src="@/assets/userBind/deleteIcon.png">
</div>
</div>
</div>
</div>
</div>
<div class="card2">
<span>其他资产证件</span>
<div class="img-content">
<div class="card-upload">
<img src="@/assets/userBind/camera.png" >
<div class="card-upload" @click="imgUploadShow(list.check_id)">
<img src="@/assets/userBind/camera.png" class="upload-btn">
</div>
</div>
</div>
......@@ -475,6 +475,9 @@ export default {
idCardBack: '', // 身份证反面图片
licenseImg: '', // 营业执照照片
bankImg: '', // 银行卡图片
upload_list: [], // 上传图片列表
dowload_list: [], // 下载图片列表
cddItemList: [], // 资料清单列表
}
},
computed: {},
......@@ -541,6 +544,7 @@ export default {
vm.from = true
vm.getbaseInfo()
vm.getBankInfo()
vm.loadItemList()// 附件查询
})
}
next()
......@@ -686,8 +690,7 @@ export default {
},
verified () {
// debugger
if (this.flag) {
/* if (this.flag) {
// this.flag = false
for (let i in this.authMsg) {
this.authMsg[i] = ''
......@@ -897,9 +900,12 @@ export default {
// window.sessionStorage.setItem('user_id', res.bp_id)
vm.bp_id = res.bp_id
vm.getBankInfo()
// 查询资料清单
//vm.loadItemList()
}
})
}
}*/
vm.loadItemList()
},
hideModal () {
this.showModalValue = false
......@@ -1223,6 +1229,174 @@ export default {
vm.baseInfo.organization_code = result.社会信用代码.words
})
},
load_picture (check_id, index) {
let vm = this
let url = process.env.basePath + 'attachment_list_query' + '&index' + index // 附件查询
let param = {
check_id: check_id,
}
hlsPopup.showLoading('请稍候')
vm.$post(url, param).then(function (res) {
vm.hlsPopup.hideLoading()
if (res.result === 'S') {
res.lists.forEach(item => {
item['url'] = process.env.filePath + 'attachment_id=' + item.attachment_id + '&access_token=' + window.localStorage.access_token
})
vm.dowload_list.push(res.lists)
} else {
hlsPopup.showLongCenter(res.message)
}
})
},
loadItemList () {
let vm = this
//let bpId = vm.from ? vm.$route.params.bp_id : vm.bp_id
let url = process.env.basePath + 'prj_cdd_check_list'
let param = {
master: {
'document_id': 7850,
'document_table': 'HLS_BP_MASTER',
'tab_group': 'HLS_NP',
},
}
// vm.hlsPopup.showLoading('请稍候')
vm.hlsHttp.post(url, param).then(function (res) {
// vm.hlsPopup.hideLoading()
if (res.result === 'S') {
vm.cddItemList = [...res.lists]
// 查询图片
vm.cddItemList.forEach((item, index) => {
vm.load_picture(item.check_id, index)
})
}
})
},
// 图片上传入口
imgUploadShow (check_id) {
let vm = this
vm.upload_list = []
hlsPopup.showActionSheet({
titleText: '请选择照片',
buttonArray: ['拍照', '从相册取'],
callback: index => {
if (index === 0) {
vm.imgUploadOpenCamera(check_id)
} else {
vm.imgUploadTakePicture(check_id)
}
},
})
},
imgUploadOpenCamera (check_id) {
let vm = this
let obj = {
'pkvalue': check_id,
'source_type': 'PRJ_CDD_ITEM_CHECK',
'picture': '',
'check_id': check_id,
'filePath': '',
'attachment_id': '',
'user_id': 1,
}
let cameraoptions = {
quality: 100,
}
let success = function (imgdata) {
obj.picture = imgdata
obj.filePath = imgdata
let list = []
list.push(obj)
// vm.upload_list.push(obj)
// 拍完一张立马执行保存图片逻辑
vm.save_picture(list)
}
let error = function () {
}
hlsUtil.openCamera(cameraoptions, success, error)
},
imgUploadTakePicture (check_id) {
let vm = this
let cameraoptions = {
quality: 100,
}
let success = function (imgUrl) {
var list = []
for (let i = 0; i < imgUrl.length; i++) {
let obj = {
'pkvalue': check_id,
'source_type': 'PRJ_CDD_ITEM_CHECK',
'picture': '',
'check_id': check_id,
'filePath': '',
'attachment_id': '',
'user_id': 1,
}
obj.picture = imgUrl[i]
obj.filePath = imgUrl[i]
list.push(obj)
}
vm.save_picture(list)
}
let error = function () {
}
vm.hlsUtil.takePicture(cameraoptions, success, error)
},
// 图片保存
save_picture (list) {
let vm = this
if (list.length) {
// hlsPopup.showLoading('图片上传请稍候')
var alreadyUploadNum = 0
var attLength = 0
var recordUploadInterval = setInterval(function () {
if (alreadyUploadNum === attLength) {
clearInterval(recordUploadInterval)
hlsPopup.hideLoading()
hlsPopup.showLongCenter('图片上传成功')
}
}, 500)
for (var i = 0; i < list.length; i++) {
let uploadSuccess = function (res) {
if (res.result === 'S') {
alreadyUploadNum++
for (var j = 0; j < list.length; j++) {
if (list[j].filePath === res.response.filePath) {
list[j].attachment_id = res.response.attachment_id
vm.upload_list.push(list[j])
break
}
}
} else {
hlsPopup.hideLoading()
}
}
if (!list[i].attachment_id) {
attLength++
hlsUtil.fileUploadSvc(list[i], uploadSuccess)
}
}
} else {
hlsPopup.hideLoading()
}
},
// 删除图片
delete_pic(attachment_id){
hlsPopup.showLongCenter('接口还没写')
/*let vm = this
let url = process.env.basePath + 'attachment_list_query'
let param = {
attachment_id: attachment_id,
}
hlsPopup.showLoading('请稍候')
vm.$post(url, param).then(function (res) {
vm.hlsPopup.hideLoading()
if (res.result === 'S') {
} else {
hlsPopup.showLongCenter(res.message)
}
})*/
},
},
}
</script>
......
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