zhaoke 2 vuotta sitten
vanhempi
commit
16b5f964bd

+ 2 - 1
src/components/Table/index.vue

@@ -137,7 +137,7 @@
           </div>
         </div>
       </Dialog>
-      <Dialog :flag="rmFlag">
+      <Dialog :isBody="isBody" :flag="rmFlag">
         <div class="airportInfoDialog">
           <div class="title del-title">删除</div>
           <div class="content del-content">
@@ -291,6 +291,7 @@ export default {
       type: String,
       default: "180px",
     },
+    //弹框是否显示在body上
     isBody: {
       type: Boolean,
       default: false,

+ 69 - 71
src/layout/components/Dialog/index.vue

@@ -105,82 +105,80 @@ export default {
 </script>
 
 <style lang="scss" scoped>
-.dialog {
-  ::v-deep .el-dialog {
-    border-radius: 2px;
-    background: #ffffff;
-    box-shadow: 0px 6px 10px 0px rgba(0, 0, 0, 0.3);
-    position: absolute;
-    left: 50%;
-    top: 50%;
-    transform: translate(-50%, -50%);
-    .el-dialog__header {
-      display: none;
+::v-deep .el-dialog {
+  border-radius: 2px;
+  background: #ffffff;
+  box-shadow: 0px 6px 10px 0px rgba(0, 0, 0, 0.3);
+  position: absolute;
+  left: 50%;
+  top: 50%;
+  transform: translate(-50%, -50%);
+  .el-dialog__header {
+    display: none;
+  }
+  .el-dialog__body {
+    padding: 0;
+    .title {
+      padding: 10px 0px 10px 20px;
+      font-size: 16px;
+      font-family: Microsoft YaHei;
+      font-weight: bold;
+      height: 36px;
+      background: #2d67e3;
+      color: #ffffff;
+      margin-bottom: 24px;
+      width: 100%;
     }
-    .el-dialog__body {
-      padding: 0;
-      .title {
-        padding: 10px 0px 10px 20px;
-        font-size: 16px;
-        font-family: Microsoft YaHei;
-        font-weight: bold;
-        height: 36px;
-        background: #2d67e3;
-        color: #ffffff;
-        margin-bottom: 24px;
-        width: 100%;
-      }
-      .del-title,
-      .Deltitle {
-        padding: 10px 0px 10px 20px;
-        font-size: 16px;
-        font-family: Microsoft YaHei;
-        font-weight: bold;
-        height: 36px;
-        background: #eb2f3b;
-        color: #ffffff;
-        display: flex;
-        align-items: center;
-        margin-bottom: 36px;
-        width: 100%;
-      }
-      .Delfoot {
-        background-color: #fff;
-      }
-      .DelIcon {
-        width: 26px;
-        height: 26px;
-        background: #eb2f3b;
-        border-radius: 50%;
-        margin-right: 15px;
-        background: url("../../../assets/index/ic_close_hint.png") no-repeat;
-        background-size: 100% 100%;
-        display: inline-block;
-        position: relative;
-        top: 6px;
-      }
-      .DelTxt {
+    .del-title,
+    .Deltitle {
+      padding: 10px 0px 10px 20px;
+      font-size: 16px;
+      font-family: Microsoft YaHei;
+      font-weight: bold;
+      height: 36px;
+      background: #eb2f3b;
+      color: #ffffff;
+      display: flex;
+      align-items: center;
+      margin-bottom: 36px;
+      width: 100%;
+    }
+    .Delfoot {
+      background-color: #fff;
+    }
+    .DelIcon {
+      width: 26px;
+      height: 26px;
+      background: #eb2f3b;
+      border-radius: 50%;
+      margin-right: 15px;
+      background: url("../../../assets/index/ic_close_hint.png") no-repeat;
+      background-size: 100% 100%;
+      display: inline-block;
+      position: relative;
+      top: 6px;
+    }
+    .DelTxt {
+      color: #eb2f3b;
+      margin: 0 6px;
+    }
+    .del-content {
+      .error {
         color: #eb2f3b;
-        margin: 0 6px;
-      }
-      .del-content {
-        .error {
-          color: #eb2f3b;
-        }
-      }
-      .dialog-content .el-form {
-        padding-right: 24px;
-      }
-      .el-form-item__label {
-        font-size: 14px;
-        font-family: Microsoft YaHei;
-        font-weight: 400;
-        color: #303133;
       }
     }
-    .el-button + .el-button {
-      margin-left: 0px;
+    .dialog-content .el-form {
+      padding-right: 24px;
+    }
+    .el-form-item__label {
+      font-size: 14px;
+      font-family: Microsoft YaHei;
+      font-weight: 400;
+      color: #303133;
     }
   }
+  .el-button + .el-button {
+    margin-left: 0px;
+  }
 }
 </style>

+ 55 - 57
src/views/systemSettings/views/serviceManagement/mixins/operate.js

@@ -7,129 +7,127 @@
  * have a nice day!
  */
 
-import { GeneralDataReception } from '@/api/dataIntegration'
+import { GeneralDataReception } from "@/api/dataIntegration";
 
 const operateMap = {
   create: 1,
   update: 2,
-  delete: 3
-}
+  delete: 3,
+};
 
 export default {
   methods: {
-    async updateService () {
+    async updateService() {
       const params = {
         serviceID: this.serviceID,
         ...this.serviceForm,
-        event: 2
-      }
+        event: 2,
+      };
       if (!params.serviceOutputID) {
-        params.serviceOutputID = null
+        params.serviceOutputID = null;
       }
       if (!params.dataSourceID) {
-        params.dataSourceID = null
+        params.dataSourceID = null;
       }
       try {
         const result = await GeneralDataReception({
           serviceId: SERVICE_ID.sysServiceAddId,
-          dataContent: JSON.stringify(params)
-        })
+          dataContent: JSON.stringify(params),
+        });
         if (Number(result.code) === 0) {
-          this.$message.success(result.message ?? '成功')
+          this.$message.success(result.message ?? "成功");
         } else {
-          this.$message.error(result.message ?? '失败')
+          this.$message.error(result.message ?? "失败");
         }
       } catch (error) {
-        console.log('出错了', error.message || error)
+        console.log("出错了", error.message || error);
       }
     },
-    async updateServiceNode (event, deployObject) {
+    async updateServiceNode(event, deployObject) {
       const params = {
         event,
-        serviceID: this.serviceID
-      }
+        serviceID: this.serviceID,
+      };
       if (event === 1) {
         Object.assign(params, {
-          deployNodeID: deployObject.deployNodeID
-        })
+          deployNodeID: deployObject.deployNodeID,
+        });
       } else {
         Object.assign(params, {
-          DeployID: deployObject.servicedeploynodeID
-        })
+          DeployID: deployObject.servicedeploynodeID,
+        });
       }
       try {
         const result = await GeneralDataReception({
           serviceId: SERVICE_ID.sysServiceEditBoxId,
-          dataContent: JSON.stringify(params)
-        })
+          dataContent: JSON.stringify(params),
+        });
         if (Number(result.code) === 0) {
-          return result.message
+          return result.message;
         } else {
-          return Promise.reject(result.message)
+          return Promise.reject(result.message);
         }
       } catch (error) {
-        console.log('出错了', error.message || error)
+        console.log("出错了", error.message || error);
       }
     },
-    async updateServiceSource (operate, sourceDataID) {
+    async updateServiceSource(operate, sourceDataID) {
       const params = {
         operate: operateMap[operate],
-        serviceID: this.serviceID
-      }
-      if (operate === 'create') {
-        params.sourceDataID = sourceDataID
+        serviceID: this.serviceID,
+      };
+      if (operate === "create") {
+        params.sourceDataID = sourceDataID;
       } else {
-        const { serviceInputSourceDataID } = this.serviceAndSourceList.find(
-          element => element.serviceID === this.serviceID && element.sourceDataID === sourceDataID
-        )
-        params.serviceInputSourceDataID = serviceInputSourceDataID
+        const { serviceInputSourceDataID } = this.serviceAndSourceList.find((element) => element.serviceID === this.serviceID && element.sourceDataID === sourceDataID);
+        params.serviceInputSourceDataID = serviceInputSourceDataID;
       }
       try {
         const result = await GeneralDataReception({
           serviceId: 6,
-          dataContent: JSON.stringify(params)
-        })
+          dataContent: JSON.stringify(params),
+        });
         if (Number(result.code) === 0) {
-          return result.message
+          return result.message;
         } else {
-          return Promise.reject(result.message)
+          return Promise.reject(result.message);
         }
       } catch (error) {
-        console.log('出错了', error.message || error)
+        console.log("出错了", error.message || error);
       }
     },
