代码优化
This commit is contained in:
parent
f63ac3e827
commit
cf323977c3
|
|
@ -13,7 +13,7 @@
|
||||||
"type" : "uniCloud"
|
"type" : "uniCloud"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"playground" : "standard",
|
"playground" : "custom",
|
||||||
"type" : "uni-app:app-android"
|
"type" : "uni-app:app-android"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,7 @@ export function getControlModeProApi(data) {
|
||||||
// 月计划填报提交 --生产
|
// 月计划填报提交 --生产
|
||||||
export function setMonthPlanProApi(data) {
|
export function setMonthPlanProApi(data) {
|
||||||
return request_yn({
|
return request_yn({
|
||||||
url: '/ynPlanApp/proMonth/addInfPlan',
|
url: '/ynPlanApp/proWeb/addInfPlan',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -363,6 +363,18 @@
|
||||||
placeholder="请填写"
|
placeholder="请填写"
|
||||||
/>
|
/>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
|
<uni-forms-item label="作业票/站班会" v-if="currentTime == $moment().format('YYYY-MM-DD')">
|
||||||
|
<view class="example-body">
|
||||||
|
<uni-file-picker
|
||||||
|
v-model="imageValue"
|
||||||
|
fileMediatype="image"
|
||||||
|
mode="grid"
|
||||||
|
@select="select"
|
||||||
|
@delete="onDelete"
|
||||||
|
></uni-file-picker>
|
||||||
|
</view>
|
||||||
|
</uni-forms-item>
|
||||||
|
<view class="submit-btn" v-if="currentTime == $moment().format('YYYY-MM-DD')">保存提交</view>
|
||||||
</uni-forms>
|
</uni-forms>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</swiper-item>
|
</swiper-item>
|
||||||
|
|
@ -665,7 +677,8 @@ import {
|
||||||
getWorkWaitProjectApi,
|
getWorkWaitProjectApi,
|
||||||
getReportFormListApi,
|
getReportFormListApi,
|
||||||
getImportMonthPlanApi,
|
getImportMonthPlanApi,
|
||||||
getWorkPlanContentApi
|
getWorkPlanContentApi,
|
||||||
|
getPersonInfoApi
|
||||||
} from '../../../api/workPlan/dayPlan'
|
} from '../../../api/workPlan/dayPlan'
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
|
@ -674,6 +687,7 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
activeIndex: '',
|
activeIndex: '',
|
||||||
|
imageValue: [],
|
||||||
DateValue: this.$moment(this.$moment().format('YYYY-MM-DD')).add(1, 'days').format('YYYY-MM-DD'),
|
DateValue: this.$moment(this.$moment().format('YYYY-MM-DD')).add(1, 'days').format('YYYY-MM-DD'),
|
||||||
pagesTotal: 1,
|
pagesTotal: 1,
|
||||||
currentPage: 0,
|
currentPage: 0,
|
||||||
|
|
@ -1689,38 +1703,109 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onAddSubUserInfoNew(name, index) {
|
onAddSubUserInfoNew(name, index) {
|
||||||
let proName = ''
|
new Promise((resolve, reject) => {
|
||||||
this.projectListSel.forEach(e => {
|
// 创建一个数组用于存储所有的异步请求
|
||||||
if (e.value == this.queryDataParams.proId) {
|
let promises = []
|
||||||
proName = e.text
|
|
||||||
}
|
|
||||||
})
|
|
||||||
if (name == 'rys') {
|
|
||||||
// console.log('跳转选人----') proName
|
|
||||||
|
|
||||||
// if (!this.projectId) {
|
|
||||||
// uni.showToast({ icon: 'none', title: '请选择工程!' })
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
this.currenPersonIndexNew = index
|
|
||||||
|
|
||||||
let personList = []
|
|
||||||
this.monthDataList.forEach(e => {
|
this.monthDataList.forEach(e => {
|
||||||
console.log(e.selectuser, 'e.selectusere.selectusere.selectuser')
|
// 将每个请求都包装成Promise
|
||||||
personList.push(e.selectuser)
|
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 = {
|
// 使用 Promise.all 来等待所有异步请求完成
|
||||||
personList
|
Promise.all(promises)
|
||||||
}
|
.then(() => {
|
||||||
|
// 所有请求都完成后再执行后续逻辑
|
||||||
|
|
||||||
console.log('personList', personList)
|
// 执行其他逻辑
|
||||||
uni.navigateTo({
|
resolve()
|
||||||
url: `/pages/workPlan/dayPlan/sub-user/index?proName=${proName}&personList=${JSON.stringify(
|
})
|
||||||
personInfo
|
.catch(err => {
|
||||||
)}&index=${index}`
|
// 如果有任何请求失败,触发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) {
|
onSelectWorkInfo(index) {
|
||||||
console.log('选择作业内容---')
|
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;
|
color: #000;
|
||||||
font-size: 26rpx;
|
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;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -244,7 +244,7 @@
|
||||||
:required="f.required"
|
:required="f.required"
|
||||||
>
|
>
|
||||||
<u--textarea
|
<u--textarea
|
||||||
v-if="f.items_type === 'area'"
|
v-if="f.items_type === 'area' || f.items_type === 'date'"
|
||||||
v-model="item[f.name]"
|
v-model="item[f.name]"
|
||||||
placeholder="请填写"
|
placeholder="请填写"
|
||||||
autoHeight
|
autoHeight
|
||||||
|
|
@ -264,6 +264,13 @@
|
||||||
:clear="false"
|
:clear="false"
|
||||||
v-if="f.items_type === 'sel'"
|
v-if="f.items_type === 'sel'"
|
||||||
></uni-data-select>
|
></uni-data-select>
|
||||||
|
<!-- <uni-datetime-picker
|
||||||
|
v-if="f.items_type === 'date'"
|
||||||
|
:type="f.date_type"
|
||||||
|
v-model="item.viewTime"
|
||||||
|
@maskClick="maskClick"
|
||||||
|
disabled
|
||||||
|
/> -->
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
</uni-forms>
|
</uni-forms>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
|
@ -1024,6 +1031,11 @@ export default {
|
||||||
uni.showToast({ icon: 'none', title: '暂无涉网计划!' })
|
uni.showToast({ icon: 'none', title: '暂无涉网计划!' })
|
||||||
}
|
}
|
||||||
this.monthDataList = res.obj
|
this.monthDataList = res.obj
|
||||||
|
|
||||||
|
// this.monthDataList.forEach(e => {
|
||||||
|
// this.$set(e, 'viewTime', [])
|
||||||
|
// e.viewTime = e.tdsj.split('~')
|
||||||
|
// })
|
||||||
this.activeFormPages = 0
|
this.activeFormPages = 0
|
||||||
|
|
||||||
if (this.monthDataList.length > 0) {
|
if (this.monthDataList.length > 0) {
|
||||||
|
|
|
||||||
|
|
@ -252,7 +252,7 @@
|
||||||
/> -->
|
/> -->
|
||||||
|
|
||||||
<u--textarea
|
<u--textarea
|
||||||
v-if="f.items_type === 'area'"
|
v-if="f.items_type === 'area' || f.items_type === 'date'"
|
||||||
v-model="item[f.name]"
|
v-model="item[f.name]"
|
||||||
placeholder="请填写"
|
placeholder="请填写"
|
||||||
autoHeight
|
autoHeight
|
||||||
|
|
|
||||||
|
|
@ -236,7 +236,7 @@ export default {
|
||||||
{ title: '提交', id: 4, type: 'upload', isShow: ['1', '2', '3'], isRoles: ['22', '23'] }
|
{ title: '提交', id: 4, type: 'upload', isShow: ['1', '2', '3'], isRoles: ['22', '23'] }
|
||||||
],
|
],
|
||||||
infrastructureFormLabel: [
|
infrastructureFormLabel: [
|
||||||
{ form_label: '涉网作业内容', items_type: 'ipt', name: 'area', required: true },
|
{ form_label: '涉网作业内容', items_type: 'ipt', name: 'zynr', required: true },
|
||||||
{
|
{
|
||||||
form_label: '风险等级',
|
form_label: '风险等级',
|
||||||
items_type: 'sel',
|
items_type: 'sel',
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ export default {
|
||||||
// { title: '提交', id: 4, type: 'upload', isShow: ['1', '3'] }
|
// { title: '提交', id: 4, type: 'upload', isShow: ['1', '3'] }
|
||||||
],
|
],
|
||||||
infrastructureFormLabel: [
|
infrastructureFormLabel: [
|
||||||
{ form_label: '涉网作业内容', items_type: 'ipt', name: 'area', required: true },
|
{ form_label: '涉网作业内容', items_type: 'ipt', name: 'zynr', required: true },
|
||||||
{
|
{
|
||||||
form_label: '风险等级',
|
form_label: '风险等级',
|
||||||
items_type: 'sel',
|
items_type: 'sel',
|
||||||
|
|
@ -143,7 +143,14 @@ export default {
|
||||||
required: true,
|
required: true,
|
||||||
options: []
|
options: []
|
||||||
},
|
},
|
||||||
{ form_label: '计划停电时间', items_type: 'date', date_type: 'daterange', name: 'tdsj', required: true },
|
{
|
||||||
|
form_label: '计划停电时间',
|
||||||
|
items_type: 'date',
|
||||||
|
date_type: 'daterange',
|
||||||
|
name: 'tdsj',
|
||||||
|
name_date: 'tdsj_new',
|
||||||
|
required: true
|
||||||
|
},
|
||||||
{ form_label: '停电线路(设备)名称', items_type: 'area', name: 'tdsb', required: true },
|
{ form_label: '停电线路(设备)名称', items_type: 'area', name: 'tdsb', required: true },
|
||||||
{ form_label: '停电线路所属供电局', items_type: 'area', name: 'ssgdj', required: true },
|
{ form_label: '停电线路所属供电局', items_type: 'area', name: 'ssgdj', required: true },
|
||||||
{ form_label: '停电负责人及电话', items_type: 'ipt', name: 'fzr', required: true },
|
{ form_label: '停电负责人及电话', items_type: 'ipt', name: 'fzr', required: true },
|
||||||
|
|
@ -286,6 +293,7 @@ export default {
|
||||||
},
|
},
|
||||||
/* 获取详情 */
|
/* 获取详情 */
|
||||||
async getPlanDetailData() {
|
async getPlanDetailData() {
|
||||||
|
console.log('this.params参数', this.params)
|
||||||
const res = await getPlanDetailApi(this.params)
|
const res = await getPlanDetailApi(this.params)
|
||||||
console.log('详情数据res', res)
|
console.log('详情数据res', res)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,14 @@ export default {
|
||||||
required: true,
|
required: true,
|
||||||
options: []
|
options: []
|
||||||
},
|
},
|
||||||
{ form_label: '计划停电时间', items_type: 'date', date_type: 'daterange', name: 'tdsj', required: true },
|
{
|
||||||
|
form_label: '计划停电时间',
|
||||||
|
items_type: 'date',
|
||||||
|
date_type: 'daterange',
|
||||||
|
name: 'tdsj',
|
||||||
|
name_date: 'tdsj_new',
|
||||||
|
required: true
|
||||||
|
},
|
||||||
{ form_label: '停电线路(设备)名称', items_type: 'area', name: 'tdsb', required: true },
|
{ form_label: '停电线路(设备)名称', items_type: 'area', name: 'tdsb', required: true },
|
||||||
{ form_label: '停电线路所属供电局', items_type: 'area', name: 'ssgdj', required: true },
|
{ form_label: '停电线路所属供电局', items_type: 'area', name: 'ssgdj', required: true },
|
||||||
{ form_label: '停电负责人及电话', items_type: 'ipt', name: 'fzr', required: true },
|
{ form_label: '停电负责人及电话', items_type: 'ipt', name: 'fzr', required: true },
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue