From 7be06627885d51aa6834f9c5453525e6b1bc826e Mon Sep 17 00:00:00 2001 From: ancong <12345678> Date: Fri, 23 Jan 2026 15:55:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=9B=B4=E6=96=B0=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/zhixing/addxianchang.vue | 293 ++++++++++-------- src/pages/zhixing/fucha.vue | 60 +++- src/pages/zhixing/fuchaxwt.vue | 70 ++++- src/pages/zhixing/xianchang.vue | 10 +- .../csr-uni-data-select.vue | 44 ++- src/utils/usersqlite/posteditxianchang.js | 41 ++- 6 files changed, 347 insertions(+), 171 deletions(-) diff --git a/src/pages/zhixing/addxianchang.vue b/src/pages/zhixing/addxianchang.vue index 8390098..537643c 100644 --- a/src/pages/zhixing/addxianchang.vue +++ b/src/pages/zhixing/addxianchang.vue @@ -3091,9 +3091,13 @@ 问题描述: - + + + @@ -3183,6 +3187,7 @@ parseObjectToArray, savebendiImage, } from '@/utils/util' + export default { components: { UniMenu, @@ -3397,7 +3402,8 @@ this.formdata.voiceUrl = ''; }, - parseStr(str, resultInfo = "") { + parseStr(str, resultInfo = "", showval = true) { + //str--字符串 resultInfo--值 showval--是否清空值(保存并添加时用的) const regex = /\{(\d+)\}/g; const matches = []; let match; @@ -3434,7 +3440,7 @@ // 构建list数组 const list = matches.map((match, index) => ({ - value: index < values.length ? values[index] : '', + value: showval ? index < values.length ? values[index] : '' : '', maxvalue: parseInt(match.number, 10), dw: index === matches.length - 1 ? dw : '' })); @@ -3483,6 +3489,7 @@ let jsonlist = fujianjson.fubiaolist; this.fubiaoobj.jsonmap = jsonlist.filter(item => item.attachmentType == objitem.attachmentType)[0] this.fubiaoobj.datalist = this.parseObjectToArray(this.fubiaoobj.jsonmap.data); + console.log('456654645', this.fubiaoobj); } else { let jsonlist = fujianjson.fubiaolist; this.fubiaoobj.jsonmap = jsonlist.filter(item => item.attachmentType == objitem.attachmentType)[0] @@ -3622,6 +3629,21 @@ this.$modal.msgError("抽查情况不能为空!") return; } + + if (this.formdata.materialActivityFiles) { + let returnshow = false; + for (let cc of this.formdata.materialActivityFiles) { + if (cc.resultType === '' || cc.resultType === null) { + returnshow = true; + this.$modal.msgError("现场验收不能为空!") + + break; + } + } + if (returnshow) return; + } + + for (let mm of this.locationslist) { mm.selectFlag = null; } @@ -3635,7 +3657,7 @@ } } - if (this.formdata.imgUrlbase64list) { + if (this.formdata.imgUrlbase64list && typeof this.formdata.imgUrlbase64list !== "string") { this.formdata.imgUrlbase64list = JSON.stringify(this.formdata.imgUrlbase64list); } this.formdata.locations = JSON.stringify(this.locationslist); @@ -3663,7 +3685,7 @@ } else { this.formdata.padstatus = '2' } - if (this.formdata.materialActivityFiles) { + if (this.formdata.materialActivityFiles && typeof this.formdata.materialActivityFiles !== "string") { this.formdata.materialActivityFiles = JSON.stringify(this.formdata.materialActivityFiles) } if (this.fubiaoobj) { @@ -3788,12 +3810,27 @@ this.$modal.msgError("抽查情况不能为空!") return; } + + if (this.formdata.materialActivityFiles) { + let returnshow = false; + for (let cc of this.formdata.materialActivityFiles) { + if (cc.resultType === '' || cc.resultType === null) { + returnshow = true; + this.$modal.msgError("现场验收不能为空!") + + break; + } + } + if (returnshow) return; + } + + const baocunitem = JSON.parse(JSON.stringify(this.formdata)); for (let mm of this.locationslist) { mm.selectFlag = null; } - if (this.formdata.checkPointids) { - for (let m of this.formdata.checkPointids) { + if (baocunitem.checkPointids) { + for (let m of baocunitem.checkPointids) { let index = this.locationslist.findIndex(element => element.standardLocationId == m); // 使用 findIndex 直接获取索引 if (index != -1) { @@ -3803,12 +3840,12 @@ } - if (this.formdata.imgUrlbase64list) { - this.formdata.imgUrlbase64list = JSON.stringify(this.formdata.imgUrlbase64list); + if (baocunitem.imgUrlbase64list && typeof baocunitem.imgUrlbase64list !== "string") { + baocunitem.imgUrlbase64list = JSON.stringify(baocunitem.imgUrlbase64list); } - this.formdata.locations = JSON.stringify(this.locationslist); - this.formdata.imgUrl = this.imgfileList1.toString(); - if (this.formdata.tableLevel4Id) { + baocunitem.locations = JSON.stringify(this.locationslist); + baocunitem.imgUrl = this.imgfileList1.toString(); + if (baocunitem.tableLevel4Id) { // if (this.formdata.padstatus == '0') { // //padstatus 0--没有tableLevel4Id 1--有tableLevel4Id 2--需要新增的 3--需要修改的 4--删除的 // this.formdata.padstatus = '2' @@ -3816,114 +3853,111 @@ // //padstatus 0--没有tableLevel4Id 1--有tableLevel4Id 2--需要新增的 3--需要修改的 4--删除的 // this.formdata.padstatus = '3' // } - this.formdata.padstatus = '3' + baocunitem.padstatus = '3' } else { - this.formdata.padstatus = '2' + baocunitem.padstatus = '2' } - if (this.formdata.materialActivityFiles) { - this.formdata.materialActivityFiles = JSON.stringify(this.formdata.materialActivityFiles) + if (baocunitem.materialActivityFiles && typeof baocunitem.materialActivityFiles !== "string") { + baocunitem.materialActivityFiles = JSON.stringify(baocunitem.materialActivityFiles) } - if (this.formdata.records) { - for (let s of this.formdata.records) { + if (baocunitem.records) { + for (let s of baocunitem.records) { let vallsit = s.infopadobj.list.map(item => item.value); s.resultInfo = vallsit.toString(); } - this.formdata.records = JSON.stringify(this.formdata.records); + baocunitem.records = JSON.stringify(baocunitem.records); } if (this.fubiaoobj) { - this.formdata.attachmentJson = JSON.stringify(this.fubiaoobj.formdata); + baocunitem.attachmentJson = JSON.stringify(this.fubiaoobj.formdata); } let updata = { - createTime: this.formdata.createTime, - updateTime: this.formdata.updateTime, - createBy: this.formdata.createBy, - updateBy: this.formdata.updateBy, - tableLevel4Id: this.formdata.tableLevel4Id, - tableLevel4Code: this.formdata.tableLevel4Code, - parentNo: this.formdata.parentNo, - parentId: this.formdata.parentId, - buildingId: this.formdata.buildingId, - checkPoint: this.formdata.checkPoint, - resultType: this.formdata.resultType, - resultTypeInfo: this.formdata.resultTypeInfo, - issue: this.formdata.issue, - standard: this.formdata.standard, - term: this.formdata.term, - issueType: this.formdata.issueType, - issueTypeInfo: this.formdata.issueTypeInfo, - rectifyCompanyId: this.formdata.rectifyCompanyId, - rectifyCompanyName: this.formdata.rectifyCompanyName, - regulatoryCompanyId: this.formdata.regulatoryCompanyId, - regulatoryCompanyName: this.formdata.regulatoryCompanyName, - expectDeadLineDate: this.formdata.expectDeadLineDate, - deadLineWarning: this.formdata.deadLineWarning, - attachmentId: this.formdata.attachmentId, - imgUrl: this.formdata.imgUrl, - voiceUrl: this.formdata.voiceUrl, - checkerName: this.formdata.checkerName, - checkDate: this.formdata.checkDate, - status: this.formdata.status, - statusInfo: this.formdata.statusInfo, - projectId: this.formdata.projectId, - remark: this.formdata.remark, - imgNum: this.formdata.imgNum, - attachmentJson: this.formdata.attachmentJson, - standardTableLevel2Id: this.formdata.standardTableLevel2Id, - standardTableLevel1Id: this.formdata.standardTableLevel1Id, - standardTableLevel3Id: this.formdata.standardTableLevel3Id, - standardTableLevel4Id: this.formdata.standardTableLevel4Id, - checkContent: this.formdata.checkContent, - phaseTypesControlInfo: this.formdata.phaseTypesControlInfo, - checkMethod: this.formdata.checkMethod, - allScopeFlag: this.formdata.allScopeFlag, - checkScope: this.formdata.checkScope, - activeCheckFlag: this.formdata.activeCheckFlag, - locationType: this.formdata.locationType, - locations: this.formdata.locations, - locationInfos: this.formdata.locationInfos, - records: this.formdata.records, - recordInfos: this.formdata.recordInfos, - materialActivityFiles: this.formdata.materialActivityFiles, - attachmentType: this.formdata.attachmentType, - attachmentName: this.formdata.attachmentName, - buildingName: this.formdata.buildingName, - buildingMap: this.formdata.buildingMap, - standardCommonIssues: this.formdata.standardCommonIssues, - companyMap: this.formdata.companyMap, - regulatoryCompanyMap: this.formdata.regulatoryCompanyMap, - issueTypeMap: this.formdata.issueTypeMap, - checkResultTypeMap: this.formdata.checkResultTypeMap, - logs: this.formdata.logs, - phaseTypes: this.formdata.phaseTypes, - syncTime: this.formdata.syncTime, - syncTimestamp: this.formdata.syncTimestamp, - imgUrlbase64list: this.formdata.imgUrlbase64list, - voiceUrllist: this.formdata.voiceUrllist, - padstatus: this.formdata.padstatus, + createTime: baocunitem.createTime, + updateTime: baocunitem.updateTime, + createBy: baocunitem.createBy, + updateBy: baocunitem.updateBy, + tableLevel4Id: baocunitem.tableLevel4Id, + tableLevel4Code: baocunitem.tableLevel4Code, + parentNo: baocunitem.parentNo, + parentId: baocunitem.parentId, + buildingId: baocunitem.buildingId, + checkPoint: baocunitem.checkPoint, + resultType: baocunitem.resultType, + resultTypeInfo: baocunitem.resultTypeInfo, + issue: baocunitem.issue, + standard: baocunitem.standard, + term: baocunitem.term, + issueType: baocunitem.issueType, + issueTypeInfo: baocunitem.issueTypeInfo, + rectifyCompanyId: baocunitem.rectifyCompanyId, + rectifyCompanyName: baocunitem.rectifyCompanyName, + regulatoryCompanyId: baocunitem.regulatoryCompanyId, + regulatoryCompanyName: baocunitem.regulatoryCompanyName, + expectDeadLineDate: baocunitem.expectDeadLineDate, + deadLineWarning: baocunitem.deadLineWarning, + attachmentId: baocunitem.attachmentId, + imgUrl: baocunitem.imgUrl, + voiceUrl: baocunitem.voiceUrl, + checkerName: baocunitem.checkerName, + checkDate: baocunitem.checkDate, + status: baocunitem.status, + statusInfo: baocunitem.statusInfo, + projectId: baocunitem.projectId, + remark: baocunitem.remark, + imgNum: baocunitem.imgNum, + attachmentJson: baocunitem.attachmentJson, + standardTableLevel2Id: baocunitem.standardTableLevel2Id, + standardTableLevel1Id: baocunitem.standardTableLevel1Id, + standardTableLevel3Id: baocunitem.standardTableLevel3Id, + standardTableLevel4Id: baocunitem.standardTableLevel4Id, + checkContent: baocunitem.checkContent, + phaseTypesControlInfo: baocunitem.phaseTypesControlInfo, + checkMethod: baocunitem.checkMethod, + allScopeFlag: baocunitem.allScopeFlag, + checkScope: baocunitem.checkScope, + activeCheckFlag: baocunitem.activeCheckFlag, + locationType: baocunitem.locationType, + locations: baocunitem.locations, + locationInfos: baocunitem.locationInfos, + records: baocunitem.records, + recordInfos: baocunitem.recordInfos, + materialActivityFiles: baocunitem.materialActivityFiles, + attachmentType: baocunitem.attachmentType, + attachmentName: baocunitem.attachmentName, + buildingName: baocunitem.buildingName, + buildingMap: baocunitem.buildingMap, + standardCommonIssues: baocunitem.standardCommonIssues, + companyMap: baocunitem.companyMap, + regulatoryCompanyMap: baocunitem.regulatoryCompanyMap, + issueTypeMap: baocunitem.issueTypeMap, + checkResultTypeMap: baocunitem.checkResultTypeMap, + logs: baocunitem.logs, + phaseTypes: baocunitem.phaseTypes, + syncTime: baocunitem.syncTime, + syncTimestamp: baocunitem.syncTimestamp, + imgUrlbase64list: baocunitem.imgUrlbase64list, + voiceUrllist: baocunitem.voiceUrllist, + padstatus: baocunitem.padstatus, } - if (this.formdata.padstatus = '3') { + if (baocunitem.padstatus = '3') { //padstatus 0--没有tableLevel4Id 1--有tableLevel4Id 2--需要新增的 3--需要修改的 4--删除的 - updata.uuid = this.formdata.uuid; + updata.uuid = baocunitem.uuid; console.log('马上更新11111:', updata); - let xinzneg = await this.$dbUtils.upnewdateSQL('xiaofangdb', 'projectxianchangtable', updata, 'uuid', this - .formdata - .uuid); + let xinzneg = await this.$dbUtils.upnewdateSQL('xiaofangdb', 'projectxianchangtable', updata, 'uuid', + baocunitem.uuid); if (xinzneg) { this.$modal.msgSuccess("保存成功!") } else { this.$modal.msgError("保存失败!") } - console.log('更新结果:', xinzneg, this - .formdata - .uuid); + console.log('更新结果:', xinzneg, baocunitem.uuid); } else { console.log('马上新增11111:', updata); @@ -3933,46 +3967,22 @@ } else { this.$modal.msgError("保存失败!") } - console.log('新增结果:', xinzneg, this - .formdata - .uuid); + console.log('新增结果:', xinzneg, baocunitem.uuid); } - this.addinfo(); //保存并添加 + this.resetformdata(); //重置保存添加 + }, - async addinfo() { + + + async resetformdata() { //重置保存添加 - this.jzwlist = JSON.parse(this.objitem.buildingMap) || []; - this.locationslist = JSON.parse(this.objitem.locations) || []; - this.standardCommonIssueslist = JSON.parse(this.objitem.standardCommonIssues) || []; - this.issueTypeMaplist = JSON.parse(this.objitem.issueTypeMap) || []; - this.companyMaplist = JSON.parse(this.objitem.companyMap) || []; - this.regulatoryCompanyMaplist = JSON.parse(this.objitem.regulatoryCompanyMap) || []; - // this.recordslist = JSON.parse(objitem.records) || []; - let recordsl = JSON.parse(this.objitem.records) || []; - for (let xx of recordsl) { - let info = xx.info; - let resultInfo = xx.resultInfo; - xx.infopadobj = this.parseStr(info, resultInfo); - - - } - - - let httpurl = this.userStore.allurl; - this.formdata = JSON.parse(JSON.stringify(this.objitem)); - this.formdata.records = recordsl; - this.formdata.checkPointids = this.locationslist.filter(item => item.selectFlag == true).map(item => item - .standardLocationId); - this.formdata.materialActivityFiles = JSON.parse(this.formdata.materialActivityFiles) || []; - // if (this.formdata.imgUrl) { - // this.imgfileList1 = JSON.parse(this.formdata.imgUrlbase64list); - // } - // if (this.formdata.voiceUrl) { - // this.voiceUrlfileList1 = JSON.parse(this.formdata.voiceUrllist); - // } + console.log("sdfds", this.formdata) + // return + // materialActivityFiles this.imgfileList1 = []; this.voiceUrlfileList1 = []; + this.formdata.voiceUrl = ""; this.formdata.tableLevel4Id = null; this.formdata.tableLevel4Code = null; this.fubiaoobj = null; @@ -3981,9 +3991,23 @@ this.formdata.checkPointids = null; this.formdata.remark = null; this.formdata.issue = null; - this.formdata.resultType = null; + this.formdata.resultType = "1"; this.formdata.checkPoint = null; - if (this.formdata.attachmentType) { + let recordsl = this.formdata.records || []; + for (let xx of recordsl) { + let info = xx.info; + let resultInfo = xx.resultInfo; + xx.infopadobj = this.parseStr(info, resultInfo, false); + //infopadlist + } + this.formdata.records = recordsl; + if (this.formdata.materialActivityFiles) { + for (let xxx of this.formdata.materialActivityFiles) { + xxx.resultType = "" + } + } + + if (this.formdata.attachmentType !== '0') { this.fubiaoobj = { typeid: this.formdata.attachmentType, name: this.formdata.attachmentName, @@ -4008,7 +4032,12 @@ console.log('456654645', this.fubiaoobj); } } + console.log('dddd', this.formdata) + + + }, + } } diff --git a/src/pages/zhixing/fucha.vue b/src/pages/zhixing/fucha.vue index 748b9d5..03c2e85 100644 --- a/src/pages/zhixing/fucha.vue +++ b/src/pages/zhixing/fucha.vue @@ -1,5 +1,5 @@ diff --git a/src/uni_modules/csr-uni-data-select/components/csr-uni-data-select/csr-uni-data-select.vue b/src/uni_modules/csr-uni-data-select/components/csr-uni-data-select/csr-uni-data-select.vue index 4e64f23..5cd5510 100644 --- a/src/uni_modules/csr-uni-data-select/components/csr-uni-data-select/csr-uni-data-select.vue +++ b/src/uni_modules/csr-uni-data-select/components/csr-uni-data-select/csr-uni-data-select.vue @@ -38,7 +38,14 @@ - {{emptyTips}} + + {{emptyTips}} + + + + {{emptyTips}} + {{filterInput}} + item[this.dataValue] === defValue) - const def = this.mixinDatacomResData.find(item => item[this.dataValue] == defValue) - this.current = def ? this.formatItemName(def) : '' + // console.log('1sdfs8', this.current, this.modelValue) + // console.log('1sdfs7', defValue) + + let def = this.mixinDatacomResData.find(item => item[this.dataValue] == this.modelValue) + if (this.modelValue === '') { + def = null + } + // console.log('1sdfs910', def, defValue, this.mixinDatacomResData) + this.current = def ? this.formatItemName(def) : ''; + // console.log('1sdfs9', this.current, this.modelValue) } }, /** @@ -448,6 +470,13 @@ } } }, + changexz(val) { + //新增 + console.error('sdsd', val) + this.$emit('update:modelValue', val) + this.$emit('input', val) + this.showSelector = false + }, delItem(item) { if (this.disabled) { return @@ -474,7 +503,14 @@ this.$emit('update:modelValue', val) const current = this.mixinDatacomResData.find(item => val == item[this.dataValue]) console.log(current); - this.$emit('change', current) + if (current == undefined || current == null) { + let xxobj = {}; + xxobj[this.dataValue] = this.filterInput; + this.$emit('change', xxobj) + } else { + this.$emit('change', current) + } + } if (this.collection) { this.setCache(val); diff --git a/src/utils/usersqlite/posteditxianchang.js b/src/utils/usersqlite/posteditxianchang.js index 47b44eb..2397034 100644 --- a/src/utils/usersqlite/posteditxianchang.js +++ b/src/utils/usersqlite/posteditxianchang.js @@ -403,7 +403,7 @@ async function processDeleteData(deleteDataList, results) { for (const item of deleteDataList) { try { - const deleteResult = await callDeleteServerApi(item.uuid); + const deleteResult = await callDeleteServerApi(item.tableLevel4Id); if (deleteResult.success) { await deleteLocalData(item.uuid, 'projectxianchangtable'); @@ -604,7 +604,7 @@ async function callUpdateServerApi(data) { 'Bearerauth': `Bearer ${getToken()}` }, success: async (res) => { - // console.error('批量处理4:', res); + // console.error('批量处理44444:', res); if (res.data.code === 200) { resolve({ @@ -612,10 +612,19 @@ async function callUpdateServerApi(data) { data: res.data.data }); } else { - resolve({ - success: false, - message: res.data.msg || '更新失败' - }); + + if (res.data.msg == "已被删除,无法更新") { + resolve({ + success: true, + data: res.data.data + }); + } else { + resolve({ + success: false, + message: res.data.msg || '更新失败' + }); + } + } }, fail: (error) => { @@ -640,16 +649,28 @@ async function callDeleteServerApi(id) { }, success: (res) => { + console.log("删除接口", res) if (res.data.code === 200) { resolve({ success: true, data: res.data.data }); } else { - resolve({ - success: false, - message: res.data.msg || '删除失败' - }); + + if (res.data.msg == "Index 0 out of bounds for length 0") { + resolve({ + success: true, + data: res.data.data + }); + } else { + resolve({ + success: false, + message: res.data.msg || '删除失败' + }); + + } + + } }, fail: (error) => {