-    async updateServiceOutput (operate, outputTarget) {
-      const { dataOutputConfig, outputCondition, protocolID, serviceOutputID, targetdataID } = outputTarget
+    async updateServiceOutput(operate, outputTarget) {
+      const { dataOutputConfig, outputCondition, protocolID, serviceOutputID, targetdataID } = outputTarget;
       const params = {
-        operate: operateMap[operate]
-      }
-      if (operate !== 'create') {
+        operate: operateMap[operate],
+      };
+      if (operate !== "create") {
         Object.assign(params, {
-          serviceOutputID
-        })
+          serviceOutputID,
+        });
       }
-      if (operate !== 'delete') {
+      if (operate !== "delete") {
         Object.assign(params, {
           protocolID,
           dataOutputConfig,
           targetdataID,
           outputCondition,
-          serviceID: this.serviceID
-        })
+          serviceID: this.serviceID,
+        });
       }
       try {
         const result = await GeneralDataReception({
           serviceId: 9,
-          dataContent: JSON.stringify(params)
-        })
+          dataContent: JSON.stringify(params),
+        });
         if (Number(result.code) === 0) {
-          return result.message
+          return result.message;
         } else {
-          return Promise.reject(result.message)
+          return Promise.reject(result.message);
         }
       } catch (error) {
-        console.log('出错了', error.message || error)
+        console.log("出错了", error.message || error);
       }
