修改气血数据

This commit is contained in:
huangdeliang 2021-03-30 13:45:33 +08:00
parent 8f94c50d22
commit 20466936ce
2 changed files with 130 additions and 75 deletions

View File

@ -180,16 +180,20 @@ export default {
cur.type = "main"; cur.type = "main";
arr.push(cur); arr.push(cur);
} }
if (idx === res.rows.length - 1 && arr.children) { if (idx === res.rows.length - 1) {
arr.forEach((obj) => { arr.forEach((obj) => {
obj.amount = arr.children.reduce((a, c) => { console.log({ obj });
return a + c.afterSaleCommissOrder === 0 ? c.amount : 0; if (obj.children) {
}, 0); obj.amount = obj.children.reduce(
(a, c) => a + (c.afterSaleCommissOrder === 0 ? c.amount : 0),
0
);
}
}); });
} }
return arr; return arr;
}, []); }, []);
// console.log(this.orderList); console.log(this.orderList);
this.loading = false; this.loading = false;
}); });
}, },

View File

@ -1,35 +1,77 @@
<template> <template>
<el-dialog v-if="visible" :visible.sync="visible" :title="title" width="500px" append-to-body @closed="onClosed"> <el-dialog
v-if="visible"
:visible.sync="visible"
:title="title"
width="500px"
append-to-body
@closed="onClosed"
>
<div style="margin-top: -10px"> <div style="margin-top: -10px">
<el-form ref="form" label-position="top" label-width="100px"> <el-form ref="form" label-position="top" label-width="100px">
<el-form-item :label="'请勾选需要修改的模块'" prop="showModuleArray"> <el-form-item :label="'请勾选需要修改的模块'" prop="showModuleArray">
<el-checkbox-group v-model="showModuleArray" @change="changeShowModule()"> <el-checkbox-group
<el-checkbox v-for="(item, index) in healthyData['titleArray']" :label="index" :key="index">{{item}}</el-checkbox> v-model="showModuleArray"
@change="changeShowModule()"
>
<el-checkbox
v-for="(item, index) in healthyData['titleArray']"
:label="index"
:key="index"
>{{ item }}</el-checkbox
>
</el-checkbox-group> </el-checkbox-group>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<div style="height:400px;overflow: auto"> <div style="height: 400px; overflow: auto">
<el-form ref="form" label-position="top" :model="form" :rules="rules" label-width="100px" style="padding: 16px"> <el-form
<healthy-form1 v-show="stepArray[0]" :flag="1" :form.sync="form"></healthy-form1> ref="form"
label-position="top"
:model="form"
:rules="rules"
label-width="100px"
style="padding: 16px"
>
<healthy-form1
v-show="stepArray[0]"
:flag="1"
:form.sync="form"
></healthy-form1>
<healthy-form2 v-show="stepArray[1]" :form.sync="form"></healthy-form2> <healthy-form2 v-show="stepArray[1]" :form.sync="form"></healthy-form2>
<healthy-form3 v-show="stepArray[2]" :form.sync="form"></healthy-form3> <healthy-form3 v-show="stepArray[2]" :form.sync="form"></healthy-form3>
<healthy-form4 v-show="stepArray[3]" :form.sync="form"></healthy-form4> <healthy-form4 v-show="stepArray[3]" :form.sync="form"></healthy-form4>
<healthy-form5 v-show="stepArray[4]" :form.sync="form"></healthy-form5> <healthy-form5 v-show="stepArray[4]" :form.sync="form"></healthy-form5>
<healthy-form6 v-show="stepArray[5]" :form.sync="form"></healthy-form6> <healthy-form6 v-show="stepArray[5]" :form.sync="form"></healthy-form6>
<healthy-form7 v-show="stepArray[6]" :form.sync="form"></healthy-form7> <healthy-form7 v-show="stepArray[6]" :form.sync="form"></healthy-form7>
<healthy-form8 v-show="stepArray[7]" :flag="1" :form.sync="form"></healthy-form8> <healthy-form8
<edit-file v-show="stepArray[8]" ref="editFile" :form.sync="form"></edit-file> v-show="stepArray[7]"
<el-form-item style="text-align: center; margin: 30px auto" v-show="submitShow"> :flag="1"
<el-button type="primary" @click="submit()" style="width: 40%" >提交</el-button> :form.sync="form"
<el-button @click="onClosed()" style="width: 40%" >取消</el-button> ></healthy-form8>
<edit-file
v-show="stepArray[8]"
ref="editFile"
:form.sync="form"
></edit-file>
<el-form-item
style="text-align: center; margin: 30px auto"
v-show="submitShow"
>
<el-button type="primary" @click="submit()" style="width: 40%"
>提交</el-button
>
<el-button @click="onClosed()" style="width: 40%">取消</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { getCustomerPhysicalSignsByCusId,delCustomerHealthy } from "@/api/custom/customer"; import {
getCustomerPhysicalSignsByCusId,
delCustomerHealthy,
} from "@/api/custom/customer";
import { updateHealthy } from "@/api/custom/healthy"; import { updateHealthy } from "@/api/custom/healthy";
import * as healthyData from "@/utils/healthyData"; import * as healthyData from "@/utils/healthyData";
import Form1 from "@/components/HealthyForm/Form1"; import Form1 from "@/components/HealthyForm/Form1";
@ -45,22 +87,22 @@ import EditHealthyFile from "@/components/HealthyForm/EditHealthyFile";
export default { export default {
name: "PhysicalSignsEdit", name: "PhysicalSignsEdit",
components: { components: {
'healthy-form1': Form1, "healthy-form1": Form1,
'healthy-form2': Form2, "healthy-form2": Form2,
'healthy-form3': Form3, "healthy-form3": Form3,
'healthy-form4': Form4, "healthy-form4": Form4,
'healthy-form5': Form5, "healthy-form5": Form5,
'healthy-form6': Form6, "healthy-form6": Form6,
'healthy-form7': Form7, "healthy-form7": Form7,
'healthy-form8': Form8, "healthy-form8": Form8,
'healthy-form9': Form9, "healthy-form9": Form9,
'edit-file':EditHealthyFile "edit-file": EditHealthyFile,
}, },
data() { data() {
return { return {
healthyData:healthyData, healthyData: healthyData,
showModuleArray:[0], showModuleArray: [0],
stepArray: [true,false,false,false,false,false,false,false,false], stepArray: [true, false, false, false, false, false, false, false, false],
submitShow: true, submitShow: true,
visible: false, visible: false,
title: "", title: "",
@ -95,28 +137,34 @@ export default {
message: "体重格式不正确", message: "体重格式不正确",
}, },
], ],
conditioningProjectId:[ conditioningProjectId: [
{ required: true, trigger: "blur", message: "请选择调理项目" } { required: true, trigger: "blur", message: "请选择调理项目" },
], ],
position:[ position: [
{ required: true, trigger: "blur", message: "请选择地理位置" } { required: true, trigger: "blur", message: "请选择地理位置" },
] ],
} },
}; };
}, },
methods: { methods: {
showDialog(data, customerHealthyData) { showDialog(data, customerHealthyData) {
this.data = data; this.data = data;
this.title = "修改"+`${data.name}`+"健康评估信息"; this.title = "修改" + `${data.name}` + "健康评估信息";
let healthy = Object.assign({}, customerHealthyData); let healthy = Object.assign({}, customerHealthyData);
if(data && customerHealthyData){ if (data && customerHealthyData) {
this.healthyData['arrayName'].forEach(function (item, index) { this.healthyData["arrayName"].forEach((item) => {
healthy[item] = healthy[item] ? healthy[item].split(",") : []; if (item === "bloodData" || item === "moistureDate") {
healthy[item] = healthy[item].map((str) =>
str.substring(0, str.indexOf("."))
);
} else {
healthy[item] = (healthy[item] || "").split(",");
}
}); });
this.form = healthy; this.form = healthy;
this.visible = true; this.visible = true;
}else{ } else {
this.$message.error('健康评估信息获取失败'); this.$message.error("健康评估信息获取失败");
} }
/*getCustomerPhysicalSignsByCusId(data.id).then((res) => { /*getCustomerPhysicalSignsByCusId(data.id).then((res) => {
if (res.data.customerHealthy && res.data.type == 0) { if (res.data.customerHealthy && res.data.type == 0) {
@ -136,53 +184,56 @@ export default {
this.data = null; this.data = null;
//this.form = null; //this.form = null;
}, },
submit(){ submit() {
this.$refs.form.validate((valid) => { this.$refs.form.validate((valid) => {
if (valid) { if (valid) {
this.editCustomerHealthy(); this.editCustomerHealthy();
} else { } else {
this.$message({message: "数据未填写完整", type: "warning"}); this.$message({ message: "数据未填写完整", type: "warning" });
} }
}); });
}, },
editCustomerHealthy(){ editCustomerHealthy() {
this.$refs.editFile.addUploadNewFile(); this.$refs.editFile.addUploadNewFile();
// //
let cusMessage = Object.assign({}, this.form); let cusMessage = Object.assign({}, this.form);
this.healthyData['arrayName'].forEach(function (item, index) { this.healthyData["arrayName"].forEach(function (item, index) {
cusMessage[item] = cusMessage[item] != null ? cusMessage[item].join(",") : null; cusMessage[item] =
}); cusMessage[item] != null ? cusMessage[item].join(",") : null;
updateHealthy(cusMessage).then((response) => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.onClosed();
this.$emit('refreshHealthyData');
}
}).catch(function() {
console.log("error");
}); });
updateHealthy(cusMessage)
.then((response) => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.onClosed();
this.$emit("refreshHealthyData");
}
})
.catch(function () {
console.log("error");
});
}, },
changeShowModule(){ changeShowModule() {
let allShow = false; let allShow = false;
for(var i = 0; i < this.stepArray.length; i++){ for (var i = 0; i < this.stepArray.length; i++) {
let flag = this.showModuleArray.find((opt) => opt === i); let flag = this.showModuleArray.find((opt) => opt === i);
let showFlag = flag != null && flag != undefined let showFlag = flag != null && flag != undefined;
this.$set(this.stepArray, i, showFlag); this.$set(this.stepArray, i, showFlag);
allShow = showFlag ? showFlag : allShow; allShow = showFlag ? showFlag : allShow;
} }
this.submitShow = allShow; this.submitShow = allShow;
} },
} },
}; };
</script> </script>
<style scoped> <style scoped>
.margin-top-20{ .margin-top-20 {
margin-top:20px; margin-top: 20px;
} }
.p_title_1{ .p_title_1 {
font-size: 18px; font-size: 18px;
font-weight: bold; font-weight: bold;
margin-top: 20px; margin-top: 20px;
} }
</style> </style>