营养小知识提问优化
This commit is contained in:
parent
b94071e141
commit
571415473b
@ -3,7 +3,9 @@ package com.stdiet.custom.controller;
|
||||
import java.util.List;
|
||||
|
||||
import com.stdiet.common.utils.StringUtils;
|
||||
import com.stdiet.custom.domain.SysAskNutritionQuestion;
|
||||
import com.stdiet.custom.domain.SysCustomerCase;
|
||||
import com.stdiet.custom.service.ISysAskNutritionQuestionService;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.aspectj.weaver.loadtime.Aj;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@ -31,6 +33,9 @@ public class SysNutritionQuestionController extends BaseController
|
||||
@Autowired
|
||||
private ISysNutritionQuestionService sysNutritionQuestionService;
|
||||
|
||||
@Autowired
|
||||
private ISysAskNutritionQuestionService sysAskNutritionQuestionService;
|
||||
|
||||
/**
|
||||
* 查询营养知识小问答列表
|
||||
*/
|
||||
@ -73,7 +78,16 @@ public class SysNutritionQuestionController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SysNutritionQuestion sysNutritionQuestion)
|
||||
{
|
||||
return toAjax(sysNutritionQuestionService.insertSysNutritionQuestion(sysNutritionQuestion));
|
||||
int row = sysNutritionQuestionService.insertSysNutritionQuestion(sysNutritionQuestion);
|
||||
if(row > 0 && sysNutritionQuestion.getAskQuestionId() != null && sysNutritionQuestion.getAskQuestionId().longValue() > 0){
|
||||
//如果携带了提问ID,则需要将该提问问题状态更改为已解答
|
||||
SysAskNutritionQuestion sysAskNutritionQuestion = new SysAskNutritionQuestion();
|
||||
sysAskNutritionQuestion.setId(sysNutritionQuestion.getAskQuestionId());
|
||||
sysAskNutritionQuestion.setReplyFlag(1);
|
||||
sysAskNutritionQuestion.setNutritionQuestionId(sysNutritionQuestion.getId());
|
||||
row = sysAskNutritionQuestionService.updateSysAskNutritionQuestion(sysAskNutritionQuestion);
|
||||
}
|
||||
return toAjax(row);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -26,10 +26,14 @@ public class SysAskNutritionQuestion extends BaseEntity
|
||||
@Excel(name = "问题内容")
|
||||
private String question;
|
||||
|
||||
/** 是否已回答,0未回答,1已回答 */
|
||||
@Excel(name = "是否已回答,0未回答,1已回答")
|
||||
/** 问题状态,0未回答 1已回答 2已关闭 */
|
||||
@Excel(name = "问题状态")
|
||||
private Integer replyFlag;
|
||||
|
||||
/** 解答之后对应的营养知识ID */
|
||||
@Excel(name = "解答之后对应的营养知识ID")
|
||||
private Long nutritionQuestionId;
|
||||
|
||||
/** 删除标识 0未删除 1已删除 */
|
||||
private Integer delFlag;
|
||||
}
|
@ -42,4 +42,7 @@ public class SysNutritionQuestion extends BaseEntity
|
||||
|
||||
/** 删除标识 0未删除 1已删除 */
|
||||
private Integer delFlag;
|
||||
|
||||
//解答问题对应的ID
|
||||
private Long askQuestionId;
|
||||
}
|
@ -9,6 +9,7 @@
|
||||
<result property="openid" column="openid" />
|
||||
<result property="question" column="question" />
|
||||
<result property="replyFlag" column="reply_flag" />
|
||||
<result property="nutritionQuestionId" column="nutrition_question_id" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
@ -40,6 +41,7 @@
|
||||
<if test="openid != null">openid,</if>
|
||||
<if test="question != null">question,</if>
|
||||
<if test="replyFlag != null">reply_flag,</if>
|
||||
<if test="nutritionQuestionId != null">nutrition_question_id,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
@ -50,6 +52,7 @@
|
||||
<if test="openid != null">#{openid},</if>
|
||||
<if test="question != null">#{question},</if>
|
||||
<if test="replyFlag != null">#{replyFlag},</if>
|
||||
<if test="nutritionQuestionId != null">#{nutritionQuestionId},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
@ -64,6 +67,7 @@
|
||||
<if test="openid != null">openid = #{openid},</if>
|
||||
<if test="question != null">question = #{question},</if>
|
||||
<if test="replyFlag != null">reply_flag = #{replyFlag},</if>
|
||||
<if test="nutritionQuestionId != null">nutrition_question_id = #{nutritionQuestionId},</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>
|
||||
|
53
stdiet-ui/src/api/custom/askQuestion.js
Normal file
53
stdiet-ui/src/api/custom/askQuestion.js
Normal file
@ -0,0 +1,53 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询营养小知识提问列表
|
||||
export function listAskQuestion(query) {
|
||||
return request({
|
||||
url: '/custom/askQuestion/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询营养小知识提问详细
|
||||
export function getAskQuestion(id) {
|
||||
return request({
|
||||
url: '/custom/askQuestion/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增营养小知识提问
|
||||
export function addAskQuestion(data) {
|
||||
return request({
|
||||
url: '/custom/askQuestion',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改营养小知识提问
|
||||
export function updateAskQuestion(data) {
|
||||
return request({
|
||||
url: '/custom/askQuestion',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除营养小知识提问
|
||||
export function delAskQuestion(id) {
|
||||
return request({
|
||||
url: '/custom/askQuestion/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 导出营养小知识提问
|
||||
export function exportAskQuestion(query) {
|
||||
return request({
|
||||
url: '/custom/askQuestion/export',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
@ -0,0 +1,177 @@
|
||||
<template>
|
||||
<!-- 添加或修改营养知识小问答对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="标题" prop="title">
|
||||
<el-input v-model="form.title" placeholder="请输入标题" />
|
||||
</el-form-item>
|
||||
<el-form-item label="关键词" prop="keyArray">
|
||||
<el-select
|
||||
v-model="form.keyArray"
|
||||
multiple
|
||||
filterable
|
||||
clearable
|
||||
allow-create
|
||||
default-first-option
|
||||
placeholder="请创建案例关键词,按回车创建,最多5个"
|
||||
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="content">
|
||||
<Editor :value="form.content" :isClear="isClear" @change="questionContentChange"></Editor>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="展示状态" prop="wxShow">
|
||||
<el-switch
|
||||
v-model="form.wxShow"
|
||||
active-text="小程序展示"
|
||||
inactive-text="小程序不展示">
|
||||
</el-switch>
|
||||
<div>提示:请保证内容正确再展示到小程序</div>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import { addNutritionQuestion, updateNutritionQuestion } from "@/api/custom/nutritionQuestion";
|
||||
import Editor from '@/components/Wangeditor';
|
||||
import AutoHideMessage from "@/components/AutoHideMessage";
|
||||
|
||||
export default {
|
||||
name: "EditOrAddQuestion",
|
||||
components: {
|
||||
Editor,AutoHideMessage
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
title: [
|
||||
{ required: true, message: "标题不能为空", trigger: "blur" },
|
||||
]
|
||||
},
|
||||
keyOptions:[],
|
||||
isClear: false,
|
||||
callback: null,
|
||||
askQuestionId: undefined
|
||||
};
|
||||
},
|
||||
created(){
|
||||
|
||||
},
|
||||
methods: {
|
||||
showDialog(data, callback, askQuestionId) {
|
||||
this.reset();
|
||||
if(askQuestionId == undefined || askQuestionId == null){
|
||||
if(data.id != undefined && data.id != null){
|
||||
this.form = {
|
||||
id: data.id,
|
||||
title: data.title,
|
||||
content: data.content,
|
||||
key: data.key,
|
||||
keyArray: (data.key != null && data.key.trim() != '' ) ? data.key.split(",") : [],
|
||||
showFlag: data.showFlag,
|
||||
wxShow: data.showFlag == 1 ? true : false
|
||||
}
|
||||
this.title = "修改营养小知识";
|
||||
}else{
|
||||
this.title = "新增营养小知识";
|
||||
}
|
||||
}else{
|
||||
this.form = {
|
||||
title: data.title,
|
||||
askQuestionId: askQuestionId
|
||||
}
|
||||
this.title = "问题解答并新增小知识";
|
||||
}
|
||||
this.callback = callback;
|
||||
this.open = true;
|
||||
},
|
||||
reset(){
|
||||
this.form = {
|
||||
id: null,
|
||||
title: null,
|
||||
content: null,
|
||||
key: null,
|
||||
keyArray: [],
|
||||
wxShow: false,
|
||||
showFlag: 0,
|
||||
askQuestionId: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
questionContentChange(content){
|
||||
console.log(content);
|
||||
this.form.content = content;
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.form.keyArray = this.form.keyArray == null ? [] : this.form.keyArray;
|
||||
//判断案例关键词
|
||||
if (this.form.keyArray.length > 5) {
|
||||
this.$message({ message: "关键词最多5个", type: "warning" });
|
||||
return;
|
||||
}
|
||||
//判断内容
|
||||
if (this.form.content == null || this.form.content.trim().length == 0) {
|
||||
this.$message({ message: "内容不能为空", type: "warning" });
|
||||
return;
|
||||
}
|
||||
this.form.key = this.form.keyArray.join(",");
|
||||
this.form.showFlag = this.form.wxShow ? 1 : 0;
|
||||
if (this.form.id != null) {
|
||||
updateNutritionQuestion(this.form).then(response => {
|
||||
if (response.code === 200) {
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.callback && this.callback();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
addNutritionQuestion(this.form).then(response => {
|
||||
if (response.code === 200) {
|
||||
this.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.callback && this.callback();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
onClosed() {
|
||||
this.reset();
|
||||
},
|
||||
cancel(){
|
||||
this.open = false;
|
||||
this.reset();
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
</style>
|
280
stdiet-ui/src/views/custom/askQuestion/index.vue
Normal file
280
stdiet-ui/src/views/custom/askQuestion/index.vue
Normal file
@ -0,0 +1,280 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<!--<el-form-item label="问题内容" prop="question">
|
||||
<el-input
|
||||
v-model="queryParams.question"
|
||||
placeholder="请输入问题内容"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否已回答,0未回答,1已回答" prop="replyFlag">
|
||||
<el-input
|
||||
v-model="queryParams.replyFlag"
|
||||
placeholder="请输入是否已回答,0未回答,1已回答"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</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="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['custom:askQuestion:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="askQuestionList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="问题内容" align="center" prop="question" />
|
||||
<el-table-column label="状态" align="center" prop="replyFlag" >
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="scope.row.replyFlag == 0 ? 'danger' : (scope.row.replyFlag == 1 ? 'success' : 'info')">
|
||||
{{scope.row.replyFlag == 0 ? '未解答' : (scope.row.replyFlag == 1 ? '已解答' : '已关闭')}}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
:disabled="scope.row.replyFlag != 0"
|
||||
size="normal"
|
||||
type="text"
|
||||
icon="el-icon-view"
|
||||
@click="replyQUestion(scope.row)"
|
||||
v-hasPermi="['custom:askQuestion:edit']"
|
||||
>解答</el-button>
|
||||
<el-button
|
||||
:disabled="scope.row.replyFlag != 0"
|
||||
size="normal"
|
||||
type="text"
|
||||
icon="el-icon-close"
|
||||
@click="handleCloseQuestion(scope.row)"
|
||||
v-hasPermi="['custom:askQuestion:edit']"
|
||||
>关闭</el-button>
|
||||
<el-button
|
||||
size="normal"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['custom:askQuestion:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 解答提问对话框 -->
|
||||
<EditOrAddQuestion ref="editOrAddQuestionRef"></EditOrAddQuestion>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listAskQuestion, getAskQuestion, delAskQuestion, addAskQuestion, updateAskQuestion, exportAskQuestion } from "@/api/custom/askQuestion";
|
||||
import EditOrAddQuestion from "@/components/NutrtionQuestion/EditOrAddQuestion";
|
||||
export default {
|
||||
name: "AskQuestion",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 营养小知识提问表格数据
|
||||
askQuestionList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
openid: null,
|
||||
question: null,
|
||||
replyFlag: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
components: { EditOrAddQuestion },
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询营养小知识提问列表 */
|
||||
getList() {
|
||||
this.isUpdateFlag = false;
|
||||
this.loading = true;
|
||||
listAskQuestion(this.queryParams).then(response => {
|
||||
this.askQuestionList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
init() {
|
||||
this.isUpdateFlag = false;
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
openid: null,
|
||||
question: null,
|
||||
replyFlag: null,
|
||||
createTime: null,
|
||||
createBy: null,
|
||||
updateTime: null,
|
||||
updateBy: null,
|
||||
delFlag: null
|
||||
};
|
||||
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
|
||||
getAskQuestion(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改营养小知识提问";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateAskQuestion(this.form).then(response => {
|
||||
if (response.code === 200) {
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
addAskQuestion(this.form).then(response => {
|
||||
if (response.code === 200) {
|
||||
this.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$confirm('是否确认删除营养小知识提问编号为"' + ids + '"的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(function() {
|
||||
return delAskQuestion(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
}).catch(function() {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
const queryParams = this.queryParams;
|
||||
this.$confirm('是否确认导出所有营养小知识提问数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(function() {
|
||||
return exportAskQuestion(queryParams);
|
||||
}).then(response => {
|
||||
this.download(response.msg);
|
||||
}).catch(function() {});
|
||||
},
|
||||
//关闭问题
|
||||
handleCloseQuestion(row) {
|
||||
let param = {
|
||||
'id': row.id,
|
||||
'replyFlag': 2
|
||||
}
|
||||
updateAskQuestion(param).then(response => {
|
||||
if (response.code === 200) {
|
||||
this.msgSuccess("关闭成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}
|
||||
});
|
||||
},
|
||||
replyQUestion(row){
|
||||
this.$refs.editOrAddQuestionRef.showDialog({'id': null, 'title': row.question}, () => {
|
||||
this.getList();
|
||||
this.refreshQuestion();
|
||||
}, row.id);
|
||||
},
|
||||
refreshQuestion(){
|
||||
this.$emit('refreshList');
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -58,6 +58,14 @@
|
||||
v-hasPermi="['custom:nutritionQuestion:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
size="mini"
|
||||
@click="handleAskQuestion"
|
||||
v-hasPermi="['custom:askQuestion:list']"
|
||||
>问题解答</el-button>
|
||||
</el-col>
|
||||
<!--<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
@ -136,7 +144,7 @@
|
||||
/>
|
||||
|
||||
<!-- 添加或修改营养知识小问答对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
|
||||
<!--<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="标题" prop="title">
|
||||
<el-input v-model="form.title" placeholder="请输入标题" />
|
||||
@ -180,22 +188,34 @@
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</el-dialog>-->
|
||||
|
||||
<!-- 编辑添加营养知识问答 -->
|
||||
<EditOrAddQuestion ref="editOrAddQuestionRef"></EditOrAddQuestion>
|
||||
|
||||
<el-dialog :title="previewQuestion.title" :visible.sync="previewOpen" width="800px" append-to-body>
|
||||
<div style="height: 600px; overflow: auto" v-html="previewQuestion.content">
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="用户提问列表" :visible.sync="askQuestionOpen" width="1000px" append-to-body>
|
||||
<AskQuestion ref="askQuestionListRef" @refreshList="getList"></AskQuestion>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listNutritionQuestion, getNutritionQuestion, delNutritionQuestion, addNutritionQuestion, updateNutritionQuestion, exportNutritionQuestion,updateWxShow } from "@/api/custom/nutritionQuestion";
|
||||
import Editor from '@/components/Wangeditor';
|
||||
import AutoHideMessage from "@/components/AutoHideMessage";
|
||||
import AutoHideMessage from "@/components/AutoHideMessage";
|
||||
import AskQuestion from "../askQuestion";
|
||||
import EditOrAddQuestion from "@/components/NutrtionQuestion/EditOrAddQuestion";
|
||||
|
||||
export default {
|
||||
name: "NutritionQuestion",
|
||||
components: { Editor,AutoHideMessage },
|
||||
components: { Editor,AutoHideMessage,AskQuestion,EditOrAddQuestion },
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
@ -240,7 +260,8 @@ export default {
|
||||
previewQuestion: {
|
||||
title: "",
|
||||
content: ""
|
||||
}
|
||||
},
|
||||
askQuestionOpen: false
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@ -278,7 +299,7 @@ export default {
|
||||
this.resetForm("form");
|
||||
},
|
||||
questionContentChange(content){
|
||||
console.log(content);
|
||||
//console.log(content);
|
||||
this.form.content = content;
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
@ -310,9 +331,13 @@ export default {
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
//this.isClear = true;
|
||||
//this.reset();
|
||||
//this.open = true;
|
||||
//this.title = "添加营养小知识";
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加营养小知识";
|
||||
this.$refs.editOrAddQuestionRef.showDialog(this.form, () => {
|
||||
this.getList();
|
||||
});
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
@ -324,13 +349,16 @@ export default {
|
||||
title: response.data.title,
|
||||
content: response.data.content,
|
||||
key: response.data.key,
|
||||
keyArray: (response.data.key != null && response.data.key.trim() != '' ) ? response.data.key.split(",") : null,
|
||||
keyArray: (response.data.key != null && response.data.key.trim() != '' ) ? response.data.key.split(",") : [],
|
||||
showFlag: response.data.showFlag,
|
||||
wxShow: response.data.showFlag == 1 ? true : false
|
||||
}
|
||||
//this.form.keyArray = response.data.key.split(","),
|
||||
this.open = true;
|
||||
this.title = "修改营养小知识";
|
||||
//this.open = true;
|
||||
//this.title = "修改营养小知识";
|
||||
this.$refs.editOrAddQuestionRef.showDialog(this.form, () => {
|
||||
this.getList();
|
||||
});
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
@ -397,6 +425,13 @@ export default {
|
||||
showFlag: newWxshow ? 1 : 0
|
||||
};
|
||||
updateWxShow(param);
|
||||
},
|
||||
handleAskQuestion(){
|
||||
this.askQuestionOpen = true;
|
||||
//this.$refs.askQuestionListRef.init();
|
||||
},
|
||||
onClosedAskQuestion(){
|
||||
console.log(this.$refs.askQuestionListRef.isUpdateFlag);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user