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
stdiet-admin/src/main/java/com/stdiet/web/controller/custom
stdiet-common/src/main/java/com/stdiet/common/utils/oss
stdiet-custom/src/main
stdiet-ui/src
components
ContractDrawer
FileUpload
HeatStatisticsDrawer
PhysicalSignsDialog
RecipesPlanDrawer
store/modules
utils
views/custom
contract
customer
customerCase
dishes
recipesBuild
RecipesView/RecipesCom
VerifyView
recipesPlan

@ -141,36 +141,37 @@ public class SysCustomerCaseController extends BaseController
return getDataTable(list);
}
/**
* 上传文件到OSS返回URL
*/
@PostMapping("/uploadCaseFile")
@PreAuthorize("@ss.hasPermi('custom:customerCase:list')")
public AjaxResult uploadCseFile(MultipartFile file) 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(AliyunOSSConfig.casePrefix, 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("文件上传失败");
}
}
// 转移到SysFileUploadController.java
// /**
// * 上传文件到OSS返回URL
// */
// @PostMapping("/uploadCaseFile")
// @PreAuthorize("@ss.hasPermi('custom:customerCase:list')")
// public AjaxResult uploadCseFile(MultipartFile file) 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(AliyunOSSConfig.casePrefix, 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("文件上传失败");
// }
// }
}

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

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

@ -1,6 +1,8 @@
package com.stdiet.custom.mapper;
import java.util.List;
import com.stdiet.custom.domain.SysIngredentFile;
import com.stdiet.custom.domain.SysIngredient;
import com.stdiet.custom.domain.SysIngredientNotRec;
import com.stdiet.custom.domain.SysIngredientRec;
@ -80,4 +82,6 @@ public interface SysIngredientMapper
* @return
*/
public SysIngredient selectSysIngredientByName(@Param("name") String name);
int batchInsertIngredientImage(List<SysIngredentFile> ingredentFiles);
}

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

@ -37,6 +37,7 @@
where del_flag = 0
<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="fansChannel != null "> and fans_channel = #{fansChannel}</if>
order by create_time desc
</select>

