|
@@ -0,0 +1,242 @@
|
|
|
+<template>
|
|
|
+ <el-container>
|
|
|
+ <el-header>
|
|
|
+
|
|
|
+ <div class="left-panel">
|
|
|
+ <el-button type="primary" icon="el-icon-plus" @click="add">{{
|
|
|
+ $t("create")
|
|
|
+ }}</el-button>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-compass"
|
|
|
+ :disabled="selection.length == 0"
|
|
|
+ @click="add"
|
|
|
+ >{{ $t("organization.AssignAdmin") }}</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>
|
|
|
+ <el-select
|
|
|
+ v-model="search.queryType"
|
|
|
+ style="width: 120px"
|
|
|
+ :placeholder="$t('pleaseChoose')"
|
|
|
+ class="filter-item"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in queryTypes"
|
|
|
+ :key="item"
|
|
|
+ :label="$t('admin.adminQueryTypeOption' + item)"
|
|
|
+ :value="item"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+ </el-input>
|
|
|
+ <el-form-item
|
|
|
+ ref="form"
|
|
|
+ style="padding: 20px 0px 0px 0px"
|
|
|
+ :label="$t('admin.adminRoleQuery')"
|
|
|
+ >
|
|
|
+ <sc-select
|
|
|
+ v-model="search.roleCode"
|
|
|
+ :apiObj="$API.adminManage.adminRoleSelectList"
|
|
|
+ clearable
|
|
|
+ filterable
|
|
|
+ style="width: 100%"
|
|
|
+ ></sc-select>
|
|
|
+ </el-form-item>
|
|
|
+ <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="UserCode"
|
|
|
+ @selection-change="selectionChange"
|
|
|
+ stripe
|
|
|
+ >
|
|
|
+ <el-table-column type="selection" width="50"></el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ :label="$t('admin.adminName')"
|
|
|
+ prop="AdminName"
|
|
|
+ ></el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ :label="$t('admin.adminFullName')"
|
|
|
+ prop="FullName"
|
|
|
+ ></el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ :label="$t('admin.adminRoleName')"
|
|
|
+ prop="DefaultRoleName"
|
|
|
+ ></el-table-column>
|
|
|
+ <el-table-column :label="$t('createTime')" prop="CreateTime">
|
|
|
+ <template #default="scope">
|
|
|
+ <span>{{
|
|
|
+ scope.row.CreateTime.slice(0, 19).replace("T", " ")
|
|
|
+ }}</span>
|
|
|
+ </template>
|
|
|
+ </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"
|
|
|
+ @click="changeTitle(scope.row)"
|
|
|
+ >{{ $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: {
|
|
|
+ queryType: "0",
|
|
|
+ roleCode: "",
|
|
|
+ keyword: null,
|
|
|
+ },
|
|
|
+ queryTypes: ["0", "1"],
|
|
|
+ selection: [],
|
|
|
+ confirmDel: this.$t("organization.ConfirmDelete"),
|
|
|
+ };
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ async query(params) {
|
|
|
+ return await this.$API.adminManage.adminList.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(true).setData(row);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //审核
|
|
|
+ table_audit(row) {
|
|
|
+ this.$confirm(this.$t("organization.ApproveOrgMsg"), this.$t("audit"), {
|
|
|
+ distinguishCancelAndClose: true,
|
|
|
+ confirmButtonText: this.$t("audited"),
|
|
|
+ cancelButtonText: this.$t("rejected"),
|
|
|
+ type: "warning",
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.$API.wing.post(
|
|
|
+ "ModifyOrganizationStateAsync",
|
|
|
+ {
|
|
|
+ OrganizationCode: row.OrganizationCode,
|
|
|
+ State: 1,
|
|
|
+ },
|
|
|
+ this.refresh
|
|
|
+ );
|
|
|
+ })
|
|
|
+ .catch((action) => {
|
|
|
+ if (action === "cancel") {
|
|
|
+ this.$API.wing.post(
|
|
|
+ "ModifyOrganizationStateAsync",
|
|
|
+ {
|
|
|
+ OrganizationCode: row.OrganizationCode,
|
|
|
+ State: 2,
|
|
|
+ },
|
|
|
+ this.refresh
|
|
|
+ );
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .finally(() => {});
|
|
|
+ },
|
|
|
+ //删除
|
|
|
+ async table_del(row) {
|
|
|
+ await this.$API.wing.post(
|
|
|
+ "RemoveOrganization",
|
|
|
+ {
|
|
|
+ OrganizationCode: row.OrganizationCode,
|
|
|
+ },
|
|
|
+ this.refresh
|
|
|
+ );
|
|
|
+ },
|
|
|
+ //删除前验证
|
|
|
+ async changeTitle(row) {
|
|
|
+ this.confirmDel = this.$t("organization.ConfirmDelete");
|
|
|
+ var res = await this.$API.wing.post("OrganizationBindQueryResult", {
|
|
|
+ OrganizationCode: row.OrganizationCode,
|
|
|
+ });
|
|
|
+ if (res.BindDeviceNum > 0 || res.BindUserNum > 0) {
|
|
|
+ this.confirmDel = this.$t("organization.ConfirmDelete2");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //表格选择后回调事件
|
|
|
+ selectionChange(selection) {
|
|
|
+ this.selection = selection;
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style>
|
|
|
+</style>
|