作者 xiaoqiu

优化了综合评述内容,改标题,空无内容不显示

@@ -14,7 +14,7 @@ export default class EntryAbility extends UIAbility { @@ -14,7 +14,7 @@ export default class EntryAbility extends UIAbility {
14 async onWindowStageCreate(windowStage: window.WindowStage) { 14 async onWindowStageCreate(windowStage: window.WindowStage) {
15 // Main window is created, set main page for this ability 15 // Main window is created, set main page for this ability
16 hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); 16 hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
17 - await showStartAd(windowStage, this.context) 17 + // await showStartAd(windowStage, this.context)
18 windowStage.loadContent('pages/Login', (err) => { 18 windowStage.loadContent('pages/Login', (err) => {
19 if (err.code) { 19 if (err.code) {
20 hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); 20 hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
@@ -92,14 +92,30 @@ function extractRichText(str: string | null): comprehensiveType{ @@ -92,14 +92,30 @@ function extractRichText(str: string | null): comprehensiveType{
92 } else { 92 } else {
93 let richText = str.replace(/<.*?>/g, '?') 93 let richText = str.replace(/<.*?>/g, '?')
94 let arrValue: string[] = richText.split('?').filter(item => item !== '') 94 let arrValue: string[] = richText.split('?').filter(item => item !== '')
95 - let otherArr: string[] = []  
96 - if(arrValue.length > 5){  
97 - for (let index = 5; index < arrValue.length; index++) {  
98 - otherArr.push(arrValue[index]) 95 + let otherValue: string[] = []
  96 + let existingProblem: string = ''
  97 + let cumulativeIssues: string = ''
  98 + let correctedProblems: string = ''
  99 + if(arrValue.length >= 2){
  100 + for (let index = 2; index < arrValue.length; index++) {
  101 + if(arrValue[index].split(':')[0] === '本月发现的问题' || arrValue[index].split(':')[0] === '存在问题' ) {
  102 + existingProblem = arrValue[index].split(':')[1]
  103 + } else if(arrValue[index].split(':')[0] === '遗留未整改的问题' || arrValue[index].split(':')[0] === '累计问题') {
  104 + cumulativeIssues = arrValue[index].split(':')[1]
  105 + } else if(arrValue[index].split(':')[0] === '本月已整改的问题' || arrValue[index].split(':')[0] === '已整改问题') {
  106 + correctedProblems = arrValue[index].split(':')[1]
  107 + } else {
  108 + otherValue.push(arrValue[index].slice(3))
  109 + }
  110 + }
  111 + return {
  112 + range: arrValue[0].split(':')[1],
  113 + facility: arrValue[1].split(':')[1],
  114 + existingProblem: existingProblem,
  115 + cumulativeIssues: cumulativeIssues,
  116 + correctedProblems: correctedProblems,
  117 + other: otherValue.join('、')
99 } 118 }
100 - return multiply(arrValue[0], arrValue[1], arrValue[2], arrValue[3], arrValue[4], ...otherArr)  
101 - } else if(arrValue.length === 5) {  
102 - return multiply(arrValue[0], arrValue[1], arrValue[2], arrValue[3], arrValue[4], '其他:')  
103 } else { 119 } else {
104 return { 120 return {
105 range: '', 121 range: '',
@@ -115,7 +131,16 @@ function extractRichText(str: string | null): comprehensiveType{ @@ -115,7 +131,16 @@ function extractRichText(str: string | null): comprehensiveType{
115 131
116 // 提交修改时合并富文本内容 132 // 提交修改时合并富文本内容
117 function mergeRichText(comprehensive: comprehensiveType): string{ 133 function mergeRichText(comprehensive: comprehensiveType): string{
118 - 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>` 134 + let resStr = `<div>${'本月维保范围:' + comprehensive.range}</div><div style="margin-top: 6px;">${'维保设施包含:' + comprehensive.facility}</div>`
  135 + if(comprehensive.existingProblem) {
  136 + resStr += `<div style="margin-top: 6px;">${'本月发现的问题:' + comprehensive.existingProblem}</div>`
  137 + }
  138 + if(comprehensive.cumulativeIssues) {
  139 + resStr += `<div style="margin-top: 6px;">${'遗留未整改的问题:' + comprehensive.cumulativeIssues}</div>`
  140 + }
  141 + if(comprehensive.correctedProblems) {
  142 + resStr += `<div style="margin-top: 6px;">${'本月已整改的问题:' + comprehensive.correctedProblems}</div>`
  143 + }
119 if (comprehensive.other) { 144 if (comprehensive.other) {
120 resStr += `<div style="margin-top: 6px;">${'其他:' + comprehensive.other}</div>` 145 resStr += `<div style="margin-top: 6px;">${'其他:' + comprehensive.other}</div>`
121 } 146 }
@@ -276,7 +301,7 @@ struct AddRecords { @@ -276,7 +301,7 @@ struct AddRecords {
276 if(this.addForm.reportName === '' || this.addForm.reportNo === '' || this.addForm.applyCompanyName === '' || this.addForm.maintenanceTime === '请选择起始日期' || this.addForm.maintenanceEndTime === '请选择结束日期' || this.addForm.fireFacilities === '' || this.addForm.maintenancePeople === '') { 301 if(this.addForm.reportName === '' || this.addForm.reportNo === '' || this.addForm.applyCompanyName === '' || this.addForm.maintenanceTime === '请选择起始日期' || this.addForm.maintenanceEndTime === '请选择结束日期' || this.addForm.fireFacilities === '' || this.addForm.maintenancePeople === '') {
277 return promptAction.showToast({message: '* 号为必填项'}) 302 return promptAction.showToast({message: '* 号为必填项'})
278 } 303 }
279 - if(this.comprehensiveReview.range === '' || this.comprehensiveReview.existingProblem === '' || this.comprehensiveReview.cumulativeIssues === '' || this.comprehensiveReview.correctedProblems === ''){ 304 + if(this.comprehensiveReview.range === ''){
280 return promptAction.showToast({message: '综合评述带 * 号必填'}) 305 return promptAction.showToast({message: '综合评述带 * 号必填'})
281 } 306 }
282 if(this.errorMsg !== '') { 307 if(this.errorMsg !== '') {
@@ -659,22 +684,19 @@ struct AddRecords { @@ -659,22 +684,19 @@ struct AddRecords {
659 }.width('100%').alignItems(HorizontalAlign.Start) 684 }.width('100%').alignItems(HorizontalAlign.Start)
660 Column({space: 10}){ 685 Column({space: 10}){
661 Row({space: 5}){ 686 Row({space: 5}){
662 - Image($r('app.media.require')).width(20)  
663 - Text('存在问题').TitleReview() 687 + Text('本月发现的问题').TitleReview()
664 }.width('100%') 688 }.width('100%')
665 TextArea({ placeholder: '请输入存在问题', text: $$this.comprehensiveReview.existingProblem }).TextAreaReview() 689 TextArea({ placeholder: '请输入存在问题', text: $$this.comprehensiveReview.existingProblem }).TextAreaReview()
666 }.width('100%').alignItems(HorizontalAlign.Start) 690 }.width('100%').alignItems(HorizontalAlign.Start)
667 Column({space: 10}){ 691 Column({space: 10}){
668 Row({space: 5}){ 692 Row({space: 5}){
669 - Image($r('app.media.require')).width(20)  
670 - Text('累计问题').TitleReview() 693 + Text('遗留未整改的问题').TitleReview()
671 }.width('100%') 694 }.width('100%')
672 TextArea({ placeholder: '请输入累计问题', text: $$this.comprehensiveReview.cumulativeIssues }).TextAreaReview() 695 TextArea({ placeholder: '请输入累计问题', text: $$this.comprehensiveReview.cumulativeIssues }).TextAreaReview()
673 }.width('100%').alignItems(HorizontalAlign.Start) 696 }.width('100%').alignItems(HorizontalAlign.Start)
674 Column({space: 10}){ 697 Column({space: 10}){
675 Row({space: 5}){ 698 Row({space: 5}){
676 - Image($r('app.media.require')).width(20)  
677 - Text('已整改问题').TitleReview() 699 + Text('本月已整改的问题').TitleReview()
678 }.width('100%') 700 }.width('100%')
679 TextArea({ placeholder: '请输入已整改问题', text: $$this.comprehensiveReview.correctedProblems }).TextAreaReview() 701 TextArea({ placeholder: '请输入已整改问题', text: $$this.comprehensiveReview.correctedProblems }).TextAreaReview()
680 }.width('100%').alignItems(HorizontalAlign.Start) 702 }.width('100%').alignItems(HorizontalAlign.Start)
@@ -690,9 +712,7 @@ struct AddRecords { @@ -690,9 +712,7 @@ struct AddRecords {
690 Row(){ 712 Row(){
691 Text('提交').borderRadius(5).width('100%').height(30).fontColor('#fff') 713 Text('提交').borderRadius(5).width('100%').height(30).fontColor('#fff')
692 .backgroundColor('#1B65FD').fontSize(14).textAlign(TextAlign.Center) 714 .backgroundColor('#1B65FD').fontSize(14).textAlign(TextAlign.Center)
693 - .onClick(() => {  
694 - this.submitForm()  
695 - }) 715 + .onClick(() => { this.submitForm() })
696 }.width('100%').height(40).backgroundColor('#fff').padding({left: 10, right: 10}) 716 }.width('100%').height(40).backgroundColor('#fff').padding({left: 10, right: 10})
697 }.width('100%').height('100%').backgroundColor('#f2f3f7') 717 }.width('100%').height('100%').backgroundColor('#f2f3f7')
698 } 718 }
@@ -4,7 +4,6 @@ import preferencesUtils from '../utils/preferences' @@ -4,7 +4,6 @@ import preferencesUtils from '../utils/preferences'
4 import { AxiosResponse } from '@ohos/axios' 4 import { AxiosResponse } from '@ohos/axios'
5 import { HmParseHTML } from "@wuyan/html_parse" 5 import { HmParseHTML } from "@wuyan/html_parse"
6 import { basePath } from '../utils/baseUrl' 6 import { basePath } from '../utils/baseUrl'
7 -import {getCloudDown, beanType} from '../api/user'  
8 import loadingDialog from '../dialog/LoadingDialog' 7 import loadingDialog from '../dialog/LoadingDialog'
9 import UploadTipDialog from '../dialog/UploadTipDialog' 8 import UploadTipDialog from '../dialog/UploadTipDialog'
10 import { getReportDetail, getMalfunctionList, deleteRecords, successReport, returnSing } from '../api/originalRecords' 9 import { getReportDetail, getMalfunctionList, deleteRecords, successReport, returnSing } from '../api/originalRecords'
@@ -36,7 +35,6 @@ struct DetailRecords { @@ -36,7 +35,6 @@ struct DetailRecords {
36 @State findTime: string = '' 35 @State findTime: string = ''
37 @State applyCompanyComment: string = '' 36 @State applyCompanyComment: string = ''
38 @State maintenanceComment: string = '' 37 @State maintenanceComment: string = ''
39 - @State isShowCloudDown: boolean = false  
40 aboutToAppear(): void { 38 aboutToAppear(): void {
41 AppStorage.setOrCreate('videoPath', ''); 39 AppStorage.setOrCreate('videoPath', '');
42 if(!AppStorage.get('isShowTip')) { 40 if(!AppStorage.get('isShowTip')) {
@@ -45,9 +43,6 @@ struct DetailRecords { @@ -45,9 +43,6 @@ struct DetailRecords {
45 } 43 }
46 async onPageShow() { 44 async onPageShow() {
47 this.loadingController.open() 45 this.loadingController.open()
48 - // 是否可以上传云存储  
49 - let cloudDown: AxiosResponse<beanType> = await getCloudDown()  
50 - this.isShowCloudDown = cloudDown.data.msg == 'true'  
51 // 获取维保记录详情 46 // 获取维保记录详情
52 const detail: AxiosResponse<reportDetailTest> = await getReportDetail(reportId) 47 const detail: AxiosResponse<reportDetailTest> = await getReportDetail(reportId)
53 this.reportDetail = detail.data.data 48 this.reportDetail = detail.data.data
@@ -63,6 +58,7 @@ struct DetailRecords { @@ -63,6 +58,7 @@ struct DetailRecords {
63 } 58 }
64 } 59 }
65 60
  61 + // 加载弹窗
66 loadingController: CustomDialogController = new CustomDialogController({ 62 loadingController: CustomDialogController = new CustomDialogController({
67 builder: loadingDialog(), 63 builder: loadingDialog(),
68 customStyle: true, 64 customStyle: true,
@@ -71,6 +67,7 @@ struct DetailRecords { @@ -71,6 +67,7 @@ struct DetailRecords {
71 autoCancel: false 67 autoCancel: false
72 }) 68 })
73 69
  70 + // 上传下载提示框
74 uploadController: CustomDialogController = new CustomDialogController({ 71 uploadController: CustomDialogController = new CustomDialogController({
75 builder: UploadTipDialog(), 72 builder: UploadTipDialog(),
76 cornerRadius: 10 73 cornerRadius: 10
@@ -94,6 +91,125 @@ struct DetailRecords { @@ -94,6 +91,125 @@ struct DetailRecords {
94 isImgOrVideo = (list: ItemList[]): boolean => { 91 isImgOrVideo = (list: ItemList[]): boolean => {
95 return list.some(item => item.cosKey !== null) 92 return list.some(item => item.cosKey !== null)
96 } 93 }
  94 +
  95 + // 分享签名
  96 + shareSignature = () => {
  97 + AlertDialog.show({
  98 + title: '分享签名提示',
  99 + message: `出于对多个甲方见证人签名的考虑,在甲方签名完成后,仍是"待甲方签名"的状态,需【维保公司账号】前往【更多操作】-->【完成】`,
  100 + alignment: DialogAlignment.Center,
  101 + primaryButton: {
  102 + value: '取消',
  103 + action: () => {
  104 + console.info('Callback when the first button is clicked')
  105 + }
  106 + },
  107 + secondaryButton: {
  108 + enabled: true,
  109 + defaultFocus: true,
  110 + style: DialogButtonStyle.HIGHLIGHT,
  111 + value: '确认',
  112 + action: async () => {
  113 + this.copyText(`https://xfappht.crgx.net/report/record?id=${reportId}&token=${preferencesUtils.get('XF_TOKEN', '')}&time=${new Date().getTime()}&type=firstPartySign&username=${preferencesUtils.get('XF_USERNAME', '')}`)
  114 + }
  115 + }
  116 + })
  117 + }
  118 + // 查看记录
  119 + lookReport = () => {
  120 + if(personId !== '') {
  121 + router.pushUrl({
  122 + url: 'pages/LookRecords',
  123 + params: {
  124 + reportId: this.reportDetail?.reportId,
  125 + pid: personId
  126 + }
  127 + })
  128 + } else {
  129 + router.pushUrl({
  130 + url: 'pages/LookRecordCompany',
  131 + params: {
  132 + reportId: this.reportDetail?.reportId
  133 + }
  134 + })
  135 + }
  136 + }
  137 + // 修改记录
  138 + updateReport = () => {
  139 + AlertDialog.show({
  140 + title: '重要提示',
  141 + message: `退回编辑会清除所有的维保人员签名和甲方签名,确认退回?`,
  142 + alignment: DialogAlignment.Center,
  143 + primaryButton: {
  144 + value: '取消',
  145 + action: () => {
  146 + console.info('Callback when the first button is clicked')
  147 + }
  148 + },
  149 + secondaryButton: {
  150 + enabled: true,
  151 + defaultFocus: true,
  152 + style: DialogButtonStyle.HIGHLIGHT,
  153 + value: '确认',
  154 + action: async () => {
  155 + const res: AxiosResponse<configTest> = await returnSing(reportId)
  156 + promptAction.showToast({message: res.data.msg})
  157 + const detail: AxiosResponse<reportDetailTest> = await getReportDetail(reportId)
  158 + this.reportDetail = detail.data.data
  159 + }
  160 + }
  161 + })
  162 + }
  163 + // 完成签发
  164 + IssueCompleted = () => {
  165 + AlertDialog.show({
  166 + title: '提示',
  167 + message: `完成签发后不可退回修改,确认完成吗`,
  168 + alignment: DialogAlignment.Center,
  169 + primaryButton: {
  170 + value: '取消',
  171 + action: () => {
  172 + console.info('Callback when the first button is clicked')
  173 + }
  174 + },
  175 + secondaryButton: {
  176 + enabled: true,
  177 + defaultFocus: true,
  178 + style: DialogButtonStyle.HIGHLIGHT,
  179 + value: '确认',
  180 + action: async () => {
  181 + await successReport(reportId)
  182 + await deleteRecords({reportId, state: '1'})
  183 + promptAction.showToast({message: '修改完成'})
  184 + }
  185 + }
  186 + })
  187 + }
  188 + // 删除记录
  189 + deleteReport = () => {
  190 + AlertDialog.show({
  191 + title: '删除提示',
  192 + message: `维保原始记录一经删除,无法找回,确认删除${this.reportDetail?.reportName}(${this.reportDetail?.reportNo})的原始记录吗?`,
  193 + alignment: DialogAlignment.Center,
  194 + primaryButton: {
  195 + value: '取消',
  196 + action: () => {
  197 + console.info('Callback when the first button is clicked')
  198 + }
  199 + },
  200 + secondaryButton: {
  201 + enabled: true,
  202 + defaultFocus: true,
  203 + style: DialogButtonStyle.HIGHLIGHT,
  204 + value: '确认',
  205 + action: async () => {
  206 + await deleteRecords({reportId, state: '2'})
  207 + router.back()
  208 + }
  209 + }
  210 + })
  211 + }
  212 +
97 build() { 213 build() {
98 Column(){ 214 Column(){
99 NavHeader({title: '维保记录详情'}) 215 NavHeader({title: '维保记录详情'})
@@ -175,29 +291,7 @@ struct DetailRecords { @@ -175,29 +291,7 @@ struct DetailRecords {
175 Row({space: 5}){ 291 Row({space: 5}){
176 Image($r('app.media.share')).width(14) 292 Image($r('app.media.share')).width(14)
177 Text('分享签名').fontSize(12).fontColor('#1890ff') 293 Text('分享签名').fontSize(12).fontColor('#1890ff')
178 - }.onClick(() => {  
179 - AlertDialog.show({  
180 - title: '分享签名提示',  
181 - message: `出于对多个甲方见证人签名的考虑,在甲方签名完成后,仍是"待甲方签名"的状态,需【维保公司账号】前往【更多操作】-->【完成】`,  
182 - alignment: DialogAlignment.Center,  
183 - primaryButton: {  
184 - value: '取消',  
185 - action: () => {  
186 - console.info('Callback when the first button is clicked')  
187 - }  
188 - },  
189 - secondaryButton: {  
190 - enabled: true,  
191 - defaultFocus: true,  
192 - style: DialogButtonStyle.HIGHLIGHT,  
193 - value: '确认',  
194 - action: async () => {  
195 - console.log(`https://xfappht.crgx.net/report/record?id=${reportId}&token=${preferencesUtils.get('XF_TOKEN', '')}&time=${new Date().getTime()}&type=firstPartySign&username=${preferencesUtils.get('XF_USERNAME', '')}`)  
196 - this.copyText(`https://xfappht.crgx.net/report/record?id=${reportId}&token=${preferencesUtils.get('XF_TOKEN', '')}&time=${new Date().getTime()}&type=firstPartySign&username=${preferencesUtils.get('XF_USERNAME', '')}`)  
197 - }  
198 - }  
199 - })  
200 - }) 294 + }.onClick(() => { this.shareSignature() })
201 }.border({width: {bottom: 1}, color: '#eee'}).padding(10).justifyContent(FlexAlign.SpaceBetween).width('100%') 295 }.border({width: {bottom: 1}, color: '#eee'}).padding(10).justifyContent(FlexAlign.SpaceBetween).width('100%')
202 .visibility(this.reportDetail?.state == '1' || this.reportDetail?.state == '5' ? Visibility.Visible : Visibility.None) 296 .visibility(this.reportDetail?.state == '1' || this.reportDetail?.state == '5' ? Visibility.Visible : Visibility.None)
203 Column({space: 5}){ 297 Column({space: 5}){
@@ -224,24 +318,7 @@ struct DetailRecords { @@ -224,24 +318,7 @@ struct DetailRecords {
224 Image($r('app.media.edit_1')).width(12) 318 Image($r('app.media.edit_1')).width(12)
225 Text('查看记录').fontColor('#1890ff').fontSize(12).margin({left: 3, right: 3}) 319 Text('查看记录').fontColor('#1890ff').fontSize(12).margin({left: 3, right: 3})
226 Image($r('app.media.right_arrow')).width(12) 320 Image($r('app.media.right_arrow')).width(12)
227 - }.onClick(() => {  
228 - if(personId !== '') {  
229 - router.pushUrl({  
230 - url: 'pages/LookRecords',  
231 - params: {  
232 - reportId: this.reportDetail?.reportId,  
233 - pid: personId  
234 - }  
235 - })  
236 - } else {  
237 - router.pushUrl({  
238 - url: 'pages/LookRecordCompany',  
239 - params: {  
240 - reportId: this.reportDetail?.reportId  
241 - }  
242 - })  
243 - }  
244 - }) 321 + }.onClick(() => { this.lookReport() })
245 }.justifyContent(FlexAlign.SpaceBetween).width('100%').margin({bottom: 10}) 322 }.justifyContent(FlexAlign.SpaceBetween).width('100%').margin({bottom: 10})
246 ForEach(this.projectList, (item: ProjectList, index) => { 323 ForEach(this.projectList, (item: ProjectList, index) => {
247 Column({space: 5}){ 324 Column({space: 5}){
@@ -277,9 +354,7 @@ struct DetailRecords { @@ -277,9 +354,7 @@ struct DetailRecords {
277 }) 354 })
278 router.pushUrl({ 355 router.pushUrl({
279 url: 'pages/VideoDetail', 356 url: 'pages/VideoDetail',
280 - params: {  
281 - cosKeyList: newArr  
282 - } 357 + params: { cosKeyList: newArr }
283 }) 358 })
284 }) 359 })
285 }.width('100%').justifyContent(FlexAlign.SpaceBetween) 360 }.width('100%').justifyContent(FlexAlign.SpaceBetween)
@@ -371,29 +446,7 @@ struct DetailRecords { @@ -371,29 +446,7 @@ struct DetailRecords {
371 Image($r('app.media.right_arrow')).width(16) 446 Image($r('app.media.right_arrow')).width(16)
372 }.padding(10).justifyContent(FlexAlign.SpaceBetween).width('100%').border({width: {bottom: 1}, color: '#eee'}) 447 }.padding(10).justifyContent(FlexAlign.SpaceBetween).width('100%').border({width: {bottom: 1}, color: '#eee'})
373 .visibility(this.reportDetail?.state == '1' ? Visibility.None : Visibility.Visible) 448 .visibility(this.reportDetail?.state == '1' ? Visibility.None : Visibility.Visible)
374 - .onClick(() => {  
375 - AlertDialog.show({  
376 - title: '删除提示',  
377 - message: `维保原始记录一经删除,无法找回,确认删除${this.reportDetail?.reportName}(${this.reportDetail?.reportNo})的原始记录吗?`,  
378 - alignment: DialogAlignment.Center,  
379 - primaryButton: {  
380 - value: '取消',  
381 - action: () => {  
382 - console.info('Callback when the first button is clicked')  
383 - }  
384 - },  
385 - secondaryButton: {  
386 - enabled: true,  
387 - defaultFocus: true,  
388 - style: DialogButtonStyle.HIGHLIGHT,  
389 - value: '确认',  
390 - action: async () => {  
391 - await deleteRecords({reportId, state: '2'})  
392 - router.back()  
393 - }  
394 - }  
395 - })  
396 - }) 449 + .onClick(() => { this.deleteReport() })
397 Row(){ 450 Row(){
398 Row(){ 451 Row(){
399 Image($r('app.media.finish')).width(16) 452 Image($r('app.media.finish')).width(16)
@@ -402,30 +455,7 @@ struct DetailRecords { @@ -402,30 +455,7 @@ struct DetailRecords {
402 Image($r('app.media.right_arrow')).width(16) 455 Image($r('app.media.right_arrow')).width(16)
403 }.border({width: {bottom: 1}, color: '#eee'}).padding(10).justifyContent(FlexAlign.SpaceBetween).width('100%') 456 }.border({width: {bottom: 1}, color: '#eee'}).padding(10).justifyContent(FlexAlign.SpaceBetween).width('100%')
404 .visibility(this.reportDetail?.state == '5' && roleName == 'company' ? Visibility.Visible : Visibility.None) 457 .visibility(this.reportDetail?.state == '5' && roleName == 'company' ? Visibility.Visible : Visibility.None)
405 - .onClick(async () => {  
406 - AlertDialog.show({  
407 - title: '提示',  
408 - message: `完成签发后不可退回修改,确认完成吗`,  
409 - alignment: DialogAlignment.Center,  
410 - primaryButton: {  
411 - value: '取消',  
412 - action: () => {  
413 - console.info('Callback when the first button is clicked')  
414 - }  
415 - },  
416 - secondaryButton: {  
417 - enabled: true,  
418 - defaultFocus: true,  
419 - style: DialogButtonStyle.HIGHLIGHT,  
420 - value: '确认',  
421 - action: async () => {  
422 - await successReport(reportId)  
423 - await deleteRecords({reportId, state: '1'})  
424 - promptAction.showToast({message: '修改完成'})  
425 - }  
426 - }  
427 - })  
428 - }) 458 + .onClick(async () => { this.IssueCompleted() })
429 Row(){ 459 Row(){
430 Row(){ 460 Row(){
431 Image($r('app.media.returnUpdate')).width(16) 461 Image($r('app.media.returnUpdate')).width(16)
@@ -434,41 +464,7 @@ struct DetailRecords { @@ -434,41 +464,7 @@ struct DetailRecords {
434 Image($r('app.media.right_arrow')).width(16) 464 Image($r('app.media.right_arrow')).width(16)
435 }.border({width: {bottom: 1}, color: '#eee'}).padding(10).justifyContent(FlexAlign.SpaceBetween).width('100%') 465 }.border({width: {bottom: 1}, color: '#eee'}).padding(10).justifyContent(FlexAlign.SpaceBetween).width('100%')
436 .visibility(this.reportDetail?.state == '5' && roleName == 'company' ? Visibility.Visible : Visibility.None) 466 .visibility(this.reportDetail?.state == '5' && roleName == 'company' ? Visibility.Visible : Visibility.None)
437 - .onClick(async () => {  
438 - AlertDialog.show({  
439 - title: '重要提示',  
440 - message: `退回编辑会清除所有的维保人员签名和甲方签名,确认退回?`,  
441 - alignment: DialogAlignment.Center,  
442 - primaryButton: {  
443 - value: '取消',  
444 - action: () => {  
445 - console.info('Callback when the first button is clicked')  
446 - }  
447 - },  
448 - secondaryButton: {  
449 - enabled: true,  
450 - defaultFocus: true,  
451 - style: DialogButtonStyle.HIGHLIGHT,  
452 - value: '确认',  
453 - action: async () => {  
454 - const res: AxiosResponse<configTest> = await returnSing(reportId)  
455 - promptAction.showToast({message: res.data.msg})  
456 - const detail: AxiosResponse<reportDetailTest> = await getReportDetail(reportId)  
457 - this.reportDetail = detail.data.data  
458 - }  
459 - }  
460 - })  
461 - })  
462 - // Row(){  
463 - // Row(){  
464 - // Image($r('app.media.lookView')).width(16)  
465 - // Text('预览统计').fontColor('#1890ff').fontSize(12).margin({left: 3, right: 3})  
466 - // }  
467 - // Image($r('app.media.right_arrow')).width(16)  
468 - // }.border({width: {bottom: 1}, color: '#eee'}).padding(10).justifyContent(FlexAlign.SpaceBetween).width('100%')  
469 - // .onClick(() => {  
470 - // pushOutsideWeb(`https://xfwbzs.crgx.net/report/preview?id=${reportId}`)  
471 - // }) 467 + .onClick(async () => { this.updateReport() })
472 Row(){ 468 Row(){
473 Row(){ 469 Row(){
474 Image($r('app.media.document')).width(16) 470 Image($r('app.media.document')).width(16)
@@ -477,9 +473,7 @@ struct DetailRecords { @@ -477,9 +473,7 @@ struct DetailRecords {
477 Image($r('app.media.right_arrow')).width(16) 473 Image($r('app.media.right_arrow')).width(16)
478 }.border({width: {bottom: 1}, color: '#eee'}).padding(10).justifyContent(FlexAlign.SpaceBetween).width('100%') 474 }.border({width: {bottom: 1}, color: '#eee'}).padding(10).justifyContent(FlexAlign.SpaceBetween).width('100%')
479 .visibility(this.reportDetail?.state == '1' ? Visibility.Visible : Visibility.None) 475 .visibility(this.reportDetail?.state == '1' ? Visibility.Visible : Visibility.None)
480 - .onClick(() => {  
481 - pushOutsideWeb(`${basePath}/report/view?id=${reportId}`)  
482 - }) 476 + .onClick(() => { pushOutsideWeb(`${basePath}/report/view?id=${reportId}`) })
483 Row(){ 477 Row(){
484 Row(){ 478 Row(){
485 Image($r('app.media.setting')).width(16) 479 Image($r('app.media.setting')).width(16)
@@ -488,9 +482,7 @@ struct DetailRecords { @@ -488,9 +482,7 @@ struct DetailRecords {
488 Image($r('app.media.right_arrow')).width(16) 482 Image($r('app.media.right_arrow')).width(16)
489 }.border({width: {bottom: 1}, color: '#eee'}).padding(10).justifyContent(FlexAlign.SpaceBetween).width('100%') 483 }.border({width: {bottom: 1}, color: '#eee'}).padding(10).justifyContent(FlexAlign.SpaceBetween).width('100%')
490 .visibility(this.reportDetail?.state == '1' ? Visibility.Visible : Visibility.None) 484 .visibility(this.reportDetail?.state == '1' ? Visibility.Visible : Visibility.None)
491 - .onClick(() => {  
492 - pushOutsideWeb(`${basePath}/report/view?id=${reportId}`)  
493 - }) 485 + .onClick(() => { pushOutsideWeb(`${basePath}/report/view?id=${reportId}`) })
494 }.backgroundColor('#fff').borderRadius(10).padding(10).width('100%') 486 }.backgroundColor('#fff').borderRadius(10).padding(10).width('100%')
495 }.width('100%') 487 }.width('100%')
496 }.backgroundColor('#f2f3f7').padding(10) 488 }.backgroundColor('#f2f3f7').padding(10)
@@ -36,6 +36,37 @@ struct Login { @@ -36,6 +36,37 @@ struct Login {
36 alignment: DialogAlignment.Bottom 36 alignment: DialogAlignment.Bottom
37 }) 37 })
38 38
  39 + submitLogin = async () => {
  40 + if(!this.agreeSelect) return promptAction.showToast({ message: '请勾选同意用户协议与隐私政策' })
  41 + if(this.rememberSelect) {
  42 + preferencesUtil.set('XF_ACCOUNT', this.loginForm.username) // 存入账号
  43 + preferencesUtil.set('XF_PASSWORD', this.loginForm.password) // 存入密码
  44 + }
  45 + const res: AxiosResponse<loginType> = await login(this.loginForm)
  46 + const token = res.data.token
  47 + preferencesUtil.set('XF_TOKEN', token) // 存入token
  48 + const accountInfo: AxiosResponse<InfoTest> = await getInfo()
  49 + let roleName: string = accountInfo.data.roles[0] || ''
  50 + preferencesUtil.set('XF_ROLE_NAME', roleName)
  51 + // 根据角色存储不同的数据
  52 + if(roleName == 'company'){
  53 + let companyInfo: AxiosResponse<companyTest> = await getCompanyInfo()
  54 + preferencesUtil.set('XF_COMPANY_INFO', JSON.stringify(companyInfo.data.data))
  55 + preferencesUtil.set('XF_COMPANY_ID', companyInfo.data.data.companyId)
  56 + preferencesUtil.set('XF_USERNAME', companyInfo.data.data.username)
  57 + preferencesUtil.set('XF_USER_ID', companyInfo.data.data.userId)
  58 + } else {
  59 + let personInfo: AxiosResponse<personTest> = await getPersonInfo()
  60 + preferencesUtil.set('XF_PERSON_INFO', JSON.stringify(personInfo.data.data))
  61 + preferencesUtil.set('XF_COMPANY_ID', personInfo.data.data.companyId || 0)
  62 + preferencesUtil.set('XF_PERSON_ID', personInfo.data.data.personId)
  63 + preferencesUtil.set('XF_USERNAME', personInfo.data.data.username)
  64 + }
  65 + router.pushUrl({
  66 + url: 'pages/Index'
  67 + })
  68 + }
  69 +
39 build() { 70 build() {
40 Column(){ 71 Column(){
41 Column(){ 72 Column(){
@@ -65,28 +96,16 @@ struct Login { @@ -65,28 +96,16 @@ struct Login {
65 .selectedColor('#1890ff') 96 .selectedColor('#1890ff')
66 .shape(CheckBoxShape.CIRCLE) 97 .shape(CheckBoxShape.CIRCLE)
67 .width(16).height(16) 98 .width(16).height(16)
68 - .mark({  
69 - size: 10,  
70 - strokeWidth: 5  
71 - })  
72 - .onChange((value) => {  
73 - this.agreeSelect = value  
74 - }) 99 + .mark({ size: 10, strokeWidth: 5 })
  100 + .onChange((value) => { this.agreeSelect = value })
75 Row(){ 101 Row(){
76 Text('已阅读并同意').fontSize(12).fontColor('#fff') 102 Text('已阅读并同意').fontSize(12).fontColor('#fff')
77 Text('《用户协议》').fontSize(12).fontColor(Color.Red) 103 Text('《用户协议》').fontSize(12).fontColor(Color.Red)
78 .onClick(() => { 104 .onClick(() => {
79 - router.pushUrl({  
80 - url: 'pages/UserAgreement'  
81 - })  
82 - }) 105 + router.pushUrl({ url: 'pages/UserAgreement' }) })
83 Text('和').fontSize(12).fontColor('#fff') 106 Text('和').fontSize(12).fontColor('#fff')
84 Text('《隐私政策》').fontSize(12).fontColor(Color.Red) 107 Text('《隐私政策》').fontSize(12).fontColor(Color.Red)
85 - .onClick(() => {  
86 - router.pushUrl({  
87 - url: 'pages/PrivacyPolicy'  
88 - })  
89 - }) 108 + .onClick(() => { router.pushUrl({ url: 'pages/PrivacyPolicy' }) })
90 } 109 }
91 }.width('100%').justifyContent(FlexAlign.Start) 110 }.width('100%').justifyContent(FlexAlign.Start)
92 Row({space: 5}){ 111 Row({space: 5}){
@@ -95,10 +114,7 @@ struct Login { @@ -95,10 +114,7 @@ struct Login {
95 .selectedColor('#1890ff') 114 .selectedColor('#1890ff')
96 .shape(CheckBoxShape.ROUNDED_SQUARE) 115 .shape(CheckBoxShape.ROUNDED_SQUARE)
97 .width(16).height(16) 116 .width(16).height(16)
98 - .mark({  
99 - size: 10,  
100 - strokeWidth: 5  
101 - }) 117 + .mark({ size: 10, strokeWidth: 5 })
102 .onChange((value: boolean) => { 118 .onChange((value: boolean) => {
103 this.rememberSelect = value 119 this.rememberSelect = value
104 preferencesUtil.set('XF_REMEMBER', value) 120 preferencesUtil.set('XF_REMEMBER', value)
@@ -120,46 +136,7 @@ struct Login { @@ -120,46 +136,7 @@ struct Login {
120 .fontSize(16).fontColor('#1890ff') 136 .fontSize(16).fontColor('#1890ff')
121 .borderRadius(20).backgroundColor(Color.White) 137 .borderRadius(20).backgroundColor(Color.White)
122 .margin({top: 20}) 138 .margin({top: 20})
123 - .onClick(async () => {  
124 - if(!this.agreeSelect) {  
125 - return promptAction.showToast({  
126 - message: '请勾选同意用户协议与隐私政策'  
127 - })  
128 - }  
129 - if(this.rememberSelect) {  
130 - preferencesUtil.set('XF_ACCOUNT', this.loginForm.username)  
131 - preferencesUtil.set('XF_PASSWORD', this.loginForm.password)  
132 - }  
133 - const res: AxiosResponse<loginType> = await login(this.loginForm)  
134 - const token = res.data.token  
135 - preferencesUtil.set('XF_TOKEN', token)  
136 - const accountInfo: AxiosResponse<InfoTest> = await getInfo()  
137 - let roleName: string = accountInfo.data.roles[0] || ''  
138 - preferencesUtil.set('XF_ROLE_NAME', roleName)  
139 - // 根据角色存储不同的数据  
140 - if(roleName == 'person'){  
141 - let personInfo: AxiosResponse<personTest> = await getPersonInfo()  
142 - preferencesUtil.set('XF_PERSON_INFO', JSON.stringify(personInfo.data.data))  
143 - preferencesUtil.set('XF_COMPANY_ID', personInfo.data.data.companyId)  
144 - preferencesUtil.set('XF_PERSON_ID', personInfo.data.data.personId)  
145 - preferencesUtil.set('XF_USERNAME', personInfo.data.data.username)  
146 - } else if(roleName == 'company'){  
147 - let companyInfo: AxiosResponse<companyTest> = await getCompanyInfo()  
148 - preferencesUtil.set('XF_COMPANY_INFO', JSON.stringify(companyInfo.data.data))  
149 - preferencesUtil.set('XF_COMPANY_ID', companyInfo.data.data.companyId)  
150 - preferencesUtil.set('XF_USERNAME', companyInfo.data.data.username)  
151 - preferencesUtil.set('XF_USER_ID', companyInfo.data.data.userId)  
152 - } else {  
153 - let personInfo: AxiosResponse<personTest> = await getPersonInfo()  
154 - preferencesUtil.set('XF_PERSON_INFO', JSON.stringify(personInfo.data.data))  
155 - preferencesUtil.set('XF_COMPANY_ID', personInfo.data.data.companyId || 0)  
156 - preferencesUtil.set('XF_PERSON_ID', personInfo.data.data.personId)  
157 - preferencesUtil.set('XF_USERNAME', personInfo.data.data.username)  
158 - }  
159 - router.pushUrl({  
160 - url: 'pages/Index'  
161 - })  
162 - }) 139 + .onClick(() => { this.submitLogin() })
163 Row({space: 10}){ 140 Row({space: 10}){
164 Row({ space: 5}){ 141 Row({ space: 5}){
165 Text('忘记密码').width(15).fontSize(14).height(60).fontColor('#fff') 142 Text('忘记密码').width(15).fontSize(14).height(60).fontColor('#fff')
@@ -167,11 +144,7 @@ struct Login { @@ -167,11 +144,7 @@ struct Login {
167 }.width(50).height(100).linearGradient({ 144 }.width(50).height(100).linearGradient({
168 angle: GradientDirection.Bottom, colors: [['#72b8d6', 0.0], ['#70a6d8', 0.5]] 145 angle: GradientDirection.Bottom, colors: [['#72b8d6', 0.0], ['#70a6d8', 0.5]]
169 }).borderRadius({topRight: 50, bottomRight: 50}).justifyContent(FlexAlign.End).padding(10) 146 }).borderRadius({topRight: 50, bottomRight: 50}).justifyContent(FlexAlign.End).padding(10)
170 - .onClick(() => {  
171 - router.pushUrl({  
172 - url: 'pages/UpdatePassword'  
173 - })  
174 - }) 147 + .onClick(() => { router.pushUrl({ url: 'pages/UpdatePassword' }) })
175 Column({space: 10}){ 148 Column({space: 10}){
176 Text('监管工具箱').fontSize(14).fontColor('#fff') 149 Text('监管工具箱').fontSize(14).fontColor('#fff')
177 Text('立即使用').height(30).fontSize(14).fontColor('#1890ff').width(120).textAlign(TextAlign.Center) 150 Text('立即使用').height(30).fontSize(14).fontColor('#1890ff').width(120).textAlign(TextAlign.Center)
@@ -179,20 +152,14 @@ struct Login { @@ -179,20 +152,14 @@ struct Login {
179 }.layoutWeight(1).height(80).linearGradient({ 152 }.layoutWeight(1).height(80).linearGradient({
180 angle: GradientDirection.Bottom, colors: [['#72b8d6', 0.0], ['#70a6d8', 0.5]] 153 angle: GradientDirection.Bottom, colors: [['#72b8d6', 0.0], ['#70a6d8', 0.5]]
181 }).borderRadius(40).justifyContent(FlexAlign.Center) 154 }).borderRadius(40).justifyContent(FlexAlign.Center)
182 - .onClick(() => {  
183 - router.pushUrl({  
184 - url: 'pages/ToolBox'  
185 - })  
186 - }) 155 + .onClick(() => { router.pushUrl({ url: 'pages/ToolBox' }) })
187 Row({space: 5}){ 156 Row({space: 5}){
188 Image($r('app.media.left')).width(14) 157 Image($r('app.media.left')).width(14)
189 Text('立即注册').width(15).fontSize(14).height(60).fontColor('#fff') 158 Text('立即注册').width(15).fontSize(14).height(60).fontColor('#fff')
190 }.width(50).height(100).linearGradient({ 159 }.width(50).height(100).linearGradient({
191 angle: GradientDirection.Bottom, colors: [['#72b8d6', 0.0], ['#70a6d8', 0.5]] 160 angle: GradientDirection.Bottom, colors: [['#72b8d6', 0.0], ['#70a6d8', 0.5]]
192 }).borderRadius({topLeft: 50, bottomLeft: 50}).justifyContent(FlexAlign.Start).padding(10) 161 }).borderRadius({topLeft: 50, bottomLeft: 50}).justifyContent(FlexAlign.Start).padding(10)
193 - .onClick(() => {  
194 - this.selectRegController.open()  
195 - }) 162 + .onClick(() => { this.selectRegController.open() })
196 }.width('100%').height(100).justifyContent(FlexAlign.SpaceBetween) 163 }.width('100%').height(100).justifyContent(FlexAlign.SpaceBetween)
197 .position({x: 0, y: '80%'}) 164 .position({x: 0, y: '80%'})
198 Text('Ⓒ 广西世纪创软信息技术有限公司\n' + 165 Text('Ⓒ 广西世纪创软信息技术有限公司\n' +
@@ -6,9 +6,6 @@ class preferencesUtils { @@ -6,9 +6,6 @@ class preferencesUtils {
6 const context = getContext(this) 6 const context = getContext(this)
7 const preferences_obj = preferences.getPreferencesSync(context, {name: 'userData'}) 7 const preferences_obj = preferences.getPreferencesSync(context, {name: 'userData'})
8 const result = preferences_obj.getSync(key, value) 8 const result = preferences_obj.getSync(key, value)
9 - if(key == 'XF_PERSON_ID') {  
10 - console.log(`获取${key}成功`)  
11 - }  
12 return result 9 return result
13 } catch (e){ 10 } catch (e){
14 return value 11 return value
@@ -21,9 +18,6 @@ class preferencesUtils { @@ -21,9 +18,6 @@ class preferencesUtils {
21 const preferences_obj = preferences.getPreferencesSync(context, {name: 'userData'}) 18 const preferences_obj = preferences.getPreferencesSync(context, {name: 'userData'})
22 preferences_obj.putSync(key, value) 19 preferences_obj.putSync(key, value)
23 preferences_obj.flush().then(() => { 20 preferences_obj.flush().then(() => {
24 - if(key == 'XF_PERSON_ID') {  
25 - console.log(`存储${key}成功, 值为${value}`)  
26 - }  
27 }) 21 })
28 } catch (e){ 22 } catch (e){
29 } 23 }
@@ -35,7 +29,6 @@ class preferencesUtils { @@ -35,7 +29,6 @@ class preferencesUtils {
35 const preferences_obj = preferences.getPreferencesSync(context, {name: 'userData'}) 29 const preferences_obj = preferences.getPreferencesSync(context, {name: 'userData'})
36 preferences_obj.deleteSync(key) 30 preferences_obj.deleteSync(key)
37 preferences_obj.flush().then(() => { 31 preferences_obj.flush().then(() => {
38 - console.log('删除成功')  
39 }) 32 })
40 } catch (e){ 33 } catch (e){
41 console.log('删除失败') 34 console.log('删除失败')