@ -5,21 +5,23 @@
<mapper namespace="com.stdiet.custom.mapper.SysIngredientMapper">
<resultMap type="SysIngredient" id="SysIngredientResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="type" column="type" />
<result property="proteinRatio" column="protein_ratio" />
<result property="fatRatio" column="fat_ratio" />
<result property="carbonRatio" column="carbon_ratio" />
<result property="area" column="area" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="rec" column="rec" />
<result property="notRec" column="not_rec" />
<result property="reviewStatus" column="review_status" />
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="type" column="type"/>
<result property="proteinRatio" column="protein_ratio"/>
<result property="fatRatio" column="fat_ratio"/>
<result property="carbonRatio" column="carbon_ratio"/>
<result property="area" column="area"/>
<result property="remark" column="remark"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="rec" column="rec"/>
<result property="notRec" column="not_rec"/>
<result property="reviewStatus" column="review_status"/>
<result property="info" column="info"/>
<association property="imgFiles" column="id" select="selectIngredentFileById"/>
</resultMap>
<sql id="selectSysIngredientVo">
@ -43,44 +45,44 @@
<sql id="selectSysIngredientByPhyVo">
SELECT * FROM sys_ingredient igd
RIGHT JOIN(
SELECT * FROM(
SELECT DISTINCT(ingredient_id) as id FROM sys_ingredient_rec
<where>
<if test="recIds != null">
physical_signs_id in
<foreach collection="recIds" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
) recId
LEFT JOIN (
SELECT ingredient_id as id, GROUP_CONCAT(name SEPARATOR ',') rec FROM(
SELECT physical_signs_id as id, ingredient_id
FROM sys_ingredient_rec
) rec JOIN sys_physical_signs phy USING(id)
GROUP BY id
) recM USING(id)
INNER JOIN (
SELECT * FROM(
SELECT DISTINCT(ingredient_id) as id FROM sys_ingredient_not_rec
<where>
<if test="notRecIds != null">
physical_signs_id in
<foreach collection="notRecIds" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
) notRecId
LEFT JOIN (
SELECT ingredient_id as id, GROUP_CONCAT(name SEPARATOR ',') not_rec FROM(
SELECT physical_signs_id as id, ingredient_id
FROM sys_ingredient_not_rec
) notRec JOIN sys_physical_signs phy USING(id)
GROUP BY id
) notRecM USING(id)
) notRecT USING(id)
SELECT * FROM(
SELECT DISTINCT(ingredient_id) as id FROM sys_ingredient_rec
<where>
<if test="recIds != null">
physical_signs_id in
<foreach collection="recIds" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
) recId
LEFT JOIN (
SELECT ingredient_id as id, GROUP_CONCAT(name SEPARATOR ',') rec FROM(
SELECT physical_signs_id as id, ingredient_id
FROM sys_ingredient_rec
) rec JOIN sys_physical_signs phy USING(id)
GROUP BY id
) recM USING(id)
INNER JOIN (
SELECT * FROM(
SELECT DISTINCT(ingredient_id) as id FROM sys_ingredient_not_rec
<where>
<if test="notRecIds != null">
physical_signs_id in
<foreach collection="notRecIds" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
) notRecId
LEFT JOIN (
SELECT ingredient_id as id, GROUP_CONCAT(name SEPARATOR ',') not_rec FROM(
SELECT physical_signs_id as id, ingredient_id
FROM sys_ingredient_not_rec
) notRec JOIN sys_physical_signs phy USING(id)
GROUP BY id
) notRecM USING(id)
) notRecT USING(id)
) recT USING(id)
</sql>
@ -97,10 +99,10 @@
</otherwise>
</choose>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="area != null and area != ''"> and area = #{area}</if>
<if test="reviewStatus != null and reviewStatus != ''"> and review_status = #{reviewStatus}</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="area != null and area != ''">and area = #{area}</if>
<if test="reviewStatus != null and reviewStatus != ''">and review_status = #{reviewStatus}</if>
</where>
</select>
@ -141,14 +143,14 @@
</trim>
</insert>
<insert id="batchIngredientRec" >
<insert id="batchIngredientRec">
insert into sys_ingredient_rec(ingredient_id, physical_signs_id) values
<foreach collection="list" separator="," item="item" index="index">
(#{item.ingredientId},#{item.recommandId})
</foreach>
</insert>
<insert id="batchIngredientNotRec" >
<insert id="batchIngredientNotRec">
insert into sys_ingredient_not_rec(ingredient_id, physical_signs_id) values
<foreach collection="list" separator="," item="item" index="index">
(#{item.ingredientId},#{item.notRecommandId})
@ -213,4 +215,28 @@
where name = #{name} limit 1
</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>

@ -70,7 +70,7 @@
>复制
</el-button>
<el-popover placement="top" trigger="click">
<VueQr :text="copyValue" :logoSrc="logo" size="256" />
<VueQr :text="copyValue" :logoSrc="logo" :size="256" />
<el-button
slot="reference"
icon="el-icon-picture-outline"

@ -1,74 +1,81 @@
<template>
<el-upload class="upload-demo"
ref="upload"
drag
:headers="upload.headers"
:action="upload.url"
:limit="upload.limit"
:disabled="upload.isUploading"
:file-list="upload.fileList"
:multiple="upload.multiple"
:on-change="handleFileChange"
:on-remove="handleFileRemove"
:on-exceed="handleFileexceed"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:on-error="handleFileFail"
:data="upload.data"
:auto-upload="false">
<i class="el-icon-upload"></i>
<el-upload
class="upload-demo"
ref="upload"
drag
:headers="upload.headers"
:action="upload.url"
:limit="upload.limit"
:disabled="upload.isUploading"
:file-list="upload.fileList"
:multiple="upload.multiple"
:on-change="handleFileChange"
:on-remove="handleFileRemove"
:on-exceed="handleFileexceed"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:on-error="handleFileFail"
:data="upload.data"
:auto-upload="false"
>
<em class="el-icon-upload" />
<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>
</template>
<script>
import { getToken } from '@/utils/auth'
import { getToken } from "@/utils/auth";
export default {
name: "DragUpload",
components: {
},
components: {},
data() {
return {
upload: {
//
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,
//(byte)
fileSize: 1024 * 1024 * 10,
//
multiple: true
multiple: true,
},
uploadResult: {
fileUrl: [],
fileName: [],
},
uploadResult:{
fileUrl:[],
fileName:[]
}
};
},
methods: {
uploadFile(){
if(this.upload.fileList.length > 0 && this.uploadResult.fileUrl.length < this.upload.fileList.length){
uploadFile() {
if (
this.upload.fileList.length > 0 &&
this.uploadResult.fileUrl.length < this.upload.fileList.length
) {
this.$refs.upload.submit();
}else{
this.$emit('callbackMethod', this.uploadResult);
} else {
this.$emit("callbackMethod", this.uploadResult);
}
},
uploadReset(){
uploadReset() {
this.upload.fileList = [];
this.uploadResult["fileUrl"] = [];
this.uploadResult["fileName"] = [];
},
//
handleFileRemove(file, fileList){
handleFileRemove(file, fileList) {
this.upload.fileList = fileList;
},
//
@ -84,9 +91,9 @@ export default {
this.upload.fileList = fileList;
},
//
handleFileexceed(file, fileList){
handleFileexceed(file, fileList) {
this.$message({
message: "最多可上传"+ this.upload.limit +"份文件",
message: "最多可上传" + this.upload.limit + "份文件",
type: "warning",
});
},
@ -96,39 +103,38 @@ export default {
},
//
handleFileSuccess(response, file, fileList) {
if(response != null && response.code === 200){
if (response != null && response.code === 200) {
this.uploadResult.fileUrl.push(response.fileUrl);
this.uploadResult.fileName.push(response.fileName);
if(this.uploadResult.fileUrl.length === this.upload.fileList.length){
if (this.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.$message.error('文件上传失败,请检查文件格式');
this.$emit('changeSubmitFlag', false);
this.$message.error("文件上传失败,请检查文件格式");
this.$emit("changeSubmitFlag", false);
}
},
//
handleFileFail(err, file, fileList){
this.$message.error('文件上传失败,请检查文件格式');
handleFileFail(err, file, fileList) {
this.$message.error("文件上传失败,请检查文件格式");
this.upload.fileList = fileList.pop();
this.$emit('changeSubmitFlag', false);
}
this.$emit("changeSubmitFlag", false);
},
},
props: {
prefix: {
type: String,
default: "case",
},
},
created() {
//this.uploadReset();
//this.uploadReset();
},
};
</script>
<style scoped>
</style>

@ -1,41 +1,58 @@
<template>
<div>
<div v-for="(item, index) in oldCaseFileList">
<span style="margin-right: 10px;">
{{item.fileName.length > 15 ? (item.fileName.substring(0,15)+"...") : item.fileName}}
<div v-for="(item, index) in oldCaseFileList" :key="index">
<span style="margin-right: 10px">
{{
item.fileName.length > 15
? item.fileName.substring(0, 15) + "..."
: item.fileName
}}
</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>
<el-upload class="upload-demo" style="margin-top: 10px;"
ref="upload"
drag
:headers="upload.headers"
:action="upload.url"
:limit="upload.limit"
:disabled="upload.isUploading"
:file-list="upload.fileList"
:multiple="upload.multiple"
:on-remove="handleFileRemove"
:on-change="handleFileChange"
:on-exceed="handleFileexceed"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:on-error="handleFileFail"
:data="upload.data"
:auto-upload="false">
<i class="el-icon-upload"></i>
<el-upload
class="upload-demo"
style="margin-top: 10px"
ref="upload"
drag
:headers="upload.headers"
:action="upload.url"
:limit="upload.limit"
:disabled="upload.isUploading"
:file-list="upload.fileList"
:multiple="upload.multiple"
:on-remove="handleFileRemove"
:on-change="handleFileChange"
:on-exceed="handleFileexceed"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:on-error="handleFileFail"
:data="upload.data"
:auto-upload="false"
>
<em class="el-icon-upload" />
<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>
</div>
</template>
<script>
import { getToken } from '@/utils/auth'
import AutoHideMessage from "@/components/AutoHideMessage";
import { getToken } from "@/utils/auth";
// import AutoHideMessage from "@/components/AutoHideMessage";
export default {
name: "DragUploadEdit",
components: {
"AutoHideMessage":AutoHideMessage
// "AutoHideMessage":AutoHideMessage
},
data() {
return {
@ -43,54 +60,57 @@ export default {
//
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,
//(byte)
fileSize: 1024 * 1024 * 10,
//
multiple: true
multiple: true,
},
oldCaseFileList: this.caseFileList,
uploadResult:{
fileUrl:[],
fileName:[]
}
uploadResult: {
fileUrl: [],
fileName: [],
},
};
},
methods: {
async uploadFile(){
if(this.upload.fileList.length > 0 && this.uploadResult.fileUrl.length < this.upload.fileList.length){
async uploadFile() {
if (
this.upload.fileList.length > 0 &&
this.uploadResult.fileUrl.length < this.upload.fileList.length
) {
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) => {
this.uploadResult.fileUrl.unshift(item.fileUrl);
this.uploadResult.fileName.unshift(item.fileName);
});
}
this.$emit('callbackMethod', this.uploadResult);
this.$emit("callbackMethod", this.uploadResult);
}
},
removeOldFile(index){
this.oldCaseFileList.splice(index,1);
removeOldFile(index) {
this.oldCaseFileList.splice(index, 1);
this.upload.limit = 10 - this.oldCaseFileList.length;
},
uploadReset(){
uploadReset() {
this.upload.fileList = [];
this.uploadResult["fileUrl"] = [];
this.uploadResult["fileName"] = [];
this.oldCaseFileList = [];
},
//
handleFileRemove(file, fileList){
handleFileRemove(file, fileList) {
this.upload.fileList = fileList;
},
//
@ -106,9 +126,9 @@ export default {
this.upload.fileList = fileList;
},
//
handleFileexceed(file, fileList){
handleFileexceed(file, fileList) {
this.$message({
message: "最多可上传"+ this.upload.limit +"份文件",
message: "最多可上传" + this.upload.limit + "份文件",
type: "warning",
});
},
@ -118,56 +138,54 @@ export default {
},
//
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.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) => {
this.uploadResult.fileUrl.unshift(item.fileUrl);
this.uploadResult.fileName.unshift(item.fileName);
});
}
this.$emit('callbackMethod', this.uploadResult);
this.$emit("callbackMethod", this.uploadResult);
}
}else{
} else {
this.upload.fileList = fileList.pop();
this.$message.error('文件上传失败,请检查文件格式');
this.$emit('changeSubmitFlag', false);
this.$message.error("文件上传失败,请检查文件格式");
this.$emit("changeSubmitFlag", false);
}
},
//
handleFileFail(err, file, fileList){
this.$message.error('文件上传失败,请检查文件格式');
handleFileFail(err, file, fileList) {
this.$message.error("文件上传失败,请检查文件格式");
this.upload.fileList = fileList.pop();
this.$emit('changeSubmitFlag', false);
}
this.$emit("changeSubmitFlag", false);
},
},
props: {
caseFileList:{
caseFileList: {
type: Array,
default: function () {
return [];
}
}
},
},
prefix: {
type: String,
default: "case",
},
},
created() {
created() {},
watch: {
caseFileList: function (newVal, oldVal) {
//console.log(newVal.length);
this.oldCaseFileList = newVal;
},
},
watch : {
caseFileList:function(newVal, oldVal) {
//console.log(newVal.length);
this.oldCaseFileList = newVal;
}
}
};
</script>
<style scoped>
</style>

@ -25,7 +25,7 @@
trigger="click"
style="margin: 0 12px"
>
<VueQr :text="copyValue" :logoSrc="logo" size="256" />
<VueQr :text="copyValue" :logoSrc="logo" :size="256" />
<el-button
slot="reference"
size="mini"

@ -201,7 +201,7 @@
v-show="dataList.length == 0"
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">
<el-button
icon="el-icon-share"
@ -689,6 +689,28 @@ export default {
? medicalReportNameArray[2]
: "体检报告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;
for (let i = 0; i < this.healthyTitleData.length; i++) {
let stepArray = [];

@ -25,7 +25,7 @@
v-if="cusOutId"
style="margin: 0 12px"
>
<VueQr :text="copyValue" :logoSrc="logo" size="256" />
<VueQr :text="copyValue" :logoSrc="logo" :size="256" />
<el-button
slot="reference"
size="mini"

@ -36,7 +36,10 @@ const oriState = {
fontSize: parseInt(localStorage.getItem("fontSize")) || 12,
dishBigClassOptions: [],
dishSmallClassOptions: [],
leftShow: false
//
leftShow: false,
notRecIgds: [],
igdTypeOptions: []
};
const mutations = {
@ -64,7 +67,7 @@ const mutations = {
payload.cusWeight && (tarIgd.cusWeight = payload.cusWeight);
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") {
tarDishes.igdList = tarDishes.igdList.filter(
igd => igd.id !== payload.igdId
@ -103,6 +106,9 @@ const mutations = {
toggleLeftShow(state, payload) {
state.leftShow = !state.leftShow;
},
setNotRecIgds(state, payload) {
state.notRecIgds = payload.data;
},
setDate(state, payload) {
state.startDate = payload.startDate;
state.endDate = payload.endDate;
@ -152,6 +158,9 @@ const actions = {
getDicts("dish_class_small").then(response => {
commit("updateStateData", { dishSmallClassOptions: response.data });
});
getDicts("cus_ing_type").then(response => {
commit("updateStateData", { igdTypeOptions: response.data });
});
return new Promise((res, rej) => {
// 健康数据
@ -559,6 +568,19 @@ const getters = {
});
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 =>
state.cusUnitOptions.reduce((obj, cur) => {
obj[cur.dictValue] = cur.dictLabel;
@ -583,6 +605,11 @@ const getters = {
state.dishSmallClassOptions.reduce((obj, cur) => {
obj[cur.dictValue] = cur.dictLabel;
return obj;
}, {}),
igdTypeDict: state =>
state.igdTypeOptions.reduce((obj, cur) => {
obj[cur.dictValue] = cur.dictLabel;
return obj;
}, {})
};

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

@ -198,7 +198,7 @@
>复制
</el-button>
<el-popover placement="top" trigger="click">
<VueQr :text="copyValue" :logoSrc="logo" size="256"/>
<VueQr :text="copyValue" :logoSrc="logo" :size="256"/>
<el-button
slot="reference"
icon="el-icon-picture-outline"

@ -25,16 +25,17 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!--<el-form-item label="主营养师" prop="mainDietitian">
<el-input
v-model="queryParams.mainDietitian"
placeholder="请输入主营养师"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
<el-form-item label="进粉渠道" prop="fansChannel">
<el-select v-model="queryParams.fansChannel" placeholder="请选择">
<el-option
v-for="dict in fansChannelOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
</el-form-item>
<el-form-item label="营养师助理" prop="assistantDietitian">
<!--<el-form-item label="营养师助理" prop="assistantDietitian">
<el-input
v-model="queryParams.assistantDietitian"
placeholder="请输入营养师助理"
@ -430,6 +431,7 @@ export default {
queryParams: {
pageNum: 1,
pageSize: 10,
fansChannel: null,
name: null,
phone: null,
mainDietitian: null,

@ -1,6 +1,12 @@
<template>
<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-input
v-model.trim="queryParams.name"
@ -17,12 +23,15 @@
allow-create
clearable
default-first-option
placeholder="关键词搜索" style="width: 100%;">
placeholder="关键词搜索"
style="width: 100%"
>
<el-option
v-for="dict in caseKeyOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue">
:value="dict.dictValue"
>
</el-option>
</el-select>
</el-form-item>
@ -36,8 +45,16 @@
/>
</el-form-item>
<el-form-item>
<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-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>
@ -49,7 +66,8 @@
size="mini"
@click="handleAdd"
v-hasPermi="['custom:customerCase:add']"
>新增</el-button>
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@ -59,7 +77,8 @@
:disabled="single"
@click="handleUpdate"
v-hasPermi="['custom:customerCase:edit']"
>修改</el-button>
>修改</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@ -69,7 +88,8 @@
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['custom:customerCase:remove']"
>删除</el-button>
>删除</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@ -78,40 +98,54 @@
size="mini"
@click="handleExport"
v-hasPermi="['custom:customerCase:export']"
>导出</el-button>
>导出</el-button
>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</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 label="案例名称" align="center" prop="name" >
<el-table-column label="案例名称" align="center" prop="name">
<template slot-scope="scope">
<AutoHideMessage :data="scope.row.name" :maxLength="10"></AutoHideMessage>
<AutoHideMessage
:data="scope.row.name"
:maxLength="10"
></AutoHideMessage>
</template>
</el-table-column>
<el-table-column label="关键词" align="center" prop="keyword" >
<el-table-column label="关键词" align="center" prop="keyword">
<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>-->
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" >
<el-table-column label="备注" align="center" prop="remark">
<template slot-scope="scope">
<AutoHideMessage :data="scope.row.remark" :maxLength="10"></AutoHideMessage>
<AutoHideMessage
:data="scope.row.remark"
:maxLength="10"
></AutoHideMessage>
</template>
</el-table-column>
<el-table-column label="所属客户" align="center" prop="customerName" />
<el-table-column
label="文件"
align="center"
>
<el-table-column label="文件" align="center">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="getFileListByCaseId(scope.row)"
>文件列表
>文件列表
</el-button>
</template>
</el-table-column>
@ -127,7 +161,11 @@
}}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
@ -135,20 +173,22 @@
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['custom:customerCase:edit']"
>修改</el-button>
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['custom:customerCase:remove']"
>删除</el-button>
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@ -156,49 +196,87 @@
/>
<!-- 添加或修改客户案例管理对话框 -->
<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">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="案例名称" prop="name">
<el-input v-model.trim="form.name" type="textarea" maxlength="50" rows = "1" show-word-limit placeholder="请输入案例名称" />
</el-form-item>
<el-form-item label="关键词" prop="keywordArray">
<el-select
v-model="form.keywordArray"
multiple
filterable
clearable
allow-create
default-first-option
placeholder="请创建案例关键词按回车创建最多20个" style="width: 100%;">
<el-option
v-for="dict in caseKeyOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="案例备注" prop="remark">
<el-input
type="textarea"
placeholder="请输入案例备注"
v-model.trim="form.remark"
maxlength="200"
rows = "4"
show-word-limit
></el-input>
</el-form-item>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="案例名称" prop="name">
<el-input
v-model.trim="form.name"
type="textarea"
maxlength="50"
rows="1"
show-word-limit
placeholder="请输入案例名称"
/>
</el-form-item>
<el-form-item label="关键词" prop="keywordArray">
<el-select
v-model="form.keywordArray"
multiple
filterable
clearable
allow-create
default-first-option
placeholder="请创建案例关键词按回车创建最多20个"
style="width: 100%"
>
<el-option
v-for="dict in caseKeyOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="案例备注" prop="remark">
<el-input
type="textarea"
placeholder="请输入案例备注"
v-model.trim="form.remark"
maxlength="200"
rows="4"
show-word-limit
></el-input>
</el-form-item>
<el-form-item label="所属客户" prop="customerId">
<el-input v-model="form.customerName" placeholder="" style="width: 60%" :readonly="true" />
<span style="margin-left: 10px"> <el-button type="primary" @click="selectCustomer">选择所属客户</el-button></span>
</el-form-item>
<el-form-item label="案例文件" prop="file" >
<DragUpload v-show="form.id == null || form.id <= 0" @changeSubmitFlag="changeSubmitFlag" @callbackMethod="addOrEditCustomerCase" ref="uploadCaseFile"></DragUpload>
<DragUploadEdit v-show="form.id != null || form.id > 0" @callbackMethod="addOrEditCustomerCase" @changeSubmitFlag="changeSubmitFlag" :caseFileList="form.caseFileList" ref="editUploadCaseFile"></DragUploadEdit>
</el-form-item>
</el-form>
<el-form-item label="所属客户" prop="customerId">
<el-input
v-model="form.customerName"
placeholder=""
style="width: 60%"
:readonly="true"
/>
<span style="margin-left: 10px">
<el-button type="primary" @click="selectCustomer"
>选择所属客户</el-button
></span
>
</el-form-item>
<el-form-item label="案例文件" prop="file">
<DragUpload
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>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
@ -207,258 +285,281 @@
</el-dialog>
<MuchFileDown ref="muchFileDownRef"></MuchFileDown>
<SelectCustomer @dealCustomerId="dealCustomerId" ref="selectCustomerRef"></SelectCustomer>
<SelectCustomer
@dealCustomerId="dealCustomerId"
ref="selectCustomerRef"
></SelectCustomer>
</div>
</template>
<script>
import { listCustomerCase, getCustomerCase, delCustomerCase, addCustomerCase, updateCustomerCase, exportCustomerCase,getFileListByCaseId,downCaseFile } 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";
import {
listCustomerCase,
getCustomerCase,
delCustomerCase,
addCustomerCase,
updateCustomerCase,
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 {
name: "CustomerCase",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
customerCaseList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
keyword: null,
customerName: null
},
//
form: {
},
//
rules: {
name: [
{ required: true, message: "案例名称不能为空", trigger: "blur" },
],
keywordArray: [
{ required: true, message: "案例关键词不能为空", trigger: "blur" },
],
},
keywordArray:[],
submitFlag: false,
caseKeyOptions: [],
};
},
components: {
"DragUpload": DragUpload,
"SelectCustomer":SelectCustomer,
"MuchFileDown": MuchFileDown,
"AutoHideMessage": AutoHideMessage,
"AutoHideInfo":AutoHideInfo,
"DragUploadEdit":DragUploadEdit
},
created() {
this.getList();
this.getDicts("case_key").then((response) => {
this.caseKeyOptions = response.data;
export default {
name: "CustomerCase",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
customerCaseList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
keyword: null,
customerName: null,
},
//
form: {},
//
rules: {
name: [
{ required: true, message: "案例名称不能为空", trigger: "blur" },
],
keywordArray: [
{ required: true, message: "案例关键词不能为空", trigger: "blur" },
],
},
keywordArray: [],
submitFlag: false,
caseKeyOptions: [],
};
},
components: {
DragUpload: DragUpload,
SelectCustomer: SelectCustomer,
MuchFileDown: MuchFileDown,
AutoHideMessage: AutoHideMessage,
AutoHideInfo: AutoHideInfo,
DragUploadEdit: DragUploadEdit,
},
created() {
this.getList();
this.getDicts("case_key").then((response) => {
this.caseKeyOptions = response.data;
});
},
methods: {
/** 查询客户案例管理列表 */
getList() {
this.loading = true;
this.queryParams.keyword = this.keywordArray.join(",");
listCustomerCase(this.queryParams).then((response) => {
this.customerCaseList = response.rows;
this.total = response.total;
this.loading = false;
});
},
methods: {
/** 查询客户案例管理列表 */
getList() {
this.loading = true;
this.queryParams.keyword = this.keywordArray.join(",");
listCustomerCase(this.queryParams).then(response => {
this.customerCaseList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
//
cancel() {
this.open = false;
this.$refs["uploadCaseFile"] &&
this.$refs["uploadCaseFile"].uploadReset();
this.$refs["editUploadCaseFile"] &&
this.$refs["editUploadCaseFile"].uploadReset();
this.reset();
},
//
reset() {
this.reset();
},
//
reset() {
this.form = {
id: null,
name: null,
keywordArray: [],
remark: null,
customerId: null,
customerName: null,
caseFileList: [],
caseFileUrl: [],
caseFileName: [],
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加客户案例管理";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids;
getCustomerCase(id).then((response) => {
this.form = {
id: null,
name: null,
keywordArray: [],
remark: null,
customerId: null,
customerName: null,
caseFileList:[],
id: response.data.id,
name: response.data.name,
keywordArray: response.data.keyword.split(","),
remark: response.data.remark,
customerId: response.data.customerId,
customerName: response.data.customerName,
caseFileList: response.data.caseFileList,
caseFileUrl: [],
caseFileName: []
caseFileName: [],
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加客户案例管理";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getCustomerCase(id).then(response => {
this.form = {
id: response.data.id,
name: response.data.name,
keywordArray: response.data.keyword.split(","),
remark: response.data.remark,
customerId: response.data.customerId,
customerName: response.data.customerName,
caseFileList: response.data.caseFileList,
caseFileUrl: [],
caseFileName: []
};
this.open = true;
this.title = "修改客户案例管理";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if(this.submitFlag){
this.$message({
message: "正在上传提交中,请勿重复提交",
type: "warning",
});
return;
}
//
if(this.form.keywordArray.length > 20){
this.$message({message: "案例关键词最多20个", type: "warning"});
return;
}
this.submitFlag = true;
this.form.keyword = this.form.keywordArray.join(",");
if (this.form.id != null) {
this.$refs["editUploadCaseFile"].uploadFile();
} else {
this.$refs["uploadCaseFile"].uploadFile();
}
this.title = "修改客户案例管理";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.submitFlag) {
this.$message({
message: "正在上传提交中,请勿重复提交",
type: "warning",
});
return;
}
//
if (this.form.keywordArray.length > 20) {
this.$message({ message: "案例关键词最多20个", type: "warning" });
return;
}
this.submitFlag = true;
this.form.keyword = this.form.keywordArray.join(",");
if (this.form.id != null) {
this.$refs["editUploadCaseFile"].uploadFile();
} else {
this.$refs["uploadCaseFile"].uploadFile();
}
});
},
addOrEditCustomerCase(fileResult){
this.form.caseFileName = fileResult.fileName;
this.form.caseFileUrl = fileResult.fileUrl;
if(this.form.caseFileUrl.length == 0){
this.$message.error('请至少选择一个文件上传');
this.submitFlag = false;
return;
}
if(this.form.id != null){
// console.log(this.form.caseFileName.length);
updateCustomerCase(this.form).then(response => {
if (response.code === 200) {
this.$refs["editUploadCaseFile"].uploadReset();
this.msgSuccess("修改成功");
this.open = false;
this.getList();
}
this.submitFlag = false;
});
}else{
addCustomerCase(this.form).then(response => {
if (response.code === 200) {
this.$refs["uploadCaseFile"].uploadReset();
this.msgSuccess("新增成功");
this.open = false;
this.getList();
}
this.submitFlag = false;
});
}
},
changeSubmitFlag(flag){
this.submitFlag = flag;
},
selectCustomer(){
this.$refs['selectCustomerRef'].showDialog("选择案例所属客户");
},
dealCustomerId(customerId, customerName){
this.form.customerId = customerId;
this.form.customerName = customerName;
},
getFileListByCaseId(customerCase){
getFileListByCaseId(customerCase.id).then(response => {
});
},
addOrEditCustomerCase(fileResult) {
this.form.caseFileName = fileResult.fileName;
this.form.caseFileUrl = fileResult.fileUrl;
if (this.form.caseFileUrl.length == 0) {
this.$message.error("请至少选择一个文件上传");
this.submitFlag = false;
return;
}
if (this.form.id != null) {
// console.log(this.form.caseFileName.length);
updateCustomerCase(this.form).then((response) => {
if (response.code === 200) {
this.$refs["muchFileDownRef"].showDialog(customerCase.name, response.rows);
this.$refs["editUploadCaseFile"].uploadReset();
this.msgSuccess("修改成功");
this.open = false;
this.getList();
}
this.submitFlag = false;
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除客户案例管理编号为"' + ids + '"的数据项?', "警告", {
} else {
addCustomerCase(this.form).then((response) => {
if (response.code === 200) {
this.$refs["uploadCaseFile"].uploadReset();
this.msgSuccess("新增成功");
this.open = false;
this.getList();
}
this.submitFlag = false;
});
}
},
changeSubmitFlag(flag) {
this.submitFlag = flag;
},
selectCustomer() {
this.$refs["selectCustomerRef"].showDialog("选择案例所属客户");
},
dealCustomerId(customerId, customerName) {
this.form.customerId = customerId;
this.form.customerName = customerName;
},
getFileListByCaseId(customerCase) {
getFileListByCaseId(customerCase.id).then((response) => {
if (response.code === 200) {
this.$refs["muchFileDownRef"].showDialog(
customerCase.name,
response.rows
);
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm(
'是否确认删除客户案例管理编号为"' + ids + '"的数据项?',
"警告",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
type: "warning",
}
)
.then(function () {
return delCustomerCase(ids);
}).then(() => {
})
.then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(function() {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有客户案例管理数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
})
.catch(function () {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm("是否确认导出所有客户案例管理数据项?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(function () {
return exportCustomerCase(queryParams);
}).then(response => {
})
.then((response) => {
this.download(response.msg);
}).catch(function() {});
}
}
};
})
.catch(function () {});
},
},
};
</script>

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

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

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

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

@ -47,7 +47,7 @@
</el-popover>
</template>
</el-table-column>
<el-table-column label="菜品" prop="name" align="center" :width="180">
<el-table-column label="菜品" prop="name" align="center">
<template slot="header">
<el-tooltip
class="item"
@ -108,7 +108,7 @@
</el-popover>
</template>
</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">
<span
v-if="
@ -412,6 +412,7 @@ export default {
"fontSize",
"canCopyMenuTypes",
"recipesId",
"notRecIgds",
]),
},
methods: {
@ -420,7 +421,11 @@ export default {
if (!columnIndex) {
return "recipes_first_col";
} 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) {
@ -660,4 +665,9 @@ export default {
.recipes_cell_18 {
font-size: 18px;
}
.warning_heightlight {
background: #d66969;
color: blue;
}
</style>

@ -1,6 +1,6 @@
<template>
<div class="verify_view_wrapper">
<div>忌口</div>
<div>病理忌口</div>
<div class="content">
<span
:class="`item ${
@ -12,23 +12,46 @@
>{{ item.name }}</span
>
</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>
</template>
<script>
import { createNamespacedHelpers } from "vuex";
const { mapActions, mapState, mapGetters } = createNamespacedHelpers("recipes");
const {
mapActions,
mapState,
mapGetters,
mapMutations,
} = createNamespacedHelpers("recipes");
export default {
name: "VerifyView",
data() {
return {
selectedNotRec: [],
selectedIgd: 0,
};
},
computed: {
...mapGetters(["verifyNotRecData"]),
...mapGetters(["verifyNotRecData", "igdTypeDict", "igdTypeDetial"]),
},
methods: {
handleOnClick(data) {
if (this.selectedIgd !== 0) {
this.selectedIgd = 0;
this.setNotRecIgds({ data: [] });
}
if (this.selectedNotRec.some((str) => data.name === str)) {
this.selectedNotRec = this.selectedNotRec.filter(
(str) => str !== data.name
@ -39,27 +62,45 @@ export default {
}
const notRecIgds = this.selectedNotRec.reduce((arr, cur) => {
this.verifyNotRecData[cur].data.forEach((obj) => {
if (!arr.includes(obj.igdId)) {
arr.push(obj.igdId);
}
});
const tarData = this.verifyNotRecData.find((obj) => obj.name === cur);
if (tarData) {
tarData.data.forEach((obj) => {
if (!arr.includes(obj.igdId)) {
arr.push(obj.igdId);
}
});
}
return arr;
}, []);
console.log({
data,
notRecIgds,
verifyNotRecData: this.verifyNotRecData,
});
// console.log({
// data,
// notRecIgds,
// 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>
<style lang="scss" scoped>
.verify_view_wrapper {
height: calc(100vh - 32px);
overflow: auto;
.content {
margin-top: 8px;
margin: 8px 0;
.item {
font-size: 14px;
margin: 4px;

@ -200,6 +200,7 @@ export default {
orderDialog: undefined,
reviewStatusOptions: [
{ dictValue: 0, dictLabel: "未制作" },
{ dictValue: 3, dictLabel: "制作中" },
{ dictValue: 1, dictLabel: "未审核" },
{ dictValue: 2, dictLabel: "已审核" },
],