修复健康评估弹窗

This commit is contained in:
huangdeliang
2021-01-29 13:56:53 +08:00
parent 459d55913e
commit 3c7e7a0f00
8 changed files with 199 additions and 26 deletions

View File

@ -114,4 +114,9 @@ public class SysCustomerController extends BaseController {
} }
return AjaxResult.success(sysCustomer); return AjaxResult.success(sysCustomer);
} }
@GetMapping("/physicalSigns/{id}")
public AjaxResult getPhysicalSignsById(@PathVariable("id") Long id) {
return AjaxResult.success(sysCustomerPhysicalSignsService.selectSysCustomerPhysicalSignsByCusId(id));
}
} }

View File

@ -22,6 +22,8 @@ public interface SysCustomerPhysicalSignsMapper
*/ */
public SysCustomerPhysicalSigns selectSysCustomerPhysicalSignsById(Long id); public SysCustomerPhysicalSigns selectSysCustomerPhysicalSignsById(Long id);
public SysCustomerPhysicalSigns selectSysCustomerPhysicalSignsByCusId(Long id);
/** /**
* 新增客户体征信息 * 新增客户体征信息
* *

View File

@ -22,6 +22,8 @@ public interface ISysCustomerPhysicalSignsService {
*/ */
public SysCustomerPhysicalSigns selectSysCustomerPhysicalSignsById(Long id); public SysCustomerPhysicalSigns selectSysCustomerPhysicalSignsById(Long id);
public SysCustomerPhysicalSigns selectSysCustomerPhysicalSignsByCusId(Long id);
/** /**
* 新增客户体征信息 * 新增客户体征信息
* *

View File

@ -41,6 +41,11 @@ public class SysCustomerPhysicalSignsServiceImpl implements ISysCustomerPhysical
return sysCustomerPhysicalSignsMapper.selectSysCustomerPhysicalSignsById(id); return sysCustomerPhysicalSignsMapper.selectSysCustomerPhysicalSignsById(id);
} }
@Override
public SysCustomerPhysicalSigns selectSysCustomerPhysicalSignsByCusId(Long cusId) {
return sysCustomerPhysicalSignsMapper.selectSysCustomerPhysicalSignsByCusId(cusId);
}
/** /**
* 新增客户体征信息 * 新增客户体征信息
* *

View File

@ -67,6 +67,10 @@
<include refid="selectSysCustomerPhysicalSigns"/> where scps.del_flag = 0 and sc.del_flag = 0 and scps.id = #{id} <include refid="selectSysCustomerPhysicalSigns"/> where scps.del_flag = 0 and sc.del_flag = 0 and scps.id = #{id}
</select> </select>
<select id="selectSysCustomerPhysicalSignsByCusId" parameterType="Long" resultMap="SysCustomerSignResult">
<include refid="selectSysCustomerPhysicalSigns"/> where scps.del_flag = 0 and sc.del_flag = 0 and scps.customer_id = #{id}
</select>
<insert id="insertSysCustomerPhysicalSigns" parameterType="SysCustomerPhysicalSigns" useGeneratedKeys="true" keyProperty="id"> <insert id="insertSysCustomerPhysicalSigns" parameterType="SysCustomerPhysicalSigns" useGeneratedKeys="true" keyProperty="id">
insert into sys_customer_physical_signs insert into sys_customer_physical_signs
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">

View File

@ -1,63 +1,70 @@
import request from '@/utils/request' import request from "@/utils/request";
// 查询客户信息列表 // 查询客户信息列表
export function listCustomer(query) { export function listCustomer(query) {
return request({ return request({
url: '/custom/customer/list', url: "/custom/customer/list",
method: 'get', method: "get",
params: query params: query
}) });
} }
// 查询客户信息详细 // 查询客户信息详细
export function getCustomer(id) { export function getCustomer(id) {
return request({ return request({
url: '/custom/customer/' + id, url: "/custom/customer/" + id,
method: 'get' method: "get"
}) });
} }
// 新增客户信息 // 新增客户信息
export function addCustomer(data) { export function addCustomer(data) {
return request({ return request({
url: '/custom/customer', url: "/custom/customer",
method: 'post', method: "post",
data: data data: data
}) });
} }
// 修改客户信息 // 修改客户信息
export function updateCustomer(data) { export function updateCustomer(data) {
return request({ return request({
url: '/custom/customer', url: "/custom/customer",
method: 'put', method: "put",
data: data data: data
}) });
} }
// 删除客户信息 // 删除客户信息
export function delCustomer(id) { export function delCustomer(id) {
return request({ return request({
url: '/custom/customer/' + id, url: "/custom/customer/" + id,
method: 'delete' method: "delete"
}) });
} }
// 导出客户信息 // 导出客户信息
export function exportCustomer(query) { export function exportCustomer(query) {
return request({ return request({
url: '/custom/customer/export', url: "/custom/customer/export",
method: 'get', method: "get",
params: query params: query
}) });
} }
// 查询客户信息详细 // 查询客户信息详细
export function getCustomerAndSignByPhone(query) { export function getCustomerAndSignByPhone(query) {
return request({ return request({
url: '/custom/customer/getCustomerAndSignByPhone', url: "/custom/customer/getCustomerAndSignByPhone",
method: 'get', method: "get",
params: query params: query
}) });
} }
/**获取用户体征信息 */
export function getCustomerPhysicalSignsByCusId(id) {
return request({
url: `/custom/customer/physicalSigns/${id}`,
method: "get"
});
}

