commit
dcae5727f8
@ -1,6 +1,7 @@
|
||||
package com.stdiet.custom.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.stdiet.common.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
@ -21,6 +22,9 @@ public class SysRecipesTemplate {
|
||||
|
||||
Long planId;
|
||||
|
||||
/** 关键词,使用 , 隔开 */
|
||||
private String keyWord;
|
||||
|
||||
String remark;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
@ -10,6 +10,7 @@
|
||||
<result property="planId" column="plan_id"/>
|
||||
<result property="nutritionistId" column="nutritionist_id"/>
|
||||
<result property="nutriAssisId" column="nutri_assis_id"/>
|
||||
<result property="keyWord" column="key_word" />
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
@ -23,7 +24,7 @@
|
||||
</resultMap>
|
||||
|
||||
<select id="selectRecipesTemplateListByCondition" parameterType="SysRecipesTemplate" resultMap="SysRecipesTemplateResult">
|
||||
select srt.id, srt.name, srt.nutritionist_id, srt.nutri_assis_id, srt.remark, srt.update_time,
|
||||
select srt.id, srt.name, srt.nutritionist_id, srt.nutri_assis_id, srt.key_word, srt.remark, srt.update_time,
|
||||
srt.create_time, srt.update_by, srt.create_by, srt.plan_id, srp.recipes_id, srp.review_status,
|
||||
su_nutritionist.nick_name as nutritionist, su_nutritionist_assis.nick_name as nutritionist_assis
|
||||
from sys_recipes_template srt
|
||||
@ -31,19 +32,31 @@
|
||||
left join sys_user su_nutritionist on su_nutritionist.user_id = srt.nutritionist_id and su_nutritionist.del_flag = 0
|
||||
left join sys_user su_nutritionist_assis on su_nutritionist_assis.user_id = srt.nutri_assis_id and su_nutritionist_assis.del_flag = 0
|
||||
where srt.del_flag = 0
|
||||
<if test="keys != null">and
|
||||
<if test="keys != null and keys.length > 0">and
|
||||
<foreach collection="keys" item="key" separator="and" open="(" close=")">
|
||||
srt.name like concat('%', #{key}, '%') or srt.remark like concat('%', #{key}, '%')
|
||||
(
|
||||
srt.name like concat('%', #{key}, '%') or srt.remark like concat('%', #{key}, '%')
|
||||
or FIND_IN_SET(#{key}, srt.key_word)
|
||||
)
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="nutriAssisId != null ">and srt.nutri_assis_id = #{nutriAssisId}</if>
|
||||
<if test="nutritionistId != null ">and srt.nutritionist_id = #{nutritionistId}</if>
|
||||
<if test="reviewStatus != null ">and srp.review_status = #{reviewStatus}</if>
|
||||
order by srt.id desc
|
||||
order by
|
||||
<if test="keys != null and keys.length > 0">
|
||||
FIND_IN_SET(srt.id, (
|
||||
SELECT group_concat(t.id Separator ',') from sys_recipes_template t WHERE
|
||||
<foreach collection="keys" item="key" separator="and" open="(" close=")">
|
||||
FIND_IN_SET(#{key}, srt.key_word)
|
||||
</foreach>
|
||||
)) desc,
|
||||
</if>
|
||||
srt.id desc
|
||||
</select>
|
||||
|
||||
<select id="getRecipesTemplateById" parameterType="Long" resultType="SysRecipesTemplate">
|
||||
select srt.id, srt.name, srt.nutritionist_id as nutritionistId, srt.nutri_assis_id as nutriAssisId, srt.remark, srt.update_time as updateTime,
|
||||
select srt.id, srt.name, srt.nutritionist_id as nutritionistId, srt.nutri_assis_id as nutriAssisId, srt.key_word, srt.remark, srt.update_time as updateTime,
|
||||
srt.create_time as createTime, srt.update_by as updateBy, srt.create_by as createBy, srt.plan_id as planId,
|
||||
su_nutritionist.nick_name as nutritionist, su_nutritionist_assis.nick_name as nutriAssis
|
||||
from sys_recipes_template srt
|
||||
@ -59,6 +72,7 @@
|
||||
<if test="planId != null">plan_id,</if>
|
||||
<if test="nutriAssisId != null">nutri_assis_id,</if>
|
||||
<if test="nutritionistId != null">nutritionist_id,</if>
|
||||
<if test="keyWord != null">key_word,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
@ -70,6 +84,7 @@
|
||||
<if test="planId != null">#{planId},</if>
|
||||
<if test="nutriAssisId != null">#{nutriAssisId},</if>
|
||||
<if test="nutritionistId != null">#{nutritionistId},</if>
|
||||
<if test="keyWord != null">#{keyWord},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
@ -84,6 +99,7 @@
|
||||
<if test="name != null">name = #{name},</if>
|
||||
<if test="nutriAssisId != null">nutri_assis_id = #{nutriAssisId},</if>
|
||||
<if test="nutritionistId != null">nutritionist_id = #{nutritionistId},</if>
|
||||
<if test="keyWord != null">key_word = #{keyWord},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
|
@ -29,6 +29,27 @@
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="关键词" prop="keyWordArray" label-width="100px">
|
||||
<el-select
|
||||
v-model="form.keyWordArray"
|
||||
multiple
|
||||
filterable
|
||||
clearable
|
||||
allow-create
|
||||
default-first-option
|
||||
placeholder="请创建模板关键词,用于模板检索,按回车创建"
|
||||
style="width:100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in keyOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="备注" prop="remark" label-width="100px">
|
||||
<el-input
|
||||
v-model="form.remark"
|
||||
@ -58,6 +79,8 @@ export default {
|
||||
nutriAssisId: null,
|
||||
nutritionistId: null,
|
||||
remark: null,
|
||||
keyWordArray: null,
|
||||
keyWord: null
|
||||
},
|
||||
// 表单校验
|
||||
rules: {
|
||||
@ -70,6 +93,16 @@ export default {
|
||||
],
|
||||
},
|
||||
visible: false,
|
||||
keyOptions:[
|
||||
{
|
||||
dictLabel: "1-7",
|
||||
dictValue: "1-7"
|
||||
},
|
||||
{
|
||||
dictLabel: "高血压",
|
||||
dictValue: "高血压"
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -87,6 +120,7 @@ export default {
|
||||
this.reset();
|
||||
if (data) {
|
||||
this.title = "修改模板";
|
||||
data.keyWordArray = (data.keyWord != null && data.keyWord != "") ? data.keyWord.split(",") : null;
|
||||
this.form = data;
|
||||
} else {
|
||||
this.title = "创建模板";
|
||||
@ -94,7 +128,9 @@ export default {
|
||||
},
|
||||
submitForm() {
|
||||
this.$refs["form"].validate((valid) => {
|
||||
if (valid) {
|
||||
if (valid && this.checkFormat(this.form.keyWordArray)) {
|
||||
this.form.keyWord = (this.form.keyWordArray != null && this.form.keyWordArray.length > 0) ? this.form.keyWordArray.join(",") : null;
|
||||
this.form.keyWord = this.form.keyWord.replace(",",",");
|
||||
this.$emit("onConfirm", this.form);
|
||||
this.visible = false;
|
||||
}
|
||||
@ -108,12 +144,30 @@ export default {
|
||||
nutriAssisId: null,
|
||||
nutritionistId: null,
|
||||
remark: null,
|
||||
keyWordArray: null,
|
||||
keyWord: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
cancel() {
|
||||
this.visible = false;
|
||||
},
|
||||
checkFormat(keyWordArray){
|
||||
let flag = true;
|
||||
let msg = "";
|
||||
if(keyWordArray != null && keyWordArray.length > 0){
|
||||
keyWordArray.forEach((item,index) => {
|
||||
if(item.indexOf(",") != -1 || item.indexOf(",") != -1 || item.indexOf(" ") != -1){
|
||||
msg = "关键词中不能含有逗号和空格";
|
||||
flag = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
if(!flag){
|
||||
this.msgError(msg);
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
@ -8,11 +8,22 @@
|
||||
<!-- 筛选 -->
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true">
|
||||
<el-form-item label="搜索内容" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入模板名称或备注"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
<el-select
|
||||
v-model="queryParams.keys"
|
||||
multiple
|
||||
filterable
|
||||
allow-create
|
||||
clearable
|
||||
default-first-option
|
||||
@keyup.enter.native="handleQuery"
|
||||
placeholder="请输入或选择关键字">
|
||||
<!--<el-option
|
||||
v-for="item in options"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>-->
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="营养师" prop="nutritionistId">
|
||||
<el-select
|
||||
@ -67,7 +78,16 @@
|
||||
<el-table-column label="模板名称" align="center" prop="name" />
|
||||
<el-table-column label="营养师" align="center" prop="nutritionist" />
|
||||
<el-table-column label="营养师助理" align="center" prop="nutriAssis" />
|
||||
<el-table-column label="备注" prop="remark" align="center" />
|
||||
<el-table-column label="关键词" align="center" prop="keyWord">
|
||||
<template slot-scope="scope">
|
||||
<AutoHideMessage :data="scope.row.keyWord" :maxLength="20"></AutoHideMessage>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" prop="remark" align="center" >
|
||||
<template slot-scope="scope">
|
||||
<AutoHideMessage :data="scope.row.remark" :maxLength="20"></AutoHideMessage>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
@ -83,6 +103,7 @@
|
||||
<script>
|
||||
import { listRecipesTemplate } from "@/api/custom/recipesTemplate";
|
||||
import { mapState } from "vuex";
|
||||
import AutoHideMessage from "@/components/AutoHideMessage";
|
||||
export default {
|
||||
name: "TemplateView",
|
||||
data() {
|
||||
@ -97,9 +118,13 @@ export default {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
reviewStatus: 2,
|
||||
keys: null
|
||||
},
|
||||
};
|
||||
},
|
||||
components:{
|
||||
AutoHideMessage
|
||||
},
|
||||
props: ["view"],
|
||||
computed: {
|
||||
...mapState({
|
||||
@ -119,6 +144,7 @@ export default {
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.queryParams.keys = null;
|
||||
this.handleQuery();
|
||||
},
|
||||
handleOnBackClick() {
|
||||
@ -132,7 +158,7 @@ export default {
|
||||
getList() {
|
||||
this.loading = true;
|
||||
const params = JSON.parse(JSON.stringify(this.queryParams));
|
||||
params.keys = (params.name || "").split(" ");
|
||||
//params.keys = (params.name || "").split(" ");
|
||||
listRecipesTemplate(params).then((res) => {
|
||||
if (res.code === 200) {
|
||||
this.dataList = res.rows;
|
||||
|
@ -7,11 +7,28 @@
|
||||
v-show="showSearch"
|
||||
>
|
||||
<el-form-item label="搜索内容" prop="name">
|
||||
<el-input
|
||||
<!--<el-input
|
||||
clearable
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入模板名称或备注"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
/>-->
|
||||
<el-select
|
||||
v-model="queryParams.keys"
|
||||
multiple
|
||||
filterable
|
||||
allow-create
|
||||
clearable
|
||||
default-first-option
|
||||
@keyup.enter.native="handleQuery"
|
||||
placeholder="请输入或选择关键字">
|
||||
<!--<el-option
|
||||
v-for="item in options"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>-->
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="营养师" prop="nutritionistId">
|
||||
<el-select
|
||||
@ -116,13 +133,30 @@
|
||||
prop="nutriAssisId"
|
||||
:formatter="nutriAssisIdFormat"
|
||||
/>
|
||||
<el-table-column
|
||||
label="关键词"
|
||||
align="center"
|
||||
width="200"
|
||||
prop="kwyWordArray"
|
||||
>
|
||||
<!--<template slot-scope="scope">
|
||||
<AutoHideInfo :data="scope.row.keyWordArray" :line="2"> </AutoHideInfo>
|
||||
</template>-->
|
||||
<template slot-scope="scope">
|
||||
<AutoHideMessage :data="scope.row.keyWord" :maxLength="20"></AutoHideMessage>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" prop="remark" align="center" >
|
||||
<template slot-scope="scope">
|
||||
<AutoHideMessage :data="scope.row.remark" :maxLength="20"></AutoHideMessage>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
width="180"
|
||||
prop="createTime"
|
||||
/>
|
||||
<el-table-column label="备注" prop="remark" align="center" />
|
||||
<el-table-column
|
||||
label="操作"
|
||||
align="center"
|
||||
@ -181,6 +215,8 @@ import {
|
||||
deleteRecipesTemplate,
|
||||
} from "@/api/custom/recipesTemplate";
|
||||
import TemplateDialog from "@/components/TemplateDialog";
|
||||
import AutoHideInfo from "@/components/AutoHideInfo";
|
||||
import AutoHideMessage from "@/components/AutoHideMessage";
|
||||
import { mapGetters, mapState } from "vuex";
|
||||
|
||||
export default {
|
||||
@ -210,6 +246,7 @@ export default {
|
||||
nutritionistId: null,
|
||||
nutriAssisId: null,
|
||||
reviewStatus: null,
|
||||
keys: null
|
||||
},
|
||||
open: false,
|
||||
title: "",
|
||||
@ -231,6 +268,8 @@ export default {
|
||||
},
|
||||
components: {
|
||||
TemplateDialog,
|
||||
AutoHideInfo,
|
||||
AutoHideMessage
|
||||
// "order-dialog": OrderDetail,
|
||||
// body_sign_dialog: BodySignDetail,
|
||||
},
|
||||
@ -270,8 +309,11 @@ export default {
|
||||
getList() {
|
||||
this.loading = true;
|
||||
const params = JSON.parse(JSON.stringify(this.queryParams));
|
||||
params.keys = params.name ? params.name.split(" ") : null;
|
||||
//params.keys = params.name ? params.name.split(" ") : null;
|
||||
listRecipesTemplate(params).then((response) => {
|
||||
response.rows.forEach((item,index) => {
|
||||
item.keyWordArray = (item.keyWord != null && item.keyWord != "") ? item.keyWord.split(",") : [];
|
||||
});
|
||||
this.recipesTemplateList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
@ -289,6 +331,7 @@ export default {
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.queryParams.keys = null;
|
||||
this.handleQuery();
|
||||
},
|
||||
getReviewStatusName(status) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user