!310 调查小问卷

Merge pull request !310 from 德仔/xzj
This commit is contained in:
德仔 2021-07-06 10:36:03 +00:00 committed by Gitee
commit 564d4c5530
13 changed files with 920 additions and 6 deletions

View File

@ -3,17 +3,16 @@ package com.stdiet.web.controller.common;
import com.stdiet.common.core.controller.BaseController;
import com.stdiet.common.core.domain.AjaxResult;
import com.stdiet.common.core.page.TableDataInfo;
import com.stdiet.common.enums.BusinessType;
import com.stdiet.common.utils.StringUtils;
import com.stdiet.common.utils.sign.AesUtils;
import com.stdiet.custom.domain.SysCustomer;
import com.stdiet.custom.domain.SysCustomerHealthy;
import com.stdiet.custom.domain.SysOrder;
import com.stdiet.custom.domain.SysPhysicalSigns;
import com.stdiet.custom.domain.*;
import com.stdiet.custom.dto.request.CustomerInvestigateRequest;
import com.stdiet.custom.dto.request.FoodHeatCalculatorRequest;
import com.stdiet.custom.service.*;
import com.stdiet.system.service.ISysDictTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
@ -51,6 +50,9 @@ public class InvestigateController extends BaseController {
@Autowired
private ISysOrderService sysOrderService;
@Autowired
private ISysPreSaleSurveyService sysPreSaleSurveyService;
/**
* 建立客户信息档案
*/
@ -123,4 +125,34 @@ public class InvestigateController extends BaseController {
return toAjax(sysFoodHeatStatisticsService.addMuchFoodHeat(foodHeatCalculatorRequest));
}
/**
* 添加用户基础信息问卷调查表
*/
@PostMapping(value = "/addCustomerSurvey")
public AjaxResult addCustomerSurvey(@RequestBody SysPreSaleSurvey sysPreSaleSurvey)
{
//判断客户唯一标识是否为空
if(StringUtils.isEmpty(sysPreSaleSurvey.getCustomerKey())){
return AjaxResult.error("操作失败,缺少必要参数");
}
SysPreSaleSurvey oldSysPreSale = sysPreSaleSurveyService.getSysPreSaleSurveyByKey(sysPreSaleSurvey.getCustomerKey());
if(oldSysPreSale != null){
return AjaxResult.error("已提交过问卷,无法重复提交");
}
return toAjax(sysPreSaleSurveyService.insertSysPreSaleSurvey(sysPreSaleSurvey));
}
/**
* 根据客户唯一标识
*/
@GetMapping("/getCustomerSurvey/{customerKey}")
public AjaxResult getCustomerSurvey(@PathVariable("customerKey")String customerKey)
{
//判断客户唯一标识是否为空
if(StringUtils.isEmpty(customerKey)){
return AjaxResult.error("操作失败,缺少必要参数");
}
SysPreSaleSurvey preSaleSurvey = sysPreSaleSurveyService.getSysPreSaleSurveyByKey(customerKey);
return AjaxResult.success(preSaleSurvey);
}
}

View File

