Эх сурвалжийг харах

Merge branch 'master' of http://120.26.64.82:3000/BFFE/CABaggageData2.0

zhongxiaoyu 2 жил өмнө
parent
commit
2634d91810

+ 3 - 0
src/views/BasicsData/views/airport/airportInfo.vue

@@ -599,6 +599,9 @@ export default {
     background: url("../../../../assets/index/ic_close_hint.png") no-repeat;
     background-size: 100% 100%;
   }
+  ::v-deep .el-tree-node__children {
+    display: block;
+  }
   ::v-deep .el-form-item {
     margin-bottom: 20px;
   }

+ 282 - 298
src/views/systemSettings/views/sourceDataItemManagement/sourceDataItemEdit.vue

@@ -20,60 +20,62 @@
           class="demo-ruleForm"
           label-width="140px"
         >
-          <el-form-item label="源数据名称" prop="name">
+          <el-form-item label="源数据名称" prop="dataName">
             <el-input
               size="small"
               maxlength="128"
               placeholder="请输入源数据名称"
-              v-model="ruleForm.name"
+              v-model="ruleForm.dataName"
             ></el-input>
           </el-form-item>
-          <el-form-item label="数据格式" prop="tag">
+          <el-form-item label="数据格式" prop="dataType">
             <el-select
               size="small"
               style="width: 100%"
-              v-model="ruleForm.tag"
-              placeholder="请选择数据格式"
+              v-model="ruleForm.dataType"
+              placeholder="请选择数据类型"
             >
-              <el-option label="Mysql_local" value="1"></el-option>
+              <el-option label="JSON" value="1"></el-option>
+              <el-option label="XML" value="2"></el-option>
+              <el-option label=" REGULA" value="3"></el-option>
             </el-select>
           </el-form-item>
-          <el-form-item label="目标数据描述" prop="code">
+          <el-form-item label="目标数据描述">
               <el-input
                 maxlength="128"
                 placeholder="请输入描述"
                 type="textarea"
                 :rows="1"
-                v-model="ruleForm.code"
+                v-model="ruleForm.dataDescribe"
                 style="width: 575px"
               ></el-input>
             </el-form-item>
-
           <el-row>
-            <el-form-item label="取值方法" prop="fullName">
-              <el-col :span="12">
-                <el-input
-              size="small"
-              maxlength="128"
-              placeholder="请输入取值方法"
-              v-model="ruleForm.fullName"
-              style="width: 575px"
-            ></el-input>
-              </el-col>
-
-          </el-form-item>
-          <el-form-item label="检测方法" prop="fullName">
-              <el-col :span="12">
-                <el-input
-              size="small"
-              maxlength="128"
-              placeholder="请输入检测方法"
-              v-model="ruleForm.fullName"
-              style="width: 575px"
-            ></el-input>
-              </el-col>
+            <el-col :span="10.5">
+            <el-form-item label="取值方法">
+              <el-input
+                maxlength="128"
+                placeholder="请输入取值方法"
+                type="textarea"
+                :rows="1"
+                v-model="ruleForm.computingMethod"
+                style="width: 575px"
+              ></el-input>
+            </el-form-item>
+            </el-col>
+            <el-col :span="10.5">
 
-          </el-form-item>
+            <el-form-item label="检测方法">
+              <el-input
+                maxlength="128"
+                placeholder="请输入检测方法"
+                type="textarea"
+                :rows="1"
+                v-model="ruleForm.validationExpression"
+                style="width: 575px"
+              ></el-input>
+            </el-form-item>
+            </el-col>
           </el-row>
         </el-form>
       </div>
@@ -92,49 +94,49 @@
       <div class="table-info">
         <el-table
           :data="posArr"
-          row-key="id"
+          row-key="ItemID"
           :row-class-name="tabRowClassName"
           height="56vh"
           :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
           class="table"
           style="width: 100%"
-          :header-cell-style="{ 'text-align': 'center' }"
-          :cell-style="{ 'text-align': 'center' }"
+          :header-cell-style="{ 'text-align': 'left' }"
+          :cell-style="{ 'text-align': 'left' }"
         >
-          <el-table-column prop="itemName" label="数据项名称"></el-table-column>
-          <el-table-column prop="itemCode" label="源数据编号"></el-table-column>
+          <el-table-column prop="ItemName" label="数据项名称"></el-table-column>
+          <!-- <el-table-column prop="itemCode" label="数据项标识"></el-table-column> -->
           <el-table-column
-            prop="dataTypeName"
+            prop="dataTypeText"
             label="数据类型"
           ></el-table-column>
           <el-table-column
-            prop="canNullName"
+            prop="ItemDescribe"
             label="数据项描述"
           ></el-table-column>
           <el-table-column
-            prop="isOnlyMarkName"
+            prop="computingMethod"
             label="取值方法"
           ></el-table-column>
           <el-table-column
-            prop="analysisDataItemName"
+            prop="computingExpression"
             label="取值表达式"
           ></el-table-column>
           <el-table-column
-            prop="analysisDataItemName"
+            prop="outputIdentifier"
             label="输出标识符"
           ></el-table-column>
           <el-table-column
-            prop="analysisDataItemName"
-            label="多条拆分"
-          ></el-table-column>
-          <el-table-column
-            prop="analysisDataItemName"
+            prop="isMustText"
             label="是否必填"
           ></el-table-column>
           <el-table-column
-            prop="analysisDataItemName"
+            prop="isKeyText"
             label="是否唯一"
           ></el-table-column>
+          <el-table-column
+            prop="isSpliteText"
+            label="多条拆分"
+          ></el-table-column>
           <el-table-column label="操作">
             <div
               slot-scope="scope"
@@ -149,7 +151,7 @@
               <el-button
                 class="fut"
                 size="small"
-                @click="handleEdit(scope.$index, scope.row)"
+                @click="handleAdd(scope.$index, scope.row)"
                 >新增</el-button
               >
               <el-button
@@ -189,36 +191,51 @@
       </div>
     </Dialog>
     <!--新增/编辑存储数据项弹框-->
-    <Dialog width="750px" customClass="dataStoreInfoDialog" :flag="addFlag">
+    <Dialog width="748px" customClass="dataStoreInfoDialog" :flag="addFlag">
       <div class="dialog-public-background">
         <div class="flx">
-          {{ msgType === 1 ? "新增" : "编辑" }}新增数据项信息
+          {{ msgType === 1 ? "新增" : "编辑" }}数据项信息
         </div>
         <div class="contenter">
           <el-form
             :model="dataForm"
             :rules="dataRules"
             ref="dataForm"
-            label-width="100px"
+            label-width="130px"
             class="demo-dataForm"
           >
