Bläddra i källkod

代码格式化

zhengkaixin 4 år sedan
förälder
incheckning
916cfac058

+ 160 - 173
src/projects/pension/views/Master/Hospital/Archives.vue

@@ -1,184 +1,171 @@
 <template>
 <div>
-	 <common @asynCallBack="asynCallBack"></common>
-                	<top-header :pageTitle="pageTitle"  ></top-header>
-
-		<div class="mui-content margin60">
-			<div class="mui-content-padded vongi-qingjiadt vongi-editme">
-				<form class="mui-input-group">
-					<div class="mui-input-row">
-						<label>头像</label>
-						<button class="mui-btn mui-btn-block  " type='button' style="width:65%;padding-right:15px">
-							<img :src="detail.faceImageUrl" />
-						</button>
-					</div>
-					<div class="mui-input-row">
-						<label>姓名</label>
-						<span>{{detail.name}}</span>
-					</div>
-					<div class="mui-input-row">
-						<label>性别</label>
-						<button class="mui-btn mui-btn-block mui-navigate-right mui-ellipsis"
-						 type='button' style="width:65%" @click="selectGender">
-							{{detail.gender}}
-						</button>
-					</div>
-					<div class="mui-input-row">
-						<label>出生年月</label>
-						<button class="mui-btn mui-btn-block mui-navigate-right mui-ellipsis"
-
-						 @click="selectDate" type='button' style="width:65%" >
-							{{detail.birthDate?detail.birthDate:'请选择'}}
-						</button>
-					</div>
-				</form>
-			</div>
-			<div class="vongi-meform-pho mui-content-padded">
-				<h4>过敏药品</h4>
-				<div class="mui-input-row">
-					<textarea id="textarea" rows="5"  v-model="detail.allergicDrugs" placeholder="请输入过敏药品"></textarea>
-				</div>
-			</div>
-			<div class="vongi-meform-pho mui-content-padded">
-				<h4>已有病史</h4>
-				<div class="mui-input-row">
-					<textarea id="textarea" rows="5" v-model="detail.medicalHistory"
-					 placeholder="请输入已有病史"></textarea>
-				</div>
-			</div>
-
-		</div>
-		<div class="fyy-footer">
-			<div class="bindfyy-btn"><button type="submit"  @click="submit()"
-			class="mui-btn mui-btn-pink ">保  存</button></div>
-		</div>
-				 <loading :visible="isLoading"></loading>
-
+    <common @asynCallBack="asynCallBack"></common>
+    <top-header :pageTitle="pageTitle"></top-header>
+
+    <div class="mui-content margin60">
+        <div class="mui-content-padded vongi-qingjiadt vongi-editme">
+            <form class="mui-input-group">
+                <div class="mui-input-row">
+                    <label>头像</label>
+                    <button class="mui-btn mui-btn-block" type="button" style="width: 65%; padding-right: 15px">
+                        <img :src="detail.faceImageUrl" />
+                    </button>
+                </div>
+                <div class="mui-input-row">
+                    <label>姓名</label>
+                    <span>{{ detail.name }}</span>
+                </div>
+                <div class="mui-input-row">
+                    <label>性别</label>
+                    <button class="mui-btn mui-btn-block mui-navigate-right mui-ellipsis" type="button" style="width: 65%" @click="selectGender">
+                        {{ detail.gender }}
+                    </button>
+                </div>
+                <div class="mui-input-row">
+                    <label>出生年月</label>
+                    <button class="mui-btn mui-btn-block mui-navigate-right mui-ellipsis" @click="selectDate" type="button" style="width: 65%">
+                        {{ detail.birthDate ? detail.birthDate : "请选择" }}
+                    </button>
+                </div>
+            </form>
+        </div>
+        <div class="vongi-meform-pho mui-content-padded">
+            <h4>过敏药品</h4>
+            <div class="mui-input-row">
+                <textarea id="textarea" rows="5" v-model="detail.allergicDrugs" placeholder="请输入过敏药品"></textarea>
+            </div>
+        </div>
+        <div class="vongi-meform-pho mui-content-padded">
+            <h4>已有病史</h4>
+            <div class="mui-input-row">
+                <textarea id="textarea" rows="5" v-model="detail.medicalHistory" placeholder="请输入已有病史"></textarea>
+            </div>
+        </div>
+    </div>
+    <div class="fyy-footer">
+        <div class="bindfyy-btn">
+            <button type="submit" @click="submit()" class="mui-btn mui-btn-pink">
+                保 存
+            </button>
+        </div>
+    </div>
+    <loading :visible="isLoading"></loading>
 </div>
 </template>
 
-
 <script>