@ -0,0 +1,85 @@
package com.stdiet.custom.domain;
import com.stdiet.common.annotation.Excel;
import com.stdiet.common.core.domain.BaseEntity;
import lombok.Data;
import java.math.BigDecimal;
/**
* 售前调查销售给客户发送简易信息调查链接对象 sys_pre_sale_survey
*
* @author xzj
* @date 2021-07-05
*/
@Data
public class SysPreSaleSurvey extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 客户唯一标识 */
@Excel(name = "客户唯一标识")
private String customerKey;
/** 姓名 */
@Excel(name = "姓名")
private String name;
/** 身高,厘米 */
@Excel(name = "身高,厘米")
private Integer tall;
/** 体重 */
@Excel(name = "体重")
private BigDecimal weight;
/** 年龄 */
@Excel(name = "年龄")
private Integer age;
/** 0男 1女 */
@Excel(name = "0男 1女")
private Integer sex;
/** 电话 */
@Excel(name = "电话")
private String phone;
/** 特殊体征ID */
@Excel(name = "特殊体征ID")
private String physicalSignsId;
/** 其他体征 */
@Excel(name = "其他体征")
private String otherPhysicalSigns;
/** 作息时间 */
@Excel(name = "作息时间")
private String timeTable;
/** 减脂或慢病调理经历 */
@Excel(name = "减脂或慢病调理经历")
private String experience;
/** 职业 */
@Excel(name = "职业")
private String occupation;
/** 气血数据 */
@Excel(name = "气血数据")
private String bloodData;
/** 湿气数据 */
@Excel(name = "湿气数据")
private String moistureData;
/** 售前ID */
@Excel(name = "售前ID")
private Long preSaleId;
/** 删除标识 0未删除 1已删除 */
private Integer delFlag;
}

View File

@ -0,0 +1,68 @@
package com.stdiet.custom.mapper;
import java.util.List;
import com.stdiet.custom.domain.SysPreSaleSurvey;
import org.apache.ibatis.annotations.Param;
/**
* 售前调查销售给客户发送简易信息调查链接Mapper接口
*
* @author xzj
* @date 2021-07-05
*/
public interface SysPreSaleSurveyMapper
{
/**
* 查询售前调查销售给客户发送简易信息调查链接
*
* @param id 售前调查销售给客户发送简易信息调查链接ID
* @return 售前调查销售给客户发送简易信息调查链接
*/
public SysPreSaleSurvey selectSysPreSaleSurveyById(Long id);
/**
* 查询售前调查销售给客户发送简易信息调查链接列表
*
* @param sysPreSaleSurvey 售前调查销售给客户发送简易信息调查链接
* @return 售前调查销售给客户发送简易信息调查链接集合
*/
public List<SysPreSaleSurvey> selectSysPreSaleSurveyList(SysPreSaleSurvey sysPreSaleSurvey);
/**
* 新增售前调查销售给客户发送简易信息调查链接
*
* @param sysPreSaleSurvey 售前调查销售给客户发送简易信息调查链接
* @return 结果
*/
public int insertSysPreSaleSurvey(SysPreSaleSurvey sysPreSaleSurvey);
/**
* 修改售前调查销售给客户发送简易信息调查链接
*
* @param sysPreSaleSurvey 售前调查销售给客户发送简易信息调查链接
* @return 结果
*/
public int updateSysPreSaleSurvey(SysPreSaleSurvey sysPreSaleSurvey);
/**
* 删除售前调查销售给客户发送简易信息调查链接
*
* @param id 售前调查销售给客户发送简易信息调查链接ID
* @return 结果
*/
public int deleteSysPreSaleSurveyById(Long id);
/**
* 批量删除售前调查销售给客户发送简易信息调查链接
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteSysPreSaleSurveyByIds(Long[] ids);
/**
* 根据客户唯一标识查询问卷
* @return
*/
public SysPreSaleSurvey getSysPreSaleSurveyByKey(@Param("customerKey")String customerKey);
}

View File

