zhangjie преди 2 години
родител
ревизия
c6d1db7890

+ 35 - 10
src/assets/styles/home.scss

@@ -616,7 +616,7 @@
 // privilege-dialog
 .privilege-dialog {
   .el-dialog {
-    width: 1000px;
+    width: 800px;
   }
   .el-dialog__body {
     padding-top: 75px !important;
@@ -625,41 +625,66 @@
   }
 
   .privilege-group {
-    margin-bottom: 20px;
+    padding: 20px 0 10px;
+    border-bottom: 1px dashed $--color-text-gray-6;
+
     &-title {
       line-height: 1;
-      padding-bottom: 10px;
+      padding-bottom: 8px;
 
       .el-checkbox__label {
         font-weight: 600;
-        color: $--color-text-dark-1 !important;
+        color: #999 !important;
       }
     }
 
     .privilege-item {
-      display: inline-block;
       margin-bottom: 10px;
-      margin-right: 30px;
-      min-width: 80px;
 
-      &-scope {
-        display: block;
+      .el-checkbox__label {
+        color: $--color-text-dark-1 !important;
+      }
+
+      .cont-edit {
+        visibility: hidden;
+      }
+      &:hover {
+        .cont-edit {
+          visibility: visible;
+        }
       }
     }
   }
 
   .privilege-scope-edit {
+    padding-top: 10px;
+    color: $--color-text-gray-2;
+    margin-left: 14px;
     .scope-edit {
       &-label {
         display: block;
         width: 80px;
         text-align: right;
         float: left;
-        padding: 8px 0;
       }
       &-content {
         margin-left: 80px;
       }
     }
+    .cont-edit {
+      padding: 0;
+      color: $--color-primary-light;
+      border-radius: 0;
+      &:hover,
+      &:focus {
+        color: $--color-primary;
+      }
+    }
+    .el-tag {
+      margin-right: 5px;
+      margin-bottom: 5px;
+      color: $--color-text-dark;
+      // color: $--color-primary;
+    }
   }
 }

+ 1 - 0
src/constants/navs.js

@@ -24,6 +24,7 @@ export const navs = [
     parentId: "1",
     name: "应用管理",
     url: "AppManage",
+    privilege: "APP_VIEW",
   },
   {
     id: "5",

+ 45 - 7
src/constants/privilege.js

@@ -4,7 +4,7 @@ export const privilegeConfig = [
     options: [
       {
         permission: "USER_VIEW",
-        name: "用户管理",
+        name: "用户查看",
       },
       {
         permission: "USER_INSERT",
@@ -21,7 +21,7 @@ export const privilegeConfig = [
     options: [
       {
         permission: "WXAPP_VIEW",
-        name: "微信小程序管理",
+        name: "微信小程序查看",
       },
       {
         permission: "WXAPP_INSERT",
@@ -38,7 +38,7 @@ export const privilegeConfig = [
     options: [
       {
         permission: "ORG_VIEW",
-        name: "机构管理",
+        name: "机构查看",
       },
       {
         permission: "ORG_INSERT",
@@ -53,6 +53,10 @@ export const privilegeConfig = [
   {
     title: "应用",
     options: [
+      {
+        permission: "APP_VIEW",
+        name: "应用查看",
+      },
       {
         permission: "APP_INSERT",
         name: "应用新增",
@@ -66,6 +70,10 @@ export const privilegeConfig = [
   {
     title: "模块",
     options: [
+      {
+        permission: "MODULE_VIEW",
+        name: "模块查看",
+      },
       {
         permission: "MODULE_INSERT",
         name: "模块新增",
@@ -79,6 +87,10 @@ export const privilegeConfig = [
   {
     title: "环境",
     options: [
+      {
+        permission: "ENV_VIEW",
+        name: "环境查看",
+      },
       {
         permission: "ENV_INSERT",
         name: "环境新增",
@@ -92,6 +104,10 @@ export const privilegeConfig = [
   {
     title: "版本",
     options: [
+      {
+        permission: "VERSION_VIEW",
+        name: "版本查看",
+      },
       {
         permission: "VERSION_INSERT",
         name: "版本新增",
@@ -107,6 +123,10 @@ export const privilegeConfig = [
   {
     title: "程序配置",
     options: [
+      {
+        permission: "PROPERTY_VIEW",
+        name: "程序配置查看",
+      },
       {
         permission: "PROPERTY_BASELINE_EDIT",
         name: "基线配置修改",
@@ -122,6 +142,10 @@ export const privilegeConfig = [
   {
     title: "Nginx配置",
     options: [
+      {
+        permission: "NGINX_VIEW",
+        name: "Nginx配置查看",
+      },
       {
         permission: "NGINX_BASELINE_EDIT",
         name: "Nginx基线修改",
@@ -137,6 +161,10 @@ export const privilegeConfig = [
   {
     title: "部署",
     options: [
+      {
+        permission: "DEPLOY_VIEW",
+        name: "部署查看",
+      },
       {
         permission: "DEPLOY_INSERT",
         name: "部署新增",
@@ -146,19 +174,29 @@ export const privilegeConfig = [
         name: "部署修改",
         dataPrivilege: "deploy.id",
       },
+      {
+        permission: "DEPLOY_SECRET_VIEW",
+        name: "部署密钥查看",
+        dataPrivilege: "deploy.id",
+      },
+      {
+        permission: "DEPLOY_ORG_VIEW",
+        name: "部署绑定机构查看",
+        dataPrivilege: "deploy.id",
+      },
       {
         permission: "DEPLOY_ORG_EDIT",
         name: "部署绑定机构修改",
         dataPrivilege: "deploy.id",
       },
       {
-        permission: "DEPLOY_DEVICE_EDIT",
-        name: "部署绑定设备修改",
+        permission: "DEPLOY_LICENSE_ENTRY",
+        name: "部署证书功能",
         dataPrivilege: "deploy.id",
       },
       {
-        permission: "DEPLOY_SECRET_VIEW",
-        name: "部署密钥查看",
+        permission: "DEPLOY_DEVICE_EDIT",
+        name: "部署绑定设备修改",
         dataPrivilege: "deploy.id",
       },
       {

+ 1 - 1
src/mixins/privilege.js

@@ -5,7 +5,7 @@ export default {
       if (!privilegeScope) return false;
       if (privilegeScope === "*") return true;
 
-      return privilegeScope.split(",").include(scopeId + "");
+      return privilegeScope.split(",").includes(scopeId + "");
     },
   },
 };

+ 4 - 0
src/modules/admin/api.js

@@ -216,6 +216,9 @@ export const deployList = () => {
 export const appDeployList = (datas) => {
   return $postParam("/api/admin/deploy/query", datas);
 };
+export const appDeploySecret = (deviceId) => {
+  return $postParam("/api/admin/deploy/secret", { id: deviceId });
+};
 export const appDeployModes = () => {
   return $post("/api/admin/deploy/modes", {});
 };
@@ -247,6 +250,7 @@ export const appDeployDeviceList = (deployId) => {
 export const appDeployDeviceInfo = (deviceId) => {
   return $postParam("/api/admin/deploy/device/info", { deviceId });
 };
+
 export const appDeployDeviceSave = (datas) => {
   let formData = new FormData();
   Object.keys(datas).forEach((key) => {

+ 0 - 2
src/modules/admin/app-deploy/AppDeployBindDevice.vue

@@ -40,7 +40,6 @@
           </el-table-column>
           <el-table-column
             v-if="
-              checkPrivilege('DEPLOY_SECRET_VIEW', instance.id) ||
               checkPrivilege('DEPLOY_LICENSE_DOWNLOAD', instance.id) ||
               checkPrivilege('DEPLOY_DEVICE_EDIT', instance.id)
             "
@@ -50,7 +49,6 @@
           >
             <template slot-scope="scope">
               <el-button
-                v-if="checkPrivilege('DEPLOY_SECRET_VIEW', instance.id)"
                 class="btn-primary"
                 type="text"
                 @click="toDetail(scope.row)"

+ 25 - 1
src/modules/admin/app-deploy/AppDeployManage.vue

@@ -49,6 +49,17 @@
             label="部署方式"
             min-width="80"
           ></el-table-column>
+          <el-table-column label="密钥" width="130" class-name="action-column">
+            <template slot-scope="scope">
+              <el-button
+                v-if="checkPrivilege('DEPLOY_SECRET_VIEW', scope.row.id)"
+                class="btn-primary"
+                type="text"
+                @click="toCopyKey(scope.row)"
+                >复制到剪贴板</el-button
+              >
+            </template>
+          </el-table-column>
           <el-table-column label="操作" width="200" class-name="action-column">
             <template slot-scope="scope">
               <el-button
@@ -59,12 +70,14 @@
                 >编辑</el-button
               >
               <el-button
+                v-if="checkPrivilege('DEPLOY_ORG_VIEW', scope.row.id)"
                 class="btn-primary"
                 type="text"
                 @click="toBindOrg(scope.row)"
                 >关联机构</el-button
               >
               <el-button
+                v-if="checkPrivilege('DEPLOY_LICENSE_ENTRY', scope.row.id)"
                 class="btn-primary"
                 type="text"
                 @click="toBindDevice(scope.row)"
@@ -108,7 +121,7 @@
 </template>
 
 <script>
-import { appDeployList, appDeployModes } from "../api";
+import { appDeployList, appDeployModes, appDeploySecret } from "../api";
 import ModifyAppDeploy from "./ModifyAppDeploy.vue";
 import AppDeployBindOrg from "./AppDeployBindOrg.vue";
 import AppDeployBindDevice from "./AppDeployBindDevice.vue";
@@ -179,6 +192,17 @@ export default {
       this.current = page;
       this.getList();
     },
+    async toCopyKey(row) {
+      const data = await appDeploySecret(row.id);
+
+      const inputDom = document.createElement("textarea");
+      inputDom.value = `accessKey:${data.accessKey}\naccessSecret:${data.accessSecret}`;
+      document.body.appendChild(inputDom);
+      inputDom.select();
+      document.execCommand("copy");
+      inputDom.parentNode.removeChild(inputDom);
+      this.$message.success("复制成功!");
+    },
     toAdd() {
       this.curRow = { appId: this.app.id };
       this.$refs.ModifyAppDeploy.open();

+ 32 - 5
src/modules/admin/app/AppManage.vue

@@ -51,36 +51,42 @@
         <el-table-column label="管理" width="360" class-name="action-column">
           <template slot-scope="scope">
             <el-button
+              v-if="checkPrivilege('DEPLOY_VIEW')"
               class="btn-primary"
               type="text"
               @click="toEditDeploy(scope.row)"
               >部署</el-button
             >
             <el-button
+              v-if="checkPrivilege('MODULE_VIEW')"
               class="btn-primary"
               type="text"
               @click="toEditModule(scope.row)"
               >模块</el-button
             >
             <el-button
+              v-if="checkPrivilege('VERSION_VIEW')"
               class="btn-primary"
               type="text"
               @click="toEditVersion(scope.row)"
               >版本</el-button
             >
             <el-button
+              v-if="checkPrivilege('ENV_VIEW')"
               class="btn-primary"
               type="text"
               @click="toEditEnv(scope.row)"
               >环境</el-button
             >
             <el-button
+              v-if="checkPrivilege('PROPERTY_VIEW')"
               class="btn-primary"
               type="text"
               @click="toEditConfig(scope.row)"
               >程序配置</el-button
             >
             <el-button
+              v-if="checkPrivilege('NGINX_VIEW')"
               class="btn-primary"
               type="text"
               @click="toEditConfigNginx(scope.row)"
@@ -111,21 +117,42 @@
     >
     </modify-app>
     <!-- AppDeployManage -->
-    <app-deploy-manage ref="AppDeployManage" :app="curRow"></app-deploy-manage>
+    <app-deploy-manage
+      v-if="checkPrivilege('DEPLOY_VIEW')"
+      ref="AppDeployManage"
+      :app="curRow"
+    ></app-deploy-manage>
     <!-- AppModuleManage -->
-    <app-module-manage ref="AppModuleManage" :app="curRow"></app-module-manage>
+    <app-module-manage
+      v-if="checkPrivilege('MODULE_VIEW')"
+      ref="AppModuleManage"
+      :app="curRow"
+    ></app-module-manage>
     <!-- AppVersionManage -->
     <app-version-manage
+      v-if="checkPrivilege('VERSION_VIEW')"
       ref="AppVersionManage"
       :app="curRow"
       @master-change="getList"
     ></app-version-manage>
     <!-- AppEnvManage -->
-    <app-env-manage ref="AppEnvManage" :app="curRow"></app-env-manage>
+    <app-env-manage
+      v-if="checkPrivilege('ENV_VIEW')"
+      ref="AppEnvManage"
+      :app="curRow"
+    ></app-env-manage>
     <!-- AppConfigManage -->
-    <app-config-manage ref="AppConfigManage" :app="curRow"></app-config-manage>
+    <app-config-manage
+      v-if="checkPrivilege('PROPERTY_VIEW')"
+      ref="AppConfigManage"
+      :app="curRow"
+    ></app-config-manage>
     <!-- AppNginxManage -->
-    <app-nginx-manage ref="AppNginxManage" :app="curRow"></app-nginx-manage>
+    <app-nginx-manage
+      v-if="checkPrivilege('NGINX_VIEW')"
+      ref="AppNginxManage"
+      :app="curRow"
+    ></app-nginx-manage>
   </div>
 </template>
 

+ 1 - 20
src/modules/admin/org/OrgManage.vue

@@ -92,7 +92,7 @@
         <el-table-column prop="code" label="编码"> </el-table-column>
         <el-table-column prop="typeName" label="一级分类" width="90">
         </el-table-column>
-        <el-table-column prop="subTypesName" label="二级分类">
+        <el-table-column prop="subTypesName" label="二级分类" min-width="160">
         </el-table-column>
         <el-table-column prop="createTime" label="创建时间" width="160">
           <span slot-scope="scope">{{
@@ -111,16 +111,6 @@
             >{{ scope.row.enable | ableTypeFilter }}</span
           >
         </el-table-column>
-        <el-table-column label="密钥" width="130" class-name="action-column">
-          <template slot-scope="scope">
-            <el-button
-              class="btn-primary"
-              type="text"
-              @click="toCopyKey(scope.row)"
-              >复制到剪贴板</el-button
-            >
-          </template>
-        </el-table-column>
         <el-table-column
           v-if="checkPrivilege('ORG_EDIT')"
           class-name="action-column"
@@ -240,15 +230,6 @@ export default {
       this.current = page;
       this.getList();
     },
-    toCopyKey(row) {
-      const inputDom = document.createElement("textarea");
-      inputDom.value = `accessKey:${row.accessKey}\naccessSecret:${row.accessSecret}`;
-      document.body.appendChild(inputDom);
-      inputDom.select();
-      document.execCommand("copy");
-      inputDom.parentNode.removeChild(inputDom);
-      this.$message.success("复制成功!");
-    },
     toAdd() {
       this.curRow = {};
       this.$refs.ModifyOrg.open();

+ 9 - 8
src/modules/admin/user/ModifyPrivilege.vue

@@ -4,7 +4,6 @@
       class="page-dialog privilege-dialog"
       :visible.sync="modalIsShow"
       top="10px"
-      width="1000px"
       :close-on-click-modal="false"
       :close-on-press-escape="false"
       :show-close="false"
@@ -40,14 +39,13 @@
             <div
               v-for="option in item.options"
               :key="option.permission"
-              :class="[
-                'privilege-item',
-                { 'privilege-item-scope': option.dataPrivilege },
-              ]"
+              :class="['privilege-item']"
             >
-              <el-checkbox v-model="option.selected">{{
-                option.name
-              }}</el-checkbox>
+              <el-checkbox
+                v-model="option.selected"
+                @change="optionCheckChange(item)"
+                >{{ option.name }}</el-checkbox
+              >
               <privilege-scope-edit
                 v-if="option.dataPrivilege && option.selected"
                 v-model="option.scope"
@@ -194,6 +192,9 @@ export default {
     groupCheckChange(group) {
       group.options.forEach((option) => (option.selected = group.selected));
     },
+    optionCheckChange(group) {
+      group.selected = !group.options.some((option) => !option.selected);
+    },
     async submit() {
       const data = this.getData();
       if (!data.length) {

+ 5 - 14
src/modules/admin/user/PrivilegeScopeEdit.vue

@@ -2,25 +2,16 @@
   <div class="privilege-scope-edit">
     <span class="scope-edit-label">数据范围:</span>
     <div class="scope-edit-content">
+      <el-tag v-for="item in selectedSources" :key="item.id" type="info">{{
+        item.name
+      }}</el-tag>
+
       <div>
         <span class="mr-2" v-if="!selectedSources.length">无限制</span>
-        <el-button
-          class="btn-primary cont-edit"
-          size="medium"
-          type="text"
-          @click="toSelect"
+        <el-button class="cont-edit" size="medium" type="text" @click="toSelect"
           >编辑</el-button
         >
       </div>
-
-      <el-tag
-        v-for="item in selectedSources"
-        :key="item.id"
-        effect="dark"
-        type="primary"
-        style="margin-right: 5px; margin-bottom: 5px"
-        >{{ item.name }}</el-tag
-      >
     </div>
     <!-- SelectScopeDialog -->
     <select-scope-dialog

+ 3 - 1
src/modules/admin/user/SelectScopeDialog.vue

@@ -103,7 +103,9 @@ export default {
       this.filterLabel = "";
 
       this.$refs.DataTree.setCheckedKeys(this.selected, true);
-      this.checkChange();
+      this.$nextTick(() => {
+        this.checkChange();
+      });
     },
     cancel() {
       this.modalIsShow = false;