Browse Source

3.0 联调

2.0
kola-web 1 week 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({ @@ -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({ @@ -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({ @@ -70,5 +94,13 @@ Component({
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 @@ @@ -194,18 +194,33 @@
<view class="container">
<view class="title">请选择您的免疫抑制剂</view>
<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">
<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 class="content">泼尼松</view>
<view class="content">{{item}}</view>
</view>
</view>
<textarea
wx:if="{{inhibitorsName == '其他'}}"
focus="{{inhibitorsName == '其他'}}"
class="texcarea"
model:value="{{inhibitorsContent}}"
placeholder-style="color:rgba(207, 209, 213, 1)"
placeholder="请输入您的药品名称"
disable-default-padding
cursor-spacing="40"
></textarea>
<view class="footer">
<view class="cancel" bind:tap="handleCancel">取消</view>

3
src/pages/my/index.ts

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

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

@ -14,17 +14,15 @@ Page({ @@ -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({ @@ -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({ @@ -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({ @@ -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({

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

@ -15,8 +15,15 @@ @@ -15,8 +15,15 @@
<view class="label">用药方式</view>
<view class="container">
<view class="select select2">
<view class="s-item active">口服</view>
<view class="s-item">注射</view>
<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>
@ -31,9 +38,9 @@ @@ -31,9 +38,9 @@
model:value="{{dosage}}"
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="content" data-place="请选择">mg/天</view>
<view class="content" data-place="请选择">{{dosageUnitName}}</view>
<van-icon name="arrow-down" />
</view>
</picker>

Loading…
Cancel
Save