另存为模板功能
This commit is contained in:
parent
ff89b9bf5e
commit
b3ce59ff25
@ -3,6 +3,7 @@ package com.stdiet.web.controller.custom;
|
|||||||
import com.stdiet.common.core.controller.BaseController;
|
import com.stdiet.common.core.controller.BaseController;
|
||||||
import com.stdiet.common.core.domain.AjaxResult;
|
import com.stdiet.common.core.domain.AjaxResult;
|
||||||
import com.stdiet.common.core.page.TableDataInfo;
|
import com.stdiet.common.core.page.TableDataInfo;
|
||||||
|
import com.stdiet.common.utils.StringUtils;
|
||||||
import com.stdiet.custom.domain.SysRecipesTemplate;
|
import com.stdiet.custom.domain.SysRecipesTemplate;
|
||||||
import com.stdiet.custom.service.ISysRecipesTemplateService;
|
import com.stdiet.custom.service.ISysRecipesTemplateService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -10,6 +11,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 食谱模板
|
* 食谱模板
|
||||||
@ -46,7 +48,11 @@ public class SysRecipesTemplateController extends BaseController {
|
|||||||
@PreAuthorize("@ss.hasPermi('recipes:template:edit')")
|
@PreAuthorize("@ss.hasPermi('recipes:template:edit')")
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
public AjaxResult add(@RequestBody SysRecipesTemplate sysRecipesTemplate) {
|
public AjaxResult add(@RequestBody SysRecipesTemplate sysRecipesTemplate) {
|
||||||
return toAjax(iSysRecipesTemplateService.insertRecipsesTemplate(sysRecipesTemplate));
|
Map<String, Long> result = iSysRecipesTemplateService.insertRecipsesTemplate(sysRecipesTemplate);
|
||||||
|
if (StringUtils.isEmpty(result)) {
|
||||||
|
return AjaxResult.error();
|
||||||
|
}
|
||||||
|
return AjaxResult.success(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3,6 +3,7 @@ package com.stdiet.custom.service;
|
|||||||
import com.stdiet.custom.domain.SysRecipesTemplate;
|
import com.stdiet.custom.domain.SysRecipesTemplate;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 食谱计划Service接口
|
* 食谱计划Service接口
|
||||||
@ -14,7 +15,7 @@ public interface ISysRecipesTemplateService {
|
|||||||
|
|
||||||
List<SysRecipesTemplate> selectRecipesTemplateListByCondition(SysRecipesTemplate sysRecipesTemplate);
|
List<SysRecipesTemplate> selectRecipesTemplateListByCondition(SysRecipesTemplate sysRecipesTemplate);
|
||||||
|
|
||||||
int insertRecipsesTemplate(SysRecipesTemplate sysRecipesTemplate);
|
Map<String, Long> insertRecipsesTemplate(SysRecipesTemplate sysRecipesTemplate);
|
||||||
|
|
||||||
int updateRecipesTemplate(SysRecipesTemplate sysRecipesTemplate);
|
int updateRecipesTemplate(SysRecipesTemplate sysRecipesTemplate);
|
||||||
|
|
||||||
|
@ -12,7 +12,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 食谱计划Service业务层处理
|
* 食谱计划Service业务层处理
|
||||||
@ -36,7 +38,7 @@ public class SysRecipesTemplateServiceImpl implements ISysRecipesTemplateService
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int insertRecipsesTemplate(SysRecipesTemplate sysRecipesTemplate) {
|
public Map<String, Long> insertRecipsesTemplate(SysRecipesTemplate sysRecipesTemplate) {
|
||||||
SysRecipesPlan sysRecipesPlan = new SysRecipesPlan();
|
SysRecipesPlan sysRecipesPlan = new SysRecipesPlan();
|
||||||
sysRecipesPlan.setStartNumDay(1);
|
sysRecipesPlan.setStartNumDay(1);
|
||||||
sysRecipesPlan.setEndNumDay(7);
|
sysRecipesPlan.setEndNumDay(7);
|
||||||
@ -47,9 +49,17 @@ public class SysRecipesTemplateServiceImpl implements ISysRecipesTemplateService
|
|||||||
sysRecipesTemplate.setCreateBy(SecurityUtils.getUsername());
|
sysRecipesTemplate.setCreateBy(SecurityUtils.getUsername());
|
||||||
sysRecipesTemplate.setCreateTime(DateUtils.getNowDate());
|
sysRecipesTemplate.setCreateTime(DateUtils.getNowDate());
|
||||||
sysRecipesTemplate.setPlanId(sysRecipesPlan.getId());
|
sysRecipesTemplate.setPlanId(sysRecipesPlan.getId());
|
||||||
return sysRecipesTemplateMapper.insertRecipsesTemplate(sysRecipesTemplate);
|
int rows = sysRecipesTemplateMapper.insertRecipsesTemplate(sysRecipesTemplate);
|
||||||
|
if(rows > 0) {
|
||||||
|
Map<String, Long> result = new HashMap<>();
|
||||||
|
result.put("id", sysRecipesTemplate.getId());
|
||||||
|
result.put("planId", sysRecipesPlan.getId());
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -12,10 +12,10 @@
|
|||||||
>
|
>
|
||||||
<div class="msg-info" v-for="(info, idx) in basicInfo" :key="idx">
|
<div class="msg-info" v-for="(info, idx) in basicInfo" :key="idx">
|
||||||
<text-info
|
<text-info
|
||||||
v-for="con in info"
|
v-for="i in info"
|
||||||
:title="con.title"
|
:title="i.title"
|
||||||
:key="con.title"
|
:key="i.title"
|
||||||
:value="data[con.value]"
|
:value="data[i.value]"
|
||||||
extraclass="text-info-extra"
|
extraclass="text-info-extra"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
119
stdiet-ui/src/components/TemplateDialog/index.vue
Normal file
119
stdiet-ui/src/components/TemplateDialog/index.vue
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
:title="title"
|
||||||
|
:visible.sync="visible"
|
||||||
|
width="520px"
|
||||||
|
append-to-body
|
||||||
|
>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="模板名称" prop="name" label-width="100px">
|
||||||
|
<el-input v-model="form.name" placeholder="请输入模板名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="营养师" prop="nutritionistId" label-width="100px">
|
||||||
|
<el-select v-model="form.nutritionistId" placeholder="请选择营养师">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in nutritionistIdOptions"
|
||||||
|
:key="dict.dictValue"
|
||||||
|
:label="dict.dictLabel"
|
||||||
|
:value="dict.dictValue"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="营养师助理" prop="nutriAssisId" label-width="100px">
|
||||||
|
<el-select v-model="form.nutriAssisId" placeholder="请选择营养师助理">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in nutriAssisIdOptions"
|
||||||
|
: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"
|
||||||
|
:rows="4"
|
||||||
|
type="textarea"
|
||||||
|
placeholder="请输入内容"
|
||||||
|
/>
|
||||||
|
</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 { mapState } from "vuex";
|
||||||
|
export default {
|
||||||
|
name: "TemplateDialog",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
title: "",
|
||||||
|
form: {
|
||||||
|
cusId: 0,
|
||||||
|
id: null,
|
||||||
|
name: null,
|
||||||
|
nutriAssisId: null,
|
||||||
|
nutritionistId: null,
|
||||||
|
remark: null,
|
||||||
|
},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
name: [{ required: true, message: "请输入模板名称", trigger: "blur" }],
|
||||||
|
nutritionistId: [
|
||||||
|
{ required: true, message: "请选择营养师", trigger: "blur" },
|
||||||
|
],
|
||||||
|
nutriAssisId: [
|
||||||
|
{ required: true, message: "请选择营养师助理", trigger: "blur" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
visible: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState({
|
||||||
|
//营养师
|
||||||
|
nutritionistIdOptions: (state) =>
|
||||||
|
state.global.nutritionistIdOptions.slice(1),
|
||||||
|
//营养师助理
|
||||||
|
nutriAssisIdOptions: (state) => state.global.nutriAssisIdOptions.slice(1),
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
showDialog(data) {
|
||||||
|
this.visible = true;
|
||||||
|
this.reset();
|
||||||
|
if (data) {
|
||||||
|
this.title = "修改模板";
|
||||||
|
this.form = data;
|
||||||
|
} else {
|
||||||
|
this.title = "创建模板";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
this.$emit("onConfirm", this.form);
|
||||||
|
this.visible = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
cusId: 0,
|
||||||
|
id: null,
|
||||||
|
name: null,
|
||||||
|
nutriAssisId: null,
|
||||||
|
nutritionistId: null,
|
||||||
|
remark: null,
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
cancel() {
|
||||||
|
this.visible = false;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
@ -108,6 +108,7 @@ const mutations = {
|
|||||||
|
|
||||||
const actions = {
|
const actions = {
|
||||||
async init({ commit, dispatch }, payload) {
|
async init({ commit, dispatch }, payload) {
|
||||||
|
//
|
||||||
// console.log(payload);
|
// console.log(payload);
|
||||||
const planResponse = await getRecipesPlan(payload.planId);
|
const planResponse = await getRecipesPlan(payload.planId);
|
||||||
const {
|
const {
|
||||||
@ -262,8 +263,8 @@ const actions = {
|
|||||||
async saveRecipes({ commit, dispatch, state }, payload) {
|
async saveRecipes({ commit, dispatch, state }, payload) {
|
||||||
const { recipesData, cusId, planId } = state;
|
const { recipesData, cusId, planId } = state;
|
||||||
const params = {
|
const params = {
|
||||||
cusId,
|
cusId: payload.cusId !== undefined ? payload.cusId : cusId,
|
||||||
planId,
|
planId: payload.planId || planId,
|
||||||
menus: recipesData.map((menu, idx) => ({
|
menus: recipesData.map((menu, idx) => ({
|
||||||
numDay: menu.numDay,
|
numDay: menu.numDay,
|
||||||
cusId,
|
cusId,
|
||||||
@ -284,8 +285,11 @@ const actions = {
|
|||||||
const result = await addRecipesApi(params);
|
const result = await addRecipesApi(params);
|
||||||
if (result.code === 200) {
|
if (result.code === 200) {
|
||||||
const recipesId = result.data;
|
const recipesId = result.data;
|
||||||
commit("updateStateData", { recipesId });
|
if (!payload.planId) {
|
||||||
dispatch("getRecipesInfo", { recipesId });
|
// 非保存模板
|
||||||
|
commit("updateStateData", { recipesId });
|
||||||
|
dispatch("getRecipesInfo", { recipesId });
|
||||||
|
}
|
||||||
payload.callback &&
|
payload.callback &&
|
||||||
payload.callback({
|
payload.callback({
|
||||||
name: state.name,
|
name: state.name,
|
||||||
|
@ -3,58 +3,84 @@
|
|||||||
class="recipes_aspect_wrapper"
|
class="recipes_aspect_wrapper"
|
||||||
:style="`height: ${collapse ? 30 : 200}px`"
|
:style="`height: ${collapse ? 30 : 200}px`"
|
||||||
>
|
>
|
||||||
<div class="header">
|
<div class="header" v-loading="loading">
|
||||||
<span class="font_size_style">
|
<div class="header_btns">
|
||||||
字体大小:
|
<span>
|
||||||
<el-select
|
<el-button
|
||||||
v-model="mFontSize"
|
size="mini"
|
||||||
size="mini"
|
v-if="!!recipesId"
|
||||||
style="width: 80px"
|
type="primary"
|
||||||
@change="handleOnSizeChange"
|
icon="el-icon-document-copy"
|
||||||
>
|
@click="handleOnTemplateClick"
|
||||||
<el-option
|
|
||||||
v-for="size in fontSizeOpts"
|
|
||||||
:key="size.value"
|
|
||||||
:label="size.label"
|
|
||||||
:value="size.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</span>
|
|
||||||
<el-button size="mini" v-if="!recipesId" @click="handleOnBack"
|
|
||||||
>返回</el-button
|
|
||||||
>
|
|
||||||
<el-popover
|
|
||||||
placement="bottom"
|
|
||||||
trigger="click"
|
|
||||||
title="修改审核状态"
|
|
||||||
style="margin-right: 12px"
|
|
||||||
v-hasPermi="['recipes:plan:review']"
|
|
||||||
>
|
|
||||||
<div>
|
|
||||||
<el-button size="mini" type="success" @click="hanldeOnReveiwChange(2)"
|
|
||||||
>审核通过</el-button
|
|
||||||
>
|
>
|
||||||
<el-button size="mini" type="danger" @click="hanldeOnReveiwChange(1)"
|
另存为模板
|
||||||
>未审核通过</el-button
|
</el-button>
|
||||||
|
</span>
|
||||||
|
<span>
|
||||||
|
<span class="font_size_style">
|
||||||
|
字体大小:
|
||||||
|
<el-select
|
||||||
|
v-model="mFontSize"
|
||||||
|
size="mini"
|
||||||
|
style="width: 80px"
|
||||||
|
@change="handleOnSizeChange"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="size in fontSizeOpts"
|
||||||
|
:key="size.value"
|
||||||
|
:label="size.label"
|
||||||
|
:value="size.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</span>
|
||||||
|
<el-button size="mini" v-if="!recipesId" @click="handleOnBack"
|
||||||
|
>返回</el-button
|
||||||
>
|
>
|
||||||
</div>
|
<el-popover
|
||||||
<el-button
|
placement="bottom"
|
||||||
slot="reference"
|
trigger="click"
|
||||||
size="mini"
|
title="修改审核状态"
|
||||||
v-if="reviewStatus"
|
style="margin-right: 12px"
|
||||||
:type="reviewStatus === 1 ? 'danger' : 'success'"
|
v-hasPermi="['recipes:plan:review']"
|
||||||
>
|
>
|
||||||
{{ reviewStatus === 1 ? "未审核" : "已审核" }}
|
<div>
|
||||||
</el-button>
|
<el-button
|
||||||
</el-popover>
|
size="mini"
|
||||||
|
type="success"
|
||||||
|
@click="hanldeOnReveiwChange(2)"
|
||||||
|
>审核通过</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="danger"
|
||||||
|
@click="hanldeOnReveiwChange(1)"
|
||||||
|
>未审核通过</el-button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<el-button
|
||||||
|
slot="reference"
|
||||||
|
size="mini"
|
||||||
|
v-if="reviewStatus"
|
||||||
|
:type="reviewStatus === 1 ? 'danger' : 'success'"
|
||||||
|
>
|
||||||
|
{{ reviewStatus === 1 ? "未审核" : "已审核" }}
|
||||||
|
</el-button>
|
||||||
|
</el-popover>
|
||||||
|
<el-button
|
||||||
|
v-if="!recipesId"
|
||||||
|
size="mini"
|
||||||
|
type="primary"
|
||||||
|
@click="handleOnSave"
|
||||||
|
>生成食谱</el-button
|
||||||
|
>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="!recipesId"
|
|
||||||
size="mini"
|
size="mini"
|
||||||
type="primary"
|
type="text"
|
||||||
@click="handleOnSave"
|
@click="handleCollapseClick"
|
||||||
>生成食谱</el-button
|
class="collapse_btn"
|
||||||
>
|
>
|
||||||
<el-button size="mini" type="text" @click="handleCollapseClick">
|
|
||||||
{{ `${collapse ? "展开" : "收起"}` }}
|
{{ `${collapse ? "展开" : "收起"}` }}
|
||||||
<em
|
<em
|
||||||
class="el-icon-arrow-down arrow_icon"
|
class="el-icon-arrow-down arrow_icon"
|
||||||
@ -91,23 +117,29 @@
|
|||||||
width="500px"
|
width="500px"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- 模板 -->
|
||||||
|
<TemplateDialog ref="templateRef" @onConfirm="handleOnCopy" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import BarChart from "./BarChart";
|
import BarChart from "./BarChart";
|
||||||
import PieChart from "./PieChart";
|
import PieChart from "./PieChart";
|
||||||
|
import { addRecipesTemplate } from "@/api/custom/recipesTemplate";
|
||||||
import { createNamespacedHelpers } from "vuex";
|
import { createNamespacedHelpers } from "vuex";
|
||||||
const { mapActions, mapState, mapMutations } = createNamespacedHelpers(
|
const { mapActions, mapState, mapMutations } = createNamespacedHelpers(
|
||||||
"recipes"
|
"recipes"
|
||||||
);
|
);
|
||||||
|
import TemplateDialog from "@/components/TemplateDialog";
|
||||||
export default {
|
export default {
|
||||||
name: "RecipesAspectCom",
|
name: "RecipesAspectCom",
|
||||||
components: {
|
components: {
|
||||||
BarChart,
|
BarChart,
|
||||||
PieChart,
|
PieChart,
|
||||||
|
TemplateDialog,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
loading: false,
|
||||||
mFontSize: 12,
|
mFontSize: 12,
|
||||||
fontSizeOpts: [
|
fontSizeOpts: [
|
||||||
{ value: 12, label: "12" },
|
{ value: 12, label: "12" },
|
||||||
@ -152,6 +184,29 @@ export default {
|
|||||||
handleOnBack() {
|
handleOnBack() {
|
||||||
this.updateStateData({ recipesData: [] });
|
this.updateStateData({ recipesData: [] });
|
||||||
},
|
},
|
||||||
|
handleOnTemplateClick() {
|
||||||
|
this.$refs.templateRef.showDialog();
|
||||||
|
},
|
||||||
|
handleOnCopy(form) {
|
||||||
|
this.loading = true;
|
||||||
|
addRecipesTemplate(form).then((response) => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
const { planId, id } = response.data;
|
||||||
|
this.saveRecipes({
|
||||||
|
cusId: 0,
|
||||||
|
planId,
|
||||||
|
callback: () => {
|
||||||
|
this.$message.success(`另存为模板「${form.name}」成功`);
|
||||||
|
this.loading = false;
|
||||||
|
window.open(
|
||||||
|
"/recipes/build/" + form.name + "/" + planId + "?temId=" + id,
|
||||||
|
"_blank"
|
||||||
|
);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
...mapActions(["saveRecipes", "updateReviewStatus"]),
|
...mapActions(["saveRecipes", "updateReviewStatus"]),
|
||||||
...mapMutations(["updateStateData", "updateFontSize"]),
|
...mapMutations(["updateStateData", "updateFontSize"]),
|
||||||
},
|
},
|
||||||
@ -165,6 +220,19 @@ export default {
|
|||||||
.header {
|
.header {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.header_btns {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.collapse_btn {
|
||||||
|
width: 42px;
|
||||||
|
}
|
||||||
|
|
||||||
.arrow_icon {
|
.arrow_icon {
|
||||||
transition: all 0.3s;
|
transition: all 0.3s;
|
||||||
|
@ -77,8 +77,9 @@
|
|||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
class="fun_button"
|
class="fun_button"
|
||||||
@click="handleOnDelete(scope.row)"
|
@click="handleOnDelete(scope.row)"
|
||||||
>删除</el-button
|
|
||||||
>
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<el-button
|
<el-button
|
||||||
@ -87,15 +88,18 @@
|
|||||||
icon="el-icon-document-copy"
|
icon="el-icon-document-copy"
|
||||||
class="fun_button"
|
class="fun_button"
|
||||||
@click="handleOnCopy(scope.row)"
|
@click="handleOnCopy(scope.row)"
|
||||||
>复制</el-button
|
|
||||||
>
|
>
|
||||||
|
复制
|
||||||
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
|
type="primary"
|
||||||
size="mini"
|
size="mini"
|
||||||
icon="el-icon-document-copy"
|
icon="el-icon-document-copy"
|
||||||
class="fun_button"
|
class="fun_button"
|
||||||
@click="handleOnSetting(scope.row)"
|
@click="handleOnSetting(scope.row)"
|
||||||
>修改餐类</el-button
|
|
||||||
>
|
>
|
||||||
|
修改餐类
|
||||||
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="pointer_style" slot="reference">
|
<div class="pointer_style" slot="reference">
|
||||||
|
@ -40,6 +40,8 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
this.$store.dispatch("global/init", {});
|
||||||
|
//
|
||||||
this.init({
|
this.init({
|
||||||
planId: this.planId,
|
planId: this.planId,
|
||||||
name: this.name,
|
name: this.name,
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
export function getProcessMenuData(menuData) {
|
export function getProcessMenuData(menuData) {
|
||||||
return menuData.reduce((arr, cur) => {
|
// const igdPlanData = {};
|
||||||
|
|
||||||
|
const menuList = menuData.reduce((arr, cur) => {
|
||||||
if (
|
if (
|
||||||
cur.dishesId > -1 &&
|
cur.dishesId > -1 &&
|
||||||
cur.name &&
|
cur.name &&
|
||||||
@ -39,4 +41,5 @@ export function getProcessMenuData(menuData) {
|
|||||||
}
|
}
|
||||||
return arr;
|
return arr;
|
||||||
}, []);
|
}, []);
|
||||||
|
return menuList;
|
||||||
}
|
}
|
||||||
|
@ -180,49 +180,7 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- 添加或修改食材对话框 -->
|
<!-- 添加或修改食材对话框 -->
|
||||||
<el-dialog :title="title" :visible.sync="open" width="520px" append-to-body>
|
<TemplateDialog ref="templateDialogRef" @onConfirm="handleOnConfirm" />
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
||||||
<el-form-item label="模板名称" prop="name" label-width="100px">
|
|
||||||
<el-input v-model="form.name" placeholder="请输入模板名称" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="营养师" prop="nutritionistId" label-width="100px">
|
|
||||||
<el-select v-model="form.nutritionistId" placeholder="请选择营养师">
|
|
||||||
<el-option
|
|
||||||
v-for="dict in nutritionistIdOptions"
|
|
||||||
:key="dict.dictValue"
|
|
||||||
:label="dict.dictLabel"
|
|
||||||
:value="dict.dictValue"
|
|
||||||
></el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item
|
|
||||||
label="营养师助理"
|
|
||||||
prop="nutriAssisId"
|
|
||||||
label-width="100px"
|
|
||||||
>
|
|
||||||
<el-select v-model="form.nutriAssisId" placeholder="请选择营养师助理">
|
|
||||||
<el-option
|
|
||||||
v-for="dict in nutriAssisIdOptions"
|
|
||||||
: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"
|
|
||||||
:rows="4"
|
|
||||||
type="textarea"
|
|
||||||
placeholder="请输入内容"
|
|
||||||
/>
|
|
||||||
</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>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -233,10 +191,9 @@ import {
|
|||||||
updateRecipesTemplate,
|
updateRecipesTemplate,
|
||||||
deleteRecipesTemplate,
|
deleteRecipesTemplate,
|
||||||
} from "@/api/custom/recipesTemplate";
|
} from "@/api/custom/recipesTemplate";
|
||||||
import store from "@/store";
|
import TemplateDialog from "@/components/TemplateDialog";
|
||||||
import { mapState } from "vuex";
|
import { mapGetters, mapState } from "vuex";
|
||||||
|
|
||||||
const userId = store.getters && store.getters.userId;
|
|
||||||
export default {
|
export default {
|
||||||
name: "recipesTemplate",
|
name: "recipesTemplate",
|
||||||
data() {
|
data() {
|
||||||
@ -266,18 +223,6 @@ export default {
|
|||||||
},
|
},
|
||||||
open: false,
|
open: false,
|
||||||
title: "",
|
title: "",
|
||||||
// 表单参数
|
|
||||||
form: {},
|
|
||||||
// 表单校验
|
|
||||||
rules: {
|
|
||||||
name: [{ required: true, message: "请输入模板名称", trigger: "blur" }],
|
|
||||||
nutritionistId: [
|
|
||||||
{ required: true, message: "请选择营养师", trigger: "blur" },
|
|
||||||
],
|
|
||||||
nutriAssisId: [
|
|
||||||
{ required: true, message: "请选择营养师助理", trigger: "blur" },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
//订单对于所有计划安排数据
|
//订单对于所有计划安排数据
|
||||||
allRecipesPlanList: [],
|
allRecipesPlanList: [],
|
||||||
//订单弹窗状态
|
//订单弹窗状态
|
||||||
@ -295,10 +240,12 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
TemplateDialog,
|
||||||
// "order-dialog": OrderDetail,
|
// "order-dialog": OrderDetail,
|
||||||
// body_sign_dialog: BodySignDetail,
|
// body_sign_dialog: BodySignDetail,
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
// ...mapGetters(["userId"]),
|
||||||
...mapState({
|
...mapState({
|
||||||
//营养师
|
//营养师
|
||||||
nutritionistIdOptions: (state) =>
|
nutritionistIdOptions: (state) =>
|
||||||
@ -340,9 +287,7 @@ export default {
|
|||||||
},
|
},
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
handleAdd() {
|
handleAdd() {
|
||||||
this.reset();
|
this.$refs.templateDialogRef.showDialog();
|
||||||
this.open = true;
|
|
||||||
this.title = "添加模板";
|
|
||||||
},
|
},
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
handleQuery() {
|
handleQuery() {
|
||||||
@ -354,22 +299,6 @@ export default {
|
|||||||
this.resetForm("queryForm");
|
this.resetForm("queryForm");
|
||||||
this.handleQuery();
|
this.handleQuery();
|
||||||
},
|
},
|
||||||
// 取消按钮
|
|
||||||
cancel() {
|
|
||||||
this.open = false;
|
|
||||||
this.reset();
|
|
||||||
},
|
|
||||||
// 表单重置
|
|
||||||
reset() {
|
|
||||||
this.form = {
|
|
||||||
id: null,
|
|
||||||
name: null,
|
|
||||||
remark: null,
|
|
||||||
nutritionistId: null,
|
|
||||||
nutriAssisId: null,
|
|
||||||
};
|
|
||||||
this.resetForm("form");
|
|
||||||
},
|
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
handleExport() {
|
||||||
const queryParams = this.queryParams;
|
const queryParams = this.queryParams;
|
||||||
@ -402,10 +331,7 @@ export default {
|
|||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
},
|
},
|
||||||
handleOnTemplateEdit(data) {
|
handleOnTemplateEdit(data) {
|
||||||
this.open = true;
|
this.$refs.templateDialogRef.showDialog(data);
|
||||||
this.title = "修改模板";
|
|
||||||
this.reset();
|
|
||||||
this.form = data;
|
|
||||||
},
|
},
|
||||||
handleOnRecipesEdit(data) {
|
handleOnRecipesEdit(data) {
|
||||||
// console.log(data);
|
// console.log(data);
|
||||||
@ -427,29 +353,24 @@ export default {
|
|||||||
return this.selectDictLabel(this.nutriAssisIdOptions, row.nutriAssisId);
|
return this.selectDictLabel(this.nutriAssisIdOptions, row.nutriAssisId);
|
||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm() {
|
handleOnConfirm(form) {
|
||||||
this.$refs["form"].validate((valid) => {
|
if (form.id != null) {
|
||||||
if (valid) {
|
updateRecipesTemplate(form).then((response) => {
|
||||||
this.form.cusId = 0;
|
if (response.code === 200) {
|
||||||
if (this.form.id != null) {
|
this.msgSuccess("修改成功");
|
||||||
updateRecipesTemplate(this.form).then((response) => {
|
this.open = false;
|
||||||
if (response.code === 200) {
|
this.getList();
|
||||||
this.msgSuccess("修改成功");
|
|
||||||
this.open = false;
|
|
||||||
this.getList();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
addRecipesTemplate(this.form).then((response) => {
|
|
||||||
if (response.code === 200) {
|
|
||||||
this.msgSuccess("新增成功");
|
|
||||||
this.open = false;
|
|
||||||
this.getList();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
} else {
|
||||||
|
addRecipesTemplate(form).then((response) => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
this.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -268,7 +268,6 @@ import {
|
|||||||
updateWxDistribution,
|
updateWxDistribution,
|
||||||
exportWxDistribution,
|
exportWxDistribution,
|
||||||
} from "@/api/custom/wxDistribution";
|
} from "@/api/custom/wxDistribution";
|
||||||
import { getOptions } from "@/api/custom/order";
|
|
||||||
import { listWxAccount } from "@/api/custom/wxAccount";
|
import { listWxAccount } from "@/api/custom/wxAccount";
|
||||||
import { mapState } from "vuex";
|
import { mapState } from "vuex";
|
||||||
export default {
|
export default {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user