Ver Fonte

feat: 弹框式添加发动机型号、测量批次

Rmengdi há 11 meses atrás
pai
commit
38cf43e55a

+ 135 - 28
meas_web/src/views/meas/envData/index.vue

@@ -116,6 +116,9 @@
               placeholder="请选择发动机型号">
               <el-option v-for="item in engineModelList" :key="item.id" :label="item.model" :value="item.id">
               </el-option>
+              <el-option :value="undefined" disabled style="cursor: pointer">
+                <el-button type="text" @click="onClickBtn('engine')"><i class="el-icon-plus"></i> 增加发动机型号</el-button>
+              </el-option>
             </el-select>
           </el-form-item>
           <el-form-item label="几何模型" prop="geometryFiles">
@@ -130,12 +133,15 @@
       <el-form ref="form" :model="form" :rules="rules" size="mini" label-width="90px">
         <el-form-item label="测量批次" prop="measurementBatch">
           <el-select ref="measureBatch" allow-create default-first-option filterable v-model="form.measurementBatchId"
-            placeholder="请选择测量批次id">
+            placeholder="请选择测量批次">
             <el-option v-for="item in measureBatchOptions" :key="item.id" :label="item.measurementBatch"
               :value="item.id">
               <span style="float: left">{{ item.id }}</span>
               <span style="float: right; color: #8492a6; font-size: 13px">{{ item.measurementBatch }}</span>
             </el-option>
+            <el-option :value="undefined" disabled style="cursor: pointer">
+                <el-button type="text" @click="onClickBtn('measBatch')"><i class="el-icon-plus"></i> 增加测量批次</el-button>
+              </el-option>
           </el-select>
 
         </el-form-item>
@@ -194,7 +200,9 @@
             <el-form-item label="CO₂浓度" prop="concentration">
               <el-input v-model="form.concentration" placeholder="请输入浓度(单位:mol)" />
             </el-form-item>
-            <el-col :span="8"></el-col>
+            <el-col :span="8">
+              <el-button type="primary" size="mini" @click="envDataSave">保 存</el-button>
+            </el-col>
           </el-row>
         </el-form>
       </div>
@@ -322,6 +330,35 @@
         <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
+    <el-dialog title="增加发动机型号" :visible.sync="addDialogVisible" width="400px" append-to-body>
+      <el-input v-model="engineModel" placeholder="请输入发动机型号">
+        <template slot="prepend">发动机型号</template>
+      </el-input>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="addEngine()">确 定</el-button>
+        <el-button @click="addDialogVisible = false">取 消</el-button>
+      </div>
+    </el-dialog>
+    <el-dialog :title="title" :visible.sync="addMeasVisible" width="400px" append-to-body>
+      <el-form ref="form" :model="addMeasBatchForm" :rules="rules" label-width="80px">
+        <el-form-item label="发动机型号ID" label-width="110px" prop="engineId">
+          <el-select v-model="addMeasBatchForm.engineId" placeholder="请选择发动机型号ID">
+            <el-option v-for="item in engineModelList" :key="item.id" :label="item.model"
+              :value="item.id">
+              <span style="float: left">{{ item.id }}</span>
+              <span style="float: right; color: #8492a6; font-size: 13px">{{ item.model }}</span>
+            </el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="测量批次" prop="measurementBatch">
+          <el-input v-model="addMeasBatchForm.measurementBatch" placeholder="请输入测量批次(测量年月日+发动机型号)" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="addMeas()">确 定</el-button>
+        <el-button @click="addMeasVisible=false">取 消</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
@@ -334,8 +371,8 @@ import {
   updateEnvData,
 } from "@/api/meas/envData";
 import { listEngineModel, addEngineModel, getEngineModel, updateEngineModel } from "@/api/meas/engineModel";
-import { listMeasBatch } from "@/api/meas/measBatch";
-import { addRadiation, getRadiation, updateRadiation,listRadiation  } from "@/api/meas/radiation";
+import { listMeasBatch,addMeasBatch } from "@/api/meas/measBatch";
+import { addRadiation, getRadiation, updateRadiation, listRadiation } from "@/api/meas/radiation";
 import { addThermalImagerTesDdata, listThermalImagerTesDdata, updateThermalImagerTesDdata } from "@/api/meas/thermalImagerTesDdata";
 import { addTransmissionRate, listTransmissionRate, updateTransmissionRate } from "@/api/meas/transmissionRate";
 
@@ -361,6 +398,8 @@ export default {
       title: "",
       // 是否显示弹出层
       open: false,
+      addDialogVisible: false,
+      addMeasVisible:false,
       // 查询参数
       queryParams: {
         pageNum: 1,
@@ -451,7 +490,6 @@ export default {
           },
         ],
       },
-
       // 发动机状态
       engineStatusOptions: [
         { label: "最大", value: 1 },
@@ -470,12 +508,18 @@ export default {
       fpsOptions: [],
       spectralBandOptions: [],
       measureBatchOptions: [],
-      engineModelList: []
+      engineModelList: [],
+      engineModel: '',
+      addMeasBatchForm:{
+        engineId:null,
+        measurementBatch:null
+      },
     };
   },
   created() {
     this.getList();
-    this.getFormData()
+    this.getListEngineModel()
+    this.getListMeasBatch()
   },
   methods: {
     /** 查询测量环境数据列表 */
@@ -487,13 +531,22 @@ export default {
         this.loading = false;
       });
     },