-            <el-row :gutter="8">
+            <el-row :gutter="24">
+              <el-col :span="12">
+                <el-form-item class="flex1" label="所属数据项" prop="parentID">
+                  <el-cascader
+                    size="small"
+                    style="width: 100%"
+                    placeholder="请选择所属数据项"
+                    v-model="dataForm.parentIDs"
+                    :options="posArr"
+                    ref="cascader"
+                    :props="{ label: 'ItemName', value: 'ItemID',checkStrictly: true  }"
+                    @change="handleChange"
+                    >
+                  </el-cascader>
+                </el-form-item>
+              </el-col>
               <el-col :span="12">
-                <el-form-item label="数据项名称" prop="name">
+                <el-form-item class="flex1" label="数据项名称" prop="ItemName">
                   <el-input
                     maxlength="128"
                     size="small"
                     placeholder="请输入数据项名称"
-                    v-model="dataForm.name"
+                    v-model="dataForm.ItemName"
                   ></el-input>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
-                <el-form-item label="数据类型" prop="tag">
+                <el-form-item class="flex1" label="数据类型" prop="dataType">
                   <el-select
                     size="small"
                     style="width: 100%"
-                    v-model="dataForm.tag"
+                    v-model="dataForm.dataType"
                     placeholder="请选择数据类型"
                   >
                     <el-option
@@ -231,83 +248,79 @@
                   </el-select>
                 </el-form-item>
               </el-col>
-            </el-row>
-            <el-row :gutter="8">
               <el-col :span="12">
-                <el-form-item label="取值方法" prop="tag">
-                  <el-select
+                <el-form-item
+                  class="flex1"
+                  label="输出标识符"
+                  prop="outputIdentifier"
+                >
+                  <el-input
+                    maxlength="128"
                     size="small"
-                    style="width: 100%"
-                    v-model="dataForm.tag"
-                    placeholder="请选择取值方法"
-                  >
-                    <el-option
-                      v-for="item in optiondata"
-                      :key="item.id"
-                      :label="item.name"
-                      :value="item.id"
-                    >
-                    </el-option>
-                  </el-select>
+                    placeholder="请输入输出标识符"
+                    v-model="dataForm.outputIdentifier"
+                  ></el-input>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
-                <el-form-item label="输出标识符" prop="name">
+                <el-form-item
+                  class="flex1"
+                  label="取值方法"
+                  prop="computingMethod"
+                >
                   <el-input
                     maxlength="128"
                     size="small"
-                    placeholder="输出标识符"
-                    v-model="dataForm.name"
+                    placeholder="请输入取值方法"
+                    v-model="dataForm.computingMethod"
                   ></el-input>
                 </el-form-item>
               </el-col>
             </el-row>
-            <el-row :gutter="8">
+            <el-row :gutter="24">
               <el-col :span="24">
-                <el-form-item
-                  label="取值表达式"
-                  prop="priority"
-                >
+                <el-form-item label="取值表达式">
                   <el-input
+                    v-model="dataForm.computingExpression"
+                    size="medium"
                     type="textarea"
-                    placeholder="取值表达式"
-                    v-model="dataForm.priority"
-                    style="width: 104%"
-                  ></el-input>
+                    :rows="2"
+                    placeholder="请输入取值表达式"
+                  />
                 </el-form-item>
               </el-col>
               <el-col :span="24">
                 <el-form-item label="数据项描述">
                   <el-input
-                    v-model="dataForm.uninq"
-                    size="small"
-                    placeholder="请输入描述"
-                    style="width: 104%"
+                    v-model="dataForm.ItemDescribe"
+                    size="medium"
+                    type="textarea"
+                    :rows="2"
+                    placeholder="请输入数据项描述"
                   />
                 </el-form-item>
               </el-col>
             </el-row>
-            <el-row :gutter="8">
+            <el-row :gutter="24">
               <el-col :span="12">
-                <el-form-item class="flexer" label="多条拆分">
-                  <el-radio v-model="dataForm.isnull" label="1">是</el-radio>
-                  <el-radio v-model="dataForm.isnull" label="0">否</el-radio>
+                <el-form-item class="flexer" label="允许空值">
+                  <el-radio v-model="dataForm.isMust" label="1">是</el-radio>
+                  <el-radio v-model="dataForm.isMust" label="0">否</el-radio>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
-                <el-form-item class="flexer" label="是否必填">
-                  <el-radio v-model="dataForm.uninq" label="1">是</el-radio>
-                  <el-radio v-model="dataForm.uninq" label="0">否</el-radio>
+                <el-form-item class="flexer" label="唯一项标志">
+                  <el-radio v-model="dataForm.isKey" label="1">是</el-radio>
+                  <el-radio v-model="dataForm.isKey" label="0">否</el-radio>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
-                <el-form-item class="flexer" label="是否唯一">
-                  <el-radio v-model="dataForm.uninq" label="1">是</el-radio>
-                  <el-radio v-model="dataForm.uninq" label="0">否</el-radio>
+                <el-form-item class="flexer" label="多条拆分">
+                  <el-radio v-model="dataForm.isSplite" label="1">是</el-radio>
+                  <el-radio v-model="dataForm.isSplite" label="0">否</el-radio>
                 </el-form-item>
               </el-col>
             </el-row>
-
           </el-form>
         </div>
         <div class="foot center" style="padding-right: 35px">
@@ -330,15 +343,7 @@
 <script>
 import Search from "@/layout/components/Search/index.vue";
 import Dialog from "@/layout/components/Dialog/index.vue";
