正则等问题优化

This commit is contained in:
BianLzhaoMin 2024-11-05 09:56:34 +08:00
parent e337b040d1
commit a8f41928e3
13 changed files with 208 additions and 14 deletions

View File

@ -131,7 +131,7 @@ export function getReportFormListApi(data) {
// 月计划-导入计划 --基建 // 月计划-导入计划 --基建
export function getImportMonthPlanApi(data) { export function getImportMonthPlanApi(data) {
return request_yn({ return request_yn({
url: '/ynPlanApp/infMonth/getPrevPlan', url: '/ynPlanApp/infWeb/getPrevPlan',
method: 'post', method: 'post',
data: data data: data
}) })
@ -318,7 +318,7 @@ export function getReportFormListProApi(data) {
// 月计划-导入计划 --基建 // 月计划-导入计划 --基建
export function getImportMonthPlanProApi(data) { export function getImportMonthPlanProApi(data) {
return request_yn({ return request_yn({
url: '/ynPlanApp/proMonth/getPrevPlan', url: '/ynPlanApp/proWeb/getPrevPlan',
method: 'post', method: 'post',
data: data data: data
}) })

View File

@ -131,7 +131,7 @@ export function getReportFormListApi(data) {
// 月计划-导入计划 --基建 // 月计划-导入计划 --基建
export function getImportMonthPlanApi(data) { export function getImportMonthPlanApi(data) {
return request_yn({ return request_yn({
url: '/ynPlanApp/infMonth/getPrevPlan', url: '/ynPlanApp/infWeek/getPrevPlan',
method: 'post', method: 'post',
data: data data: data
}) })

View File

@ -448,7 +448,7 @@ export default {
// //
uni.getLocation({ uni.getLocation({
type: 'gcj02', // gcj02 'wgs84' type: 'gcj02', // gcj02 'wgs84'
// altitude: true, altitude: true,
geocode: true, geocode: true,
success: res => { success: res => {
console.log(res, '位置信息--') console.log(res, '位置信息--')

View File

@ -177,6 +177,7 @@
:type="f.isType ? f.isType : 'text'" :type="f.isType ? f.isType : 'text'"
v-model="item[f.name]" v-model="item[f.name]"
placeholder="请填写" placeholder="请填写"
@input="handleInput($event, f.isType, index, f.name)"
/> />
<!-- <uni-easyinput <!-- <uni-easyinput
v-if="f.items_type === 'ipt' && f.name != 'rys' && f.name != 'zynr'" v-if="f.items_type === 'ipt' && f.name != 'rys' && f.name != 'zynr'"
@ -193,7 +194,7 @@
></uni-data-select> ></uni-data-select>
<view v-if="f.name === 'rys'" @tap="onAddSubUserInfo(f.name)"> <view v-if="f.name === 'rys'" @tap="onAddSubUserInfo(f.name)">
<uni-easyinput :autoHeight="true" type="text" v-model="item.rys" placeholder="请选择" /> <u--input :autoHeight="true" type="text" v-model="item.rys" placeholder="请选择" disabled />
<!-- <uni-easyinput <!-- <uni-easyinput
v-else v-else
@ -1594,14 +1595,16 @@ export default {
} }
const params = { const params = {
proId: this.projectId, proId: this.projectId,
month: this.DateValue planDate: this.DateValue
} }
console.log(params, 'params') console.log(params, 'params')
const res = await getImportMonthPlanApi(params) const res = await getImportMonthPlanApi(params)
console.log('导入计划的结果', res) console.log('导入计划的结果', res)
if (res.res == 0) { if (res.res == 0) {
uni.showToast({ title: '获取失败,该日期上月无计划', icon: 'none' }) uni.showToast({ title: '获取失败,该日期上日无计划', icon: 'none' })
this.monthParams = []
this.monthParams.push(this.paramsItem)
return return
} else { } else {
this.monthParams = res.obj this.monthParams = res.obj
@ -1654,6 +1657,22 @@ export default {
}) })
this.$refs.popupWorkContent.close() this.$refs.popupWorkContent.close()
} catch (error) {} } catch (error) {}
},
handleInput(e, type, index, name) {
if (type == 'number') {
const regex = /^[1-9]\d*$/
if (!regex.test(e)) {
// console.log('', typeof e)
this.$nextTick(() => {
this.monthParams[index][name] = ''
e = ''
})
} else {
this.$nextTick(() => {
this.monthParams[index][name] = e
})
}
}
} }
}, },

View File

@ -185,6 +185,7 @@
:type="f.isType ? f.isType : 'text'" :type="f.isType ? f.isType : 'text'"
v-model="item[f.name]" v-model="item[f.name]"
placeholder="请填写" placeholder="请填写"
@input="handleInput($event, f.isType, index, f.name)"
/> />
<uni-data-select <uni-data-select
v-model="item[f.name]" v-model="item[f.name]"
@ -1614,14 +1615,16 @@ export default {
} }
const params = { const params = {
proId: this.projectId, proId: this.projectId,
month: this.DateValue planDate: this.DateValue
} }
console.log(params, 'params') console.log(params, 'params')
const res = await getImportMonthPlanProApi(params) const res = await getImportMonthPlanProApi(params)
console.log('导入计划的结果', res) console.log('导入计划的结果', res)
if (res.res == 0) { if (res.res == 0) {
uni.showToast({ title: '获取失败,该日期上月无计划', icon: 'none' }) uni.showToast({ title: '获取失败,该日期上日无计划', icon: 'none' })
this.monthParams = []
this.monthParams.push(this.paramsItem)
return return
} else { } else {
this.monthParams = res.obj this.monthParams = res.obj
@ -1693,6 +1696,22 @@ export default {
}) })
} catch (error) {} } catch (error) {}
// console.log('result_1', result_1, 'result_2', result_2) // console.log('result_1', result_1, 'result_2', result_2)
},
handleInput(e, type, index, name) {
if (type == 'number') {
const regex = /^[1-9]\d*$/
if (!regex.test(e)) {
// console.log('', typeof e)
this.$nextTick(() => {
this.monthParams[index][name] = ''
e = ''
})
} else {
this.$nextTick(() => {
this.monthParams[index][name] = e
})
}
}
} }
}, },

