Browse Source

事件回复增加附件功能;

feature
luyan 2 years ago
parent
commit
7d7a278a17
  1. 58
      src/views/modules/shequzhili/event/cpts/event-info.vue
  2. 87
      src/views/modules/shequzhili/event/cpts/process-form-designate.vue
  3. 83
      src/views/modules/shequzhili/event/cpts/process-form-replay-end.vue

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

@ -99,6 +99,31 @@
<div class="detail-field">办结时限</div>
<div class="detail-value">{{ formTimeLimit(item.timeLimit) }}</div>
</div>
<template v-if="item.internalFile && item.internalFile.length > 0"
v-for="i in item.internalFile">
<template v-if="i.type === 'image'">
<div :class="['m-info-prop', { 'm-info-prop-vis': source === 'visiual' },]">
<span class="u-info-title-2">图片</span>
<img :src="i.url" :key="i.url"
style="width: 150px; height: 150px; padding-right: 10px"
@click="watchImg(i.url)" />
</div>
</template>
<template v-if="i.type === 'voice'">
<div :class="['m-info-prop', { 'm-info-prop-vis': source === 'visiual' },]">
<span class="u-info-title-2">语音</span>
<audio controls>
<source :src="i.url" type="" :key="i.url" />
</audio>
</div>
</template>
<template v-if="i.type === 'doc'">
<div :class="['m-info-prop', { 'm-info-prop-vis': source === 'visiual' },]">
<span class="u-info-title-2">附件</span>
<a :href="i.url">{{ i.name }}</a>
</div>
</template>
</template>
</template>
<template v-else>
<div class="detail">
@ -113,6 +138,33 @@
<div class="detail-field">办结时限</div>
<div class="detail-value">{{ formTimeLimit(item.timeLimit) }}</div>
</div>
<template v-if="item.internalFile && item.internalFile.length > 0"
v-for="i in item.internalFile">
<template v-if="i.type === 'image'">
<div :class="['m-info-prop', { 'm-info-prop-vis': source === 'visiual' },]">
<span class="u-info-title-2">图片</span>
<img :src="i.url" :key="i.url"
style="width: 150px; height: 150px; padding-right: 10px"
@click="watchImg(i.url)" />
</div>
</template>
<template v-if="i.type === 'voice'">
<div :class="['m-info-prop', { 'm-info-prop-vis': source === 'visiual' },]">
<span class="u-info-title-2">语音</span>
<audio controls>
<source :src="i.url" type="" :key="i.url" />
</audio>
</div>
</template>
<template v-if="i.type === 'doc'">
<div :class="['m-info-prop', { 'm-info-prop-vis': source === 'visiual' },]">
<span class="u-info-title-2">语音</span>
<audio controls>
<source :src="i.url" type="" :key="i.url" />
</audio>
</div>
</template>
</template>
</template>
</div>
</div>
@ -259,6 +311,9 @@ export default {
changeGridId(val) {
this.gridId = val;
},
watchImg(src) {
window.open(src);
},
//
async getProjectProcess() {
@ -305,6 +360,7 @@ export default {
},
async handelAdd() {
debugger
this.$refs.ref_add.getEventInfo();
if (this.$refs.ref_add.okflag) {
this.eventInfoData = this.$refs.ref_add.formData;
@ -318,6 +374,7 @@ export default {
this.project = {};
this.demand = {};
this.replayInfo = this.$refs.ref_processinfo_add.replayInfo;
console.log(this.replayInfo);
//
this.eventInfoData.content = this.replayInfo.content;
this.eventInfoData.status = this.replayInfo.status;
@ -330,6 +387,7 @@ export default {
this.demand = {};
console.log(this.$refs.ref_process_form_designate.replayInfo);
this.replayInfo = this.$refs.ref_process_form_designate.replayInfo;
console.log(this.replayInfo);
//
this.eventInfoData.content = this.replayInfo.content;
this.eventInfoData.status = this.replayInfo.status;

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

@ -28,6 +28,15 @@
placeholder="请输入转办意见,不超过500字" v-model="formData.content"></el-input>
</div>
</el-form-item>
<el-form-item style="display: block" label="附件" label-width="150px" prop="attach">
<el-upload :headers="$getElUploadHeaders()" class="upload-demo" :action="uploadUlr"
accept=".doc,.pdf,.xls,.docx,.xlsx,.jpg,.png,.jpeg,.bmp,.mp4,.wma,.m4a,.mp3"
:on-success="handleFileSuccess" :on-remove="handleFileRemove" :on-preview="handleFileDownload"
:limit="3" :before-upload="beforeUpload" :file-list="fileList">
<el-button size="small" :disabled="fileList.length === 3" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">支持图片wordpdf</div>
</el-upload>
</el-form-item>
<el-form-item label="办结时限" prop="timeLimit" label-width="150px" :class="{ 'form-item': source === 'visiual' }"
style="display: block">
<div :class="{ 'visiual-form': source === 'visiual' }">
@ -55,7 +64,8 @@ export default {
categoryId: "",//
deptId: "", //
deptName: "",
categoryList: []
categoryList: [],
files: [] //
},
orgOptions: [],
orgOptionProps: {
@ -71,6 +81,8 @@ export default {
eventDetailCopy: {},
selCategoryArray: [],
casOptions: [],
fileList: [],
uploadUlr: window.SITE_CONFIG["apiURL"] + "/oss/file/uploadvariedfile",
iscascaderShow: 0,
optionProps: {
multiple: false,
@ -126,7 +138,6 @@ export default {
this.getCategoryList();
if (this.eventId) {
this.eventDetailCopy = JSON.parse(JSON.stringify(this.eventDetailData));
console.log(this.eventDetailCopy);
// eventDetailCopy
if (this.eventDetailCopy.parentCategoryId && this.eventDetailCopy.categoryId) {
this.selCateObj.id = this.eventDetailCopy.categoryId
@ -206,11 +217,13 @@ export default {
if (!valid) {
app.util.validateRule(messageObj);
} else {
console.log(this.selCateObj);
if (!this.selCateObj || !this.selCateObj.id) {
this.$message.error("请选择事件分类");
return false;
}
if(this.fileList){
this.formData.files = this.fileList
}
this.formData.status = "processing";
this.formData.categoryId = this.selCateObj.id;
this.formData.categoryList = [];
@ -222,6 +235,74 @@ export default {
resetData() {
this.agencyIdArray = []
},
beforeUpload(file) {
const array = file.name.split(".");
const extension = array[array.length - 1];
const formatarray = [
"jpg",
"png",
"jpeg",
"bmp",
"mp4",
"wma",
"m4a",
"mp3",
"doc",
"docx",
"xls",
"xlsx",
"pdf",
];
if (formatarray.indexOf(extension) === -1) {
this.$message.error("只支持图片、word、pdf");
return false;
}
},
handleFileRemove(file) {
if (file && file.status === "success") {
this.fileList.splice(
this.fileList.findIndex((item) => item.uid === file.uid),
1
);
}
},
handleFileSuccess(res, file) {
if (res.code === 0 && res.msg === "success") {
const array = file.name.split(".");
const fileType = array[array.length - 1];
const picArray = ["jpg", "png", "jpeg", "bmp"];
const videoarray = ["mp4", "wma", "m4a"];
const docArray = ["doc", "docx", "xls", "xlsx", "pdf"];
const mp3Array = ["mp3"];
if (picArray.indexOf(fileType) > -1) {
file.attachmentFormat = "image";
} else if (videoarray.indexOf(fileType) > -1) {
file.attachmentFormat = "video";
} else if (docArray.indexOf(fileType) > -1) {
file.attachmentFormat = "doc";
} else if (mp3Array.indexOf(fileType) > -1) {
file.attachmentFormat = "voice";
}
file.url = res.data.url;
file.type = fileType;
file.attachmentName = file.name;
file.attachmentType = file.type;
file.attachmentUrl = file.url;
this.fileList.push(file);
} else this.$message.error(res.msg);
},
//
handleFileDownload(file) {
var a = document.createElement("a");
var event = new MouseEvent("click");
a.download = file.name;
a.href = file.url;
a.dispatchEvent(event);
},
//
startLoading() {
loading = Loading.service({

83
src/views/modules/shequzhili/event/cpts/process-form-replay-end.vue

@ -25,6 +25,15 @@
placeholder="请输入回复内容,不超过500字" v-model="formData.content"></el-input>
</div>
</el-form-item>
<el-form-item style="display: block" label="附件" label-width="150px" prop="attach">
<el-upload :headers="$getElUploadHeaders()" class="upload-demo" :action="uploadUlr"
accept=".doc,.pdf,.xls,.docx,.xlsx,.jpg,.png,.jpeg,.bmp,.mp4,.wma,.m4a,.mp3"
:on-success="handleFileSuccess" :on-remove="handleFileRemove" :on-preview="handleFileDownload"
:limit="3" :before-upload="beforeUpload" :file-list="fileList">
<el-button size="small" :disabled="fileList.length === 3" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">支持图片wordpdf</div>
</el-upload>
</el-form-item>
</el-form>
</div>
</template>
@ -43,12 +52,15 @@ export default {
content: '',
status: 'closed_case',
categoryList: [],
files: []
},
status: false,
okflag: false,
eventDetailCopy: {},
selCategoryArray: [],
casOptions: [],
fileList: [],
uploadUlr: window.SITE_CONFIG["apiURL"] + "/oss/file/uploadvariedfile",
iscascaderShow: 0,
optionProps: {
multiple: false,
@ -152,6 +164,9 @@ export default {
if (!this.formData.categoryId) {
this.formData.categoryId = this.selCateObj.id;
}
if(this.fileList){
this.formData.files = this.fileList
}
this.formData.categoryList = [];
this.formData.categoryList.push(this.selCateObj);
this.okflag = true;
@ -159,6 +174,74 @@ export default {
});
},
resetData() { },
beforeUpload(file) {
const array = file.name.split(".");
const extension = array[array.length - 1];
const formatarray = [
"jpg",
"png",
"jpeg",
"bmp",
"mp4",
"wma",
"m4a",
"mp3",
"doc",
"docx",
"xls",
"xlsx",
"pdf",
];
if (formatarray.indexOf(extension) === -1) {
this.$message.error("只支持图片、word、pdf");
return false;
}
},
handleFileRemove(file) {
if (file && file.status === "success") {
this.fileList.splice(
this.fileList.findIndex((item) => item.uid === file.uid),
1
);
}
},
handleFileSuccess(res, file) {
if (res.code === 0 && res.msg === "success") {
const array = file.name.split(".");
const fileType = array[array.length - 1];
const picArray = ["jpg", "png", "jpeg", "bmp"];
const videoarray = ["mp4", "wma", "m4a"];
const docArray = ["doc", "docx", "xls", "xlsx", "pdf"];
const mp3Array = ["mp3"];
if (picArray.indexOf(fileType) > -1) {
file.attachmentFormat = "image";
} else if (videoarray.indexOf(fileType) > -1) {
file.attachmentFormat = "video";
} else if (docArray.indexOf(fileType) > -1) {
file.attachmentFormat = "doc";
} else if (mp3Array.indexOf(fileType) > -1) {
file.attachmentFormat = "voice";
}
file.url = res.data.url;
file.type = fileType;
file.attachmentName = file.name;
file.attachmentType = file.type;
file.attachmentUrl = file.url;
this.fileList.push(file);
} else this.$message.error(res.msg);
},
//
handleFileDownload(file) {
var a = document.createElement("a");
var event = new MouseEvent("click");
a.download = file.name;
a.href = file.url;
a.dispatchEvent(event);
},
//
startLoading() {
loading = Loading.service({

Loading…
Cancel
Save