-    getFormData() {
+    // 获取发电机List
+    getListEngineModel(){
+      this.loading = true;
       const data = {}
       listEngineModel(data).then(response => {
         this.engineModelList = response.rows
+        this.loading = false;
       });
+    },
+    // 获取测量批次List
+    getListMeasBatch(){
+      const data = {}
+      this.loading = true;
       listMeasBatch(data).then(response => {
         this.measureBatchOptions = response.rows;
+        this.loading = false;
       });
     },
     // 取消按钮
@@ -501,6 +554,40 @@ export default {
       this.open = false;
       this.reset();
     },
+    // 保存环境参数
+    envDataSave() {
+      // 保存环境参数,返回一个环境数据ID
+    },
+    // 点击增加按钮
+    onClickBtn(type) {
+      if(type==='engine') this.addDialogVisible = true
+      else if(type==='measBatch') this.addMeasVisible = true
+    },
+    // 增加发动机型号
+    addEngine() {
+      this.loading = true;
+      const form = {
+        model: this.engineModel
+      }
+      addEngineModel(form).then(response => {
+        this.$modal.msgSuccess("新增成功");
+        this.addDialogVisible = false;
+        this.getListEngineModel()
+        this.engineModel=null
+      });
+    },
+    // 增加测量批次
+    addMeas(){
+      addMeasBatch(this.addMeasBatchForm).then(response => {
+        this.$modal.msgSuccess("新增成功");
+        this.addMeasVisible = false;
+        this.getListMeasBatch();
+        this.addMeasBatchForm={
+          engineId:null,
+          measurementBatch:null
+        }
+      });
+    },
     // 表单重置
     reset() {
       this.form = {
@@ -522,7 +609,44 @@ export default {
         updateBy: null,
         updateTime: null,
       };
+      this.engineForm = {
+        model: null,
+        geometryFiles: null,
+        geometryImage: null,
+      }
+      this.radiationForm = {
+        model: null,
+        lensFView: null,
+        gain: null,
+        backgroundData: null,
+        calTemp: null,
+        calCurve: null,
+        rawData: null,
+        radiance1: null,
+        radiance2: null,
+      }
+      this.TIForm = {
+        model: null,
+        lensFView: null,
+        filterNo: null,
+        fps: null,
+        spectralBand: null,
+        integrationTime: null,
+        tempCal: null,
+        radiance: null,
+        radIllumination: null,
+        radTemp: null,
+      }
+      this.TransmittanceForm = {
+        rawData: null,
+        curve1: null,
+        curve2: null,
+      }
       this.resetForm("form");
+      this.resetForm("engineForm");
+      this.resetForm("radiationForm");
+      this.resetForm("TIForm");
+      this.resetForm("TransmittanceForm");
     },
     /** 搜索按钮操作 */
     handleQuery() {
@@ -550,13 +674,13 @@ export default {
     handleUpdate(row) {
       this.reset();
       const measId = {
-        measurementBatchId:row.measurementBatchId
+        measurementBatchId: row.measurementBatchId
       }
-      console.log("measId",measId);
+      console.log("measId", measId);
       const id = row.id || this.ids;
       // 通过measId来查找,不具有唯一性吧。一个测量批次可以绑定多个光谱辐射数据吧。。。。
       listEngineModel(measId).then(response => {
-        console.log("getEngineModelRes",response);
+        console.log("getEngineModelRes", response);
         this.engineForm = response.rows[0];
       });
       listRadiation(measId).then(response => {
@@ -576,8 +700,6 @@ export default {
     },
     /** 提交按钮 */
     submitForm() {
-      // 新增加的自定义选项
-      this.addCustomOptions()
       this.TIForm['measurementBatchId'] = this.form.measurementBatchId
       this.TransmittanceForm['measurementBatchId'] = this.form.measurementBatchId
       this.radiationForm['measurementBatchId'] = this.form.measurementBatchId
@@ -605,21 +727,6 @@ export default {
         }
       });
     },
-    addCustomOptions() {
-      if (this.$refs.engineModel.createdLabel) {
-        addEngineModel(this.engineForm).then(response => {
-          console.log("response", response);
-          this.open = false;
-        });
-      }
-      // if(this.$refs.measureBatch.createdLabel){
-      //   const addData={
-
-      // }
-      // 增加测量批次,需要有发动机型号的ID,如果新添加的自定义型号,此时还没有发动机型号ID
-      // 测量批次绑定的有一个发动机型号ID,所以选择的时候用不用关联
-      // 发动机状态、角度是否分别写入数据库
-    },
     /** 删除按钮操作 */
     handleDelete(row) {
       const ids = row.id || this.ids;

+ 1 - 1
meas_web/src/views/meas/measBatch/index.vue

@@ -108,7 +108,7 @@
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
         <el-form-item label="发动机型号ID" label-width="110px" prop="engineId">
           <!-- <el-input v-model.number="form.engineId" placeholder="请输入发动机型号ID" /> -->
-          <el-select v-model="form.engineId" placeholder="请选择测量批次id">
+          <el-select v-model="form.engineId" placeholder="请选择发动机型号ID">
             <el-option v-for="item in engineOptions" :key="item.id" :label="item.model"
               :value="item.id">
               <span style="float: left">{{ item.id }}</span>