From 3989508bc05fc7cfbbd1727152e0f2e1ee9cbae0 Mon Sep 17 00:00:00 2001 From: kola-web Date: Wed, 16 Jul 2025 16:42:05 +0800 Subject: [PATCH] =?UTF-8?q?3.0=20=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/popup/index.ts | 34 +++++++++++- src/components/popup/index.wxml | 21 ++++++- src/pages/my/index.ts | 3 +- src/patient/pages/inhibitorsManage/index.ts | 79 ++++++++++++++++++++++----- src/patient/pages/inhibitorsManage/index.wxml | 15 +++-- 5 files changed, 127 insertions(+), 25 deletions(-) diff --git a/src/components/popup/index.ts b/src/components/popup/index.ts index 06c4f23..19833ce 100644 --- a/src/components/popup/index.ts +++ b/src/components/popup/index.ts @@ -20,12 +20,16 @@ Component({ TCenterId: '', + inhibitorsId: '', + inhibitorsName: '', + inhibitorsContent: '', + imageUrl: app.globalData.imageUrl, Timestamp: app.globalData.Timestamp, }, methods: { handleOk() { - const { type } = this.data + const { type, inhibitorsId, inhibitorsName, inhibitorsContent } = this.data if (type === 'argument' && !this.data.popup1Check1) { wx.showToast({ title: '请同意隐私政策', @@ -44,6 +48,26 @@ Component({ this.triggerEvent('ok', { id: this.data.TCenterId }) return } + + if (type === 'inhibitors') { + if (!inhibitorsId) { + wx.showToast({ + title: '请选择抑制剂', + icon: 'none', + }) + return + } + if (inhibitorsName === '其他' && !inhibitorsContent) { + wx.showToast({ + title: '请填写其他抑制剂', + icon: 'none', + }) + return + } + + this.triggerEvent('ok', { id: inhibitorsId, name: inhibitorsName, content: inhibitorsContent }) + return + } this.triggerEvent('ok') }, handleCancel() { @@ -70,5 +94,13 @@ Component({ TCenterId: id, }) }, + handleSelectInhibitors(e) { + const { id, name } = e.currentTarget.dataset + console.log(11111) + this.setData({ + inhibitorsId: id, + inhibitorsName: name, + }) + }, }, }) diff --git a/src/components/popup/index.wxml b/src/components/popup/index.wxml index e8f806c..c59ec4b 100644 --- a/src/components/popup/index.wxml +++ b/src/components/popup/index.wxml @@ -194,18 +194,33 @@ 请选择您的免疫抑制剂 - + - + - 泼尼松 + {{item}} 取消 diff --git a/src/pages/my/index.ts b/src/pages/my/index.ts index bc6e9fc..33bc444 100644 --- a/src/pages/my/index.ts +++ b/src/pages/my/index.ts @@ -33,8 +33,7 @@ Page({ }).then((res) => { this.setData({ showPatient: res === '1', - - this.getApplyWord() + }) }) }, getApplyWord() { diff --git a/src/patient/pages/inhibitorsManage/index.ts b/src/patient/pages/inhibitorsManage/index.ts index b2e10c0..dc98630 100644 --- a/src/patient/pages/inhibitorsManage/index.ts +++ b/src/patient/pages/inhibitorsManage/index.ts @@ -14,17 +14,15 @@ Page({ type: '', dosage: '', dosageUnit: '', + dosageUnitName: '', + dosageUnitIndex: 0, - unitRange: [ - { - id: '1', - name: 'mg/天', - }, - { - id: '2', - name: 'IU/天', - }, - ], + drugUnitList: [] as any, + dict: { + drugTypeList: {}, + drugUnitList: {}, + drugList: {}, + }, }, onLoad(options) { console.log('DEBUGPRINT[71]: index.ts:29: options=', options) @@ -44,7 +42,16 @@ Page({ url: '?r=wtx/treatment/get-dict', data: {}, }).then((res) => { - console.log('res: ', res) + this.setData({ + dict: res, + drugUnitList: Object.entries(res.drugUnitList).map(([key, value]) => { + console.log('DEBUGPRINT[75]: index.ts:45: key=', key) + return { + id: key, + value, + } + }), + }) }) }, getDetail(id: string) { @@ -59,17 +66,41 @@ Page({ }) }, handleDrug() { - console.log(111) + const { dict } = this.data this.setData({ popupShow: true, popupType: 'inhibitors', popupParams: { close: true, - list: [], + list: dict.drugList, }, }) }, - handlePopupOk() { + handleSelect(e) { + const { id } = e.currentTarget.dataset + this.setData({ + type: id, + }) + }, + handleChange(e: any) { + const index = e.detail.value + const { drugUnitList } = this.data + const { id, value } = drugUnitList[index] + this.setData({ + dosageUnit: id, + dosageUnitName: value, + dosageUnitIndex: index, + }) + }, + handlePopupOk(e) { + const { popupType } = this.data + if (popupType === 'inhibitors') { + const { id, name, content } = e.detail + this.setData({ + drugId: id, + drugName: name === '其他' ? content : name, + }) + } this.setData({ popupShow: false, }) @@ -79,7 +110,25 @@ Page({ popupShow: false, }) }, - handleSubmit() {}, + handleSubmit() { + const { recordId, period, recordDate, drugId, drugName, type, dosage, dosageUnit } = this.data + wx.ajax({ + method: 'POST', + url: '?r=wtx/immune/save-record', + data: { + recordId, + period, + recordDate, + drugId, + drugName, + type, + dosage, + dosageUnit, + }, + }).then(() => { + this.handleBack() + }) + }, handleDel() { const { recordId } = this.data wx.ajax({ diff --git a/src/patient/pages/inhibitorsManage/index.wxml b/src/patient/pages/inhibitorsManage/index.wxml index 025faf1..3c37721 100644 --- a/src/patient/pages/inhibitorsManage/index.wxml +++ b/src/patient/pages/inhibitorsManage/index.wxml @@ -15,8 +15,15 @@ 用药方式 - 口服 - 注射 + + {{item}} + @@ -31,9 +38,9 @@ model:value="{{dosage}}" placeholder="请输入" /> - + - mg/天 + {{dosageUnitName}}