Procházet zdrojové kódy

运行记录选择井号

Zimo před 12 hodinami
rodič
revize
1b21356af1

+ 1 - 0
src/api/pms/iotopeationfill/index.ts

@@ -38,6 +38,7 @@ export interface IotOpeationFillVO {
   maxAllowedValue: any
   isCollection: any
   description: any
+  wellNamePair: any
 }
 
 // 运行记录填报 API

+ 48 - 3
src/views/pms/iotopeationfill/index1.vue

@@ -44,7 +44,7 @@
             size="default"
             label-width="120px"
             class="scrollable-form"
-            :model="{ attrList: attrList, reportDetails }"
+            :model="{ attrList: attrList, reportDetails, taskId }"
           >
             <div style="margin-left: 24px">
               <el-form class="demo-form-inline" :inline="true">
@@ -59,7 +59,33 @@
                   </span>
                 </el-form-item>
                 <el-form-item
-                  v-if="deviceItem.deviceName === '生产日报'"
+                  v-if="deviceItem.deviceName === '生产日报' && companyName !== 'ry'"
+                  label="井号"
+                  class="custom-label1"
+                >
+                  <span style="text-decoration: underline">
+                    {{ deviceItem.wellName }}
+                  </span>
+                </el-form-item>
+                <el-form-item
+                  v-else-if="
+                    deviceItem.deviceName === '生产日报' &&
+                    companyName === 'ry' &&
+                    taskOptions.length > 0
+                  "
+                  label="井号"
+                  class="custom-label1"
+                  prop="taskId"
+                >
+                  <el-select
+                    v-model="taskId"
+                    placeholder="请选择井号"
+                    :options="taskOptions"
+                    class="w-40!"
+                  />
+                </el-form-item>
+                <el-form-item
+                  v-else-if="deviceItem.deviceName === '生产日报'"
                   label="井号"
                   class="custom-label1"
                 >
@@ -502,6 +528,9 @@ interface ReportDetail {
   constructionDetail: string
 }
 
+const taskId = ref<number | undefined>(undefined)
+const taskOptions = ref<{ label: string; value: number }[]>([])
+
 const reportDetails = ref<ReportDetail[]>([])
 
 const addProductionStatusRow = () => {
@@ -751,6 +780,16 @@ const getList = async () => {
       queryParams.deviceId = list.value[0].deviceId
     }
     await getAttrList()
+
+    const daily = list.value.find((item) => item.deviceName === '生产日报') ?? { wellNamePair: {} }
+
+    taskOptions.value = Object.keys(daily.wellNamePair).map((key) => ({
+      label: daily.wellNamePair[key],
+      value: Number(key)
+    }))
+
+    taskId.value = taskOptions.value[0].value
+
     IotOpeationFillApi.getReportDetails(deptId.split(',')[3]).then((res) => {
       reportDetails.value = (res ? (res as any[]) : []).map((item) => ({
         reportDate: item.reportDate ?? dayjs(createTime).valueOf(),
@@ -1031,7 +1070,13 @@ const getFillInfo = async () => {
     })
     const data = attrList2.value as unknown as IotOpeationFillVO
 
-    const reqData = { createReqVO: data, reportDetails: reportDetails.value }
+    const reqData = {
+      createReqVO: data,
+      reportDetails: reportDetails.value.map((item) => ({
+        ...item,
+        taskId: taskId.value
+      }))
+    }
 
     await IotOpeationFillApi.insertLog(reqData)
     message.success(t('common.createSuccess'))