View File

@ -176,6 +176,7 @@
:type="f.isType ? f.isType : 'text'" :type="f.isType ? f.isType : 'text'"
v-model="item[f.name]" v-model="item[f.name]"
placeholder="请填写" placeholder="请填写"
@input="handleInput($event, f.isType, index, f.name)"
/> />
<uni-data-select <uni-data-select
v-model="item[f.name]" v-model="item[f.name]"
@ -566,6 +567,7 @@ import {
getReportFormListApi, getReportFormListApi,
getImportMonthPlanApi getImportMonthPlanApi
} from '../../../api/workPlan/monthPlan' } from '../../../api/workPlan/monthPlan'
import editProfileVue from '../../YNEduApp/user/editProfile.vue'
export default { export default {
components: { components: {
TimeSelect TimeSelect
@ -643,7 +645,14 @@ export default {
rules: [{ required: true, errorMessage: '请填写单位负责人/联系电话' }] rules: [{ required: true, errorMessage: '请填写单位负责人/联系电话' }]
}, },
planCount: { planCount: {
rules: [{ required: true, errorMessage: '请填写计划数量' }] rules: [
{ required: true, errorMessage: '请填写计划数量' },
{
pattern: /^[1-9]\d*$/,
message: '请输入正整数',
trigger: 'blur'
}
]
} }
}, },
infrastructureFormLabel: [ infrastructureFormLabel: [
@ -1512,10 +1521,28 @@ export default {
console.log('导入计划的结果', res) console.log('导入计划的结果', res)
if (res.res == 0) { if (res.res == 0) {
uni.showToast({ title: '获取失败,该日期上月无计划', icon: 'none' }) uni.showToast({ title: '获取失败,该日期上月无计划', icon: 'none' })
this.monthParams = []
this.monthParams.push(this.paramsItem)
return return
} else { } else {
this.monthParams = res.obj this.monthParams = res.obj
} }
},
handleInput(e, type, index, name) {
if (type == 'number') {
const regex = /^[1-9]\d*$/
if (!regex.test(e)) {
// console.log('', typeof e)
this.$nextTick(() => {
this.monthParams[index][name] = ''
e = ''
})
} else {
this.$nextTick(() => {
this.monthParams[index][name] = e
})
}
}
} }
}, },

View File

@ -169,6 +169,7 @@
:type="f.isType ? f.isType : 'text'" :type="f.isType ? f.isType : 'text'"
v-model="item[f.name]" v-model="item[f.name]"
placeholder="请填写" placeholder="请填写"
@input="handleInput($event, f.isType, index, f.name)"
/> />
<uni-data-select <uni-data-select
v-model="item[f.name]" v-model="item[f.name]"
@ -1585,10 +1586,28 @@ export default {
console.log('导入计划的结果', res) console.log('导入计划的结果', res)
if (res.res == 0) { if (res.res == 0) {
uni.showToast({ title: '获取失败,该日期上月无计划', icon: 'none' }) uni.showToast({ title: '获取失败,该日期上月无计划', icon: 'none' })
this.monthParams = []
this.monthParams.push(this.paramsItem)
return return
} else { } else {
this.monthParams = res.obj this.monthParams = res.obj
} }
},
handleInput(e, type, index, name) {
if (type == 'number') {
const regex = /^[1-9]\d*$/
if (!regex.test(e)) {
// console.log('', typeof e)
this.$nextTick(() => {
this.monthParams[index][name] = ''
e = ''
})
} else {
this.$nextTick(() => {
this.monthParams[index][name] = e
})
}
}
} }
}, },

