Bladeren bron

feat: 软件黑名单配置功能

chenhao 2 jaren geleden
bovenliggende
commit
7481ecd58e
2 gewijzigde bestanden met toevoegingen van 113 en 0 verwijderingen
  1. 6 0
      src/modules/basic/routes/routes.js
  2. 107 0
      src/modules/basic/view/black_list_app.vue

+ 6 - 0
src/modules/basic/routes/routes.js

@@ -20,6 +20,7 @@ import sys_notice from "../view/sys_notice";
 import sysLoginRuleList from "../view/sys_login_rule_list";
 import sysCryptoConfig from "../view/sys_crypto_config";
 import admin_operate from "../view/admin_operate";
+import BlackListApp from "../view/black_list_app";
 
 export default [
   {
@@ -130,6 +131,11 @@ export default [
         meta: { privilegeCodes: "sys_crypto_config" },
         component: sysCryptoConfig, //加密方案组合配置
       },
+      {
+        path: "black_list_app",
+        meta: { privilegeCodes: "black_list_app" },
+        component: BlackListApp, // 软件黑名单配置
+      },
     ],
   },
 ];

+ 107 - 0
src/modules/basic/view/black_list_app.vue

@@ -0,0 +1,107 @@
+<template>
+  <div v-loading="loading === 'fetch'" class="black-list-container">
+    <el-row style="margin-bottom: 20px">
+      <el-alert
+        title="软件黑名单配置"
+        type="warning"
+        show-icon
+        :closable="false"
+      >
+        注:编辑时以换行符分隔, 最好不要包含分号';'!
+        <el-button
+          class="el-alert__closebtn"
+          type="warning"
+          size="small"
+          round
+          plain
+          @click="onSave"
+        >
+          保存</el-button
+        >
+      </el-alert>
+    </el-row>
+    <el-row>
+      <el-col :span="8">
+        <h5>虚拟摄像头黑名单配置:</h5>
+        <el-input
+          v-model="vCamList"
+          type="textarea"
+          placeholder="虚拟摄像头黑名单配置"
+          :rows="20"
+        ></el-input>
+      </el-col>
+      <el-col :span="8" :offset="1">
+        <h5>远程桌面软件黑名单配置:</h5>
+        <el-input
+          v-model="remoteApp"
+          type="textarea"
+          placeholder="远程桌面软件黑名单配置"
+          :rows="20"
+        ></el-input>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+export default {
+  name: "BasicBlackListApp",
+  data() {
+    return {
+      /** loading  'fetch' | 'add' */
+      loading: null,
+      /** 虚拟摄像头配置 */
+      vCamList: "",
+      /** 远程桌面软件配置 */
+      remoteApp: "",
+    };
+  },
+  mounted() {
+    this.fetchConfig();
+  },
+  methods: {
+    /** click 保存 */
+    async onSave() {
+      this.handleSaveConfig().then(this.fetchConfig);
+    },
+    /** 保存黑名单APP配置 */
+    async handleSaveConfig() {
+      try {
+        this.loading = "add";
+        const params = new URLSearchParams();
+        params.append(
+          "blacklist",
+          JSON.stringify({
+            vCamList: this.vCamList,
+            remoteApp: this.remoteApp,
+          })
+        );
+        await this.$http.put("/api/ecs_core/systemProperty/blacklist", params, {
+          headers: {
+            "content-type": "application/x-www-form-urlencoded",
+          },
+        });
+      } catch (error) {
+        error.message && this.$message.warning(error.message);
+      } finally {
+        this.loading = null;
+      }
+    },
+    /** 查询黑名单APP配置 */
+    async fetchConfig() {
+      try {
+        this.loading = "fetch";
+        const { vCamList = "", remoteApp = "" } = await this.$http
+          .get("/api/ecs_core/systemProperty/blacklist")
+          .then((response) => response.data);
+        this.vCamList = vCamList;
+        this.remoteApp = remoteApp;
+      } catch (error) {
+        error.message && this.$message.warning(error.message);
+      } finally {
+        this.loading = null;
+      }
+    },
+  },
+};
+</script>