@ -0,0 +1,67 @@
package com.stdiet.custom.service;
import java.util.List;
import com.stdiet.custom.domain.SysPreSaleSurvey;
/**
* 售前调查销售给客户发送简易信息调查链接Service接口
*
* @author xzj
* @date 2021-07-05
*/
public interface ISysPreSaleSurveyService
{
/**
* 查询售前调查销售给客户发送简易信息调查链接
*
* @param id 售前调查销售给客户发送简易信息调查链接ID
* @return 售前调查销售给客户发送简易信息调查链接
*/
public SysPreSaleSurvey selectSysPreSaleSurveyById(Long id);
/**
* 查询售前调查销售给客户发送简易信息调查链接列表
*
* @param sysPreSaleSurvey 售前调查销售给客户发送简易信息调查链接
* @return 售前调查销售给客户发送简易信息调查链接集合
*/
public List<SysPreSaleSurvey> selectSysPreSaleSurveyList(SysPreSaleSurvey sysPreSaleSurvey);
/**
* 新增售前调查销售给客户发送简易信息调查链接
*
* @param sysPreSaleSurvey 售前调查销售给客户发送简易信息调查链接
* @return 结果
*/
public int insertSysPreSaleSurvey(SysPreSaleSurvey sysPreSaleSurvey);
/**
* 修改售前调查销售给客户发送简易信息调查链接
*
* @param sysPreSaleSurvey 售前调查销售给客户发送简易信息调查链接
* @return 结果
*/
public int updateSysPreSaleSurvey(SysPreSaleSurvey sysPreSaleSurvey);
/**
* 批量删除售前调查销售给客户发送简易信息调查链接
*
* @param ids 需要删除的售前调查销售给客户发送简易信息调查链接ID
* @return 结果
*/
public int deleteSysPreSaleSurveyByIds(Long[] ids);
/**
* 删除售前调查销售给客户发送简易信息调查链接信息
*
* @param id 售前调查销售给客户发送简易信息调查链接ID
* @return 结果
*/
public int deleteSysPreSaleSurveyById(Long id);
/**
* 根据客户唯一标识查询问卷
* @return
*/
public SysPreSaleSurvey getSysPreSaleSurveyByKey(String customerKey);
}

View File

@ -0,0 +1,105 @@
package com.stdiet.custom.service.impl;
import java.util.List;
import com.stdiet.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.stdiet.custom.mapper.SysPreSaleSurveyMapper;
import com.stdiet.custom.domain.SysPreSaleSurvey;
import com.stdiet.custom.service.ISysPreSaleSurveyService;
/**
* 售前调查销售给客户发送简易信息调查链接Service业务层处理
*
* @author xzj
* @date 2021-07-05
*/
@Service
public class SysPreSaleSurveyServiceImpl implements ISysPreSaleSurveyService
{
@Autowired
private SysPreSaleSurveyMapper sysPreSaleSurveyMapper;
/**
* 查询售前调查销售给客户发送简易信息调查链接
*
* @param id 售前调查销售给客户发送简易信息调查链接ID
* @return 售前调查销售给客户发送简易信息调查链接
*/
@Override
public SysPreSaleSurvey selectSysPreSaleSurveyById(Long id)
{
return sysPreSaleSurveyMapper.selectSysPreSaleSurveyById(id);
}
/**
* 查询售前调查销售给客户发送简易信息调查链接列表
*
* @param sysPreSaleSurvey 售前调查销售给客户发送简易信息调查链接
* @return 售前调查销售给客户发送简易信息调查链接
*/
@Override
public List<SysPreSaleSurvey> selectSysPreSaleSurveyList(SysPreSaleSurvey sysPreSaleSurvey)
{
return sysPreSaleSurveyMapper.selectSysPreSaleSurveyList(sysPreSaleSurvey);
}
/**
* 新增售前调查销售给客户发送简易信息调查链接
*
* @param sysPreSaleSurvey 售前调查销售给客户发送简易信息调查链接
* @return 结果
*/
@Override
public int insertSysPreSaleSurvey(SysPreSaleSurvey sysPreSaleSurvey)
{
sysPreSaleSurvey.setCreateTime(DateUtils.getNowDate());
return sysPreSaleSurveyMapper.insertSysPreSaleSurvey(sysPreSaleSurvey);
}
/**
* 修改售前调查销售给客户发送简易信息调查链接
*
* @param sysPreSaleSurvey 售前调查销售给客户发送简易信息调查链接
* @return 结果
*/
@Override
public int updateSysPreSaleSurvey(SysPreSaleSurvey sysPreSaleSurvey)
{
sysPreSaleSurvey.setUpdateTime(DateUtils.getNowDate());
return sysPreSaleSurveyMapper.updateSysPreSaleSurvey(sysPreSaleSurvey);
}
/**
* 批量删除售前调查销售给客户发送简易信息调查链接
*
* @param ids 需要删除的售前调查销售给客户发送简易信息调查链接ID
* @return 结果
*/
@Override
public int deleteSysPreSaleSurveyByIds(Long[] ids)
{
return sysPreSaleSurveyMapper.deleteSysPreSaleSurveyByIds(ids);
}
/**
* 删除售前调查销售给客户发送简易信息调查链接信息
*
* @param id 售前调查销售给客户发送简易信息调查链接ID
* @return 结果
*/
@Override
public int deleteSysPreSaleSurveyById(Long id)
{
return sysPreSaleSurveyMapper.deleteSysPreSaleSurveyById(id);
}
/**
* 根据客户唯一标识查询问卷
* @return
*/
@Override
public SysPreSaleSurvey getSysPreSaleSurveyByKey(String customerKey){
return sysPreSaleSurveyMapper.getSysPreSaleSurveyByKey(customerKey);
}
}