-	require('$project/assets/js/mui.picker.min.js');
-
-	import * as API from '@/apis/Master/hospital'
-	import Common from '$project/components/Common.vue'
-	import Loading from '$project/components/Loading.vue'
-	import TopHeader from '$project/components/TopHeader.vue'
-
-	import {
-		mapGetters,
-		mapMutations
-	} from 'vuex'
-
-	import {
-
-
-	} from '$project/utils'
-	export default {
-		name: 'MasterHospitalArchives',
-		components: {
-			Common,
-			Loading,
-			TopHeader
-		},
-		data() {
-			return {
-				pageTitle: '就医档案',
-				isLoading: false,
- 				detail:{},
-			}
-		},
-		created() {
-
-		 },
-		methods:  {
-		submit(){
-								this.isLoading = true;
-
-		        	API.medicalPersonSave(this.detail).then(res=>{
-                             this.$router.push({
-                             					name: 'MasterHospital',
-                             					query: {
-                              					}
-                             				})
-                                    this.detail=res;
-                					mui.toast("已提交");
-
-                  }).catch(error => {
-                  			this.isLoading = false;
-
-                					mui.toast(error);
-
-                    })
-		},
-		selectGender(){
-		  	var picker = new mui.PopPicker();
-
-		    		picker.setData([
-		    		{
-            						text: "男",
-            						value: '男'
-            					},
-            					{
-            						text: "女",
-            						value: '女'
-            					},{
-                                     text: "未知",
-                                     value: '未知'
-                                }
-            				]);
-            	picker.show((selectItems) => {
-                      this.detail.gender = selectItems[0].text;
-
-             });
-		},
-			selectDate(){
-			            var dtPicker = new mui.DtPicker({
-            					type: 'date',
-            					"beginYear": 1900,
-            					"endDate": new Date(),
-            				});
-
-            				dtPicker.show((selectItems) => {
-            					var year = selectItems.y.value;
-            					var month = selectItems.m.value;
-            					var day = selectItems.d.value;
-
-            					var curDate = year + "-" + month + "-" + day;
-                                this.detail.birthDate=curDate;
-
-            				});
-			},
-		getDetail(){
-						this.isLoading = true;
-
-	        	API.medicalPersonDetail(this.person_data.id).then(res=>{
-                    this.detail=res;
-				this.isLoading = false;
-
-         		}).catch(error => {
+require("$project/assets/js/mui.picker.min.js");
+
+import * as API from "@/apis/Master/hospital";
+import Common from "$project/components/Common.vue";
+import Loading from "$project/components/Loading.vue";
+import TopHeader from "$project/components/TopHeader.vue";
+
+import {
+    mapGetters,
+    mapMutations
+} from "vuex";
+
+import {} from "$project/utils";
+export default {
+    name: "MasterHospitalArchives",
+    components: {
+        Common,
+        Loading,
+        TopHeader,
+    },
+    data() {
+        return {
+            pageTitle: "就医档案",
+            isLoading: false,
+            detail: {},
+        };
+    },
+    created() {},
+    methods: {
+        submit() {
+            this.isLoading = true;
+
+            API.medicalPersonSave(this.detail)
+                .then((res) => {
+                    this.$router.push({
+                        name: "MasterHospital",
+                        query: {},
+                    });
+                    this.detail = res;
+                    mui.toast("已提交");
+                })
+                .catch((error) => {
                     this.isLoading = false;
-        		})
-		}
 
-		 ,asynCallBack(){},
-		},
-		mounted() {
-            this.getDetail();
-		},
-		destroyed() {
-
-		},
-		computed: {
-			...mapGetters({
-				openId: 'wx_openid',
-				token: 'token',
-				person_data: 'person_data',
-				person_popedom: 'person_popedom',
-			})
-		}
-	}
+                    mui.toast(error);
+                });
+        },
+        selectGender() {
+            var picker = new mui.PopPicker();
+
+            picker.setData([{
+                    text: "男",
+                    value: "男",
+                },
+                {
+                    text: "女",
+                    value: "女",
+                },
+                {
+                    text: "未知",
+                    value: "未知",
+                },
+            ]);
+            picker.show((selectItems) => {
+                this.detail.gender = selectItems[0].text;
+            });
+        },
+        selectDate() {
+            var dtPicker = new mui.DtPicker({
+                type: "date",
+                beginYear: 1900,
+                endDate: new Date(),
+            });
+
+            dtPicker.show((selectItems) => {
+                var year = selectItems.y.value;
+                var month = selectItems.m.value;
+                var day = selectItems.d.value;
+
+                var curDate = year + "-" + month + "-" + day;
+                this.detail.birthDate = curDate;
+            });
+        },
+        getDetail() {
+            this.isLoading = true;
+
+            API.medicalPersonDetail(this.person_data.id)
+                .then((res) => {
+                    this.detail = res;
+                    this.isLoading = false;
+                })
+                .catch((error) => {
+                    this.isLoading = false;
+                });
+        },
+
+        asynCallBack() {},
+    },
+    mounted() {
+        this.getDetail();
+    },
+    destroyed() {},
+    computed: {
+        ...mapGetters({
+            openId: "wx_openid",
+            token: "token",
+            person_data: "person_data",
+            person_popedom: "person_popedom",
+        }),
+    },
+};
 </script>
 
 <style scoped src="$project/assets/css/pension.css"></style>

+ 311 - 322
src/projects/pension/views/Master/Hospital/Form.vue

@@ -1,333 +1,322 @@
 <template>
 <div>