-    }
-  }
-}
+    },
+  },
+};

+ 209 - 12
src/views/systemSettings/views/serviceManagement/serviceEdit - copy.vue → src/views/systemSettings/views/serviceManagement/serviceEdit1.vue

@@ -17,8 +17,9 @@
               <span class="s2">{{ serviceState }}</span>
             </div>
             <div class="manageBtns">
-              <el-button size="mini" @click="slotVisible = true" type="primary">1个插槽</el-button>
-              <el-button size="mini" class="btn-white" plain type="primary">查看日志</el-button>
+              <el-button size="mini" @click="slotVisible = true" type="primary">{{ slotValue }}个插槽</el-button>
+              <el-button size="mini" @click="handleLog" class="btn-white" plain type="primary">查看日志</el-button>
+              <el-button size="mini" @click="editSubmitHandler" type="primary">保存</el-button>
             </div>
           </div>
           <div class="content-list-box-body">
@@ -269,11 +270,84 @@
           />
         </div>
         <div class="foot mt24">
-          <el-button size="medium" type="primary" class="r25 r26">确定</el-button>
+          <el-button size="medium" @click="slotQd" type="primary" class="r25 r26">确定</el-button>
           <el-button size="medium" class="r26" @click="slotVisible = false">取消</el-button>
         </div>
       </div>
     </Dialog>