View File

@ -0,0 +1,137 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.stdiet.custom.mapper.SysPreSaleSurveyMapper">
<resultMap type="SysPreSaleSurvey" id="SysPreSaleSurveyResult">
<result property="id" column="id" />
<result property="customerKey" column="customer_key" />
<result property="name" column="name" />
<result property="tall" column="tall" />
<result property="weight" column="weight" />
<result property="age" column="age" />
<result property="sex" column="sex" />
<result property="phone" column="phone" />
<result property="physicalSignsId" column="physical_signs_id" />
<result property="otherPhysicalSigns" column="other_physical_signs" />
<result property="timeTable" column="time_table" />
<result property="experience" column="experience" />
<result property="occupation" column="occupation" />
<result property="bloodData" column="blood_data" />
<result property="moistureData" column="moisture_data" />
<result property="preSaleId" column="pre_sale_id" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="delFlag" column="del_flag" />
</resultMap>
<sql id="selectSysPreSaleSurveyVo">
select id, customer_key, name, tall, weight, age, sex, phone, physical_signs_id, other_physical_signs, time_table, experience, occupation, blood_data, moisture_data, pre_sale_id, create_time, update_time, create_by, update_by, del_flag from sys_pre_sale_survey
</sql>
<select id="selectSysPreSaleSurveyList" parameterType="SysPreSaleSurvey" resultMap="SysPreSaleSurveyResult">
<include refid="selectSysPreSaleSurveyVo"/> where del_flag = 0
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
</select>
<select id="selectSysPreSaleSurveyById" parameterType="Long" resultMap="SysPreSaleSurveyResult">
<include refid="selectSysPreSaleSurveyVo"/>
where id = #{id} and del_flag = 0
</select>
<insert id="insertSysPreSaleSurvey" parameterType="SysPreSaleSurvey" useGeneratedKeys="true" keyProperty="id">
insert into sys_pre_sale_survey
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="customerKey != null and customerKey != ''">customer_key,</if>
<if test="name != null">name,</if>
<if test="tall != null">tall,</if>
<if test="weight != null">weight,</if>
<if test="age != null">age,</if>
<if test="sex != null">sex,</if>
<if test="phone != null">phone,</if>
<if test="physicalSignsId != null">physical_signs_id,</if>
<if test="otherPhysicalSigns != null">other_physical_signs,</if>
<if test="timeTable != null">time_table,</if>
<if test="experience != null">experience,</if>
<if test="occupation != null">occupation,</if>
<if test="bloodData != null">blood_data,</if>
<if test="moistureData != null">moisture_data,</if>
<if test="preSaleId != null">pre_sale_id,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
<if test="delFlag != null">del_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="customerKey != null and customerKey != ''">#{customerKey},</if>
<if test="name != null">#{name},</if>
<if test="tall != null">#{tall},</if>
<if test="weight != null">#{weight},</if>
<if test="age != null">#{age},</if>
<if test="sex != null">#{sex},</if>
<if test="phone != null">#{phone},</if>
<if test="physicalSignsId != null">#{physicalSignsId},</if>
<if test="otherPhysicalSigns != null">#{otherPhysicalSigns},</if>
<if test="timeTable != null">#{timeTable},</if>
<if test="experience != null">#{experience},</if>
<if test="occupation != null">#{occupation},</if>
<if test="bloodData != null">#{bloodData},</if>
<if test="moistureData != null">#{moistureData},</if>
<if test="preSaleId != null">#{preSaleId},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="delFlag != null">#{delFlag},</if>
</trim>
</insert>
<update id="updateSysPreSaleSurvey" parameterType="SysPreSaleSurvey">
update sys_pre_sale_survey
<trim prefix="SET" suffixOverrides=",">
<if test="customerKey != null and customerKey != ''">customer_key = #{customerKey},</if>
<if test="name != null">name = #{name},</if>
<if test="tall != null">tall = #{tall},</if>
<if test="weight != null">weight = #{weight},</if>
<if test="age != null">age = #{age},</if>
<if test="sex != null">sex = #{sex},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="physicalSignsId != null">physical_signs_id = #{physicalSignsId},</if>
<if test="otherPhysicalSigns != null">other_physical_signs = #{otherPhysicalSigns},</if>
<if test="timeTable != null">time_table = #{timeTable},</if>
<if test="experience != null">experience = #{experience},</if>
<if test="occupation != null">occupation = #{occupation},</if>
<if test="bloodData != null">blood_data = #{bloodData},</if>
<if test="moistureData != null">moisture_date = #{moistureData},</if>
<if test="preSaleId != null">pre_sale_id = #{preSaleId},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
</trim>
where id = #{id}
</update>
<update id="deleteSysPreSaleSurveyById" parameterType="Long">
update sys_pre_sale_survey set del_flag = 1 where id = #{id}
</update>
<update id="deleteSysPreSaleSurveyByIds" parameterType="String">
update sys_pre_sale_survey set del_flag = 1 where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<!-- 根据客户唯一标识查询客户问卷是否已存在 -->
<select id="getSysPreSaleSurveyByKey" parameterType="String" resultMap="SysPreSaleSurveyResult">
<include refid="selectSysPreSaleSurveyVo"/>
where del_flag = 0 and customer_key = #{customerKey} limit 1
</select>
</mapper>

