| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- import PageContainerBehavior from "../../../../core/behavior/page-container.behavior";
- // module/health/pages/home/home.ts
- import { toPatientPage } from "../../router";
- import { healthIndexMethod, healthPatientMethod } from "../../request";
- import { healthIndex2Progress } from "../../tools/health-index";
- Component({
- behaviors: [
- PageContainerBehavior,
- ],
- lifetimes: {
- attached() {
- this.getHealthPatient();
- this.getHealthIndex();
-
- }
- },
- properties: {},
- data: {
- // healthId: '',
- healthPatient: { data: null, loading: false, message: '' },
- healthIndex: { data: [], loading: false, message: '' },
- },
- methods: {
-
- async getHealthPatient() {
- this.setData({ 'healthPatient.loading': true, })
- try {
- const data = await healthPatientMethod();
- this.setData({
- 'healthPatient.data': data,
- 'healthPatient.loading': false,
- });
- } catch (error) {
- this.setData({
- 'healthPatient.data': [],
- 'healthPatient.loading': false,
- 'healthPatient.message': error.errMsg,
- });
- }
- },
- async getHealthIndex(id?: string) {
- this.setData({ 'healthIndex.loading': true, })
- try {
- const data = await healthIndexMethod(id);
- this.setData({
- 'healthIndex.data': healthIndex2Progress(data),
- 'healthIndex.loading': false,
- });
- } catch (error) {
- this.setData({
- 'healthIndex.data': [],
- 'healthIndex.loading': false,
- 'healthIndex.message': error.errMsg,
- });
- }
- },
- toPatientPage: toPatientPage,
- toHealthIndexListPage() {
- wx.navigateTo({ url: `/module/charts/record-index/record-index` })
- },
- }
- })
|