案例修改、图片预览
This commit is contained in:
parent
edd5b5559d
commit
e35992d984
@ -81,7 +81,7 @@ public class SysCustomerCaseController extends BaseController
|
|||||||
@GetMapping(value = "/{id}")
|
@GetMapping(value = "/{id}")
|
||||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||||
{
|
{
|
||||||
return AjaxResult.success(sysCustomerCaseService.selectSysCustomerCaseById(id));
|
return AjaxResult.success(sysCustomerCaseService.selectSysCustomerCaseById(id, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -134,6 +134,7 @@ public class SysCustomerCaseController extends BaseController
|
|||||||
int index = 0;
|
int index = 0;
|
||||||
for (String downUrl : downUrlList) {
|
for (String downUrl : downUrlList) {
|
||||||
list.get(index).setDownUrl(downUrl);
|
list.get(index).setDownUrl(downUrl);
|
||||||
|
index++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
|
@ -5,14 +5,7 @@ import java.util.List;
|
|||||||
import com.stdiet.common.utils.StringUtils;
|
import com.stdiet.common.utils.StringUtils;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.stdiet.common.annotation.Log;
|
import com.stdiet.common.annotation.Log;
|
||||||
import com.stdiet.common.core.controller.BaseController;
|
import com.stdiet.common.core.controller.BaseController;
|
||||||
import com.stdiet.common.core.domain.AjaxResult;
|
import com.stdiet.common.core.domain.AjaxResult;
|
||||||
@ -40,9 +33,11 @@ public class SysWxSaleAccountController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('custom:wxAccount:list')")
|
@PreAuthorize("@ss.hasPermi('custom:wxAccount:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(SysWxSaleAccount sysWxSaleAccount)
|
public TableDataInfo list(SysWxSaleAccount sysWxSaleAccount, @RequestParam(value = "pageFlag", required = false, defaultValue = "true")boolean pageFlag)
|
||||||
{
|
{
|
||||||
|
if(pageFlag){
|
||||||
startPage();
|
startPage();
|
||||||
|
}
|
||||||
List<SysWxSaleAccount> list = sysWxSaleAccountService.selectSysWxSaleAccountList(sysWxSaleAccount);
|
List<SysWxSaleAccount> list = sysWxSaleAccountService.selectSysWxSaleAccountList(sysWxSaleAccount);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,6 @@ import java.io.File;
|
|||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.URL;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -74,10 +73,10 @@ public class AliyunOSSUtils {
|
|||||||
//去尾
|
//去尾
|
||||||
String tail = oranName.substring(cutPoint);
|
String tail = oranName.substring(cutPoint);
|
||||||
//返回正确的带路径的图片名称
|
//返回正确的带路径的图片名称
|
||||||
return prefix + head + uuid + "_" + tail;
|
return prefix + head + tail + "_" + uuid;
|
||||||
}
|
}
|
||||||
//不存在 直接返回
|
//不存在 直接返回
|
||||||
return prefix + uuid + "_" + oranName;
|
return prefix + oranName + "_" + uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4,6 +4,8 @@ import com.stdiet.common.annotation.Excel;
|
|||||||
import com.stdiet.common.core.domain.BaseEntity;
|
import com.stdiet.common.core.domain.BaseEntity;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 客户案例管理对象 sys_customer_case
|
* 客户案例管理对象 sys_customer_case
|
||||||
*
|
*
|
||||||
@ -35,6 +37,11 @@ public class SysCustomerCase extends BaseEntity
|
|||||||
/** 删除标识 0未删除 1已删除,默认0 */
|
/** 删除标识 0未删除 1已删除,默认0 */
|
||||||
private Long delFlag;
|
private Long delFlag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件列表
|
||||||
|
*/
|
||||||
|
private List<SysCustomerCaseFile> caseFileList;
|
||||||
|
|
||||||
//案例文件名称数组
|
//案例文件名称数组
|
||||||
private String[] caseFileName;
|
private String[] caseFileName;
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ public interface ISysCustomerCaseService {
|
|||||||
* @param id 客户案例管理ID
|
* @param id 客户案例管理ID
|
||||||
* @return 客户案例管理
|
* @return 客户案例管理
|
||||||
*/
|
*/
|
||||||
public SysCustomerCase selectSysCustomerCaseById(Long id);
|
public SysCustomerCase selectSysCustomerCaseById(Long id, boolean fileListFlag);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询客户案例管理列表
|
* 查询客户案例管理列表
|
||||||
|
@ -35,9 +35,13 @@ public class SysCustomerCaseServiceImpl implements ISysCustomerCaseService
|
|||||||
* @return 客户案例管理
|
* @return 客户案例管理
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SysCustomerCase selectSysCustomerCaseById(Long id)
|
public SysCustomerCase selectSysCustomerCaseById(Long id, boolean fileListFlag)
|
||||||
{
|
{
|
||||||
return sysCustomerCaseMapper.selectSysCustomerCaseById(id);
|
SysCustomerCase customerCase = sysCustomerCaseMapper.selectSysCustomerCaseById(id);
|
||||||
|
if(customerCase != null && fileListFlag){
|
||||||
|
customerCase.setCaseFileList(sysCustomerCaseFileMapper.selectSysCustomerCaseFileListByCaseId(customerCase.getId()));
|
||||||
|
}
|
||||||
|
return customerCase;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -64,19 +68,7 @@ public class SysCustomerCaseServiceImpl implements ISysCustomerCaseService
|
|||||||
sysCustomerCase.setCreateTime(DateUtils.getNowDate());
|
sysCustomerCase.setCreateTime(DateUtils.getNowDate());
|
||||||
int rows = sysCustomerCaseMapper.insertSysCustomerCase(sysCustomerCase);
|
int rows = sysCustomerCaseMapper.insertSysCustomerCase(sysCustomerCase);
|
||||||
if(rows > 0){
|
if(rows > 0){
|
||||||
//批量添加文件对应列表
|
rows = addCaseFile(sysCustomerCase);
|
||||||
SysCustomerCaseFile caseFile = null;
|
|
||||||
if(sysCustomerCase.getCaseFileUrl() != null && sysCustomerCase.getCaseFileUrl().length > 0){
|
|
||||||
List<SysCustomerCaseFile> caseFileList = new ArrayList<>();
|
|
||||||
for (String url : sysCustomerCase.getCaseFileUrl()) {
|
|
||||||
caseFile = new SysCustomerCaseFile();
|
|
||||||
caseFile.setCaseId(sysCustomerCase.getId());
|
|
||||||
caseFile.setFileName(sysCustomerCase.getCaseFileName()[caseFileList.size()]);
|
|
||||||
caseFile.setFileUrl(url);
|
|
||||||
caseFileList.add(caseFile);
|
|
||||||
}
|
|
||||||
rows = sysCustomerCaseFileMapper.insertBatch(caseFileList);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return rows;
|
return rows;
|
||||||
}
|
}
|
||||||
@ -91,7 +83,38 @@ public class SysCustomerCaseServiceImpl implements ISysCustomerCaseService
|
|||||||
public int updateSysCustomerCase(SysCustomerCase sysCustomerCase)
|
public int updateSysCustomerCase(SysCustomerCase sysCustomerCase)
|
||||||
{
|
{
|
||||||
sysCustomerCase.setUpdateTime(DateUtils.getNowDate());
|
sysCustomerCase.setUpdateTime(DateUtils.getNowDate());
|
||||||
return sysCustomerCaseMapper.updateSysCustomerCase(sysCustomerCase);
|
int rows = sysCustomerCaseMapper.updateSysCustomerCase(sysCustomerCase);
|
||||||
|
if(rows > 0){
|
||||||
|
rows = addCaseFile(sysCustomerCase);
|
||||||
|
}
|
||||||
|
return rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量添加文件对应列表
|
||||||
|
* @param sysCustomerCase
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private int addCaseFile(SysCustomerCase sysCustomerCase){
|
||||||
|
int rows = 0;
|
||||||
|
//批量添加文件对应列表
|
||||||
|
SysCustomerCaseFile caseFile = null;
|
||||||
|
if(sysCustomerCase.getCaseFileUrl() != null && sysCustomerCase.getCaseFileUrl().length > 0){
|
||||||
|
List<SysCustomerCaseFile> caseFileList = new ArrayList<>();
|
||||||
|
for (String url : sysCustomerCase.getCaseFileUrl()) {
|
||||||
|
caseFile = new SysCustomerCaseFile();
|
||||||
|
caseFile.setCaseId(sysCustomerCase.getId());
|
||||||
|
caseFile.setFileName(sysCustomerCase.getCaseFileName()[caseFileList.size()]);
|
||||||
|
caseFile.setFileUrl(url);
|
||||||
|
caseFileList.add(caseFile);
|
||||||
|
}
|
||||||
|
//如果是修改操作直接先删除全部,再添加
|
||||||
|
if(sysCustomerCase.getId() != null){
|
||||||
|
sysCustomerCaseFileMapper.deleteSysCustomerCaseFileByCaseId(sysCustomerCase.getId());
|
||||||
|
}
|
||||||
|
rows = sysCustomerCaseFileMapper.insertBatch(caseFileList);
|
||||||
|
}
|
||||||
|
return rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
<if test="wxNickName != null and wxNickName != ''"> and wx_nick_name like concat('%', #{wxNickName}, '%')</if>
|
<if test="wxNickName != null and wxNickName != ''"> and wx_nick_name like concat('%', #{wxNickName}, '%')</if>
|
||||||
<if test="wxAccount != null and wxAccount != ''"> and wx_account like concat('%', #{wxAccount}, '%')</if>
|
<if test="wxAccount != null and wxAccount != ''"> and wx_account like concat('%', #{wxAccount}, '%')</if>
|
||||||
<if test="wxPhone != null and wxPhone != ''"> and wx_phone like concat('%', #{wxPhone}, '%')</if>
|
<if test="wxPhone != null and wxPhone != ''"> and wx_phone like concat('%', #{wxPhone}, '%')</if>
|
||||||
|
order by id desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectSysWxSaleAccountById" parameterType="Long" resultMap="SysWxSaleAccountResult">
|
<select id="selectSysWxSaleAccountById" parameterType="Long" resultMap="SysWxSaleAccountResult">
|
||||||
|
@ -1,11 +1,35 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<div>
|
||||||
<!-- 多文件下载对话框 -->
|
<!-- 多文件下载对话框 -->
|
||||||
<el-dialog :title="title" :visible.sync="open" @closed="cancel" width="600px" append-to-body>
|
<el-dialog :title="title" :visible.sync="open" @closed="cancel" width="700px" append-to-body>
|
||||||
<div class="app-container">
|
<div class="app-container" style="height: 400px; overflow: auto">
|
||||||
|
<div style="margin: -20px auto 15px auto">
|
||||||
|
<el-button type="primary" @click="lazyShow = true" plain>滚动下拉预览</el-button>
|
||||||
|
</div>
|
||||||
<el-table v-loading="loading" :data="fileList">
|
<el-table v-loading="loading" :data="fileList">
|
||||||
<el-table-column label="文件名" align="center" prop="fileName" />
|
<el-table-column label="文件预览" align="center" prop="fileUrl">
|
||||||
<el-table-column label="上传时间" align="center" prop="createTime" />
|
<template slot-scope="scope">
|
||||||
|
<el-image v-if="scope.row.imageFlag" title="点击大图预览"
|
||||||
|
style="width: 80px; height: 80px"
|
||||||
|
:src="scope.row.downUrl"
|
||||||
|
:preview-src-list="imageList">
|
||||||
|
</el-image>
|
||||||
|
<span v-else>不可预览</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="文件名" align="center" prop="fileName" width="200">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<AutoHideMessage :maxLength="10" :data="scope.row.fileName"></AutoHideMessage>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="上传时间" align="center" prop="createTime" >
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{
|
||||||
|
parseTime(scope.row.createTime, "{y}-{m}-{d}")
|
||||||
|
}}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
@ -17,21 +41,30 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button @click="cancel">取 消</el-button>
|
<el-button @click="cancel">取 消</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
<el-dialog :title="'滚动下拉预览'" v-if="lazyShow" :visible.sync="lazyShow" width="600px" style="height: 90%; overflow: auto" append-to-body>
|
||||||
|
<div class="demo-image__lazy">
|
||||||
|
<el-image v-for="(url,index) in imageList" :class="index !=0 ? 'top-10' : ''" :key="url" :src="url" lazy></el-image>
|
||||||
|
</div>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="lazyShow = false">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { downCaseFile } from "@/api/custom/customerCase";
|
import { downCaseFile } from "@/api/custom/customerCase";
|
||||||
|
import AutoHideMessage from "@/components/AutoHideMessage";
|
||||||
export default {
|
export default {
|
||||||
name: "MuchFileDown",
|
name: "MuchFileDown",
|
||||||
components: {
|
components: {
|
||||||
|
AutoHideMessage
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -43,8 +76,14 @@ export default {
|
|||||||
open: false,
|
open: false,
|
||||||
//案例id
|
//案例id
|
||||||
caseId: null,
|
caseId: null,
|
||||||
|
//支持预览的文件类型
|
||||||
|
imgArr: ['jpg', 'jpeg', 'png', 'gif'],
|
||||||
//文件列表
|
//文件列表
|
||||||
fileList: []
|
fileList: [],
|
||||||
|
//图片文件列表
|
||||||
|
imageList:[],
|
||||||
|
//懒加载
|
||||||
|
lazyShow: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@ -55,6 +94,13 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
showDialog(title, fileList) {
|
showDialog(title, fileList) {
|
||||||
this.title = title ? title : "文件列表";
|
this.title = title ? title : "文件列表";
|
||||||
|
fileList.forEach((item, index) => {
|
||||||
|
item["imageFlag"] = this.isImage(item.fileName);
|
||||||
|
if(item["imageFlag"]){
|
||||||
|
//this.$set(this.imageList, this.imageList.length, item.downUrl)
|
||||||
|
this.imageList.push(item.downUrl);
|
||||||
|
}
|
||||||
|
});
|
||||||
this.fileList = fileList;
|
this.fileList = fileList;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.open = true;
|
this.open = true;
|
||||||
@ -64,10 +110,29 @@ export default {
|
|||||||
this.open = false;
|
this.open = false;
|
||||||
this.caseId = null;
|
this.caseId = null;
|
||||||
this.fileList = [];
|
this.fileList = [];
|
||||||
|
this.imageList = [];
|
||||||
},
|
},
|
||||||
downloadFile(file){
|
downloadFile(file){
|
||||||
|
if(file == undefined || file == null || file.downUrl == null || file.downUrl == ""){
|
||||||
|
this.$message({message: "文件不存在", type: "warning",});
|
||||||
|
return;
|
||||||
|
}
|
||||||
downCaseFile(file.downUrl);
|
downCaseFile(file.downUrl);
|
||||||
|
},
|
||||||
|
isImage(name){
|
||||||
|
var idx = name.indexOf('.');
|
||||||
|
if (idx === -1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var type = name.substr(idx + 1);
|
||||||
|
return this.imgArr.indexOf(type) !== -1 ? true : false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.top-10{
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
:file-list="upload.fileList"
|
:file-list="upload.fileList"
|
||||||
:multiple="upload.multiple"
|
:multiple="upload.multiple"
|
||||||
:on-change="handleFileChange"
|
:on-change="handleFileChange"
|
||||||
|
:on-remove="handleFileRemove"
|
||||||
:on-exceed="handleFileexceed"
|
:on-exceed="handleFileexceed"
|
||||||
:on-progress="handleFileUploadProgress"
|
:on-progress="handleFileUploadProgress"
|
||||||
:on-success="handleFileSuccess"
|
:on-success="handleFileSuccess"
|
||||||
@ -17,7 +18,7 @@
|
|||||||
:auto-upload="false">
|
:auto-upload="false">
|
||||||
<i class="el-icon-upload"></i>
|
<i class="el-icon-upload"></i>
|
||||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||||
<div class="el-upload__tip" slot="tip">每个案例最多上传5个文件,且每个文件不超过10M</div>
|
<div class="el-upload__tip" slot="tip">最多可上传{{upload.limit}}个文件,且每个文件不超过{{upload.fileSize/(1024*1024)}}M</div>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
@ -41,8 +42,8 @@ export default {
|
|||||||
//文件列表
|
//文件列表
|
||||||
fileList:[],
|
fileList:[],
|
||||||
//同时上传文件上限
|
//同时上传文件上限
|
||||||
limit: 5,
|
limit: 10,
|
||||||
//每个文件大小
|
//每个文件大小(单位:byte)
|
||||||
fileSize: 1024 * 1024 * 10,
|
fileSize: 1024 * 1024 * 10,
|
||||||
//是否支持同时选择多张
|
//是否支持同时选择多张
|
||||||
multiple: true
|
multiple: true
|
||||||
@ -66,6 +67,10 @@ export default {
|
|||||||
this.uploadResult["fileUrl"] = [];
|
this.uploadResult["fileUrl"] = [];
|
||||||
this.uploadResult["fileName"] = [];
|
this.uploadResult["fileName"] = [];
|
||||||
},
|
},
|
||||||
|
//移除文件
|
||||||
|
handleFileRemove(file, fileList){
|
||||||
|
this.upload.fileList = fileList;
|
||||||
|
},
|
||||||
//监控上传文件列表
|
//监控上传文件列表
|
||||||
handleFileChange(file, fileList) {
|
handleFileChange(file, fileList) {
|
||||||
let sizeFlag = file.size > this.upload.fileSize;
|
let sizeFlag = file.size > this.upload.fileSize;
|
||||||
@ -110,9 +115,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
this.uploadReset();
|
||||||
},
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
165
stdiet-ui/src/components/FileUpload/DragUploadEdit.vue
Normal file
165
stdiet-ui/src/components/FileUpload/DragUploadEdit.vue
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<div v-for="(item, index) in oldCaseFileList">
|
||||||
|
<span style="margin-right: 10px;">
|
||||||
|
{{item.fileName ? (item.fileName.substring(0,15)+"..."): ""}}
|
||||||
|
</span>
|
||||||
|
<el-button style="margin-left: 10px;" type="danger" size="small" @click="removeOldFile(index)">移除该文件</el-button>
|
||||||
|
</div>
|
||||||
|
<el-upload class="upload-demo" style="margin-top: 10px;"
|
||||||
|
ref="upload"
|
||||||
|
drag
|
||||||
|
:headers="upload.headers"
|
||||||
|
:action="upload.url"
|
||||||
|
:limit="upload.limit"
|
||||||
|
:disabled="upload.isUploading"
|
||||||
|
:file-list="upload.fileList"
|
||||||
|
:multiple="upload.multiple"
|
||||||
|
:on-remove="handleFileRemove"
|
||||||
|
:on-change="handleFileChange"
|
||||||
|
:on-exceed="handleFileexceed"
|
||||||
|
:on-progress="handleFileUploadProgress"
|
||||||
|
:on-success="handleFileSuccess"
|
||||||
|
:on-error="handleFileFail"
|
||||||
|
:data="upload.data"
|
||||||
|
:auto-upload="false">
|
||||||
|
<i class="el-icon-upload"></i>
|
||||||
|
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||||
|
<div class="el-upload__tip" slot="tip">已存在{{oldCaseFileList.length}}个文件,还可上传{{upload.limit}}个文件,且每个文件不超过{{upload.fileSize/(1024*1024)}}M</div>
|
||||||
|
</el-upload>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { getToken } from '@/utils/auth'
|
||||||
|
import AutoHideMessage from "@/components/AutoHideMessage";
|
||||||
|
export default {
|
||||||
|
name: "DragUploadEdit",
|
||||||
|
components: {
|
||||||
|
"AutoHideMessage":AutoHideMessage
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
upload: {
|
||||||
|
// 是否禁用上传
|
||||||
|
isUploading: false,
|
||||||
|
// 上传的地址
|
||||||
|
url: process.env.VUE_APP_BASE_API + "/custom/customerCase/uploadCaseFile",
|
||||||
|
// 设置上传的请求头部
|
||||||
|
headers: {Authorization: 'Bearer ' + getToken()},
|
||||||
|
// 其他需要携带的数据
|
||||||
|
data:{},
|
||||||
|
//文件列表
|
||||||
|
fileList:[],
|
||||||
|
//同时上传文件上限
|
||||||
|
limit: 10 - this.caseFileList.length,
|
||||||
|
//每个文件大小(单位:byte)
|
||||||
|
fileSize: 1024 * 1024 * 10,
|
||||||
|
//是否支持同时选择多张
|
||||||
|
multiple: true
|
||||||
|
},
|
||||||
|
oldCaseFileList: this.caseFileList,
|
||||||
|
uploadResult:{
|
||||||
|
fileUrl:[],
|
||||||
|
fileName:[]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
uploadFile(){
|
||||||
|
if(this.upload.fileList.length > 0 && this.uploadResult.fileUrl.length < this.upload.fileList.length){
|
||||||
|
this.$refs.upload.submit();
|
||||||
|
}else{
|
||||||
|
//合并旧文件
|
||||||
|
if(this.oldCaseFileList != null && this.oldCaseFileList.length > 0){
|
||||||
|
this.oldCaseFileList.forEach((item, index) => {
|
||||||
|
this.uploadResult.fileUrl.unshift(item.fileUrl);
|
||||||
|
this.uploadResult.fileName.unshift(item.fileName);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.$emit('callbackMethod', this.uploadResult);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
removeOldFile(index){
|
||||||
|
this.oldCaseFileList.splice(index,1);
|
||||||
|
this.upload.limit = 10 - this.oldCaseFileList.length;
|
||||||
|
},
|
||||||
|
uploadReset(){
|
||||||
|
this.upload.fileList = [];
|
||||||
|
this.uploadResult["fileUrl"] = [];
|
||||||
|
this.uploadResult["fileName"] = [];
|
||||||
|
this.oldCaseFileList = [];
|
||||||
|
},
|
||||||
|
//移除文件
|
||||||
|
handleFileRemove(file, fileList){
|
||||||
|
this.upload.fileList = fileList;
|
||||||
|
},
|
||||||
|
//监控上传文件列表
|
||||||
|
handleFileChange(file, fileList) {
|
||||||
|
let sizeFlag = file.size > this.upload.fileSize;
|
||||||
|
if (sizeFlag) {
|
||||||
|
this.$message({
|
||||||
|
message: "当前文件过大",
|
||||||
|
type: "warning",
|
||||||
|
});
|
||||||
|
fileList.pop();
|
||||||
|
}
|
||||||
|
this.upload.fileList = fileList;
|
||||||
|
},
|
||||||
|
// 文件数量超过限度
|
||||||
|
handleFileexceed(file, fileList){
|
||||||
|
this.$message({
|
||||||
|
message: "最多可上传"+ this.upload.limit +"份文件",
|
||||||
|
type: "warning",
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 文件上传中处理
|
||||||
|
handleFileUploadProgress(event, file, fileList) {
|
||||||
|
//this.upload.isUploading = true;
|
||||||
|
},
|
||||||
|
// 文件上传成功处理
|
||||||
|
handleFileSuccess(response, file, fileList) {
|
||||||
|
if(response != null && response.code === 200){
|
||||||
|
this.uploadResult.fileUrl.push(response.fileUrl);
|
||||||
|
this.uploadResult.fileName.push(response.fileName);
|
||||||
|
if(this.uploadResult.fileUrl.length === this.upload.fileList.length){
|
||||||
|
//文件全部上传成功,则调用回调方法
|
||||||
|
if(this.oldCaseFileList != null && this.oldCaseFileList.length > 0){
|
||||||
|
this.oldCaseFileList.forEach((item, index) => {
|
||||||
|
this.uploadResult.fileUrl.unshift(item.fileUrl);
|
||||||
|
this.uploadResult.fileName.unshift(item.fileName);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.$emit('callbackMethod', this.uploadResult);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
this.upload.fileList = fileList.pop();
|
||||||
|
this.$message.error('文件上传失败,请检查文件格式');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 文件上传失败处理
|
||||||
|
handleFileFail(err, file, fileList){
|
||||||
|
this.$message.error('文件上传失败,请检查文件格式');
|
||||||
|
this.upload.fileList = fileList.pop();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
caseFileList:{
|
||||||
|
type: Array,
|
||||||
|
default: function () {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
@ -66,8 +66,8 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
removeOldFile(index){
|
removeOldFile(index){
|
||||||
this.form.medicalReport = this.form.medicalReport.splice(index,index);
|
this.form.medicalReport.splice(index,1);
|
||||||
this.form.medicalReportName = this.form.medicalReportName.splice(index,index);
|
this.form.medicalReportName.splice(index,1);
|
||||||
this.upload.limit = 3 - this.form.medicalReport.length;
|
this.upload.limit = 3 - this.form.medicalReport.length;
|
||||||
},
|
},
|
||||||
getReportName(index){
|
getReportName(index){
|
||||||
|
@ -67,9 +67,22 @@
|
|||||||
|
|
||||||
<el-table v-loading="loading" :data="customerCaseList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="customerCaseList" @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="name" />
|
<el-table-column label="案例名称" align="center" prop="name" >
|
||||||
<el-table-column label="关键词" align="center" prop="keyword" />
|
<template slot-scope="scope">
|
||||||
<el-table-column label="备注" align="center" prop="remark" />
|
<AutoHideMessage :data="scope.row.name" :maxLength="10"></AutoHideMessage>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="关键词" align="center" prop="keyword" >
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<AutoHideMessage :data="scope.row.keyword" :maxLength="10"></AutoHideMessage>
|
||||||
|
<!--<AutoHideInfo :data="scope.row.keyword.split(',')" :line="1"></AutoHideInfo>-->
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" >
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<AutoHideMessage :data="scope.row.remark" :maxLength="10"></AutoHideMessage>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="所属客户" align="center" prop="customerName" />
|
<el-table-column label="所属客户" align="center" prop="customerName" />
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="文件"
|
label="文件"
|
||||||
@ -125,7 +138,8 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- 添加或修改客户案例管理对话框 -->
|
<!-- 添加或修改客户案例管理对话框 -->
|
||||||
<el-dialog :title="title" :visible.sync="open" @closed="cancel" width="500px" append-to-body>
|
<el-dialog :title="title" :visible.sync="open" @closed="cancel" width="520px" append-to-body>
|
||||||
|
<div style="height: 600px; overflow: auto; padding-right: 20px">
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
<el-form-item label="案例名称" prop="name">
|
<el-form-item label="案例名称" prop="name">
|
||||||
<el-input v-model.trim="form.name" type="textarea" maxlength="50" rows = "1" show-word-limit placeholder="请输入案例名称" />
|
<el-input v-model.trim="form.name" type="textarea" maxlength="50" rows = "1" show-word-limit placeholder="请输入案例名称" />
|
||||||
@ -155,11 +169,12 @@
|
|||||||
<el-input v-model="form.customerName" placeholder="" style="width: 60%" :readonly="true" />
|
<el-input v-model="form.customerName" placeholder="" style="width: 60%" :readonly="true" />
|
||||||
<span style="margin-left: 10px"> <el-button type="primary" @click="selectCustomer">选择所属客户</el-button></span>
|
<span style="margin-left: 10px"> <el-button type="primary" @click="selectCustomer">选择所属客户</el-button></span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="案例文件" prop="file" v-show="form.id == null || form.id <= 0">
|
<el-form-item label="案例文件" prop="file" >
|
||||||
<DragUpload @callbackMethod="addCustomerCase" ref="uploadCaseFile"></DragUpload>
|
<DragUpload v-if="form.id == null || form.id <= 0" @callbackMethod="addOrEditCustomerCase" ref="uploadCaseFile"></DragUpload>
|
||||||
|
<DragUploadEdit v-else @callbackMethod="addOrEditCustomerCase" :caseFileList="form.caseFileList" ref="editUploadCaseFile"></DragUploadEdit>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
|
</div>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
<el-button @click="cancel">取 消</el-button>
|
<el-button @click="cancel">取 消</el-button>
|
||||||
@ -174,8 +189,12 @@
|
|||||||
<script>
|
<script>
|
||||||
import { listCustomerCase, getCustomerCase, delCustomerCase, addCustomerCase, updateCustomerCase, exportCustomerCase,getFileListByCaseId,downCaseFile } from "@/api/custom/customerCase";
|
import { listCustomerCase, getCustomerCase, delCustomerCase, addCustomerCase, updateCustomerCase, exportCustomerCase,getFileListByCaseId,downCaseFile } from "@/api/custom/customerCase";
|
||||||
import DragUpload from "@/components/FileUpload/DragUpload";
|
import DragUpload from "@/components/FileUpload/DragUpload";
|
||||||
|
import DragUploadEdit from "@/components/FileUpload/DragUploadEdit";
|
||||||
import SelectCustomer from "@/components/Customer/SelectCustomer";
|
import SelectCustomer from "@/components/Customer/SelectCustomer";
|
||||||
import MuchFileDown from "@/components/FileDownload/MuchFileDown";
|
import MuchFileDown from "@/components/FileDownload/MuchFileDown";
|
||||||
|
import AutoHideMessage from "@/components/AutoHideMessage";
|
||||||
|
import AutoHideInfo from "@/components/AutoHideInfo";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "CustomerCase",
|
name: "CustomerCase",
|
||||||
data() {
|
data() {
|
||||||
@ -224,7 +243,10 @@
|
|||||||
components: {
|
components: {
|
||||||
"DragUpload": DragUpload,
|
"DragUpload": DragUpload,
|
||||||
"SelectCustomer":SelectCustomer,
|
"SelectCustomer":SelectCustomer,
|
||||||
"MuchFileDown": MuchFileDown
|
"MuchFileDown": MuchFileDown,
|
||||||
|
"AutoHideMessage": AutoHideMessage,
|
||||||
|
"AutoHideInfo":AutoHideInfo,
|
||||||
|
"DragUploadEdit":DragUploadEdit
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
@ -242,7 +264,8 @@
|
|||||||
// 取消按钮
|
// 取消按钮
|
||||||
cancel() {
|
cancel() {
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.$refs["uploadCaseFile"].uploadReset();
|
//this.$refs["uploadCaseFile"].uploadReset();
|
||||||
|
//this.$refs["editUploadCaseFile"].uploadReset();
|
||||||
this.reset();
|
this.reset();
|
||||||
},
|
},
|
||||||
// 表单重置
|
// 表单重置
|
||||||
@ -250,10 +273,11 @@
|
|||||||
this.form = {
|
this.form = {
|
||||||
id: null,
|
id: null,
|
||||||
name: null,
|
name: null,
|
||||||
keywordArray: null,
|
keywordArray: [],
|
||||||
remark: null,
|
remark: null,
|
||||||
customerId: null,
|
customerId: null,
|
||||||
customerName: null,
|
customerName: null,
|
||||||
|
caseFileList:[],
|
||||||
caseFileUrl: [],
|
caseFileUrl: [],
|
||||||
caseFileName: []
|
caseFileName: []
|
||||||
};
|
};
|
||||||
@ -293,6 +317,7 @@
|
|||||||
remark: response.data.remark,
|
remark: response.data.remark,
|
||||||
customerId: response.data.customerId,
|
customerId: response.data.customerId,
|
||||||
customerName: response.data.customerName,
|
customerName: response.data.customerName,
|
||||||
|
caseFileList: response.data.caseFileList,
|
||||||
caseFileUrl: [],
|
caseFileUrl: [],
|
||||||
caseFileName: []
|
caseFileName: []
|
||||||
};
|
};
|
||||||
@ -311,9 +336,31 @@
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//判断案例关键词
|
||||||
|
if(this.form.keywordArray.length > 20){
|
||||||
|
this.$message({message: "案例关键词最多20个", type: "warning"});
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.submitFlag = true;
|
this.submitFlag = true;
|
||||||
this.form.keyword = this.form.keywordArray.join(",");
|
this.form.keyword = this.form.keywordArray.join(",");
|
||||||
if (this.form.id != null) {
|
if (this.form.id != null) {
|
||||||
|
this.$refs["editUploadCaseFile"].uploadFile();
|
||||||
|
} else {
|
||||||
|
this.$refs["uploadCaseFile"].uploadFile();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
addOrEditCustomerCase(fileResult){
|
||||||
|
this.form.caseFileName = fileResult.fileName;
|
||||||
|
this.form.caseFileUrl = fileResult.fileUrl;
|
||||||
|
if(this.form.caseFileUrl.length == 0){
|
||||||
|
this.$message.error('请至少选择一个文件上传');
|
||||||
|
this.submitFlag = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(this.form.id != null){
|
||||||
|
console.log(this.form.caseFileName.length);
|
||||||
updateCustomerCase(this.form).then(response => {
|
updateCustomerCase(this.form).then(response => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.msgSuccess("修改成功");
|
this.msgSuccess("修改成功");
|
||||||
@ -323,34 +370,20 @@
|
|||||||
this.submitFlag = false;
|
this.submitFlag = false;
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
this.$refs["uploadCaseFile"].uploadFile();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
addCustomerCase(fileResult){
|
|
||||||
this.form.caseFileName = fileResult.fileName;
|
|
||||||
this.form.caseFileUrl = fileResult.fileUrl;
|
|
||||||
if(this.form.caseFileUrl.length == 0){
|
|
||||||
this.$message.error('请至少选择一个文件上传');
|
|
||||||
this.submitFlag = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
addCustomerCase(this.form).then(response => {
|
addCustomerCase(this.form).then(response => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.msgSuccess("新增成功");
|
this.msgSuccess("新增成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.$refs["uploadCaseFile"].uploadReset();
|
|
||||||
this.getList();
|
this.getList();
|
||||||
}
|
}
|
||||||
this.submitFlag = false;
|
this.submitFlag = false;
|
||||||
});
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
selectCustomer(){
|
selectCustomer(){
|
||||||
this.$refs['selectCustomerRef'].showDialog("选择案例所属客户");
|
this.$refs['selectCustomerRef'].showDialog("选择案例所属客户");
|
||||||
},
|
},
|
||||||
dealCustomerId(customerId, customerName){
|
dealCustomerId(customerId, customerName){
|
||||||
//console.log(customerId);
|
|
||||||
this.form.customerId = customerId;
|
this.form.customerId = customerId;
|
||||||
this.form.customerName = customerName;
|
this.form.customerName = customerName;
|
||||||
},
|
},
|
||||||
|
@ -301,6 +301,7 @@ export default {
|
|||||||
saleGroupId: null,
|
saleGroupId: null,
|
||||||
accountId: null,
|
accountId: null,
|
||||||
wechatAccount: null,
|
wechatAccount: null,
|
||||||
|
pageFlag: false
|
||||||
},
|
},
|
||||||
// 表单参数
|
// 表单参数
|
||||||
form: {},
|
form: {},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user