串联功能
This commit is contained in:
parent
df485e55d0
commit
1d7b7cd259
stdiet-admin/src/main/java/com/stdiet/web/controller/custom
stdiet-custom/src/main
java/com/stdiet/custom
domain
mapper
service
resources/mapper/custom
stdiet-ui/src
api/custom
components/RecipesPlanDrawer
router
store/modules
utils
views/custom
@ -57,6 +57,12 @@ public class SysRecipesPlanController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('recipes:recipesPlan:list')")
|
||||
@GetMapping(value = "/list/{cusId}")
|
||||
public AjaxResult getAllPlanByCusId(@PathVariable Long cusId) {
|
||||
return AjaxResult.success(sysRecipesPlanService.selectPlanListByCusId(cusId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取食谱计划详细信息
|
||||
*/
|
||||
|
@ -34,16 +34,31 @@ public class SysWapController extends BaseController {
|
||||
return AjaxResult.success(iSysWapServices.getRecipesPlanListInfo(outId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
* @param outId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/healthyInfo/{outId}")
|
||||
public AjaxResult healthy(@PathVariable String outId) {
|
||||
return AjaxResult.success(iSysWapServices.getHealthyDataByOutId(outId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取某天食谱菜品
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/recipes/menu/{id}")
|
||||
public AjaxResult dayilyMenu(@PathVariable Long id) {
|
||||
return AjaxResult.success(iSysRecipesService.selectDishesByMenuId(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统字典
|
||||
* @param dictType
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/dict/{dictType}")
|
||||
public AjaxResult sysDict(@PathVariable String dictType) {
|
||||
return AjaxResult.success(iSysDictTypeService.selectDictDataByType(dictType));
|
||||
|
@ -28,6 +28,11 @@ public class SysRecipesPlan {
|
||||
|
||||
private Long cusId;
|
||||
|
||||
/**
|
||||
* 对外的用户id
|
||||
*/
|
||||
private String outId;
|
||||
|
||||
//客户ID
|
||||
// private Long customerId;
|
||||
|
||||
|
@ -88,9 +88,9 @@ public interface SysRecipesPlanMapper
|
||||
*/
|
||||
List<SysRecipesPlan> selectPlanListByOrderId(SysRecipesPlan sysRecipesPlan);
|
||||
|
||||
List<SysRecipesPlan> selectPlanListByOutId(String outId);
|
||||
|
||||
Long getCusIdByOutId(String outId);
|
||||
|
||||
List<SysRecipesPlanListInfo> selectRecipesPlanListInfo(String outId);
|
||||
|
||||
List<SysRecipesPlan> selectPlanListByCusId(Long cusId);
|
||||
}
|
@ -91,10 +91,26 @@ public interface ISysRecipesPlanService
|
||||
*/
|
||||
List<SysRecipesPlan> selectPlanListByOrderId(SysRecipesPlan sysRecipesPlan);
|
||||
|
||||
List<SysRecipesPlan> selectPlanListByOutId(String outId);
|
||||
|
||||
/**
|
||||
* 通过outId查询cusId
|
||||
* @param outId
|
||||
* @return
|
||||
*/
|
||||
Long getCusIdByOutId(String outId);
|
||||
|
||||
/**
|
||||
* 通过outId查询食谱计划简要
|
||||
* @param outId
|
||||
* @return
|
||||
*/
|
||||
List<SysRecipesPlanListInfo> selectRecipesPlanListInfo(String outId);
|
||||
|
||||
/**
|
||||
* 通过客户id查询食谱计划
|
||||
* @param cusId
|
||||
* @return
|
||||
*/
|
||||
List<SysRecipesPlan> selectPlanListByCusId(Long cusId);
|
||||
|
||||
}
|
@ -293,11 +293,6 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
|
||||
return sysRecipesPlanMapper.selectPlanListByOrderId(sysRecipesPlan);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysRecipesPlan> selectPlanListByOutId(String outId) {
|
||||
return sysRecipesPlanMapper.selectPlanListByOutId(outId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getCusIdByOutId(String outId) {
|
||||
return sysRecipesPlanMapper.getCusIdByOutId(outId);
|
||||
@ -308,4 +303,9 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
|
||||
return sysRecipesPlanMapper.selectRecipesPlanListInfo(outId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysRecipesPlan> selectPlanListByCusId(Long cusId) {
|
||||
return sysRecipesPlanMapper.selectPlanListByCusId(cusId);
|
||||
}
|
||||
|
||||
}
|
@ -54,6 +54,7 @@ public class SysRecipesServiceImpl implements ISysRecipesService {
|
||||
SysRecipesPlan sysRecipesPlan = new SysRecipesPlan();
|
||||
sysRecipesPlan.setId(sysRecipes.getPlanId());
|
||||
sysRecipesPlan.setRecipesId(sysRecipes.getId());
|
||||
sysRecipesPlan.setReviewStatus(1);
|
||||
sysRecipesPlanMapper.updateSysRecipesPlan(sysRecipesPlan);
|
||||
}
|
||||
|
||||
|
@ -5,52 +5,53 @@
|
||||
<mapper namespace="com.stdiet.custom.mapper.SysRecipesPlanMapper">
|
||||
|
||||
<resultMap type="SysRecipesPlan" id="SysRecipesPlanResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="orderId" column="order_id" />
|
||||
<result property="startDate" column="start_date" />
|
||||
<result property="endDate" column="end_date" />
|
||||
<result property="startNumDay" column="start_num_day" />
|
||||
<result property="endNumDay" column="end_num_day" />
|
||||
<result property="recipesId" column="recipes_id" />
|
||||
<result property="sendFlag" column="send_flag" />
|
||||
<result property="sendTime" column="send_time" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="cusId" column="cus_id" />
|
||||
<result property="id" column="id"/>
|
||||
<result property="orderId" column="order_id"/>
|
||||
<result property="startDate" column="start_date"/>
|
||||
<result property="endDate" column="end_date"/>
|
||||
<result property="startNumDay" column="start_num_day"/>
|
||||
<result property="endNumDay" column="end_num_day"/>
|
||||
<result property="recipesId" column="recipes_id"/>
|
||||
<result property="sendFlag" column="send_flag"/>
|
||||
<result property="sendTime" column="send_time"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="cusId" column="cus_id"/>
|
||||
<result property="outId" column="out_id"/>
|
||||
<!-- 非持久化字段 -->
|
||||
<!-- <result property="customerId" column="cus_id"></result><!– 客户ID –>-->
|
||||
<result property="customer" column="customer" /><!-- 客户姓名 -->
|
||||
<result property="phone" column="phone" />
|
||||
<result property="reviewStatus" column="review_status" />
|
||||
<result property="orderStartDate" column="order_start_date" />
|
||||
<result property="orderEndDate" column="order_end_date" />
|
||||
<result property="nutritionistId" column="nutritionist_id" />
|
||||
<result property="nutritionist" column="nutritionist" />
|
||||
<result property="nutritionistAssisId" column="nutritionist_assis_id" />
|
||||
<result property="nutritionistAssis" column="nutritionist_assis" />
|
||||
<!-- <result property="customerId" column="cus_id"></result><!– 客户ID –>-->
|
||||
<result property="customer" column="customer"/><!-- 客户姓名 -->
|
||||
<result property="phone" column="phone"/>
|
||||
<result property="reviewStatus" column="review_status"/>
|
||||
<result property="orderStartDate" column="order_start_date"/>
|
||||
<result property="orderEndDate" column="order_end_date"/>
|
||||
<result property="nutritionistId" column="nutritionist_id"/>
|
||||
<result property="nutritionist" column="nutritionist"/>
|
||||
<result property="nutritionistAssisId" column="nutritionist_assis_id"/>
|
||||
<result property="nutritionistAssis" column="nutritionist_assis"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
|
||||
<sql id="selectSysRecipesPlanVo">
|
||||
select id, order_id, cus_id, start_date, end_date, start_num_day, end_num_day, recipes_id, send_flag, send_time, create_time, create_by, update_time, update_by, del_flag, review_status from sys_recipes_plan
|
||||
</sql>
|
||||
|
||||
<select id="selectSysRecipesPlanList" parameterType="SysRecipesPlan" resultMap="SysRecipesPlanResult">
|
||||
<include refid="selectSysRecipesPlanVo"/> where del_flag = 0
|
||||
<if test="orderId != null "> and order_id = #{orderId}</if>
|
||||
<if test="cusId != null "> and cus_id = #{cusId}</if>
|
||||
<if test="startDate != null "> and start_date = #{startDate}</if>
|
||||
<if test="endDate != null "> and end_date = #{endDate}</if>
|
||||
<if test="startNumDay != null "> and start_num_day = #{startNumDay}</if>
|
||||
<if test="endNumDay != null "> and end_num_day = #{endNumDay}</if>
|
||||
<if test="recipesId != null "> and recipes_id = #{recipesId}</if>
|
||||
<if test="sendFlag != null "> and send_flag = #{sendFlag}</if>
|
||||
<if test="sendTime != null "> and send_time = #{sendTime}</if>
|
||||
<if test="reviewStatus != null "> and review_status = #{reviewStatus}</if>
|
||||
<include refid="selectSysRecipesPlanVo"/>
|
||||
where del_flag = 0
|
||||
<if test="orderId != null ">and order_id = #{orderId}</if>
|
||||
<if test="cusId != null ">and cus_id = #{cusId}</if>
|
||||
<if test="startDate != null ">and start_date = #{startDate}</if>
|
||||
<if test="endDate != null ">and end_date = #{endDate}</if>
|
||||
<if test="startNumDay != null ">and start_num_day = #{startNumDay}</if>
|
||||
<if test="endNumDay != null ">and end_num_day = #{endNumDay}</if>
|
||||
<if test="recipesId != null ">and recipes_id = #{recipesId}</if>
|
||||
<if test="sendFlag != null ">and send_flag = #{sendFlag}</if>
|
||||
<if test="sendTime != null ">and send_time = #{sendTime}</if>
|
||||
<if test="reviewStatus != null ">and review_status = #{reviewStatus}</if>
|
||||
</select>
|
||||
|
||||
<select id="selectSysRecipesPlanById" parameterType="Long" resultMap="SysRecipesPlanResult">
|
||||
@ -134,37 +135,45 @@
|
||||
INSERT INTO sys_recipes_plan
|
||||
(order_id, cus_id, start_date, end_date, start_num_day, end_num_day, send_flag, send_time, recipes_id)
|
||||
VALUES
|
||||
<foreach collection ="list" item="plan" separator =",">
|
||||
(#{plan.orderId}, #{plan.cusId}, #{plan.startDate}, #{plan.endDate}, #{plan.startNumDay}, #{plan.endNumDay}, #{plan.sendFlag}, #{plan.sendTime}, #{plan.recipesId})
|
||||
</foreach >
|
||||
<foreach collection="list" item="plan" separator=",">
|
||||
(#{plan.orderId}, #{plan.cusId}, #{plan.startDate}, #{plan.endDate}, #{plan.startNumDay}, #{plan.endNumDay},
|
||||
#{plan.sendFlag}, #{plan.sendTime}, #{plan.recipesId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 根据订单ID删除对应食谱计划 -->
|
||||
<update id="delRecipesPlanByOrderId" parameterType="String">
|
||||
delete from sys_recipes_plan where order_id in
|
||||
<foreach item="orderId" collection="array" open="(" separator="," close=")">
|
||||
delete from sys_recipes_plan where order_id in
|
||||
<foreach item="orderId" collection="array" open="(" separator="," close=")">
|
||||
#{orderId}
|
||||
</foreach>
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<!-- 食谱计划、订单表联查 -->
|
||||
<select id="selectPlanListByCondition" parameterType="SysRecipesPlan" resultMap="SysRecipesPlanResult">
|
||||
SELECT srp.id,srp.order_id,srp.recipes_id,srp.start_num_day,srp.end_num_day,srp.cus_id,sc.phone,
|
||||
SELECT srp.id,srp.order_id,srp.recipes_id,srp.start_num_day,srp.end_num_day,srp.cus_id,sc.phone,
|
||||
su_nutritionist.nick_name nutritionist,su_nutritionist_assis.nick_name AS nutritionist_assis,
|
||||
srp.start_date,srp.end_date,srp.send_flag,srp.send_time, sc.name as customer
|
||||
FROM sys_recipes_plan srp
|
||||
LEFT JOIN sys_order sr ON sr.order_id = srp.order_id
|
||||
LEFT JOIN sys_customer sc ON sc.id = srp.cus_id
|
||||
LEFT JOIN sys_user su_nutritionist ON su_nutritionist.user_id = sr.nutritionist_id AND su_nutritionist.del_flag = 0
|
||||
LEFT JOIN sys_user su_nutritionist_assis ON su_nutritionist_assis.user_id = sr.nutri_assis_id AND su_nutritionist_assis.del_flag = 0
|
||||
WHERE srp.del_flag = 0 and sr.del_flag = 0
|
||||
<if test="orderId != null">AND srp.order_id = #{orderId}</if>
|
||||
srp.start_date,srp.end_date,srp.send_flag,srp.send_time, sc.name as customer, srp.review_status
|
||||
FROM sys_recipes_plan srp
|
||||
LEFT JOIN sys_order sr ON sr.order_id = srp.order_id
|
||||
LEFT JOIN sys_customer sc ON sc.id = srp.cus_id
|
||||
LEFT JOIN sys_user su_nutritionist ON su_nutritionist.user_id = sr.nutritionist_id AND su_nutritionist.del_flag
|
||||
= 0
|
||||
LEFT JOIN sys_user su_nutritionist_assis ON su_nutritionist_assis.user_id = sr.nutri_assis_id AND
|
||||
su_nutritionist_assis.del_flag = 0
|
||||
WHERE srp.del_flag = 0 and sr.del_flag = 0
|
||||
<if test="orderId != null">AND srp.order_id = #{orderId}</if>
|
||||
<if test="sendFlag != null">AND srp.send_flag = #{sendFlag}</if>
|
||||
<if test="customer != null and customer != ''">AND (sc.name like concat('%',#{customer},'%') OR sc.phone like concat('%',#{customer},'%'))</if>
|
||||
<if test="nutritionistId != null">AND su_nutritionist.user_id = #{nutritionistId}</if>
|
||||
<if test="nutritionistAssisId != null">AND su_nutritionist_assis.user_id = #{nutritionistAssisId}</if>
|
||||
<if test="startDate != null and endDate != null ">AND srp.start_date BETWEEN date_format(#{startDate},'%y%m%d') AND date_format(#{endDate},'%y%m%d') </if>
|
||||
ORDER BY srp.order_id DESC,srp.id ASC
|
||||
<if test="customer != null and customer != ''">AND (sc.name like concat('%',#{customer},'%') OR sc.phone like
|
||||
concat('%',#{customer},'%'))
|
||||
</if>
|
||||
<if test="nutritionistId != null">AND su_nutritionist.user_id = #{nutritionistId}</if>
|
||||
<if test="nutritionistAssisId != null">AND su_nutritionist_assis.user_id = #{nutritionistAssisId}</if>
|
||||
<if test="reviewStatus != null">AND srp.review_status = #{reviewStatus}</if>
|
||||
<if test="startDate != null and endDate != null ">AND srp.start_date BETWEEN date_format(#{startDate},'%y%m%d')
|
||||
AND date_format(#{endDate},'%y%m%d')
|
||||
</if>
|
||||
ORDER BY srp.order_id DESC,srp.id ASC
|
||||
</select>
|
||||
<!-- 食谱计划、订单表联查 -->
|
||||
<!--<select id="selectPlanListByCondition" parameterType="SysRecipesPlan" resultMap="SysRecipesPlanResult">
|
||||
@ -186,17 +195,17 @@
|
||||
|
||||
<!-- 根据订单ID查询食谱计划 -->
|
||||
<select id="selectPlanListByOrderId" parameterType="SysRecipesPlan" resultMap="SysRecipesPlanResult">
|
||||
SELECT srp.id,srp.order_id,sr.customer,sr.phone, srp.start_date,srp.end_date,srp.send_flag,srp.send_time
|
||||
FROM sys_recipes_plan srp
|
||||
LEFT JOIN sys_order sr ON sr.order_id = srp.order_id
|
||||
WHERE srp.del_flag = 0 AND sr.del_flag = 0 AND srp.order_id = #{orderId}
|
||||
<if test="sendFlag != null">AND srp.send_flag = #{sendFlag}</if>
|
||||
ORDER BY srp.id ASC
|
||||
SELECT srp.id,srp.order_id,sr.customer,sr.phone, srp.start_date,srp.end_date,srp.send_flag,srp.send_time
|
||||
FROM sys_recipes_plan srp
|
||||
LEFT JOIN sys_order sr ON sr.order_id = srp.order_id
|
||||
WHERE srp.del_flag = 0 AND sr.del_flag = 0 AND srp.order_id = #{orderId}
|
||||
<if test="sendFlag != null">AND srp.send_flag = #{sendFlag}</if>
|
||||
ORDER BY srp.id ASC
|
||||
</select>
|
||||
|
||||
<!-- 根据outId查询食谱计划-->
|
||||
<select id="selectPlanListByOutId" parameterType="String" resultMap="SysRecipesPlanResult">
|
||||
select cus_id, recipes_id, start_num_day, end_num_day from sys_recipes_plan where out_id=#{outId} order by create_time desc
|
||||
<!-- 根据cusId查询食谱计划-->
|
||||
<select id="selectPlanListByCusId" parameterType="Long" resultMap="SysRecipesPlanResult">
|
||||
select id, out_id, start_date, end_date, start_num_day, end_num_day, recipes_id, review_status from sys_recipes_plan where cus_id=#{cusId} order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="getCusIdByOutId" parameterType="String" resultType="Long">
|
||||
@ -204,14 +213,15 @@
|
||||
</select>
|
||||
|
||||
<resultMap id="SysRecipesPlanListInfoResult" type="SysRecipesPlanListInfo">
|
||||
<result property="id" column="id" />
|
||||
<result property="startDate" column="start_date" />
|
||||
<result property="endDate" column="end_date" />
|
||||
<result property="startNumDay" column="start_num_day" />
|
||||
<result property="endNumDay" column="end_num_day" />
|
||||
<result property="id" column="id"/>
|
||||
<result property="startDate" column="start_date"/>
|
||||
<result property="endDate" column="end_date"/>
|
||||
<result property="startNumDay" column="start_num_day"/>
|
||||
<result property="endNumDay" column="end_num_day"/>
|
||||
<association property="menus" column="recipes_id" select="selectMenuIds"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 通过outId查询食谱计划简要-->
|
||||
<select id="selectRecipesPlanListInfo" resultMap="SysRecipesPlanListInfoResult">
|
||||
select id, start_date, end_date, start_num_day, end_num_day, recipes_id from sys_recipes_plan where out_id=#{outId}
|
||||
</select>
|
||||
|
@ -1,36 +1,43 @@
|
||||
import request from '@/utils/request'
|
||||
import request from "@/utils/request";
|
||||
|
||||
// 查询食谱计划列表
|
||||
export function listRecipesPlan(query) {
|
||||
return request({
|
||||
url: '/recipes/recipesPlan/list',
|
||||
method: 'get',
|
||||
url: "/recipes/recipesPlan/list",
|
||||
method: "get",
|
||||
params: query
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
// 查询食谱计划详细
|
||||
export function getRecipesPlan(id) {
|
||||
return request({
|
||||
url: '/recipes/recipesPlan/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
url: "/recipes/recipesPlan/" + id,
|
||||
method: "get"
|
||||
});
|
||||
}
|
||||
|
||||
// 修改食谱计划
|
||||
export function updateRecipesPlan(data) {
|
||||
return request({
|
||||
url: '/recipes/recipesPlan',
|
||||
method: 'put',
|
||||
url: "/recipes/recipesPlan",
|
||||
method: "put",
|
||||
data: data
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
// 导出食谱计划
|
||||
export function exportRecipesPlan(query) {
|
||||
return request({
|
||||
url: '/recipes/recipesPlan/export',
|
||||
method: 'get',
|
||||
url: "/recipes/recipesPlan/export",
|
||||
method: "get",
|
||||
params: query
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
export function listRecipesPlanByCusId(id) {
|
||||
return request({
|
||||
url: "/recipes/recipesPlan/list/" + id,
|
||||
method: "get"
|
||||
});
|
||||
}
|
||||
|
@ -6,19 +6,60 @@
|
||||
@closed="handleOnClosed"
|
||||
size="40%"
|
||||
>
|
||||
<div class="app-container">
|
||||
<div class="app-container recipes_plan_drawer_wrapper">
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
v-if="cusOutId"
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
icon="el-icon-share"
|
||||
size="mini"
|
||||
@click="handleInnerOpen"
|
||||
class="copyBtn"
|
||||
:data-clipboard-text="copyValue"
|
||||
@click="handleOnRecipesLinkClick"
|
||||
>客户食谱链接
|
||||
</el-button>
|
||||
|
||||
<el-button icon="el-icon-view" size="mini" @click="handleInnerOpen"
|
||||
>查看暂停记录
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table :data="planList" v-loading="planLoading" height="90%">
|
||||
<el-table-column label="审核状态" align="center" width="80">
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="scope.row.reviewStatus ? 'success' : 'danger'">{{
|
||||
`${scope.row.reviewStatus ? "已审核" : "未审核"}`
|
||||
}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="计划" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ `第${scope.row.startNumDay} 至 ${scope.row.endNumDay}天` }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="日期" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ `${scope.row.startDate} 至 ${scope.row.endDate}` }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
type="text"
|
||||
:icon="
|
||||
scope.row.recipesId ? 'el-icon-edit' : 'el-icon-edit-outline'
|
||||
"
|
||||
@click="handleOnRecipesEditClick(scope.row)"
|
||||
>
|
||||
{{ `${scope.row.recipesId ? "编辑" : "制作"}` }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 暂停记录抽屉 -->
|
||||
<el-drawer
|
||||
:title="innerTitle"
|
||||
:append-to-body="true"
|
||||
@ -34,7 +75,7 @@
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleInnerOpen"
|
||||
>查看暂停记录
|
||||
>增加暂停记录
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -44,6 +85,8 @@
|
||||
</el-drawer>
|
||||
</template>
|
||||
<script>
|
||||
import Clipboard from "clipboard";
|
||||
import { listRecipesPlanByCusId } from "@/api/custom/recipesPlan";
|
||||
export default {
|
||||
name: "RecipesPlanDrawer",
|
||||
data() {
|
||||
@ -52,25 +95,59 @@ export default {
|
||||
innerVisible: false,
|
||||
title: "",
|
||||
innerTitle: "",
|
||||
cusOutId: "",
|
||||
copyValue: "",
|
||||
planLoading: false,
|
||||
planList: [],
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
showDrawer(data) {
|
||||
// console.log(data);
|
||||
this.data = data;
|
||||
if (!this.data) {
|
||||
return;
|
||||
}
|
||||
this.visible = true;
|
||||
this.title = `「${this.data.name}」食谱计划`;
|
||||
this.planLoading = true;
|
||||
listRecipesPlanByCusId(data.id).then((response) => {
|
||||
this.planList = response.data;
|
||||
this.cusOutId = response.data.reduce((str, cur) => {
|
||||
if (!str && cur.recipesId) {
|
||||
str = cur.outId;
|
||||
}
|
||||
return str;
|
||||
}, "");
|
||||
console.log(this.planList);
|
||||
this.planLoading = false;
|
||||
});
|
||||
},
|
||||
handleOnClosed() {
|
||||
this.data = undefined;
|
||||
this.cusOutId = "";
|
||||
},
|
||||
handleInnerOpen() {
|
||||
this.innerVisible = true;
|
||||
this.innerTitle = `「${this.data.name}」暂停记录`;
|
||||
},
|
||||
handleOnRecipesLinkClick() {
|
||||
this.copyValue =
|
||||
window.location.origin.replace("manage", "sign") +
|
||||
"/recipes/detail/" +
|
||||
this.cusOutId;
|
||||
new Clipboard(".copyBtn");
|
||||
this.$message({
|
||||
message: "拷贝成功",
|
||||
type: "success",
|
||||
});
|
||||
},
|
||||
handleOnInnerClosed() {},
|
||||
handleOnRecipesEditClick(data) {
|
||||
// console.log(data);
|
||||
const { id, name } = this.data;
|
||||
window.open("/recipes/build/" + name + "/" + id, "_blank");
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@ -78,4 +155,8 @@ export default {
|
||||
/deep/ :focus {
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.recipes_plan_drawer_wrapper {
|
||||
height: calc(100vh - 77px);
|
||||
}
|
||||
</style>
|
||||
|
@ -140,9 +140,10 @@ export const constantRoutes = [
|
||||
]
|
||||
},
|
||||
{
|
||||
path: "/recipes/build",
|
||||
path: "/recipes/build/:name/:planId",
|
||||
component: resolve => require(["@/views/custom/recipesBuild"], resolve),
|
||||
name: "RecipiesBuild",
|
||||
props: true,
|
||||
meta: { title: "食谱制作" },
|
||||
hidden: true
|
||||
},
|
||||
|
@ -7,6 +7,7 @@ import {
|
||||
deleteDishesApi,
|
||||
addRecipesApi
|
||||
} from "@/api/custom/recipes";
|
||||
import { getRecipesPlan, updateRecipesPlan } from "@/api/custom/recipesPlan";
|
||||
import { getDicts } from "@/api/system/dict/data";
|
||||
|
||||
const oriState = {
|
||||
@ -23,7 +24,8 @@ const oriState = {
|
||||
typeOptions: [],
|
||||
currentDay: -1,
|
||||
startNum: 0,
|
||||
endNum: 0
|
||||
endNum: 0,
|
||||
reviewStatus: 0
|
||||
};
|
||||
|
||||
const mutations = {
|
||||
@ -72,32 +74,55 @@ const mutations = {
|
||||
|
||||
const actions = {
|
||||
async init({ commit, dispatch }, payload) {
|
||||
return new Promise((res, rej) => {
|
||||
// console.log(payload);
|
||||
//
|
||||
commit("updateStateData", payload);
|
||||
//
|
||||
getDicts("cus_cus_unit").then(response => {
|
||||
commit("updateStateData", { cusUnitOptions: response.data });
|
||||
});
|
||||
getDicts("cus_cus_weight").then(response => {
|
||||
commit("updateStateData", { cusWeightOptions: response.data });
|
||||
});
|
||||
getDicts("cus_dishes_type").then(response => {
|
||||
commit("updateStateData", { typeOptions: response.data });
|
||||
});
|
||||
// console.log(payload);
|
||||
const planResponse = await getRecipesPlan(payload.planId);
|
||||
const {
|
||||
startNumDay,
|
||||
endNumDay,
|
||||
recipesId,
|
||||
cusId,
|
||||
reviewStatus
|
||||
} = planResponse.data;
|
||||
commit("updateStateData", {
|
||||
cusId,
|
||||
recipesId,
|
||||
reviewStatus,
|
||||
planId: payload.planId,
|
||||
startNum: startNumDay,
|
||||
endNum: endNumDay
|
||||
});
|
||||
|
||||
getDicts("cus_cus_unit").then(response => {
|
||||
commit("updateStateData", { cusUnitOptions: response.data });
|
||||
});
|
||||
getDicts("cus_cus_weight").then(response => {
|
||||
commit("updateStateData", { cusWeightOptions: response.data });
|
||||
});
|
||||
getDicts("cus_dishes_type").then(response => {
|
||||
commit("updateStateData", { typeOptions: response.data });
|
||||
});
|
||||
|
||||
return new Promise((res, rej) => {
|
||||
// 健康数据
|
||||
if (payload.cusId) {
|
||||
dispatch("getHealthyData", payload).catch(err => rej(err));
|
||||
if (cusId) {
|
||||
dispatch("getHealthyData", { cusId }).catch(err => rej(err));
|
||||
}
|
||||
|
||||
// 食谱数据
|
||||
if (payload.recipesId) {
|
||||
dispatch("getRecipesInfo", payload).catch(err => rej(err));
|
||||
if (recipesId) {
|
||||
dispatch("getRecipesInfo", { recipesId }).catch(err => rej(err));
|
||||
}
|
||||
});
|
||||
},
|
||||
async updateReviewStatus({ commit, state }, payload) {
|
||||
const response = await updateRecipesPlan({
|
||||
id: state.planId,
|
||||
reviewStatus: payload.reviewStatus
|
||||
});
|
||||
if (response.code === 200) {
|
||||
commit("updateStateData", payload);
|
||||
}
|
||||
},
|
||||
async getHealthyData({ commit }, payload) {
|
||||
commit("updateStateData", { healthDataLoading: true });
|
||||
const healthyDataResult = await getCustomerPhysicalSignsByCusId(
|
||||
@ -127,16 +152,14 @@ const actions = {
|
||||
const recipesDataResult = await getRecipesApi(payload.recipesId);
|
||||
let recipesData = [];
|
||||
if (recipesDataResult.code === 200) {
|
||||
const { endNum, startNum } = state;
|
||||
let length = null;
|
||||
if (endNum && startNum) {
|
||||
length = endNum - startNum;
|
||||
}
|
||||
const { endNum, startNum, recipesId } = state;
|
||||
// 计算
|
||||
let length = endNum - startNum;
|
||||
recipesData = recipesDataResult.data.reduce((outArr, dayData, idx) => {
|
||||
if (!length || (length && length >= idx)) {
|
||||
if (!recipesId || length >= idx) {
|
||||
outArr.push({
|
||||
id: dayData.id,
|
||||
numDay: startNum ? startNum + idx : dayData.numDay,
|
||||
numDay: !recipesId ? startNum + idx : dayData.numDay,
|
||||
dishes: dayData.dishes.reduce((arr, cur) => {
|
||||
if (
|
||||
cur.dishesId > -1 &&
|
||||
|
@ -29,7 +29,6 @@ service.interceptors.request.use(config => {
|
||||
service.interceptors.response.use(res => {
|
||||
// 未设置状态码则默认成功状态
|
||||
const code = res.data.code || 200;
|
||||
console.log(res)
|
||||
// 获取错误信息
|
||||
const msg = errorCode[code] || res.data.msg || errorCode['default']
|
||||
if (code === 401) {
|
||||
|
@ -4,6 +4,31 @@
|
||||
:style="`height: ${collapse ? 30 : 200}px`"
|
||||
>
|
||||
<div class="header">
|
||||
<el-popover
|
||||
placement="bottom"
|
||||
trigger="click"
|
||||
title="修改审核状态"
|
||||
style="margin-right: 12px"
|
||||
v-hasPermi="['recipes:recipesPlan:review']"
|
||||
>
|
||||
<div>
|
||||
<el-button 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"
|
||||
@click="handleReview"
|
||||
:type="reviewStatus === 1 ? 'danger' : 'success'"
|
||||
>
|
||||
{{ reviewStatus === 1 ? "未审核" : "已审核" }}
|
||||
</el-button>
|
||||
</el-popover>
|
||||
<el-button
|
||||
v-if="!recipesId"
|
||||
size="mini"
|
||||
@ -11,9 +36,15 @@
|
||||
@click="handleOnSave"
|
||||
>生成食谱</el-button
|
||||
>
|
||||
<el-button size="mini" type="text" @click="handleCollapseClick">{{
|
||||
`${collapse ? "展开分析" : "收起分析"}`
|
||||
}}</el-button>
|
||||
<el-button size="mini" type="text" @click="handleCollapseClick">
|
||||
{{ `${collapse ? "展开" : "收起"}` }}
|
||||
<em
|
||||
class="el-icon-arrow-down arrow_icon"
|
||||
:style="
|
||||
collapse ? 'transform: rotate(-180deg);' : 'transform: unset;'
|
||||
"
|
||||
/>
|
||||
</el-button>
|
||||
</div>
|
||||
<div
|
||||
class="content"
|
||||
@ -53,7 +84,7 @@ export default {
|
||||
},
|
||||
props: ["collapse", "data"],
|
||||
computed: {
|
||||
...mapState(["recipesId"]),
|
||||
...mapState(["recipesId", "reviewStatus"]),
|
||||
},
|
||||
methods: {
|
||||
handleCollapseClick() {
|
||||
@ -67,7 +98,10 @@ export default {
|
||||
},
|
||||
});
|
||||
},
|
||||
...mapActions(["saveRecipes"]),
|
||||
hanldeOnReveiwChange(reviewStatus) {
|
||||
this.updateReviewStatus({ reviewStatus });
|
||||
},
|
||||
...mapActions(["saveRecipes", "updateReviewStatus"]),
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@ -79,6 +113,11 @@ export default {
|
||||
.header {
|
||||
text-align: right;
|
||||
height: 30px;
|
||||
|
||||
.arrow_icon {
|
||||
transition: all 0.3s;
|
||||
transform-origin: center center;
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
|
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="recipes_build_wrapper" v-title :data-title="$route.query.name">
|
||||
<div class="recipes_build_wrapper" v-title :data-title="name">
|
||||
<div class="left" v-loading="recipesDataLoading">
|
||||
<RecipesView
|
||||
v-if="!!recipesData.length"
|
||||
@ -35,14 +35,8 @@ export default {
|
||||
return {};
|
||||
},
|
||||
mounted() {
|
||||
const { cusId, planId, startNum, endNum, recipesId } = this.$route.query;
|
||||
|
||||
this.init({
|
||||
cusId,
|
||||
planId,
|
||||
startNum: parseInt(startNum),
|
||||
endNum: parseInt(endNum),
|
||||
recipesId,
|
||||
planId: this.planId,
|
||||
}).catch((err) => {
|
||||
this.$message.error(err.message);
|
||||
});
|
||||
@ -57,7 +51,7 @@ export default {
|
||||
RecipesView,
|
||||
RecommondView,
|
||||
},
|
||||
// props: ["cusId", "planId", "recipesId", "startDate", "endDate"],
|
||||
props: ["name", "planId"],
|
||||
computed: {
|
||||
...mapState([
|
||||
"healthyData",
|
||||
|
@ -14,11 +14,7 @@
|
||||
size="small"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="食谱开始日期范围"
|
||||
prop="planStartDateScope"
|
||||
label-width="130px"
|
||||
>
|
||||
<el-form-item label="日期" prop="planStartDateScope">
|
||||
<el-date-picker
|
||||
v-model="planStartDateScope"
|
||||
type="daterange"
|
||||
@ -58,6 +54,21 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="审核状态" prop="reviewStatus">
|
||||
<el-select
|
||||
v-model="queryParams.reviewStatus"
|
||||
placeholder="请选审核状态"
|
||||
clearable
|
||||
size="small"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in reviewStatusOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="cyan"
|
||||
@ -78,17 +89,6 @@
|
||||
>
|
||||
</div>
|
||||
<el-row :gutter="10" class="mb8" style="margin-top: 10px">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['recipes:recipesPlan:edit']"
|
||||
>修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
@ -99,19 +99,35 @@
|
||||
>导出
|
||||
</el-button>
|
||||
</el-col>
|
||||
<!--<div><span style="margin-left:10px;font-size:16px;color:#E6A23C;font-family:PingFang SC">备注:2021年1月开始的订单才会自动生成食谱计划</span></div>-->
|
||||
<right-toolbar
|
||||
:showSearch.sync="showSearch"
|
||||
@queryTable="getList"
|
||||
></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="recipesPlanList"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<!-- <el-table-column type="selection" width="55" align="center" /> -->
|
||||
<el-table v-loading="loading" :data="recipesPlanList">
|
||||
<el-table-column label="审核状态" align="center" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-tag
|
||||
:type="
|
||||
!scope.row.reviewStatus
|
||||
? 'info'
|
||||
: scope.row.reviewStatus === 1
|
||||
? 'danger'
|
||||
: 'success'
|
||||
"
|
||||
>{{
|
||||
`${
|
||||
!scope.row.reviewStatus
|
||||
? "未制作"
|
||||
: scope.row.reviewStatus == 1
|
||||
? "未审核"
|
||||
: "已审核"
|
||||
}`
|
||||
}}</el-tag
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="客户姓名" align="center" prop="customer" />
|
||||
<el-table-column
|
||||
label="客户手机号"
|
||||
@ -120,15 +136,15 @@
|
||||
width="180"
|
||||
/>
|
||||
<el-table-column
|
||||
label="食谱日期范围"
|
||||
label="计划"
|
||||
align="center"
|
||||
prop="scopeDate"
|
||||
prop="scopeDay"
|
||||
width="200"
|
||||
/>
|
||||
<el-table-column
|
||||
label="食谱天数范围"
|
||||
label="日期"
|
||||
align="center"
|
||||
prop="scopeDay"
|
||||
prop="scopeDate"
|
||||
width="200"
|
||||
/>
|
||||
<el-table-column label="营养师" align="center" prop="nutritionist" />
|
||||
@ -138,26 +154,6 @@
|
||||
prop="nutritionistAssis"
|
||||
width="180"
|
||||
/>
|
||||
<el-table-column label="是否发送" align="center" prop="sendFlag">
|
||||
<!--<template slot-scope="scope">
|
||||
<span>{{ scope.row.sendFlag == 1 ? "已发送" : "未发送"}}</span>
|
||||
</template>(.sendFlag == 1) ? 'success' : 'warning'-->
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="getTagType(scope.row)" disable-transitions>
|
||||
{{ scope.row.sendFlag == 1 ? "已发送" : "未发送" }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="食谱发送时间"
|
||||
align="center"
|
||||
prop="sendTime"
|
||||
width="180"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.sendTime, "{y}-{m}-{d}") }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
align="center"
|
||||
@ -168,45 +164,12 @@
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['recipes:recipesPlan:edit']"
|
||||
>修改
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-view"
|
||||
@click="
|
||||
allRecipesPlanQueryParam.orderId = scope.row.orderId;
|
||||
getAllPlanByOrderId();
|
||||
"
|
||||
>查看完整计划
|
||||
</el-button>
|
||||
<!-- <el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="getOrderDetail(scope.row)"
|
||||
v-hasPermi="['custom:order:query']"
|
||||
>查看订单
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="getCustomerSign(scope.row)"
|
||||
v-hasPermi="['custom:customer:query']"
|
||||
>查看体征
|
||||
</el-button> -->
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
:icon="`${
|
||||
scope.row.recipesId ? 'el-icon-edit' : 'el-icon-edit-outline'
|
||||
}`"
|
||||
@click="handleBuild(scope.row)"
|
||||
>{{ `${scope.row.recipesId ? "编辑" : "制作"}食谱` }}</el-button
|
||||
>{{ `${scope.row.recipesId ? "编辑" : "制作"}` }}</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -219,121 +182,11 @@
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改食谱计划对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item
|
||||
label="食谱是否已发送"
|
||||
prop="sendFlag"
|
||||
label-width="120px"
|
||||
>
|
||||
<el-select v-model="form.sendFlag" placeholder="请选择">
|
||||
<el-option label="否" :value="parseInt('0')" />
|
||||
<el-option label="是" :value="parseInt('1')" />
|
||||
</el-select>
|
||||
</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>
|
||||
|
||||
<!-- 查看完整计划 -->
|
||||
<el-dialog
|
||||
:title="allRecipesPlanTitle"
|
||||
:visible.sync="allRecipesPlanOpen"
|
||||
width="800px"
|
||||
append-to-body
|
||||
>
|
||||
<el-form
|
||||
:model="allRecipesPlanQueryParam"
|
||||
ref="allPlanQueryFrom"
|
||||
:inline="true"
|
||||
>
|
||||
<el-form-item label="发送状态" prop="sendFlag">
|
||||
<el-select
|
||||
v-model="allRecipesPlanQueryParam.sendFlag"
|
||||
placeholder="请选择"
|
||||
>
|
||||
<el-option label="全部" :value="null" />
|
||||
<el-option label="未发送" :value="parseInt('0')" />
|
||||
<el-option label="已发送" :value="parseInt('1')" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="cyan"
|
||||
icon="el-icon-search"
|
||||
size="mini"
|
||||
@click="getAllPlanByOrderId()"
|
||||
>搜索</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table v-loading="loading" :data="allRecipesPlanList" width="700px">
|
||||
<!-- <el-table-column label="客户姓名" align="center" prop="customer" /> -->
|
||||
<!--<el-table-column label="营养师名称" align="center" prop="nutritionist" />
|
||||
<el-table-column label="营养师助理名称" align="center" prop="nutritionistAssis" />-->
|
||||
|
||||
<el-table-column
|
||||
label="食谱时间范围"
|
||||
align="center"
|
||||
prop="scopeDate"
|
||||
width="250"
|
||||
/>
|
||||
<el-table-column label="食谱是否发送" align="center" prop="sendFlag">
|
||||
<!--<template slot-scope="scope">
|
||||
<span>{{ scope.row.sendFlag == 1 ? "已发送" : "未发送"}}</span>
|
||||
</template>(.sendFlag == 1) ? 'success' : 'warning'-->
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="getTagType(scope.row)" disable-transitions>
|
||||
{{ scope.row.sendFlag == 1 ? "已发送" : "未发送" }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="食谱发送时间"
|
||||
align="center"
|
||||
prop="sendTime"
|
||||
width="180"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.sendTime, "{y}-{m}-{d}") }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="allRecipesPlanTotal > 0"
|
||||
:total="allRecipesPlanTotal"
|
||||
:page.sync="allRecipesPlanQueryParam.pageNum"
|
||||
:limit.sync="allRecipesPlanQueryParam.pageSize"
|
||||
@pagination="getAllPlanByOrderId"
|
||||
/>
|
||||
<!--<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="allRecipesPlanOpen = false">关 闭</el-button>
|
||||
</div>-->
|
||||
</el-dialog>
|
||||
|
||||
<!-- 查看订单 -->
|
||||
<!-- <order-dialog ref="orderDialog" /> -->
|
||||
<!-- 查看体征 -->
|
||||
<!-- <body_sign_dialog ref="bodySignDialog" /> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
exportRecipesPlan,
|
||||
getRecipesPlan,
|
||||
listRecipesPlan,
|
||||
updateRecipesPlan,
|
||||
} from "@/api/custom/recipesPlan";
|
||||
import { getOptions } from "@/api/custom/order";
|
||||
// import OrderDetail from "@/components/OrderDetail";
|
||||
// import BodySignDetail from "@/components/BodySignDetail";
|
||||
import { exportRecipesPlan, listRecipesPlan } from "@/api/custom/recipesPlan";
|
||||
import dayjs from "dayjs";
|
||||
import store from "@/store";
|
||||
import { mapState } from "vuex";
|
||||
@ -359,11 +212,12 @@ export default {
|
||||
total: 0,
|
||||
// 食谱计划表格数据
|
||||
recipesPlanList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
orderDialog: undefined,
|
||||
reviewStatusOptions: [
|
||||
{ dictValue: 0, dictLabel: "未制作" },
|
||||
{ dictValue: 1, dictLabel: "未审核" },
|
||||
{ dictValue: 2, dictLabel: "已审核" },
|
||||
],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
@ -373,6 +227,7 @@ export default {
|
||||
endDate: null,
|
||||
nutritionistId: null,
|
||||
nutritionistAssisId: null,
|
||||
reviewStatus: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
@ -461,33 +316,8 @@ export default {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 查询客户体征 */
|
||||
getCustomerSign(row) {
|
||||
this.$refs.bodySignDialog.showDialog(row.phone);
|
||||
},
|
||||
getAllPlanByOrderId() {
|
||||
if (this.allRecipesPlanQueryParam.sendFlag === "") {
|
||||
this.allRecipesPlanQueryParam.sendFlag = null;
|
||||
}
|
||||
listRecipesPlan(this.allRecipesPlanQueryParam).then((response) => {
|
||||
this.allRecipesPlanList = response.rows;
|
||||
this.allRecipesPlanList.forEach(function (item, index) {
|
||||
item.scopeDate =
|
||||
dayjs(item.startDate).format("YYYY-MM-DD") +
|
||||
" 到 " +
|
||||
dayjs(item.endDate).format("YYYY-MM-DD");
|
||||
});
|
||||
this.allRecipesPlanOpen = true;
|
||||
this.allRecipesPlanTitle = `「${this.allRecipesPlanList[0].customer}」食谱计划表`;
|
||||
this.allRecipesPlanTotal = response.total;
|
||||
});
|
||||
},
|
||||
getOrderDetail(row) {
|
||||
this.$refs.orderDialog.showDialog(row.orderId);
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
@ -519,39 +349,6 @@ export default {
|
||||
this.planStartDateScope = [nextDate, nextDate];
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map((item) => item.id);
|
||||
this.single = selection.length !== 1;
|
||||
this.multiple = !selection.length;
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids;
|
||||
getRecipesPlan(id).then((response) => {
|
||||
this.form.id = response.data.id;
|
||||
this.form.sendFlag = response.data.sendFlag;
|
||||
this.open = true;
|
||||
this.title = "修改食谱计划";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateRecipesPlan(this.form).then((response) => {
|
||||
if (response.code === 200) {
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
const queryParams = this.queryParams;
|
||||
@ -568,67 +365,10 @@ export default {
|
||||
})
|
||||
.catch(function () {});
|
||||
},
|
||||
getTagType(row) {
|
||||
if (row.sendFlag == 1) {
|
||||
return "success";
|
||||
}
|
||||
return "danger";
|
||||
/* if(dayjs(row.startDate+"").diff(dayjs(),'day') <= 1){
|
||||
return "danger";
|
||||
}
|
||||
return '';*/
|
||||
},
|
||||
// 自定义列背景色
|
||||
columnStyle({ row, column, rowIndex, columnIndex }) {
|
||||
if (
|
||||
columnIndex == 0 ||
|
||||
columnIndex == 2 ||
|
||||
columnIndex == 4 ||
|
||||
columnIndex == 6
|
||||
) {
|
||||
//第三第四列的背景色就改变了2和3都是列数的下标
|
||||
return "background:#f3f6fc;font-weight:bold";
|
||||
} else {
|
||||
return "background:#ffffff;";
|
||||
}
|
||||
},
|
||||
// 和并列
|
||||
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
|
||||
if (columnIndex === 0) {
|
||||
if (rowIndex % 4 === 0) {
|
||||
return {
|
||||
rowspan: 4,
|
||||
colspan: 1,
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
rowspan: 0,
|
||||
colspan: 0,
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
handleBuild(data) {
|
||||
// console.log(data);
|
||||
const { id, cusId, recipesId, customer, startNumDay, endNumDay } = data;
|
||||
|
||||
const queryParam = {
|
||||
planId: id,
|
||||
cusId,
|
||||
name: customer,
|
||||
};
|
||||
if (recipesId) {
|
||||
queryParam.recipesId = recipesId;
|
||||
} else {
|
||||
queryParam.startNum = startNumDay;
|
||||
queryParam.endNum = endNumDay;
|
||||
}
|
||||
const routeUrl = this.$router.resolve({
|
||||
path: "/recipes/build",
|
||||
query: queryParam,
|
||||
});
|
||||
window.open(routeUrl.href, "_blank");
|
||||
// this.$router.push({ path: "/recipes/build", query: queryParam });
|
||||
const { id, customer } = data;
|
||||
window.open("/recipes/build/" + customer + "/" + id, "_blank");
|
||||
},
|
||||
},
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user