-  	 <common @asynCallBack="asynCallBack"></common>
-       <top-header :pageTitle="pageTitle"  ></top-header>
-
-		<div class="mui-content margin60">
-			<div class="mui-content-padded vongi-qingjiadt vongi-editme">
-				<form class="mui-input-group">
-					<div class="mui-input-row">
-						<label>就医医院<i style="color:red">*</i></label>
-						<input type="text" class="mui-input-clear" v-model="detail.hospitalName" placeholder="请填写医院名称">
-					</div>
-					<div class="mui-input-row">
-						<label>就医时间<i style="color:red">*</i></label>
-						<button class="mui-btn mui-btn-block mui-navigate-right mui-ellipsis"
-						  @click="selectDate"
-						 type='button' style="width:65%">
-
-							{{detail.hospitalTime?detail.hospitalTime:'请选择'}}
-
-						</button>
-					</div>
-				</form>
-			</div>
-			<div class="vongi-meform-pho mui-content-padded">
-				<h4>病因<i style="color:red">*</i></h4>
-				<div class="mui-input-row">
-					<textarea id="textarea" rows="5"  v-model="detail.pathogeny" placeholder="请填写病因"></textarea>
-				</div>
-			</div>
-			<div class="vongi-meform-pho mui-content-padded">
-				<h4>就医结果</h4>
-				<div class="mui-input-row">
-					<textarea id="textarea" rows="5" v-model="detail.result"  placeholder="请填写就医结果"></textarea>
-				</div>
-			</div>
-			<div class="vongi-wordcard vongi-meform-pho mui-content-padded">
-				<h4>结果图片记录</h4>
-				<div class="fyy-upphoto">
-					<div class="mui-col-xs-3 fyy-upphoto-close"  v-for="(picture,index) in resultImg" :key="index" >
-						<img  v-if="picture" :src="picture + '?x-oss-process=image/resize,m_fill,w_128,h_128'"  />
-						<a class="mui-icon mui-icon-closeempty"   @click="delImg('1',index)" ></a>
-					</div>
-					<div class="mui-col-xs-3">
-						<a><span class="mui-icon mui-icon-camera" @click="changeImg('1')" ></span></a>
-					</div>
-				</div>
-			</div>
-			<div class="vongi-meform-pho mui-content-padded">
-				<h4>使用药品</h4>
-				<div class="mui-input-row">
-					<textarea id="textarea" rows="5" v-model="detail.drugs" placeholder="请填写使用药品"></textarea>
-				</div>
-			</div>
-			<div class="vongi-wordcard vongi-meform-pho mui-content-padded">
-				<h4>药品图片记录</h4>
-				<div class="fyy-upphoto">
-					<div class="mui-col-xs-3 fyy-upphoto-close"  v-for="(picture,index) in drugsImg" :key="index" >
-                    						<img  v-if="picture" :src="picture + '?x-oss-process=image/resize,m_fill,w_128,h_128'"  />
-                    						<a class="mui-icon mui-icon-closeempty"   @click="delImg('2',index)" ></a>
-                    					</div>
-					<div class="mui-col-xs-3">
-						<a><span class="mui-icon mui-icon-camera" @click="changeImg('2')"></span></a>
-					</div>
-				</div>
-			</div>
-			<div class="mui-content-padded vongi-qingjiadt vongi-editme">
-				<form class="mui-input-group">
-					<div class="mui-input-row">
-						<label>诊疗费用(元)</label>
-						<span  style=" padding-top: 0px;
-                                   padding-bottom: 0px;">
-                         <input v-model="detail.cost" placeholder="请填写诊疗费用" class="mui-input-clear" type="number" > </span>
-					</div>
-				</form>
-			</div>
-			<div class="vongi-wordcard vongi-meform-pho mui-content-padded">
-				<h4>诊疗费用图</h4>
-				<div class="fyy-upphoto">
-					<div class="mui-col-xs-3 fyy-upphoto-close"  v-for="(picture,index) in costImg" :key="index" >
-                    						<img  v-if="picture" :src="picture + '?x-oss-process=image/resize,m_fill,w_128,h_128'"  />
-                    						<a class="mui-icon mui-icon-closeempty"    @click="delImg('3',index)" ></a>
-                    					</div>
-					<div class="mui-col-xs-3">
-						<a><span class="mui-icon mui-icon-camera" @click="changeImg('3')"></span></a>
-					</div>
-				</div>
-			</div>
-		</div>
-		<div class="fyy-footer">
-			<div class="bindfyy-btn"><button type="submit" class="mui-btn mui-btn-pink "  @click="submit()">保  存</button></div>
-		</div>
-				 <loading :visible="isLoading"></loading>
-
+    <common @asynCallBack="asynCallBack"></common>
+    <top-header :pageTitle="pageTitle"></top-header>
+
+    <div class="mui-content margin60">
+        <div class="mui-content-padded vongi-qingjiadt vongi-editme">
+            <form class="mui-input-group">
+                <div class="mui-input-row">
+                    <label>就医医院<i style="color: red">*</i></label>
+                    <input type="text" class="mui-input-clear" v-model="detail.hospitalName" placeholder="请填写医院名称" />
+                </div>
+                <div class="mui-input-row">
+                    <label>就医时间<i style="color: red">*</i></label>
+                    <button class="mui-btn mui-btn-block mui-navigate-right mui-ellipsis" @click="selectDate" type="button" style="width: 65%">
+                        {{ detail.hospitalTime ? detail.hospitalTime : "请选择" }}
+                    </button>
+                </div>
+            </form>
+        </div>
+        <div class="vongi-meform-pho mui-content-padded">
+            <h4>病因<i style="color: red">*</i></h4>
+            <div class="mui-input-row">
+                <textarea id="textarea" rows="5" v-model="detail.pathogeny" placeholder="请填写病因"></textarea>
+            </div>
+        </div>
+        <div class="vongi-meform-pho mui-content-padded">
+            <h4>就医结果</h4>
+            <div class="mui-input-row">
+                <textarea id="textarea" rows="5" v-model="detail.result" placeholder="请填写就医结果"></textarea>
+            </div>
+        </div>
+        <div class="vongi-wordcard vongi-meform-pho mui-content-padded">
+            <h4>结果图片记录</h4>
+            <div class="fyy-upphoto">
+                <div class="mui-col-xs-3 fyy-upphoto-close" v-for="(picture, index) in resultImg" :key="index">
+                    <img v-if="picture" :src="picture + '?x-oss-process=image/resize,m_fill,w_128,h_128'" />
+                    <a class="mui-icon mui-icon-closeempty" @click="delImg('1', index)"></a>
+                </div>
+                <div class="mui-col-xs-3">
+                    <a><span class="mui-icon mui-icon-camera" @click="changeImg('1')"></span></a>
+                </div>
+            </div>
+        </div>
+        <div class="vongi-meform-pho mui-content-padded">
+            <h4>使用药品</h4>
+            <div class="mui-input-row">
+                <textarea id="textarea" rows="5" v-model="detail.drugs" placeholder="请填写使用药品"></textarea>
+            </div>
+        </div>
+        <div class="vongi-wordcard vongi-meform-pho mui-content-padded">
+            <h4>药品图片记录</h4>
+            <div class="fyy-upphoto">
+                <div class="mui-col-xs-3 fyy-upphoto-close" v-for="(picture, index) in drugsImg" :key="index">
+                    <img v-if="picture" :src="picture + '?x-oss-process=image/resize,m_fill,w_128,h_128'" />
+                    <a class="mui-icon mui-icon-closeempty" @click="delImg('2', index)"></a>
+                </div>
+                <div class="mui-col-xs-3">
+                    <a><span class="mui-icon mui-icon-camera" @click="changeImg('2')"></span></a>
+                </div>
+            </div>
+        </div>
+        <div class="mui-content-padded vongi-qingjiadt vongi-editme">
+            <form class="mui-input-group">
+                <div class="mui-input-row">
+                    <label>诊疗费用(元)</label>
+                    <span style="padding-top: 0px; padding-bottom: 0px">
+                        <input v-model="detail.cost" placeholder="请填写诊疗费用" class="mui-input-clear" type="number" />
+                    </span>
+                </div>
+            </form>
+        </div>
+        <div class="vongi-wordcard vongi-meform-pho mui-content-padded">
+            <h4>诊疗费用图</h4>
+            <div class="fyy-upphoto">
+                <div class="mui-col-xs-3 fyy-upphoto-close" v-for="(picture, index) in costImg" :key="index">
+                    <img v-if="picture" :src="picture + '?x-oss-process=image/resize,m_fill,w_128,h_128'" />
+                    <a class="mui-icon mui-icon-closeempty" @click="delImg('3', index)"></a>
+                </div>
+                <div class="mui-col-xs-3">
+                    <a><span class="mui-icon mui-icon-camera" @click="changeImg('3')"></span></a>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="fyy-footer">
+        <div class="bindfyy-btn">
+            <button type="submit" class="mui-btn mui-btn-pink" @click="submit()">
+                保 存
+            </button>
+        </div>
+    </div>
+    <loading :visible="isLoading"></loading>
 </div>
 </template>
 