View File

@ -0,0 +1,142 @@
<template>
<el-dialog
:visible.sync="visible"
:title="title"
append-to-body
@closed="onClosed"
>
<el-table
:show-header="false"
:data="dataList"
border
:cell-style="columnStyle"
style="width: 100%"
>
<el-table-column width="120" prop="attr_name_one"> </el-table-column>
<el-table-column prop="value_one">
<template slot-scope="scope">
<auto-hide-message
:data="scope.row.value_one == null ? '' : scope.row.value_one + ''"
:maxLength="20"
/>
</template>
</el-table-column>
<el-table-column width="120" prop="attr_name_two"></el-table-column>
<el-table-column prop="value_two">
<template slot-scope="scope">
<auto-hide-message
:data="scope.row.value_two == null ? '' : scope.row.value_two + ''"
:maxLength="20"
/>
</template>
</el-table-column>
<el-table-column width="120" prop="attr_name_three"></el-table-column>
<el-table-column prop="value_three">
<template slot-scope="scope">
<auto-hide-message
:data="
scope.row.value_three == null ? '' : scope.row.value_three + ''
"
:maxLength="20"
/>
</template>
</el-table-column>
</el-table>
</el-dialog>
</template>
<script>
import { getCustomerPhysicalSignsByCusId } from "@/api/custom/customer";
import AutoHideMessage from "@/components/AutoHideMessage";
export default {
name: "PhysicalSignsDialog",
components: {
"auto-hide-message": AutoHideMessage,
},
data() {
return {
visible: false,
title: "",
dataList: [],
// 标题
titleData: [
["创建时间", "姓名", "年龄"],
["性别", "手机号", "身高(cm)"],
["体重(斤)", "地域", "病史"],
["忌口或过敏源", "便秘", "熬夜失眠"],
["经常运动", "饮食方式", "饮食备注"],
["饮食特点", "工作职业", "上夜班"],
["久坐/运动多", "浑身乏力", "减脂反弹"],
["意识到生活习惯是减脂关键", "睡觉时间", "起床时间"],
["方便沟通时间", "湿气数据", "气血数据"],
["减脂经历", "减脂遇到的困难", "备注"],
],
// 属性
valueData: [
["createTime", "name", "age"],
["sex", "phone", "tall"],
["weight", "position", "singList"],
["dishesIngredientId", "constipation", "staylate"],
["motion", "makeFoodType", "remarks"],
["makeFoodTaste", "vocation", "night"],
["walk", "weakness", "rebound"],
["crux", "sleepTime", "getupTime"],
["connectTime", "bloodData", "moistureDate"],
["experience", "difficulty", "comments"],
],
};
},
methods: {
// 自定义列背景色
columnStyle({ row, column, rowIndex, columnIndex }) {
if (columnIndex % 2 === 0) {
//第三第四列的背景色就改变了2和3都是列数的下标
return "background:#f3f6fc;font-weight:bold";
} else {
return "background:#ffffff;";
}
},
showDialog(data) {
this.title = `${data.name}」客户体征`;
getCustomerPhysicalSignsByCusId(data.id).then((res) => {
if (!res.data) {
this.visible = true;
return;
}
const sign = res.data;
sign.sex = sign.sex === 0 ? `` : "女";
sign.position = sign.position === 0 ? `南方` : "北方";
sign.signString = sign.signList.join("");
sign.constipation = sign.constipation === 0 ? "是" : "否";
sign.staylate = sign.staylate === 0 ? "是" : "否";
sign.motion = sign.motion === 0 ? "是" : "否";
sign.makeFoodType = sign.makeFoodType === 0 ? `自己做` : "外面吃";
sign.makeFoodTaste = sign.makeFoodTaste === 0 ? "清淡" : "重口味";
sign.night = sign.night === 0 ? `` : "否";
sign.walk = sign.walk === 0 ? `久坐多` : "走动多";
sign.weakness = sign.weakness === 0 ? `` : "否";
sign.rebound = sign.rebound === 0 ? `` : "否";
sign.crux = sign.crux === 0 ? `` : "否";
sign.sleepTime = sign.sleepTime + "点";
sign.getupTime = sign.getupTime + "点";
sign.connectTime = sign.connectTime + "点";
for (let i = 0; i < this.titleData.length; i++) {
this.dataList.push({
attr_name_one: this.titleData[i][0],
value_one: sign[this.valueData[i][0]],
attr_name_two: this.titleData[i][1],
value_two: sign[this.valueData[i][1]],
attr_name_three: this.titleData[i][2],
value_three: sign[this.valueData[i][2]],
});
}
this.visible = true;
});
},
onClosed() {
this.dataList = [];
},
},
};
</script>

