Browse Source

3.0 联调

2.0
kola-web 2 weeks ago
parent
commit
3989508bc0
  1. 34
      src/components/popup/index.ts
  2. 21
      src/components/popup/index.wxml
  3. 3
      src/pages/my/index.ts
  4. 79
      src/patient/pages/inhibitorsManage/index.ts
  5. 15
      src/patient/pages/inhibitorsManage/index.wxml

34
src/components/popup/index.ts

@ -20,12 +20,16 @@ Component({
TCenterId: '', TCenterId: '',
inhibitorsId: '',
inhibitorsName: '',
inhibitorsContent: '',
imageUrl: app.globalData.imageUrl, imageUrl: app.globalData.imageUrl,
Timestamp: app.globalData.Timestamp, Timestamp: app.globalData.Timestamp,
}, },
methods: { methods: {
handleOk() { handleOk() {
const { type } = this.data const { type, inhibitorsId, inhibitorsName, inhibitorsContent } = this.data
if (type === 'argument' && !this.data.popup1Check1) { if (type === 'argument' && !this.data.popup1Check1) {
wx.showToast({ wx.showToast({
title: '请同意隐私政策', title: '请同意隐私政策',
@ -44,6 +48,26 @@ Component({
this.triggerEvent('ok', { id: this.data.TCenterId }) this.triggerEvent('ok', { id: this.data.TCenterId })
return 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') this.triggerEvent('ok')
}, },
handleCancel() { handleCancel() {
@ -70,5 +94,13 @@ Component({
TCenterId: id, TCenterId: id,
}) })
}, },
handleSelectInhibitors(e) {
const { id, name } = e.currentTarget.dataset
console.log(11111)
this.setData({
inhibitorsId: id,
inhibitorsName: name,
})
},
}, },
}) })

21
src/components/popup/index.wxml

@ -194,18 +194,33 @@
<view class="container"> <view class="container">
<view class="title">请选择您的免疫抑制剂</view> <view class="title">请选择您的免疫抑制剂</view>
<view class="list"> <view class="list">
<view class="list-item" wx:for="{{6}}" wx:key="index"> <view
class="list-item"
wx:for="{{params.list}}"
wx:key="index"
bind:tap="handleSelectInhibitors"
data-id="{{index}}"
data-name="{{item}}"
>
<view class="radio"> <view class="radio">
<image class="r-icon" src="{{imageUrl}}icon34.png?t={{Timestamp}}"></image> <image
wx:if="{{inhibitorsId == index}}"
class="r-icon"
src="{{imageUrl}}icon34.png?t={{Timestamp}}"
></image>
</view> </view>
<view class="content">泼尼松</view> <view class="content">{{item}}</view>
</view> </view>
</view> </view>
<textarea <textarea
wx:if="{{inhibitorsName == '其他'}}"
focus="{{inhibitorsName == '其他'}}"
class="texcarea" class="texcarea"
model:value="{{inhibitorsContent}}"
placeholder-style="color:rgba(207, 209, 213, 1)" placeholder-style="color:rgba(207, 209, 213, 1)"
placeholder="请输入您的药品名称" placeholder="请输入您的药品名称"
disable-default-padding disable-default-padding
cursor-spacing="40"
></textarea> ></textarea>
<view class="footer"> <view class="footer">
<view class="cancel" bind:tap="handleCancel">取消</view> <view class="cancel" bind:tap="handleCancel">取消</view>

3
src/pages/my/index.ts

@ -33,8 +33,7 @@ Page({
}).then((res) => { }).then((res) => {
this.setData({ this.setData({
showPatient: res === '1', showPatient: res === '1',
})
this.getApplyWord()
}) })
}, },
getApplyWord() { getApplyWord() {

79
src/patient/pages/inhibitorsManage/index.ts

@ -14,17 +14,15 @@ Page({
type: '', type: '',
dosage: '', dosage: '',
dosageUnit: '', dosageUnit: '',
dosageUnitName: '',
dosageUnitIndex: 0,
unitRange: [ drugUnitList: [] as any,
{ dict: {
id: '1', drugTypeList: {},
name: 'mg/天', drugUnitList: {},
}, drugList: {},
{ },
id: '2',
name: 'IU/天',
},
],
}, },
onLoad(options) { onLoad(options) {
console.log('DEBUGPRINT[71]: index.ts:29: options=', options) console.log('DEBUGPRINT[71]: index.ts:29: options=', options)
@ -44,7 +42,16 @@ Page({
url: '?r=wtx/treatment/get-dict', url: '?r=wtx/treatment/get-dict',
data: {}, data: {},
}).then((res) => { }).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) { getDetail(id: string) {
@ -59,17 +66,41 @@ Page({
}) })
}, },
handleDrug() { handleDrug() {
console.log(111) const { dict } = this.data
this.setData({ this.setData({
popupShow: true, popupShow: true,
popupType: 'inhibitors', popupType: 'inhibitors',
popupParams: { popupParams: {
close: true, 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({ this.setData({
popupShow: false, popupShow: false,
}) })
@ -79,7 +110,25 @@ Page({
popupShow: false, 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() { handleDel() {
const { recordId } = this.data const { recordId } = this.data
wx.ajax({ wx.ajax({

15
src/patient/pages/inhibitorsManage/index.wxml

@ -15,8 +15,15 @@
<view class="label">用药方式</view> <view class="label">用药方式</view>
<view class="container"> <view class="container">
<view class="select select2"> <view class="select select2">
<view class="s-item active">口服</view> <view
<view class="s-item">注射</view> class="s-item {{type == index && 'active'}}"
wx:for="{{dict.drugTypeList}}"
wx:key="index"
data-id="{{index}}"
bind:tap="handleSelect"
>
{{item}}
</view>
</view> </view>
</view> </view>
</view> </view>
@ -31,9 +38,9 @@
model:value="{{dosage}}" model:value="{{dosage}}"
placeholder="请输入" placeholder="请输入"
/> />
<picker mode="selector" model:value="{{dosageUnit}}" range="{{unitRange}}" range-key="name" class="date"> <picker mode="selector" value="{{dosageUnitIndex}}" range="{{drugUnitList}}" range-key="value" class="date" bind:change="handleChange">
<view class="date-content"> <view class="date-content">
<view class="content" data-place="请选择">mg/天</view> <view class="content" data-place="请选择">{{dosageUnitName}}</view>
<van-icon name="arrow-down" /> <van-icon name="arrow-down" />
</view> </view>
</picker> </picker>

Loading…
Cancel
Save