-
 <script>
-	require('$project/assets/js/mui.picker.min.js');
-
-	import * as API from '@/apis/Master/hospital'
-	import Common from '$project/components/Common.vue'
-	import Loading from '$project/components/Loading.vue'
-	import TopHeader from '$project/components/TopHeader.vue'
-	import * as WxJsApi from '$project/utils/wxJsApi'
-
-	import {
-		mapGetters,
-		mapMutations
-	} from 'vuex'
-
-	import {
-
-
-	} from '$project/utils'
-	export default {
-		name: 'MasterHospitalForm',
-		components: {
-			Common,
-			Loading,
-			TopHeader
-		},
-		data() {
-			return {
-				pageTitle: '就医记录',
-				isLoading: false,
-				drugsImg:[],
-				resultImg:[],
-				costImg:[],
- 				detail:{
-                       		"cost": '',//费用
-                       		"costImg": "",
-
-                       		"delFlag": false,
-                       		"drugs": "",//药品
-                       		"drugsImg": "",
-                       		"hospitalName": "",//医院
-                       		"hospitalTime": "",
-                       		"id": "",
-                       		"personId": "",
-                       		"pathogeny": "",//病因
-                       		"result": "",//就医结果
-                       		"resultImg": "",//结果图片
-                       		"updateBy": "",
-                       		"updateTime": ""
-                       	},
-			}
-		},
-		created() {
-
-		 },
-		methods:  {
-		checkForm(){
-		    if (!this.detail.hospitalName) {
-            					mui.toast('请输入就医医院');
-            					return false;
-            				} else if (!this.detail.hospitalTime) {
-            					mui.toast('请选择就医时间');
-            					return false;
-            				} else if (!this.detail.pathogeny) {
-                                         mui.toast('请输入病因');
-                                         return false;
-                           }
-                           return true;
-		},
-		submit(){
-
-		if (!this.checkForm()) {
-		       return;
-		}
-		this.detail.personId=this.person_data.id
-		this.detail.resultImg=this.resultImg.join(",")
-		this.detail.drugsImg=this.drugsImg.join(",")
-		this.detail.costImg=this.costImg.join(",")
-
- 				this.isLoading = true;
-                if(!this.detail.id){
-                	API.medicalRecordAdd(this.detail).then(res=>{
-                                             this.$router.push({
-                                             					name: 'MasterHospital',
-                                             					query: {
-                                              					}
-                                             				})
-                                                    this.detail=res;
-                                					mui.toast("已提交");
-
-                                  }).catch(error => {
-                                  			this.isLoading = false;
-
-                                					mui.toast(error);
-
-                                    })
-                }else{
-                API.medicalRecordUpdate(this.detail).then(res=>{
-                                                             this.$router.push({
-                                                             					name: 'MasterHospital',
-                                                             					query: {
-                                                              					}
-                                                             				})
-                                                                    this.detail=res;
-                                                					mui.toast("已提交");
-
-                                                  }).catch(error => {
-                                                  			this.isLoading = false;
-
-                                                					mui.toast(error);
-
-                                                    })
-                }
-
-		},
-		 changeImg(type) {
-		 var sz=[];
-		    if(type==1){
-		        sz=this.resultImg
-		    }else if(type==2){
-		        sz=this.drugsImg
-		    }else if(type==3){
-		         sz=this.costImg
-		    }
-
-         				if (sz.length >= 10) {
-         					mui.toast("只能上传10张照片");
-         					return;
-         				}
-         				var _this = this;
-
-         				WxJsApi.chooseImage().then(res => {
-         					var localData = res.localData;
-
-         					if (localData.indexOf('data:image') != 0) {
-         						//判断是否有这样的头部
-         						localData = 'data:image/jpeg;base64,' + localData
-         					}
-         					localData = localData.replace(/\r|\n/g, '').replace('data:image/jgp', 'data:image/jpeg')
-         					this.imgBase64 = localData;
-         					//显示裁剪图片
-         					//_this.showCropper(field);
-         					this.uploadpic(sz);
-         				}).catch(error => {
-         					mui.toast(error);
-         				})
-
-
-         			},	delImg(type,index) {
-         			var sz;
-            if(type==1){
-		        sz=this.resultImg
-		    }else if(type==2){
-		        sz=this.drugsImg
-		    }else if(type==3){
-		         sz=this.costImg
-		    }
-               sz.splice(index, 1);
-                      			},
-                      				//上传图片
-                                			uploadpic(sz) {
-                                				this.isLoading = true;
-
-                                				WxJsApi.uploadPic(this.imgBase64).then(response => {
-                                					this.isLoading = false;
-                                					sz.push(response);
-                                				}).catch(error => {
-                                					this.isLoading = false;
-                                					mui.toast(error);
-                                				})
-                                			},
-			selectDate(){
-			            var dtPicker = new mui.DtPicker({
-            					type: 'date',
-            					"beginYear": 1900,
-            					"endDate": new Date(),
-            				});
-
-            				dtPicker.show((selectItems) => {
-            					var year = selectItems.y.value;
-            					var month = selectItems.m.value;
-            					var day = selectItems.d.value;
-
-            					var curDate = year + "-" + month + "-" + day;
-                                this.detail.hospitalTime=curDate;
-
-            				});
-			},
-		getDetail(){
-						this.isLoading = true;
-
-	        	API.medicalRecordDetail(this.$route.query.id).then(res=>{
-                    this.detail=res;
-				this.isLoading = false;
-				if(this.detail.resultImg){
-				 	        	this.resultImg=this.detail.resultImg.split(",")
-				}
-				if(this.detail.drugsImg){
-				 		 		this.drugsImg=this.detail.drugsImg.split(",")
-
-				}
-				if(this.detail.costImg){
-				 	        	this.costImg=this.detail.costImg.split(",")
-
-                				}
-
-
-         		}).catch(error => {
-                    this.isLoading = false;
-        		})
-		}
-
-		 ,asynCallBack(){},
-		},
-		mounted() {
-					WxJsApi.getWxConfig();
-            if(this.$route.query.id){
-                 this.getDetail();
+require("$project/assets/js/mui.picker.min.js");
+
+import * as API from "@/apis/Master/hospital";
+import Common from "$project/components/Common.vue";
+import Loading from "$project/components/Loading.vue";
+import TopHeader from "$project/components/TopHeader.vue";
+import * as WxJsApi from "$project/utils/wxJsApi";
+
+import {
+    mapGetters,
+    mapMutations
+} from "vuex";
+
+import {} from "$project/utils";
+export default {
+    name: "MasterHospitalForm",
+    components: {
+        Common,
+        Loading,
+        TopHeader,
+    },
+    data() {
+        return {
+            pageTitle: "就医记录",
+            isLoading: false,
+            drugsImg: [],
+            resultImg: [],
+            costImg: [],
+            detail: {
+                cost: "", //费用
+                costImg: "",
+
+                delFlag: false,
+                drugs: "", //药品
+                drugsImg: "",
+                hospitalName: "", //医院
+                hospitalTime: "",
+                id: "",
+                personId: "",
+                pathogeny: "", //病因
+                result: "", //就医结果
+                resultImg: "", //结果图片
+                updateBy: "",
+                updateTime: "",
+            },
+        };
+    },
+    created() {},
+    methods: {
+        checkForm() {
+            if (!this.detail.hospitalName) {
+                mui.toast("请输入就医医院");
+                return false;
+            } else if (!this.detail.hospitalTime) {
+                mui.toast("请选择就医时间");
+                return false;
+            } else if (!this.detail.pathogeny) {
+                mui.toast("请输入病因");
+                return false;
+            }
+            return true;
+        },
+        submit() {
+            if (!this.checkForm()) {
+                return;
+            }
+            this.detail.personId = this.person_data.id;
+            this.detail.resultImg = this.resultImg.join(",");
+            this.detail.drugsImg = this.drugsImg.join(",");
+            this.detail.costImg = this.costImg.join(",");
+
+            this.isLoading = true;
+            if (!this.detail.id) {
+                API.medicalRecordAdd(this.detail)
+                    .then((res) => {
+                        this.$router.push({
+                            name: "MasterHospital",
+                            query: {},
+                        });
+                        this.detail = res;
+                        mui.toast("已提交");
+                    })
+                    .catch((error) => {
+                        this.isLoading = false;
+
+                        mui.toast(error);
+                    });
+            } else {
+                API.medicalRecordUpdate(this.detail)
+                    .then((res) => {
+                        this.$router.push({
+                            name: "MasterHospital",
+                            query: {},
+                        });
+                        this.detail = res;
+                        mui.toast("已提交");
+                    })
+                    .catch((error) => {
+                        this.isLoading = false;
+
+                        mui.toast(error);
+                    });
+            }
+        },
+        changeImg(type) {
+            var sz = [];
+            if (type == 1) {
+                sz = this.resultImg;
+            } else if (type == 2) {
+                sz = this.drugsImg;
+            } else if (type == 3) {
+                sz = this.costImg;
             }
-           //
-		},
-		destroyed() {
 
-		},
-		computed: {
-			...mapGetters({
-				openId: 'wx_openid',
-				token: 'token',
-				person_data: 'person_data',
-				person_popedom: 'person_popedom',
-			})
-		}
-	}
+            if (sz.length >= 10) {
+                mui.toast("只能上传10张照片");
+                return;
+            }
+            var _this = this;
+
+            WxJsApi.chooseImage()
+                .then((res) => {
+                    var localData = res.localData;
+
+                    if (localData.indexOf("data:image") != 0) {
+                        //判断是否有这样的头部
+                        localData = "data:image/jpeg;base64," + localData;
+                    }
+                    localData = localData
+                        .replace(/\r|\n/g, "")
+                        .replace("data:image/jgp", "data:image/jpeg");
+                    this.imgBase64 = localData;
+                    //显示裁剪图片
+                    //_this.showCropper(field);
+                    this.uploadpic(sz);
+                })
+                .catch((error) => {
+                    mui.toast(error);
+                });
+        },
+        delImg(type, index) {
+            var sz;
+            if (type == 1) {
+                sz = this.resultImg;
+            } else if (type == 2) {
+                sz = this.drugsImg;
+            } else if (type == 3) {
+                sz = this.costImg;
+            }
+            sz.splice(index, 1);
+        },
+        //上传图片
+        uploadpic(sz) {
+            this.isLoading = true;
+
+            WxJsApi.uploadPic(this.imgBase64)
+                .then((response) => {
+                    this.isLoading = false;
+                    sz.push(response);
+                })
+                .catch((error) => {
+                    this.isLoading = false;
+                    mui.toast(error);
+                });
+        },
+        selectDate() {
+            var dtPicker = new mui.DtPicker({
+                type: "date",
+                beginYear: 1900,
+                endDate: new Date(),
+            });
+
+            dtPicker.show((selectItems) => {
+                var year = selectItems.y.value;
+                var month = selectItems.m.value;
+                var day = selectItems.d.value;
+
+                var curDate = year + "-" + month + "-" + day;
+                this.detail.hospitalTime = curDate;
+            });
+        },
+        getDetail() {
+            this.isLoading = true;
+
+            API.medicalRecordDetail(this.$route.query.id)
+                .then((res) => {
+                    this.detail = res;
+                    this.isLoading = false;
+                    if (this.detail.resultImg) {
+                        this.resultImg = this.detail.resultImg.split(",");
+                    }
+                    if (this.detail.drugsImg) {
+                        this.drugsImg = this.detail.drugsImg.split(",");
+                    }
+                    if (this.detail.costImg) {
+                        this.costImg = this.detail.costImg.split(",");
+                    }
+                })
+                .catch((error) => {
+                    this.isLoading = false;
+                });
+        },
+
+        asynCallBack() {},
+    },
+    mounted() {
+        WxJsApi.getWxConfig();
+        if (this.$route.query.id) {
+            this.getDetail();
+        }
+        //
+    },
+    destroyed() {},
+    computed: {
+        ...mapGetters({
+            openId: "wx_openid",
+            token: "token",
+            person_data: "person_data",
+            person_popedom: "person_popedom",
+        }),
+    },
+};
 </script>
 
 <style scoped src="$project/assets/css/pension.css"></style>

+ 179 - 181
src/projects/pension/views/Master/Hospital/Home.vue

@@ -1,191 +1,189 @@
 <template>
 <div>
-      <common @asynCallBack="asynCallBack"></common>
-       	<top-header :pageTitle="pageTitle" ></top-header>
-
-		<div class="mui-content margin60">
-			<div class="vongi-jy-list flew-sp">
-				<div class="vongi-wordcard flew-items">
-					<div class="mui-media-object mui-pull-left ">
-					<img :src="info.faceImageUrl" width="50" /></div>
-					<div class="mui-media-body">
-						<h3>{{info.name}}</h3>
-						<p class='mui-ellipsis mui-h4'>年龄:{{info.age}} · 性别:{{info.gender}}</p>
-					</div>
-				</div>
-				<div class="vongi-center">
-					<span class="iconfont icon-xinbaniconshangchuan- pink"></span>
-					<div class="mui-media-body mui-h5" @click="edit()">编辑</div>
-				</div>
-			</div>
-			<!--<div class="vongi-examineInfo vongi-center">
-				<img src="~$project/assets/img/no.png" width="40%" />
-				<p>暂无就医记录</p>
-			</div>-->
-			<NullList :remark="'笑口常开,无病无灾'" v-if="!recordList.length"></NullList>
-
-			<ul class="mui-table-view vongi-jy-ul">
-				<li class="mui-table-view-cell"  v-for="mod in recordList">
-					<a class="mui-navigate-right" @click="add(mod.id)" >
-						<div class="mui-media-body">
-							{{mod.hospitalTime}}
-							<h4 class='mui-ellipsis'>{{mod.pathogeny}}</h4>
-						</div>
-						<span>{{mod.hospitalName}}</span>
-					</a>
-				</li>
-
-			</ul>
-		</div>
-		<div class="fyy-footer">
-			<div class="bindfyy-btn"><button type="submit" class="mui-btn mui-btn-pink " @click="add('')">新增就医记录</button></div>
-		</div>
-				 <loading :visible="isLoading"></loading>
-
+    <common @asynCallBack="asynCallBack"></common>
+    <top-header :pageTitle="pageTitle"></top-header>
+
+    <div class="mui-content margin60">
+        <div class="vongi-jy-list flew-sp">
+            <div class="vongi-wordcard flew-items">
+                <div class="mui-media-object mui-pull-left">
+                    <img :src="info.faceImageUrl" width="50" />
+                </div>
+                <div class="mui-media-body">
+                    <h3>{{ info.name }}</h3>
+                    <p class="mui-ellipsis mui-h4">
+                        年龄:{{ info.age }} · 性别:{{ info.gender }}
+                    </p>
+                </div>
+            </div>
+            <div class="vongi-center">
+                <span class="iconfont icon-xinbaniconshangchuan- pink"></span>
+                <div class="mui-media-body mui-h5" @click="edit()">编辑</div>
+            </div>
+        </div>
+        <!--<div class="vongi-examineInfo vongi-center">
+                <img src="~$project/assets/img/no.png" width="40%" />
+                <p>暂无就医记录</p>
+            </div>-->
+        <NullList :remark="'笑口常开,无病无灾'" v-if="!recordList.length"></NullList>
+
+        <ul class="mui-table-view vongi-jy-ul">
+            <li class="mui-table-view-cell" v-for="mod in recordList">
+                <a class="mui-navigate-right" @click="add(mod.id)">
+                    <div class="mui-media-body">
+                        {{ mod.hospitalTime }}
+                        <h4 class="mui-ellipsis">{{ mod.pathogeny }}</h4>
+                    </div>
+                    <span>{{ mod.hospitalName }}</span>
+                </a>
+            </li>
+        </ul>
+    </div>
+    <div class="fyy-footer">
+        <div class="bindfyy-btn">
+            <button type="submit" class="mui-btn mui-btn-pink" @click="add('')">
+                新增就医记录
+            </button>
+        </div>
+    </div>
+    <loading :visible="isLoading"></loading>
 </div>
 </template>
 
-
 <script>
-	import * as API from '@/apis/Master/hospital'
-	import Common from '$project/components/Common.vue'
-	import Loading from '$project/components/Loading.vue'
-	import TopHeader from '$project/components/TopHeader.vue'
-	import isReachBottom from '$project/utils/isReachBottom'
-	import NullList from '$project/components/NullList.vue'
-	import {
-
-		currentTimeStamp,
-		parseUnixTime
-	} from '$project/utils'
-	import {
-		mapGetters,
-		mapMutations
-	} from 'vuex'
-	export default {
-		name: 'MasterHospital',
-		components: {
-			Common,
-			Loading,
-			TopHeader,NullList
-		},
-		data() {
-			return {
-				pageTitle: '就医记录',
-
-				rightLink: {
-					show: true,
-					icon: 'icon-baobiao',
-					style: 'font-size:14px',
-					title: '账单记录'
-				},
-				isLoading: false,
-                info:{
-                faceImageUrl:''
-                },
-				listForm: {
-					pageIndex: 1,
-					pageSize: 20,
- 					totalPage: 1,
- 					status:10
- 				},
-				recordList: [],
-
-			}
-		},
-		created() {
- 		},
-		methods: {
-	        //右上角点击事件
-			edit() {
-				this.$router.push({
-					name: 'MasterHospitalArchives',
-					query: {
- 					}
-				})
-			},
-			add(id){
-
-			    this.$router.push({
-            			name: 'MasterHospitalForm',
-            			query: {
-            			    id:id
-             			}
-            	})
-			},
-
-            getInfo() {
-                API.getElderInfo().then(res => {
-                    this.info=res;
-
-
-
-            	}).catch(error => {
-             					mui.toast(error);
-            	})
+import * as API from "@/apis/Master/hospital";
+import Common from "$project/components/Common.vue";
+import Loading from "$project/components/Loading.vue";
+import TopHeader from "$project/components/TopHeader.vue";
+import isReachBottom from "$project/utils/isReachBottom";
+import NullList from "$project/components/NullList.vue";
+import {
+    currentTimeStamp,
+    parseUnixTime
+} from "$project/utils";
+import {
+    mapGetters,
+    mapMutations
+} from "vuex";
+export default {
+    name: "MasterHospital",
+    components: {
+        Common,
+        Loading,
+        TopHeader,
+        NullList,
+    },
+    data() {
+        return {
+            pageTitle: "就医记录",
+
+            rightLink: {
+                show: true,
+                icon: "icon-baobiao",
+                style: "font-size:14px",
+                title: "账单记录",
             },
-			//获取列表
-			getList() {
-				this.isLoading = true;
-				API.pageList(this.listForm).then(res => {
-					var response=res;
-					if (response) {
-						if (this.listForm.pageIndex == 1) {
-							this.recordList = response.data;
-							this.listForm.pageIndex = response.pageNumber;
-							this.listForm.totalPage = response.totalPage;
-						} else {
-							this.recordList = [
-								...this.recordList,
-								...response.data
-							];
-						}
-					}
-					this.listForm.pageIndex++;
-					this.isLoading = false;
-				}).catch(error => {
-					this.isLoading = false;
-					mui.toast(error);
-				})
-			},
-			//下拉事件
-			handleScrool() {
-				if (isReachBottom()) {
-					console.log('到达底部')
-					if (this.listForm.pageIndex <= this.listForm.totalPage && this.isLoading == false) {
-						this.getList();
-					} else {
-						return;
-					}
-				}
-			},
-
-			asynCallBack() {
-
-			},
-		},
-		mounted() {
-			this.getInfo();
-            this.getList();
-			//监控下拉加载事件
-			var _this = this;
-			window.addEventListener('scroll', _this.handleScrool);
-		},
-		destroyed() {
-			//销毁监听事件
-			var _this = this;
-			window.removeEventListener('scroll', _this.handleScrool);
-		},
-		computed: {
-			...mapGetters({
-				openId: 'wx_openid',
-				token: 'token',
-				person_data: 'person_data',
-				person_popedom: 'person_popedom',
-			})
-		},
-
-	}
+            isLoading: false,
+            info: {
+                faceImageUrl: "",
+            },
+            listForm: {
+                pageIndex: 1,
+                pageSize: 20,
+                totalPage: 1,
+                status: 10,
+            },
+            recordList: [],
+        };
+    },
+    created() {},
+    methods: {
+        //右上角点击事件
+        edit() {
+            this.$router.push({
+                name: "MasterHospitalArchives",
+                query: {},
+            });
+        },
+        add(id) {
+            this.$router.push({
+                name: "MasterHospitalForm",
+                query: {
+                    id: id,
+                },
+            });
+        },
+
+        getInfo() {
+            API.getElderInfo()
+                .then((res) => {
+                    this.info = res;
+                })
+                .catch((error) => {
+                    mui.toast(error);
+                });
+        },
+        //获取列表
+        getList() {
+            this.isLoading = true;
+            API.pageList(this.listForm)
+                .then((res) => {
+                    var response = res;
+                    if (response) {
+                        if (this.listForm.pageIndex == 1) {
+                            this.recordList = response.data;
+                            this.listForm.pageIndex = response.pageNumber;
+                            this.listForm.totalPage = response.totalPage;
+                        } else {
+                            this.recordList = [...this.recordList, ...response.data];
+                        }
+                    }
+                    this.listForm.pageIndex++;
+                    this.isLoading = false;
+                })
+                .catch((error) => {
+                    this.isLoading = false;
+                    mui.toast(error);
+                });
+        },
+        //下拉事件
+        handleScrool() {
+            if (isReachBottom()) {
+                console.log("到达底部");
+                if (
+                    this.listForm.pageIndex <= this.listForm.totalPage &&
+                    this.isLoading == false
+                ) {
+                    this.getList();
+                } else {
+                    return;
+                }
+            }
+        },
+
+        asynCallBack() {},
+    },
+    mounted() {
+        this.getInfo();
+        this.getList();
+        //监控下拉加载事件
+        var _this = this;
+        window.addEventListener("scroll", _this.handleScrool);
+    },
+    destroyed() {
+        //销毁监听事件
+        var _this = this;
+        window.removeEventListener("scroll", _this.handleScrool);
+    },
+    computed: {
+        ...mapGetters({
+            openId: "wx_openid",
+            token: "token",
+            person_data: "person_data",
+            person_popedom: "person_popedom",
+        }),
+    },
+};
 </script>
 
 <style scoped src="$project/assets/css/pension.css"></style>