|
|
|
|
@ -83,7 +83,12 @@
|
|
|
|
|
</view>
|
|
|
|
|
<view class="form-field">
|
|
|
|
|
<text class="form-label">{{ t('moldPressureNet.pressureNetTime') }}<text class="required-star">*</text></text>
|
|
|
|
|
<uni-datetime-picker v-model="pressureNetTime" type="datetime" :clear-icon="false" />
|
|
|
|
|
<uni-datetime-picker
|
|
|
|
|
v-model="pressureNetTime"
|
|
|
|
|
type="datetime"
|
|
|
|
|
:clear-icon="false"
|
|
|
|
|
@change="onPressureNetTimeChange"
|
|
|
|
|
/>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="form-field">
|
|
|
|
|
<text class="form-label">{{ t('moldPressureNet.remark') }}</text>
|
|
|
|
|
@ -317,6 +322,14 @@ function goHistory() {
|
|
|
|
|
uni.navigateTo({ url: '/pages_function/pages/moldPressureNet/history' })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function onPressureNetTimeChange(value) {
|
|
|
|
|
const normalizedValue = normalizePressureNetTime(value)
|
|
|
|
|
pressureNetTime.value = normalizedValue
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
pressureNetTime.value = normalizePressureNetTime(pressureNetTime.value || value) || normalizedValue
|
|
|
|
|
}, 0)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function handleSubmit() {
|
|
|
|
|
if (submitLoading.value) return
|
|
|
|
|
if (!selectedBrand.id) {
|
|
|
|
|
@ -327,7 +340,8 @@ async function handleSubmit() {
|
|
|
|
|
uni.showToast({ title: t('moldPressureNet.selectSubMoldError'), icon: 'none' })
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (!pressureNetTime.value) {
|
|
|
|
|
const normalizedPressureNetTime = normalizePressureNetTime(pressureNetTime.value)
|
|
|
|
|
if (!normalizedPressureNetTime) {
|
|
|
|
|
uni.showToast({ title: t('moldPressureNet.selectReplaceTimeError'), icon: 'none' })
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
@ -342,12 +356,12 @@ async function handleSubmit() {
|
|
|
|
|
moldBrandName: selectedBrand.name,
|
|
|
|
|
moldId: moldId,
|
|
|
|
|
moldName: selected?.name || '',
|
|
|
|
|
pressureNetTime: pressureNetTime.value,
|
|
|
|
|
pressureNetTime: normalizedPressureNetTime,
|
|
|
|
|
remark: remark.value.trim() || undefined
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
await createPressureNetRecord(createReqVOList)
|
|
|
|
|
uni.showToast({ title: t('moldPressureNet.submitSuccess'), icon: 'success' })
|
|
|
|
|
uni.showToast({ title: t('functionCommon.saveSuccess'), icon: 'success' })
|
|
|
|
|
// 清空表单
|
|
|
|
|
selectedBrand.id = ''
|
|
|
|
|
selectedBrand.name = ''
|
|
|
|
|
@ -362,6 +376,26 @@ async function handleSubmit() {
|
|
|
|
|
submitLoading.value = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function normalizePressureNetTime(value) {
|
|
|
|
|
const text = String(value || '').trim().replace(/\//g, '-')
|
|
|
|
|
const dateOnlyMatch = text.match(/^(\d{4}-\d{2}-\d{2})(?:\s+(?:undefined|null|选择时间|select time))?$/i)
|
|
|
|
|
if (dateOnlyMatch) {
|
|
|
|
|
return `${dateOnlyMatch[1]} ${getCurrentTime()}`
|
|
|
|
|
}
|
|
|
|
|
const dateTimeMatch = text.match(/^(\d{4}-\d{2}-\d{2})[ T](\d{2}):(\d{2})(?::(\d{2}))?$/)
|
|
|
|
|
if (!dateTimeMatch) return ''
|
|
|
|
|
const [, date, hour, minute, second = '00'] = dateTimeMatch
|
|
|
|
|
return `${date} ${hour}:${minute}:${second}`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getCurrentTime() {
|
|
|
|
|
const date = new Date()
|
|
|
|
|
const hour = String(date.getHours()).padStart(2, '0')
|
|
|
|
|
const minute = String(date.getMinutes()).padStart(2, '0')
|
|
|
|
|
const second = String(date.getSeconds()).padStart(2, '0')
|
|
|
|
|
return `${hour}:${minute}:${second}`
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|