代码优化

This commit is contained in:
BianLzhaoMin 2024-11-05 21:22:17 +08:00
parent f63ac3e827
commit cf323977c3
8 changed files with 196 additions and 35 deletions

View File

@ -13,7 +13,7 @@
"type" : "uniCloud"
},
{
"playground" : "standard",
"playground" : "custom",
"type" : "uni-app:app-android"
}
]

View File

@ -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
})

View File

@ -363,6 +363,18 @@
placeholder="请填写"
/>
</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>
</scroll-view>
</swiper-item>
@ -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;
}
</style>

View File

@ -244,7 +244,7 @@
:required="f.required"
>
<u--textarea
v-if="f.items_type === 'area'"
v-if="f.items_type === 'area' || f.items_type === 'date'"
v-model="item[f.name]"
placeholder="请填写"
autoHeight
@ -264,6 +264,13 @@
:clear="false"
v-if="f.items_type === 'sel'"
></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>
</scroll-view>
@ -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) {

View File

@ -252,7 +252,7 @@
/> -->
<u--textarea
v-if="f.items_type === 'area'"
v-if="f.items_type === 'area' || f.items_type === 'date'"
v-model="item[f.name]"
placeholder="请填写"
autoHeight

View File

@ -236,7 +236,7 @@ export default {
{ title: '提交', id: 4, type: 'upload', isShow: ['1', '2', '3'], isRoles: ['22', '23'] }
],
infrastructureFormLabel: [
{ form_label: '涉网作业内容', items_type: 'ipt', name: 'area', required: true },
{ form_label: '涉网作业内容', items_type: 'ipt', name: 'zynr', required: true },
{
form_label: '风险等级',
items_type: 'sel',

View File

@ -135,7 +135,7 @@ export default {
// { title: '', id: 4, type: 'upload', isShow: ['1', '3'] }
],
infrastructureFormLabel: [
{ form_label: '涉网作业内容', items_type: 'ipt', name: 'area', required: true },
{ form_label: '涉网作业内容', items_type: 'ipt', name: 'zynr', required: true },
{
form_label: '风险等级',
items_type: 'sel',
@ -143,7 +143,14 @@ export default {
required: true,
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: 'ssgdj', required: true },
{ form_label: '停电负责人及电话', items_type: 'ipt', name: 'fzr', required: true },
@ -286,6 +293,7 @@ export default {
},
/* 获取详情 */
async getPlanDetailData() {
console.log('this.params参数', this.params)
const res = await getPlanDetailApi(this.params)
console.log('详情数据res', res)

View File

@ -135,7 +135,14 @@ export default {
required: true,
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: 'ssgdj', required: true },
{ form_label: '停电负责人及电话', items_type: 'ipt', name: 'fzr', required: true },