View File

@ -52,3 +52,22 @@ export function addFoodHeatStatistics(data) {
})
}
// 根据客户唯一标识查询对应基础信息问卷调查表
export function getCustomerSurvey(customerKey) {
return request({
url: '/investigate/getCustomerSurvey/'+(customerKey != undefined && customerKey != null ? customerKey : ""),
method: 'get'
})
}
// 添加客户基础信息问卷,携带者客户唯一标识
export function addCustomerSurvey(customerSurvey) {
return request({
url: '/investigate/addCustomerSurvey',
method: 'post',
data: customerSurvey
})
}

View File

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询售前调查,销售给客户发送简易信息调查链接列表
export function listPreSaleSurvey(query) {
return request({
url: '/custom/preSaleSurvey/list',
method: 'get',
params: query
})
}
// 查询售前调查,销售给客户发送简易信息调查链接详细
export function getPreSaleSurvey(id) {
return request({
url: '/custom/preSaleSurvey/' + id,
method: 'get'
})
}
// 新增售前调查,销售给客户发送简易信息调查链接
export function addPreSaleSurvey(data) {
return request({
url: '/custom/preSaleSurvey',
method: 'post',
data: data
})
}
// 修改售前调查,销售给客户发送简易信息调查链接
export function updatePreSaleSurvey(data) {
return request({
url: '/custom/preSaleSurvey',
method: 'put',
data: data
})
}
// 删除售前调查,销售给客户发送简易信息调查链接
export function delPreSaleSurvey(id) {
return request({
url: '/custom/preSaleSurvey/' + id,
method: 'delete'
})
}
// 导出售前调查,销售给客户发送简易信息调查链接
export function exportPreSaleSurvey(query) {
return request({
url: '/custom/preSaleSurvey/export',
method: 'get',
params: query
})
}

