|
...
|
...
|
@@ -34,12 +34,12 @@ interface comprehensiveType { |
|
|
|
}
|
|
|
|
let params = router.getParams() as routerParams
|
|
|
|
let reportId: number | undefined = params?.reportId
|
|
|
|
|
|
|
|
// 查看原始记录编号是否存在
|
|
|
|
let queryReportNo = async (reportNo: string) => {
|
|
|
|
let res: AxiosResponse<RecordsList> = await getRecordsList({pageNum: 1, pageSize: 10, reportNo})
|
|
|
|
return res.data.total > 0
|
|
|
|
}
|
|
|
|
|
|
|
|
// 模糊查询
|
|
|
|
//模糊查询1:利用字符串的indexOf方法
|
|
|
|
function searchByIndexOf(keyWord: string, list: equipmentType[]){
|
|
...
|
...
|
@@ -108,7 +108,8 @@ struct AddRecords { |
|
|
|
@Builder indicatorBuilder(icon: ResourceStr) {
|
|
|
|
Image(icon)
|
|
|
|
}
|
|
|
|
searchController: SearchController = new SearchController()
|
|
|
|
personId = preferencesUtil.get('XF_PERSON_ID', 0)
|
|
|
|
flag: boolean = true
|
|
|
|
// 添加维保记录类型参数
|
|
|
|
@State addForm: addParamsType = {
|
|
|
|
reportName: '',
|
|
...
|
...
|
@@ -129,11 +130,12 @@ struct AddRecords { |
|
|
|
projectList: [],
|
|
|
|
equipmentList: [],
|
|
|
|
maintenancePeopleList: [],
|
|
|
|
technicalDirectorId: ''
|
|
|
|
technicalDirectorId: '',
|
|
|
|
county: '',
|
|
|
|
city: '',
|
|
|
|
}
|
|
|
|
personId = preferencesUtil.get('XF_PERSON_ID', 0)
|
|
|
|
@State pickerValue:string[] = ['广西壮族自治区','南宁市','青秀区']//省市区选中值
|
|
|
|
@State comprehensiveReview: comprehensiveType = {
|
|
|
|
@State comprehensiveReview: comprehensiveType = { // 综合评述
|
|
|
|
range: '',
|
|
|
|
facility: '',
|
|
|
|
existingProblem: '',
|
|
...
|
...
|
@@ -141,7 +143,7 @@ struct AddRecords { |
|
|
|
other: '',
|
|
|
|
correctedProblems: '',
|
|
|
|
}
|
|
|
|
// 回显数据使用
|
|
|
|
// 回显消防设施和仪器设备数据使用
|
|
|
|
@State viewEquipmentList: string[] = []
|
|
|
|
@State fireFacilitiesList: string[] = []
|
|
|
|
// 维保人员列表
|
|
...
|
...
|
@@ -158,10 +160,12 @@ struct AddRecords { |
|
|
|
// 初始设备列表
|
|
|
|
@State initEquipmentList: equipmentType[] = []
|
|
|
|
@State errorMsg: string = ''
|
|
|
|
flag: boolean = true
|
|
|
|
@State text: string = "请选择维保记录类型"
|
|
|
|
async aboutToAppear() {
|
|
|
|
// reportId等于undefined为编辑状态
|
|
|
|
this.isEdit = reportId !== undefined
|
|
|
|
this.addForm.city = this.pickerValue[1]
|
|
|
|
this.addForm.county = this.pickerValue[2]
|
|
|
|
if(reportId){
|
|
|
|
this.addForm.reportId = reportId
|
|
|
|
const res: AxiosResponse<reportDetailTest> = await getReportDetail(reportId)
|
|
...
|
...
|
@@ -179,6 +183,8 @@ struct AddRecords { |
|
|
|
this.addForm.state = result.state
|
|
|
|
this.addForm.technicalDirectorId = result.technicalDirectorId
|
|
|
|
this.addForm.maintenancePeopleList = result.technicalDirectorId?.split(',')
|
|
|
|
this.addForm.city = result.city
|
|
|
|
this.addForm.county = result.county
|
|
|
|
this.addForm.approvePersonId = result.approvePersonId as number
|
|
|
|
this.addForm.projectList = result.projectList.map(item => {
|
|
|
|
return { projectId: item.projectId } as projectType
|
|
...
|
...
|
@@ -189,6 +195,7 @@ struct AddRecords { |
|
|
|
this.pickerValue = ['广西壮族自治区', result.city as string, result.county as string]
|
|
|
|
this.comprehensiveReview = extractRichText(result.result)
|
|
|
|
}
|
|
|
|
// 获取项目的类型列表
|
|
|
|
getMaintenanceType().then((res: AxiosResponse<quarterTest>) => {
|
|
|
|
this.recordsType = res.data.data
|
|
|
|
})
|
|
...
|
...
|
@@ -207,12 +214,8 @@ struct AddRecords { |
|
|
|
this.companyPersonList = res.data.rows
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
@State changeValue: string = '';
|
|
|
|
@State text: string = "请选择维保记录类型"
|
|
|
|
@State index: number = 2
|
|
|
|
@State space: number = 8
|
|
|
|
@State arrowPosition: ArrowPosition = ArrowPosition.END
|
|
|
|
// 搜索框实例
|
|
|
|
searchController: SearchController = new SearchController()
|
|
|
|
|
|
|
|
// 选择区域弹窗
|
|
|
|
areaController: CustomDialogController = new CustomDialogController({
|
|
...
|
...
|
@@ -225,7 +228,8 @@ struct AddRecords { |
|
|
|
this.addForm.county = value[2]
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
customStyle: true
|
|
|
|
customStyle: true,
|
|
|
|
autoCancel: false
|
|
|
|
})
|
|
|
|
|
|
|
|
// 加载弹窗
|
|
...
|
...
|
@@ -236,6 +240,61 @@ struct AddRecords { |
|
|
|
alignment: DialogAlignment.Center,
|
|
|
|
autoCancel: false
|
|
|
|
})
|
|
|
|
|
|
|
|
// 获取维保记录类型
|
|
|
|
getReportType = async (dictValue: string) => {
|
|
|
|
this.addForm.reportType = dictValue
|
|
|
|
if(this.flag) {
|
|
|
|
this.addForm.projectList = []
|
|
|
|
this.fireFacilitiesList = []
|
|
|
|
this.addForm.fireFacilities = ''
|
|
|
|
this.flag = false
|
|
|
|
let result: AxiosResponse<LatestProjectTest> = await getLatestProjectList(dictValue)
|
|
|
|
this.latestProjectList = result.data.data
|
|
|
|
this.flag = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 提交表单
|
|
|
|
submitForm = async () => {
|
|
|
|
if(this.addForm.reportName == '') {
|
|
|
|
return promptAction.showToast({message: '项目名称为必填项'})
|
|
|
|
} else if(this.addForm.reportNo == '') {
|
|
|
|
return promptAction.showToast({message: '项目编号为必填项'})
|
|
|
|
} else if(this.addForm.applyCompanyName == ''){
|
|
|
|
return promptAction.showToast({message: '消防设施管理单位为必填项'})
|
|
|
|
} else if(this.addForm.maintenanceTime == '请选择起始日期' || this.addForm.maintenanceEndTime == '请选择结束日期'){
|
|
|
|
return promptAction.showToast({message: '维保日期为必填项'})
|
|
|
|
} else if(this.addForm.fireFacilities == ''){
|
|
|
|
return promptAction.showToast({message: '至少选择一下消防设施'})
|
|
|
|
} else if(this.addForm.maintenancePeople == ''){
|
|
|
|
return promptAction.showToast({message: '请选择维保人员'})
|
|
|
|
}
|
|
|
|
if(this.errorMsg !== '') {
|
|
|
|
return promptAction.showToast({message: '校验失败'})
|
|
|
|
}
|
|
|
|
if(!this.addForm.maintenancePeopleList?.includes(this.personId.toString())){
|
|
|
|
return promptAction.showToast({message: '本人必须在维护人员中'})
|
|
|
|
}
|
|
|
|
this.addForm.result = mergeRichText(this.comprehensiveReview)
|
|
|
|
if(this.isEdit){
|
|
|
|
this.loadingController.open()
|
|
|
|
await updateRecords(this.addForm)
|
|
|
|
this.loadingController.close()
|
|
|
|
promptAction.showToast({
|
|
|
|
message: '更新成功'
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
this.loadingController.open()
|
|
|
|
this.addForm.maintenanceDate = [this.addForm.maintenanceTime as string, this.addForm.maintenanceEndTime as string]
|
|
|
|
await addRecords(this.addForm)
|
|
|
|
this.loadingController.close()
|
|
|
|
promptAction.showToast({
|
|
|
|
message: '添加成功'
|
|
|
|
})
|
|
|
|
router.back()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
build() {
|
|
|
|
Column(){
|
|
|
|
NavHeader({title: '添加原始记录'})
|
|
...
|
...
|
@@ -419,19 +478,7 @@ struct AddRecords { |
|
|
|
Text(item.dictLabel)
|
|
|
|
}.margin({right: 5,bottom: 5})
|
|
|
|
Row().width(80).height(30).backgroundColor(Color.White).opacity(0.1)
|
|
|
|
.onClick(() => {
|
|
|
|
this.addForm.reportType = item.dictValue
|
|
|
|
if(this.flag) {
|
|
|
|
this.addForm.projectList = []
|
|
|
|
this.fireFacilitiesList = []
|
|
|
|
this.addForm.fireFacilities = ''
|
|
|
|
this.flag = false
|
|
|
|
getLatestProjectList(item.dictValue).then((res: AxiosResponse<LatestProjectTest>) => {
|
|
|
|
this.latestProjectList = res.data.data
|
|
|
|
this.flag = true
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.onClick(async () => { await this.getReportType(item.dictValue) })
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
...
|
...
|
@@ -591,44 +638,8 @@ struct AddRecords { |
|
|
|
Row(){
|
|
|
|
Text('提交').borderRadius(5).width('100%').height(30).fontColor('#fff')
|
|
|
|
.backgroundColor('#1B65FD').fontSize(14).textAlign(TextAlign.Center)
|
|
|
|
.onClick(async () => {
|
|
|
|
if(this.addForm.reportName == '') {
|
|
|
|
return promptAction.showToast({message: '项目名称为必填项'})
|
|
|
|
} else if(this.addForm.reportNo == '') {
|
|
|
|
return promptAction.showToast({message: '项目编号为必填项'})
|
|
|
|
} else if(this.addForm.applyCompanyName == ''){
|
|
|
|
return promptAction.showToast({message: '消防设施管理单位为必填项'})
|
|
|
|
} else if(this.addForm.maintenanceTime == '请选择起始日期' || this.addForm.maintenanceEndTime == '请选择结束日期'){
|
|
|
|
return promptAction.showToast({message: '维保日期为必填项'})
|
|
|
|
} else if(this.addForm.fireFacilities == ''){
|
|
|
|
return promptAction.showToast({message: '至少选择一下消防设施'})
|
|
|
|
} else if(this.addForm.maintenancePeople == ''){
|
|
|
|
return promptAction.showToast({message: '请选择维保人员'})
|
|
|
|
}
|
|
|
|
if(this.errorMsg !== '') {
|
|
|
|
return promptAction.showToast({message: '校验失败'})
|
|
|
|
}
|
|
|
|
if(!this.addForm.maintenancePeopleList?.includes(this.personId.toString())){
|
|
|
|
return promptAction.showToast({message: '本人必须在维护人员中'})
|
|
|
|
}
|
|
|
|
if(this.isEdit){
|
|
|
|
this.loadingController.open()
|
|
|
|
this.addForm.result = mergeRichText(this.comprehensiveReview)
|
|
|
|
await updateRecords(this.addForm)
|
|
|
|
this.loadingController.close()
|
|
|
|
promptAction.showToast({
|
|
|
|
message: '更新成功'
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
this.loadingController.open()
|
|
|
|
this.addForm.maintenanceDate = [this.addForm.maintenanceTime as string, this.addForm.maintenanceEndTime as string]
|
|
|
|
await addRecords(this.addForm)
|
|
|
|
this.loadingController.close()
|
|
|
|
promptAction.showToast({
|
|
|
|
message: '添加成功'
|
|
|
|
})
|
|
|
|
router.back()
|
|
|
|
}
|
|
|
|
.onClick(() => {
|
|
|
|
this.submitForm()
|
|
|
|
})
|
|
|
|
}.width('100%').height(40).backgroundColor('#fff').padding({left: 10, right: 10})
|
|
|
|
}.width('100%').height('100%').backgroundColor('#f2f3f7')
|
...
|
...
|
|