正在显示
13 个修改的文件
包含
283 行增加
和
104 行删除
不能预览此文件类型
| @@ -157,6 +157,8 @@ export interface addParamsType { | @@ -157,6 +157,8 @@ export interface addParamsType { | ||
| 157 | technicalDirector?: string | null | 157 | technicalDirector?: string | null |
| 158 | technicalDirectorId?: string | 158 | technicalDirectorId?: string |
| 159 | undeGroundLayers?: string | null | 159 | undeGroundLayers?: string | null |
| 160 | + city?: string | ||
| 161 | + county?: string | ||
| 160 | } | 162 | } |
| 161 | 163 | ||
| 162 | export interface projectType{ | 164 | export interface projectType{ |
| @@ -206,8 +208,8 @@ export interface reportDetailData { | @@ -206,8 +208,8 @@ export interface reportDetailData { | ||
| 206 | allowPerson?: null; | 208 | allowPerson?: null; |
| 207 | state: string; | 209 | state: string; |
| 208 | reportType: string; | 210 | reportType: string; |
| 209 | - city?: null; | ||
| 210 | - county?: null; | 211 | + city?: string; |
| 212 | + county?: string; | ||
| 211 | projectNature?: null; | 213 | projectNature?: null; |
| 212 | reportTime: string; | 214 | reportTime: string; |
| 213 | contractId?: null; | 215 | contractId?: null; |
| @@ -2,7 +2,8 @@ import { useCascadeAreaData } from '../utils/getArea' | @@ -2,7 +2,8 @@ import { useCascadeAreaData } from '../utils/getArea' | ||
| 2 | 2 | ||
| 3 | @Component | 3 | @Component |
| 4 | export default struct AreaPicker { | 4 | export default struct AreaPicker { |
| 5 | - @State cascade: TextCascadePickerRangeContent[] = useCascadeAreaData() //省市区列表数据 | 5 | + @Prop provinceValue: string |
| 6 | + @State cascade: TextCascadePickerRangeContent[] = useCascadeAreaData(this.provinceValue) //省市区列表数据 | ||
| 6 | @Link value: string[] //选中值例如:['北京市','北京市','东城区'] | 7 | @Link value: string[] //选中值例如:['北京市','北京市','东城区'] |
| 7 | private onChange: (value: string[], index: number[]) => void = () => { | 8 | private onChange: (value: string[], index: number[]) => void = () => { |
| 8 | } //选择改变回调函数 | 9 | } //选择改变回调函数 |
| @@ -4,6 +4,7 @@ import AreaPicker from '../components/AreaPicker' | @@ -4,6 +4,7 @@ import AreaPicker from '../components/AreaPicker' | ||
| 4 | export default struct AreaPickerDialog { | 4 | export default struct AreaPickerDialog { |
| 5 | private dialogController: CustomDialogController //弹窗控制器 | 5 | private dialogController: CustomDialogController //弹窗控制器 |
| 6 | @State value: string[] = [] //选中值 | 6 | @State value: string[] = [] //选中值 |
| 7 | + @Prop provinceValue: string = '' // 单选某个省份是市、区/县 | ||
| 7 | //确认关闭选择改变回调 | 8 | //确认关闭选择改变回调 |
| 8 | onChange: (value: string[]) => void = () => { | 9 | onChange: (value: string[]) => void = () => { |
| 9 | } | 10 | } |
| @@ -13,7 +14,7 @@ export default struct AreaPickerDialog { | @@ -13,7 +14,7 @@ export default struct AreaPickerDialog { | ||
| 13 | //记录打开时候的默认值 | 14 | //记录打开时候的默认值 |
| 14 | this.defaultValue = this.value | 15 | this.defaultValue = this.value |
| 15 | if (Array.isArray(this.value) && this.value.length < 3) { | 16 | if (Array.isArray(this.value) && this.value.length < 3) { |
| 16 | - this.value = ['北京市', '北京市', '东城区']; //设置默认值 | 17 | + this.value = ['广西壮族自治区','南宁市','青秀区']; //设置默认值 |
| 17 | } | 18 | } |
| 18 | } | 19 | } |
| 19 | 20 | ||
| @@ -41,7 +42,7 @@ export default struct AreaPickerDialog { | @@ -41,7 +42,7 @@ export default struct AreaPickerDialog { | ||
| 41 | .justifyContent(FlexAlign.SpaceBetween) | 42 | .justifyContent(FlexAlign.SpaceBetween) |
| 42 | 43 | ||
| 43 | //地区选择器 | 44 | //地区选择器 |
| 44 | - AreaPicker({ value: this.value }) | 45 | + AreaPicker({ value: this.value, provinceValue: this.provinceValue }) |
| 45 | } | 46 | } |
| 46 | .backgroundColor(Color.White) | 47 | .backgroundColor(Color.White) |
| 47 | .borderRadius(24) | 48 | .borderRadius(24) |
| @@ -11,7 +11,7 @@ import { | @@ -11,7 +11,7 @@ import { | ||
| 11 | } from '@csj/openadsdk' | 11 | } from '@csj/openadsdk' |
| 12 | import { UIUtil } from '../mediation_adtype/tools/UIUtil' | 12 | import { UIUtil } from '../mediation_adtype/tools/UIUtil' |
| 13 | import { PrintBiddingTokenUtils } from '../mediation_adtype/test/PrintBiddintTokenUtils' | 13 | import { PrintBiddingTokenUtils } from '../mediation_adtype/test/PrintBiddintTokenUtils' |
| 14 | -import { window, promptAction, router } from '@kit.ArkUI' | 14 | +import { window, router } from '@kit.ArkUI' |
| 15 | import { DemoConstants } from '../entryability/DemoConstants' | 15 | import { DemoConstants } from '../entryability/DemoConstants' |
| 16 | 16 | ||
| 17 | import('./SplashAdShowPage') | 17 | import('./SplashAdShowPage') |
| @@ -100,7 +100,11 @@ export struct SplashAdDemoPage { | @@ -100,7 +100,11 @@ export struct SplashAdDemoPage { | ||
| 100 | } | 100 | } |
| 101 | aboutToAppear(){ | 101 | aboutToAppear(){ |
| 102 | let adSlot = new AdSlotBuilder() | 102 | let adSlot = new AdSlotBuilder() |
| 103 | +<<<<<<< HEAD | ||
| 104 | + .setCodeId("103438700") | ||
| 105 | +======= | ||
| 103 | .setCodeId("103397742") | 106 | .setCodeId("103397742") |
| 107 | +>>>>>>> 2191e70067b776ee401629441f16bd4644393902 | ||
| 104 | .setAcceptSize(adWidth, | 108 | .setAcceptSize(adWidth, |
| 105 | adHeight) | 109 | adHeight) |
| 106 | .build() | 110 | .build() |
| @@ -149,14 +153,17 @@ export struct SplashAdDemoPage { | @@ -149,14 +153,17 @@ export struct SplashAdDemoPage { | ||
| 149 | onDidClick: () => { | 153 | onDidClick: () => { |
| 150 | console.log("开屏回调 - onDidClick") | 154 | console.log("开屏回调 - onDidClick") |
| 151 | router.pushUrl({ url: "pages/Login"}) | 155 | router.pushUrl({ url: "pages/Login"}) |
| 156 | + this.closeWin() | ||
| 152 | }, | 157 | }, |
| 153 | 158 | ||
| 154 | onVideoDidPlayFinish: () => { | 159 | onVideoDidPlayFinish: () => { |
| 155 | console.log("开屏回调 - onVideoDidPlayFinish") | 160 | console.log("开屏回调 - onVideoDidPlayFinish") |
| 161 | + this.closeWin() | ||
| 156 | }, | 162 | }, |
| 157 | 163 | ||
| 158 | onVideoDidPlayFail: () => { | 164 | onVideoDidPlayFail: () => { |
| 159 | console.log("开屏回调 - onVideoDidPlayFail") | 165 | console.log("开屏回调 - onVideoDidPlayFail") |
| 166 | + this.closeWin() | ||
| 160 | } | 167 | } |
| 161 | } | 168 | } |
| 162 | } | 169 | } |
| @@ -12,14 +12,26 @@ import { | @@ -12,14 +12,26 @@ import { | ||
| 12 | RecordsList | 12 | RecordsList |
| 13 | } from '../api/recordsType' | 13 | } from '../api/recordsType' |
| 14 | import NavHeader from '../components/NavHeader' | 14 | import NavHeader from '../components/NavHeader' |
| 15 | +import AreaPickerDialog from '../dialog/AreaPickerDialog' | ||
| 16 | +import LoadingDialog from '../dialog/LoadingDialog' | ||
| 15 | import { quarterType, quarterTest } from '../api/options/optionsType' | 17 | import { quarterType, quarterTest } from '../api/options/optionsType' |
| 16 | import { getMaintenanceType, getLatestProjectList, getEquipmentList, addRecords, getCompanyPersonList, getReportDetail, updateRecords, getRecordsList } from '../api/originalRecords' | 18 | import { getMaintenanceType, getLatestProjectList, getEquipmentList, addRecords, getCompanyPersonList, getReportDetail, updateRecords, getRecordsList } from '../api/originalRecords' |
| 17 | import { AxiosResponse } from '@ohos/axios' | 19 | import { AxiosResponse } from '@ohos/axios' |
| 18 | import preferencesUtil from '../utils/preferences' | 20 | import preferencesUtil from '../utils/preferences' |
| 19 | import { router, promptAction } from '@kit.ArkUI' | 21 | import { router, promptAction } from '@kit.ArkUI' |
| 22 | +import { Color } from '@ohasasugar/hp-richtext/src/main/ets/common/types/artUIEnum' | ||
| 23 | + | ||
| 20 | interface routerParams { | 24 | interface routerParams { |
| 21 | reportId: number | 25 | reportId: number |
| 22 | } | 26 | } |
| 27 | +interface comprehensiveType { | ||
| 28 | + range: string; | ||
| 29 | + facility: string; | ||
| 30 | + existingProblem: string; | ||
| 31 | + cumulativeIssues: string; | ||
| 32 | + correctedProblems: string; | ||
| 33 | + other: string; | ||
| 34 | +} | ||
| 23 | let params = router.getParams() as routerParams | 35 | let params = router.getParams() as routerParams |
| 24 | let reportId: number | undefined = params?.reportId | 36 | let reportId: number | undefined = params?.reportId |
| 25 | // 查看原始记录编号是否存在 | 37 | // 查看原始记录编号是否存在 |
| @@ -45,9 +57,54 @@ function searchByIndexOf(keyWord: string, list: equipmentType[]){ | @@ -45,9 +57,54 @@ function searchByIndexOf(keyWord: string, list: equipmentType[]){ | ||
| 45 | return arr; | 57 | return arr; |
| 46 | } | 58 | } |
| 47 | 59 | ||
| 60 | +// 提取的富文本内容分别赋值 | ||
| 61 | +function multiply(range: string, facility: string, existingProblem: string,cumulativeIssues:string, correctedProblems: string, ...other: string[]){ | ||
| 62 | + let otherValue: string = other.length > 1 ? other?.slice(1).join('、') : other[0].slice(3) | ||
| 63 | + let newObj:comprehensiveType = { | ||
| 64 | + range: range.split(':')[1], | ||
| 65 | + facility: facility.split(':')[1], | ||
| 66 | + existingProblem: existingProblem.split(':')[1], | ||
| 67 | + cumulativeIssues: cumulativeIssues.split(':')[1], | ||
| 68 | + correctedProblems: correctedProblems.split(':')[1], | ||
| 69 | + other: otherValue | ||
| 70 | + } | ||
| 71 | + return newObj | ||
| 72 | +} | ||
| 73 | + | ||
| 74 | +// 提取富文本中的内容解析后导出 | ||
| 75 | +function extractRichText(str: string): comprehensiveType{ | ||
| 76 | + let richText = str.replace(/<.*?>/g, '?') | ||
| 77 | + let arrValue: string[] = richText.split('?').filter(item => item !== '') | ||
| 78 | + let otherArr: string[] = [] | ||
| 79 | + if(arrValue.length > 5){ | ||
| 80 | + for (let index = 5; index < arrValue.length; index++) { | ||
| 81 | + otherArr.push(arrValue[index]) | ||
| 82 | + } | ||
| 83 | + } | ||
| 84 | + return multiply(arrValue[0], arrValue[1], arrValue[2], arrValue[3], arrValue[4], ...otherArr) | ||
| 85 | +} | ||
| 86 | + | ||
| 87 | +// 提交修改时合并富文本内容 | ||
| 88 | +function mergeRichText(comprehensive: comprehensiveType): string{ | ||
| 89 | + let resStr = `<div>${'本月维保范围:' + comprehensive.range}</div><div style="margin-top: 6px;">${'维保设施包含:' + comprehensive.facility}</div><div style="margin-top: 6px;">${'存在问题:' + comprehensive.existingProblem}</div><div style="margin-top: 6px;">${'累计问题:' + comprehensive.cumulativeIssues}</div><div style="margin-top: 6px;">${'已整改问题:' + comprehensive.correctedProblems}</div>` | ||
| 90 | + if (comprehensive.other) { | ||
| 91 | + resStr += `<div style="margin-top: 6px;">${'其他:' + comprehensive.other}</div>` | ||
| 92 | + } | ||
| 93 | + return resStr | ||
| 94 | +} | ||
| 95 | +@Extend(Text) function TitleReview () { | ||
| 96 | + .fontColor('#000').fontSize(14).fontWeight(500) | ||
| 97 | +} | ||
| 98 | + | ||
| 99 | +@Extend(TextInput) function TextInputReview () { | ||
| 100 | + .width('100%').height(40).fontSize(14).fontColor('#999') | ||
| 101 | + .border({width: 1, color: '#eee'}).backgroundColor(Color.Transparent) | ||
| 102 | + .placeholderColor('#999').borderRadius(4).placeholderFont({size: 14}) | ||
| 103 | +} | ||
| 104 | + | ||
| 48 | @Entry | 105 | @Entry |
| 49 | @Component | 106 | @Component |
| 50 | -struct EditUser { | 107 | +struct AddRecords { |
| 51 | @Builder indicatorBuilder(icon: ResourceStr) { | 108 | @Builder indicatorBuilder(icon: ResourceStr) { |
| 52 | Image(icon) | 109 | Image(icon) |
| 53 | } | 110 | } |
| @@ -75,9 +132,19 @@ struct EditUser { | @@ -75,9 +132,19 @@ struct EditUser { | ||
| 75 | technicalDirectorId: '' | 132 | technicalDirectorId: '' |
| 76 | } | 133 | } |
| 77 | personId = preferencesUtil.get('XF_PERSON_ID', 0) | 134 | personId = preferencesUtil.get('XF_PERSON_ID', 0) |
| 135 | + @State pickerValue:string[] = ['广西壮族自治区','南宁市','青秀区']//省市区选中值 | ||
| 136 | + @State comprehensiveReview: comprehensiveType = { | ||
| 137 | + range: '', | ||
| 138 | + facility: '', | ||
| 139 | + existingProblem: '', | ||
| 140 | + cumulativeIssues: '', | ||
| 141 | + other: '', | ||
| 142 | + correctedProblems: '', | ||
| 143 | + } | ||
| 78 | // 回显数据使用 | 144 | // 回显数据使用 |
| 79 | @State viewEquipmentList: string[] = [] | 145 | @State viewEquipmentList: string[] = [] |
| 80 | @State fireFacilitiesList: string[] = [] | 146 | @State fireFacilitiesList: string[] = [] |
| 147 | + // 维保人员列表 | ||
| 81 | @State PeopleList: string[] = [] | 148 | @State PeopleList: string[] = [] |
| 82 | @State isEdit: boolean = false | 149 | @State isEdit: boolean = false |
| 83 | // 公司在职人员列表 | 150 | // 公司在职人员列表 |
| @@ -119,6 +186,8 @@ struct EditUser { | @@ -119,6 +186,8 @@ struct EditUser { | ||
| 119 | this.fireFacilitiesList = this.addForm.fireFacilities.split('、') | 186 | this.fireFacilitiesList = this.addForm.fireFacilities.split('、') |
| 120 | this.viewEquipmentList = result.equipment.split(',') | 187 | this.viewEquipmentList = result.equipment.split(',') |
| 121 | this.PeopleList = result.technicalDirectorId?.split(',') || [] | 188 | this.PeopleList = result.technicalDirectorId?.split(',') || [] |
| 189 | + this.pickerValue = ['广西壮族自治区', result.city as string, result.county as string] | ||
| 190 | + this.comprehensiveReview = extractRichText(result.result) | ||
| 122 | } | 191 | } |
| 123 | getMaintenanceType().then((res: AxiosResponse<quarterTest>) => { | 192 | getMaintenanceType().then((res: AxiosResponse<quarterTest>) => { |
| 124 | this.recordsType = res.data.data | 193 | this.recordsType = res.data.data |
| @@ -145,6 +214,28 @@ struct EditUser { | @@ -145,6 +214,28 @@ struct EditUser { | ||
| 145 | @State space: number = 8 | 214 | @State space: number = 8 |
| 146 | @State arrowPosition: ArrowPosition = ArrowPosition.END | 215 | @State arrowPosition: ArrowPosition = ArrowPosition.END |
| 147 | 216 | ||
| 217 | + // 选择区域弹窗 | ||
| 218 | + areaController: CustomDialogController = new CustomDialogController({ | ||
| 219 | + builder: AreaPickerDialog({ | ||
| 220 | + value:this.pickerValue,//首次默认选中值 | ||
| 221 | + provinceValue: '广西壮族自治区', | ||
| 222 | + onChange: (value:string[]) => {//选择改变回调 | ||
| 223 | + this.pickerValue = value | ||
| 224 | + this.addForm.city = value[1] | ||
| 225 | + this.addForm.county = value[2] | ||
| 226 | + } | ||
| 227 | + }), | ||
| 228 | + customStyle: true | ||
| 229 | + }) | ||
| 230 | + | ||
| 231 | + // 加载弹窗 | ||
| 232 | + loadingController: CustomDialogController = new CustomDialogController({ | ||
| 233 | + builder: LoadingDialog(), | ||
| 234 | + customStyle: true, | ||
| 235 | + offset: { dx: 0, dy: 0 }, | ||
| 236 | + alignment: DialogAlignment.Center, | ||
| 237 | + autoCancel: false | ||
| 238 | + }) | ||
| 148 | build() { | 239 | build() { |
| 149 | Column(){ | 240 | Column(){ |
| 150 | NavHeader({title: '添加原始记录'}) | 241 | NavHeader({title: '添加原始记录'}) |
| @@ -168,20 +259,25 @@ struct EditUser { | @@ -168,20 +259,25 @@ struct EditUser { | ||
| 168 | }.width(90) | 259 | }.width(90) |
| 169 | Row({ space: 5 }){ | 260 | Row({ space: 5 }){ |
| 170 | TextInput({placeholder: '请输入项目编号', text: $$this.addForm.reportNo}) | 261 | TextInput({placeholder: '请输入项目编号', text: $$this.addForm.reportNo}) |
| 171 | - .backgroundColor('#fff').showError(this.errorMsg).onBlur(async () => { | 262 | + .backgroundColor('#fff').showError(this.errorMsg) |
| 263 | + .onBlur(async () => { | ||
| 264 | + if(this.addForm.reportNo == '') { | ||
| 265 | + this.errorMsg = '请输入项目编号' | ||
| 266 | + } else { | ||
| 172 | this.errorMsg = await queryReportNo(this.addForm.reportNo as string) ? '此原始记录编号已被使用' : '' | 267 | this.errorMsg = await queryReportNo(this.addForm.reportNo as string) ? '此原始记录编号已被使用' : '' |
| 268 | + } | ||
| 173 | }) | 269 | }) |
| 174 | }.layoutWeight(1) | 270 | }.layoutWeight(1) |
| 175 | }.border({width: {bottom: 1}, color: '#eee'}).padding({top: 10, bottom: 10}) | 271 | }.border({width: {bottom: 1}, color: '#eee'}).padding({top: 10, bottom: 10}) |
| 176 | .visibility(this.isEdit ? Visibility.None : Visibility.Visible) | 272 | .visibility(this.isEdit ? Visibility.None : Visibility.Visible) |
| 273 | + // 编辑状态下项目编号不可修改 | ||
| 177 | Row(){ | 274 | Row(){ |
| 178 | Row(){ | 275 | Row(){ |
| 179 | Image($r('app.media.require')).width(20) | 276 | Image($r('app.media.require')).width(20) |
| 180 | Text('项目编号') | 277 | Text('项目编号') |
| 181 | }.width(90) | 278 | }.width(90) |
| 182 | Row({ space: 5 }){ | 279 | Row({ space: 5 }){ |
| 183 | - Text(this.addForm.reportNo).fontColor('#c0c4cc') | ||
| 184 | - .fontSize(16).padding({top: 8, bottom: 8, left: 16, right: 16}) | 280 | + Text(this.addForm.reportNo).padding({top: 8, bottom: 8, left: 16, right: 16}) |
| 185 | }.layoutWeight(1) | 281 | }.layoutWeight(1) |
| 186 | }.border({width: {bottom: 1}, color: '#eee'}).padding({top: 10, bottom: 10}) | 282 | }.border({width: {bottom: 1}, color: '#eee'}).padding({top: 10, bottom: 10}) |
| 187 | .visibility(this.isEdit ? Visibility.Visible : Visibility.None) | 283 | .visibility(this.isEdit ? Visibility.Visible : Visibility.None) |
| @@ -294,16 +390,17 @@ struct EditUser { | @@ -294,16 +390,17 @@ struct EditUser { | ||
| 294 | }.justifyContent(FlexAlign.Start).width('100%') | 390 | }.justifyContent(FlexAlign.Start).width('100%') |
| 295 | TextInput({placeholder: '请输入消防设施管理单位', text: $$this.addForm.applyCompanyName}) | 391 | TextInput({placeholder: '请输入消防设施管理单位', text: $$this.addForm.applyCompanyName}) |
| 296 | .backgroundColor('#fff') | 392 | .backgroundColor('#fff') |
| 297 | - }.border({width: {bottom: 1}, color: '#eee'}).padding({top: 10, bottom: 10}) | 393 | + }.border({width: {bottom: 1}, color: '#eee'}).padding({top: 10}) |
| 298 | Row(){ | 394 | Row(){ |
| 299 | Row(){ | 395 | Row(){ |
| 300 | - Text('备注') | ||
| 301 | - }.width(100) | ||
| 302 | - TextArea({ | ||
| 303 | - text: $$this.addForm.result, | ||
| 304 | - placeholder: '请输入内容' | ||
| 305 | - }).layoutWeight(1).height(80).borderRadius(5).backgroundColor('#fff') | ||
| 306 | - .border({width: 1, color: "#eee"}) | 396 | + Image($r('app.media.require')).width(20) |
| 397 | + Text('项目区域') | ||
| 398 | + }.width(90) | ||
| 399 | + Text(this.pickerValue.join(' ')).layoutWeight(1).padding({top: 8, bottom: 8, left: 16, right: 16}) | ||
| 400 | + .backgroundColor('#fff').textOverflow({overflow: TextOverflow.Ellipsis}).maxLines(2) | ||
| 401 | + .onClick(() => { | ||
| 402 | + this.areaController?.open() | ||
| 403 | + }) | ||
| 307 | }.border({width: {bottom: 1}, color: '#eee'}).padding({top: 10, bottom: 10}) | 404 | }.border({width: {bottom: 1}, color: '#eee'}).padding({top: 10, bottom: 10}) |
| 308 | Column(){ | 405 | Column(){ |
| 309 | Row(){ | 406 | Row(){ |
| @@ -351,6 +448,7 @@ struct EditUser { | @@ -351,6 +448,7 @@ struct EditUser { | ||
| 351 | .selectedColor('#1890ff') | 448 | .selectedColor('#1890ff') |
| 352 | .onChange((itemName: CheckboxGroupResult) => { | 449 | .onChange((itemName: CheckboxGroupResult) => { |
| 353 | this.addForm.fireFacilities = itemName.name.join('、') | 450 | this.addForm.fireFacilities = itemName.name.join('、') |
| 451 | + this.comprehensiveReview.facility = itemName.name.join('、') | ||
| 354 | }) | 452 | }) |
| 355 | .mark({ | 453 | .mark({ |
| 356 | strokeColor:Color.White, | 454 | strokeColor:Color.White, |
| @@ -411,7 +509,9 @@ struct EditUser { | @@ -411,7 +509,9 @@ struct EditUser { | ||
| 411 | this.equipmentList = searchByIndexOf(value, this.initEquipmentList) as equipmentType[] | 509 | this.equipmentList = searchByIndexOf(value, this.initEquipmentList) as equipmentType[] |
| 412 | } | 510 | } |
| 413 | }) | 511 | }) |
| 414 | - }.width('100%').justifyContent(FlexAlign.Start) | 512 | + }.width('100%').justifyContent(FlexAlign.Start).padding({left: 10}) |
| 513 | + List(){ | ||
| 514 | + ListItem(){ | ||
| 415 | Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center, wrap: FlexWrap.Wrap }) { | 515 | Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center, wrap: FlexWrap.Wrap }) { |
| 416 | Row(){ | 516 | Row(){ |
| 417 | CheckboxGroup({ group: 'checkboxGroup2' }) | 517 | CheckboxGroup({ group: 'checkboxGroup2' }) |
| @@ -449,7 +549,42 @@ struct EditUser { | @@ -449,7 +549,42 @@ struct EditUser { | ||
| 449 | }.margin({right: 10}) | 549 | }.margin({right: 10}) |
| 450 | }) | 550 | }) |
| 451 | }.margin({right:15}) | 551 | }.margin({right:15}) |
| 452 | - }.border({width: {bottom: 1}, color: '#eee'}).padding({top: 10, bottom: 10}) | 552 | + }.border({width: {bottom: 1}, color: '#eee'}) |
| 553 | + }.height(300).width('100%') | ||
| 554 | + }.padding({top: 10, bottom: 10}) | ||
| 555 | + Column({space: 10}){ | ||
| 556 | + Row(){ | ||
| 557 | + Text().width(4).height(16).backgroundColor('#1890ff').margin({right: 6}) | ||
| 558 | + Text('综合评述') | ||
| 559 | + }.padding({left: 10}) | ||
| 560 | + Column({space: 10}){ | ||
| 561 | + Column({space: 10}){ | ||
| 562 | + Text('本月维保范围').TitleReview() | ||
| 563 | + TextInput({placeholder: '请输入本月维保范围(填写楼层)', text: $$this.comprehensiveReview.range}).TextInputReview() | ||
| 564 | + }.width('100%').alignItems(HorizontalAlign.Start) | ||
| 565 | + Column({space: 10}){ | ||
| 566 | + Text('消防设施包含').TitleReview() | ||
| 567 | + Text(this.comprehensiveReview.facility || '勾选主要消防设施').width('100%').height(40).fontSize(14).padding({top: 8, bottom: 8, left: 16, right: 16}) | ||
| 568 | + .border({width: 1, color: '#eee'}).borderRadius(4).fontColor('#999').textAlign(TextAlign.Start) | ||
| 569 | + }.width('100%').alignItems(HorizontalAlign.Start) | ||
| 570 | + Column({space: 10}){ | ||
| 571 | + Text('存在问题').TitleReview() | ||
| 572 | + TextInput({placeholder: '请输入存在问题', text: this.comprehensiveReview.existingProblem}).TextInputReview() | ||
| 573 | + }.width('100%').alignItems(HorizontalAlign.Start) | ||
| 574 | + Column({space: 10}){ | ||
| 575 | + Text('累计问题').TitleReview() | ||
| 576 | + TextInput({placeholder: '请输入累计问题', text: $$this.comprehensiveReview.cumulativeIssues}).TextInputReview() | ||
| 577 | + }.width('100%').alignItems(HorizontalAlign.Start) | ||
| 578 | + Column({space: 10}){ | ||
| 579 | + Text('已整改问题').TitleReview() | ||
| 580 | + TextInput({placeholder: '请输入已整改问题', text: $$this.comprehensiveReview.correctedProblems}).TextInputReview() | ||
| 581 | + }.width('100%').alignItems(HorizontalAlign.Start) | ||
| 582 | + Column({space: 10}){ | ||
| 583 | + Text('其他').TitleReview() | ||
| 584 | + TextInput({placeholder: '其他内容', text: $$this.comprehensiveReview.other}).TextInputReview() | ||
| 585 | + }.width('100%').alignItems(HorizontalAlign.Start) | ||
| 586 | + } | ||
| 587 | + }.width('100%').alignItems(HorizontalAlign.Start).margin({top: 20}).padding({bottom: 30}) | ||
| 453 | }.backgroundColor('#fff').width('100%').padding({left: 5, right: 5}).borderRadius(10) | 588 | }.backgroundColor('#fff').width('100%').padding({left: 5, right: 5}).borderRadius(10) |
| 454 | }.padding(10).margin({bottom: 20, top: 10}) | 589 | }.padding(10).margin({bottom: 20, top: 10}) |
| 455 | }.layoutWeight(1).scrollBar(BarState.Off) | 590 | }.layoutWeight(1).scrollBar(BarState.Off) |
| @@ -477,14 +612,18 @@ struct EditUser { | @@ -477,14 +612,18 @@ struct EditUser { | ||
| 477 | return promptAction.showToast({message: '本人必须在维护人员中'}) | 612 | return promptAction.showToast({message: '本人必须在维护人员中'}) |
| 478 | } | 613 | } |
| 479 | if(this.isEdit){ | 614 | if(this.isEdit){ |
| 480 | - console.log(JSON.stringify(this.addForm)) | 615 | + this.loadingController.open() |
| 616 | + this.addForm.result = mergeRichText(this.comprehensiveReview) | ||
| 481 | await updateRecords(this.addForm) | 617 | await updateRecords(this.addForm) |
| 618 | + this.loadingController.close() | ||
| 482 | promptAction.showToast({ | 619 | promptAction.showToast({ |
| 483 | message: '更新成功' | 620 | message: '更新成功' |
| 484 | }) | 621 | }) |
| 485 | } else { | 622 | } else { |
| 623 | + this.loadingController.open() | ||
| 486 | this.addForm.maintenanceDate = [this.addForm.maintenanceTime as string, this.addForm.maintenanceEndTime as string] | 624 | this.addForm.maintenanceDate = [this.addForm.maintenanceTime as string, this.addForm.maintenanceEndTime as string] |
| 487 | await addRecords(this.addForm) | 625 | await addRecords(this.addForm) |
| 626 | + this.loadingController.close() | ||
| 488 | promptAction.showToast({ | 627 | promptAction.showToast({ |
| 489 | message: '添加成功' | 628 | message: '添加成功' |
| 490 | }) | 629 | }) |
| @@ -4,20 +4,15 @@ import { BusinessError } from '@ohos.base'; | @@ -4,20 +4,15 @@ import { BusinessError } from '@ohos.base'; | ||
| 4 | import { promptAction, router } from '@kit.ArkUI' | 4 | import { promptAction, router } from '@kit.ArkUI' |
| 5 | import { common } from '@kit.AbilityKit'; | 5 | import { common } from '@kit.AbilityKit'; |
| 6 | import { FileUtil, CommonConstants } from '../utils/FileUtil'; | 6 | import { FileUtil, CommonConstants } from '../utils/FileUtil'; |
| 7 | -import { uploadFileByTask } from '../utils/uploadCloud' | 7 | +// import { uploadFileByTask } from '../utils/uploadCloud' |
| 8 | +import { commonRouterParams } from '../utils/UserAuth' | ||
| 8 | 9 | ||
| 9 | /** | 10 | /** |
| 10 | * 视频录制 | 11 | * 视频录制 |
| 11 | */ | 12 | */ |
| 12 | 13 | ||
| 13 | -interface routerParams { | ||
| 14 | - cosKeyStr: string; | ||
| 15 | - relateId: number; | ||
| 16 | -} | ||
| 17 | - | ||
| 18 | -const TAG: string = 'Record'; | ||
| 19 | let context = getContext(this) as common.UIAbilityContext; | 14 | let context = getContext(this) as common.UIAbilityContext; |
| 20 | -let routerParamsData: routerParams = router.getParams() as routerParams; | 15 | +let routerParamsData: commonRouterParams = router.getParams() as commonRouterParams; |
| 21 | @Entry | 16 | @Entry |
| 22 | @Component | 17 | @Component |
| 23 | struct CreateCamera { | 18 | struct CreateCamera { |
| @@ -70,21 +65,30 @@ struct CreateCamera { | @@ -70,21 +65,30 @@ struct CreateCamera { | ||
| 70 | if (this.recording) { | 65 | if (this.recording) { |
| 71 | clearInterval(this.timer); | 66 | clearInterval(this.timer); |
| 72 | this.timer = 0 | 67 | this.timer = 0 |
| 68 | + promptAction.showToast({ message: '已完成录制,开始上传' }) | ||
| 73 | await this.stopRecord(); | 69 | await this.stopRecord(); |
| 74 | - await uploadFileByTask(routerParamsData.cosKeyStr, routerParamsData.relateId, this.path); | ||
| 75 | - router.back() | 70 | + routerParamsData.videoPath = this.path; |
| 71 | + router.back({ | ||
| 72 | + url:'', | ||
| 73 | + params: routerParamsData | ||
| 74 | + }) | ||
| 76 | } else { | 75 | } else { |
| 76 | + promptAction.showToast({ message: '已开始录制,再次点击完成录制' }) | ||
| 77 | this.timer = setInterval(async () => { | 77 | this.timer = setInterval(async () => { |
| 78 | this.countTime++; | 78 | this.countTime++; |
| 79 | if(this.countTime >= 120){ | 79 | if(this.countTime >= 120){ |
| 80 | clearInterval(this.timer); | 80 | clearInterval(this.timer); |
| 81 | this.timer = 0 | 81 | this.timer = 0 |
| 82 | + promptAction.showToast({ message: '已完成录制,开始上传' }) | ||
| 82 | await this.stopRecord(); | 83 | await this.stopRecord(); |
| 83 | - await uploadFileByTask(routerParamsData.cosKeyStr, routerParamsData.relateId, this.path); | ||
| 84 | - router.back() | 84 | + routerParamsData.videoPath = this.path; |
| 85 | + router.back({ | ||
| 86 | + url:'', | ||
| 87 | + params: routerParamsData | ||
| 88 | + }) | ||
| 85 | } | 89 | } |
| 86 | }, 1000); | 90 | }, 1000); |
| 87 | - this.startRecord(); | 91 | + await this.startRecord(); |
| 88 | } | 92 | } |
| 89 | this.recording = !this.recording; | 93 | this.recording = !this.recording; |
| 90 | }) | 94 | }) |
| @@ -10,9 +10,11 @@ import UploadTipDialog from '../dialog/UploadTipDialog' | @@ -10,9 +10,11 @@ import UploadTipDialog from '../dialog/UploadTipDialog' | ||
| 10 | import { getReportDetail, getMalfunctionList, deleteRecords, successReport, returnSing } from '../api/originalRecords' | 10 | import { getReportDetail, getMalfunctionList, deleteRecords, successReport, returnSing } from '../api/originalRecords' |
| 11 | import { reportDetailTest, reportDetailData, ProjectList, ItemList, MalfunctionListTest, MalfunctionListRow, configTest } from '../api/recordsType' | 11 | import { reportDetailTest, reportDetailData, ProjectList, ItemList, MalfunctionListTest, MalfunctionListRow, configTest } from '../api/recordsType' |
| 12 | import { pushOutsideWeb } from '../utils/pushOutsideWeb' | 12 | import { pushOutsideWeb } from '../utils/pushOutsideWeb' |
| 13 | +import { commonRouterParams } from '../utils/UserAuth' | ||
| 13 | import ThemeStaticTest from '../components/ThemeStaticText' | 14 | import ThemeStaticTest from '../components/ThemeStaticText' |
| 14 | import NavHeader from '../components/NavHeader' | 15 | import NavHeader from '../components/NavHeader' |
| 15 | 16 | ||
| 17 | + | ||
| 16 | interface showVideoOrImg { | 18 | interface showVideoOrImg { |
| 17 | cosKey: string | null; | 19 | cosKey: string | null; |
| 18 | itemName: string; | 20 | itemName: string; |
| @@ -157,7 +159,11 @@ struct DetailRecords { | @@ -157,7 +159,11 @@ struct DetailRecords { | ||
| 157 | }.border({width: {bottom: 1}, color: '#eee'}).padding(10).justifyContent(FlexAlign.SpaceBetween).width('100%') | 159 | }.border({width: {bottom: 1}, color: '#eee'}).padding(10).justifyContent(FlexAlign.SpaceBetween).width('100%') |
| 158 | Row(){ | 160 | Row(){ |
| 159 | Text('项目负责人').fontSize(12).fontColor('#999') | 161 | Text('项目负责人').fontSize(12).fontColor('#999') |
| 160 | - Text(this.reportDetail?.approvePerson || '').fontColor('#999').fontSize(12).margin({left: 3, right: 3}) | 162 | + Text(this.reportDetail?.approvePerson).fontColor('#999').fontSize(12).margin({left: 3, right: 3}) |
| 163 | + }.border({width: {bottom: 1}, color: '#eee'}).padding(10).justifyContent(FlexAlign.SpaceBetween).width('100%') | ||
| 164 | + Row(){ | ||
| 165 | + Text('项目区域').fontSize(12).fontColor('#999') | ||
| 166 | + Text(`${this.reportDetail?.city} ${this.reportDetail?.county}`).fontColor('#999').fontSize(12).margin({left: 3, right: 3}) | ||
| 161 | }.border({width: {bottom: 1}, color: '#eee'}).padding(10).justifyContent(FlexAlign.SpaceBetween).width('100%') | 167 | }.border({width: {bottom: 1}, color: '#eee'}).padding(10).justifyContent(FlexAlign.SpaceBetween).width('100%') |
| 162 | Row(){ | 168 | Row(){ |
| 163 | Text('维保人员').fontSize(12).fontColor('#999') | 169 | Text('维保人员').fontSize(12).fontColor('#999') |
| @@ -197,14 +203,14 @@ struct DetailRecords { | @@ -197,14 +203,14 @@ struct DetailRecords { | ||
| 197 | Text('仪器设备').fontSize(12).fontColor('#999') | 203 | Text('仪器设备').fontSize(12).fontColor('#999') |
| 198 | Text(this.reportDetail?.equipment || '').fontColor('#999').fontSize(12).margin({left: 3, right: 3}) | 204 | Text(this.reportDetail?.equipment || '').fontColor('#999').fontSize(12).margin({left: 3, right: 3}) |
| 199 | }.border({width: {bottom: 1}, color: '#eee'}).padding(10).alignItems(HorizontalAlign.Start).width('100%') | 205 | }.border({width: {bottom: 1}, color: '#eee'}).padding(10).alignItems(HorizontalAlign.Start).width('100%') |
| 200 | - Row(){ | ||
| 201 | - Text('备注').fontSize(12).fontColor('#999').margin({right: 10}) | 206 | + Column({space: 10}){ |
| 207 | + Text('综合评述').fontSize(12).fontColor('#999').margin({right: 10}) | ||
| 202 | HmParseHTML({ | 208 | HmParseHTML({ |
| 203 | htmlStr: this.reportDetail?.result || '<p>无</p>', | 209 | htmlStr: this.reportDetail?.result || '<p>无</p>', |
| 204 | baseFontSize: 12, | 210 | baseFontSize: 12, |
| 205 | baseFontColor: '#999' | 211 | baseFontColor: '#999' |
| 206 | }) | 212 | }) |
| 207 | - }.padding(10).justifyContent(FlexAlign.SpaceBetween) | 213 | + }.padding(10).alignItems(HorizontalAlign.Start).width('100%') |
| 208 | }.backgroundColor('#fff').borderRadius(10).padding(10).width('100%') | 214 | }.backgroundColor('#fff').borderRadius(10).padding(10).width('100%') |
| 209 | // 主要消防措施 | 215 | // 主要消防措施 |
| 210 | Column({space: 10}){ | 216 | Column({space: 10}){ |
| @@ -246,9 +252,14 @@ struct DetailRecords { | @@ -246,9 +252,14 @@ struct DetailRecords { | ||
| 246 | Text(item.projectName).fontSize(16).fontColor('#1890ff') | 252 | Text(item.projectName).fontSize(16).fontColor('#1890ff') |
| 247 | Image($r('app.media.edit_1')).width(16).margin({right: 4}) | 253 | Image($r('app.media.edit_1')).width(16).margin({right: 4}) |
| 248 | }.onClick(() => { | 254 | }.onClick(() => { |
| 255 | + let routerData: commonRouterParams = { | ||
| 256 | + projectId: item.projectId, | ||
| 257 | + reportId: item.reportId, | ||
| 258 | + videoPath: '' | ||
| 259 | + } | ||
| 249 | router.pushUrl({ | 260 | router.pushUrl({ |
| 250 | url: 'pages/FireProtectionDetail', | 261 | url: 'pages/FireProtectionDetail', |
| 251 | - params: item | 262 | + params: routerData |
| 252 | }) | 263 | }) |
| 253 | }) | 264 | }) |
| 254 | } | 265 | } |
| 1 | import { router, promptAction } from '@kit.ArkUI' | 1 | import { router, promptAction } from '@kit.ArkUI' |
| 2 | -import { ProjectList } from '../api/recordsType' | ||
| 3 | import { webview } from '@kit.ArkWeb' | 2 | import { webview } from '@kit.ArkWeb' |
| 4 | -import { basePath } from '../utils/baseUrl' | ||
| 5 | import fs from '@ohos.file.fs'; | 3 | import fs from '@ohos.file.fs'; |
| 6 | -import preferencesUtils from '../utils/preferences' | ||
| 7 | -import { BusinessError, request } from '@kit.BasicServicesKit'; | ||
| 8 | -import { cameraPickerImg, cameraPickerVideo, videoCompressMethod } from '../utils/uploadFile' | 4 | +import { common, Permissions } from '@kit.AbilityKit'; |
| 5 | +import { AxiosResponse } from '@ohos/axios' | ||
| 9 | import { getCosKey, cosKeyTest, cosKeyData, uploadVideoOrImg } from '../api/cosKey' | 6 | import { getCosKey, cosKeyTest, cosKeyData, uploadVideoOrImg } from '../api/cosKey' |
| 10 | import loadingDialog from '../dialog/LoadingDialog' | 7 | import loadingDialog from '../dialog/LoadingDialog' |
| 11 | -import { rpc } from '@kit.IPCKit'; | ||
| 12 | -import { abilityAccessCtrl, common, Permissions } from '@kit.AbilityKit'; | ||
| 13 | -import { AxiosResponse } from '@ohos/axios' | 8 | +import NavHeader from '../components/NavHeader' |
| 9 | +import { basePath } from '../utils/baseUrl' | ||
| 10 | +import preferencesUtils from '../utils/preferences' | ||
| 11 | +import { BusinessError, request } from '@kit.BasicServicesKit'; | ||
| 12 | +import { cameraPickerImg } from '../utils/uploadFile' | ||
| 13 | +import { reqPermissionsFromUser, checkAccessToken, commonRouterParams } from '../utils/UserAuth' | ||
| 14 | + | ||
| 14 | 15 | ||
| 15 | -let routerInfo: ProjectList = router.getParams() as ProjectList | 16 | +let routerInfo: commonRouterParams = router.getParams() as commonRouterParams |
| 16 | const context = getContext() as common.UIAbilityContext; | 17 | const context = getContext() as common.UIAbilityContext; |
| 17 | 18 | ||
| 18 | @Entry | 19 | @Entry |
| @@ -20,8 +21,9 @@ const context = getContext() as common.UIAbilityContext; | @@ -20,8 +21,9 @@ const context = getContext() as common.UIAbilityContext; | ||
| 20 | struct FireProtectionDetail { | 21 | struct FireProtectionDetail { |
| 21 | controller: RichEditorController = new RichEditorController(); | 22 | controller: RichEditorController = new RichEditorController(); |
| 22 | options: RichEditorOptions = { controller: this.controller }; | 23 | options: RichEditorOptions = { controller: this.controller }; |
| 23 | - @State projectInfo: ProjectList = routerInfo | ||
| 24 | - private result: boolean = false; | 24 | + @State projectInfo: commonRouterParams = routerInfo |
| 25 | + cosKeyStr: string | null ='' | ||
| 26 | + relateId: number = 0 | ||
| 25 | permissions: Array<Permissions> = [ | 27 | permissions: Array<Permissions> = [ |
| 26 | 'ohos.permission.CAMERA', | 28 | 'ohos.permission.CAMERA', |
| 27 | 'ohos.permission.MICROPHONE', | 29 | 'ohos.permission.MICROPHONE', |
| @@ -29,8 +31,15 @@ struct FireProtectionDetail { | @@ -29,8 +31,15 @@ struct FireProtectionDetail { | ||
| 29 | ]; | 31 | ]; |
| 30 | webviewController: webview.WebviewController = new webview.WebviewController() | 32 | webviewController: webview.WebviewController = new webview.WebviewController() |
| 31 | 33 | ||
| 34 | + onPageShow() { | ||
| 35 | + let pathUrl = (router.getParams() as commonRouterParams)?.videoPath || '' | ||
| 36 | + console.log('pathUrl', pathUrl) | ||
| 37 | + if (pathUrl !== '' || pathUrl !== undefined || pathUrl !== null) { | ||
| 38 | + this.uploadMethods(this.cosKeyStr, this.relateId, pathUrl, 'mp4') | ||
| 39 | + } | ||
| 40 | + } | ||
| 32 | aboutToAppear(): void { | 41 | aboutToAppear(): void { |
| 33 | - this.reqPermissionsFromUser(this.permissions, context) | 42 | + reqPermissionsFromUser(this.permissions, context) |
| 34 | } | 43 | } |
| 35 | // 加载弹窗 | 44 | // 加载弹窗 |
| 36 | loadingController: CustomDialogController = new CustomDialogController({ | 45 | loadingController: CustomDialogController = new CustomDialogController({ |
| @@ -40,49 +49,11 @@ struct FireProtectionDetail { | @@ -40,49 +49,11 @@ struct FireProtectionDetail { | ||
| 40 | alignment: DialogAlignment.Center, | 49 | alignment: DialogAlignment.Center, |
| 41 | autoCancel: false | 50 | autoCancel: false |
| 42 | }) | 51 | }) |
| 43 | - | ||
| 44 | - // 获取用户授权 | ||
| 45 | - reqPermissionsFromUser(permissions: Array<Permissions>, context: common.UIAbilityContext) { | ||
| 46 | - let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager(); | ||
| 47 | - atManager.requestPermissionsFromUser(context, permissions).then((data) => { | ||
| 48 | - let grantStatus: Array<number> = data.authResults; | ||
| 49 | - let length: number = grantStatus.length; | ||
| 50 | - for (let i = 0; i < length; i++) { | ||
| 51 | - if (grantStatus[i] === 0) { | ||
| 52 | - promptAction.showToast({message: 'User authorized.'}) | ||
| 53 | - } else { | ||
| 54 | - promptAction.showToast({message: 'User denied authorization.'}) | ||
| 55 | - return; | ||
| 56 | - } | ||
| 57 | - } | ||
| 58 | - }).catch((err: BusinessError) => { | ||
| 59 | - promptAction.showToast({message: `Failed to request permissions from user. Code is ${err.code}, message is ${err.message}`}) | ||
| 60 | - }) | ||
| 61 | - } | ||
| 62 | - // 检查用户是否授权 | ||
| 63 | - checkAccessToken(permissions: Array<Permissions>) { | ||
| 64 | - // Determine the authorization status. | ||
| 65 | - let callerTokenId: number = rpc.IPCSkeleton.getCallingTokenId(); | ||
| 66 | - let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager(); | ||
| 67 | - try { | ||
| 68 | - for (let i = 0; i < permissions.length; i++) { | ||
| 69 | - let data: abilityAccessCtrl.GrantStatus = atManager.verifyAccessTokenSync(callerTokenId, permissions[i]); | ||
| 70 | - if (data === -1) { | ||
| 71 | - this.result = false; | ||
| 72 | - } else { | ||
| 73 | - this.result = true; | ||
| 74 | - } | ||
| 75 | - if (!this.result) { | ||
| 76 | - break; | ||
| 77 | - } | ||
| 78 | - } | ||
| 79 | - } catch (err) { | ||
| 80 | - promptAction.showToast({message: `checkAccessToken catch err->${JSON.stringify(err)}`}) | ||
| 81 | - } | ||
| 82 | - } | ||
| 83 | - | ||
| 84 | // 上传方法 | 52 | // 上传方法 |
| 85 | uploadMethods = async (cosKeyStr: string | null, relateId: number, systemPhotoImagePath: string, fileType: string) => { | 53 | uploadMethods = async (cosKeyStr: string | null, relateId: number, systemPhotoImagePath: string, fileType: string) => { |
| 54 | + if(systemPhotoImagePath =='' || systemPhotoImagePath == null || systemPhotoImagePath == undefined){ | ||
| 55 | + return promptAction.showToast({ message: '用户取消选择' }); | ||
| 56 | + } | ||
| 86 | let _this = this | 57 | let _this = this |
| 87 | _this.loadingController.open() | 58 | _this.loadingController.open() |
| 88 | let cacheDir = getContext().cacheDir // 获取缓存目录 | 59 | let cacheDir = getContext().cacheDir // 获取缓存目录 |
| @@ -112,7 +83,7 @@ struct FireProtectionDetail { | @@ -112,7 +83,7 @@ struct FireProtectionDetail { | ||
| 112 | method: "PUT", | 83 | method: "PUT", |
| 113 | files:[{ // 上传文件 | 84 | files:[{ // 上传文件 |
| 114 | filename: filename, // 文件名 | 85 | filename: filename, // 文件名 |
| 115 | - type: 'jpg', // 文件扩展名 | 86 | + type: fileType, // 文件扩展名 |
| 116 | name:'file', // 接口参数名 | 87 | name:'file', // 接口参数名 |
| 117 | uri:`internal://cache/${filename}` // 缓存目录中的要上传给服务器的图片路径 | 88 | uri:`internal://cache/${filename}` // 缓存目录中的要上传给服务器的图片路径 |
| 118 | }], | 89 | }], |
| @@ -123,11 +94,10 @@ struct FireProtectionDetail { | @@ -123,11 +94,10 @@ struct FireProtectionDetail { | ||
| 123 | _this.loadingController.close() | 94 | _this.loadingController.close() |
| 124 | for (let i = 0; i < taskStates.length; i++) { | 95 | for (let i = 0; i < taskStates.length; i++) { |
| 125 | let cosKeyArr: string[] = [] | 96 | let cosKeyArr: string[] = [] |
| 126 | - if(cosKeyStr !== null) { | 97 | + if(cosKeyStr !== null && cosKeyStr !== 'null') { |
| 127 | cosKeyArr = cosKeyStr.split(';') | 98 | cosKeyArr = cosKeyStr.split(';') |
| 128 | } | 99 | } |
| 129 | cosKeyArr.push(cosKey) | 100 | cosKeyArr.push(cosKey) |
| 130 | - console.log('最终的cosKeys数据: ' + cosKeyArr.join(';')) | ||
| 131 | await uploadVideoOrImg({ cosKey: cosKeyArr.join(';'), relateId: relateId }) | 101 | await uploadVideoOrImg({ cosKey: cosKeyArr.join(';'), relateId: relateId }) |
| 132 | await _this.webviewController.runJavaScript(`window.setKey(${JSON.stringify(cosKeyArr.join(';'))})`) | 102 | await _this.webviewController.runJavaScript(`window.setKey(${JSON.stringify(cosKeyArr.join(';'))})`) |
| 133 | _this.loadingController.close() | 103 | _this.loadingController.close() |
| @@ -149,29 +119,28 @@ struct FireProtectionDetail { | @@ -149,29 +119,28 @@ struct FireProtectionDetail { | ||
| 149 | } | 119 | } |
| 150 | build() { | 120 | build() { |
| 151 | Column(){ | 121 | Column(){ |
| 122 | + NavHeader({title: '编写记录信息'}) | ||
| 152 | Web({ | 123 | Web({ |
| 153 | src: `${basePath}/report/handle?id=${this.projectInfo.reportId}&pid=${this.projectInfo.projectId}&source=harmony&token=${preferencesUtils.get('XF_TOKEN', '')}`, | 124 | src: `${basePath}/report/handle?id=${this.projectInfo.reportId}&pid=${this.projectInfo.projectId}&source=harmony&token=${preferencesUtils.get('XF_TOKEN', '')}`, |
| 154 | - // src: 'http://www.xiao-ming.love/', | ||
| 155 | controller: this.webviewController, | 125 | controller: this.webviewController, |
| 156 | }).mixedMode(MixedMode.All).javaScriptAccess(true).domStorageAccess(true) | 126 | }).mixedMode(MixedMode.All).javaScriptAccess(true).domStorageAccess(true) |
| 157 | .onConsole((event) => { | 127 | .onConsole((event) => { |
| 158 | let data = event.message.getMessage().replace(/^['"]|['"]$/g, ''); | 128 | let data = event.message.getMessage().replace(/^['"]|['"]$/g, ''); |
| 159 | let formatData = data.split('&') | 129 | let formatData = data.split('&') |
| 160 | - let cosKeyStr: string | null = formatData[1] | ||
| 161 | - let relateId: number = parseInt(formatData[2]) | 130 | + this.cosKeyStr = formatData[1] |
| 131 | + this.relateId = parseInt(formatData[2]) | ||
| 162 | if (formatData[0] == '鸿蒙图片上传') { | 132 | if (formatData[0] == '鸿蒙图片上传') { |
| 163 | // 使用相机拍照 | 133 | // 使用相机拍照 |
| 164 | cameraPickerImg().then(async systemPhotoImagePath => { | 134 | cameraPickerImg().then(async systemPhotoImagePath => { |
| 165 | if (systemPhotoImagePath == '' || systemPhotoImagePath == null) { | 135 | if (systemPhotoImagePath == '' || systemPhotoImagePath == null) { |
| 166 | return promptAction.showToast({ message: '用户取消选择' }); | 136 | return promptAction.showToast({ message: '用户取消选择' }); |
| 167 | } | 137 | } |
| 168 | - this.uploadMethods(cosKeyStr, relateId, systemPhotoImagePath, 'jpg') | 138 | + this.uploadMethods(this.cosKeyStr, this.relateId, systemPhotoImagePath, 'jpg') |
| 169 | }) | 139 | }) |
| 170 | } else if(formatData[0] == '鸿蒙视频上传'){ | 140 | } else if(formatData[0] == '鸿蒙视频上传'){ |
| 171 | // 使用相机录像 | 141 | // 使用相机录像 |
| 172 | - this.checkAccessToken(this.permissions); | ||
| 173 | - if (this.result) { | ||
| 174 | - router.pushUrl({ url: 'pages/CreateCamera', params: { cosKeyStr: cosKeyStr, relateId: relateId} }) | 142 | + if (checkAccessToken(this.permissions)) { |
| 143 | + router.pushUrl({ url: 'pages/CreateCamera', params: this.projectInfo }) | ||
| 175 | } | 144 | } |
| 176 | } | 145 | } |
| 177 | return false | 146 | return false |
| @@ -2,6 +2,7 @@ import { router } from '@kit.ArkUI' | @@ -2,6 +2,7 @@ import { router } from '@kit.ArkUI' | ||
| 2 | import { webview } from '@kit.ArkWeb' | 2 | import { webview } from '@kit.ArkWeb' |
| 3 | import preferencesUtils from '../utils/preferences' | 3 | import preferencesUtils from '../utils/preferences' |
| 4 | import { basePath } from '../utils/baseUrl' | 4 | import { basePath } from '../utils/baseUrl' |
| 5 | +import NavHeader from '../components/NavHeader' | ||
| 5 | interface routerType { | 6 | interface routerType { |
| 6 | reportId: number | 7 | reportId: number |
| 7 | } | 8 | } |
| @@ -14,6 +15,7 @@ struct LookRecords { | @@ -14,6 +15,7 @@ struct LookRecords { | ||
| 14 | webviewController: webview.WebviewController = new webview.WebviewController() | 15 | webviewController: webview.WebviewController = new webview.WebviewController() |
| 15 | build() { | 16 | build() { |
| 16 | Column(){ | 17 | Column(){ |
| 18 | + NavHeader({title: '查看记录'}) | ||
| 17 | Web({ | 19 | Web({ |
| 18 | src: `${basePath}/report/record?id=${reportId}&token=${preferencesUtils.get('XF_TOKEN', '')}&time=${new Date().getTime()}&type=${preferencesUtils.get('XF_ROLE_NAME', '')}&username=${preferencesUtils.get('XF_USERNAME', '')}`, | 20 | src: `${basePath}/report/record?id=${reportId}&token=${preferencesUtils.get('XF_TOKEN', '')}&time=${new Date().getTime()}&type=${preferencesUtils.get('XF_ROLE_NAME', '')}&username=${preferencesUtils.get('XF_USERNAME', '')}`, |
| 19 | controller: this.webviewController, | 21 | controller: this.webviewController, |
| @@ -8,7 +8,7 @@ import { | @@ -8,7 +8,7 @@ import { | ||
| 8 | // 创建SDKConfig对象 | 8 | // 创建SDKConfig对象 |
| 9 | let adConfigBuilder = new SDKConfigBuilder() | 9 | let adConfigBuilder = new SDKConfigBuilder() |
| 10 | let config: SDKConfig = adConfigBuilder | 10 | let config: SDKConfig = adConfigBuilder |
| 11 | - .appId("5669833") | 11 | + .appId("5682334") |
| 12 | .appName("消防维保助手") | 12 | .appName("消防维保助手") |
| 13 | .allowShowNotify(true) | 13 | .allowShowNotify(true) |
| 14 | .debug(true) | 14 | .debug(true) |
entry/src/main/ets/utils/UserAuth.ets
0 → 100644
| 1 | +import { abilityAccessCtrl, common, Permissions } from '@kit.AbilityKit'; | ||
| 2 | +import { promptAction } from '@kit.ArkUI' | ||
| 3 | +import { rpc } from '@kit.IPCKit'; | ||
| 4 | + | ||
| 5 | + | ||
| 6 | +// 获取用户授权 | ||
| 7 | +export async function reqPermissionsFromUser(permissions: Array<Permissions>, context: common.UIAbilityContext) { | ||
| 8 | + let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager(); | ||
| 9 | + try { | ||
| 10 | + let data = await atManager.requestPermissionsFromUser(context, permissions) | ||
| 11 | + let grantStatus: Array<number> = data.authResults; | ||
| 12 | + if(grantStatus.every((numberItem: number) => numberItem === 0)){ | ||
| 13 | + promptAction.showToast({message: '授权成功'}) | ||
| 14 | + } else { | ||
| 15 | + promptAction.showToast({message: '用户已取消授权'}) | ||
| 16 | + } | ||
| 17 | + } catch (err) { | ||
| 18 | + promptAction.showToast({message: `Failed to request permissions from user. Code is ${err.code}, message is ${err.message}`}) | ||
| 19 | + } | ||
| 20 | +} | ||
| 21 | + | ||
| 22 | +// 检查用户是否授权 | ||
| 23 | +export function checkAccessToken(permissions: Array<Permissions>): boolean { | ||
| 24 | + // Determine the authorization status. | ||
| 25 | + let callerTokenId: number = rpc.IPCSkeleton.getCallingTokenId(); | ||
| 26 | + let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager(); | ||
| 27 | + try { | ||
| 28 | + return permissions.every((permissionItem: Permissions) => atManager.verifyAccessTokenSync(callerTokenId, permissionItem) !== -1) | ||
| 29 | + } catch (err) { | ||
| 30 | + promptAction.showToast({message: `checkAccessToken catch err->${JSON.stringify(err)}`}) | ||
| 31 | + return false | ||
| 32 | + } | ||
| 33 | +} | ||
| 34 | + | ||
| 35 | +export interface commonRouterParams { | ||
| 36 | + reportId: number; | ||
| 37 | + projectId: number; | ||
| 38 | + videoPath: string; | ||
| 39 | +} |
| @@ -3905,7 +3905,7 @@ const makeOption = ( | @@ -3905,7 +3905,7 @@ const makeOption = ( | ||
| 3905 | children, | 3905 | children, |
| 3906 | }); | 3906 | }); |
| 3907 | 3907 | ||
| 3908 | -export function useCascadeAreaData() { | 3908 | +export function useCascadeAreaData(provinceValue: string = '') { |
| 3909 | 3909 | ||
| 3910 | const city = areaList.city_list | 3910 | const city = areaList.city_list |
| 3911 | const county = areaList.county_list | 3911 | const county = areaList.county_list |
| @@ -3934,6 +3934,10 @@ export function useCascadeAreaData() { | @@ -3934,6 +3934,10 @@ export function useCascadeAreaData() { | ||
| 3934 | } | 3934 | } |
| 3935 | }); | 3935 | }); |
| 3936 | 3936 | ||
| 3937 | + if(provinceValue === '') { | ||
| 3937 | return Array.from(provinceMap.values()); | 3938 | return Array.from(provinceMap.values()); |
| 3939 | + } else { | ||
| 3940 | + return Array.from(provinceMap.values()).filter((item) => item.text === provinceValue) | ||
| 3941 | + } | ||
| 3938 | } | 3942 | } |
| 3939 | 3943 |
-
请 注册 或 登录 后发表评论