Browse Source

12345事件处理支持附件上传

featrue-social
mk 11 months ago
parent
commit
10fae4d518
  1. 24
      src/views/modules/shequzhili/event/cpts/event-info.vue
  2. 51
      src/views/modules/shequzhili/event/cpts/process-form-complete.vue
  3. 41
      src/views/modules/shequzhili/event/cpts/process-form-contact.vue
  4. 95
      src/views/modules/shequzhili/event/cpts/process-form-process.vue
  5. 6
      src/views/modules/shequzhili/event/cpts/process-form.vue

24
src/views/modules/shequzhili/event/cpts/event-info.vue

@ -211,7 +211,7 @@
@click="watchImg(i.attachmentUrl)" />
</div>
</template>
<template v-if="i.attachmentType === 'voice' || i.attachmentType === 'video'">
<template v-else-if="i.attachmentType === 'voice' || i.attachmentType === 'video'">
<div
:class="['m-info-prop', { 'm-info-prop-vis': source === 'visiual' },]">
<span class="u-info-title-2">录音</span>
@ -220,13 +220,11 @@
</audio>
</div>
</template>
<template v-if="i.attachmentType === 'doc'">
<template v-else-if="i.attachmentType === 'doc'">
<div
:class="['m-info-prop', { 'm-info-prop-vis': source === 'visiual' },]">
<span class="u-info-title-2">录音</span>
<audio controls>
<source :src="i.attachmentUrl" type="" :key="i.attachmentUrl" />
</audio>
:class="['m-info-prop', { 'm-info-prop-vis': source === 'visiual' }]">
<span class="u-info-title-2">附件</span>
<a @click="aTagDownload(i.attachmentUrl,i.attachmentName)" style="cursor: pointer">{{i.attachmentName}}}</a>
</div>
</template>
</template>
@ -353,7 +351,17 @@ export default {
},
methods: {
changeName(val) {
aTagDownload(url, filename){
const a = document.createElement("a"); // a
a.href = url; //
a.download = filename; //
a.style.display = "none"; //
document.body.appendChild(a); //
a.click(); //
document.body.removeChild(a); //
},
changeName(val) {
this.demandUserName = val;
},
changeMobile(val) {

51
src/views/modules/shequzhili/event/cpts/process-form-complete.vue

@ -41,6 +41,22 @@
</div>
</section>
</el-form-item>
<el-form-item label="上传附件" label-width="118px" :class="{ 'form-item': source === 'visiual' }" prop="luyin"
>
<el-upload :headers="$getElUploadHeaders()" class="avatar-uploader" :action="uploadUlr"
accept=".doc,.pdf,.xls,.docx,.xlsx" :show-file-list="false"
:data="{ customerId: customerId }" :on-success="handleDocSuccess"
:on-remove="handleDocRemove" :before-upload="beforeDocUpload">
<el-button type="primary" :disabled="pageType === 'check'" >上传附件<i class="el-icon-upload el-icon--right"></i></el-button>
</el-upload>
<section class="uploadList">
<div v-for="file in docList" :key="file.attachmentUrl" :file="file"
:style="{cursor:pageType === 'check'? 'no-drop':'pointer'}">
<span>{{ file.attachmentName }}</span>
<span type="text" @click="handleDocRemove(file)" class="el-icon-close"> </span>
</div>
</section>
</el-form-item>
<el-divider></el-divider>
<div class="flex">
<div class="item">
@ -404,6 +420,7 @@ export default {
},
imgList: [],
audioList: [],
docList:[],
examineImgList:[]
};
},
@ -442,10 +459,10 @@ export default {
console.log(newVal,'bianle');
if(this.pageType === 'check'){
this.formData = newVal;
console.log(this.formData);
if(this.formData.internalFile){
this.imgList = this.formData.internalFile.filter(item=>item.attachmentType==='image')
this.audioList = this.formData.internalFile.filter(item=>item.attachmentType==='voice')
this.docList = this.formData.internalFile.filter(item=>item.attachmentType == 'doc')
}
}
},
@ -557,6 +574,38 @@ export default {
this.imgList.splice(index, 1);
console.log(this.imgList);
},
beforeDocUpload(file) {
const isLt1M = file.size / 1024 / 1024 < 10;
if (!isLt1M) {
this.$message.error("上传文件大小不能超过 10MB!");
}
return isLt1M;
},
handleDocSuccess(res, file, fileList) {
console.log("res.data.url", file);
if (res.code === 0 && res.msg === "success") {
console.log("res.data.url", res.data.url);
this.docList.push({
attachmentFormat: file.name.split(".").pop(),
attachmentName: file.name,
size: file.size,
attachmentType: file.raw.type,
attachmentUrl: res.data.url,
});
console.log(this.docList);
} else {
this.$message.error(res.msg);
}
},
handleDocRemove(file) {
let index = this.formData.files.findIndex(
(item) => item.url == file.response.data.url
);
this.formData.files.splice(index, 1);
console.log(this.formData.files);
},
async getReplayInfo() {
this.okflag = false;
this.$refs["ref_form"].validate((valid, messageObj) => {

41
src/views/modules/shequzhili/event/cpts/process-form-contact.vue

@ -26,6 +26,16 @@
<el-button type="primary" >上传图片<i class="el-icon-upload el-icon--right"></i></el-button>
</el-upload>
</el-form-item>
<el-form-item label="上传附件" label-width="118px" :class="{ 'form-item': source === 'visiual' }"
>
<el-upload :headers="$getElUploadHeaders()" class="avatar-uploader" :action="uploadUlr"
accept=".doc,.pdf,.xls,.docx,.xlsx"
:data="{ customerId: customerId }" :show-file-list="true" :on-success="handleDocSuccess"
:on-remove="handleDocRemove" :before-upload="beforeDocUpload">
<el-button type="primary" >上传附件<i class="el-icon-upload el-icon--right"></i></el-button>
</el-upload>
</el-form-item>
<el-divider></el-divider>
<div class="flex">
@ -250,7 +260,38 @@ export default {
console.log(this.imgList);
},
beforeDocUpload(file) {
const isLt1M = file.size / 1024 / 1024 < 10;
if (!isLt1M) {
this.$message.error("上传文件大小不能超过 10MB!");
}
return isLt1M;
},
handleDocSuccess(res, file, fileList) {
console.log("res.data.url", file);
if (res.code === 0 && res.msg === "success") {
console.log("res.data.url", res.data.url);
this.docList.push({
attachmentFormat: file.name.split(".").pop(),
attachmentName: file.name,
size: file.size,
attachmentType: file.raw.type,
attachmentUrl: res.data.url,
});
console.log(this.docList);
} else {
this.$message.error(res.msg);
}
},
handleDocRemove(file) {
let index = this.formData.files.findIndex(
(item) => item.url == file.response.data.url
);
this.formData.files.splice(index, 1);
console.log(this.formData.files);
},
async getReplayInfo() {
this.okflag = false;
this.$refs['ref_form2'].validate((valid, messageObj) => {

95
src/views/modules/shequzhili/event/cpts/process-form-process.vue

@ -32,7 +32,15 @@
<el-button type="primary">上传图片<i class="el-icon-upload el-icon--right"></i></el-button>
</el-upload>
</el-form-item>
<el-form-item label="上传附件" label-width="118px" :class="{ 'form-item': source === 'visiual' }"
>
<el-upload :headers="$getElUploadHeaders()" class="avatar-uploader" :action="uploadUlr"
accept=".doc,.pdf,.xls,.docx,.xlsx"
:data="{ customerId: customerId }" :show-file-list="true" :on-success="handleDocSuccess"
:on-remove="handleDocRemove" :before-upload="beforeDocUpload">
<el-button type="primary" >上传附件<i class="el-icon-upload el-icon--right"></i></el-button>
</el-upload>
</el-form-item>
<el-divider></el-divider>
<div class="flex">
<div class="item">
@ -158,7 +166,8 @@ export default {
},
selectList: [{ label: '属实', value: 1 }, { label: '不属实', value: 0 }],
imgList: [],
audioList: []
audioList: [],
docList:[]
};
},
components: {},
@ -198,38 +207,10 @@ export default {
}
});
},
beforeImgUpload(file) {
const isLt1M = file.size / 1024 / 1024 < 10;
if (!isLt1M) {
this.$message.error("上传文件大小不能超过 10MB!");
}
return isLt1M;
},
handleImgSuccess(res, file, fileList) {
console.log("res.data.url", file);
if (res.code === 0 && res.msg === "success") {
console.log("res.data.url", res.data.url);
this.imgList.push({
attachmentFormat: file.name.split(".").pop(),
attachmentName: file.name,
size: file.size,
attachmentType: file.raw.type,
attachmentUrl: res.data.url,
});
console.log(this.imgList);
} else {
this.$message.error(res.msg);
}
},
handleImgRemove(file) {
let index = this.imgList.findIndex(
(item) => item.url == file.response.data.url
);
this.imgList.splice(index, 1);
console.log(this.imgList);
},
beforeAudioUpload(file) {
const isLt1M = file.size / 1024 / 1024 < 10;
if (!isLt1M) {
@ -269,7 +250,22 @@ export default {
}
return isLt1M;
},
handleImgSuccess(res, file, fileList) {
console.log("res.data.url", file);
if (res.code === 0 && res.msg === "success") {
console.log("res.data.url", res.data.url);
this.imgList.push({
attachmentFormat: file.name.split(".").pop(),
attachmentName: file.name,
size: file.size,
attachmentType: file.raw.type,
attachmentUrl: res.data.url,
});
console.log(this.imgList);
} else {
this.$message.error(res.msg);
}
},
handleImgRemove(file) {
let index = this.formData.files.findIndex(
@ -278,6 +274,39 @@ export default {
this.formData.files.splice(index, 1);
console.log(this.formData.files);
},
beforeDocUpload(file) {
const isLt1M = file.size / 1024 / 1024 < 10;
if (!isLt1M) {
this.$message.error("上传文件大小不能超过 10MB!");
}
return isLt1M;
},
handleDocSuccess(res, file, fileList) {
console.log("res.data.url", file);
if (res.code === 0 && res.msg === "success") {
console.log("res.data.url", res.data.url);
this.docList.push({
attachmentFormat: file.name.split(".").pop(),
attachmentName: file.name,
size: file.size,
attachmentType: file.raw.type,
attachmentUrl: res.data.url,
});
console.log(this.docList);
} else {
this.$message.error(res.msg);
}
},
handleDocRemove(file) {
let index = this.formData.files.findIndex(
(item) => item.url == file.response.data.url
);
this.formData.files.splice(index, 1);
console.log(this.formData.files);
},
//
startLoading() {
loading = Loading.service({

6
src/views/modules/shequzhili/event/cpts/process-form.vue

@ -156,7 +156,7 @@ export default {
if (this.operationType === '9') {
this.$refs.process_form_contact.getReplayInfo()
this.replayInfo = this.$refs.process_form_contact.formData;
this.replayInfo.files = [...this.$refs.process_form_contact.imgList,...this.$refs.process_form_contact.audioList]
this.replayInfo.files = [...this.$refs.process_form_contact.imgList,...this.$refs.process_form_contact.audioList,...this.$refs.process_form_contact.docList]
if (this.$refs.process_form_contact.okflag) {
this.replayInfo = this.$refs.process_form_contact.formData
this.okflag = true
@ -164,7 +164,7 @@ export default {
} else if (this.operationType === '10') {
this.$refs.ref_process_form_process.getReplayInfo()
this.replayInfo = this.$refs.ref_process_form_process.formData;
this.replayInfo.files = [...this.$refs.ref_process_form_process.imgList,...this.$refs.ref_process_form_process.audioList]
this.replayInfo.files = [...this.$refs.ref_process_form_process.imgList,...this.$refs.ref_process_form_process.audioList,...this.$refs.ref_process_form_process.docList]
if (this.$refs.ref_process_form_process.okflag) {
this.replayInfo = this.$refs.ref_process_form_process.formData
this.okflag = true
@ -172,7 +172,7 @@ export default {
} else if (this.operationType === '11' || this.pageType === 'check') {
this.$refs.ref_process_form_complete.getReplayInfo()
this.replayInfo = this.$refs.ref_process_form_complete.formData;
this.replayInfo.files = [...this.$refs.ref_process_form_complete.imgList,...this.$refs.ref_process_form_complete.audioList]
this.replayInfo.files = [...this.$refs.ref_process_form_complete.imgList,...this.$refs.ref_process_form_complete.audioList,...this.$refs.ref_process_form_complete.docList]
if(this.pageType === 'check'){
this.replayInfo.operationType = '12';
this.replayInfo.files = [...this.replayInfo.files,...this.$refs.ref_process_form_complete.examineImgList]

Loading…
Cancel
Save