串联功能

This commit is contained in:
huangdeliang
2021-02-27 16:57:45 +08:00
parent df485e55d0
commit 1d7b7cd259
16 changed files with 388 additions and 451 deletions

View File

@ -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 {

View File

@ -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",

View File

@ -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");
},
},
};