|
|
|
@ -78,15 +78,10 @@
|
|
|
|
|
style="width: 100%"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item v-if="isEdit" label="供述材料" prop="confessionMaterial">
|
|
|
|
|
<!-- <el-form-item v-if="isEdit" label="供述材料" prop="confessionMaterial">
|
|
|
|
|
<el-row :gutter="10" type="flex" style="flex-wrap:wrap">
|
|
|
|
|
<el-col v-for="(item, index) in fileIdList" :key="index" :span="8">
|
|
|
|
|
<div class="file-item">
|
|
|
|
|
<!-- <el-image-->
|
|
|
|
|
<!-- src="~@/assets/caseDetails/doc.png"-->
|
|
|
|
|
<!-- fit="contain"-->
|
|
|
|
|
<!-- -->
|
|
|
|
|
<!-- />-->
|
|
|
|
|
<img
|
|
|
|
|
src="~@/assets/caseDetails/doc.png"
|
|
|
|
|
style="width: 50px;height: 50px"
|
|
|
|
@ -96,16 +91,16 @@
|
|
|
|
|
</div>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="上传材料" prop="file">
|
|
|
|
|
</el-form-item> -->
|
|
|
|
|
<el-form-item label="上传材料" prop="fileIdList">
|
|
|
|
|
<el-upload
|
|
|
|
|
class="upload-demo"
|
|
|
|
|
:action="uploadOption.action"
|
|
|
|
|
:accept="uploadOption.accept"
|
|
|
|
|
:on-preview="handlePreview"
|
|
|
|
|
:on-remove="handleRemove"
|
|
|
|
|
:on-change="handleFileChange"
|
|
|
|
|
:auto-upload="false"
|
|
|
|
|
:before-remove="beforeRemove"
|
|
|
|
|
:on-success="handleSuccess"
|
|
|
|
|
multiple
|
|
|
|
|
:on-exceed="handleExceed"
|
|
|
|
|
:file-list="fileList"
|
|
|
|
@ -157,7 +152,9 @@ export default {
|
|
|
|
|
// 是否显示文件浏览器
|
|
|
|
|
showFileViewer: false,
|
|
|
|
|
// 笔录表单
|
|
|
|
|
recordForm: {},
|
|
|
|
|
recordForm: {
|
|
|
|
|
fileIdList: []
|
|
|
|
|
},
|
|
|
|
|
rules: {
|
|
|
|
|
name: [{ required: true, message: '姓名不能为空!', trigger: 'blur' }],
|
|
|
|
|
indexNum: [{ required: true, message: '次数不能为空!', trigger: 'blur' }],
|
|
|
|
@ -165,7 +162,7 @@ export default {
|
|
|
|
|
lawAsker: [{ required: true, message: '询问人不能为空!', trigger: 'blur' }],
|
|
|
|
|
confessionTime: [{ required: true, message: '供述时间不能为空!', trigger: 'blur' }],
|
|
|
|
|
confessionMaterial: [{ required: true, message: '供述材料不能为空!', trigger: 'blur' }],
|
|
|
|
|
file: [{ required: true, message: '上传材料不能为空!', trigger: 'blur' }]
|
|
|
|
|
fileIdList: [{ required: true, message: '上传材料不能为空!', trigger: 'blur' }]
|
|
|
|
|
},
|
|
|
|
|
// 用户
|
|
|
|
|
userList: [],
|
|
|
|
@ -173,39 +170,24 @@ export default {
|
|
|
|
|
roleList: JSON.parse(sessionStorage.getItem('case_role')),
|
|
|
|
|
// 文件列表
|
|
|
|
|
fileList: [],
|
|
|
|
|
// 已上传的文件列表
|
|
|
|
|
fileIdList: [],
|
|
|
|
|
// 上传配置
|
|
|
|
|
uploadOption: {
|
|
|
|
|
action: '',
|
|
|
|
|
accept: '.docx,.doc'
|
|
|
|
|
action: `${baseURL}/minio/uploadFile`,
|
|
|
|
|
accept: '.docx,.bmp,.jpg,.png'
|
|
|
|
|
},
|
|
|
|
|
// 初始化下标
|
|
|
|
|
initialIndex: 0,
|
|
|
|
|
// 时间线数据
|
|
|
|
|
// activities: [
|
|
|
|
|
// {
|
|
|
|
|
// content: '',
|
|
|
|
|
// timestamp: '2018-04-15'
|
|
|
|
|
// }, {
|
|
|
|
|
// content: '',
|
|
|
|
|
// timestamp: '2018-04-13'
|
|
|
|
|
// }, {
|
|
|
|
|
// content: '',
|
|
|
|
|
// timestamp: '2018-04-11'
|
|
|
|
|
// }
|
|
|
|
|
// ],
|
|
|
|
|
isEdit: false
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
// 监听文件列表
|
|
|
|
|
fileList: {
|
|
|
|
|
handler: function(val) {
|
|
|
|
|
this.$set(this.recordForm, 'file', val.length > 0 ? '12' : '')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// watch: {
|
|
|
|
|
// // 监听文件列表
|
|
|
|
|
// fileList: {
|
|
|
|
|
// handler: function(val) {
|
|
|
|
|
// this.$set(this.recordForm, 'file', val.length > 0 ? '12' : '')
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
mounted() {
|
|
|
|
|
this.caseId = this.$route.params.id
|
|
|
|
|
this.getUserList()
|
|
|
|
@ -215,18 +197,21 @@ export default {
|
|
|
|
|
this.isEdit = isEdit
|
|
|
|
|
// 弹窗宽度变化
|
|
|
|
|
// this.drawerOption.width = isEdit ? '50%' : '35%'
|
|
|
|
|
this.recordForm = isEdit ? data : {}
|
|
|
|
|
this.recordForm = isEdit ? data : { fileIdList: [] }
|
|
|
|
|
// 处理编辑时时间选择器
|
|
|
|
|
if (isEdit && data['confessionStartTime'] && data['confessionEndTime']) {
|
|
|
|
|
this.$set(this.recordForm, 'confessionTime', [data['confessionStartTime'], data['confessionEndTime']])
|
|
|
|
|
}
|
|
|
|
|
this.fileList = []
|
|
|
|
|
// 处理文件id列表
|
|
|
|
|
if (isEdit && data['fileIds']) {
|
|
|
|
|
this.fileIdList = data['fileIds'].split(',')
|
|
|
|
|
// files.map(item => {
|
|
|
|
|
// this.fileIdList.push(`${baseURL}${commonDownloadFile}${item}`)
|
|
|
|
|
// })
|
|
|
|
|
if (isEdit) {
|
|
|
|
|
const list = []
|
|
|
|
|
data.fileList.forEach(e => {
|
|
|
|
|
list.push(e.fileId)
|
|
|
|
|
this.fileList.push({
|
|
|
|
|
name: e.fileName
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
this.recordForm.fileIdList = list
|
|
|
|
|
}
|
|
|
|
|
this.drawerOption.title = isEdit ? '编辑笔录' : '添加笔录'
|
|
|
|
|
this.drawerOption.show = true
|
|
|
|
@ -254,32 +239,26 @@ export default {
|
|
|
|
|
})
|
|
|
|
|
return list
|
|
|
|
|
},
|
|
|
|
|
// 预览图片、文件
|
|
|
|
|
handlePreviewItem(index) {
|
|
|
|
|
this.showFileViewer = true
|
|
|
|
|
this.initialIndex = index
|
|
|
|
|
handleRemove(file, uploadFiles) {
|
|
|
|
|
const list = []
|
|
|
|
|
for (const item of uploadFiles) {
|
|
|
|
|
list.push(item.response.data)
|
|
|
|
|
}
|
|
|
|
|
this.recordForm.fileIdList = list
|
|
|
|
|
},
|
|
|
|
|
// 删除供述材料
|
|
|
|
|
handleDelete(item) {
|
|
|
|
|
this.$baseConfirm('确定删除该笔录材料吗?', null, async() => {
|
|
|
|
|
const { code } = await deleteFile(item)
|
|
|
|
|
if (code === 200) {
|
|
|
|
|
this.fileIdList.splice(this.fileIdList.indexOf(item), 1)
|
|
|
|
|
const params = this.$baseLodash.cloneDeep(this.recordForm)
|
|
|
|
|
params['fileIds'] = this.fileIdList.join(',')
|
|
|
|
|
if (this.$baseLodash.isArray(params['confessionTime'])) {
|
|
|
|
|
this.$set(params, 'confessionStartTime', params['confessionTime'][0])
|
|
|
|
|
this.$set(params, 'confessionEndTime', params['confessionTime'][1])
|
|
|
|
|
}
|
|
|
|
|
delete params['file']
|
|
|
|
|
delete params['confessionTime']
|
|
|
|
|
const formData = new FormData()
|
|
|
|
|
this.$baseLodash.keys(params).forEach(key => {
|
|
|
|
|
formData.append(key, params[key])
|
|
|
|
|
})
|
|
|
|
|
addOrUpdRecords(formData)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
handlePreview(file) {
|
|
|
|
|
console.log(file)
|
|
|
|
|
},
|
|
|
|
|
handleExceed(files, fileList) {
|
|
|
|
|
this.$message.warning(`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`)
|
|
|
|
|
},
|
|
|
|
|
beforeRemove(file, fileList) {
|
|
|
|
|
return this.$confirm(`确定移除 ${file.name}?`)
|
|
|
|
|
},
|
|
|
|
|
handleSuccess(response) {
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
this.recordForm.fileIdList.push(response.data)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 重置
|
|
|
|
|
handleReset() {
|
|
|
|
@ -291,26 +270,32 @@ export default {
|
|
|
|
|
this.$refs.form.validate(async valid => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
// 处理参数
|
|
|
|
|
const params = this.$baseLodash.cloneDeep(this.recordForm)
|
|
|
|
|
if (this.isEdit) {
|
|
|
|
|
params['fileIds'] = this.fileIdList.join(',')
|
|
|
|
|
// const params = this.$baseLodash.cloneDeep(this.recordForm)
|
|
|
|
|
// const formData = new FormData()
|
|
|
|
|
// if (this.isEdit) {
|
|
|
|
|
// params['fileIds'] = this.fileIdList.join(',')
|
|
|
|
|
// } else {
|
|
|
|
|
// formData.append('caseId', this.caseId)
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// delete params['file']
|
|
|
|
|
// delete params['confessionTime']
|
|
|
|
|
// this.$baseLodash.keys(params).forEach(key => {
|
|
|
|
|
// formData.append(key, params[key])
|
|
|
|
|
// })
|
|
|
|
|
// for (let i = 0; i < this.fileList.length; i++) {
|
|
|
|
|
// formData.append('file', this.fileList[i])
|
|
|
|
|
// }
|
|
|
|
|
const params = {
|
|
|
|
|
...this.recordForm,
|
|
|
|
|
caseId: this.$route.params.id
|
|
|
|
|
}
|
|
|
|
|
if (this.$baseLodash.isArray(params['confessionTime'])) {
|
|
|
|
|
this.$set(params, 'confessionStartTime', params['confessionTime'][0])
|
|
|
|
|
this.$set(params, 'confessionEndTime', params['confessionTime'][1])
|
|
|
|
|
}
|
|
|
|
|
delete params['file']
|
|
|
|
|
delete params['confessionTime']
|
|
|
|
|
const formData = new FormData()
|
|
|
|
|
this.$baseLodash.keys(params).forEach(key => {
|
|
|
|
|
formData.append(key, params[key])
|
|
|
|
|
})
|
|
|
|
|
for (let i = 0; i < this.fileList.length; i++) {
|
|
|
|
|
formData.append('file', this.fileList[i])
|
|
|
|
|
}
|
|
|
|
|
formData.append('caseId', this.caseId)
|
|
|
|
|
const loading = this.$baseLoading(0, '笔录上传中,请勿刷新界面..')
|
|
|
|
|
addOrUpdRecords(formData).then(res => {
|
|
|
|
|
addOrUpdRecords(params).then(res => {
|
|
|
|
|
loading.close()
|
|
|
|
|
const { code, msg } = res
|
|
|
|
|
code === 200 ? this.$baseMessage.success(msg || '上传成功') : this.$baseMessage.error(msg || '上传失败')
|
|
|
|
@ -335,15 +320,6 @@ export default {
|
|
|
|
|
this.fileList.push(x.raw)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
handleRemove(file, fileList) {
|
|
|
|
|
console.log(file, fileList)
|
|
|
|
|
},
|
|
|
|
|
handlePreview(file) {
|
|
|
|
|
console.log(file)
|
|
|
|
|
},
|
|
|
|
|
handleExceed(files, fileList) {
|
|
|
|
|
this.$message.warning(`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|