Merge branch 'develop' of https://gitee.com/darlk/ShengTangManage into xzj
This commit is contained in:
@ -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");
|
||||
},
|
||||
},
|
||||
};
|
||||
|
Reference in New Issue
Block a user