View File

@ -82,6 +82,7 @@
icon="el-icon-plus" icon="el-icon-plus"
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['custom:customer:add']"
>新增 >新增
</el-button> </el-button>
</el-col> </el-col>
@ -91,6 +92,7 @@
icon="el-icon-download" icon="el-icon-download"
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['custom:customer:export']"
>导出 >导出
</el-button> </el-button>
</el-col> </el-col>
@ -198,7 +200,7 @@
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['custom:customerCenter:edit']" v-hasPermi="['custom:customer:edit']"
>修改 >修改
</el-button> </el-button>
<el-button <el-button
@ -206,7 +208,7 @@
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['custom:customerCenter:remove']" v-hasPermi="['custom:customer:remove']"
>删除 >删除
</el-button> </el-button>
</template> </template>
@ -308,6 +310,7 @@
<order-drawer ref="cusOrderDrawerRef" /> <order-drawer ref="cusOrderDrawerRef" />
<!-- 合同抽屉 --> <!-- 合同抽屉 -->
<!-- 健康评估弹窗 --> <!-- 健康评估弹窗 -->
<physical-signs-dialog ref="physicalSignsDialogRef" />
<!-- 食谱计划抽屉 --> <!-- 食谱计划抽屉 -->
</div> </div>
</template> </template>
@ -321,16 +324,19 @@ import {
listCustomer, listCustomer,
updateCustomer, updateCustomer,
} from "@/api/custom/customer"; } from "@/api/custom/customer";
import store from "@/store"; import store from "@/store";
import { getOptions } from "@/api/custom/order"; import { getOptions } from "@/api/custom/order";
import OrderDrawer from "@/components/OrderDrawer"; import OrderDrawer from "@/components/OrderDrawer";
import PhysicalSignsDialog from "@/components/PhysicalSignsDialog";
export default { export default {
name: "Customer", name: "Customer",
components: { components: {
"order-drawer": OrderDrawer, "order-drawer": OrderDrawer,
"physical-signs-dialog": PhysicalSignsDialog,
}, },
data() { data() {
const userId = store.getters && store.getters.userId; const userId = store.getters && store.getters.userId;
@ -378,7 +384,7 @@ export default {
// 表单校验 // 表单校验
rules: { rules: {
customer: [ customer: [
// { required: true, message: "客户姓名不能为空", trigger: "blur" }, { required: true, message: "客户姓名不能为空", trigger: "blur" },
], ],
phone: [ phone: [
{ required: true, message: "手机号不能为空", trigger: "blur" }, { required: true, message: "手机号不能为空", trigger: "blur" },
@ -476,7 +482,7 @@ export default {
console.log(row); console.log(row);
}, },
handleOnHealthSignClick(row) { handleOnHealthSignClick(row) {
console.log(row); this.$refs["physicalSignsDialogRef"].showDialog(row);
}, },
handleOnMenuClick(row) { handleOnMenuClick(row) {
console.log(row); console.log(row);