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 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() {
//
@ -211,6 +224,10 @@
proxy.$modal.showToast('请输入预估人数')
return;
}
if (!validateInteger(form.value.peoples)) {
proxy.$modal.showToast('预估人数请输入正整数')
return;
}
if (form.value.peoples > 100) {
proxy.$modal.showToast('预估人数不得超出100')
return;
@ -219,10 +236,19 @@
proxy.$modal.showToast(`请输入预估分钟`)
return;
}
if (!validateInteger(form.value.estimatedMinutes)) {
proxy.$modal.showToast('预估分钟请输入正整数')
return;
}
if (!form.value.actualMinutes) {
proxy.$modal.showToast('请输入实际分钟')
return;
}
if (!validateInteger(form.value.actualMinutes)) {
proxy.$modal.showToast('实际分钟请输入正整数')
return;
}
if (!form.value.chargePeoples) {
proxy.$modal.showToast('请选择负责人')
return;
@ -465,6 +491,7 @@
form.value = JSON.parse(decodeURIComponent(option.data))
form.value.itemNumbers = form.value.items
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')

47
src/pages/upkeepOrder/addServiceRecord.vue

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

Loading…
Cancel
Save