模板检索语句修改,新增编辑时加上关键词
This commit is contained in:
@ -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) {
|
||||
|
Reference in New Issue
Block a user