chenrui  2 жил өмнө
parent
commit
44c80f0307

+ 84 - 15
src/views/BasicsData/shippingSpace/index.vue

@@ -23,29 +23,33 @@
         :msgTitle="msgTitle"
         @resetForm="resetForm"
         @delRest="delRest"
+        @submitForm="submitForm"
+        @delRemove="delRemove"
       >
         <div class="diacont">
           <el-form :model="tableForm">
             <el-row :gutter="24">
               <el-col>
                 <el-form-item label="舱位名称" size="default">
-                  <el-input v-model="tableForm.name" placeholder="请输入ID" />
+                  <el-input
+                    v-model="tableForm.storingName"
+                    placeholder="请输入舱位名称"
+                  />
                 </el-form-item>
               </el-col>
               <el-col>
                 <el-form-item label="舱位编码" size="default">
                   <el-input
-                    v-model="tableForm.china"
-                    placeholder="请输入航站名称"
+                    v-model="tableForm.storingCode"
+                    placeholder="请输入舱位编码"
                   />
                 </el-form-item>
               </el-col>
               <el-col>
                 <el-form-item label="舱位描述" size="default">
                   <el-input
-                    type="textarea"
-                    v-model="tableForm.englin"
-                    placeholder="请输入机场三字码"
+                    v-model="tableForm.storingDesc"
+                    placeholder="请输入舱位描述"
                   />
                 </el-form-item>
               </el-col>
@@ -75,10 +79,14 @@ const type = ref<String>(""); //判断是否删除
 const msgTitle = ref<String>("新增舱位管理"); //弹窗标题
 const tableColsCopys = reactive<Object>({}); //弹窗
 const tableForm = reactive({
-  name: "",
-  china: "",
-  englin: "",
+  storingID: "",
+  storingName: "",
+  storingCode: "",
+  storingDesc: "",
+  binNo: "",
+  event: "",
 }); //弹窗内容
+tableForm.binNo = route.query.modelID;
 //列表
 const tableData = ref([]);
 //表头
@@ -105,15 +113,17 @@ const tableBtnGroup = ref([
 //新增
 const addForm = () => {
   msgTitle.value = "新增舱位管理";
+  tableForm.event = 1;
   flag.value = true;
   type.value = "";
 };
 //取消
 const resetForm = () => {
   flag.value = false;
-  tableForm.name = "";
-  tableForm.china = "";
-  tableForm.englin = "";
+  tableForm.storingID = "";
+  tableForm.storingName = "";
+  tableForm.storingCode = "";
+  tableForm.storingDesc = "";
 };
 //编辑
 const editDialog = (data) => {
@@ -130,6 +140,10 @@ const eleDialog = () => {
   flag.value = true;
   type.value = "del";
 };
+const delRemove = () => {
+  tableForm.event = 3;
+  generalDataReception(tableForm);
+};
 //删除
 const delRest = () => {
   flag.value = false;
@@ -140,13 +154,20 @@ const btnClick = (row, index, param) => {
     msgTitle.value = "编辑舱位管理";
     flag.value = true;
     type.value = "";
-    tableForm.name = index.name;
-    tableForm.china = index.china;
-    tableForm.englin = index.englin;
+    tableForm.event = 2;
+    tableForm.storingID = index.storingID;
+    tableForm.storingName = index.storingName;
+    tableForm.storingCode = index.storingCode;
+    tableForm.storingDesc = index.storingDesc;
   } else if (param === 3) {
     msgTitle.value = "删除舱位管理";
     flag.value = true;
     type.value = "del";
+    tableForm.event = 3;
+    tableForm.storingID = index.storingID;
+    tableForm.storingName = index.storingName;
+    tableForm.storingCode = index.storingCode;
+    tableForm.storingDesc = index.storingDesc;
   } else if (param === 4) {
   }
 };
@@ -186,6 +207,54 @@ const getQuery = async () => {
     page.value--;
   }
 };
+//确认提交
+const submitForm = () => {
+  generalDataReception(tableForm);
+};
+const resetTable = () => {
+  page.value = 0;
+  noMore.value = false;
+  tableData.value = [];
+};
+//新增-编辑-删除
+const generalDataReception = async (data) => {
+  try {
+    let obj = {
+      IATACode: route.query.modelID,
+    };
+    data = {
+      ...data,
+      ...obj,
+    };
+    const { code } = await GeneralDataReception({
+      serviceId: serviceId.value,
+      dataContent: JSON.stringify(data),
+    });
+    if (code == 0) {
+      ElMessage.success(`操作成功`);
+      // this.$message.success("操作成功");
+      resetTable();
+      getQuery();
+      resetForm();
+      flag.value = false;
+      // rmFlag.value = false;
+      tableObj.value = {};
+      // this.$router.go(0);
+    } else {
+      ElMessage.error(`操作失败`);
+      // this.$message.error("操作失败");
+      // this.flag = false;
+      // this.rmFlag = false;
+      tableObj.value = {};
+      resetForm();
+    }
+  } catch (error) {
+    flag.value = false;
+    //  rmFlag.value = false;
+    tableObj.value = {};
+    resetForm();
+  }
+};
 getQuery();
 </script>
 <style lang="scss" scoped>