commit
b037802a9c
@ -141,36 +141,37 @@ public class SysCustomerCaseController extends BaseController
|
|||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// 转移到SysFileUploadController.java
|
||||||
* 上传文件到OSS返回URL
|
// /**
|
||||||
*/
|
// * 上传文件到OSS返回URL
|
||||||
@PostMapping("/uploadCaseFile")
|
// */
|
||||||
@PreAuthorize("@ss.hasPermi('custom:customerCase:list')")
|
// @PostMapping("/uploadCaseFile")
|
||||||
public AjaxResult uploadCseFile(MultipartFile file) throws Exception {
|
// @PreAuthorize("@ss.hasPermi('custom:customerCase:list')")
|
||||||
try {
|
// public AjaxResult uploadCseFile(MultipartFile file) throws Exception {
|
||||||
if(file == null){
|
// try {
|
||||||
return AjaxResult.error("文件不存在");
|
// if(file == null){
|
||||||
}
|
// return AjaxResult.error("文件不存在");
|
||||||
int fileNameLength = file.getOriginalFilename().length();
|
// }
|
||||||
if (fileNameLength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH)
|
// int fileNameLength = file.getOriginalFilename().length();
|
||||||
{
|
// if (fileNameLength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH)
|
||||||
throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH);
|
// {
|
||||||
}
|
// throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH);
|
||||||
FileUploadUtils.assertAllowed(file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
|
// }
|
||||||
|
// FileUploadUtils.assertAllowed(file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
|
||||||
String fileUrl = AliyunOSSUtils.uploadFileInputSteam(AliyunOSSConfig.casePrefix, DateUtils.getDate()+"/"+file.getOriginalFilename(), file);
|
//
|
||||||
|
// String fileUrl = AliyunOSSUtils.uploadFileInputSteam(AliyunOSSConfig.casePrefix, DateUtils.getDate()+"/"+file.getOriginalFilename(), file);
|
||||||
AjaxResult ajax = null;
|
//
|
||||||
if(StringUtils.isNotEmpty(fileUrl)){
|
// AjaxResult ajax = null;
|
||||||
ajax = AjaxResult.success();
|
// if(StringUtils.isNotEmpty(fileUrl)){
|
||||||
ajax.put("fileUrl", fileUrl);
|
// ajax = AjaxResult.success();
|
||||||
ajax.put("fileName", file.getOriginalFilename());
|
// ajax.put("fileUrl", fileUrl);
|
||||||
}else{
|
// ajax.put("fileName", file.getOriginalFilename());
|
||||||
ajax = AjaxResult.error("文件上传失败");
|
// }else{
|
||||||
}
|
// ajax = AjaxResult.error("文件上传失败");
|
||||||
return ajax;
|
// }
|
||||||
} catch (Exception e) {
|
// return ajax;
|
||||||
return AjaxResult.error("文件上传失败");
|
// } catch (Exception e) {
|
||||||
}
|
// return AjaxResult.error("文件上传失败");
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
@ -0,0 +1,54 @@
|
|||||||
|
package com.stdiet.web.controller.custom;
|
||||||
|
|
||||||
|
import com.stdiet.common.core.controller.BaseController;
|
||||||
|
import com.stdiet.common.core.domain.AjaxResult;
|
||||||
|
import com.stdiet.common.exception.file.FileNameLengthLimitExceededException;
|
||||||
|
import com.stdiet.common.utils.DateUtils;
|
||||||
|
import com.stdiet.common.utils.StringUtils;
|
||||||
|
import com.stdiet.common.utils.file.FileUploadUtils;
|
||||||
|
import com.stdiet.common.utils.file.MimeTypeUtils;
|
||||||
|
import com.stdiet.common.utils.oss.AliyunOSSUtils;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/custom/fileUpload")
|
||||||
|
public class SysFileUploadController extends BaseController {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传文件到OSS返回URL
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/{prefix}")
|
||||||
|
@PreAuthorize("@ss.hasPermi('custom:file:upload')")
|
||||||
|
public AjaxResult uploadCseFile(MultipartFile file, @PathVariable String prefix) throws Exception {
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (file == null) {
|
||||||
|
return AjaxResult.error("文件不存在");
|
||||||
|
}
|
||||||
|
int fileNameLength = file.getOriginalFilename().length();
|
||||||
|
if (fileNameLength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) {
|
||||||
|
throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH);
|
||||||
|
}
|
||||||
|
FileUploadUtils.assertAllowed(file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
|
||||||
|
|
||||||
|
String fileUrl = AliyunOSSUtils.uploadFileInputSteam(prefix + '/', DateUtils.getDate() + "/" + file.getOriginalFilename(), file);
|
||||||
|
|
||||||
|
AjaxResult ajax = null;
|
||||||
|
if (StringUtils.isNotEmpty(fileUrl)) {
|
||||||
|
ajax = AjaxResult.success();
|
||||||
|
ajax.put("fileUrl", fileUrl);
|
||||||
|
ajax.put("fileName", file.getOriginalFilename());
|
||||||
|
} else {
|
||||||
|
ajax = AjaxResult.error("文件上传失败");
|
||||||
|
}
|
||||||
|
return ajax;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return AjaxResult.error("文件上传失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -248,7 +248,7 @@ public class AliyunOSSUtils {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param fileUrl
|
* @param fileUrlList
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static List<String> generatePresignedUrl(List<String> fileUrlList){
|
public static List<String> generatePresignedUrl(List<String> fileUrlList){
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
package com.stdiet.custom.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SysIngredentFile {
|
||||||
|
|
||||||
|
Long id;
|
||||||
|
|
||||||
|
Long igdId;
|
||||||
|
|
||||||
|
String fileUrl;
|
||||||
|
|
||||||
|
String fileName;
|
||||||
|
|
||||||
|
Integer delFlag;
|
||||||
|
|
||||||
|
String createBy;
|
||||||
|
|
||||||
|
Date createTime;
|
||||||
|
|
||||||
|
String updateBy;
|
||||||
|
|
||||||
|
Date updateTime;
|
||||||
|
}
|
@ -6,6 +6,7 @@ import lombok.Data;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 食材对象 sys_ingredient
|
* 食材对象 sys_ingredient
|
||||||
@ -15,8 +16,6 @@ import java.util.Date;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class SysIngredient {
|
public class SysIngredient {
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* id
|
* id
|
||||||
*/
|
*/
|
||||||
@ -107,4 +106,11 @@ public class SysIngredient {
|
|||||||
|
|
||||||
private Long[] notRecIds;
|
private Long[] notRecIds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 食材信息
|
||||||
|
*/
|
||||||
|
private String info;
|
||||||
|
|
||||||
|
private List<SysIngredentFile> imgList;
|
||||||
|
|
||||||
}
|
}
|
@ -1,6 +1,8 @@
|
|||||||
package com.stdiet.custom.mapper;
|
package com.stdiet.custom.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.stdiet.custom.domain.SysIngredentFile;
|
||||||
import com.stdiet.custom.domain.SysIngredient;
|
import com.stdiet.custom.domain.SysIngredient;
|
||||||
import com.stdiet.custom.domain.SysIngredientNotRec;
|
import com.stdiet.custom.domain.SysIngredientNotRec;
|
||||||
import com.stdiet.custom.domain.SysIngredientRec;
|
import com.stdiet.custom.domain.SysIngredientRec;
|
||||||
@ -80,4 +82,6 @@ public interface SysIngredientMapper
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public SysIngredient selectSysIngredientByName(@Param("name") String name);
|
public SysIngredient selectSysIngredientByName(@Param("name") String name);
|
||||||
|
|
||||||
|
int batchInsertIngredientImage(List<SysIngredentFile> list);
|
||||||
}
|
}
|
@ -1,7 +1,9 @@
|
|||||||
package com.stdiet.custom.service.impl;
|
package com.stdiet.custom.service.impl;
|
||||||
|
|
||||||
import com.stdiet.common.utils.DateUtils;
|
import com.stdiet.common.utils.DateUtils;
|
||||||
|
import com.stdiet.common.utils.SecurityUtils;
|
||||||
import com.stdiet.common.utils.StringUtils;
|
import com.stdiet.common.utils.StringUtils;
|
||||||
|
import com.stdiet.custom.domain.SysIngredentFile;
|
||||||
import com.stdiet.custom.domain.SysIngredient;
|
import com.stdiet.custom.domain.SysIngredient;
|
||||||
import com.stdiet.custom.domain.SysIngredientNotRec;
|
import com.stdiet.custom.domain.SysIngredientNotRec;
|
||||||
import com.stdiet.custom.domain.SysIngredientRec;
|
import com.stdiet.custom.domain.SysIngredientRec;
|
||||||
@ -60,11 +62,22 @@ public class SysIngredientServiceImpl implements ISysIngredientService {
|
|||||||
insertRecommand(sysIngredient);
|
insertRecommand(sysIngredient);
|
||||||
//
|
//
|
||||||
insertNotRecommand(sysIngredient);
|
insertNotRecommand(sysIngredient);
|
||||||
|
//
|
||||||
|
if (StringUtils.isNotNull(sysIngredient.getImgList())) {
|
||||||
|
List<SysIngredentFile> fileList = sysIngredient.getImgList();
|
||||||
|
for (SysIngredentFile file : fileList) {
|
||||||
|
file.setId(sysIngredient.getId());
|
||||||
|
file.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
file.setCreateTime(DateUtils.getNowDate());
|
||||||
|
}
|
||||||
|
sysIngredientMapper.batchInsertIngredientImage(fileList);
|
||||||
|
}
|
||||||
return rows;
|
return rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增推荐标签
|
* 新增推荐标签
|
||||||
|
*
|
||||||
* @param ingredient
|
* @param ingredient
|
||||||
*/
|
*/
|
||||||
public void insertRecommand(SysIngredient ingredient) {
|
public void insertRecommand(SysIngredient ingredient) {
|
||||||
@ -85,6 +98,7 @@ public class SysIngredientServiceImpl implements ISysIngredientService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增不推荐标签
|
* 新增不推荐标签
|
||||||
|
*
|
||||||
* @param ingredient
|
* @param ingredient
|
||||||
*/
|
*/
|
||||||
public void insertNotRecommand(SysIngredient ingredient) {
|
public void insertNotRecommand(SysIngredient ingredient) {
|
||||||
@ -148,6 +162,7 @@ public class SysIngredientServiceImpl implements ISysIngredientService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据食材名称查询食材信息
|
* 根据食材名称查询食材信息
|
||||||
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
where del_flag = 0
|
where del_flag = 0
|
||||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||||
<if test="phone != null and phone != ''"> and phone like concat('%', #{phone}, '%')</if>
|
<if test="phone != null and phone != ''"> and phone like concat('%', #{phone}, '%')</if>
|
||||||
|
<if test="fansChannel != null "> and fans_channel = #{fansChannel}</if>
|
||||||
order by create_time desc
|
order by create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
<result property="rec" column="rec"/>
|
<result property="rec" column="rec"/>
|
||||||
<result property="notRec" column="not_rec"/>
|
<result property="notRec" column="not_rec"/>
|
||||||
<result property="reviewStatus" column="review_status"/>
|
<result property="reviewStatus" column="review_status"/>
|
||||||
|
<result property="info" column="info"/>
|
||||||
|
<association property="imgList" column="id" select="selectIngredentFileById"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectSysIngredientVo">
|
<sql id="selectSysIngredientVo">
|
||||||
@ -124,6 +126,7 @@
|
|||||||
<if test="updateBy != null">update_by,</if>
|
<if test="updateBy != null">update_by,</if>
|
||||||
<if test="updateTime != null">update_time,</if>
|
<if test="updateTime != null">update_time,</if>
|
||||||
<if test="reviewStatus != null">review_status,</if>
|
<if test="reviewStatus != null">review_status,</if>
|
||||||
|
<if test="info != null">info,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="name != null">#{name},</if>
|
<if test="name != null">#{name},</if>
|
||||||
@ -138,6 +141,7 @@
|
|||||||
<if test="updateBy != null">#{updateBy},</if>
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
<if test="updateTime != null">#{updateTime},</if>
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
<if test="reviewStatus != null">#{reviewStatus},</if>
|
<if test="reviewStatus != null">#{reviewStatus},</if>
|
||||||
|
<if test="info != null">#{info},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@ -192,6 +196,7 @@
|
|||||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
<if test="reviewStatus != null">review_status = #{reviewStatus},</if>
|
<if test="reviewStatus != null">review_status = #{reviewStatus},</if>
|
||||||
|
<if test="info != null">info = #{info},</if>
|
||||||
</trim>
|
</trim>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
@ -213,4 +218,28 @@
|
|||||||
where name = #{name} limit 1
|
where name = #{name} limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 添加食材图片-->
|
||||||
|
<insert id="batchInsertIngredientImage">
|
||||||
|
insert into sys_ingredient_file(igd_id, file_url, file_name, create_by, create_time, update_by, update_time )
|
||||||
|
values
|
||||||
|
<foreach collection="list" separator="," item="item" index="index">
|
||||||
|
(#{item.ingredientId},#{item.fileUrl},#{item.fileName},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<resultMap id="SysIngredentFileResult" type="SysIngredentFile">
|
||||||
|
<result property="id" column="id"/>
|
||||||
|
<result property="fileName" column="file_name"/>
|
||||||
|
<result property="fileUrl" column="file_url"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!-- 查找图片-->
|
||||||
|
<select id="selectIngredentFileById" parameterType="Long" resultMap="SysIngredentFileResult">
|
||||||
|
select id, file_url, file_name from sys_ingredent_file where igd_id = #{id} and del_flag = 0
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 删除图片记录-->
|
||||||
|
<update id="deleteIngredentFileById" parameterType="Long">
|
||||||
|
update sys_ingredent_file set del_flag=1 where id=#{id}
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
@ -70,7 +70,7 @@
|
|||||||
>复制
|
>复制
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-popover placement="top" trigger="click">
|
<el-popover placement="top" trigger="click">
|
||||||
<VueQr :text="copyValue" :logoSrc="logo" size="256" />
|
<VueQr :text="copyValue" :logoSrc="logo" :size="256" />
|
||||||
<el-button
|
<el-button
|
||||||
slot="reference"
|
slot="reference"
|
||||||
icon="el-icon-picture-outline"
|
icon="el-icon-picture-outline"
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-upload class="upload-demo"
|
<el-upload
|
||||||
|
class="upload-demo"
|
||||||
ref="upload"
|
ref="upload"
|
||||||
drag
|
drag
|
||||||
:headers="upload.headers"
|
:headers="upload.headers"
|
||||||
@ -15,28 +16,31 @@
|
|||||||
:on-success="handleFileSuccess"
|
:on-success="handleFileSuccess"
|
||||||
:on-error="handleFileFail"
|
:on-error="handleFileFail"
|
||||||
:data="upload.data"
|
:data="upload.data"
|
||||||
:auto-upload="false">
|
:auto-upload="false"
|
||||||
<i class="el-icon-upload"></i>
|
>
|
||||||
|
<em class="el-icon-upload" />
|
||||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||||
<div class="el-upload__tip" slot="tip">最多可上传{{upload.limit}}个文件,且每个文件不超过{{upload.fileSize/(1024*1024)}}M</div>
|
<div class="el-upload__tip" slot="tip">
|
||||||
|
最多可上传{{ upload.limit }}个文件,且每个文件不超过{{
|
||||||
|
upload.fileSize / (1024 * 1024)
|
||||||
|
}}M
|
||||||
|
</div>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getToken } from '@/utils/auth'
|
import { getToken } from "@/utils/auth";
|
||||||
export default {
|
export default {
|
||||||
name: "DragUpload",
|
name: "DragUpload",
|
||||||
components: {
|
components: {},
|
||||||
|
|
||||||
},
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
upload: {
|
upload: {
|
||||||
// 是否禁用上传
|
// 是否禁用上传
|
||||||
isUploading: false,
|
isUploading: false,
|
||||||
// 上传的地址
|
// 上传的地址
|
||||||
url: process.env.VUE_APP_BASE_API + "/custom/customerCase/uploadCaseFile",
|
url: process.env.VUE_APP_BASE_API + "/custom/fileUpload/" + this.prefix,
|
||||||
// 设置上传的请求头部
|
// 设置上传的请求头部
|
||||||
headers: {Authorization: 'Bearer ' + getToken()},
|
headers: { Authorization: "Bearer " + getToken() },
|
||||||
// 其他需要携带的数据
|
// 其他需要携带的数据
|
||||||
data: {},
|
data: {},
|
||||||
//文件列表
|
//文件列表
|
||||||
@ -46,20 +50,23 @@ export default {
|
|||||||
//每个文件大小(单位:byte)
|
//每个文件大小(单位:byte)
|
||||||
fileSize: 1024 * 1024 * 10,
|
fileSize: 1024 * 1024 * 10,
|
||||||
//是否支持同时选择多张
|
//是否支持同时选择多张
|
||||||
multiple: true
|
multiple: true,
|
||||||
},
|
},
|
||||||
uploadResult: {
|
uploadResult: {
|
||||||
fileUrl: [],
|
fileUrl: [],
|
||||||
fileName:[]
|
fileName: [],
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
uploadFile() {
|
uploadFile() {
|
||||||
if(this.upload.fileList.length > 0 && this.uploadResult.fileUrl.length < this.upload.fileList.length){
|
if (
|
||||||
|
this.upload.fileList.length > 0 &&
|
||||||
|
this.uploadResult.fileUrl.length < this.upload.fileList.length
|
||||||
|
) {
|
||||||
this.$refs.upload.submit();
|
this.$refs.upload.submit();
|
||||||
} else {
|
} else {
|
||||||
this.$emit('callbackMethod', this.uploadResult);
|
this.$emit("callbackMethod", this.uploadResult);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
uploadReset() {
|
uploadReset() {
|
||||||
@ -101,34 +108,33 @@ export default {
|
|||||||
this.uploadResult.fileName.push(response.fileName);
|
this.uploadResult.fileName.push(response.fileName);
|
||||||
if (this.uploadResult.fileUrl.length === this.upload.fileList.length) {
|
if (this.uploadResult.fileUrl.length === this.upload.fileList.length) {
|
||||||
//文件全部上传成功,则调用回调方法
|
//文件全部上传成功,则调用回调方法
|
||||||
this.$emit('callbackMethod', this.uploadResult);
|
this.$emit("callbackMethod", this.uploadResult);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.upload.fileList = fileList.pop();
|
this.upload.fileList = fileList.pop();
|
||||||
this.$message.error('文件上传失败,请检查文件格式');
|
this.$message.error("文件上传失败,请检查文件格式");
|
||||||
this.$emit('changeSubmitFlag', false);
|
this.$emit("changeSubmitFlag", false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 文件上传失败处理
|
// 文件上传失败处理
|
||||||
handleFileFail(err, file, fileList) {
|
handleFileFail(err, file, fileList) {
|
||||||
this.$message.error('文件上传失败,请检查文件格式');
|
this.$message.error("文件上传失败,请检查文件格式");
|
||||||
this.upload.fileList = fileList.pop();
|
this.upload.fileList = fileList.pop();
|
||||||
this.$emit('changeSubmitFlag', false);
|
this.$emit("changeSubmitFlag", false);
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
prefix: {
|
||||||
|
type: String,
|
||||||
|
default: "case",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
//this.uploadReset();
|
//this.uploadReset();
|
||||||
},
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
@ -1,12 +1,24 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div v-for="(item, index) in oldCaseFileList">
|
<div v-for="(item, index) in oldCaseFileList" :key="index">
|
||||||
<span style="margin-right: 10px;">
|
<span style="margin-right: 10px">
|
||||||
{{item.fileName.length > 15 ? (item.fileName.substring(0,15)+"...") : item.fileName}}
|
{{
|
||||||
|
item.fileName.length > 15
|
||||||
|
? item.fileName.substring(0, 15) + "..."
|
||||||
|
: item.fileName
|
||||||
|
}}
|
||||||
</span>
|
</span>
|
||||||
<el-button style="margin-left: 10px;" type="danger" size="small" @click="removeOldFile(index)">移除该文件</el-button>
|
<el-button
|
||||||
|
style="margin-left: 10px"
|
||||||
|
type="danger"
|
||||||
|
size="small"
|
||||||
|
@click="removeOldFile(index)"
|
||||||
|
>移除该文件</el-button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<el-upload class="upload-demo" style="margin-top: 10px;"
|
<el-upload
|
||||||
|
class="upload-demo"
|
||||||
|
style="margin-top: 10px"
|
||||||
ref="upload"
|
ref="upload"
|
||||||
drag
|
drag
|
||||||
:headers="upload.headers"
|
:headers="upload.headers"
|
||||||
@ -22,20 +34,25 @@
|
|||||||
:on-success="handleFileSuccess"
|
:on-success="handleFileSuccess"
|
||||||
:on-error="handleFileFail"
|
:on-error="handleFileFail"
|
||||||
:data="upload.data"
|
:data="upload.data"
|
||||||
:auto-upload="false">
|
:auto-upload="false"
|
||||||
<i class="el-icon-upload"></i>
|
>
|
||||||
|
<em class="el-icon-upload" />
|
||||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
<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>
|
<div class="el-upload__tip" slot="tip">
|
||||||
|
已存在{{ oldCaseFileList.length }}个文件,还可上传{{
|
||||||
|
upload.limit
|
||||||
|
}}个文件,且每个文件不超过{{ upload.fileSize / (1024 * 1024) }}M
|
||||||
|
</div>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getToken } from '@/utils/auth'
|
import { getToken } from "@/utils/auth";
|
||||||
import AutoHideMessage from "@/components/AutoHideMessage";
|
// import AutoHideMessage from "@/components/AutoHideMessage";
|
||||||
export default {
|
export default {
|
||||||
name: "DragUploadEdit",
|
name: "DragUploadEdit",
|
||||||
components: {
|
components: {
|
||||||
"AutoHideMessage":AutoHideMessage
|
// "AutoHideMessage":AutoHideMessage
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -43,9 +60,9 @@ export default {
|
|||||||
// 是否禁用上传
|
// 是否禁用上传
|
||||||
isUploading: false,
|
isUploading: false,
|
||||||
// 上传的地址
|
// 上传的地址
|
||||||
url: process.env.VUE_APP_BASE_API + "/custom/customerCase/uploadCaseFile",
|
url: process.env.VUE_APP_BASE_API + "/custom/fileUpload/" + this.prefix,
|
||||||
// 设置上传的请求头部
|
// 设置上传的请求头部
|
||||||
headers: {Authorization: 'Bearer ' + getToken()},
|
headers: { Authorization: "Bearer " + getToken() },
|
||||||
// 其他需要携带的数据
|
// 其他需要携带的数据
|
||||||
data: {},
|
data: {},
|
||||||
//文件列表
|
//文件列表
|
||||||
@ -55,18 +72,21 @@ export default {
|
|||||||
//每个文件大小(单位:byte)
|
//每个文件大小(单位:byte)
|
||||||
fileSize: 1024 * 1024 * 10,
|
fileSize: 1024 * 1024 * 10,
|
||||||
//是否支持同时选择多张
|
//是否支持同时选择多张
|
||||||
multiple: true
|
multiple: true,
|
||||||
},
|
},
|
||||||
oldCaseFileList: this.caseFileList,
|
oldCaseFileList: this.caseFileList,
|
||||||
uploadResult: {
|
uploadResult: {
|
||||||
fileUrl: [],
|
fileUrl: [],
|
||||||
fileName:[]
|
fileName: [],
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async uploadFile() {
|
async uploadFile() {
|
||||||
if(this.upload.fileList.length > 0 && this.uploadResult.fileUrl.length < this.upload.fileList.length){
|
if (
|
||||||
|
this.upload.fileList.length > 0 &&
|
||||||
|
this.uploadResult.fileUrl.length < this.upload.fileList.length
|
||||||
|
) {
|
||||||
this.$refs.upload.submit();
|
this.$refs.upload.submit();
|
||||||
} else {
|
} else {
|
||||||
//合并旧文件
|
//合并旧文件
|
||||||
@ -76,7 +96,7 @@ export default {
|
|||||||
this.uploadResult.fileName.unshift(item.fileName);
|
this.uploadResult.fileName.unshift(item.fileName);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.$emit('callbackMethod', this.uploadResult);
|
this.$emit("callbackMethod", this.uploadResult);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
removeOldFile(index) {
|
removeOldFile(index) {
|
||||||
@ -129,45 +149,43 @@ export default {
|
|||||||
this.uploadResult.fileName.unshift(item.fileName);
|
this.uploadResult.fileName.unshift(item.fileName);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.$emit('callbackMethod', this.uploadResult);
|
this.$emit("callbackMethod", this.uploadResult);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.upload.fileList = fileList.pop();
|
this.upload.fileList = fileList.pop();
|
||||||
this.$message.error('文件上传失败,请检查文件格式');
|
this.$message.error("文件上传失败,请检查文件格式");
|
||||||
this.$emit('changeSubmitFlag', false);
|
this.$emit("changeSubmitFlag", false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 文件上传失败处理
|
// 文件上传失败处理
|
||||||
handleFileFail(err, file, fileList) {
|
handleFileFail(err, file, fileList) {
|
||||||
this.$message.error('文件上传失败,请检查文件格式');
|
this.$message.error("文件上传失败,请检查文件格式");
|
||||||
this.upload.fileList = fileList.pop();
|
this.upload.fileList = fileList.pop();
|
||||||
this.$emit('changeSubmitFlag', false);
|
this.$emit("changeSubmitFlag", false);
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
caseFileList: {
|
caseFileList: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: function () {
|
default: function () {
|
||||||
return [];
|
return [];
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
created() {
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
prefix: {
|
||||||
|
type: String,
|
||||||
|
default: "case",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
created() {},
|
||||||
watch: {
|
watch: {
|
||||||
caseFileList: function (newVal, oldVal) {
|
caseFileList: function (newVal, oldVal) {
|
||||||
//console.log(newVal.length);
|
//console.log(newVal.length);
|
||||||
this.oldCaseFileList = newVal;
|
this.oldCaseFileList = newVal;
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
60
stdiet-ui/src/components/FileUpload/index.vue
Normal file
60
stdiet-ui/src/components/FileUpload/index.vue
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<template>
|
||||||
|
<el-upload
|
||||||
|
ref="ElUpload"
|
||||||
|
v-bind="$props"
|
||||||
|
>
|
||||||
|
<slot></slot>
|
||||||
|
</el-upload>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'formUpload',
|
||||||
|
componentName: 'formUpload',
|
||||||
|
props: [
|
||||||
|
'value', 'action', 'headers', 'multiple', 'data', 'show-file-list', 'name', 'with-credentials', 'drag',
|
||||||
|
'accept', 'on-preview', 'on-remove', 'on-success', 'on-error', 'on-progress', 'on-change',
|
||||||
|
'before-upload', 'before-remove', 'list-type', 'auto-upload', 'file-list', 'http-request',
|
||||||
|
'disabled', 'limit', 'on-exceed',
|
||||||
|
],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
currentValue: this.value,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
// eslint-disable-next-line
|
||||||
|
value(val, oldValue) {
|
||||||
|
this.setCurrentValue(val);
|
||||||
|
},
|
||||||
|
// eslint-disable-next-line
|
||||||
|
fileList(val, oldValue) {
|
||||||
|
this.setCurrentValue(val);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
clearFiles() {
|
||||||
|
this.$refs.ElUpload.clearFiles();
|
||||||
|
},
|
||||||
|
abort(file) {
|
||||||
|
this.$refs.ElUpload.abort(file);
|
||||||
|
},
|
||||||
|
dispatch(componentName, eventName, params) {
|
||||||
|
let parent = this.$parent || this.$root;
|
||||||
|
let name = parent.$options.componentName;
|
||||||
|
while (parent && (!name || name !== componentName)) {
|
||||||
|
parent = parent.$parent;
|
||||||
|
if (parent) {
|
||||||
|
name = parent.$options.componentName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (parent) {
|
||||||
|
parent.$emit(...[eventName].concat(params));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
setCurrentValue(value) {
|
||||||
|
this.currentValue = value;
|
||||||
|
this.dispatch('ElFormItem', 'el.form.change', [].concat(value));
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
@ -25,7 +25,7 @@
|
|||||||
trigger="click"
|
trigger="click"
|
||||||
style="margin: 0 12px"
|
style="margin: 0 12px"
|
||||||
>
|
>
|
||||||
<VueQr :text="copyValue" :logoSrc="logo" size="256" />
|
<VueQr :text="copyValue" :logoSrc="logo" :size="256" />
|
||||||
<el-button
|
<el-button
|
||||||
slot="reference"
|
slot="reference"
|
||||||
size="mini"
|
size="mini"
|
||||||
|
@ -201,7 +201,7 @@
|
|||||||
v-show="dataList.length == 0"
|
v-show="dataList.length == 0"
|
||||||
style="font-size: 20px; text-align: center"
|
style="font-size: 20px; text-align: center"
|
||||||
>
|
>
|
||||||
<VueQr :text="copyValue" :logoSrc="logo" size="256"/>
|
<VueQr :text="copyValue" :logoSrc="logo" :size="256" />
|
||||||
<div style="text-align: center; margin-top: 20px">
|
<div style="text-align: center; margin-top: 20px">
|
||||||
<el-button
|
<el-button
|
||||||
icon="el-icon-share"
|
icon="el-icon-share"
|
||||||
@ -689,6 +689,28 @@ export default {
|
|||||||
? medicalReportNameArray[2]
|
? medicalReportNameArray[2]
|
||||||
: "体检报告(3)"
|
: "体检报告(3)"
|
||||||
: "";
|
: "";
|
||||||
|
detailHealthy.moistureDate = detailHealthy.moistureDate
|
||||||
|
.split(",")
|
||||||
|
.reduce((arr, cur) => {
|
||||||
|
const tarData = healthyData.moistureDateArray.find(
|
||||||
|
(obj) => obj.value === cur
|
||||||
|
);
|
||||||
|
if (tarData) {
|
||||||
|
arr.push(tarData.name);
|
||||||
|
}
|
||||||
|
return arr;
|
||||||
|
}, []);
|
||||||
|
detailHealthy.bloodData = detailHealthy.bloodData
|
||||||
|
.split(",")
|
||||||
|
.reduce((arr, cur) => {
|
||||||
|
const tarData = healthyData.bloodDataArray.find(
|
||||||
|
(obj) => obj.value === cur
|
||||||
|
);
|
||||||
|
if (tarData) {
|
||||||
|
arr.push(tarData.name);
|
||||||
|
}
|
||||||
|
return arr;
|
||||||
|
}, []);
|
||||||
this.detailHealthy = detailHealthy;
|
this.detailHealthy = detailHealthy;
|
||||||
for (let i = 0; i < this.healthyTitleData.length; i++) {
|
for (let i = 0; i < this.healthyTitleData.length; i++) {
|
||||||
let stepArray = [];
|
let stepArray = [];
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
v-if="cusOutId"
|
v-if="cusOutId"
|
||||||
style="margin: 0 12px"
|
style="margin: 0 12px"
|
||||||
>
|
>
|
||||||
<VueQr :text="copyValue" :logoSrc="logo" size="256" />
|
<VueQr :text="copyValue" :logoSrc="logo" :size="256" />
|
||||||
<el-button
|
<el-button
|
||||||
slot="reference"
|
slot="reference"
|
||||||
size="mini"
|
size="mini"
|
||||||
|
@ -198,7 +198,7 @@
|
|||||||
>复制
|
>复制
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-popover placement="top" trigger="click">
|
<el-popover placement="top" trigger="click">
|
||||||
<VueQr :text="copyValue" :logoSrc="logo" size="256"/>
|
<VueQr :text="copyValue" :logoSrc="logo" :size="256"/>
|
||||||
<el-button
|
<el-button
|
||||||
slot="reference"
|
slot="reference"
|
||||||
icon="el-icon-picture-outline"
|
icon="el-icon-picture-outline"
|
||||||
|
@ -25,16 +25,17 @@
|
|||||||
@keyup.enter.native="handleQuery"
|
@keyup.enter.native="handleQuery"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!--<el-form-item label="主营养师" prop="mainDietitian">
|
<el-form-item label="进粉渠道" prop="fansChannel">
|
||||||
<el-input
|
<el-select v-model="queryParams.fansChannel" placeholder="请选择">
|
||||||
v-model="queryParams.mainDietitian"
|
<el-option
|
||||||
placeholder="请输入主营养师"
|
v-for="dict in fansChannelOptions"
|
||||||
clearable
|
:key="dict.dictValue"
|
||||||
size="small"
|
:label="dict.dictLabel"
|
||||||
@keyup.enter.native="handleQuery"
|
:value="parseInt(dict.dictValue)"
|
||||||
/>
|
/>
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="营养师助理" prop="assistantDietitian">
|
<!--<el-form-item label="营养师助理" prop="assistantDietitian">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryParams.assistantDietitian"
|
v-model="queryParams.assistantDietitian"
|
||||||
placeholder="请输入营养师助理"
|
placeholder="请输入营养师助理"
|
||||||
@ -430,6 +431,7 @@ export default {
|
|||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
|
fansChannel: null,
|
||||||
name: null,
|
name: null,
|
||||||
phone: null,
|
phone: null,
|
||||||
mainDietitian: null,
|
mainDietitian: null,
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form
|
||||||
|
:model="queryParams"
|
||||||
|
ref="queryForm"
|
||||||
|
:inline="true"
|
||||||
|
v-show="showSearch"
|
||||||
|
label-width="68px"
|
||||||
|
>
|
||||||
<!--<el-form-item label="案例信息" prop="name">
|
<!--<el-form-item label="案例信息" prop="name">
|
||||||
<el-input
|
<el-input
|
||||||
v-model.trim="queryParams.name"
|
v-model.trim="queryParams.name"
|
||||||
@ -17,12 +23,15 @@
|
|||||||
allow-create
|
allow-create
|
||||||
clearable
|
clearable
|
||||||
default-first-option
|
default-first-option
|
||||||
placeholder="关键词搜索" style="width: 100%;">
|
placeholder="关键词搜索"
|
||||||
|
style="width: 100%"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in caseKeyOptions"
|
v-for="dict in caseKeyOptions"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
:label="dict.dictLabel"
|
:label="dict.dictLabel"
|
||||||
:value="dict.dictValue">
|
:value="dict.dictValue"
|
||||||
|
>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -36,8 +45,16 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
type="cyan"
|
||||||
|
icon="el-icon-search"
|
||||||
|
size="mini"
|
||||||
|
@click="handleQuery"
|
||||||
|
>搜索</el-button
|
||||||
|
>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
||||||
|
>重置</el-button
|
||||||
|
>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
@ -49,7 +66,8 @@
|
|||||||
size="mini"
|
size="mini"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
v-hasPermi="['custom:customerCase:add']"
|
v-hasPermi="['custom:customerCase:add']"
|
||||||
>新增</el-button>
|
>新增</el-button
|
||||||
|
>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
@ -59,7 +77,8 @@
|
|||||||
:disabled="single"
|
:disabled="single"
|
||||||
@click="handleUpdate"
|
@click="handleUpdate"
|
||||||
v-hasPermi="['custom:customerCase:edit']"
|
v-hasPermi="['custom:customerCase:edit']"
|
||||||
>修改</el-button>
|
>修改</el-button
|
||||||
|
>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
@ -69,7 +88,8 @@
|
|||||||
:disabled="multiple"
|
:disabled="multiple"
|
||||||
@click="handleDelete"
|
@click="handleDelete"
|
||||||
v-hasPermi="['custom:customerCase:remove']"
|
v-hasPermi="['custom:customerCase:remove']"
|
||||||
>删除</el-button>
|
>删除</el-button
|
||||||
|
>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
@ -78,34 +98,48 @@
|
|||||||
size="mini"
|
size="mini"
|
||||||
@click="handleExport"
|
@click="handleExport"
|
||||||
v-hasPermi="['custom:customerCase:export']"
|
v-hasPermi="['custom:customerCase:export']"
|
||||||
>导出</el-button>
|
>导出</el-button
|
||||||
|
>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar
|
||||||
|
:showSearch.sync="showSearch"
|
||||||
|
@queryTable="getList"
|
||||||
|
></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<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">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<AutoHideMessage :data="scope.row.name" :maxLength="10"></AutoHideMessage>
|
<AutoHideMessage
|
||||||
|
:data="scope.row.name"
|
||||||
|
:maxLength="10"
|
||||||
|
></AutoHideMessage>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="关键词" align="center" prop="keyword">
|
<el-table-column label="关键词" align="center" prop="keyword">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<AutoHideMessage :data="scope.row.keyword" :maxLength="10"></AutoHideMessage>
|
<AutoHideMessage
|
||||||
|
:data="scope.row.keyword"
|
||||||
|
:maxLength="10"
|
||||||
|
></AutoHideMessage>
|
||||||
<!--<AutoHideInfo :data="scope.row.keyword.split(',')" :line="1"></AutoHideInfo>-->
|
<!--<AutoHideInfo :data="scope.row.keyword.split(',')" :line="1"></AutoHideInfo>-->
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="备注" align="center" prop="remark">
|
<el-table-column label="备注" align="center" prop="remark">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<AutoHideMessage :data="scope.row.remark" :maxLength="10"></AutoHideMessage>
|
<AutoHideMessage
|
||||||
|
:data="scope.row.remark"
|
||||||
|
:maxLength="10"
|
||||||
|
></AutoHideMessage>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</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="文件" align="center">
|
||||||
label="文件"
|
|
||||||
align="center"
|
|
||||||
>
|
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
@ -127,7 +161,11 @@
|
|||||||
}}</span>
|
}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</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
|
||||||
size="mini"
|
size="mini"
|
||||||
@ -135,14 +173,16 @@
|
|||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
@click="handleUpdate(scope.row)"
|
@click="handleUpdate(scope.row)"
|
||||||
v-hasPermi="['custom:customerCase:edit']"
|
v-hasPermi="['custom:customerCase:edit']"
|
||||||
>修改</el-button>
|
>修改</el-button
|
||||||
|
>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
@click="handleDelete(scope.row)"
|
@click="handleDelete(scope.row)"
|
||||||
v-hasPermi="['custom:customerCase:remove']"
|
v-hasPermi="['custom:customerCase:remove']"
|
||||||
>删除</el-button>
|
>删除</el-button
|
||||||
|
>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -156,11 +196,24 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- 添加或修改客户案例管理对话框 -->
|
<!-- 添加或修改客户案例管理对话框 -->
|
||||||
<el-dialog :title="title" :visible.sync="open" @closed="cancel" width="520px" 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">
|
<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="请输入案例名称"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="关键词" prop="keywordArray">
|
<el-form-item label="关键词" prop="keywordArray">
|
||||||
<el-select
|
<el-select
|
||||||
@ -170,12 +223,15 @@
|
|||||||
clearable
|
clearable
|
||||||
allow-create
|
allow-create
|
||||||
default-first-option
|
default-first-option
|
||||||
placeholder="请创建案例关键词,按回车创建,最多20个" style="width: 100%;">
|
placeholder="请创建案例关键词,按回车创建,最多20个"
|
||||||
|
style="width: 100%"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in caseKeyOptions"
|
v-for="dict in caseKeyOptions"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
:label="dict.dictLabel"
|
:label="dict.dictLabel"
|
||||||
:value="dict.dictValue">
|
:value="dict.dictValue"
|
||||||
|
>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -191,12 +247,34 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="所属客户" prop="customerId">
|
<el-form-item label="所属客户" prop="customerId">
|
||||||
<el-input v-model="form.customerName" placeholder="" style="width: 60%" :readonly="true" />
|
<el-input
|
||||||
<span style="margin-left: 10px"> <el-button type="primary" @click="selectCustomer">选择所属客户</el-button></span>
|
v-model="form.customerName"
|
||||||
|
placeholder=""
|
||||||
|
style="width: 60%"
|
||||||
|
:readonly="true"
|
||||||
|
/>
|
||||||
|
<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">
|
<el-form-item label="案例文件" prop="file">
|
||||||
<DragUpload v-show="form.id == null || form.id <= 0" @changeSubmitFlag="changeSubmitFlag" @callbackMethod="addOrEditCustomerCase" ref="uploadCaseFile"></DragUpload>
|
<DragUpload
|
||||||
<DragUploadEdit v-show="form.id != null || form.id > 0" @callbackMethod="addOrEditCustomerCase" @changeSubmitFlag="changeSubmitFlag" :caseFileList="form.caseFileList" ref="editUploadCaseFile"></DragUploadEdit>
|
v-if="form.id == null || form.id <= 0"
|
||||||
|
@changeSubmitFlag="changeSubmitFlag"
|
||||||
|
@callbackMethod="addOrEditCustomerCase"
|
||||||
|
ref="uploadCaseFile"
|
||||||
|
prefix="case"
|
||||||
|
/>
|
||||||
|
<DragUploadEdit
|
||||||
|
v-else
|
||||||
|
@callbackMethod="addOrEditCustomerCase"
|
||||||
|
@changeSubmitFlag="changeSubmitFlag"
|
||||||
|
:caseFileList="form.caseFileList"
|
||||||
|
ref="editUploadCaseFile"
|
||||||
|
prefix="case"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
@ -207,12 +285,23 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<MuchFileDown ref="muchFileDownRef"></MuchFileDown>
|
<MuchFileDown ref="muchFileDownRef"></MuchFileDown>
|
||||||
<SelectCustomer @dealCustomerId="dealCustomerId" ref="selectCustomerRef"></SelectCustomer>
|
<SelectCustomer
|
||||||
|
@dealCustomerId="dealCustomerId"
|
||||||
|
ref="selectCustomerRef"
|
||||||
|
></SelectCustomer>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listCustomerCase, getCustomerCase, delCustomerCase, addCustomerCase, updateCustomerCase, exportCustomerCase,getFileListByCaseId,downCaseFile } from "@/api/custom/customerCase";
|
import {
|
||||||
|
listCustomerCase,
|
||||||
|
getCustomerCase,
|
||||||
|
delCustomerCase,
|
||||||
|
addCustomerCase,
|
||||||
|
updateCustomerCase,
|
||||||
|
exportCustomerCase,
|
||||||
|
getFileListByCaseId,
|
||||||
|
} from "@/api/custom/customerCase";
|
||||||
import DragUpload from "@/components/FileUpload/DragUpload";
|
import DragUpload from "@/components/FileUpload/DragUpload";
|
||||||
import DragUploadEdit from "@/components/FileUpload/DragUploadEdit";
|
import DragUploadEdit from "@/components/FileUpload/DragUploadEdit";
|
||||||
import SelectCustomer from "@/components/Customer/SelectCustomer";
|
import SelectCustomer from "@/components/Customer/SelectCustomer";
|
||||||
@ -248,12 +337,10 @@
|
|||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
name: null,
|
name: null,
|
||||||
keyword: null,
|
keyword: null,
|
||||||
customerName: null
|
customerName: null,
|
||||||
},
|
},
|
||||||
// 表单参数
|
// 表单参数
|
||||||
form: {
|
form: {},
|
||||||
|
|
||||||
},
|
|
||||||
// 表单校验
|
// 表单校验
|
||||||
rules: {
|
rules: {
|
||||||
name: [
|
name: [
|
||||||
@ -269,12 +356,12 @@
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
"DragUpload": DragUpload,
|
DragUpload: DragUpload,
|
||||||
"SelectCustomer":SelectCustomer,
|
SelectCustomer: SelectCustomer,
|
||||||
"MuchFileDown": MuchFileDown,
|
MuchFileDown: MuchFileDown,
|
||||||
"AutoHideMessage": AutoHideMessage,
|
AutoHideMessage: AutoHideMessage,
|
||||||
"AutoHideInfo":AutoHideInfo,
|
AutoHideInfo: AutoHideInfo,
|
||||||
"DragUploadEdit":DragUploadEdit
|
DragUploadEdit: DragUploadEdit,
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
@ -287,7 +374,7 @@
|
|||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.queryParams.keyword = this.keywordArray.join(",");
|
this.queryParams.keyword = this.keywordArray.join(",");
|
||||||
listCustomerCase(this.queryParams).then(response => {
|
listCustomerCase(this.queryParams).then((response) => {
|
||||||
this.customerCaseList = response.rows;
|
this.customerCaseList = response.rows;
|
||||||
this.total = response.total;
|
this.total = response.total;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
@ -296,7 +383,9 @@
|
|||||||
// 取消按钮
|
// 取消按钮
|
||||||
cancel() {
|
cancel() {
|
||||||
this.open = false;
|
this.open = false;
|
||||||
|
this.$refs["uploadCaseFile"] &&
|
||||||
this.$refs["uploadCaseFile"].uploadReset();
|
this.$refs["uploadCaseFile"].uploadReset();
|
||||||
|
this.$refs["editUploadCaseFile"] &&
|
||||||
this.$refs["editUploadCaseFile"].uploadReset();
|
this.$refs["editUploadCaseFile"].uploadReset();
|
||||||
this.reset();
|
this.reset();
|
||||||
},
|
},
|
||||||
@ -311,7 +400,7 @@
|
|||||||
customerName: null,
|
customerName: null,
|
||||||
caseFileList: [],
|
caseFileList: [],
|
||||||
caseFileUrl: [],
|
caseFileUrl: [],
|
||||||
caseFileName: []
|
caseFileName: [],
|
||||||
};
|
};
|
||||||
this.resetForm("form");
|
this.resetForm("form");
|
||||||
},
|
},
|
||||||
@ -327,9 +416,9 @@
|
|||||||
},
|
},
|
||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.ids = selection.map(item => item.id)
|
this.ids = selection.map((item) => item.id);
|
||||||
this.single = selection.length!==1
|
this.single = selection.length !== 1;
|
||||||
this.multiple = !selection.length
|
this.multiple = !selection.length;
|
||||||
},
|
},
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
handleAdd() {
|
handleAdd() {
|
||||||
@ -340,8 +429,8 @@
|
|||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.reset();
|
this.reset();
|
||||||
const id = row.id || this.ids
|
const id = row.id || this.ids;
|
||||||
getCustomerCase(id).then(response => {
|
getCustomerCase(id).then((response) => {
|
||||||
this.form = {
|
this.form = {
|
||||||
id: response.data.id,
|
id: response.data.id,
|
||||||
name: response.data.name,
|
name: response.data.name,
|
||||||
@ -351,7 +440,7 @@
|
|||||||
customerName: response.data.customerName,
|
customerName: response.data.customerName,
|
||||||
caseFileList: response.data.caseFileList,
|
caseFileList: response.data.caseFileList,
|
||||||
caseFileUrl: [],
|
caseFileUrl: [],
|
||||||
caseFileName: []
|
caseFileName: [],
|
||||||
};
|
};
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改客户案例管理";
|
this.title = "修改客户案例管理";
|
||||||
@ -359,7 +448,7 @@
|
|||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.submitFlag) {
|
if (this.submitFlag) {
|
||||||
this.$message({
|
this.$message({
|
||||||
@ -387,13 +476,13 @@
|
|||||||
this.form.caseFileName = fileResult.fileName;
|
this.form.caseFileName = fileResult.fileName;
|
||||||
this.form.caseFileUrl = fileResult.fileUrl;
|
this.form.caseFileUrl = fileResult.fileUrl;
|
||||||
if (this.form.caseFileUrl.length == 0) {
|
if (this.form.caseFileUrl.length == 0) {
|
||||||
this.$message.error('请至少选择一个文件上传');
|
this.$message.error("请至少选择一个文件上传");
|
||||||
this.submitFlag = false;
|
this.submitFlag = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.form.id != null) {
|
if (this.form.id != null) {
|
||||||
// console.log(this.form.caseFileName.length);
|
// 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.$refs["editUploadCaseFile"].uploadReset();
|
this.$refs["editUploadCaseFile"].uploadReset();
|
||||||
this.msgSuccess("修改成功");
|
this.msgSuccess("修改成功");
|
||||||
@ -401,10 +490,9 @@
|
|||||||
this.getList();
|
this.getList();
|
||||||
}
|
}
|
||||||
this.submitFlag = false;
|
this.submitFlag = false;
|
||||||
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
addCustomerCase(this.form).then(response => {
|
addCustomerCase(this.form).then((response) => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.$refs["uploadCaseFile"].uploadReset();
|
this.$refs["uploadCaseFile"].uploadReset();
|
||||||
this.msgSuccess("新增成功");
|
this.msgSuccess("新增成功");
|
||||||
@ -419,46 +507,59 @@
|
|||||||
this.submitFlag = flag;
|
this.submitFlag = flag;
|
||||||
},
|
},
|
||||||
selectCustomer() {
|
selectCustomer() {
|
||||||
this.$refs['selectCustomerRef'].showDialog("选择案例所属客户");
|
this.$refs["selectCustomerRef"].showDialog("选择案例所属客户");
|
||||||
},
|
},
|
||||||
dealCustomerId(customerId, customerName) {
|
dealCustomerId(customerId, customerName) {
|
||||||
this.form.customerId = customerId;
|
this.form.customerId = customerId;
|
||||||
this.form.customerName = customerName;
|
this.form.customerName = customerName;
|
||||||
},
|
},
|
||||||
getFileListByCaseId(customerCase) {
|
getFileListByCaseId(customerCase) {
|
||||||
getFileListByCaseId(customerCase.id).then(response => {
|
getFileListByCaseId(customerCase.id).then((response) => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.$refs["muchFileDownRef"].showDialog(customerCase.name, response.rows);
|
this.$refs["muchFileDownRef"].showDialog(
|
||||||
|
customerCase.name,
|
||||||
|
response.rows
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const ids = row.id || this.ids;
|
const ids = row.id || this.ids;
|
||||||
this.$confirm('是否确认删除客户案例管理编号为"' + ids + '"的数据项?', "警告", {
|
this.$confirm(
|
||||||
|
'是否确认删除客户案例管理编号为"' + ids + '"的数据项?',
|
||||||
|
"警告",
|
||||||
|
{
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
type: "warning"
|
type: "warning",
|
||||||
}).then(function() {
|
}
|
||||||
|
)
|
||||||
|
.then(function () {
|
||||||
return delCustomerCase(ids);
|
return delCustomerCase(ids);
|
||||||
}).then(() => {
|
})
|
||||||
|
.then(() => {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.msgSuccess("删除成功");
|
this.msgSuccess("删除成功");
|
||||||
}).catch(function() {});
|
})
|
||||||
|
.catch(function () {});
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
handleExport() {
|
||||||
const queryParams = this.queryParams;
|
const queryParams = this.queryParams;
|
||||||
this.$confirm('是否确认导出所有客户案例管理数据项?', "警告", {
|
this.$confirm("是否确认导出所有客户案例管理数据项?", "警告", {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
type: "warning"
|
type: "warning",
|
||||||
}).then(function() {
|
})
|
||||||
|
.then(function () {
|
||||||
return exportCustomerCase(queryParams);
|
return exportCustomerCase(queryParams);
|
||||||
}).then(response => {
|
})
|
||||||
|
.then((response) => {
|
||||||
this.download(response.msg);
|
this.download(response.msg);
|
||||||
}).catch(function() {});
|
})
|
||||||
}
|
.catch(function () {});
|
||||||
}
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -245,55 +245,17 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- 添加或修改食材对话框 -->
|
<!-- 添加或修改食材对话框 -->
|
||||||
<el-dialog :title="title" :visible.sync="open" width="620px" append-to-body>
|
<el-dialog :title="title" :visible.sync="open" width="720px" append-to-body>
|
||||||
<el-row :gutter="15">
|
<el-row :gutter="8">
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
<el-col :span="12">
|
<el-col :span="8">
|
||||||
<el-form-item label="食材名称" prop="name" label-width="90px">
|
<el-form-item label="食材名称" prop="name" label-width="90px">
|
||||||
<el-input v-model="form.name" placeholder="请输入食材名称" />
|
<el-input v-model="form.name" placeholder="请输入名称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="8">
|
||||||
<el-form-item
|
<el-form-item label="食材类别" prop="type" label-width="100px">
|
||||||
label="蛋白质比例"
|
<el-select v-model="form.type" placeholder="请选择类别">
|
||||||
prop="proteinRatio"
|
|
||||||
label-width="90px"
|
|
||||||
>
|
|
||||||
<el-input
|
|
||||||
v-model="form.proteinRatio"
|
|
||||||
placeholder="请输入蛋白质比例"
|
|
||||||
style="width: 150px"
|
|
||||||
/>
|
|
||||||
/100g
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="脂肪比例" prop="fatRatio" label-width="90px">
|
|
||||||
<el-input
|
|
||||||
v-model="form.fatRatio"
|
|
||||||
placeholder="请输入脂肪比例"
|
|
||||||
style="width: 150px"
|
|
||||||
/>
|
|
||||||
/100g
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item
|
|
||||||
label="碳水比例"
|
|
||||||
prop="carbonRatio"
|
|
||||||
label-width="90px"
|
|
||||||
>
|
|
||||||
<el-input
|
|
||||||
v-model="form.carbonRatio"
|
|
||||||
placeholder="请输入碳水比例"
|
|
||||||
style="width: 150px"
|
|
||||||
/>
|
|
||||||
/100g
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="食材类别" prop="type" label-width="90px">
|
|
||||||
<el-select v-model="form.type" placeholder="请选择食材类别">
|
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in typeOptions"
|
v-for="dict in typeOptions"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
@ -303,8 +265,8 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="8">
|
||||||
<el-form-item label="地域" prop="area" label-width="90px">
|
<el-form-item label="地域" prop="area" label-width="100px">
|
||||||
<el-select v-model="form.area" placeholder="请选择地域">
|
<el-select v-model="form.area" placeholder="请选择地域">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in areaOptions"
|
v-for="dict in areaOptions"
|
||||||
@ -315,8 +277,35 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item
|
||||||
|
label="蛋白质/100g"
|
||||||
|
prop="proteinRatio"
|
||||||
|
label-width="100px"
|
||||||
|
>
|
||||||
|
<el-input
|
||||||
|
v-model="form.proteinRatio"
|
||||||
|
placeholder="蛋白质比例"
|
||||||
|
width="80px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="脂肪/100g" prop="fatRatio" label-width="90px">
|
||||||
|
<el-input v-model="form.fatRatio" placeholder="脂肪比例" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item
|
||||||
|
label="碳水/100g"
|
||||||
|
prop="carbonRatio"
|
||||||
|
label-width="90px"
|
||||||
|
>
|
||||||
|
<el-input v-model="form.carbonRatio" placeholder="碳水比例" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="忌口人群" label-width="90px">
|
<el-form-item label="忌口人群" label-width="76px">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="form.notRecIds"
|
v-model="form.notRecIds"
|
||||||
multiple
|
multiple
|
||||||
@ -333,7 +322,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="推荐人群" label-width="90px">
|
<el-form-item label="推荐人群" label-width="76px">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="form.recIds"
|
v-model="form.recIds"
|
||||||
multiple
|
multiple
|
||||||
@ -349,9 +338,17 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col
|
||||||
<el-form-item label="审核状态" prop="reviewStatus">
|
:span="12"
|
||||||
|
style="position: absolute; left: 100px; top: -70px"
|
||||||
|
>
|
||||||
|
<el-form-item
|
||||||
|
label="审核状态"
|
||||||
|
prop="reviewStatus"
|
||||||
|
label-width="76px"
|
||||||
|
>
|
||||||
<el-select
|
<el-select
|
||||||
|
style="position: absolute"
|
||||||
v-model="form.reviewStatus"
|
v-model="form.reviewStatus"
|
||||||
placeholder="请选择审核状态"
|
placeholder="请选择审核状态"
|
||||||
clearable
|
clearable
|
||||||
@ -365,9 +362,43 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :span="20">
|
||||||
|
<el-form-item label="食材图片" prop="imgList">
|
||||||
|
<el-upload
|
||||||
|
drag
|
||||||
|
:auto-upload="true"
|
||||||
|
:headers="{ Authorization: 'Bearer ' + token }"
|
||||||
|
:limit="5"
|
||||||
|
:multiple="true"
|
||||||
|
:file-list="form.imgList"
|
||||||
|
:action="actionUrl"
|
||||||
|
:on-success="handleOnUploadSuccess"
|
||||||
|
:on-remove="handleOnUploadRemove"
|
||||||
|
>
|
||||||
|
<em class="el-icon-upload" />
|
||||||
|
<div class="el-upload__text">
|
||||||
|
将文件拖到此处,或<em>点击上传</em>
|
||||||
|
</div>
|
||||||
|
<div class="el-upload__tip" slot="tip">
|
||||||
|
最多可上传5个文件,且每个文件不超过10M
|
||||||
|
</div>
|
||||||
|
</el-upload>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="介绍" prop="info" label-width="90px">
|
||||||
|
<el-input
|
||||||
|
:rows="5"
|
||||||
|
v-model="form.info"
|
||||||
|
type="textarea"
|
||||||
|
placeholder="请输入内容"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="备注" prop="remark" label-width="90px">
|
<el-form-item label="备注" prop="remark" label-width="90px">
|
||||||
<el-input
|
<el-input
|
||||||
|
:rows="3"
|
||||||
v-model="form.remark"
|
v-model="form.remark"
|
||||||
type="textarea"
|
type="textarea"
|
||||||
placeholder="请输入内容"
|
placeholder="请输入内容"
|
||||||
@ -395,6 +426,8 @@ import {
|
|||||||
} from "@/api/custom/ingredient";
|
} from "@/api/custom/ingredient";
|
||||||
|
|
||||||
import AutoHideInfo from "@/components/AutoHideInfo";
|
import AutoHideInfo from "@/components/AutoHideInfo";
|
||||||
|
import FileUpload from "@/components/FileUpload";
|
||||||
|
import { getToken } from "@/utils/auth";
|
||||||
|
|
||||||
import { listPhysicalSigns } from "@/api/custom/physicalSigns";
|
import { listPhysicalSigns } from "@/api/custom/physicalSigns";
|
||||||
|
|
||||||
@ -402,11 +435,14 @@ export default {
|
|||||||
name: "Ingredient",
|
name: "Ingredient",
|
||||||
components: {
|
components: {
|
||||||
autohideinfo: AutoHideInfo,
|
autohideinfo: AutoHideInfo,
|
||||||
|
FileUpload,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
loading: true,
|
loading: true,
|
||||||
|
//
|
||||||
|
actionUrl: process.env.VUE_APP_BASE_API + "/custom/fileUpload/ingredient",
|
||||||
// 选中数组
|
// 选中数组
|
||||||
ids: [],
|
ids: [],
|
||||||
// 非单个禁用
|
// 非单个禁用
|
||||||
@ -431,6 +467,8 @@ export default {
|
|||||||
areaOptions: [],
|
areaOptions: [],
|
||||||
//
|
//
|
||||||
physicalSignsOptions: [],
|
physicalSignsOptions: [],
|
||||||
|
//
|
||||||
|
token: getToken(),
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
@ -506,6 +544,7 @@ export default {
|
|||||||
createTime: null,
|
createTime: null,
|
||||||
updateBy: null,
|
updateBy: null,
|
||||||
updateTime: null,
|
updateTime: null,
|
||||||
|
imgList: [],
|
||||||
};
|
};
|
||||||
this.resetForm("form");
|
this.resetForm("form");
|
||||||
},
|
},
|
||||||
@ -621,6 +660,12 @@ export default {
|
|||||||
string2Arr(str) {
|
string2Arr(str) {
|
||||||
return str ? str.split(",") : [];
|
return str ? str.split(",") : [];
|
||||||
},
|
},
|
||||||
|
handleOnUploadSuccess() {
|
||||||
|
|
||||||
|
},
|
||||||
|
handleOnUploadRemove() {
|
||||||
|
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -87,7 +87,7 @@ export default {
|
|||||||
this.setNotRecIgds({ data: [] });
|
this.setNotRecIgds({ data: [] });
|
||||||
}
|
}
|
||||||
|
|
||||||
this.selectedIgd = data.id;
|
this.selectedIgd = data.id === this.selectedIgd ? 0 : data.id;
|
||||||
|
|
||||||
this.setNotRecIgds({ data: [this.selectedIgd] });
|
this.setNotRecIgds({ data: [this.selectedIgd] });
|
||||||
},
|
},
|
||||||
|
@ -200,6 +200,7 @@ export default {
|
|||||||
orderDialog: undefined,
|
orderDialog: undefined,
|
||||||
reviewStatusOptions: [
|
reviewStatusOptions: [
|
||||||
{ dictValue: 0, dictLabel: "未制作" },
|
{ dictValue: 0, dictLabel: "未制作" },
|
||||||
|
{ dictValue: 3, dictLabel: "制作中" },
|
||||||
{ dictValue: 1, dictLabel: "未审核" },
|
{ dictValue: 1, dictLabel: "未审核" },
|
||||||
{ dictValue: 2, dictLabel: "已审核" },
|
{ dictValue: 2, dictLabel: "已审核" },
|
||||||
],
|
],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user