|
@@ -40,6 +40,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
<div class="form-wrapper h-full">
|
|
<div class="form-wrapper h-full">
|
|
|
<el-form
|
|
<el-form
|
|
|
|
|
+ ref="formRef"
|
|
|
size="default"
|
|
size="default"
|
|
|
label-width="120px"
|
|
label-width="120px"
|
|
|
class="scrollable-form"
|
|
class="scrollable-form"
|
|
@@ -224,7 +225,7 @@
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
import { IotOpeationFillApi, IotOpeationFillVO } from '@/api/pms/iotopeationfill'
|
|
import { IotOpeationFillApi, IotOpeationFillVO } from '@/api/pms/iotopeationfill'
|
|
|
-import { ElMessage, FormRules } from 'element-plus'
|
|
|
|
|
|
|
+import { ElMessage, FormInstance, FormRules } from 'element-plus'
|
|
|
import moment from 'moment'
|
|
import moment from 'moment'
|
|
|
import { getIntDictOptions, getStrDictOptions } from '@/utils/dict'
|
|
import { getIntDictOptions, getStrDictOptions } from '@/utils/dict'
|
|
|
import { useRoute } from 'vue-router'
|
|
import { useRoute } from 'vue-router'
|
|
@@ -321,7 +322,6 @@ const sumNonProdTimes = () => {
|
|
|
const rhValidateTotalTime =
|
|
const rhValidateTotalTime =
|
|
|
(isNon: boolean = false) =>
|
|
(isNon: boolean = false) =>
|
|
|
(_rule: any, _value: any, callback: any) => {
|
|
(_rule: any, _value: any, callback: any) => {
|
|
|
- console.log('11 :>> ', 11)
|
|
|
|
|
const gasTime =
|
|
const gasTime =
|
|
|
attrList.value.find((item) => item.description === 'dailyInjectGasTime')?.fillContent || 0
|
|
attrList.value.find((item) => item.description === 'dailyInjectGasTime')?.fillContent || 0
|
|
|
const nonProdSum = sumNonProdTimes()
|
|
const nonProdSum = sumNonProdTimes()
|
|
@@ -399,14 +399,14 @@ const validateOtherReason = (_rule: any, value: any, callback: any) => {
|
|
|
|
|
|
|
|
const rules = reactive<FormRules>({
|
|
const rules = reactive<FormRules>({
|
|
|
dailyInjectGasTime: [
|
|
dailyInjectGasTime: [
|
|
|
- { required: true, message: '请输入当日运转时间', trigger: 'blur' },
|
|
|
|
|
- { validator: rhValidateTotalTime(), trigger: 'blur' }
|
|
|
|
|
|
|
+ { required: true, message: '请输入当日运转时间' },
|
|
|
|
|
+ { validator: rhValidateTotalTime() }
|
|
|
],
|
|
],
|
|
|
drillingWorkingTime: [
|
|
drillingWorkingTime: [
|
|
|
- { required: true, message: '请输入进尺工作时间', trigger: 'blur' },
|
|
|
|
|
- { validator: ryValidateTotalTime(), trigger: 'blur' }
|
|
|
|
|
|
|
+ { required: true, message: '请输入进尺工作时间' },
|
|
|
|
|
+ { validator: ryValidateTotalTime() }
|
|
|
],
|
|
],
|
|
|
- otherProductionTime: [{ validator: ryValidateTotalTime(), trigger: 'blur' }],
|
|
|
|
|
|
|
+ otherProductionTime: [{ validator: ryValidateTotalTime() }],
|
|
|
// ratedProductionTime: [
|
|
// ratedProductionTime: [
|
|
|
// { required: true, message: '请输入额定生产时间', trigger: 'blur' },
|
|
// { required: true, message: '请输入额定生产时间', trigger: 'blur' },
|
|
|
// { validator: ryXjValidateTotalTime(), trigger: 'blur' }
|
|
// { validator: ryXjValidateTotalTime(), trigger: 'blur' }
|
|
@@ -415,7 +415,7 @@ const rules = reactive<FormRules>({
|
|
|
// { required: true, message: '请输入生产时间', trigger: 'blur' },
|
|
// { required: true, message: '请输入生产时间', trigger: 'blur' },
|
|
|
// { validator: ryXjValidateTotalTime(), trigger: 'blur' }
|
|
// { validator: ryXjValidateTotalTime(), trigger: 'blur' }
|
|
|
// ],
|
|
// ],
|
|
|
- otherNptReason: [{ validator: validateOtherReason, trigger: 'blur' }]
|
|
|
|
|
|
|
+ otherNptReason: [{ validator: validateOtherReason }]
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
const totalValidatorComputed = computed(() => {
|
|
const totalValidatorComputed = computed(() => {
|
|
@@ -434,7 +434,7 @@ nextTick(() => {
|
|
|
const validator = totalValidatorComputed.value
|
|
const validator = totalValidatorComputed.value
|
|
|
if (!validator) return
|
|
if (!validator) return
|
|
|
NON_KEYS.forEach((field) => {
|
|
NON_KEYS.forEach((field) => {
|
|
|
- rules[field] = [{ validator: validator(true), trigger: 'blur' }]
|
|
|
|
|
|
|
+ rules[field] = [{ validator: validator(true) }]
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -605,17 +605,31 @@ const getAttrList = async () => {
|
|
|
|
|
|
|
|
// 为非累计数据添加最大值限制
|
|
// 为非累计数据添加最大值限制
|
|
|
attrList.value.forEach(function (item) {
|
|
attrList.value.forEach(function (item) {
|
|
|
- if (item.fillContent !== '' && item.fillContent !== null) {
|
|
|
|
|
- const num = Number(item.fillContent)
|
|
|
|
|
|
|
+ let strVal = String(item.fillContent || '').trim()
|
|
|
|
|
+
|
|
|
|
|
+ if (strVal !== '') {
|
|
|
|
|
+ const num = Number(strVal)
|
|
|
|
|
+
|
|
|
if (!isNaN(num)) {
|
|
if (!isNaN(num)) {
|
|
|
- if (item.fillContent.includes('.')) {
|
|
|
|
|
|
|
+ if (strVal.includes('.')) {
|
|
|
item.fillContent = Number(num.toFixed(2))
|
|
item.fillContent = Number(num.toFixed(2))
|
|
|
} else {
|
|
} else {
|
|
|
- item.fillContent = Math.floor(num)
|
|
|
|
|
|
|
+ item.fillContent = num
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // if (item.fillContent !== '' && item.fillContent !== null) {
|
|
|
|
|
+ // const num = Number(item.fillContent)
|
|
|
|
|
+ // if (!isNaN(num)) {
|
|
|
|
|
+ // if (item.fillContent.includes('.')) {
|
|
|
|
|
+ // item.fillContent = Number(num.toFixed(2))
|
|
|
|
|
+ // } else {
|
|
|
|
|
+ // item.fillContent = Math.floor(num)
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
+
|
|
|
if (companyName.value === 'rd') {
|
|
if (companyName.value === 'rd') {
|
|
|
// 添加最大值限制逻辑
|
|
// 添加最大值限制逻辑
|
|
|
const coreName = item.name.replace(/填报/g, '')
|
|
const coreName = item.name.replace(/填报/g, '')
|
|
@@ -655,9 +669,16 @@ const getAttrList = async () => {
|
|
|
loading.value = false
|
|
loading.value = false
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+const formRef = ref<FormInstance[] | null>(null)
|
|
|
|
|
+
|
|
|
/** 获取填写信息保存到后台*/
|
|
/** 获取填写信息保存到后台*/
|
|
|
const getFillInfo = async () => {
|
|
const getFillInfo = async () => {
|
|
|
|
|
+ if (!formRef.value) return
|
|
|
try {
|
|
try {
|
|
|
|
|
+ formRef.value.forEach((form) => {
|
|
|
|
|
+ form.validate()
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
const company = await IotOpeationFillApi.getOrgName(route.params.id.toString().split(',')[0])
|
|
const company = await IotOpeationFillApi.getOrgName(route.params.id.toString().split(',')[0])
|
|
|
|
|
|
|
|
if (devName != '生产日报') {
|
|
if (devName != '生产日报') {
|