Merge branch 'develop' of https://gitee.com/darlk/ShengTangManage into xzj

This commit is contained in:
xiezhijun 2021-03-16 17:56:45 +08:00
commit b65f9534e1
27 changed files with 1054 additions and 659 deletions

View File

@ -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("文件上传失败");
} // }
// }
} }

View File

@ -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("文件上传失败");
}
}
}

View File

@ -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){

View File

@ -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;
Long createBy;
Date createTime;
Long updateBy;
Date updateTime;
}

View File

@ -15,8 +15,6 @@ import java.util.Date;
*/ */
@Data @Data
public class SysIngredient { public class SysIngredient {
private static final long serialVersionUID = 1L;
/** /**
* id * id
*/ */
@ -107,4 +105,9 @@ public class SysIngredient {
private Long[] notRecIds; private Long[] notRecIds;
/**
* 食材信息
*/
private String info;
} }

View File

@ -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> ingredentFiles);
} }

View File

@ -60,6 +60,9 @@ public class SysIngredientServiceImpl implements ISysIngredientService {
insertRecommand(sysIngredient); insertRecommand(sysIngredient);
// //
insertNotRecommand(sysIngredient); insertNotRecommand(sysIngredient);
//
return rows; return rows;
} }

View File

@ -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>

View File

@ -5,21 +5,23 @@
<mapper namespace="com.stdiet.custom.mapper.SysIngredientMapper"> <mapper namespace="com.stdiet.custom.mapper.SysIngredientMapper">
<resultMap type="SysIngredient" id="SysIngredientResult"> <resultMap type="SysIngredient" id="SysIngredientResult">
<result property="id" column="id" /> <result property="id" column="id"/>
<result property="name" column="name" /> <result property="name" column="name"/>
<result property="type" column="type" /> <result property="type" column="type"/>
<result property="proteinRatio" column="protein_ratio" /> <result property="proteinRatio" column="protein_ratio"/>
<result property="fatRatio" column="fat_ratio" /> <result property="fatRatio" column="fat_ratio"/>
<result property="carbonRatio" column="carbon_ratio" /> <result property="carbonRatio" column="carbon_ratio"/>
<result property="area" column="area" /> <result property="area" column="area"/>
<result property="remark" column="remark" /> <result property="remark" column="remark"/>
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by"/>
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time"/>
<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="imgFiles" column="id" select="selectIngredentFileById"/>
</resultMap> </resultMap>
<sql id="selectSysIngredientVo"> <sql id="selectSysIngredientVo">
@ -97,10 +99,10 @@
</otherwise> </otherwise>
</choose> </choose>
<where> <where>
<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="type != null and type != ''"> and type = #{type}</if> <if test="type != null and type != ''">and type = #{type}</if>
<if test="area != null and area != ''"> and area = #{area}</if> <if test="area != null and area != ''">and area = #{area}</if>
<if test="reviewStatus != null and reviewStatus != ''"> and review_status = #{reviewStatus}</if> <if test="reviewStatus != null and reviewStatus != ''">and review_status = #{reviewStatus}</if>
</where> </where>
</select> </select>
@ -141,14 +143,14 @@
</trim> </trim>
</insert> </insert>
<insert id="batchIngredientRec" > <insert id="batchIngredientRec">
insert into sys_ingredient_rec(ingredient_id, physical_signs_id) values insert into sys_ingredient_rec(ingredient_id, physical_signs_id) values
<foreach collection="list" separator="," item="item" index="index"> <foreach collection="list" separator="," item="item" index="index">
(#{item.ingredientId},#{item.recommandId}) (#{item.ingredientId},#{item.recommandId})
</foreach> </foreach>
</insert> </insert>
<insert id="batchIngredientNotRec" > <insert id="batchIngredientNotRec">
insert into sys_ingredient_not_rec(ingredient_id, physical_signs_id) values insert into sys_ingredient_not_rec(ingredient_id, physical_signs_id) values
<foreach collection="list" separator="," item="item" index="index"> <foreach collection="list" separator="," item="item" index="index">
(#{item.ingredientId},#{item.notRecommandId}) (#{item.ingredientId},#{item.notRecommandId})
@ -213,4 +215,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>

View File

@ -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"

View File

@ -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,60 +16,66 @@
: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: {},
// //
fileList:[], fileList: [],
// //
limit: 10, limit: 10,
//(byte) //(byte)
fileSize: 1024 * 1024 * 10, fileSize: 1024 * 1024 * 10,
// //
multiple: true multiple: true,
},
uploadResult: {
fileUrl: [],
fileName: [],
}, },
uploadResult:{
fileUrl:[],
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() {
this.upload.fileList = []; this.upload.fileList = [];
this.uploadResult["fileUrl"] = []; this.uploadResult["fileUrl"] = [];
this.uploadResult["fileName"] = []; this.uploadResult["fileName"] = [];
}, },
// //
handleFileRemove(file, fileList){ handleFileRemove(file, fileList) {
this.upload.fileList = fileList; this.upload.fileList = fileList;
}, },
// //
@ -84,9 +91,9 @@ export default {
this.upload.fileList = fileList; this.upload.fileList = fileList;
}, },
// //
handleFileexceed(file, fileList){ handleFileexceed(file, fileList) {
this.$message({ this.$message({
message: "最多可上传"+ this.upload.limit +"份文件", message: "最多可上传" + this.upload.limit + "份文件",
type: "warning", type: "warning",
}); });
}, },
@ -96,39 +103,38 @@ export default {
}, },
// //
handleFileSuccess(response, file, fileList) { handleFileSuccess(response, file, fileList) {
if(response != null && response.code === 200){ if (response != null && response.code === 200) {
this.uploadResult.fileUrl.push(response.fileUrl); this.uploadResult.fileUrl.push(response.fileUrl);
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>

View File

@ -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,54 +60,57 @@ 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: {},
// //
fileList:[], fileList: [],
// //
limit: 10 - this.caseFileList.length, limit: 10 - this.caseFileList.length,
//(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 {
// //
if(this.oldCaseFileList != null && this.oldCaseFileList.length > 0){ if (this.oldCaseFileList != null && this.oldCaseFileList.length > 0) {
await this.oldCaseFileList.forEach((item, index) => { await this.oldCaseFileList.forEach((item, index) => {
this.uploadResult.fileUrl.unshift(item.fileUrl); this.uploadResult.fileUrl.unshift(item.fileUrl);
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) {
this.oldCaseFileList.splice(index,1); this.oldCaseFileList.splice(index, 1);
this.upload.limit = 10 - this.oldCaseFileList.length; this.upload.limit = 10 - this.oldCaseFileList.length;
}, },
uploadReset(){ uploadReset() {
this.upload.fileList = []; this.upload.fileList = [];
this.uploadResult["fileUrl"] = []; this.uploadResult["fileUrl"] = [];
this.uploadResult["fileName"] = []; this.uploadResult["fileName"] = [];
this.oldCaseFileList = []; this.oldCaseFileList = [];
}, },
// //
handleFileRemove(file, fileList){ handleFileRemove(file, fileList) {
this.upload.fileList = fileList; this.upload.fileList = fileList;
}, },
// //
@ -106,9 +126,9 @@ export default {
this.upload.fileList = fileList; this.upload.fileList = fileList;
}, },
// //
handleFileexceed(file, fileList){ handleFileexceed(file, fileList) {
this.$message({ this.$message({
message: "最多可上传"+ this.upload.limit +"份文件", message: "最多可上传" + this.upload.limit + "份文件",
type: "warning", type: "warning",
}); });
}, },
@ -118,56 +138,54 @@ export default {
}, },
// //
async handleFileSuccess(response, file, fileList) { async handleFileSuccess(response, file, fileList) {
if(response != null && response.code === 200){ if (response != null && response.code === 200) {
this.uploadResult.fileUrl.push(response.fileUrl); this.uploadResult.fileUrl.push(response.fileUrl);
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) {
// //
if(this.oldCaseFileList != null && this.oldCaseFileList.length > 0){ if (this.oldCaseFileList != null && this.oldCaseFileList.length > 0) {
await this.oldCaseFileList.forEach((item, index) => { await this.oldCaseFileList.forEach((item, index) => {
this.uploadResult.fileUrl.unshift(item.fileUrl); this.uploadResult.fileUrl.unshift(item.fileUrl);
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() {
}, },
watch : { prefix: {
caseFileList:function(newVal, oldVal) { type: String,
default: "case",
},
},
created() {},
watch: {
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>

View File

@ -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"

View File

@ -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 = [];

View File

@ -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"

View File

@ -36,7 +36,10 @@ const oriState = {
fontSize: parseInt(localStorage.getItem("fontSize")) || 12, fontSize: parseInt(localStorage.getItem("fontSize")) || 12,
dishBigClassOptions: [], dishBigClassOptions: [],
dishSmallClassOptions: [], dishSmallClassOptions: [],
leftShow: false //
leftShow: false,
notRecIgds: [],
igdTypeOptions: []
}; };
const mutations = { const mutations = {
@ -64,7 +67,7 @@ const mutations = {
payload.cusWeight && (tarIgd.cusWeight = payload.cusWeight); payload.cusWeight && (tarIgd.cusWeight = payload.cusWeight);
payload.cusUnit && (tarIgd.cusUnit = payload.cusUnit); payload.cusUnit && (tarIgd.cusUnit = payload.cusUnit);
} }
console.log(JSON.parse(JSON.stringify(state.recipesData))); // console.log(JSON.parse(JSON.stringify(state.recipesData)));
} else if (actionType === "delIgd") { } else if (actionType === "delIgd") {
tarDishes.igdList = tarDishes.igdList.filter( tarDishes.igdList = tarDishes.igdList.filter(
igd => igd.id !== payload.igdId igd => igd.id !== payload.igdId
@ -103,6 +106,9 @@ const mutations = {
toggleLeftShow(state, payload) { toggleLeftShow(state, payload) {
state.leftShow = !state.leftShow; state.leftShow = !state.leftShow;
}, },
setNotRecIgds(state, payload) {
state.notRecIgds = payload.data;
},
setDate(state, payload) { setDate(state, payload) {
state.startDate = payload.startDate; state.startDate = payload.startDate;
state.endDate = payload.endDate; state.endDate = payload.endDate;
@ -152,6 +158,9 @@ const actions = {
getDicts("dish_class_small").then(response => { getDicts("dish_class_small").then(response => {
commit("updateStateData", { dishSmallClassOptions: response.data }); commit("updateStateData", { dishSmallClassOptions: response.data });
}); });
getDicts("cus_ing_type").then(response => {
commit("updateStateData", { igdTypeOptions: response.data });
});
return new Promise((res, rej) => { return new Promise((res, rej) => {
// 健康数据 // 健康数据
@ -559,6 +568,19 @@ const getters = {
}); });
return arr; return arr;
}, []), }, []),
igdTypeDetial: state =>
state.recipesData.reduce((obj, cur) => {
cur.dishes.forEach(dObj => {
dObj.igdList.forEach(iObj => {
if (!obj[iObj.type]) {
obj[iObj.type] = [{ name: iObj.name, id: iObj.id }];
} else if (!obj[iObj.type].some(tObj => tObj.id === iObj.id)) {
obj[iObj.type].push({ name: iObj.name, id: iObj.id });
}
});
});
return obj;
}, {}),
cusUnitDict: state => cusUnitDict: state =>
state.cusUnitOptions.reduce((obj, cur) => { state.cusUnitOptions.reduce((obj, cur) => {
obj[cur.dictValue] = cur.dictLabel; obj[cur.dictValue] = cur.dictLabel;
@ -583,6 +605,11 @@ const getters = {
state.dishSmallClassOptions.reduce((obj, cur) => { state.dishSmallClassOptions.reduce((obj, cur) => {
obj[cur.dictValue] = cur.dictLabel; obj[cur.dictValue] = cur.dictLabel;
return obj; return obj;
}, {}),
igdTypeDict: state =>
state.igdTypeOptions.reduce((obj, cur) => {
obj[cur.dictValue] = cur.dictLabel;
return obj;
}, {}) }, {})
}; };

View File

@ -598,6 +598,11 @@ export function dealHealthy(customerHealthy) {
? `${customerHealthy.otherMotionField}` ? `${customerHealthy.otherMotionField}`
: ""; : "";
} }
if (customerHealthy.hasOwnProperty("otherOperationHistory")) {
customerHealthy.operationHistory += customerHealthy.otherOperationHistory
? `${customerHealthy.otherOperationHistory}`
: "";
}
if (customerHealthy.hasOwnProperty("defecationNum")) { if (customerHealthy.hasOwnProperty("defecationNum")) {
customerHealthy.defecationNum += "次/天"; customerHealthy.defecationNum += "次/天";
} }

View File

@ -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"

View File

@ -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,

View File

@ -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,20 +173,22 @@
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>
<pagination <pagination
v-show="total>0" v-show="total > 0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@ -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>
@ -185,18 +241,40 @@
placeholder="请输入案例备注" placeholder="请输入案例备注"
v-model.trim="form.remark" v-model.trim="form.remark"
maxlength="200" maxlength="200"
rows = "4" rows="4"
show-word-limit show-word-limit
></el-input> ></el-input>
</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,20 +285,31 @@
</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 {
import DragUpload from "@/components/FileUpload/DragUpload"; listCustomerCase,
import DragUploadEdit from "@/components/FileUpload/DragUploadEdit"; getCustomerCase,
import SelectCustomer from "@/components/Customer/SelectCustomer"; delCustomerCase,
import MuchFileDown from "@/components/FileDownload/MuchFileDown"; addCustomerCase,
import AutoHideMessage from "@/components/AutoHideMessage"; updateCustomerCase,
import AutoHideInfo from "@/components/AutoHideInfo"; exportCustomerCase,
getFileListByCaseId,
} from "@/api/custom/customerCase";
import DragUpload from "@/components/FileUpload/DragUpload";
import DragUploadEdit from "@/components/FileUpload/DragUploadEdit";
import SelectCustomer from "@/components/Customer/SelectCustomer";
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() {
return { return {
@ -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: [
@ -263,18 +350,18 @@
{ required: true, message: "案例关键词不能为空", trigger: "blur" }, { required: true, message: "案例关键词不能为空", trigger: "blur" },
], ],
}, },
keywordArray:[], keywordArray: [],
submitFlag: false, submitFlag: false,
caseKeyOptions: [], caseKeyOptions: [],
}; };
}, },
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();
}, },
@ -309,9 +398,9 @@
remark: null, remark: null,
customerId: null, customerId: null,
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,9 +448,9 @@
}, },
/** 提交按钮 */ /** 提交按钮 */
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({
message: "正在上传提交中,请勿重复提交", message: "正在上传提交中,请勿重复提交",
type: "warning", type: "warning",
@ -369,8 +458,8 @@
return; return;
} }
// //
if(this.form.keywordArray.length > 20){ if (this.form.keywordArray.length > 20) {
this.$message({message: "案例关键词最多20个", type: "warning"}); this.$message({ message: "案例关键词最多20个", type: "warning" });
return; return;
} }
this.submitFlag = true; this.submitFlag = true;
@ -383,17 +472,17 @@
} }
}); });
}, },
addOrEditCustomerCase(fileResult){ addOrEditCustomerCase(fileResult) {
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("新增成功");
@ -415,50 +503,63 @@
}); });
} }
}, },
changeSubmitFlag(flag){ changeSubmitFlag(flag) {
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>

View File

@ -12,12 +12,13 @@
v-model="queryParams.name" v-model="queryParams.name"
placeholder="请输入菜品名称" placeholder="请输入菜品名称"
clearable clearable
size="small" size="mini"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="菜品种类" prop="dishClass"> <el-form-item label="菜品种类" prop="dishClass">
<el-cascader <el-cascader
size="mini"
v-model="dishClassQueryParam" v-model="dishClassQueryParam"
:options="dishClassOptions" :options="dishClassOptions"
:props="{ expandTrigger: 'hover' }" :props="{ expandTrigger: 'hover' }"
@ -32,7 +33,7 @@
v-model="queryParams.type" v-model="queryParams.type"
placeholder="请选择菜品类型" placeholder="请选择菜品类型"
clearable clearable
size="small" size="mini"
> >
<el-option <el-option
v-for="dict in typeOptions" v-for="dict in typeOptions"
@ -113,9 +114,9 @@
</el-table-column> </el-table-column>
<el-table-column label="菜品名称" align="center" prop="name" /> <el-table-column label="菜品名称" align="center" prop="name" />
<el-table-column label="菜品种类" align="center" prop="bigClass" > <el-table-column label="菜品种类" align="center" prop="bigClass">
<template slot-scope="scope"> <template slot-scope="scope">
{{dishClassFormat(scope.row)}} {{ dishClassFormat(scope.row) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="菜品类型" align="center" prop="type"> <el-table-column label="菜品类型" align="center" prop="type">
@ -464,8 +465,8 @@ export default {
// //
cusWeightOptions: [], cusWeightOptions: [],
dishClassOptions: [], dishClassOptions: [],
dishClassBigOptions:[], dishClassBigOptions: [],
dishClassSmallOptions:[], dishClassSmallOptions: [],
// //
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
@ -473,14 +474,14 @@ export default {
name: null, name: null,
type: null, type: null,
bigClass: null, bigClass: null,
smallClass: null smallClass: null,
}, },
// //
form: {}, form: {},
// //
rules: {}, rules: {},
// //
dishClassQueryParam:[] dishClassQueryParam: [],
}; };
}, },
created() { created() {
@ -512,9 +513,12 @@ export default {
/** 查询菜品列表 */ /** 查询菜品列表 */
getList() { getList() {
this.loading = true; this.loading = true;
if(this.dishClassQueryParam != null && this.dishClassQueryParam.length > 0){ if (
this.dishClassQueryParam != null &&
this.dishClassQueryParam.length > 0
) {
this.queryParams.smallClass = this.dishClassQueryParam[1]; this.queryParams.smallClass = this.dishClassQueryParam[1];
}else{ } else {
this.queryParams.smallClass = null; this.queryParams.smallClass = null;
} }
listDishes(this.queryParams).then((response) => { listDishes(this.queryParams).then((response) => {
@ -549,19 +553,21 @@ export default {
}); });
}, },
// //
dealDishClassBigAndSmall(){ dealDishClassBigAndSmall() {
this.dishClassBigOptions.forEach((item, index) => { this.dishClassBigOptions.forEach((item, index) => {
this.dishClassOptions.push({ this.dishClassOptions.push({
'value': parseInt(item.dictValue), value: parseInt(item.dictValue),
'label': item.dictLabel, label: item.dictLabel,
'children': [] children: [],
}); });
if(index == this.dishClassBigOptions.length - 1){ if (index == this.dishClassBigOptions.length - 1) {
this.dishClassSmallOptions.forEach((smallClass, i) => { this.dishClassSmallOptions.forEach((smallClass, i) => {
if(smallClass.remark){ if (smallClass.remark) {
this.dishClassOptions[parseInt(smallClass.remark-1)].children.push({ this.dishClassOptions[
'value': parseInt(smallClass.dictValue), parseInt(smallClass.remark - 1)
'label': smallClass.dictLabel ].children.push({
value: parseInt(smallClass.dictValue),
label: smallClass.dictLabel,
}); });
} }
}); });
@ -587,11 +593,17 @@ export default {
return this.selectDictLabel(this.reviewStatusOptions, row.area); return this.selectDictLabel(this.reviewStatusOptions, row.area);
}, },
// //
dishClassFormat(row){ dishClassFormat(row) {
if(row.bigClass > 0 && row.smallClass > 0){ if (row.bigClass > 0 && row.smallClass > 0) {
let bigClassName = this.selectDictLabel(this.dishClassBigOptions, row.bigClass); let bigClassName = this.selectDictLabel(
let smallClassName = this.selectDictLabel(this.dishClassSmallOptions, row.smallClass); this.dishClassBigOptions,
return bigClassName+"/"+smallClassName; row.bigClass
);
let smallClassName = this.selectDictLabel(
this.dishClassSmallOptions,
row.smallClass
);
return bigClassName + "/" + smallClassName;
} }
return ""; return "";
}, },
@ -606,7 +618,7 @@ export default {
id: null, id: null,
name: null, name: null,
type: [], type: [],
dishClass:[], dishClass: [],
methods: null, methods: null,
createBy: null, createBy: null,
createTime: null, createTime: null,
@ -834,7 +846,7 @@ export default {
(arr, cur, idx) => { (arr, cur, idx) => {
if (idx > 1) { if (idx > 1) {
if (idx === 6) { if (idx === 6) {
arr[6] = arr[3] * 4 + arr[4] * 9 + arr[5] * 4 + ' kcal'; arr[6] = arr[3] * 4 + arr[4] * 9 + arr[5] * 4 + " kcal";
} else { } else {
arr[idx] = data.reduce((acc, dAcc) => { arr[idx] = data.reduce((acc, dAcc) => {
if (idx === 2) { if (idx === 2) {

View File

@ -1,5 +1,5 @@
<template> <template>
<el-form> <el-form @submit.native.prevent>
<el-form-item label="菜品名"> <el-form-item label="菜品名">
<span style="color: #262626; font-size: 16px; font-weight: bold">{{ <span style="color: #262626; font-size: 16px; font-weight: bold">{{
name name

View File

@ -1,11 +1,14 @@
<template> <template>
<div> <div>
<el-row :gutter="15">
<el-form <el-form
:model="queryParams" :model="queryParams"
ref="queryForm" ref="queryForm"
:inline="true" :inline="true"
label-width="68px" label-width="68px"
@submit.native.prevent
> >
<el-col :span="6">
<el-form-item label="菜品名称" prop="name"> <el-form-item label="菜品名称" prop="name">
<el-input <el-input
v-model="queryParams.name" v-model="queryParams.name"
@ -15,10 +18,13 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="菜品种类" prop="dishClass"> <el-form-item label="菜品种类" prop="dishClass">
<el-cascader <el-cascader
filterable filterable
clearable clearable
size="mini"
v-model="dishClassQueryParam" v-model="dishClassQueryParam"
:options="dishClassOptions" :options="dishClassOptions"
:props="{ expandTrigger: 'hover' }" :props="{ expandTrigger: 'hover' }"
@ -26,6 +32,8 @@
placeholder="请选择菜品种类" placeholder="请选择菜品种类"
></el-cascader> ></el-cascader>
</el-form-item> </el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="菜品类型" prop="type"> <el-form-item label="菜品类型" prop="type">
<el-select <el-select
:disabled="lockType" :disabled="lockType"
@ -33,6 +41,7 @@
placeholder="请选择菜品类型" placeholder="请选择菜品类型"
clearable clearable
size="mini" size="mini"
width="120px"
> >
<el-option <el-option
v-for="dict in typeOptions" v-for="dict in typeOptions"
@ -42,6 +51,7 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col>
<el-form-item> <el-form-item>
<el-button <el-button
type="cyan" type="cyan"
@ -55,6 +65,7 @@
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-row>
<el-table <el-table
v-loading="loading" v-loading="loading"
@ -67,7 +78,10 @@
<el-table-column label="菜品名称" align="center" prop="name" /> <el-table-column label="菜品名称" align="center" prop="name" />
<el-table-column label="菜品种类" align="center" prop="bigClass"> <el-table-column label="菜品种类" align="center" prop="bigClass">
<template slot-scope="scope"> <template slot-scope="scope">
<AutoHideMessage :data="dishClassFormat(scope.row)" :maxLength="10"></AutoHideMessage> <AutoHideMessage
:data="dishClassFormat(scope.row)"
:maxLength="10"
></AutoHideMessage>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="菜品类型" align="center" prop="type"> <el-table-column label="菜品类型" align="center" prop="type">
@ -109,7 +123,7 @@ import AutoHideInfo from "@/components/AutoHideInfo";
import AutoHideMessage from "@/components/AutoHideMessage"; import AutoHideMessage from "@/components/AutoHideMessage";
import { listDishes } from "@/api/custom/dishes"; import { listDishes } from "@/api/custom/dishes";
import { createNamespacedHelpers } from "vuex"; import { createNamespacedHelpers } from "vuex";
const { mapState,mapGetters } = createNamespacedHelpers("recipes"); const { mapState, mapGetters } = createNamespacedHelpers("recipes");
export default { export default {
name: "SelectDishes", name: "SelectDishes",
props: [], props: [],
@ -129,14 +143,19 @@ export default {
reviewStatus: "yes", reviewStatus: "yes",
}, },
// //
dishClassQueryParam:[] dishClassQueryParam: [],
}; };
}, },
components: { components: {
AutoHideInfo,AutoHideMessage AutoHideInfo,
AutoHideMessage,
}, },
computed: { computed: {
...mapState(["typeOptions","dishBigClassOptions","dishSmallClassOptions"]), ...mapState([
"typeOptions",
"dishBigClassOptions",
"dishSmallClassOptions",
]),
...mapGetters(["dishClassOptions"]), ...mapGetters(["dishClassOptions"]),
}, },
methods: { methods: {
@ -146,9 +165,12 @@ export default {
this.lockType = true; this.lockType = true;
this.queryParams.type = type; this.queryParams.type = type;
} }
if(this.dishClassQueryParam != null && this.dishClassQueryParam.length > 0){ if (
this.dishClassQueryParam != null &&
this.dishClassQueryParam.length > 0
) {
this.queryParams.smallClass = this.dishClassQueryParam[1]; this.queryParams.smallClass = this.dishClassQueryParam[1];
}else{ } else {
this.queryParams.smallClass = null; this.queryParams.smallClass = null;
} }
this.loading = true; this.loading = true;
@ -213,11 +235,17 @@ export default {
.map((type) => this.selectDictLabel(this.typeOptions, type)); .map((type) => this.selectDictLabel(this.typeOptions, type));
}, },
// //
dishClassFormat(row){ dishClassFormat(row) {
if(row.bigClass > 0 && row.smallClass > 0){ if (row.bigClass > 0 && row.smallClass > 0) {
let bigClassName = this.selectDictLabel(this.dishBigClassOptions, row.bigClass); let bigClassName = this.selectDictLabel(
let smallClassName = this.selectDictLabel(this.dishSmallClassOptions, row.smallClass); this.dishBigClassOptions,
return bigClassName+"/"+smallClassName; row.bigClass
);
let smallClassName = this.selectDictLabel(
this.dishSmallClassOptions,
row.smallClass
);
return bigClassName + "/" + smallClassName;
} }
return ""; return "";
}, },

View File

@ -9,7 +9,7 @@
:step="5" :step="5"
:value="value" :value="value"
@blur="handleOnBlur" @blur="handleOnBlur"
@keydown.enter.native="handleEnterClick" @keydown="handleOnKeydown"
/> />
</div> </div>
</template> </template>
@ -43,8 +43,11 @@ export default {
this.$message.error("数字必须大于0"); this.$message.error("数字必须大于0");
} }
}, },
handleEnterClick(e) { handleOnKeydown(e) {
// console.log(e);
if (e.keyCode === 13) {
e.target.blur(); e.target.blur();
}
}, },
}, },
}; };

View File

@ -47,7 +47,7 @@
</el-popover> </el-popover>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="菜品" prop="name" align="center" :width="180"> <el-table-column label="菜品" prop="name" align="center">
<template slot="header"> <template slot="header">
<el-tooltip <el-tooltip
class="item" class="item"
@ -108,7 +108,7 @@
</el-popover> </el-popover>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="食材" prop="igdName" align="center" :width="180"> <el-table-column label="食材" prop="igdName" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span <span
v-if=" v-if="
@ -412,6 +412,7 @@ export default {
"fontSize", "fontSize",
"canCopyMenuTypes", "canCopyMenuTypes",
"recipesId", "recipesId",
"notRecIgds",
]), ]),
}, },
methods: { methods: {
@ -420,7 +421,11 @@ export default {
if (!columnIndex) { if (!columnIndex) {
return "recipes_first_col"; return "recipes_first_col";
} else { } else {
return `recipes_cell recipes_cell_${this.fontSize}`; return `recipes_cell recipes_cell_${this.fontSize} ${
columnIndex === 2 && this.notRecIgds.includes(row.igdId)
? "warning_heightlight"
: ""
}`;
} }
}, },
handleParentClick(e) { handleParentClick(e) {
@ -660,4 +665,9 @@ export default {
.recipes_cell_18 { .recipes_cell_18 {
font-size: 18px; font-size: 18px;
} }
.warning_heightlight {
background: #d66969;
color: blue;
}
</style> </style>

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="verify_view_wrapper"> <div class="verify_view_wrapper">
<div>忌口</div> <div>病理忌口</div>
<div class="content"> <div class="content">
<span <span
:class="`item ${ :class="`item ${
@ -12,23 +12,46 @@
>{{ item.name }}</span >{{ item.name }}</span
> >
</div> </div>
<div style="margin: 24px 0 8px 0">涉及食材</div>
<div v-for="key in Object.keys(igdTypeDetial).reverse()" :key="key">
<div style="font-size: 14px; color: #8c8c8c">{{ igdTypeDict[key] }}</div>
<div class="content">
<span
:class="`item ${selectedIgd === item.id ? 'selected_item' : ''} `"
v-for="item in igdTypeDetial[key]"
:key="item.id"
@click="handleOnIgdClick(item)"
>{{ item.name }}
</span>
</div>
</div>
</div> </div>
</template> </template>
<script> <script>
import { createNamespacedHelpers } from "vuex"; import { createNamespacedHelpers } from "vuex";
const { mapActions, mapState, mapGetters } = createNamespacedHelpers("recipes"); const {
mapActions,
mapState,
mapGetters,
mapMutations,
} = createNamespacedHelpers("recipes");
export default { export default {
name: "VerifyView", name: "VerifyView",
data() { data() {
return { return {
selectedNotRec: [], selectedNotRec: [],
selectedIgd: 0,
}; };
}, },
computed: { computed: {
...mapGetters(["verifyNotRecData"]), ...mapGetters(["verifyNotRecData", "igdTypeDict", "igdTypeDetial"]),
}, },
methods: { methods: {
handleOnClick(data) { handleOnClick(data) {
if (this.selectedIgd !== 0) {
this.selectedIgd = 0;
this.setNotRecIgds({ data: [] });
}
if (this.selectedNotRec.some((str) => data.name === str)) { if (this.selectedNotRec.some((str) => data.name === str)) {
this.selectedNotRec = this.selectedNotRec.filter( this.selectedNotRec = this.selectedNotRec.filter(
(str) => str !== data.name (str) => str !== data.name
@ -39,27 +62,45 @@ export default {
} }
const notRecIgds = this.selectedNotRec.reduce((arr, cur) => { const notRecIgds = this.selectedNotRec.reduce((arr, cur) => {
this.verifyNotRecData[cur].data.forEach((obj) => { const tarData = this.verifyNotRecData.find((obj) => obj.name === cur);
if (tarData) {
tarData.data.forEach((obj) => {
if (!arr.includes(obj.igdId)) { if (!arr.includes(obj.igdId)) {
arr.push(obj.igdId); arr.push(obj.igdId);
} }
}); });
}
return arr; return arr;
}, []); }, []);
console.log({ // console.log({
data, // data,
notRecIgds, // notRecIgds,
verifyNotRecData: this.verifyNotRecData, // verifyNotRecData: this.verifyNotRecData,
}); // });
this.setNotRecIgds({ data: notRecIgds });
}, },
handleOnIgdClick(data) {
if (this.selectedNotRec.length > 0) {
this.selectedNotRec = [];
this.setNotRecIgds({ data: [] });
}
this.selectedIgd = data.id === this.selectedIgd ? 0 : data.id;
this.setNotRecIgds({ data: [this.selectedIgd] });
},
...mapMutations(["setNotRecIgds"]),
}, },
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.verify_view_wrapper { .verify_view_wrapper {
height: calc(100vh - 32px);
overflow: auto;
.content { .content {
margin-top: 8px; margin: 8px 0;
.item { .item {
font-size: 14px; font-size: 14px;
margin: 4px; margin: 4px;

View File

@ -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: "已审核" },
], ],