View File

@ -132,6 +132,7 @@
:type="f.isType ? f.isType : 'text'" :type="f.isType ? f.isType : 'text'"
v-model="item[f.name]" v-model="item[f.name]"
placeholder="请填写" placeholder="请填写"
@input="handleInput($event, f.isType, index, f.name)"
/> />
<uni-data-select <uni-data-select
v-model="item[f.name]" v-model="item[f.name]"
@ -1431,6 +1432,8 @@ export default {
console.log('导入计划的结果', res) console.log('导入计划的结果', res)
if (res.res == 0) { if (res.res == 0) {
uni.showToast({ title: '获取失败,该日期上月无计划', icon: 'none' }) uni.showToast({ title: '获取失败,该日期上月无计划', icon: 'none' })
this.monthParams = []
this.monthParams.push(this.paramsItem)
return return
} else { } else {
this.monthParams = res.obj this.monthParams = res.obj
@ -1440,6 +1443,22 @@ export default {
console.log(e, index, '******') console.log(e, index, '******')
this.monthParams[index].tdsj = `${e[0]}~${e[1]}` this.monthParams[index].tdsj = `${e[0]}~${e[1]}`
},
handleInput(e, type, index, name) {
if (type == 'number') {
const regex = /^[1-9]\d*$/
if (!regex.test(e)) {
// console.log('', typeof e)
this.$nextTick(() => {
this.monthParams[index][name] = ''
e = ''
})
} else {
this.$nextTick(() => {
this.monthParams[index][name] = e
})
}
}
} }
}, },

View File

@ -132,6 +132,7 @@
:type="f.isType ? f.isType : 'text'" :type="f.isType ? f.isType : 'text'"
v-model="item[f.name]" v-model="item[f.name]"
placeholder="请填写" placeholder="请填写"
@input="handleInput($event, f.isType, index, f.name)"
/> />
<uni-data-select <uni-data-select
v-model="item[f.name]" v-model="item[f.name]"
@ -1439,6 +1440,8 @@ export default {
console.log('导入计划的结果', res) console.log('导入计划的结果', res)
if (res.res == 0) { if (res.res == 0) {
uni.showToast({ title: '获取失败,该日期上月无计划', icon: 'none' }) uni.showToast({ title: '获取失败,该日期上月无计划', icon: 'none' })
this.monthParams = []
this.monthParams.push(this.paramsItem)
return return
} else { } else {
this.monthParams = res.obj this.monthParams = res.obj
@ -1448,6 +1451,22 @@ export default {
console.log(e, index, '******') console.log(e, index, '******')
this.monthParams[index].tdsj = `${e[0]}~${e[1]}` this.monthParams[index].tdsj = `${e[0]}~${e[1]}`
},
handleInput(e, type, index, name) {
if (type == 'number') {
const regex = /^[1-9]\d*$/
if (!regex.test(e)) {
// console.log('', typeof e)
this.$nextTick(() => {
this.monthParams[index][name] = ''
e = ''
})
} else {
this.$nextTick(() => {
this.monthParams[index][name] = e
})
}
}
} }
}, },

View File

@ -196,6 +196,7 @@
:type="f.isType ? f.isType : 'text'" :type="f.isType ? f.isType : 'text'"
v-model="item[f.name]" v-model="item[f.name]"
placeholder="请填写" placeholder="请填写"
@input="handleInput($event, f.isType, index, f.name)"
/> />
<uni-data-select <uni-data-select
v-model="item[f.name]" v-model="item[f.name]"
@ -1727,6 +1728,22 @@ export default {
}, },
onChangeTimeDateRange(e) { onChangeTimeDateRange(e) {
console.log('eeee', e) console.log('eeee', e)
},
handleInput(e, type, index, name) {
if (type == 'number') {
const regex = /^[1-9]\d*$/
if (!regex.test(e)) {
// console.log('', typeof e)
this.$nextTick(() => {
this.monthParams[index][name] = ''
e = ''
})
} else {
this.$nextTick(() => {
this.monthParams[index][name] = e
})
}
}
} }
}, },

View File

