Browse Source

fix: 保养和检修验证正整数

master
zhang_li 8 months ago
parent
commit
dfaf21f3a9
  1. 27
      src/pages/overhaulOrder/addServiceRecord.vue
  2. 47
      src/pages/upkeepOrder/addServiceRecord.vue

27
src/pages/overhaulOrder/addServiceRecord.vue

@ -200,6 +200,19 @@
const factoryAreaNumber = ref('') const factoryAreaNumber = ref('')
const chooseUserList = ref([]) const chooseUserList = ref([])
//
function validateInteger(value){
if (value) {
const integerReg = /^[+]{0,1}(\d+)$/
if (integerReg.test(value)) {
return true
} else {
return false
}
} else {
return false
}
}
// //
function submit() { function submit() {
// //
@ -211,6 +224,10 @@
proxy.$modal.showToast('请输入预估人数') proxy.$modal.showToast('请输入预估人数')
return; return;
} }
if (!validateInteger(form.value.peoples)) {
proxy.$modal.showToast('预估人数请输入正整数')
return;
}
if (form.value.peoples > 100) { if (form.value.peoples > 100) {
proxy.$modal.showToast('预估人数不得超出100') proxy.$modal.showToast('预估人数不得超出100')
return; return;
@ -219,10 +236,19 @@
proxy.$modal.showToast(`请输入预估分钟`) proxy.$modal.showToast(`请输入预估分钟`)
return; return;
} }
if (!validateInteger(form.value.estimatedMinutes)) {
proxy.$modal.showToast('预估分钟请输入正整数')
return;
}
if (!form.value.actualMinutes) { if (!form.value.actualMinutes) {
proxy.$modal.showToast('请输入实际分钟') proxy.$modal.showToast('请输入实际分钟')
return; return;
} }
if (!validateInteger(form.value.actualMinutes)) {
proxy.$modal.showToast('实际分钟请输入正整数')
return;
}
if (!form.value.chargePeoples) { if (!form.value.chargePeoples) {
proxy.$modal.showToast('请选择负责人') proxy.$modal.showToast('请选择负责人')
return; return;
@ -465,6 +491,7 @@
form.value = JSON.parse(decodeURIComponent(option.data)) form.value = JSON.parse(decodeURIComponent(option.data))
form.value.itemNumbers = form.value.items form.value.itemNumbers = form.value.items
formatDate.value = form.value.completionTime ? proxy.$time.formatDate(form.value.completionTime * 1000) : '' formatDate.value = form.value.completionTime ? proxy.$time.formatDate(form.value.completionTime * 1000) : ''
form.value.statusTxt = form.value.status == 0 ? '完成' :'未完成'
}; };
jxDetailsStatus.value = await dictApi.getDict('jx_details_status') jxDetailsStatus.value = await dictApi.getDict('jx_details_status')

47
src/pages/upkeepOrder/addServiceRecord.vue

@ -61,7 +61,7 @@
<view class="list"> <view class="list">
<view class="title"> <view class="title">
<span>*</span>备件 <span></span>备件
</view> </view>
<view class="item " v-for="(item,index) in form.itemNumbers" :key="index"> <view class="item " v-for="(item,index) in form.itemNumbers" :key="index">
<view class="item-box"> <view class="item-box">
@ -202,7 +202,19 @@ const form = ref({
const factoryAreaNumber = ref('') const factoryAreaNumber = ref('')
const chooseUserList = ref([]) const chooseUserList = ref([])
//
function validateInteger(value){
if (value) {
const integerReg = /^[+]{0,1}(\d+)$/
if (integerReg.test(value)) {
return true
} else {
return false
}
} else {
return false
}
}
// //
function submit() { function submit() {
// //
@ -214,6 +226,10 @@ const form = ref({
proxy.$modal.showToast('请输入实际分钟') proxy.$modal.showToast('请输入实际分钟')
return; return;
} }
if (!validateInteger(form.value.actualMinutes)) {
proxy.$modal.showToast('实际分钟请输入正整数')
return;
}
if (!form.value.chargePeoples) { if (!form.value.chargePeoples) {
proxy.$modal.showToast('请选择负责人') proxy.$modal.showToast('请选择负责人')
return; return;
@ -281,19 +297,15 @@ const form = ref({
} }
// //
function reset() { function reset() {
form.value = { form.value.actualMinutes =''
number: '', form.value.chargePeoples =''
name: '', form.value.status =null
peoples: null, form.value.statusTxt =''
estimatedMinutes: '', form.value.completionTime =''
actualMinutes: '', form.value.engineer =''
chargePeoples: '', form.value.uncompleted =''
status:null, form.value.itemNumbers =[]
completionTime: '',
engineer: '',
uncompleted: '',
itemNumbers: []
}
} }
// //
async function getSelecUser() { async function getSelecUser() {
@ -388,10 +400,6 @@ const form = ref({
} }
// //
function addSpare() { function addSpare() {
if (!form1.value.number) {
proxy.$modal.showToast('请选择备件')
return;
}
if (!form1.value.qty || form1.value.qty == 0) { if (!form1.value.qty || form1.value.qty == 0) {
proxy.$modal.showToast('请输入数量') proxy.$modal.showToast('请输入数量')
return; return;
@ -454,6 +462,7 @@ const form = ref({
form.value = JSON.parse(decodeURIComponent(option.data)) form.value = JSON.parse(decodeURIComponent(option.data))
form.value.itemNumbers = form.value.items form.value.itemNumbers = form.value.items
formatDate.value = form.value.completionTime ? proxy.$time.formatDate(form.value.completionTime * 1000) : '' formatDate.value = form.value.completionTime ? proxy.$time.formatDate(form.value.completionTime * 1000) : ''
form.value.statusTxt = form.value.status == 0 ? '完成' :'未完成'
}; };
jxDetailsStatus.value = await dictApi.getDict('jx_details_status') jxDetailsStatus.value = await dictApi.getDict('jx_details_status')

Loading…
Cancel
Save