Explorar o código

管理员角色

fly %!s(int64=2) %!d(string=hai) anos
pai
achega
c20e49e8c6

+ 19 - 1
VinnoManagementSystem/src/api/wing/adminManage.js

@@ -84,5 +84,23 @@ export default {
                 "params": [data]
             });
         }
-    }
+    },
+    adminRoleList: {
+        method: 'GetAdminRolePagesAsync',
+        name: "查询管理员角色列表",
+        post: async function (params) {
+            
+            var data = {
+                'PageIndex': params.page,
+                'PageSize': params.pageSize,
+                'RoleName': params.keyword
+            }
+            return await http.post({
+                "jsonrpc": "2.0",
+                "id": common.guid(),
+                "method": this.method,
+                "params": [data]
+            });
+        }
+    },
 }

+ 2 - 1
VinnoManagementSystem/src/locales/lang/zh-cn.js

@@ -131,7 +131,8 @@ export default {
 		password2:"确认密码",
 		passwordVaild:"密码不一致",
 		adminConfirmDelete: "确定删除该管理员吗?",
-		assignRole: "分配角色"
+		assignRole: "分配角色",
+		roleUserNum: "角色人数"
 	},
 	organization: {
 		organizationName: "机构名称",

+ 1 - 1
VinnoManagementSystem/src/views/adminManage/adminList.vue

@@ -61,7 +61,7 @@
         ref="table"
         :apiObj="apiObj"
         :pageSize="10"
-        row-key="UserCode"
+        row-key="AdminCode"
         @selection-change="selectionChange"
         stripe
       >

+ 152 - 0
VinnoManagementSystem/src/views/adminManage/adminRole.vue

@@ -0,0 +1,152 @@
+<template>
+  <el-container>
+    <el-header>
+      <div class="left-panel">
+        <el-button type="primary" icon="el-icon-plus" @click="add"
+          >{{ $t("create") }}
+        </el-button>
+      </div>
+      <el-form ref="form" class="right-panel">
+        <div class="right-panel-search">
+           <el-input
+            v-model="search.keyword"
+            clearable
+            style="width: 320px"
+            :placeholder="$t('pleaseInput')"
+          >
+            <template #prepend>
+              {{$t('admin.adminRoleName')}}
+            </template>
+          </el-input>
+          <el-button type="primary" icon="el-icon-search" @click="upsearch">{{
+            $t("query")
+          }}</el-button>
+        </div>
+      </el-form>
+    </el-header>
+    <el-main class="nopadding">
+      <scTable
+        ref="table"
+        :apiObj="apiObj"
+        :pageSize="10"
+        row-key="RoleCode"
+        @selection-change="selectionChange"
+        stripe
+      >
+         <el-table-column
+          :label="$t('admin.adminRoleName')"
+          prop="RoleName"
+        ></el-table-column>
+        <el-table-column
+          :label="$t('response.description')"
+          prop="Description"
+        ></el-table-column>
+        <el-table-column
+          :label="$t('admin.roleUserNum')"
+          prop="AdminNum"
+        ></el-table-column>
+        <el-table-column
+          :label="$t('operate')"
+          fixed="right"
+          align="center"
+          width="120"
+        >
+          <template #default="scope">
+            <!-- 编辑 -->
+            <el-button
+              type="text"
+              size="small"
+              @click="table_edit(scope.row, scope.$index)"
+              >{{ $t("edit") }}</el-button
+            >
+            <!-- 删除 -->
+            <el-popconfirm
+              :title="confirmDel"
+              @confirm="table_del(scope.row, scope.$index)"
+            >
+              <template #reference>
+                <el-button type="text" size="small">{{
+                  $t("delete")
+                }}</el-button>
+              </template>
+            </el-popconfirm>
+          </template>
+        </el-table-column>
+      </scTable>
+    </el-main>
+  </el-container>
+
+  <save-dialog
+    v-if="dialog.show"
+    ref="saveDialog"
+    @success="refresh"
+    @closed="dialog.show = false"
+  ></save-dialog>
+</template>
+
+<script>
+import saveDialog from "./saveAdmin";
+
+
+export default {
+  components: {
+    saveDialog,
+  },
+  data() {
+    return {
+      dialog: {
+        show: false,
+      },
+      apiObj: this.query,
+      search: {
+        keyword: null
+      },
+      confirmDel: this.$t("admin.adminConfirmDelete"),
+    };
+  },
+  methods: {
+    async query(params) {
+      return await this.$API.adminManage.adminRoleList.post(params);
+    },
+    //搜索
+    upsearch() {
+      this.$refs.table.upData(this.search);
+    },
+    //刷新当前页
+    refresh() {
+      this.$refs.table.refresh();
+    },
+    //增加
+    add() {
+      this.dialog.show = true;
+      this.$nextTick(() => {
+        this.$refs.saveDialog.open();
+      });
+    },
+    //编辑
+    table_edit(row) {
+      this.dialog.show = true;
+      this.$nextTick(() => {
+        this.$refs.saveDialog.open("edit").setData(row);
+      });
+    },
+    //删除
+    async table_del(row) {
+      await this.$API.wing.post(
+        "RemoveAdminAsync",
+        {
+          AdminCode: row.AdminCode,
+        },
+        this.refresh
+      );
+    },
+    //表格选择后回调事件
+    selectionChange(selection) {
+      this.selection = selection;
+    },
+  },
+};
+</script>
+
+<style>
+</style>