+    <Dialog :flag="logVisible" width="900px">
+      <div class="logDialog">
+        <div style="position: relative" class="title">
+          <span>查看日志</span>
+          <span @click="logVisible = false" class="el-icon-close logClose"></span>
+        </div>
+        <div class="interfaceLog">
+          <div class="interfaceLog_head flex">
+            <div class="interfaceLog_head_time flex-wrap">
+              <div class="interfaceLog_head_time_start">
+                <el-date-picker v-model="timeStart" value-format="yyyy-MM-dd HH:mm:ss" size="small" @change="timeStartChange" type="datetime" placeholder="选择开始日期时间" default-time="00:00:00">
+                </el-date-picker>
+              </div>
+              <div class="interfaceLog_head_time_end">
+                <el-date-picker v-model="timeEnd" value-format="yyyy-MM-dd HH:mm:ss" size="small" @change="timeEndChange" type="datetime" placeholder="选择结束日期时间" default-time="00:00:00">
+                </el-date-picker>
+              </div>
+            </div>
+            <div class="flex-wrap">
+              <el-input placeholder="请输入搜索关键词" size="small" v-model="input" clearable> </el-input>
+              <el-button size="mini" style="margin-left: 16px" @click="handleOk" type="primary">查询</el-button>
+            </div>
+          </div>
+          <div
+            v-loading="loading"
+            element-loading-text="拼命加载中"
+            stripe
+            element-loading-spinner="el-icon-loading"
+            element-loading-background="rgba(0, 0, 0, 0.8)"
+            class="interfaceLog_content flex-wrap"
+          >
+            <el-table :data="tableData" class="table" height="500px" border style="width: 100%; margin-top: 20px">
+              <el-table-column prop="logTime" width="200" label="时间"> </el-table-column>
+              <el-table-column prop="logType" width="100" label="类型"> </el-table-column>
+              <el-table-column width="200" label="位置">
+                <template slot-scope="scope">
+                  <el-tooltip class="item" effect="dark" :content="scope.row.logPositionID" placement="top">
+                    <div class="logPositionID">{{ scope.row.logPositionID }}</div>
+                  </el-tooltip>
+                </template>
+              </el-table-column>
+              <el-table-column width="100" prop="resultCode" label="成败"> </el-table-column>
+              <el-table-column label="详情">
+                <template slot-scope="scope">
+                  <div class="flex-wrap">
+                    <el-tooltip class="item" effect="dark" :content="scope.row.resultDetails" placement="top">
+                      <span :id="'logId' + scope.$index" class="logDetails">{{ scope.row.resultDetails }}</span>
+                    </el-tooltip>
+                    <el-button @click="logCopy(scope.$index)" style="margin-left: 10px" type="text">复制</el-button>
+                  </div>
+                </template>
+              </el-table-column>
+            </el-table>
+            <!-- <div class="interfaceLog_content_progress">
+              <el-timeline>
+                <el-timeline-item v-for="(item,index) in preDatas" :key="index">
+                  <div class="list">
+                    <div class="list_status"></div>
+                    <div class="list_title flex">
+                      <span class="l_title">{{item.title}}</span>
+                      <span v-if="item.status == 1" class="l_status l_success">成功</span>
+                      <span v-else class="l_status l_error">失败</span>
+                    </div>
+                    <div class="list_code">{{item.code}}</div>
+                    <div class="list_time">{{item.time}}</div>
+                  </div>
+                </el-timeline-item>
+              </el-timeline>
+            </div> -->
+          </div>
+        </div>
+      </div>
+    </Dialog>
   </div>
 </template>
 
@@ -281,10 +355,9 @@
 // import NoData from '@/components/nodata'
 import Dialog from "@/layout/components/Dialog";
 import DataTable from "@/components/Table";
-import { myQuery, GeneralDataReception } from "@/api/dataIntegration";
-
+import { myQuery, GeneralDataReception, Query } from "@/api/dataIntegration";
+import { parseTime } from "@/utils/index";
 import operate from "./mixins/operate";