@ -188,6 +188,7 @@
:type="f.isType ? f.isType : 'text'" :type="f.isType ? f.isType : 'text'"
v-model="item[f.name]" v-model="item[f.name]"
placeholder="请填写" placeholder="请填写"
@input="handleInput($event, f.isType, index, f.name)"
/> />
<uni-data-select <uni-data-select
v-model="item[f.name]" v-model="item[f.name]"
@ -1801,6 +1802,22 @@ export default {
}, },
onChangeTimeDateRange(e) { onChangeTimeDateRange(e) {
console.log('eeee', e) console.log('eeee', e)
},
handleInput(e, type, index, name) {
if (type == 'number') {
const regex = /^[1-9]\d*$/
if (!regex.test(e)) {
// console.log('', typeof e)
this.$nextTick(() => {
this.monthParams[index][name] = ''
e = ''
})
} else {
this.$nextTick(() => {
this.monthParams[index][name] = e
})
}
}
} }
}, },

View File

@ -200,6 +200,7 @@
:type="f.isType ? f.isType : 'text'" :type="f.isType ? f.isType : 'text'"
v-model="item[f.name]" v-model="item[f.name]"
placeholder="请填写" placeholder="请填写"
@input="handleInput($event, f.isType, index, f.name)"
/> />
<uni-data-select <uni-data-select
@ -1703,14 +1704,16 @@ export default {
} }
const params = { const params = {
proId: this.projectId, proId: this.projectId,
month: this.DateValue week: `${this.weekStart}~${this.weekEnd}`
} }
console.log(params, 'params') console.log(params, 'params')
const res = await getImportMonthPlanApi(params) const res = await getImportMonthPlanApi(params)
console.log('导入计划的结果', res) console.log('导入计划的结果', res)
if (res.res == 0) { if (res.res == 0) {
uni.showToast({ title: '获取失败,该日期上月无计划', icon: 'none' }) uni.showToast({ title: '获取失败,该日期上周无计划', icon: 'none' })
this.monthParams = []
this.monthParams.push(this.paramsItem)
return return
} else { } else {
this.monthParams = res.obj this.monthParams = res.obj
@ -1806,6 +1809,22 @@ export default {
this.weekStartCurrent = this.$moment().week(this.$moment().week()).startOf('week').format('YYYY-MM-DD') this.weekStartCurrent = this.$moment().week(this.$moment().week()).startOf('week').format('YYYY-MM-DD')
this.weekEndCurrent = this.$moment().week(this.$moment().week()).endOf('week').format('YYYY-MM-DD') this.weekEndCurrent = this.$moment().week(this.$moment().week()).endOf('week').format('YYYY-MM-DD')
},
handleInput(e, type, index, name) {
if (type == 'number') {
const regex = /^[1-9]\d*$/
if (!regex.test(e)) {
// console.log('', typeof e)
this.$nextTick(() => {
this.monthParams[index][name] = ''
e = ''
})
} else {
this.$nextTick(() => {
this.monthParams[index][name] = e
})
}
}
} }
}, },

View File

@ -207,6 +207,7 @@
:type="f.isType ? f.isType : 'text'" :type="f.isType ? f.isType : 'text'"
v-model="item[f.name]" v-model="item[f.name]"
placeholder="请填写" placeholder="请填写"
@input="handleInput($event, f.isType, index, f.name)"
/> />
<uni-data-select <uni-data-select
v-model="item[f.name]" v-model="item[f.name]"
@ -1768,14 +1769,16 @@ export default {
} }
const params = { const params = {
proId: this.projectId, proId: this.projectId,
month: this.DateValue week: `${this.weekStart}~${this.weekEnd}`
} }
console.log(params, 'params') console.log(params, 'params')
const res = await getImportMonthPlanProApi(params) const res = await getImportMonthPlanProApi(params)
console.log('导入计划的结果', res) console.log('导入计划的结果', res)
if (res.res == 0) { if (res.res == 0) {
uni.showToast({ title: '获取失败,该日期上月无计划', icon: 'none' }) uni.showToast({ title: '获取失败,该日期上周无计划', icon: 'none' })
this.monthParams = []
this.monthParams.push(this.paramsItem)
return return
} else { } else {
this.monthParams = res.obj this.monthParams = res.obj
@ -1871,6 +1874,22 @@ export default {
this.weekStartCurrent = this.$moment().week(this.$moment().week()).startOf('week').format('YYYY-MM-DD') this.weekStartCurrent = this.$moment().week(this.$moment().week()).startOf('week').format('YYYY-MM-DD')
this.weekEndCurrent = this.$moment().week(this.$moment().week()).endOf('week').format('YYYY-MM-DD') this.weekEndCurrent = this.$moment().week(this.$moment().week()).endOf('week').format('YYYY-MM-DD')
},
handleInput(e, type, index, name) {
if (type == 'number') {
const regex = /^[1-9]\d*$/
if (!regex.test(e)) {
// console.log('', typeof e)
this.$nextTick(() => {
this.monthParams[index][name] = ''
e = ''
})
} else {
this.$nextTick(() => {
this.monthParams[index][name] = e
})
}
}
} }
}, },