chenjun há 3 anos atrás
pai
commit
ba07d4a362

+ 142 - 6
src/views/systemSettings/views/sourceDataItemManagement/sourceDataItemHome.vue

@@ -36,6 +36,70 @@
           </el-col>
         </el-row>
       </div>
+       <!--新增/编辑-->
+      <Dialog :flag="editDialogVisible" width="466px" :show-flag="true">
+        <div class="airportInfoDialog dialog-public-background">
+          <div class="title">{{ editDialogTitle }}</div>
+          <div class="content">
+            <el-form
+              ref="ruleForm"
+              :model="ruleForm"
+              :rules="rules"
+              label-width="140px"
+              class="demo-ruleForm"
+            >
+              <el-form-item label="目标数据名" prop="tdataName">
+                <el-input
+                  v-model="ruleForm.tdataName"
+                  size="small"
+                  placeholder="请输入目标数据名称"
+                />
+              </el-form-item>
+              <el-form-item label="数据类型" prop="datatype">
+                <el-select
+                  v-model="ruleForm.datatype"
+                  size="small"
+                  placeholder="请选择数据类型"
+                >
+                  <el-option label="字符串" value="1"></el-option>
+                  <el-option label="数字" value="2"></el-option>
+                  <el-option label="时间" value="3"></el-option>
+                  <el-option label="日期" value="4"></el-option>
+                </el-select>
+              </el-form-item>
+              <el-form-item label="目标数据事件标识" prop="eventID">
+                <el-input
+                  v-model="ruleForm.eventID"
+                  size="small"
+                  placeholder="请输入目标数据事件标识"
+                />
+              </el-form-item>
+
+              <el-form-item label="目标数据描述">
+                <el-input
+                  v-model="ruleForm.dataDescribe"
+                  size="small"
+                  type="textarea"
+                  :rows="2"
+                  placeholder="请输入描述"
+                />
+              </el-form-item>
+            </el-form>
+          </div>
+          <div class="foot center t30">
+            <el-button
+              size="medium"
+              type="primary"
+              class="r25 r26"
+              @click="submitClickHandler()"
+              >提交</el-button
+            >
+            <el-button size="medium" class="r26" @click="resetForm('ruleForm')"
+              >取消</el-button
+            >
+          </div>
+        </div>
+      </Dialog>
       <!--删除弹框-->
       <Dialog :flag="removeDialogVisible">
         <div class="airportInfoDialog">
@@ -55,7 +119,7 @@
 
 <script>
 import Dialog from "@/layout/components/Dialog/index.vue";
-import { Query  } from '@/api/dataIntegration';
+import { Query ,GeneralDataReception } from '@/api/dataIntegration';
 
 export default {
   name: "ProtocolHome",
@@ -65,6 +129,31 @@ export default {
       dataList: [],
       removeDialogVisible: false,
       rmObj: {},
+      editDialogVisible:false,
+      editDialogTitle:"目标数据新增",
+      ruleForm: {
+        // 信息表单
+        tdataName: "",
+        dataDescribe: "",
+        eventID: "",
+        datatype: "",
+      },
+      rules: {
+        // 机器信息表单验证
+        tdataName: [
+          { required: true, message: "请输入目标数据名称", trigger: "blur" },
+        ],
+        eventID: [
+          {
+            required: true,
+            message: "请输入目标数据事件标识",
+            trigger: "blur",
+          },
+        ],
+        datatype: [
+          { required: true, message: "请选择数据类型", trigger: "blur" },
+        ],
+      },
     };
   },
   created () {
@@ -88,22 +177,69 @@ export default {
     },
     // 新增-跳转
     showAddDialog () {
-      this.$router.push('/systemSettings/sourceDataItemEdit')
+      this.editDialogTitle = "新增源数据";
+      this.editDialogVisible = true;
     },
     // 编辑-跳转
     showEditDialog (item) {
       this.$router.push('/systemSettings/sourceDataItemEdit')
     },
+    // 新增/编辑-确认
+    submitClickHandler() {
+      this.$refs["ruleForm"].validate((valid) => {
+        if (valid) {
+          this.addSubmit();
+          this.resetForm("ruleForm");
+        }
+      });
+    },
+    async addSubmit() {
+      this.ruleForm["operate"] = "1";
+      try {
+        const res = await GeneralDataReception({
+          serviceId: "7",
+          dataContent: JSON.stringify(this.ruleForm),
+        });
+        if (res.code === "0") {
+          this.$message.success(res.message ?? "成功");
+          this.getList()
+        } else {
+          this.$message.error(res.message ?? "失败");
+        }
+      } catch (error) {
+        console.log("错误", error);
+      }
+    },
     // 删除-弹框
     showRemoveDialog (item) {
       this.rmObj = item;
       this.removeDialogVisible = true;
     },
     // 确认删除
-    removeSubmit () {
-      this.removeDialogVisible = false;
-      this.$message.success("删除成功");
-    }
+    async removeSubmit () {
+      this.rmObj["operate"] = "3";
+      try {
+        const res = await GeneralDataReception({
+          serviceId: "4",
+          dataContent:  JSON.stringify(this.rmObj),
+        });
+        if (res.code === "0") {
+          this.removeDialogVisible = false;
+          this.$message.success("删除成功");
+          this.getList()
+        } else {
+          this.$message.error(res.message ?? "失败");
+        }
+      } catch (error) {
+        console.log("错误", error);
+      }
+    },
+    // 重置
+    resetForm(formName) {
+      this.ruleForm = {}
+      this.$refs[formName].resetFields();
+      this.editDialogVisible = false;
+    },
   },
 };
 </script>

+ 17 - 3
src/views/systemSettings/views/targetDataManagement/targetDataHome.vue

@@ -245,9 +245,23 @@ export default {
       this.removeDialogVisible = true;
     },
     // 确认删除
-    removeSubmit() {
-      this.removeDialogVisible = false;
-      this.$message.success("删除成功");
+   async removeSubmit() {
+      this.rmObj["operate"] = "3";
+      try {
+        const res = await GeneralDataReception({
+          serviceId: "7",
+          dataContent:  JSON.stringify(this.rmObj),
+        });
+        if (res.code === "0") {
+          this.removeDialogVisible = false;
+          this.$message.success("删除成功");
+          this.getList()
+        } else {
+          this.$message.error(res.message ?? "失败");
+        }
+      } catch (error) {
+        console.log("错误", error);
+      }
     },
     // 重置
     resetForm(formName) {