-
 export default {
   components: {
     // NoData,
@@ -303,6 +376,7 @@ export default {
       serviceState: this.$route.query.runState,
       operateDialogType: null,
       delObj: {},
+      slotValue: 0,
       deleteDialogType: null,
       sourceFormVisible: false,
       slotVisible: false,
@@ -347,15 +421,31 @@ export default {
         connectConfig: "",
       },
       sourceDatas: [],
+      selDatas: [],
+      selObj: {},
+      selAll: [],
+      logVisible: false,
+      timeStart: parseTime(new Date(), "{y}-{m}-{d} 00:00:00"),
+      timeEnd: parseTime(new Date().getTime() + 24 * 60 * 60 * 1000, "{y}-{m}-{d} 00:00:00"),
+      tableData: [],
+      loading: false,
+      input: "",
     };
   },
+  created() {
+    this.slotVisible = true;
+    setTimeout(() => {
+      this.slotVisible = false;
+    }, 0);
+  },
   mounted() {
     this.queryServiceByID(this.serviceID);
     this.getDataSourceList(DATACONTENT_ID.sysSourceId);
   },
   methods: {
     selectionAll(arr) {
-      console.log(arr);
+      this.slotValue = arr.length;
+      this.selAll = _.cloneDeep(arr);
     },
     editSubmitHandler() {
       this.$refs["serviceForm"].validate((valid) => {
@@ -380,16 +470,88 @@ export default {
       this.getDataSourceList(DATACONTENT_ID.sysServiceXyId);
       this.sourceFormVisible = true;
     },
-    async machineSelectionChangeHandler(selection, row) {
-      const isSelected = selection.findIndex((item) => item.deployNodeID === row.deployNodeID) > -1;
-      const event = isSelected ? 1 : 3;
+    slotQd() {
+      const arr = this.selDatas;
+      const row = this.selObj;
+      const datas = this.selAll;
+      const res = [...datas, ...arr].filter((item) => !(datas.some((p) => item.deployNodeID == p.deployNodeID) && arr.some((c) => item.deployNodeID == c.deployNodeID)));
+      // const isSelected = selection.findIndex((item) => item.deployNodeID === row.deployNodeID) > -1;
+      const event = arr.length >= datas.length ? 1 : 3;
       try {
-        const message = await this.updateServiceNode(event, row);
-        this.$message.success(message ?? "操作成功");
+        res.forEach(async (item) => {
+          const message = await this.updateServiceNode(event, item);
+          this.$message.success(message ?? "操作成功");
+        });
       } catch (error) {
         this.$message.error(error);
         this.$refs["serviceMachineTable"].toggleRowSelection(row, !isSelected);
       }
+      this.slotVisible = false;
+      this.slotValue = arr.length;
+      this.selAll = _.cloneDeep(arr);
+    },
+    timeStartChange(val) {
+      if (val >= this.timeEnd) {
+        this.timeStart = "";
+        this.$message.error("开始时间不能大于结束时间,请重新选择");
+      }
+    },
+    timeEndChange(val) {
+      if (val <= this.timeEnd) {
+        this.timeEnd = "";
+        this.$message.error("结束时间不能小于开始时间,请重新选择");
+      }
+    },
+    handleLog() {
+      this.logVisible = true;
+      this.getQuery();
+    },
+    handleOk() {
+      this.getQuery();
+    },
+    async getQuery() {
+      try {
+        this.loading = true;
+        const { code, returnData } = await Query({
+          id: DATACONTENT_ID.sysServiceTopTableId,
+          dataContent: JSON.stringify([this.serviceID, this.timeStart, this.timeEnd]),
+        });
+        if (code == 0) {
+          const { listValues } = returnData;
+          this.tableData = listValues;
+          this.loading = false;
+        } else {
+          this.$message.error("网络错误");
+          this.loading = false;
+        }
+      } catch (error) {
+        this.loading = false;
+        console.log(error);
+      }
+    },
+    logCopy(index) {
+      const ele = document.getElementById("logId" + index);
+      const val = ele.innerText;
+      try {
+        const input = document.createElement("input");
+        //将input的值设置为需要复制的内容
+        input.value = val;
+        //添加input标签
+        document.body.appendChild(input);
+        //选中input标签
+        input.select();
+        //执行复制
+        document.execCommand("copy");
+        //移除input标签
+        document.body.removeChild(input);
+        this.$message.success("复制成功");
+      } catch (e) {
+        this.$message.error("复制失败");
+      }
+    },
+    machineSelectionChangeHandler(selection, row) {
+      this.selDatas = selection;
+      this.selObj = row;
     },
     async getDataSourceList(id) {
       const dataSourceList = await this.getSelectOption(id);
@@ -615,5 +777,40 @@ export default {
       margin-bottom: 0px;
     }
   }
+  .interfaceLog {
+    padding: 0 20px 20px 20px;
+  }
+  .interfaceLog_head_time_end {
+    margin-left: 16px;
+  }
+  .logClose {
+    font-size: 20px;
+    position: absolute;
+    right: 20px;
+    cursor: pointer;
+  }
+  .interfaceLog_content {
+    ::v-deep .table {
+      color: #101116;
+      thead {
+        color: #101116;
+      }
+      .success {
+        color: #33bf47;
+      }
+      .error {
+        color: #df4545;
+      }
+      .logPositionID,
+      .logDetails {
+        white-space: nowrap;
+        text-overflow: ellipsis;
+        overflow: hidden;
+      }
+      .logDetails {
+        max-width: 65%;
+      }
+    }
+  }
 }
 </style>