View File

@ -275,6 +275,14 @@
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="食谱是否连续" prop="recipesPlanContinue">
<el-select v-model="form.recipesPlanContinue" placeholder="请选择食谱连续状态">
<el-option label="是" :value="parseInt('1')"></el-option>
<el-option label="否" :value="parseInt('0')"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item label="服务开始时间" prop="startTime" label-width="180">
<el-date-picker
@ -288,6 +296,7 @@
</el-date-picker>
</el-form-item>
</el-col>
<!-- 添加时默认未审核不能改 -->
<el-col :span="10" v-hasPermi="['custom:order:review']" v-show="false">
<el-form-item label="审核状态" prop="reviewStatus">
@ -724,6 +733,7 @@ export default {
payTypeId: defaultPayType ? parseInt(defaultPayType.dictValue) : null,
preSaleId: defaultPresale ? parseInt(defaultPresale.dictValue) : null,
pushPreSaleId: null,
recipesPlanContinue: 1,
createBy: null,
createTime: null,
onSaleId: null,

View File

@ -64,7 +64,8 @@ router.beforeEach((to, from, next) => {
to.path.startsWith("/f/contract/") ||
to.path.startsWith("/recipes/detail/") ||
to.path.startsWith("/subhealthyInvestigation/") ||
to.path.startsWith("/foodHeatCalculator/")
to.path.startsWith("/foodHeatCalculator/") ||
to.path.startsWith("/preSaleSurvey/")
) {
// 在免登录白名单,直接进入
next();

View File

@ -179,7 +179,14 @@ export const constantRoutes = [
require(["@/views/custom/foodHeatStatistics/investigate"], resolve),
hidden: true,
meta: { title: "外食计算器" }
}
},
{
path: "/preSaleSurvey/:customerKey",
component: resolve =>
require(["@/views/custom/preSaleSurvey/survey"], resolve),
hidden: true,
meta: { title: "胜唐体控基础问卷表" }
},
];
export default new Router({

View File

@ -0,0 +1,330 @@
<template>
<section>
<div style="padding: 5px; text-align: center;margin-top:5px">
<img :src="logo" style="width: auto; height: 40px" alt="logo" />
</div>
<el-form
ref="form"
label-position="top"
:model="form"
:rules="rules"
label-width="100px"
style="padding: 16px"
>
<p class="p_title_1 text-span-title" style="margin-top: 0px;" align="center">胜唐体控基础问卷表</p>
<!--<p style="font-size: 15px; margin-bottom: 12px;margin-top: 10px;">请您确保下方姓名手机号正确</p>-->
<el-form-item label="1、真实姓名" prop="name" style="margin-top: 2px;">
<el-input v-model="form.name" placeholder="请输入真实姓名" maxlength="20" :disabled="submitFlag"/>
</el-form-item>
<el-form-item label="2、手机号" prop="phone" >
<el-input v-model="form.phone" type="number" placeholder="请输入手机号" :disabled="submitFlag"/>
</el-form-item>
<el-form-item label="3、性别" prop="sex">
<el-radio-group v-model="form.sex" size="small" :disabled="submitFlag">
<el-radio :label="parseInt('0')" border></el-radio>
<el-radio :label="parseInt('1')" border></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="4、年龄" prop="age" >
<el-input type="number" v-model="form.age" placeholder="请输入年龄(整数)" :disabled="submitFlag" autocomplete="off" ></el-input>
</el-form-item>
<el-form-item label="5、身高厘米" prop="tall" >
<el-input type="number" v-model="form.tall" placeholder="请输入身高(整数)" :disabled="submitFlag" autocomplete="off" ></el-input>
</el-form-item>
<el-form-item label="6、体重" prop="weight" >
<el-input v-model="form.weight" placeholder="请输入体重(可保留一位小数)" :disabled="submitFlag" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="7、职业" prop="occupation">
<el-input placeholder="请输入职业名称" :disabled="submitFlag" v-model="form.occupation" maxlength="50"
></el-input>
</el-form-item>
<el-form-item label="8、病史体征(可多选)" prop="physicalSignsIdArray" >
<el-select v-model="form.physicalSignsIdArray" multiple placeholder="请选择" :disabled="submitFlag">
<el-option
v-for="physicalSign in physicalSignsList"
:key="physicalSign.id"
:label="physicalSign.name"
:value="physicalSign.id+''"
>
</el-option>
</el-select>
<div><span class="text-span">其他病史体征</span>
<el-input type="textarea"
:disabled="submitFlag"
placeholder="请输入病史体征"
v-model="form.otherPhysicalSigns"
maxlength="200"
show-word-limit
rows="2"
></el-input>
</div>
</el-form-item>
<el-form-item label="9、作息时间" >
<div class="margin-left">
<span class="text-span">睡觉时间</span>
<el-input placeholder="请输入睡觉时间" maxlength="20" :disabled="submitFlag" v-model="form.timeTableArray[0]" style="width:60%;margin-left:10px"/>
</div>
<div class="margin-left" style="margin-top:8px;">
<span class="text-span">起床时间</span>
<el-input placeholder="请输入起床时间" maxlength="20" :disabled="submitFlag" v-model="form.timeTableArray[1]" style="width:60%;margin-left:10px"/>
</div>
</el-form-item>
<el-form-item label="10、减脂经历" prop="experience" >
<el-input
:disabled="submitFlag"
type="textarea"
placeholder="请描述下减脂经历"
v-model="form.experience"
maxlength="200"
show-word-limit
rows="3"
></el-input>
</el-form-item>
<el-form-item label="11、湿气测试可多选" prop="moistureDataArray" >
<el-checkbox-group v-model="form.moistureDataArray" :disabled="submitFlag">
<el-checkbox v-for="moistureItem in moistureDataList" :label="moistureItem.dictValue" :key="moistureItem.dictValue">{{ moistureItem.dictLabel }}</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="12、气血测试可多选" prop="bloodDataArray" >
<el-checkbox-group v-model="form.bloodDataArray" :disabled="submitFlag">
<el-checkbox v-for="bloodItem in bloodDataList" :label="bloodItem.dictValue" :key="bloodItem.dictValue">{{ bloodItem.dictLabel }}</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item style="text-align: center; margin: 0 auto" v-show="!submitFlag">
<el-button
type="primary"
@click="addCustomerSurvey()"
style="width:80%"
:disabled="submitFlag"
>填写完成提交问卷</el-button
>
</el-form-item>
</el-form>
</section>
</template>
<script>
import {
getDictData,
physicalSignsList,
getCustomerSurvey,
addCustomerSurvey
} from "@/api/custom/customerInvestigation";
import * as healthyData from "@/utils/healthyData";
const logo = require("@/assets/logo/st_logo.png");
export default {
name: "index",
data() {
return {
logo,
submitFlag: true,
moistureDataList:[],
bloodDataList:[],
physicalSignsList:[],
form:{
customerKey: null,
name: "",
phone: "",
sex: 1,
age: null,
tall: null,
weight: null,
physicalSignsIdArray:[],
physicalSignsId: "",
otherPhysicalSigns: "",
timeTableArray:["",""],
timeTable: "",
experience: "",
occupation: "",
bloodDataArray: [],
bloodData: "",
moistureDataArray: [],
moistureData: "",
},
rules: {
name: [{ required: true, trigger: "blur", message: "请填写姓名" }],
phone: [
//{ required: false, trigger: "blur", message: "" },
{
required: false,
trigger: "blur",
pattern: /^\d{5,11}$/ ,
message: "手机号格式不正确",
}
],
sex: [{ required: true, trigger: "blur", message: "请选择性别" }],
age: [
{ required: true, trigger: "blur", message: "请填写年龄" },
{
required: true,
trigger: "blur",
pattern: /^[1-9]\d*$/,
message: "年龄格式不正确",
},
],
tall: [
{ required: true, trigger: "blur", message: "请填写身高" },
{
required: true,
trigger: "blur",
pattern: /^[1-9]\d*$/,
message: "身高格式不正确",
},
],
weight: [
{ required: true, trigger: "blur", message: "请填写体重" },
{
required: true,
trigger: "blur",
pattern: /^(\d+)(\.\d{1})?$/,
message: "体重格式不正确",
},
]
},
};
},
components: {
},
methods: {
//ID
getCustomerSurvey(customerKey) {
/*const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
setTimeout(() => {
loading.close();
}, 2000);*/
getCustomerSurvey(customerKey).then((response) => {
if(response.code == 200 && (response.data == undefined || response.data == null)){
this.submitFlag = false;
}else{
this.form = response.data;
this.form.physicalSignsIdArray = this.form.physicalSignsId.split(",");
this.form.timeTableArray = this.form.timeTable.split(",");
this.form.bloodDataArray = this.form.bloodData.split(",");
this.form.moistureDataArray = this.form.moistureData.split(",");
this.submitFlag = true;
}
});
},
addCustomerSurvey(){
this.submitFlag = true;
this.form.physicalSignsId = this.form.physicalSignsIdArray.join(",");
this.form.timeTable = this.form.timeTableArray.join(",");
this.form.bloodData = this.form.bloodDataArray.join(",");
this.form.moistureData = this.form.moistureDataArray.join(",");
this.$refs.form.validate((valid) => {
if (valid){
addCustomerSurvey(this.form).then((response) => {
if(response.code == 200){
this.$notify({
title: "提交成功",
message: "",
type: "success",
});
this.goTop();
this.submitFlag = true;
}else{
this.submitFlag = false;
}
});
}else{
this.$message({
message: "数据未填写完整",
type: "warning",
});
this.submitFlag = false;
}
})
},
goTop() {
window.scroll(0, 0);
},
//湿
getMoistureDictData() {
getDictData("sys_blood_data").then((response) => {
this.moistureDataList = response.data;
});
},
//
getBloodDictData() {
getDictData("sys_moisture_data").then((response) => {
this.bloodDataList = response.data;
});
},
/** 查询体征列表 */
getPhysicalSignsList() {
physicalSignsList().then((response) => {
this.physicalSignsList = response.rows;
});
},
},
created() {
this.form.customerKey = this.$route.params.customerKey;
this.getCustomerSurvey(this.form.customerKey);
this.getPhysicalSignsList();
this.getMoistureDictData();
this.getBloodDictData();
},
beforeCreate() {
document.title = this.$route.meta.title;
}
};
</script>
<style scoped>
.el-form-item {
margin-bottom: 8px;
}
.p_title_1 {
font-size: 18px;
font-weight: bold;
margin-top: 30px;
}
.p_title_2 {
font-size: 16px;
font-weight: bold;
margin-top: 30px;
}
.p_title_3 {
font-size: 14px;
font-weight: bold;
margin-top: 30px;
}
.margin-left {
margin-left: 14px;
}
.el-input__inner {
width: 30%;
}
.margin-top-10 {
margin-top: 10px;
}
.width-50-left-8-right-5 {
width: 50%;
margin-left: 8px;
margin-right: 5px;
}
.width-70-left-8-right-5 {
width: 70%;
margin-left: 8px;
margin-right: 5px;
}
.text-span{
color:#606266;
font-weight: 700;
font-size: 14px
}
.text-span-title{
color:#606266;
font-weight: 800;
font-size: 16px
}
</style>