-import {
-  Datastorage,
-  Datastoragemod,
-  storageList,
-  analysisList,
-  anaListmod,
-  storageListadd,
-  storageListdel,
-} from "@/api/acquisition";
+import { Query, GeneralDataReception } from "@/api/dataIntegration";
 import { translateDataToTreeAll, findarrays } from "@/utils/validate";
 export default {
   name: "dataStoreInfo",
@@ -347,18 +352,26 @@ export default {
     return {
       ruleForm: {
         //基本信息表单
-        name: "",
-        fullName: "",
-        code: "",
-        tag: "",
+        tdataName: "",
+        eventID: "",
+        datatype: "",
+        dataDescribe: "",
       },
       rules: {
         //基本信息验证
-        name: [{ required: true, message: "请输入存储名称", trigger: "blur" }],
-        fullName: [
-          { required: true, message: "请输入存储标识", trigger: "blur" },
+        tdataName: [
+          { required: true, message: "请输入目标数据名", trigger: "blur" },
+        ],
+        eventID: [
+          {
+            required: true,
+            message: "请输入目标数据事件标识",
+            trigger: "blur",
+          },
+        ],
+        datatype: [
+          { required: true, message: "请选择数据类型", trigger: "change" },
         ],
-        tag: [{ required: true, message: "请选择存储方式", trigger: "change" }],
       },
       posArr: [], //存储数据项数据
       posArrCopy: [], //临时存放数据
@@ -366,28 +379,16 @@ export default {
       rmIndex: null, //选中的表格序号
       flag: false, //删除弹框
       msgType: 1, //新增or编辑
-      dataForm: {
-        //数据项表单
-        id: "",
-        name: "",
-        demo: "",
-        code: "",
-        tag: "",
-        uninq: "1",
-        isnull: "1",
-        form: "",
-        datas: "",
-        priority: "",
-        analysisDataItemSourceId: "",
-      },
+      dataForm: {},
       dataRules: {
         //数据项表单验证
-        name: [{ required: true, message: "请输入存储名称", trigger: "blur" }],
-        code: [{ required: true, message: "请输入存储标识", trigger: "blur" }],
-        tag: [{ required: true, message: "请选择存储方式", trigger: "change" }],
-        priority: [
-          { required: true, message: "请选取值优先级", trigger: "change" },
+        ItemName: [
+          { required: true, message: "请输入数据项名称", trigger: "blur" },
         ],
+        code: [
+          { required: true, message: "请输入数据来源表达式", trigger: "blur" },
+        ],
+        dataType: [{ required: true, message: "请选数据类型", trigger: "change" }],
       },
       addFlag: false, //数据项弹框,
       dataStoreid: "", //修改id,
@@ -413,7 +414,6 @@ export default {
         },
       ],
       sourceList: [], //取值来源
-      sourceider: "", //取值来源id
       tableData: [],
       deleID: "", //删除id
     };
@@ -421,14 +421,8 @@ export default {
   created() {
     const { id } = this.$route.query;
     this.dataStoreid = id;
-    this.AcquisitionList();
-    this.DatastorageList();
     this.storagedetails();
-  },
-  watch: {
-    sourceider() {
-      this.Dataitem();
-    },
+    this.getDataList();
   },
   methods: {
     tabRowClassName({ row, rowIndex }) {
@@ -441,91 +435,107 @@ export default {
         }
       }
     },
-    //数据采集列表-取值来源
-    async AcquisitionList() {
-      const result = await analysisList();
-      if (result.code == 0) {
-        this.sourceList = result.returnData;
-      }
-    },
     //数据项信息
-    async Dataitem() {
+    // async Dataitem() {
+    //   let params = {
+    //     sourceId: this.sourceider,
+    //   };
+    //   const result = await anaListmod(params);
+    //   if (result.code == 0) {
+    //     this.sourceList = result.returnData;
+    //     this.tableData = result.returnData;
+    //   }
+    // },
+    //详情查询
+    async storagedetails() {
       let params = {
-        sourceId: this.sourceider,
+        id: 18,
+        dataContent: [this.dataStoreid],
       };
-      const result = await anaListmod(params);
+      const result = await Query(params);
       if (result.code == 0) {
-        this.tableData = result.returnData;
+        result.returnData.forEach((element) => {
+          element.dataType = element.dataType + "";
+        });
+        this.ruleForm = result.returnData[0];
+      } else {
+        this.$message.error(res.message ?? "失败");
       }
     },
-    //详情查询
-    async storagedetails() {
+
+    //保存
+    async storagemod() {
+      this.ruleForm["operate"] = "2";
+      try {
+        const res = await GeneralDataReception({
+          serviceId: "4",
+          dataContent: JSON.stringify(this.ruleForm),
+        });
+        if (res.code === "0") {
+          this.$message.success(res.message ?? "成功");
+        } else {
+          this.$message.error(res.message ?? "失败");
+        }
+      } catch (error) {
+        console.log("错误", error);
+      }
+    },
+    async getDataList() {
       let params = {
-        targetId: this.dataStoreid,
+        id: 16,
+        dataContent: [this.dataStoreid],
       };
-      const result = await storageList(params);
+      const result = await Query(params);
       if (result.code == 0) {
-        result.returnData.forEach((element) => {
-          if (element.dataType == "1") {
-            element.dataTypeName = "字符";
-          } else if (element.dataType == "2") {
-            element.dataTypeName = "数字";
-          } else if (element.dataType == "3") {
-            element.dataTypeName = "日期";
-          } else {
-            element.dataTypeName = "时间";
+        console.log(result);
+        result.returnData.forEach(item =>{
+          if(item.dataType==1){
+            item['dataTypeText'] = "字符串"
           }
-          if (element.canNull == true) {
-            element.canNullName = "是";
-          } else {
-            element.canNullName = "否";
+          else if(item.dataType==2){
+            item['dataTypeText'] = "数字"
           }
-          if (element.isOnlyMark == true) {
-            element.isOnlyMarkName = "是";
-          } else {
-            element.isOnlyMarkName = "否";
+          else if(item.dataType==3){
+            item['dataTypeText'] = "时间"
           }
-        });
+          else if(item.dataType==4){
+            item['dataTypeText'] = "日期"
+          }
+          else{
+            item['dataTypeText'] = "其他"
+          }
+          if(item.isKey==1){
+            item['isKeyText'] = "是"
+          }
+          else{
+            item['isKeyText'] = "否"
+          }
+          if(item.isMust==1){
+            item['isMustText'] = "是"
+          }
+          else{
+            item['isMustText'] = "否"
+          }
+          if(item.isSplite==1){
+            item['isSpliteText'] = "是"
+          }
+          else{
+            item['isSpliteText'] = "否"
+          }
+        })
         this.posArr = translateDataToTreeAll(
           result.returnData,
-          "parentItemID",
-          "id"
+          "parentID",
+          "ItemID"
         );
         this.posArr.forEach((res, index) => {
           res.index = index + 1;
+          if(res.children.length<1){
+            delete res.children
+          }
         });
-        this.dataitem = result.returnData;
-      }
-    },
-    //保存
-    async storagemod() {
-      let params = {
-        id: this.dataStoreid,
-        targetName: this.ruleForm.name, //储存名称
-        targetCode: this.ruleForm.fullName, //储存标识
-        saveType: this.ruleForm.tag, //储存类型
-        saveInfo: this.ruleForm.code, //储存目标
-        status: this.analyList[0].status,
-      };
-      const result = await Datastoragemod(params);
-      if (result.code == 0) {
-        this.$message.success("成功");
-        this.$router.push("/dataStore");
       } else {
-        this.$message.error(result.message);
-      }
-    },
-    //数据存储列
-    async DatastorageList() {
-      const result = await Datastorage();
-      if (result.code == 0) {
-        this.analyList = result.returnData.filter(
-          (i) => i.id == this.dataStoreid
-        );
-        this.ruleForm.name = this.analyList[0].targetName; //储存名称
-        this.ruleForm.fullName = this.analyList[0].targetCode; //储存标识
-        this.ruleForm.tag = this.analyList[0].saveType; //储存类型
-        this.ruleForm.code = this.analyList[0].saveInfo; //储存目标
+        this.$message.error(res.message ?? "失败");
       }
     },
     //搜索
@@ -543,54 +553,31 @@ export default {
     clearSearchData() {
       this.posArr = this.posArrCopy;
     },
-    //编辑信息
-    handleEdit(index, row) {
-      this.rmObj = row;
-      this.rmIndex = index;
-      this.msgType = 2;
-      this.addFlag = true;
-      const {
-        id,
-        itemName,
-        itemCode,
-        dataType,
-        isOnlyMark,
-        canNull,
-        sourceDataAnalysisId,
-        dataLevel,
-        parentItemID,
-        analysisDataItemSourceId,
-      } = row;
-      this.dataForm.id = id;
-      this.dataForm.name = itemName;
-      this.dataForm.code = itemCode;
-      this.dataForm.tag = Number(dataType);
-      this.dataForm.uninq = isOnlyMark === true ? "1" : "0";
-      this.dataForm.isnull = canNull === true ? "1" : "0";
-      this.dataForm.datas = sourceDataAnalysisId;
-      this.dataForm.priority = dataLevel;
-      this.dataForm.demo = parentItemID == 0 ? null : parentItemID;
-      this.sourceider = analysisDataItemSourceId;
-    },
     //删除信息
     handleDelete(index, row) {
       this.rmObj = row;
       this.rmIndex = index;
       this.flag = true;
-      this.deleID = row.id;
+      this.deleID = row.ItemID;
     },
     //删除
     async remove() {
-      let params = {
-        id: this.deleID,
-      };
-      const result = await storageListdel(params);
-      if (result.code == 0) {
-        this.$message.success("成功");
-      } else {
-        this.$message.error(result.message);
+      this.rmObj["operate"] = "3";
+      try {
+        const res = await GeneralDataReception({
+          serviceId: "5",
+          dataContent:  JSON.stringify(this.rmObj),
+        });
+        if (res.code === "0") {
+          this.removeDialogVisible = false;
+          this.$message.success("删除成功");
+          this.getDataList()
+        } else {
+          this.$message.error(res.message ?? "失败");
+        }
+      } catch (error) {
+        console.log("错误", error);
       }
-      this.storagedetails();
       this.flag = false;
     },
     //新增数据项
@@ -598,67 +585,64 @@ export default {
       this.msgType = 1;
       this.addFlag = true;
     },
-    //存储数据项-提交
+    handleAdd(index,row){
+      this.msgType = 1;
+      this.addFlag = true;
+      this.dataForm.parentID = row.ItemID;
+      this.dataForm.parentIDs = [row.ItemID];
+    },
+    handleEdit(index,row){
+      this.msgType = 2;
+      this.addFlag = true;
+      this.dataForm = row;
+      this.dataForm.parentIDs = [row.parentID];
+      this.dataForm.isKey = this.dataForm.isKey+""
+      this.dataForm.isMust = this.dataForm.isMust+""
+      this.dataForm.isSplite = this.dataForm.isSplite+""
+    },
+    handleChange(data){
+      this.dataForm.parentID = data[data.length-1]
+    },
+    //数据项-提交
     async addSubmit(formName) {
       this.$refs[formName].validate((valid) => {
         if (valid) {
-          // this.$message.success("提交成功");
-          // this.resetForm(formName);
+          if(this.dataForm.ItemID){
+            this.dataForm["operate"] = "2";
+          }
+          else{
+            this.dataForm["operate"] = "1";
+          }
+          this.dataForm["sourceDataID"] = this.dataStoreid;
+          this.saveData();
         } else {
           console.log("error submit!!");
           return false;
         }
       });
-      if (this.msgType === 1) {
-        let params = {
-          id: "",
-          targetDataID: this.dataStoreid,
-          parentItemID: this.dataForm.demo ? this.dataForm.demo : 0, //所属数据项
-          itemName: this.dataForm.name, //名称
-          itemCode: this.dataForm.code, //标识
-          dataType: this.dataForm.tag, //数据类型
-          isOnlyMark: this.dataForm.uninq == 1 ? true : false, //唯一项标志
-          canNull: this.dataForm.isnull == 1 ? true : false, //允许空值
-          sourceDataAnalysisId: this.dataForm.datas, //取值来源
-          dataLevel: this.dataForm.priority, //取值优先级
-        };
-        const result = await storageListadd(params);
-        if (result.code == 0) {
-          this.storagedetails();
-          this.$message.success("成功");
-          this.resetForm(formName);
-          this.dataForm = this.$options.data().dataForm;
-          this.sourceider = null;
-        }
-      } else {
-        let params = {
-          id: this.dataForm.id,
-          targetDataID: this.dataStoreid,
-          parentItemID: this.dataForm.demo ? this.dataForm.demo : 0, //所属数据项
-          itemName: this.dataForm.name, //名称
-          itemCode: this.dataForm.code, //标识
-          dataType: this.dataForm.tag, //数据类型
-          isOnlyMark: this.dataForm.uninq == 1 ? true : false, //唯一项标志
-          canNull: this.dataForm.isnull == 1 ? true : false, //允许空值
-          sourceDataAnalysisId: this.dataForm.datas, //取值来源
-          dataLevel: this.dataForm.priority, //取值优先级
-        };
-        const result = await storageListadd(params);
-        if (result.code == 0) {
-          this.storagedetails();
-          this.$message.success("成功");
-          this.resetForm(formName);
-          this.dataForm = this.$options.data().dataForm;
-          this.sourceider = null;
-        }
-        this.resetForm(formName);
-      }
+    },
+    async saveData(){
+      try {
+            const res =  await GeneralDataReception({
+              serviceId: "5",
+              dataContent: JSON.stringify(this.dataForm),
+            });
+            if (res.code === "0") {
+              this.$message.success(res.message ?? "成功");
+              this.getDataList();
+              this.resetForm("dataForm");
+            } else {
+              this.$message.error(res.message ?? "失败");
+            }
+          } catch (error) {
+            console.log("错误", error);
+          }
+
     },
     //存储数据项-取消
     resetForm(formName) {
       this.addFlag = false;
-      this.dataForm = this.$options.data().dataForm;
-      this.sourceider = null;
+      this.dataForm = {};
       this.$refs[formName].resetFields();
     },
   },

+ 161 - 8
src/views/systemSettings/views/sourceDataItemManagement/sourceDataItemHome.vue

@@ -31,11 +31,84 @@
                 </div>
                 <i class="el-icon-close icon" @click="showRemoveDialog(item)" />
               </div>
-              <div class="disc">{{item.dataType}}</div>
+              <div class="disc">{{item.dataTypeText}}</div>
             </div>
           </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="100px"
+              class="demo-ruleForm"
+            >
+              <el-form-item label="源数据名称" prop="dataName">
+                <el-input
+                  v-model="ruleForm.dataName"
+                  size="small"
+                  placeholder="请输入源数据名称"
+                />
+              </el-form-item>
+              <el-form-item label="数据格式" prop="dataType">
+                <el-select
+                  v-model="ruleForm.dataType"
+                  size="small"
+                  placeholder="请选择数据格式"
+                >
+                  <el-option label="JSON" value="1"></el-option>
+                  <el-option label="XML" value="2"></el-option>
+                  <el-option label=" REGULA" value="3"></el-option>
+                </el-select>
+              </el-form-item>
+              <el-form-item label="取值方法">
+                <el-input
+                  v-model="ruleForm.computingMethod"
+                  size="small"
+                  type="textarea"
+                  :rows="2"
+                  placeholder="请输入取值方法"
+                />
+              </el-form-item>
+              <el-form-item label="检测方法">
+                <el-input
+                  v-model="ruleForm.validationExpression"
+                  size="small"
+                  type="textarea"
+                  :rows="2"
+                  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 +128,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 +138,25 @@ export default {
       dataList: [],
       removeDialogVisible: false,
       rmObj: {},
+      editDialogVisible:false,
+      editDialogTitle:"目标数据新增",
+      ruleForm: {
+        // 信息表单
+        dataName: "",
+        dataDescribe: "",
+        computingMethod: "",
+        validationExpression:"",
+        dataType: "",
+      },
+      rules: {
+        // 机器信息表单验证
+        dataName: [
+          { required: true, message: "请输入源数据名称", trigger: "blur" },
+        ],
+        dataType: [
+          { required: true, message: "请选择数据格式", trigger: "blur" },
+        ],
+      },
     };
   },
   created () {
@@ -78,6 +170,20 @@ export default {
           dataContent: []
         });
         if (res.code === "0") {
+          res.returnData.forEach(element => {
+            if(element.dataType==1){
+              element['dataTypeText'] = "JSON"
+            }
+            else if(element.dataType==2){
+              element['dataTypeText'] = "XML"
+            }
+            else if(element.dataType==3){
+              element['dataTypeText'] = "REGULA"
+            }
+            else{
+              element['dataTypeText'] = "其他"
+            }
+          });
             this.dataList = res.returnData
         } else {
           this.$message.error(res.message ?? "失败");
@@ -88,11 +194,38 @@ export default {
     },
     // 新增-跳转
     showAddDialog () {
-      this.$router.push('/systemSettings/sourceDataItemEdit')
+      this.editDialogTitle = "新增源数据";
+      this.editDialogVisible = true;
     },
     // 编辑-跳转
     showEditDialog (item) {
-      this.$router.push('/systemSettings/sourceDataItemEdit')
+      this.$router.push({path:'/systemSettings/sourceDataItemEdit',query:{id:item.sourceDataID}})
+    },
+    // 新增/编辑-确认
+    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: "4",
+          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) {
@@ -100,10 +233,30 @@ export default {
       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>

+ 232 - 231
src/views/systemSettings/views/targetDataManagement/targetDataEdit.vue

@@ -20,40 +20,43 @@
           class="demo-ruleForm"
           label-width="140px"
         >
-          <el-form-item label="目标数据名" prop="name">
+          <el-form-item label="目标数据名" prop="tdataName">
             <el-input
               size="small"
               maxlength="128"
               placeholder="请输入目标数据名"
-              v-model="ruleForm.name"
+              v-model="ruleForm.tdataName"
             ></el-input>
           </el-form-item>
-          <el-form-item label="数据类型" prop="tag">
+          <el-form-item label="数据类型" prop="datatype">
             <el-select
               size="small"
               style="width: 100%"
-              v-model="ruleForm.tag"
+              v-model="ruleForm.datatype"
               placeholder="请选择数据类型"
             >
-              <el-option label="Mysql_local" value="1"></el-option>
+              <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="fullName">
+          <el-form-item label="目标数据事件标识" prop="eventID">
             <el-input
               size="small"
               maxlength="128"
               placeholder="请输入目标数据事件标识"
-              v-model="ruleForm.fullName"
+              v-model="ruleForm.eventID"
             ></el-input>
           </el-form-item>
           <el-row>
-            <el-form-item label="目标数据描述" prop="code">
+            <el-form-item label="目标数据描述">
               <el-input
                 maxlength="128"
                 placeholder="请输入描述"
                 type="textarea"
                 :rows="1"
-                v-model="ruleForm.code"
+                v-model="ruleForm.dataDescribe"
                 style="width: 575px"
               ></el-input>
             </el-form-item>
@@ -75,37 +78,41 @@
       <div class="table-info">
         <el-table
           :data="posArr"
-          row-key="id"
+          row-key="ItemID"
           :row-class-name="tabRowClassName"
           height="56vh"
           :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
           class="table"
           style="width: 100%"
-          :header-cell-style="{ 'text-align': 'center' }"
-          :cell-style="{ 'text-align': 'center' }"
+          :header-cell-style="{ 'text-align': 'left' }"
+          :cell-style="{ 'text-align': 'left' }"
         >
-          <el-table-column prop="itemName" label="数据项名称"></el-table-column>
-          <el-table-column prop="itemCode" label="数据项标识"></el-table-column>
+          <el-table-column prop="ItemName" label="数据项名称"></el-table-column>
+          <!-- <el-table-column prop="itemCode" label="数据项标识"></el-table-column> -->
           <el-table-column
-            prop="dataTypeName"
+            prop="dataTypeText"
             label="数据类型"
           ></el-table-column>
           <el-table-column
-            prop="canNullName"
+            prop="ItemDescribe"
             label="数据项描述"
           ></el-table-column>
           <el-table-column
-            prop="isOnlyMarkName"
+            prop="computingExpression"
             label="数据来源表达式"
           ></el-table-column>
           <el-table-column
-            prop="analysisDataItemName"
+            prop="isMustText"
             label="是否必填"
           ></el-table-column>
           <el-table-column
-            prop="analysisDataItemName"
+            prop="isKeyText"
             label="是否唯一"
           ></el-table-column>
+          <el-table-column
+            prop="isSpliteText"
+            label="多条拆分"
+          ></el-table-column>
           <el-table-column label="操作">
             <div
               slot-scope="scope"
@@ -120,7 +127,7 @@
               <el-button
                 class="fut"
                 size="small"
-                @click="handleEdit(scope.$index, scope.row)"
+                @click="handleAdd(scope.$index, scope.row)"
                 >新增</el-button
               >
               <el-button
@@ -163,7 +170,7 @@
     <Dialog width="450px" customClass="dataStoreInfoDialog" :flag="addFlag">
       <div class="dialog-public-background">
         <div class="flx">
-          {{ msgType === 1 ? "新增" : "编辑" }}新增数据项信息
+          {{ msgType === 1 ? "新增" : "编辑" }}数据项信息
         </div>
         <div class="contenter">
           <el-form
@@ -175,23 +182,40 @@
           >
             <el-row :gutter="24">
               <el-col :span="24">
-                <el-form-item class="flex1" label="数据项名称" prop="name">
+                <el-form-item class="flex1" label="所属数据项" prop="parentID">
+                  <el-cascader
+                    size="small"
+                    style="width: 100%"
+                    placeholder="请选择所属数据项"
+                    v-model="dataForm.parentIDs"
+                    :options="posArr"
+                    ref="cascader"
+                    :props="{ label: 'ItemName', value: 'ItemID',checkStrictly: true  }"
+                    @change="handleChange"
+                    >
+                  </el-cascader>
+                </el-form-item>
+              </el-col>
+            </el-row>
+            <el-row :gutter="24">
+              <el-col :span="24">
+                <el-form-item class="flex1" label="数据项名称" prop="ItemName">
                   <el-input
                     maxlength="128"
                     size="small"
                     placeholder="请输入数据项名称"
-                    v-model="dataForm.name"
+                    v-model="dataForm.ItemName"
                   ></el-input>
                 </el-form-item>
               </el-col>
             </el-row>
             <el-row :gutter="24">
               <el-col :span="24">
-                <el-form-item class="flex1" label="数据类型" prop="tag">
+                <el-form-item class="flex1" label="数据类型" prop="dataType">
                   <el-select
                     size="small"
                     style="width: 100%"
-                    v-model="dataForm.tag"
+                    v-model="dataForm.dataType"
                     placeholder="请选择数据类型"
                   >
                     <el-option
@@ -210,13 +234,13 @@
                 <el-form-item
                   class="flex1"
                   label="数据来源表达式"
-                  prop="priority"
+                  prop="computingExpression"
                 >
                   <el-input
                     maxlength="128"
                     size="small"
                     placeholder="请输入数据来源表达式"
-                    v-model="dataForm.priority"
+                    v-model="dataForm.computingExpression"
                   ></el-input>
                 </el-form-item>
               </el-col>
@@ -224,14 +248,20 @@
             <el-row :gutter="24">
               <el-col :span="24">
                 <el-form-item class="flexer" label="允许空值">
-                  <el-radio v-model="dataForm.isnull" label="1">是</el-radio>
-                  <el-radio v-model="dataForm.isnull" label="0">否</el-radio>
+                  <el-radio v-model="dataForm.isMust" label="1">是</el-radio>
+                  <el-radio v-model="dataForm.isMust" label="0">否</el-radio>
                 </el-form-item>
               </el-col>
               <el-col :span="24">
                 <el-form-item class="flexer" label="唯一项标志">
-                  <el-radio v-model="dataForm.uninq" label="1">是</el-radio>
-                  <el-radio v-model="dataForm.uninq" label="0">否</el-radio>
+                  <el-radio v-model="dataForm.isKey" label="1">是</el-radio>
+                  <el-radio v-model="dataForm.isKey" label="0">否</el-radio>
+                </el-form-item>
+              </el-col>
+              <el-col :span="24">
+                <el-form-item class="flexer" label="多条拆分">
+                  <el-radio v-model="dataForm.isSplite" label="1">是</el-radio>
+                  <el-radio v-model="dataForm.isSplite" label="0">否</el-radio>
                 </el-form-item>
               </el-col>
             </el-row>
@@ -239,7 +269,7 @@
               <el-col :span="24">
                 <el-form-item label="数据项描述">
                   <el-input
-                    v-model="dataForm.uninq"
+                    v-model="dataForm.ItemDescribe"
                     size="medium"
                     type="textarea"
                     :rows="2"
@@ -270,15 +300,7 @@
 <script>
 import Search from "@/layout/components/Search/index.vue";
 import Dialog from "@/layout/components/Dialog/index.vue";
-import {
-  Datastorage,
-  Datastoragemod,
-  storageList,
-  analysisList,
-  anaListmod,
-  storageListadd,
-  storageListdel,
-} from "@/api/acquisition";
+import { Query, GeneralDataReception } from "@/api/dataIntegration";
 import { translateDataToTreeAll, findarrays } from "@/utils/validate";
 export default {
   name: "dataStoreInfo",
@@ -287,18 +309,26 @@ export default {
     return {
       ruleForm: {
         //基本信息表单
-        name: "",
-        fullName: "",
-        code: "",
-        tag: "",
+        tdataName: "",
+        eventID: "",
+        datatype: "",
+        dataDescribe: "",
       },
       rules: {
         //基本信息验证
-        name: [{ required: true, message: "请输入存储名称", trigger: "blur" }],
-        fullName: [
-          { required: true, message: "请输入存储标识", trigger: "blur" },
+        tdataName: [
+          { required: true, message: "请输入目标数据名", trigger: "blur" },
+        ],
+        eventID: [
+          {
+            required: true,
+            message: "请输入目标数据事件标识",
+            trigger: "blur",
+          },
+        ],
+        datatype: [
+          { required: true, message: "请选择数据类型", trigger: "change" },
         ],
-        tag: [{ required: true, message: "请选择存储方式", trigger: "change" }],
       },
       posArr: [], //存储数据项数据
       posArrCopy: [], //临时存放数据
@@ -306,28 +336,16 @@ export default {
       rmIndex: null, //选中的表格序号
       flag: false, //删除弹框
       msgType: 1, //新增or编辑
-      dataForm: {
-        //数据项表单
-        id: "",
-        name: "",
-        demo: "",
-        code: "",
-        tag: "",
-        uninq: "1",
-        isnull: "1",
-        form: "",
-        datas: "",
-        priority: "",
-        analysisDataItemSourceId: "",
-      },
+      dataForm: {},
       dataRules: {
         //数据项表单验证
-        name: [{ required: true, message: "请输入存储名称", trigger: "blur" }],
-        code: [{ required: true, message: "请输入存储标识", trigger: "blur" }],
-        tag: [{ required: true, message: "请选择存储方式", trigger: "change" }],
-        priority: [
-          { required: true, message: "请选取值优先级", trigger: "change" },
+        name: [
+          { required: true, message: "请输入数据项名称", trigger: "blur" },
+        ],
+        code: [
+          { required: true, message: "请输入数据来源表达式", trigger: "blur" },
         ],
+        tag: [{ required: true, message: "请选数据类型", trigger: "change" }],
       },
       addFlag: false, //数据项弹框,
       dataStoreid: "", //修改id,
@@ -353,7 +371,6 @@ export default {
         },
       ],
       sourceList: [], //取值来源
-      sourceider: "", //取值来源id
       tableData: [],
       deleID: "", //删除id
     };
@@ -361,14 +378,8 @@ export default {
   created() {
     const { id } = this.$route.query;
     this.dataStoreid = id;
-    this.AcquisitionList();
-    this.DatastorageList();
     this.storagedetails();
-  },
-  watch: {
-    sourceider() {
-      this.Dataitem();
-    },
+    this.getDataList();
   },
   methods: {
     tabRowClassName({ row, rowIndex }) {
@@ -381,91 +392,107 @@ export default {
         }
       }
     },
-    //数据采集列表-取值来源
-    async AcquisitionList() {
-      const result = await analysisList();
-      if (result.code == 0) {
-        this.sourceList = result.returnData;
-      }
-    },
     //数据项信息
-    async Dataitem() {
+    // async Dataitem() {
+    //   let params = {
+    //     sourceId: this.sourceider,
+    //   };
+    //   const result = await anaListmod(params);
+    //   if (result.code == 0) {
+    //     this.sourceList = result.returnData;
+    //     this.tableData = result.returnData;
+    //   }
+    // },
+    //详情查询
+    async storagedetails() {
       let params = {
-        sourceId: this.sourceider,
+        id: 17,
+        dataContent: [this.dataStoreid],
       };
-      const result = await anaListmod(params);
+      const result = await Query(params);
       if (result.code == 0) {
-        this.tableData = result.returnData;
+        result.returnData.forEach((element) => {
+          element.datatype = element.datatype + "";
+        });
+        this.ruleForm = result.returnData[0];
+      } else {
+        this.$message.error(res.message ?? "失败");
       }
     },
-    //详情查询
-    async storagedetails() {
+
+    //保存
+    async storagemod() {
+      this.ruleForm["operate"] = "2";
+      try {
+        const res = await GeneralDataReception({
+          serviceId: "7",
+          dataContent: JSON.stringify(this.ruleForm),
+        });
+        if (res.code === "0") {
+          this.$message.success(res.message ?? "成功");
+        } else {
+          this.$message.error(res.message ?? "失败");
+        }
+      } catch (error) {
+        console.log("错误", error);
+      }
+    },
+    async getDataList() {
       let params = {
-        targetId: this.dataStoreid,
+        id: 15,
+        dataContent: [this.dataStoreid],
       };
-      const result = await storageList(params);
+      const result = await Query(params);
       if (result.code == 0) {
-        result.returnData.forEach((element) => {
-          if (element.dataType == "1") {
-            element.dataTypeName = "字符";
-          } else if (element.dataType == "2") {
-            element.dataTypeName = "数字";
-          } else if (element.dataType == "3") {
-            element.dataTypeName = "日期";
-          } else {
-            element.dataTypeName = "时间";
+        console.log(result);
+        result.returnData.forEach(item =>{
+          if(item.dataType==1){
+            item['dataTypeText'] = "字符串"
           }
-          if (element.canNull == true) {
-            element.canNullName = "是";
-          } else {
-            element.canNullName = "否";
+          else if(item.dataType==2){
+            item['dataTypeText'] = "数字"
           }
-          if (element.isOnlyMark == true) {
-            element.isOnlyMarkName = "是";
-          } else {
-            element.isOnlyMarkName = "否";
+          else if(item.dataType==3){
+            item['dataTypeText'] = "时间"
           }
-        });
+          else if(item.dataType==4){
+            item['dataTypeText'] = "日期"
+          }
+          else{
+            item['dataTypeText'] = "其他"
+          }
+          if(item.isKey==1){
+            item['isKeyText'] = "是"
+          }
+          else{
+            item['isKeyText'] = "否"
+          }
+          if(item.isMust==1){
+            item['isMustText'] = "是"
+          }
+          else{
+            item['isMustText'] = "否"
+          }
+          if(item.isSplite==1){
+            item['isSpliteText'] = "是"
+          }
+          else{
+            item['isSpliteText'] = "否"
+          }
+        })
         this.posArr = translateDataToTreeAll(
           result.returnData,
-          "parentItemID",
-          "id"
+          "parentID",
+          "ItemID"
         );
         this.posArr.forEach((res, index) => {
           res.index = index + 1;
+          if(res.children.length<1){
+            delete res.children
+          }
         });
-        this.dataitem = result.returnData;
-      }
-    },
-    //保存
-    async storagemod() {
-      let params = {
-        id: this.dataStoreid,
-        targetName: this.ruleForm.name, //储存名称
-        targetCode: this.ruleForm.fullName, //储存标识
-        saveType: this.ruleForm.tag, //储存类型
-        saveInfo: this.ruleForm.code, //储存目标
-        status: this.analyList[0].status,
-      };
-      const result = await Datastoragemod(params);
-      if (result.code == 0) {
-        this.$message.success("成功");
-        this.$router.push("/dataStore");
       } else {
-        this.$message.error(result.message);
-      }
-    },
-    //数据存储列
-    async DatastorageList() {
-      const result = await Datastorage();
-      if (result.code == 0) {
-        this.analyList = result.returnData.filter(
-          (i) => i.id == this.dataStoreid
-        );
-        this.ruleForm.name = this.analyList[0].targetName; //储存名称
-        this.ruleForm.fullName = this.analyList[0].targetCode; //储存标识
-        this.ruleForm.tag = this.analyList[0].saveType; //储存类型
-        this.ruleForm.code = this.analyList[0].saveInfo; //储存目标
+        this.$message.error(res.message ?? "失败");
       }
     },
     //搜索
@@ -473,7 +500,7 @@ export default {
       let that = this;
       that.storagedetails().then(function (data) {
         if (val) {
-          that.posArr = findarrays(that.posArr, "itemName", val);
+          that.posArr = findarrays(that.posArr, "ItemName", val);
         } else {
           that.storagedetails();
         }
@@ -483,54 +510,31 @@ export default {
     clearSearchData() {
       this.posArr = this.posArrCopy;
     },
-    //编辑信息
-    handleEdit(index, row) {
-      this.rmObj = row;
-      this.rmIndex = index;
-      this.msgType = 2;
-      this.addFlag = true;
-      const {
-        id,
-        itemName,
-        itemCode,
-        dataType,
-        isOnlyMark,
-        canNull,
-        sourceDataAnalysisId,
-        dataLevel,
-        parentItemID,
-        analysisDataItemSourceId,
-      } = row;
-      this.dataForm.id = id;
-      this.dataForm.name = itemName;
-      this.dataForm.code = itemCode;
-      this.dataForm.tag = Number(dataType);
-      this.dataForm.uninq = isOnlyMark === true ? "1" : "0";
-      this.dataForm.isnull = canNull === true ? "1" : "0";
-      this.dataForm.datas = sourceDataAnalysisId;
-      this.dataForm.priority = dataLevel;
-      this.dataForm.demo = parentItemID == 0 ? null : parentItemID;
-      this.sourceider = analysisDataItemSourceId;
-    },
     //删除信息
     handleDelete(index, row) {
       this.rmObj = row;
       this.rmIndex = index;
       this.flag = true;
-      this.deleID = row.id;
+      this.deleID = row.ItemID;
     },
     //删除
     async remove() {
-      let params = {
-        id: this.deleID,
-      };
-      const result = await storageListdel(params);
-      if (result.code == 0) {
-        this.$message.success("成功");
-      } else {
-        this.$message.error(result.message);
+      this.rmObj["operate"] = "3";
+      try {
+        const res = await GeneralDataReception({
+          serviceId: "8",
+          dataContent:  JSON.stringify(this.rmObj),
+        });
+        if (res.code === "0") {
+          this.removeDialogVisible = false;
+          this.$message.success("删除成功");
+          this.getDataList()
+        } else {
+          this.$message.error(res.message ?? "失败");
+        }
+      } catch (error) {
+        console.log("错误", error);
       }
-      this.storagedetails();
       this.flag = false;
     },
     //新增数据项
@@ -538,67 +542,64 @@ export default {
       this.msgType = 1;
       this.addFlag = true;
     },
-    //存储数据项-提交
+    handleAdd(index,row){
+      this.msgType = 1;
+      this.addFlag = true;
+      this.dataForm.parentID = row.ItemID;
+      this.dataForm.parentIDs = [row.ItemID];
+    },
+    handleEdit(index,row){
+      this.msgType = 2;
+      this.addFlag = true;
+      this.dataForm = row;
+      this.dataForm.parentIDs = [row.parentID];
+      this.dataForm.isKey = this.dataForm.isKey+""
+      this.dataForm.isMust = this.dataForm.isMust+""
+      this.dataForm.isSplite = this.dataForm.isSplite+""
+    },
+    handleChange(data){
+      this.dataForm.parentID = data[data.length-1]
+    },
+    //数据项-提交
     async addSubmit(formName) {
       this.$refs[formName].validate((valid) => {
         if (valid) {
-          // this.$message.success("提交成功");
-          // this.resetForm(formName);
+          if(this.dataForm.ItemID){
+            this.dataForm["operate"] = "2";
+          }
+          else{
+            this.dataForm["operate"] = "1";
+          }
+          this.dataForm["targetdataID"] = this.dataStoreid;
+          this.saveData();
         } else {
           console.log("error submit!!");
           return false;
         }
       });
-      if (this.msgType === 1) {
-        let params = {
-          id: "",
-          targetDataID: this.dataStoreid,
-          parentItemID: this.dataForm.demo ? this.dataForm.demo : 0, //所属数据项
-          itemName: this.dataForm.name, //名称
-          itemCode: this.dataForm.code, //标识
-          dataType: this.dataForm.tag, //数据类型
-          isOnlyMark: this.dataForm.uninq == 1 ? true : false, //唯一项标志
-          canNull: this.dataForm.isnull == 1 ? true : false, //允许空值
-          sourceDataAnalysisId: this.dataForm.datas, //取值来源
-          dataLevel: this.dataForm.priority, //取值优先级
-        };
-        const result = await storageListadd(params);
-        if (result.code == 0) {
-          this.storagedetails();
-          this.$message.success("成功");
-          this.resetForm(formName);
-          this.dataForm = this.$options.data().dataForm;
-          this.sourceider = null;
-        }
-      } else {
-        let params = {
-          id: this.dataForm.id,
-          targetDataID: this.dataStoreid,
-          parentItemID: this.dataForm.demo ? this.dataForm.demo : 0, //所属数据项
-          itemName: this.dataForm.name, //名称
-          itemCode: this.dataForm.code, //标识
-          dataType: this.dataForm.tag, //数据类型
-          isOnlyMark: this.dataForm.uninq == 1 ? true : false, //唯一项标志
-          canNull: this.dataForm.isnull == 1 ? true : false, //允许空值
-          sourceDataAnalysisId: this.dataForm.datas, //取值来源
-          dataLevel: this.dataForm.priority, //取值优先级
-        };
-        const result = await storageListadd(params);
-        if (result.code == 0) {
-          this.storagedetails();
-          this.$message.success("成功");
-          this.resetForm(formName);
-          this.dataForm = this.$options.data().dataForm;
-          this.sourceider = null;
-        }
-        this.resetForm(formName);
-      }
+    },
+    async saveData(){
+      try {
+            const res =  await GeneralDataReception({
+              serviceId: "8",
+              dataContent: JSON.stringify(this.dataForm),
+            });
+            if (res.code === "0") {
+              this.$message.success(res.message ?? "成功");
+              this.getDataList();
+              this.resetForm("dataForm");
+            } else {
+              this.$message.error(res.message ?? "失败");
+            }
+          } catch (error) {
+            console.log("错误", error);
+          }
+
     },
     //存储数据项-取消
     resetForm(formName) {
       this.addFlag = false;
-      this.dataForm = this.$options.data().dataForm;
-      this.sourceider = null;
+      this.dataForm = {};
       this.$refs[formName].resetFields();
     },
   },

+ 19 - 5
src/views/systemSettings/views/targetDataManagement/targetDataHome.vue

@@ -210,8 +210,8 @@ export default {
       this.editDialogTitle = "新增目标数据";
       this.editDialogVisible = true;
     },
-    showEditDialog(){
-
+    showEditDialog(item){
+      this.$router.push({path:'/systemSettings/targetDataEdit',query:{id:item.targetdataID}})
     },
     // 新增/编辑-确认
     submitClickHandler() {
@@ -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) {