|
@@ -44,7 +44,7 @@
|
|
|
size="default"
|
|
size="default"
|
|
|
label-width="120px"
|
|
label-width="120px"
|
|
|
class="scrollable-form"
|
|
class="scrollable-form"
|
|
|
- :model="{ attrList: attrList }"
|
|
|
|
|
|
|
+ :model="{ attrList: attrList, reportDetails }"
|
|
|
>
|
|
>
|
|
|
<div style="margin-left: 24px">
|
|
<div style="margin-left: 24px">
|
|
|
<el-form class="demo-form-inline" :inline="true">
|
|
<el-form class="demo-form-inline" :inline="true">
|
|
@@ -106,7 +106,13 @@
|
|
|
style="width: 320px"
|
|
style="width: 320px"
|
|
|
/>
|
|
/>
|
|
|
</div>
|
|
</div>
|
|
|
- <el-form-item :label="attrItem.name" prop="deviceId" label-position="top">
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <el-form-item
|
|
|
|
|
+ v-if="attrItem.description !== 'productionStatus'"
|
|
|
|
|
+ :label="attrItem.name"
|
|
|
|
|
+ prop="deviceId"
|
|
|
|
|
+ label-position="top"
|
|
|
|
|
+ >
|
|
|
<div v-if="fillStatus === '1'">
|
|
<div v-if="fillStatus === '1'">
|
|
|
<el-select
|
|
<el-select
|
|
|
disabled
|
|
disabled
|
|
@@ -200,6 +206,7 @@
|
|
|
:controls="false"
|
|
:controls="false"
|
|
|
align="left"
|
|
align="left"
|
|
|
placeholder="请输入数字"
|
|
placeholder="请输入数字"
|
|
|
|
|
+ :disabled="fillStatus === '1'"
|
|
|
/>
|
|
/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
|
|
@@ -214,13 +221,192 @@
|
|
|
class="w-80!"
|
|
class="w-80!"
|
|
|
v-model="attrItem.fillContent"
|
|
v-model="attrItem.fillContent"
|
|
|
placeholder="请输入其他非生产原因"
|
|
placeholder="请输入其他非生产原因"
|
|
|
|
|
+ :disabled="fillStatus === '1'"
|
|
|
/>
|
|
/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+
|
|
|
|
|
+ <div v-if="companyName === 'ry'">
|
|
|
|
|
+ <div class="flex items-center justify-between mb-6">
|
|
|
|
|
+ <div class="flex items-center gap-2">
|
|
|
|
|
+ <div class="bg-[var(--el-color-primary)] w-1 h-5 rounded-full"></div>
|
|
|
|
|
+ <div class="text-lg font-medium text-[var(--el-text-color-primary)]"
|
|
|
|
|
+ >生产动态</div
|
|
|
|
|
+ >
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ :disabled="fillStatus === '1'"
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ link
|
|
|
|
|
+ :icon="Plus"
|
|
|
|
|
+ @click="addProductionStatusRow"
|
|
|
|
|
+ >
|
|
|
|
|
+ 添加一行
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <el-form-item prop="reportDetails" class="table-form-item">
|
|
|
|
|
+ <ZmTable :data="reportDetails" :loading="false" class="mb-4">
|
|
|
|
|
+ <ZmTableColumn
|
|
|
|
|
+ label="日期"
|
|
|
|
|
+ :width="105"
|
|
|
|
|
+ cover-formatter
|
|
|
|
|
+ :real-value="() => createTime"
|
|
|
|
|
+ />
|
|
|
|
|
+
|
|
|
|
|
+ <ZmTableColumn :width="130" label="开始时间" prop="startTime">
|
|
|
|
|
+ <template #default="{ row, $index }">
|
|
|
|
|
+ <el-form-item
|
|
|
|
|
+ v-if="$index >= 0"
|
|
|
|
|
+ class="mb-0!"
|
|
|
|
|
+ :prop="`reportDetails.${$index}.startTime`"
|
|
|
|
|
+ :rules="{
|
|
|
|
|
+ required: true,
|
|
|
|
|
+ message: '请选择开始时间',
|
|
|
|
|
+ trigger: ['change', 'blur']
|
|
|
|
|
+ }"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-time-picker
|
|
|
|
|
+ v-model="row.startTime"
|
|
|
|
|
+ placeholder="选择开始时间"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ format="HH:mm"
|
|
|
|
|
+ value-format="HH:mm"
|
|
|
|
|
+ class="w-full!"
|
|
|
|
|
+ @change="calculateDuration(row)"
|
|
|
|
|
+ :disabled="fillStatus === '1'"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </ZmTableColumn>
|
|
|
|
|
+ <ZmTableColumn :width="130" label="结束时间" prop="endTime">
|
|
|
|
|
+ <template #default="{ row, $index }">
|
|
|
|
|
+ <el-form-item
|
|
|
|
|
+ v-if="$index >= 0"
|
|
|
|
|
+ class="mb-0!"
|
|
|
|
|
+ :prop="`reportDetails.${$index}.endTime`"
|
|
|
|
|
+ :rules="{
|
|
|
|
|
+ required: true,
|
|
|
|
|
+ message: '请选择结束时间',
|
|
|
|
|
+ trigger: ['change', 'blur']
|
|
|
|
|
+ }"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-time-picker
|
|
|
|
|
+ v-model="row.endTime"
|
|
|
|
|
+ placeholder="选择结束时间"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ format="HH:mm"
|
|
|
|
|
+ value-format="HH:mm"
|
|
|
|
|
+ class="w-full!"
|
|
|
|
|
+ @change="calculateDuration(row)"
|
|
|
|
|
+ :disabled="fillStatus === '1'"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </ZmTableColumn>
|
|
|
|
|
+ <ZmTableColumn :width="80" label="时长(H)" prop="duration" />
|
|
|
|
|
+
|
|
|
|
|
+ <ZmTableColumn label="工况" min-width="140">
|
|
|
|
|
+ <template #default="{ row, $index }">
|
|
|
|
|
+ <el-form-item
|
|
|
|
|
+ v-if="$index >= 0"
|
|
|
|
|
+ :prop="`reportDetails.${$index}.currentOperation`"
|
|
|
|
|
+ :rules="{
|
|
|
|
|
+ required: true,
|
|
|
|
|
+ message: '请输入工况',
|
|
|
|
|
+ trigger: ['change', 'blur']
|
|
|
|
|
+ }"
|
|
|
|
|
+ class="mb-0!"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="row.currentOperation"
|
|
|
|
|
+ type="textarea"
|
|
|
|
|
+ :autosize="{ minRows: 1 }"
|
|
|
|
|
+ show-word-limit
|
|
|
|
|
+ :maxlength="1000"
|
|
|
|
|
+ placeholder="请输入工况"
|
|
|
|
|
+ :disabled="fillStatus === '1'"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </ZmTableColumn>
|
|
|
|
|
+
|
|
|
|
|
+ <ZmTableColumn v-if="showDepth" label="结束井深(m)" min-width="80">
|
|
|
|
|
+ <template #default="{ row, $index }">
|
|
|
|
|
+ <el-form-item
|
|
|
|
|
+ v-if="$index >= 0"
|
|
|
|
|
+ :prop="`reportDetails.${$index}.currentDepth`"
|
|
|
|
|
+ :rules="[
|
|
|
|
|
+ {
|
|
|
|
|
+ required: true,
|
|
|
|
|
+ message: '请输入结束井深',
|
|
|
|
|
+ trigger: ['blur']
|
|
|
|
|
+ }
|
|
|
|
|
+ // { validator: validateLastCurrentDepth, trigger: ['change', 'blur'] }
|
|
|
|
|
+ ]"
|
|
|
|
|
+ class="mb-0!"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-input-number
|
|
|
|
|
+ v-model="row.currentDepth"
|
|
|
|
|
+ :min="0"
|
|
|
|
|
+ :controls="false"
|
|
|
|
|
+ class="!w-full"
|
|
|
|
|
+ align="left"
|
|
|
|
|
+ placeholder="请输入结束井深"
|
|
|
|
|
+ @input="(val) => inputCurrentDepth(val, $index)"
|
|
|
|
|
+ :disabled="fillStatus === '1'"
|
|
|
|
|
+ >
|
|
|
|
|
+ <template #suffix> m </template>
|
|
|
|
|
+ </el-input-number>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </ZmTableColumn>
|
|
|
|
|
+
|
|
|
|
|
+ <ZmTableColumn label="详细描述" min-width="200" align="center">
|
|
|
|
|
+ <template #default="{ row, $index }">
|
|
|
|
|
+ <el-form-item
|
|
|
|
|
+ v-if="$index >= 0"
|
|
|
|
|
+ :prop="`reportDetails.${$index}.constructionDetail`"
|
|
|
|
|
+ :rules="{ required: true, message: '请输入详细描述', trigger: 'blur' }"
|
|
|
|
|
+ class="mb-0!"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="row.constructionDetail"
|
|
|
|
|
+ type="textarea"
|
|
|
|
|
+ :autosize="{ minRows: 1 }"
|
|
|
|
|
+ show-word-limit
|
|
|
|
|
+ :maxlength="1000"
|
|
|
|
|
+ placeholder="请输入详细描述"
|
|
|
|
|
+ :disabled="fillStatus === '1'"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </ZmTableColumn>
|
|
|
|
|
+
|
|
|
|
|
+ <ZmTableColumn label="操作" width="80" fixed="right" align="center">
|
|
|
|
|
+ <template #default="{ $index }">
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ link
|
|
|
|
|
+ type="danger"
|
|
|
|
|
+ :icon="Delete"
|
|
|
|
|
+ @click="removeProductionStatusRow($index)"
|
|
|
|
|
+ :disabled="fillStatus === '1'"
|
|
|
|
|
+ >
|
|
|
|
|
+ 删除
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </ZmTableColumn>
|
|
|
|
|
+ </ZmTable>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
<el-form-item>
|
|
<el-form-item>
|
|
|
- <el-button type="primary" @click="getFillInfo" v-show="showStatus">{{
|
|
|
|
|
- t('operationFillForm.confirm')
|
|
|
|
|
- }}</el-button>
|
|
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ :loading="submitLoading"
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ @click="getFillInfo"
|
|
|
|
|
+ v-show="showStatus"
|
|
|
|
|
+ >{{ t('operationFillForm.confirm') }}</el-button
|
|
|
|
|
+ >
|
|
|
<el-button type="info" @click="deleteFillInfo" v-show="showStatus">{{
|
|
<el-button type="info" @click="deleteFillInfo" v-show="showStatus">{{
|
|
|
t('operationFill.clear')
|
|
t('operationFill.clear')
|
|
|
}}</el-button>
|
|
}}</el-button>
|
|
@@ -238,6 +424,9 @@ 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'
|
|
|
|
|
+import { calculateDuration, formatT } from '@/utils/formatTime'
|
|
|
|
|
+import { Delete, Plus } from '@element-plus/icons-vue'
|
|
|
|
|
+import { useDebounceFn } from '@vueuse/core'
|
|
|
|
|
|
|
|
/** 运行记录填报 列表 */
|
|
/** 运行记录填报 列表 */
|
|
|
defineOptions({ name: 'FillOrderInfo' })
|
|
defineOptions({ name: 'FillOrderInfo' })
|
|
@@ -284,6 +473,50 @@ const queryParams = reactive<any>({
|
|
|
isSum: undefined
|
|
isSum: undefined
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+interface ReportDetail {
|
|
|
|
|
+ startTime: string
|
|
|
|
|
+ endTime: string
|
|
|
|
|
+ duration: number
|
|
|
|
|
+ currentDepth: number
|
|
|
|
|
+ currentOperation: string
|
|
|
|
|
+ constructionDetail: string
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const reportDetails = ref<ReportDetail[]>([])
|
|
|
|
|
+
|
|
|
|
|
+const addProductionStatusRow = () => {
|
|
|
|
|
+ if (!reportDetails.value) {
|
|
|
|
|
+ reportDetails.value = []
|
|
|
|
|
+ }
|
|
|
|
|
+ reportDetails.value.push({
|
|
|
|
|
+ startTime: '',
|
|
|
|
|
+ endTime: '',
|
|
|
|
|
+ duration: 0,
|
|
|
|
|
+ currentDepth: 0,
|
|
|
|
|
+ currentOperation: '',
|
|
|
|
|
+ constructionDetail: ''
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const removeProductionStatusRow = (index: number) => {
|
|
|
|
|
+ if (index === 0) {
|
|
|
|
|
+ message.warning('至少填写一条生产动态')
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ reportDetails.value.splice(index, 1)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const inputCurrentDepth = useDebounceFn(function inputCurrentDepth(val: any, index: number) {
|
|
|
|
|
+ if (reportDetails.value && index === reportDetails.value.length - 1) {
|
|
|
|
|
+ const currentDepth = attrList.value.find((item) => item.description === 'currentDepth')
|
|
|
|
|
+ if (currentDepth) currentDepth.fillContent = val
|
|
|
|
|
+ }
|
|
|
|
|
+}, 300)
|
|
|
|
|
+
|
|
|
|
|
+const showDepth = computed(() => {
|
|
|
|
|
+ return attrList.value.some((item) => item.description === 'currentDepth')
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
const NON_KEYS = [
|
|
const NON_KEYS = [
|
|
|
'repairTime',
|
|
'repairTime',
|
|
|
'selfStopTime',
|
|
'selfStopTime',
|
|
@@ -496,7 +729,21 @@ const getList = async () => {
|
|
|
queryParams.deviceName = list.value[0].deviceName
|
|
queryParams.deviceName = list.value[0].deviceName
|
|
|
queryParams.deviceId = list.value[0].deviceId
|
|
queryParams.deviceId = list.value[0].deviceId
|
|
|
}
|
|
}
|
|
|
- getAttrList()
|
|
|
|
|
|
|
+ await getAttrList()
|
|
|
|
|
+ IotOpeationFillApi.getReportDetails(deptId.split(',')[3]).then((res) => {
|
|
|
|
|
+ reportDetails.value = (res ? (res as any[]) : []).map((item) => ({
|
|
|
|
|
+ startTime: formatT(item.startTime),
|
|
|
|
|
+ endTime: formatT(item.endTime),
|
|
|
|
|
+ duration: item.duration,
|
|
|
|
|
+ currentDepth: item.currentDepth,
|
|
|
|
|
+ currentOperation: item.currentOperation,
|
|
|
|
|
+ constructionDetail: item.constructionDetail
|
|
|
|
|
+ }))
|
|
|
|
|
+
|
|
|
|
|
+ if (!reportDetails.value.length) {
|
|
|
|
|
+ addProductionStatusRow()
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
} finally {
|
|
} finally {
|
|
|
loading.value = false
|
|
loading.value = false
|
|
|
}
|
|
}
|
|
@@ -680,10 +927,14 @@ const getAttrList = async () => {
|
|
|
}
|
|
}
|
|
|
const formRef = ref<FormInstance[] | null>(null)
|
|
const formRef = ref<FormInstance[] | null>(null)
|
|
|
|
|
|
|
|
|
|
+const submitLoading = ref(false)
|
|
|
|
|
+
|
|
|
/** 获取填写信息保存到后台*/
|
|
/** 获取填写信息保存到后台*/
|
|
|
const getFillInfo = async () => {
|
|
const getFillInfo = async () => {
|
|
|
if (!formRef.value) return
|
|
if (!formRef.value) return
|
|
|
|
|
|
|
|
|
|
+ submitLoading.value = true
|
|
|
|
|
+
|
|
|
try {
|
|
try {
|
|
|
const validations = formRef.value.map((form) => form.validate())
|
|
const validations = formRef.value.map((form) => form.validate())
|
|
|
await Promise.all(validations)
|
|
await Promise.all(validations)
|
|
@@ -699,6 +950,7 @@ const getFillInfo = async () => {
|
|
|
(item.fillContent === undefined || item.fillContent === '')
|
|
(item.fillContent === undefined || item.fillContent === '')
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
|
|
|
+
|
|
|
if (emptyFields.length > 0) {
|
|
if (emptyFields.length > 0) {
|
|
|
ElMessage.error(t('operationFillForm.fill'))
|
|
ElMessage.error(t('operationFillForm.fill'))
|
|
|
return
|
|
return
|
|
@@ -757,8 +1009,9 @@ const getFillInfo = async () => {
|
|
|
})
|
|
})
|
|
|
const data = attrList2.value as unknown as IotOpeationFillVO
|
|
const data = attrList2.value as unknown as IotOpeationFillVO
|
|
|
|
|
|
|
|
- console.log('data :>> ', data)
|
|
|
|
|
- await IotOpeationFillApi.insertLog(data)
|
|
|
|
|
|
|
+ const reqData = { createReqVO: data, reportDetails: reportDetails.value }
|
|
|
|
|
+
|
|
|
|
|
+ await IotOpeationFillApi.insertLog(reqData)
|
|
|
message.success(t('common.createSuccess'))
|
|
message.success(t('common.createSuccess'))
|
|
|
// 发送操作成功的事件
|
|
// 发送操作成功的事件
|
|
|
emit('success')
|
|
emit('success')
|
|
@@ -766,6 +1019,8 @@ const getFillInfo = async () => {
|
|
|
getList()
|
|
getList()
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
console.error('保存失败:', error)
|
|
console.error('保存失败:', error)
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ submitLoading.value = false
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -935,4 +1190,10 @@ onMounted(async () => {
|
|
|
border: 2px solid #42b983; /* 使用Vue标志性的绿色边框 */
|
|
border: 2px solid #42b983; /* 使用Vue标志性的绿色边框 */
|
|
|
border-radius: 4px;
|
|
border-radius: 4px;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+:deep(.table-form-item) {
|
|
|
|
|
+ .el-form-item__content {
|
|
|
|
|
+ margin-left: 0 !important;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
</style>
|
|
</style>
|