fix(attachment) review

approve-sys
bob 2 years ago
parent 76d1c33da4
commit 2bf6e04be4

@ -26,7 +26,7 @@
<el-form-item label="工作记录"> <el-form-item label="工作记录">
<el-input type="textarea" v-model="form.workRecord"/> <el-input type="textarea" v-model="form.workRecord"/>
</el-form-item> </el-form-item>
<el-form-item label="图片上传" prop="remark"> <el-form-item label="附件上传" prop="remark">
<el-upload <el-upload
class="upload-demo" class="upload-demo"
:action="uploadFileUrl" :action="uploadFileUrl"
@ -37,7 +37,6 @@
:headers="headers" :headers="headers"
:file-list="fileList"> :file-list="fileList">
<el-button size="small" type="primary">点击上传</el-button> <el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件且不超过500kb</div>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-form-item label="申请提交时间"> <el-form-item label="申请提交时间">

@ -32,29 +32,25 @@
<el-form-item label="工作记录"> <el-form-item label="工作记录">
<el-input type="textarea" v-model="form.workRecord"/> <el-input type="textarea" v-model="form.workRecord"/>
</el-form-item> </el-form-item>
<el-form-item label="图片上传" prop="remark"> <el-form-item label="附件">
<el-upload
class="upload-demo" <div v-for="(item,index) in uploadedImgs" class="demo-image__preview">
action="https://jsonplaceholder.typicode.com/posts/" <el-row :span="24">
:on-preview="handlePreview" <el-col :span="6">
:on-remove="handleRemove" <el-image
:file-list="fileList"> style="width: 100px; height: 100px"
<el-button size="small" type="primary">点击上传</el-button> :src="'data:image/png;base64,'+item.base64"
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件且不超过500kb</div> :preview-src-list="['data:image/png;base64,'+item.base64]">
</el-upload> </el-image>
</el-form-item> </el-col>
<el-form-item label="文件上传" prop="remark"> <el-col :span="2">
<el-upload <span>{{item.name}}</span>
class="upload-demo" </el-col>
action="https://jsonplaceholder.typicode.com/posts/" </el-row>
:on-preview="handlePreview" </div>
:on-remove="handleRemove" <div v-for="(item,index) in uploadedFiles" class="demo-image__preview">
multiple <span>{{item.name}}</span>
:limit="3" </div>
:file-list="fileList">
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件且不超过500kb</div>
</el-upload>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
@ -94,29 +90,39 @@
<el-form-item label="工作记录"> <el-form-item label="工作记录">
<el-input type="textarea" v-model="form.workRecord"/> <el-input type="textarea" v-model="form.workRecord"/>
</el-form-item> </el-form-item>
<el-form-item label="图片上传" prop="remark"> <el-form-item v-if="applyIsRevoked" label="附件上传" prop="remark">
<el-upload <el-upload
class="upload-demo" class="upload-demo"
action="https://jsonplaceholder.typicode.com/posts/" :action="uploadFileUrl"
:on-error="handleUploadError"
:on-preview="handlePreview" :on-preview="handlePreview"
:on-success="handleSuccess"
:on-remove="handleRemove" :on-remove="handleRemove"
:headers="headers"
:file-list="fileList"> :file-list="fileList">
<el-button size="small" type="primary">点击上传</el-button> <el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件且不超过500kb</div>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-form-item label="文件上传" prop="remark"> <el-form-item v-if="!applyIsRevoked" label="附件">
<el-upload
class="upload-demo" <div v-for="(item,index) in uploadedImgs" class="demo-image__preview">
action="https://jsonplaceholder.typicode.com/posts/" <el-row :span="24">
:on-preview="handlePreview" <el-col :span="6">
:on-remove="handleRemove" <el-image
multiple style="width: 100px; height: 100px"
:limit="3" :src="'data:image/png;base64,'+item.base64"
:file-list="fileList"> :preview-src-list="['data:image/png;base64,'+item.base64]">
<el-button size="small" type="primary">点击上传</el-button> </el-image>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件且不超过500kb</div> </el-col>
</el-upload> <el-col :span="2">
<span>{{item.name}}</span>
</el-col>
</el-row>
</div>
<div v-for="(item,index) in uploadedFiles" class="demo-image__preview">
<span>{{item.name}}</span>
</div>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
@ -304,6 +310,7 @@ import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import Treeselect from "@riophae/vue-treeselect"; import Treeselect from "@riophae/vue-treeselect";
import {listUser} from "@/api/system/user"; import {listUser} from "@/api/system/user";
import {optionProject} from "@/api/system/project"; import {optionProject} from "@/api/system/project";
import {getToken} from "@/utils/auth";
export default { export default {
name: "Record", name: "Record",
@ -369,8 +376,16 @@ export default {
issue: '', issue: '',
submitDate: '', submitDate: '',
solution: '', solution: '',
attachmentIds:''
}, },
fileIdList: [],
fileList: [], fileList: [],
uploadFileUrl: process.env.VUE_APP_BASE_API + "/common/attachment/upload", //
headers: {
Authorization: "Bearer " + getToken(),
},
uploadedImgs: [],
uploadedFiles: [],
projectList: [], projectList: [],
returnTaskList: [], // 退 returnTaskList: [], // 退
finished: 'false', finished: 'false',
@ -404,6 +419,9 @@ export default {
this.optionList(); this.optionList();
this.getFlowRecordList( this.taskForm.procInsId, this.taskForm.deployId); this.getFlowRecordList( this.taskForm.procInsId, this.taskForm.deployId);
this.finished = this.$route.query && this.$route.query.finished this.finished = this.$route.query && this.$route.query.finished
this.fileIdList = []
this.uploadedFiles = []
this.uploadedImgs = []
}, },
methods: { methods: {
/** 查询部门下拉树结构 */ /** 查询部门下拉树结构 */
@ -502,6 +520,8 @@ export default {
const params = {procInsId: procInsId, deployId: deployId} const params = {procInsId: procInsId, deployId: deployId}
flowRecord(params).then(res => { flowRecord(params).then(res => {
this.flowRecordList = res.data.flowList; this.flowRecordList = res.data.flowList;
this.uploadedImgs = res.data.imgs;
this.uploadedFiles = res.data.files;
// //
// if (res.data.formData) { // if (res.data.formData) {
this.form = res.data.form; this.form = res.data.form;
@ -583,6 +603,10 @@ export default {
this.getTreeselect(); this.getTreeselect();
}, /** 确认并提交任务选择 */ }, /** 确认并提交任务选择 */
handleClaimAndComplete() { handleClaimAndComplete() {
if (this.fileIdList.length > 0) {
this.form.attachmentIds=this.fileIdList.map(e => e.id).join(',')
console.log("this.form.attachmentIds", this.form.attachmentIds);
}
this.taskForm.comment = '提交任务'; this.taskForm.comment = '提交任务';
this.taskForm.vars= JSON.stringify(this.form) this.taskForm.vars= JSON.stringify(this.form)
this.taskForm.taskId= this.flowRecordList[0].taskId this.taskForm.taskId= this.flowRecordList[0].taskId
@ -721,7 +745,29 @@ export default {
this.returnTaskList = []; this.returnTaskList = [];
}, },
handleRemove(file, fileList) { handleRemove(file, fileList) {
// id
console.log(file, fileList); console.log(file, fileList);
for(var i = this.fileIdList.length -1; i >= 0 ; i--){
if(this.fileIdList[i].uid == file.uid){
// fileIdListid
this.fileIdList.splice(i, 1);
}
}
},
handleUploadError(err, file, fileList) {
this.$message.error("上传失败, 请重试");
},
handleSuccess(res, file, fileList) {
if (res.code !== 200) {
this.$message.error("上传失败, 请重试");
return
}
this.fileIdList.push({
id:res.data.id,
uid:file.uid // id
})
// id
}, },
handlePreview(file) { handlePreview(file) {
console.log(file); console.log(file);

@ -42,8 +42,8 @@
<el-table v-loading="loading" :data="todoList" border @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="todoList" border @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/> <el-table-column type="selection" width="55" align="center"/>
<el-table-column label="任务编号" align="center" prop="taskId" :show-overflow-tooltip="true"/> <el-table-column label="项目名称" align="center" prop="projectName" :show-overflow-tooltip="true"/>
<el-table-column label="流程名称" align="center" prop="procDefName"/> <el-table-column label="工作问题" align="center" prop="workIssue" :show-overflow-tooltip="true"/>
<el-table-column label="任务节点" align="center" prop="taskName"/> <el-table-column label="任务节点" align="center" prop="taskName"/>
<el-table-column label="流程版本" align="center"> <el-table-column label="流程版本" align="center">
<template slot-scope="scope"> <template slot-scope="scope">

Loading…
Cancel
Save