diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json index 9b0d791..4ccd172 100644 --- a/.hbuilderx/launch.json +++ b/.hbuilderx/launch.json @@ -13,7 +13,7 @@ "type" : "uniCloud" }, { - "playground" : "standard", + "playground" : "custom", "type" : "uni-app:app-android" } ] diff --git a/api/workPlan/networkPlan.js b/api/workPlan/networkPlan.js index 6caffef..a4a4bdc 100644 --- a/api/workPlan/networkPlan.js +++ b/api/workPlan/networkPlan.js @@ -161,7 +161,7 @@ export function getControlModeProApi(data) { // 月计划填报提交 --生产 export function setMonthPlanProApi(data) { return request_yn({ - url: '/ynPlanApp/proMonth/addInfPlan', + url: '/ynPlanApp/proWeb/addInfPlan', method: 'post', data: data }) diff --git a/pages/workPlan/dayPlan/inf-index.vue b/pages/workPlan/dayPlan/inf-index.vue index c333323..fcfb99b 100644 --- a/pages/workPlan/dayPlan/inf-index.vue +++ b/pages/workPlan/dayPlan/inf-index.vue @@ -363,6 +363,18 @@ placeholder="请填写" /> + + + + + + 保存提交 @@ -665,7 +677,8 @@ import { getWorkWaitProjectApi, getReportFormListApi, getImportMonthPlanApi, - getWorkPlanContentApi + getWorkPlanContentApi, + getPersonInfoApi } from '../../../api/workPlan/dayPlan' export default { components: { @@ -674,6 +687,7 @@ export default { data() { return { activeIndex: '', + imageValue: [], DateValue: this.$moment(this.$moment().format('YYYY-MM-DD')).add(1, 'days').format('YYYY-MM-DD'), pagesTotal: 1, currentPage: 0, @@ -1689,38 +1703,109 @@ export default { } }, onAddSubUserInfoNew(name, index) { - let proName = '' - this.projectListSel.forEach(e => { - if (e.value == this.queryDataParams.proId) { - proName = e.text - } - }) - if (name == 'rys') { - // console.log('跳转选人----') proName + new Promise((resolve, reject) => { + // 创建一个数组用于存储所有的异步请求 + let promises = [] - // if (!this.projectId) { - // uni.showToast({ icon: 'none', title: '请选择工程!' }) - // return - // } - this.currenPersonIndexNew = index - - let personList = [] this.monthDataList.forEach(e => { - console.log(e.selectuser, 'e.selectusere.selectusere.selectuser') - personList.push(e.selectuser) + // 将每个请求都包装成Promise + let promise = getPersonInfoApi({ contentId: e.contentId }) + .then(res => { + let personList = [] + console.log('res-----', res) + if (res.obj.length > 0) { + res.obj.forEach(e => { + personList.push(e.idNumber) + }) + e.selectuser = personList.join('@') + } + }) + .catch(err => { + console.error('获取人员信息失败', err) + }) + + // 将每个异步请求的Promise添加到数组中 + promises.push(promise) }) - const personInfo = { - personList - } + // 使用 Promise.all 来等待所有异步请求完成 + Promise.all(promises) + .then(() => { + // 所有请求都完成后再执行后续逻辑 - console.log('personList', personList) - uni.navigateTo({ - url: `/pages/workPlan/dayPlan/sub-user/index?proName=${proName}&personList=${JSON.stringify( - personInfo - )}&index=${index}` + // 执行其他逻辑 + resolve() + }) + .catch(err => { + // 如果有任何请求失败,触发reject + reject(err) + }) + }) + .then(() => { + // 这里是后续的代码,确保只有所有请求成功后才会执行 + if (name == 'rys') { + // console.log('跳转选人----') proName + + // if (!this.projectId) { + // uni.showToast({ icon: 'none', title: '请选择工程!' }) + // return + // } + let proName = '' + this.projectListSel.forEach(e => { + if (e.value == this.queryDataParams.proId) { + proName = e.text + } + }) + this.currenPersonIndexNew = index + + let personList = [] + this.monthDataList.forEach(e => { + // console.log(e.selectuser, 'e.selectusere.selectusere.selectuser') + console.log('eeeee----', e) + personList.push(e.selectuser) + // this.$set(e, 'selectusere', 'personStr') + }) + + const personInfo = { + personList + } + + console.log('personList', personList) + uni.navigateTo({ + url: `/pages/workPlan/dayPlan/sub-user/index?proName=${proName}&personList=${JSON.stringify( + personInfo + )}&index=${index}` + }) + } }) - } + .catch(err => { + console.error('请求失败', err) + }) + // console.log('item', item) + // new Promise((resolve, reject) => { + // this.monthDataList.forEach(e => { + // getPersonInfoApi({ contentId: e.contentId }).then(res => { + // let personList = [] + // console.log('res-----', res) + // if (res.obj.length > 0) { + // res.obj.forEach(e => { + // personList.push(e.idNumber) + // }) + // e.selectuser = personList.join('@') + // } + // }) + // }) + // resolve() + // }).then(() => { + // // if (true) return + // let proName = '' + // this.projectListSel.forEach(e => { + // if (e.value == this.queryDataParams.proId) { + // proName = e.text + // } + // }) + + // }) }, onSelectWorkInfo(index) { console.log('选择作业内容---') @@ -1774,6 +1859,40 @@ export default { }) } } + }, + select(e) { + e.tempFiles.forEach(item => { + const imgUrl = item.url + const imgName = item.name + uni.uploadFile({ + url: 'http://192.168.0.14:19191/ynPlanApp/infDay/addContentJobTicket', + filePath: imgUrl, + name: 'image', + formData: { + file: imgUrl, + photoType: 'photo' + }, + header: { 'Content-Type': 'multipart/form-data' }, + success: uploadFileRes => { + if (uploadFileRes.statusCode == 200) { + console.log('上传成功!', uploadFileRes) + const imgInfo = { + name: imgName, + tempUrl: `ynPlan/photo/${this.$moment().format('YYYY')}/${this.$moment().format( + 'MM' + )}/${this.$moment().format('DD')}/${imgName}`, + url: imgUrl + } + + this.imageValue.push(imgInfo) + } + } + }) + }) + }, + onDelete(e) { + const tempFilePath = e.tempFilePath + this.imageValue = this.imageValue.filter(e => e.url !== tempFilePath) } }, @@ -2387,4 +2506,19 @@ export default { color: #000; font-size: 26rpx; } +.example-body { + background-color: #fff; +} + +.submit-btn { + width: 95%; + margin: 15rpx auto; + height: 68rpx; + color: #fff; + background-color: #00337a; + border-radius: 12rpx; + text-align: center; + line-height: 68rpx; + font-size: 28rpx; +} diff --git a/pages/workPlan/networkPlan/inf-index.vue b/pages/workPlan/networkPlan/inf-index.vue index d883870..de8b500 100644 --- a/pages/workPlan/networkPlan/inf-index.vue +++ b/pages/workPlan/networkPlan/inf-index.vue @@ -244,7 +244,7 @@ :required="f.required" > + @@ -1024,6 +1031,11 @@ export default { uni.showToast({ icon: 'none', title: '暂无涉网计划!' }) } this.monthDataList = res.obj + + // this.monthDataList.forEach(e => { + // this.$set(e, 'viewTime', []) + // e.viewTime = e.tdsj.split('~') + // }) this.activeFormPages = 0 if (this.monthDataList.length > 0) { diff --git a/pages/workPlan/networkPlan/pro-index.vue b/pages/workPlan/networkPlan/pro-index.vue index d1a0fce..a8a1e9a 100644 --- a/pages/workPlan/networkPlan/pro-index.vue +++ b/pages/workPlan/networkPlan/pro-index.vue @@ -252,7 +252,7 @@ /> -->