|
@@ -1,96 +1,78 @@
|
|
|
import { querySingle, patientUpdate } from "../patient-detail/service";
|
|
|
+import { createSubscribe } from "applet-page-component";
|
|
|
import history from "../../utils/history";
|
|
|
-import EventHub from "../../../abMall/utils/eventEmitter";
|
|
|
+Component(
|
|
|
+ createSubscribe({
|
|
|
+ async onShow() {
|
|
|
+ await this.querySingle();
|
|
|
+ },
|
|
|
+ })({
|
|
|
+ props: {},
|
|
|
+ data: {
|
|
|
+ patient: {
|
|
|
+ balance: 0,
|
|
|
+ id: "",
|
|
|
+ name: "",
|
|
|
+ age: "",
|
|
|
+ sex: "",
|
|
|
+ phoneNumber: "",
|
|
|
+ birthDay: "",
|
|
|
+ idCardNo: "",
|
|
|
+ relationShip: "",
|
|
|
+ bindCardNum: "",
|
|
|
+ medicCards: [],
|
|
|
+ },
|
|
|
+ },
|
|
|
|
|
|
-Component({
|
|
|
- props: {},
|
|
|
- data: {
|
|
|
- patient: {
|
|
|
- balance: 0,
|
|
|
- id: "",
|
|
|
- name: "",
|
|
|
- age: "",
|
|
|
- sex: "",
|
|
|
- phoneNumber: "",
|
|
|
- birthDay: "",
|
|
|
- idCardNo: "",
|
|
|
- relationShip: "",
|
|
|
- bindCardNum: "",
|
|
|
- medicCards: [],
|
|
|
+ didMount() {
|
|
|
+ this.querySingle();
|
|
|
},
|
|
|
- },
|
|
|
|
|
|
- didMount() {
|
|
|
- this.querySingle();
|
|
|
- this.onEventChange();
|
|
|
- // this.$page.updatePatient = this;
|
|
|
- // const page = getCurrentPages();
|
|
|
- // console.log("page", this.$page);
|
|
|
- // console.log("page ===>", page);
|
|
|
- },
|
|
|
+ didUnmount() {},
|
|
|
|
|
|
- didUnmount() {
|
|
|
- this.onEventRemove();
|
|
|
- },
|
|
|
+ methods: {
|
|
|
+ querySingle() {
|
|
|
+ const {
|
|
|
+ query = {
|
|
|
+ id: "",
|
|
|
+ },
|
|
|
+ } = this.$page.data;
|
|
|
+ my.showLoading();
|
|
|
+ querySingle({
|
|
|
+ id: query.id,
|
|
|
+ }).then((data) => {
|
|
|
+ this.setData({
|
|
|
+ patient: data,
|
|
|
+ });
|
|
|
+ my.hideLoading();
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
- methods: {
|
|
|
- onEventChange() {
|
|
|
- const _this = this;
|
|
|
- EventHub.addEventListener("onPatienDetailUpdate", (payload) => {
|
|
|
- if (payload) {
|
|
|
- _this.querySingle();
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- onEventRemove() {
|
|
|
- const _this = this;
|
|
|
- EventHub.removeEventListener("onPatienDetailUpdate", (payload) => {
|
|
|
- if (payload) {
|
|
|
- _this.querySingle();
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- querySingle() {
|
|
|
- const {
|
|
|
- query = {
|
|
|
- id: "",
|
|
|
- },
|
|
|
- } = this.$page.data;
|
|
|
- my.showLoading();
|
|
|
- querySingle({
|
|
|
- id: query.id,
|
|
|
- }).then((data) => {
|
|
|
+ // 修改关系
|
|
|
+ onChange(e) {
|
|
|
this.setData({
|
|
|
- patient: data,
|
|
|
+ "patient.relationShip": e.name,
|
|
|
});
|
|
|
- my.hideLoading();
|
|
|
- });
|
|
|
- },
|
|
|
+ },
|
|
|
|
|
|
- // 修改关系
|
|
|
- onChange(e) {
|
|
|
- this.setData({
|
|
|
- "patient.relationShip": e.name,
|
|
|
- });
|
|
|
- },
|
|
|
+ onChangePhone() {
|
|
|
+ history.push({
|
|
|
+ query: {
|
|
|
+ id: this.data.patient.id,
|
|
|
+ relationShip: this.data.patient.relationShip,
|
|
|
+ },
|
|
|
+ title: "修改手机号",
|
|
|
+ pageType: "patient-detail-phone",
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
- onChangePhone() {
|
|
|
- history.push({
|
|
|
- query: {
|
|
|
+ onSubmit() {
|
|
|
+ patientUpdate({
|
|
|
id: this.data.patient.id,
|
|
|
- relationShip: this.data.patient.relationShip,
|
|
|
- },
|
|
|
- title: "修改手机号",
|
|
|
- pageType: "patient-detail-phone",
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- onSubmit() {
|
|
|
- patientUpdate({
|
|
|
- id: this.data.patient.id,
|
|
|
- name: this.data.patient.name,
|
|
|
- relationShip: this.data.patient.relationShip,
|
|
|
- }).then(my.navigateBack);
|
|
|
+ name: this.data.patient.name,
|
|
|
+ relationShip: this.data.patient.relationShip,
|
|
|
+ }).then(my.navigateBack);
|
|
|
+ },
|
|
|
},
|
|
|
- },
|
|
|
-});
|
|
|
+ })
|
|
|
+);
|