图片组件跟患者列表
This commit is contained in:
@@ -16,6 +16,7 @@ export struct MyOpinionComp {
|
||||
@State photos: string[] = []
|
||||
@State previewIndex: number = -1
|
||||
@State maxSelectNumber: number = 6
|
||||
|
||||
private photoSheetDialog!: CustomDialogController;
|
||||
@State
|
||||
@Watch('onRemoveImg')
|
||||
@@ -36,7 +37,8 @@ export struct MyOpinionComp {
|
||||
onRemoveImg()
|
||||
{
|
||||
this.photos.splice(this.removeIndex, 1)
|
||||
this.maxSelectNumber = this.maxSelectNumber - this.photos.length;
|
||||
this.maxSelectNumber =6- this.photos.length;
|
||||
let a= this.maxSelectNumber
|
||||
}
|
||||
private custom!:CustomDialogController;
|
||||
dialog: CustomDialogController = new CustomDialogController({
|
||||
@@ -89,8 +91,7 @@ export struct MyOpinionComp {
|
||||
}
|
||||
|
||||
this.photos.push(...selectedUris);
|
||||
this.maxSelectNumber = this.maxSelectNumber - this.photos.length;
|
||||
|
||||
this.maxSelectNumber = 6- this.photos.length;
|
||||
|
||||
}
|
||||
|
||||
@@ -112,7 +113,7 @@ export struct MyOpinionComp {
|
||||
if(this.params.myAnswer.imgs!=null)
|
||||
{
|
||||
this.photos.push(...this.changeToImgs(this.params.myAnswer.imgs.split(",")))
|
||||
this.maxSelectNumber = this.maxSelectNumber - this.photos.length;
|
||||
this.maxSelectNumber = 6- this.photos.length;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,19 @@
|
||||
import { authStore, BasicConstant, hdHttp, HdLoadingDialog,HdNav, HdResponse, patientDbManager,
|
||||
import {
|
||||
applyListCallBacl,
|
||||
applyListModel,
|
||||
authStore, BasicConstant,
|
||||
ChangeUtil,
|
||||
hdHttp, HdLoadingDialog,HdNav, HdResponse, patientDbManager,
|
||||
PatientListModel,
|
||||
PatientsData} from '@itcast/basic'
|
||||
PatientsData,
|
||||
preferenceStore} from '@itcast/basic'
|
||||
import { Groups } from '../model/Groups';
|
||||
import { display } from '@kit.ArkUI';
|
||||
import { StringIsEmpty } from '@nimkit/common';
|
||||
import I18n from '@ohos.i18n';
|
||||
import Intl from '@ohos.intl';
|
||||
import { BusinessError } from '@kit.BasicServicesKit';
|
||||
|
||||
let collator = new Intl.Collator(I18n.System.getSystemLocale(), {
|
||||
usage: 'sort',
|
||||
collation: 'pinyin',
|
||||
@@ -22,18 +30,51 @@ export struct PatientListComp {
|
||||
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '#']
|
||||
|
||||
private indexUtil = I18n.getInstance(I18n.System.getSystemLocale());
|
||||
|
||||
displayClass = display.getDefaultDisplaySync()
|
||||
@State alphabetSelected: number = 0
|
||||
dialog: CustomDialogController = new CustomDialogController({
|
||||
builder: HdLoadingDialog({ message: '加载中...' }),
|
||||
customStyle: true,
|
||||
alignment: DialogAlignment.Center
|
||||
})
|
||||
|
||||
@State count: number = 0
|
||||
@State total: number = 0
|
||||
@State old:number=preferenceStore.getItemNumber('old_patient_num')
|
||||
@State applyArray:applyListModel[] = [];
|
||||
@State needShow:boolean=false
|
||||
aboutToAppear() {
|
||||
this. PatientsData()
|
||||
|
||||
this.loadPatients()
|
||||
this.getApplyList()
|
||||
}
|
||||
getApplyList() {
|
||||
this.dialog.open()
|
||||
hdHttp.post<string>(BasicConstant.applyList, {
|
||||
expertUuid: authStore.getUser().uuid,
|
||||
} as updateExtraData).then(async (res: HdResponse<string>) => {
|
||||
this.dialog.close();
|
||||
let json:applyListCallBacl = JSON.parse(res+'') as applyListCallBacl;
|
||||
if(json.code == 1) {
|
||||
this.applyArray = json.data;
|
||||
if( this.applyArray!=null)
|
||||
{
|
||||
this.applyArray.forEach( item=>{
|
||||
if(1==item.status)
|
||||
{
|
||||
this.count++
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
}).catch((err: BusinessError) => {
|
||||
this.dialog.close();
|
||||
|
||||
console.info(`Response fails: ${err}`);
|
||||
})
|
||||
}
|
||||
|
||||
PatientsData()
|
||||
@@ -47,7 +88,32 @@ export struct PatientListComp {
|
||||
console.log('服务器返回的患者数据:', json);
|
||||
if(json.data!=null)
|
||||
{
|
||||
this.collationData(json.data);
|
||||
// let regionRequestData: PatientsData[]=[...json.data]
|
||||
// regionRequestData =[...json.data]
|
||||
// regionRequestData.push(...json.data)
|
||||
// regionRequestData.push(...json.data)
|
||||
// regionRequestData.push(...json.data)
|
||||
// regionRequestData.push(...json.data)
|
||||
// regionRequestData.push(...json.data)
|
||||
// regionRequestData.push(...json.data)
|
||||
// regionRequestData.push(...json.data)
|
||||
// regionRequestData.push(...json.data)
|
||||
// regionRequestData.push(...json.data)
|
||||
// regionRequestData.push(...json.data)
|
||||
// regionRequestData.push(...json.data)
|
||||
// this.collationData(regionRequestData);
|
||||
if(json.data!=null&&json.data.length>0)
|
||||
{
|
||||
this.total=json.data.length
|
||||
if(this.old<this.total/10)
|
||||
{
|
||||
this.needShow=true
|
||||
preferenceStore.setItemNumber('old_patient_num',this.total/10)
|
||||
}
|
||||
this.collationData(json.data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +143,6 @@ export struct PatientListComp {
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.justifyContent(FlexAlign.Start)
|
||||
.backgroundColor($r('sys.color.ohos_id_color_panel_bg'))
|
||||
// .enabled(this.selectState)
|
||||
.height(40)
|
||||
.width('100%')
|
||||
.padding({ left: 15,})
|
||||
@@ -89,8 +154,7 @@ export struct PatientListComp {
|
||||
|
||||
Column() {
|
||||
HdNav({ title: '患者消息', showRightIcon: true, showLeftIcon: true,showRightText:false,rightIcon:$r('app.media.selected_hospital_ws')})
|
||||
Stack({ alignContent: Alignment.TopEnd }) {
|
||||
Column() {
|
||||
Stack({ }) {
|
||||
List({ scroller: this.scroller, space: 0, initialIndex: 0 }) {
|
||||
ListItem() {
|
||||
Column()
|
||||
@@ -110,7 +174,7 @@ export struct PatientListComp {
|
||||
.maxLines(1)
|
||||
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
||||
.ellipsisMode(EllipsisMode.END)
|
||||
Text('(待审核'+'人)')
|
||||
Text('(待审核'+this.count+'人)')
|
||||
.fontSize(16)
|
||||
.fontColor(Color.Red)
|
||||
.layoutWeight(1)
|
||||
@@ -119,8 +183,9 @@ export struct PatientListComp {
|
||||
.maxLines(1)
|
||||
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
||||
.ellipsisMode(EllipsisMode.END)
|
||||
|
||||
.visibility(this.count>0?Visibility.Visible:Visibility.Hidden)
|
||||
}.layoutWeight(1)
|
||||
|
||||
.align(Alignment.Start)
|
||||
|
||||
Column()
|
||||
@@ -136,7 +201,7 @@ export struct PatientListComp {
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.padding({ top:10,bottom:10})
|
||||
.width('100%')
|
||||
Text().height(0.5).backgroundColor($r('sys.color.ohos_id_color_list_separator')).width('100%')
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -162,7 +227,7 @@ export struct PatientListComp {
|
||||
.maxLines(1)
|
||||
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
||||
.ellipsisMode(EllipsisMode.END)
|
||||
Text('(随访'+'人)')
|
||||
Text('(随访'+this.total+'人)')
|
||||
.fontSize(16)
|
||||
.fontColor(Color.Red)
|
||||
.layoutWeight(1)
|
||||
@@ -171,7 +236,7 @@ export struct PatientListComp {
|
||||
.maxLines(1)
|
||||
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
||||
.ellipsisMode(EllipsisMode.END)
|
||||
|
||||
.visibility(this.total>0?Visibility.Visible:Visibility.Hidden)
|
||||
}.layoutWeight(1)
|
||||
.align(Alignment.Start)
|
||||
|
||||
@@ -197,101 +262,76 @@ export struct PatientListComp {
|
||||
ForEach(this.regionDataGroupsList, (regionDataGroups: Groups, index) => {
|
||||
|
||||
ListItemGroup({ header: this.itemHead(regionDataGroups.title) }) {
|
||||
ListItem() {
|
||||
List() {
|
||||
|
||||
ForEach(regionDataGroups.regionDataList, (regionData: PatientsData, index?: number) => {
|
||||
ListItem() {
|
||||
Row() {
|
||||
Image(BasicConstant.urlHtml+regionData.photo)
|
||||
.alt($r('app.media.userPhoto_default'))
|
||||
.width(50)
|
||||
.height(50)
|
||||
.margin({ left:10 })
|
||||
.borderRadius(8)
|
||||
Column()
|
||||
{
|
||||
Text(regionData.realName)
|
||||
.fontSize(16)
|
||||
.fontColor($r('app.color.common_gray_01'))
|
||||
.width('100%')
|
||||
.textAlign(TextAlign.Start)
|
||||
.padding({left:10,right:10})
|
||||
.maxLines(1)
|
||||
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
||||
.ellipsisMode(EllipsisMode.END)
|
||||
Text(regionData.diagnosis?regionData.diagnosis.includes("甲、乙、丙、丁") ? '肝炎' :regionData.diagnosis:'')
|
||||
.fontSize(12)
|
||||
.borderColor($r('app.color.top_title'))
|
||||
.fontColor($r('app.color.top_title'))
|
||||
.padding({left:8,right:8,top:3,bottom:3})
|
||||
.borderRadius(17)
|
||||
.borderWidth(1)
|
||||
.textAlign(TextAlign.Center)
|
||||
.margin({top:5,left:10})
|
||||
.visibility(regionData.diagnosis?Visibility.Visible:Visibility.None)
|
||||
.alignSelf(ItemAlign.Start)
|
||||
|
||||
}.layoutWeight(1)
|
||||
.align(Alignment.Start)
|
||||
|
||||
Column()
|
||||
{
|
||||
Image($r('app.media.edit_patitent'))
|
||||
.width(24)
|
||||
.height(24)
|
||||
Column()
|
||||
{
|
||||
Row() {
|
||||
Image(BasicConstant.urlHtml+regionData.photo)
|
||||
.alt($r('app.media.userPhoto_default'))
|
||||
.width(50)
|
||||
.height(50)
|
||||
.margin({ left:10 })
|
||||
.alignSelf(ItemAlign.End)
|
||||
.borderRadius(8)
|
||||
Column()
|
||||
{
|
||||
Text(regionData.realName)
|
||||
.fontSize(16)
|
||||
.fontColor($r('app.color.common_gray_01'))
|
||||
.width('100%')
|
||||
.textAlign(TextAlign.Start)
|
||||
.padding({left:10,right:10})
|
||||
.maxLines(1)
|
||||
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
||||
.ellipsisMode(EllipsisMode.END)
|
||||
Text(regionData.diagnosis?regionData.diagnosis.includes("甲、乙、丙、丁") ? '肝炎' :regionData.diagnosis:'')
|
||||
.fontSize(12)
|
||||
.borderColor($r('app.color.top_title'))
|
||||
.fontColor($r('app.color.top_title'))
|
||||
.padding({left:8,right:8,top:3,bottom:3})
|
||||
.borderRadius(17)
|
||||
.borderWidth(1)
|
||||
.textAlign(TextAlign.Center)
|
||||
.margin({top:5,left:10})
|
||||
.visibility(regionData.diagnosis?Visibility.Visible:Visibility.None)
|
||||
.alignSelf(ItemAlign.Start)
|
||||
|
||||
Text(regionData.join_date ?"随访于"+ regionData.join_date.split(" ")[0] :'')
|
||||
.fontSize(12)
|
||||
.fontColor($r('app.color.666666'))
|
||||
.margin({top:5})
|
||||
.textAlign(TextAlign.Center)
|
||||
.visibility(regionData.join_date?Visibility.Visible:Visibility.None)
|
||||
}.layoutWeight(1)
|
||||
.align(Alignment.Start)
|
||||
|
||||
}.align(Alignment.End).padding({right:30})
|
||||
Column()
|
||||
{
|
||||
Image($r('app.media.edit_patitent'))
|
||||
.width(24)
|
||||
.height(24)
|
||||
.margin({ left:10 })
|
||||
.alignSelf(ItemAlign.End)
|
||||
|
||||
Text(regionData.join_date ?"随访于"+ regionData.join_date.split(" ")[0] :'')
|
||||
.fontSize(12)
|
||||
.fontColor($r('app.color.666666'))
|
||||
.margin({top:5})
|
||||
.textAlign(TextAlign.Center)
|
||||
.visibility(regionData.join_date?Visibility.Visible:Visibility.None)
|
||||
|
||||
}.align(Alignment.End).padding({right:30})
|
||||
}
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.padding({ top:10,bottom:10})
|
||||
.width('100%')
|
||||
Text().height(1).width('100%').backgroundColor( $r('sys.color.ohos_id_color_panel_bg'))
|
||||
}
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.padding({ top:10,bottom:10})
|
||||
.width('100%')
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// .height(100)
|
||||
.width('100%')
|
||||
.align(Alignment.Start)
|
||||
.onClick(() => {
|
||||
// // 暂不选择需要退出
|
||||
// if (regionData.name === this.noSelect) {
|
||||
// this.selectedRegion = '';
|
||||
// // 页面返回
|
||||
// return;
|
||||
// }
|
||||
// this.selectedRegion = regionData.name;
|
||||
// this.selectState = false;
|
||||
// if (this.pageLevel < 4) {
|
||||
// this.pageLevel++;
|
||||
// }
|
||||
// let regionData1 = this.getData('data2');
|
||||
// if (this.pageLevel > 1) {
|
||||
// regionData1 = this.getData('data3');
|
||||
// }
|
||||
// if (regionData1.regionInfos.length === 0) {
|
||||
// return;
|
||||
// }
|
||||
// if (this.pageLevel < 4) {
|
||||
// this.collationData(regionData1, false);
|
||||
// }
|
||||
|
||||
})
|
||||
})
|
||||
}
|
||||
.divider({
|
||||
strokeWidth: 0.5,
|
||||
color: $r('sys.color.ohos_id_color_list_separator'),
|
||||
startMargin: 0,
|
||||
endMargin: 0
|
||||
})
|
||||
.width('100%')
|
||||
}
|
||||
.width('100%')
|
||||
|
||||
}
|
||||
.width('100%')
|
||||
@@ -300,21 +340,30 @@ export struct PatientListComp {
|
||||
|
||||
}
|
||||
.sticky(StickyStyle.None)
|
||||
.divider({
|
||||
strokeWidth: 1,
|
||||
color: $r('sys.color.ohos_id_color_panel_bg'),
|
||||
startMargin: 0,
|
||||
endMargin: 0
|
||||
})
|
||||
.onScrollIndex((start: number, end: number) => {
|
||||
if(start<3)
|
||||
{
|
||||
start=0
|
||||
}
|
||||
else
|
||||
{
|
||||
start=start-2
|
||||
}
|
||||
let target = this.indexList[start]
|
||||
let indexList = this.normalIndexValue;
|
||||
let index = this.searchIndex(indexList, target)
|
||||
this.alphabetSelected = index === -1 ? this.onSlideList(indexList, target) - 1 : index;
|
||||
|
||||
})
|
||||
.layoutWeight(1)
|
||||
.width('100%')
|
||||
.scrollBar(BarState.Off)
|
||||
// Text().height(56).width('100%')
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
|
||||
Column() {
|
||||
AlphabetIndexer({
|
||||
arrayValue: this.normalIndexValue,
|
||||
selected: 0
|
||||
@@ -329,26 +378,17 @@ export struct PatientListComp {
|
||||
let pos = 0
|
||||
let useValue = this.normalIndexValue
|
||||
let currentWord = useValue[index] // 在右侧索引上的位置
|
||||
if (currentWord === '·') { // 在右侧索引上的位置 刚号是点,则需要找右侧索引上一个字母
|
||||
|
||||
let beforeWord = useValue[index - 1]; // 这个是右侧索引点的上一个字母
|
||||
let afterWord = useValue[index + 1];
|
||||
pos = this.searchIndex(this.indexList, currentWord)
|
||||
|
||||
pos = this.onClickPointIndex(this.indexList, beforeWord, afterWord)
|
||||
} else {
|
||||
pos = this.searchIndex(this.indexList, currentWord)
|
||||
}
|
||||
if (pos === -1) {
|
||||
return;
|
||||
}
|
||||
this.scroller.scrollToIndex(pos);
|
||||
this.scroller.scrollToIndex(pos+2);
|
||||
})
|
||||
.id('id_hwid_region_choose_alphabetIndexer')
|
||||
.onAreaChange((oldValue: Area, newValue: Area) => {
|
||||
// 获取屏幕对象
|
||||
let displayObj: display.Display = display.getDefaultDisplaySync();
|
||||
// 获取屏幕高度
|
||||
let displayHeight: number = displayObj.height / displayObj.densityPixels;
|
||||
|
||||
})
|
||||
.itemSize('20')
|
||||
.font({ size: '20vp' })
|
||||
@@ -356,13 +396,27 @@ export struct PatientListComp {
|
||||
size: '20vp', style: FontStyle.Normal,
|
||||
weight: FontWeight.Bolder
|
||||
})
|
||||
.position({ x: this.displayClass.width / this.displayClass.densityPixels - 25 }) // 侧边栏位置
|
||||
|
||||
Column()
|
||||
{
|
||||
Image($r('app.media.close')).width(40).height(40).margin({right:50,top:60})
|
||||
.position({x:this.displayClass.width / this.displayClass.densityPixels-50,y:60})
|
||||
.onClick(()=>{
|
||||
this.needShow=false
|
||||
})
|
||||
|
||||
}
|
||||
.visibility(this.needShow?Visibility.Visible:Visibility.None)
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.backgroundColor(Color.Transparent)
|
||||
.backgroundImageSize(ImageSize.Contain)
|
||||
.backgroundImagePosition(Alignment.Center)
|
||||
.backgroundImage($r('app.media.patientgif'))
|
||||
.backgroundColor('#44444444')
|
||||
}
|
||||
.layoutWeight(1)
|
||||
|
||||
.width('100%')
|
||||
|
||||
}.width('100%')
|
||||
.height('100%')
|
||||
@@ -388,17 +442,21 @@ export struct PatientListComp {
|
||||
this.regionDataGroupsList = [];
|
||||
this.regionInfo.forEach((value: PatientsData) => {
|
||||
let index = this.indexUtil.getIndex(value.nickname);
|
||||
if(!ChangeUtil.isLetter(index))
|
||||
{
|
||||
index='#'
|
||||
}
|
||||
|
||||
if (this.indexList.indexOf(index) === -1) {
|
||||
let regionDataGroups: Groups = new Groups();
|
||||
if(this.normalIndexValue.includes(index))
|
||||
{
|
||||
// if(this.normalIndexValue.includes(index))
|
||||
// {
|
||||
regionDataGroups.title = index;
|
||||
}
|
||||
else
|
||||
{
|
||||
regionDataGroups.title = '#';
|
||||
}
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// regionDataGroups.title = '#';
|
||||
// }
|
||||
|
||||
this.indexList.push(index);
|
||||
regionDataGroups.regionDataList.push(value);
|
||||
@@ -408,6 +466,10 @@ export struct PatientListComp {
|
||||
|
||||
}
|
||||
})
|
||||
if( this.indexList.length>0&&!ChangeUtil.isLetter(this.indexList[0]))
|
||||
{
|
||||
ChangeUtil.moveFirstToEnd(this.indexList)
|
||||
}
|
||||
this.regionDataGroupsList.sort((a, b) => {
|
||||
return this.normalIndexValue.indexOf(a.title) - this.normalIndexValue.indexOf(b.title);
|
||||
});
|
||||
@@ -420,15 +482,7 @@ export struct PatientListComp {
|
||||
}
|
||||
private onSlideList(indexList: string[], target: string): number {
|
||||
for (let i = 1; i < indexList.length; i++) {
|
||||
if (indexList[i] > target && indexList[i] !== '·') {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
private onClickPointIndex(indexList: string[], beforeWord: string, afterWord: string): number {
|
||||
for (let i = 1; i < indexList.length; i++) {
|
||||
if (indexList[i] > beforeWord && indexList[i] < afterWord) {
|
||||
if (indexList[i] > target ) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user