zhaoke 2 жил өмнө
parent
commit
3281baf34d

+ 15 - 0
public/config.js

@@ -16,6 +16,16 @@ const DATACONTENT_ID = {
   /***-----登录------***/
   loginId: 205, //登录-获取权限-id
 
+  /***-----账号管理------***/
+  accountTableId: 38, //账号管理-首页-列表
+  accountRoleId: 43, //账号管理-根据id查角色
+  accountDetailsId: 45, //账号管理-根据id查详情
+
+  /***-----角色管理------***/
+  roleTableId: 41, //角色管理-首页-列表
+  roleDetailsId: 222, //角色管理-根据id查详情
+  roleAuthId: 42, //角色管理-根据id查权限
+
   /***-----系统设置------***/
   sysSourceId: 13, //系统设置-数据源-id
   sysProtoTabId: 1, //系统设置-协议管理-表格-id
@@ -65,6 +75,11 @@ const DATACONTENT_ID = {
 };
 
 const SERVICE_ID = {
+  /***-----账号管理------***/
+  accountScId: 17, //账号管理-增删改-id
+  /***-----角色管理------***/
+  roleScId: 16, //账号管理-增删改-id
+
   sysProtoTabId: 1, //系统设置-协议管理-表格-增删改-id
   sysServiceAddId: 3, //系统设置-服务管理-新增服务-提交-id/服务管理-编辑服务-保存-id
   sysServiceEditBoxId: 4, //系统设置-服务管理-编辑服务-部署机器-多选框-id

+ 8 - 8
src/components/permissionlist/index.vue

@@ -29,7 +29,7 @@
         <ul>
           <li v-for="(item, index) in dataLists" :key="index">
             <div class="up_type" :class="active === index ? 'up_types' : 'up_type'" @click="upActive(item, index)">
-              {{ item.AppName }}
+              {{ item.app_name }}
             </div>
           </li>
         </ul>
@@ -39,9 +39,9 @@
           <el-scrollbar style="height: 100%">
             <el-row :gutter="16">
               <el-col :span="8" v-for="(item, index) in RoleData" :key="index">
-                <div :title="item.AuthName" class="cide">
+                <div :title="item.auth_name" class="cide">
                   <div class="cide_header">
-                    <p>{{ item.AuthName }}</p>
+                    <p>{{ item.auth_name }}</p>
                     <span @click.stop="upStart(item)">查看</span>
                   </div>
                   <div class="cide_cont">
@@ -141,11 +141,11 @@ export default {
   methods: {
     Roleup (arr) {
       const datas = _.cloneDeep(arr);
-      const arrs = _.unionBy(datas, "AppId");
-      const newDatas = arrs.filter((item) => item.AppId);
+      const arrs = _.unionBy(datas, "app_id");
+      const newDatas = arrs.filter((item) => item.app_id);
       if (newDatas && newDatas.length) {
         this.dataLists = newDatas;
-        const goodDatas = this.getData(newDatas[0].AppId);
+        const goodDatas = this.getData(newDatas[0].app_id);
         this.RoleData = goodDatas;
       } else {
         this.RoleData = [];
@@ -154,12 +154,12 @@ export default {
     },
     upActive (item, index) {
       this.active = index;
-      this.RoleData = this.getData(item.AppId);
+      this.RoleData = this.getData(item.app_id);
     },
     getData (id) {
       const datas = [];
       this.RoleList.forEach((item) => {
-        if (item.AppId === id) {
+        if (item.app_id === id) {
           datas.push(item);
         }
       });

+ 26 - 21
src/components/rolelist/index.vue

@@ -55,6 +55,7 @@
 import { GetAccountList } from '@/api/Account'
 import { GetRoleByGroup } from '@/api/AccountGroup'
 import { QueryRole } from '@/api/apiAuthority'
+import { GeneralDataReception, Query } from '@/api/dataIntegration'
 import NoData from "@/components/nodata"
 export default {
   props: {
@@ -124,13 +125,13 @@ export default {
     roleType: {
       handler (msg) {
         if (msg == 'account') {
-          this.getRoleData('UserId', 'UserName')
+          this.getRoleData('account_id', 'account_name')
         }
         if (msg == 'roleByUpId') {
-          this.getRoleDataByUpId('roleId')
+          this.getRoleDataByUpId('role_id')
         }
         if (msg == 'onlyRole') {
-          this.getRoleData('RoleId', 'RoleName')
+          this.getRoleData('role_id', 'role_name')
         }
       },
       deep: true
@@ -166,10 +167,10 @@ export default {
       handler (arr) {
         if (arr && arr.length == 2) {
           if (this.roleType == 'account') {
-            this.checkBoxs('UserId')
+            this.checkBoxs('user_id')
           }
           if (this.roleType == 'onlyRole' || this.roleType == 'roleByUpId') {
-            this.checkBoxs('RoleId')
+            this.checkBoxs('role_id')
           }
         }
       },
@@ -262,20 +263,23 @@ export default {
     async getRoleData (ids, names) {
       try {
         this.loading = true
-        const obj = {
-          QueryName: '',
-          PageIndex: this.pageNum,
-          PageSize: this.pageSize
-        }
         let result = null
         if (this.roleType == 'account') {
-          result = await GetAccountList(obj)
+          result = await Query({
+            id: DATACONTENT_ID.accountTableId,
+            needPage: this.pageNum,
+            dataContent: ['']
+          })
         }
         if (this.roleType == 'onlyRole') {
-          result = await QueryRole(obj)
+          result = await Query({
+            id: DATACONTENT_ID.roleTableId,
+            needPage: this.pageNum,
+            dataContent: ['']
+          })
         }
-        if (result.code === 0) {
-          const datas = result.returnData.records
+        if (result.code == 0) {
+          const datas = result.returnData.listValues
           const num = result.returnData.pages
           this.arrsList.push(datas)
           const arrs = this.arrsList.flat()
@@ -284,6 +288,7 @@ export default {
             item.name = item[names]
           })
           this.dataList = msgs
+          console.log(this.dataList)
           this.total = num
           this.$emit('roleListChange', msgs)
           this.loading = false
@@ -334,13 +339,13 @@ export default {
 
     //滚动加载数据
     load () {
-      this.pageNum += 1
-      if (this.roleType == 'account') {
-        this.getRoleData('UserId', 'UserName')
-      }
-      if (this.roleType == 'onlyRole') {
-        this.getRoleData('RoleId', 'RoleName')
-      }
+      // this.pageNum += 1
+      // if (this.roleType == 'account') {
+      //   this.getRoleData('UserId', 'UserName')
+      // }
+      // if (this.roleType == 'onlyRole') {
+      //   this.getRoleData('RoleId', 'RoleName')
+      // }
     }
   }
 }

+ 78 - 70
src/views/accountManagement/components/accountAuth.vue

@@ -22,8 +22,7 @@
                 <el-radio v-model="radio" :label="0">否</el-radio>
               </span>
             </div> -->
-            <!-- <div v-is="['role_edit save']" class="btn">
-              <el-button class="r24" @click="removeRole" type="danger">删除</el-button>
+            <!-- <div v-is="['role_edit save','admin']" class="btn">
               <el-button @click="saveBtn('form')" size="small" type="primary">保存</el-button>
             </div> -->
           </div>
@@ -36,8 +35,8 @@
                 <el-input style="width: 340px" disabled type="textarea" :rows="3" maxlength="200" placeholder="请输入描述" v-model="form.app"></el-input>
               </el-form-item>
               <el-form-item label="是否启用">
-                <el-radio disabled v-model="radio" :label="1">是</el-radio>
-                <el-radio disabled v-model="radio" :label="0">否</el-radio>
+                <el-radio disabled v-model="form.id" :label="1">是</el-radio>
+                <el-radio disabled v-model="form.id" :label="2">否</el-radio>
               </el-form-item>
             </el-form>
           </div>
@@ -59,6 +58,7 @@ import Rulesofcompetency from "@/components/rulesofcompetency";
 import Permissiontree from "@/components/permissiontree";
 import Rolelist from "@/components/rolelist";
 import { RoleDetails, EditRole, RoleAuths } from "@/api/apiAuthority";
+import { GeneralDataReception, Query } from '@/api/dataIntegration';
 export default {
   name: "AuthorityRoleEdit",
   components: { Permissionlist, Rulesofcompetency, Permissiontree, Rolelist },
@@ -95,42 +95,50 @@ export default {
   },
   created () {
     //this.getAuthTree();
-    const { RoleId, Status } = this.$route.query;
-    this.roleId = RoleId;
-    this.Status = Status;
+    const { userId } = this.$route.query;
+    this.roleId = userId;
+    this.getAccountInfo();
+    this.roleDetails()
   },
   mounted () {
     this.roleType = "onlyRole";
   },
   methods: {
+    // 获取当前账号信息
+    async getAccountInfo () {
+      const res = await Query({
+        id: DATACONTENT_ID.accountDetailsId,
+        dataContent: [this.roleId]
+      })
+      if (res.code == 0) {
+        const { listValues } = res.returnData
+        const obj = listValues[0]
+        const { user_name, user_status, user_comment } = obj
+        this.form.name = user_name
+        this.form.app = user_comment
+        this.form.id = user_status
+      } else {
+        this.$message.error(res.message)
+      }
+    },
     //角色明细
-    async roleDetails (id) {
+    async roleDetails () {
       try {
-        this.loading = true;
-        const res = await RoleDetails({
-          RoleId: id,
-        });
-        if (res.code === 0) {
-          const { RoleName, RoleDesc, AuthList, RoleStatus, DefRoleList } =
-            res.returnData;
-          this.form.name = RoleName;
-          this.form.app = RoleDesc;
-          this.radio = RoleStatus;
-          if (AuthList && AuthList.length) {
-            AuthList.forEach((item) => {
-              this.authId.push(item.AuthId);
+        // this.loading = true;
+        const res = await Query({
+          id: DATACONTENT_ID.accountRoleId,
+          dataContent: [this.roleId]
+        })
+        if (res.code == 0) {
+          const { listValues } = res.returnData;
+          console.log(listValues)
+          if (listValues && listValues.length) {
+            this.checkedBoxs = listValues;
+            listValues.forEach((item) => {
+              item.RoleId = item.role_id;
             });
-            this.checkedKeys = this.authId;
-            this.authList = _.cloneDeep(AuthList);
-            this.authTo = AuthList[0];
-          }
-          if (DefRoleList && DefRoleList.length) {
-            this.checkedBoxs = DefRoleList;
-            DefRoleList.forEach((item) => {
-              item.RoleId = item.DefRoleId;
-            });
-            this.radioCheck = DefRoleList;
-            this.roleAuths(DefRoleList[0].DefRoleId);
+            this.radioCheck = listValues;
+            this.roleAuths(listValues[0].role_id);
           }
           this.loading = false;
         } else {
@@ -155,31 +163,46 @@ export default {
       this.authTo = obj;
     },
     //互斥角色选中回调
-    checkChange (arr) {
-      const arrs = [];
-      arr.forEach((item) => {
-        const obj = {
-          DefRoleId: item.RoleId,
-          IsSelected: 1,
-          DefRoleName: item.RoleName,
-        };
-        arrs.push(obj);
-      });
-      this.checkedBoxs = arrs;
+    async checkChange (arr) {
+      console.log(arr)
+      let obj = {
+        role_id: arr[arr.length - 1].role_id,
+        user_id: this.roleId
+      }
+      obj.event = 1
+      const result = await GeneralDataReception({
+        serviceId: SERVICE_ID.roleScId,
+        dataContent: JSON.stringify(obj)
+      })
+      if (result.code == 0) {
+        this.$message.success(result.message)
+      } else {
+        this.$message.error(result.message)
+      }
+      // const arrs = [];
+      // arr.forEach((item) => {
+      //   const obj = {
+      //     DefRoleId: item.role_id,
+      //     IsSelected: 1,
+      //     DefRoleName: item.role_name,
+      //   };
+      //   arrs.push(obj);
+      // });
+      this.checkedBoxs = arr;
     },
     //互斥角色点击回调
     checkClick (item) {
-      this.roleAuths(item.RoleId);
+      this.roleAuths(item.role_id);
     },
     async roleAuths (id) {
       try {
-        let params = {
-          RoleId: id,
-        };
         this.permission = true;
-        const res = await RoleAuths(params);
-        if (res.code === 0) {
-          this.RoleList = res.returnData;
+        const res = await Query({
+          id: DATACONTENT_ID.roleAuthId,
+          dataContent: [id]
+        });
+        if (res.code == 0) {
+          this.RoleList = res.returnData.listValues;
           this.permission = false;
         } else {
           this.$message.error(res.message);
@@ -191,30 +214,15 @@ export default {
       }
     },
     //保存
-    saveBtn (formName) {
-      this.$refs[formName].validate((valid) => {
-        if (valid) {
-          this.editRole();
-        } else {
-          console.log("error submit!!");
-          return false;
-        }
-      });
+    saveBtn () {
+      this.editRole();
     },
     //确认保存
     async editRole () {
       try {
-        const datas = [];
-        this.treeData.forEach((item) => {
-          datas.push(item.AuthList);
-        });
-        const res = await EditRole({
-          RoleName: this.form.name,
-          RoleDesc: this.form.app,
-          DefRoleList: this.checkedBoxs,
-          AuthList: datas,
-          RoleStatus: this.radio,
-          RoleId: this.roleId,
+        const res = await GeneralDataReception({
+          serviceId: SERVICE_ID.roleScId,
+          dataContent: JSON.stringify(this.ruleFormObj)
         });
         if (res.code === 0) {
           this.$message.success(res.message);

+ 239 - 136
src/views/accountManagement/components/accountHome.vue

@@ -7,95 +7,46 @@
         <div class="status2"><span class="icon" />离线</div>
         <div class="status3"><span class="icon" />禁用</div>
       </div>
-      <Search
-        :is-slot="true"
-        :is-title="false"
-        @getSearchData="getSearchData"
-        @clearSearchData="clearSearchData"
-      >
-        <el-button
-          v-is="['userlist_btn_add']"
-          class="btnAdd"
-          @click="addAccount"
-        >新增</el-button>
+      <Search :is-slot="true" :is-title="false" @getSearchData="getSearchData" @clearSearchData="clearSearchData">
+        <el-button v-is="['userlist_btn_add','admin']" class="btnAdd" @click="addAccount">新增</el-button>
       </Search>
     </div>
     <div class="content-box scrollbar">
       <template v-if="accountArr.length">
-        <el-row
-          v-infinite-scroll="load"
-          :infinite-scroll-disabled="disabled"
-          :infinite-scroll-distance="20"
-          :gutter="24"
-        >
-          <el-col
-            v-for="account in accountArr"
-            :key="account.UserId"
-            :xs="24"
-            :sm="12"
-            :md="8"
-            :lg="4"
-            class="account-box"
-          >
+        <el-row v-infinite-scroll="load" :infinite-scroll-disabled="disabled" :infinite-scroll-distance="20" :gutter="24">
+          <el-col v-for="account in accountArr" :key="account.user_id" :xs="24" :sm="12" :md="8" :lg="4" class="account-box">
             <div class="account-box-wrap">
-              <div :class="account.Status === 1 ? 'headOnline' : account.Status === 2 ? 'headOffline' : 'headDisabled'" />
+              <div :class="account.user_status == 1 ? 'headOnline' : account.user_status == 2 ? 'headOffline' : 'headDisabled'" />
               <div>
                 <div class="nameBox flex">
                   <div class="flex-wrap">
-                    <div class="name">{{ account.UserName }}</div>
-                    <div
-                      v-is="['userlist_btn_update']"
-                      class="loger"
-                      @click="toEdit(account.UserId)"
-                    />
+                    <div class="name">{{ account.user_name }}</div>
+                    <div v-is="['userlist_btn_update','admin']" class="loger" @click="toEdit(account.user_id)" />
+                    <div @click="authAccount(account)" class="loger cap-auth"></div>
                   </div>
-                  <div
-                    v-is="['userlist_btn_del']"
-                    class="del"
-                    @click="deleteUser(account)"
-                  >
+                  <div v-is="['userlist_btn_del','admin']" class="del" @click="deleteUser(account)">
                     <i class="el-icon-close" />
                   </div>
                 </div>
 
-                <el-row>
+                <!-- <el-row>
                   <el-col :span="24">{{ account.group }}</el-col>
                 </el-row>
 
-                <!-- <el-row class="content">
+                <el-row class="content">
                   <el-col :span="12">登录次数:<span>{{ account.LoginCount }}</span></el-col>
-                  <el-col
-                    :span="12"
-                    class="flexLeft"
-                  >异常登录:<span>{{ account.ExceptionCount }}</span></el-col>
+                  <el-col :span="12" class="flexLeft">异常登录:<span>{{ account.ExceptionCount }}</span></el-col>
                 </el-row> -->
                 <el-row class="content">
                   <el-col :span="24">权限项数:<span>{{ account.AuthCount }}</span></el-col>
                 </el-row>
                 <el-row class="content">
                   <el-col :span="12">
-                    状态:<span
-                      v-if="account.Status == 1 || account.Status == 2"
-                      class="used"
-                    >启用</span>
-                    <span
-                      v-else-if="account.Status == 3"
-                      class="unUsed"
-                    >停用</span>
+                    状态:<span v-if="account.user_status == 1" class="used">启用</span>
+                    <span v-else-if="account.user_status == 3 || account.user_status == 2 " class="unUsed">停用</span>
                   </el-col>
-                  <el-col
-                    v-is="['userlist_btn_status_change']"
-                    :span="12"
-                    class="flexLeft"
-                  >
-                    <el-switch
-                      v-model="account.Flag"
-                      :active-value="true"
-                      :inactive-value="false"
-                      active-color="#2D67E3"
-                      inactive-color="#CFD6E2"
-                      @change="userActiveToggle(account)"
-                    />
+                  <el-col v-is="['userlist_btn_status_change','admin']" :span="12" class="flexLeft">
+                    <el-switch v-model="account.Flag" :active-value="true" :inactive-value="false" active-color="#2D67E3" inactive-color="#CFD6E2" @change="userActiveToggle(account)" />
                   </el-col>
                 </el-row>
               </div>
@@ -103,14 +54,8 @@
           </el-col>
         </el-row>
         <template v-if="pages > 1">
-          <p
-            v-if="loading"
-            class="center"
-          >加载中...</p>
-          <p
-            v-if="noMore"
-            class="center"
-          >没有更多数据了~</p>
+          <p v-if="loading" class="center">加载中...</p>
+          <p v-if="noMore" class="center">没有更多数据了~</p>
         </template>
       </template>
     </div>
@@ -119,17 +64,40 @@
         <div class="title del-title">删除账号</div>
         <div class="content del-content"><i class="el-icon-error error r10" />你确定要删除<span class="error l10">{{ deleteUserName }}</span>?</div>
         <div class="foot Delfoot right t30">
-          <el-button
-            size="medium"
-            type="danger"
-            class="r24"
-            @click="del()"
-          >删除</el-button>
+          <el-button size="medium" type="danger" class="r24" @click="del()">删除</el-button>
 
-          <el-button
-            size="medium"
-            @click="dialogVisible = false"
-          >取消</el-button>
+          <el-button size="medium" @click="dialogVisible = false">取消</el-button>
+        </div>
+      </div>
+    </Dialog>
+    <!--新增/编辑-->
+    <Dialog :flag="editDialogVisible" width="508px" :show-flag="true">
+      <div class="airportInfoDialog dialog-public-background">
+        <div class="title">{{ editDialogTitle }}</div>
+        <div class="content">
+          <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="130px" class="demo-ruleForm">
+            <el-form-item label="账号名称" prop="user_name">
+              <el-input v-model="ruleForm.user_name" size="medium" placeholder="请输入账号名称" />
+            </el-form-item>
+            <el-form-item label="账号密码" prop="user_pwd">
+              <el-input v-model="ruleForm.user_pwd" show-password class="r25" size="medium" placeholder="请输入密码" />
+              <!-- <div class="flex-wrap">
+                <el-input v-model="ruleForm.PassWord" class="r25" size="medium" placeholder="请输入密码" />
+                <el-button size="medium" @click="resetPwd" style="position: relative;top: 4px;" class="r26" type="primary">重置密码</el-button>
+              </div> -->
+            </el-form-item>
+            <el-form-item label="账号描述" prop="user_comment">
+              <el-input v-model="ruleForm.user_comment" size="medium" type="textarea" :rows="3" placeholder="请输入角色描述" />
+            </el-form-item>
+            <el-form-item label="是否启用" prop="user_status">
+              <el-radio v-model="ruleForm.user_status" :label="1">是</el-radio>
+              <el-radio v-model="ruleForm.user_status" :label="2">否</el-radio>
+            </el-form-item>
+          </el-form>
+        </div>
+        <div class="foot center t30">
+          <el-button size="medium" type="primary" class="r25 r26" @click="submitClickHandler()">提交</el-button>
+          <el-button size="medium" class="r26" @click="resetForm('ruleForm')">取消</el-button>
         </div>
       </div>
     </Dialog>
@@ -139,11 +107,17 @@
 <script>
 import Search from '@/layout/components/Search'
 import Dialog from '@/layout/components/Dialog'
-import { GetAccountList, ChangeUserStatus, delAccount } from '@/api/Account'
+import { GetAccountList, ChangeUserStatus, delAccount, getAccountDetails, editAccount, addAccount } from '@/api/Account'
+import { pwdProduce } from '@/utils/validate'
+import { mapGetters } from 'vuex'
+import { GeneralDataReception, Query } from '@/api/dataIntegration'
 export default {
   components: { Search, Dialog },
-  data() {
+  data () {
     return {
+      pwdStruc: '',
+      pwdLengthBegin: 0,
+      pwdLengthEnd: 0,
       dialogVisible: false,
       accountArr: [],
       deleteUserId: '',
@@ -155,23 +129,56 @@ export default {
       PageIndex: 1,
       PageSize: 20,
       pages: null,
-      loading: false
+      loading: false,
+      editDialogVisible: false,
+      editDialogTitle: '新增账号',
+      editType: 'add',
+      ruleForm: {
+        // 协议信息表单
+        user_name: "",
+        user_status: "",
+        user_comment: "",
+        user_pwd: "",
+      },
+      rules: {
+        // 协议信息表单验证
+        user_name: [
+          { required: true, message: "请输入账号名称", trigger: "blur" },
+        ],
+      },
+      ruleFormObj: {},
+      roleId: ''
     }
   },
   computed: {
-    noMore() {
+    ...mapGetters(['systemSet']),
+    noMore () {
       return this.PageIndex >= this.pages
     },
-    disabled() {
+    disabled () {
       return this.loading || this.noMore
     }
   },
   watch: {
-    searchInfo(val) {
+    searchInfo (val) {
       val.length === 0 && this.pageInit()
     }
   },
-  created() {
+  created () {
+    // 获取系统配置
+    // if (this.systemSet) {
+    //   let obj
+    //   if (typeof this.systemSet === 'string') {
+    //     obj = JSON.parse(this.systemSet)
+    //   } else {
+    //     obj = this.systemSet
+    //   }
+    //   // console.log(obj)
+    //   const { PwdStruc, PwdLengthBegin, PwdLengthEnd } = obj
+    //   this.pwdStruc = PwdStruc
+    //   this.pwdLengthBegin = PwdLengthBegin
+    //   this.pwdLengthEnd = PwdLengthEnd
+    // }
     if (!this.searchInfo) {
       this.accountList()
     } else {
@@ -180,42 +187,108 @@ export default {
     }
   },
   methods: {
+    // 随机生成密码
+    resetPwd () {
+      this.ruleForm.PassWord = pwdProduce(this.pwdLengthBegin, this.pwdLengthEnd, this.pwdStruc)
+    },
+    // 编辑账号
+    async saveEditAccount () {
+      try {
+        const res = await GeneralDataReception({
+          serviceId: SERVICE_ID.accountScId,
+          dataContent: JSON.stringify(this.ruleForm)
+        })
+        if (res.code == 0) {
+          this.$message.success(res.message)
+          this.resetForm('ruleForm')
+          this.pageInit()
+        } else {
+          this.$message.error(res.message)
+        }
+      } catch (error) {
+        console.log('出错了', error)
+      }
+    },
+    // 新增账号
+    async saveAddAccount () {
+      try {
+        const res = await GeneralDataReception({
+          serviceId: SERVICE_ID.accountScId,
+          dataContent: JSON.stringify(this.ruleForm)
+        })
+        if (res.code == 0) {
+          this.$message.success(res.message)
+          this.resetForm('ruleForm')
+          this.pageInit()
+        } else {
+          this.$message.error(res.message)
+        }
+      } catch (error) {
+        console.log('出错了', error)
+      }
+    },
+    // 获取当前账号信息
+    async getAccountInfo () {
+      const res = await Query({
+        id: DATACONTENT_ID.accountDetailsId,
+        dataContent: [this.roleId]
+      })
+      if (res.code == 0) {
+        const { listValues } = res.returnData
+        const obj = listValues[0]
+        this.ruleForm = obj
+        this.ruleForm.event = 2
+      } else {
+        this.$message.error(res.message)
+      }
+    },
+    // 新增/编辑-确认
+    submitClickHandler () {
+      this.$refs["ruleForm"].validate((valid) => {
+        if (valid) {
+          if (this.editType == 'add') {
+            this.saveAddAccount()
+          } else {
+            this.saveEditAccount()
+          }
+          this.editDialogVisible = false
+        } else {
+          return false
+        }
+      });
+    },
     // 滚动加载
-    load() {
-      this.PageIndex += 1
-      this.accountList()
+    load () {
+      // this.PageIndex += 1
+      // this.accountList()
     },
     // 回到第一页
-    pageInit() {
+    pageInit () {
       this.PageIndex = 1
       this.accountArr = []
       this.accountList()
     },
     // 查询
-    getSearchData(val) {
+    getSearchData (val) {
       this.searchInfo = val
       this.pageInit()
     },
 
     // 清除查询
-    clearSearchData() {
+    clearSearchData () {
       this.searchInfo = ''
     },
     // 修改状态
-    async userActiveToggle({ Flag, Status, UserId }) {
-      Status = Flag ? 2 : 3
+    async userActiveToggle (item) {
+      item.event = 2
+      item.user_status = item.Flag ? 1 : 2
       try {
-        const result = await ChangeUserStatus({
-          Flag,
-          Status,
-          UserId
+        const result = await GeneralDataReception({
+          serviceId: SERVICE_ID.accountScId,
+          dataContent: JSON.stringify(item)
         })
-        if (result.code === 0) {
-          this.accountArr.forEach(account => {
-            if (account.UserId === UserId) {
-              account.Status = Status
-            }
-          })
+        if (result.code == 0) {
+          this.pageInit()
           this.$message.success(result.message)
         } else {
           this.$message.error(result.$message)
@@ -224,38 +297,49 @@ export default {
         console.log('出错了', error)
       }
     },
-    deleteUser(user) {
+    deleteUser (user) {
       this.dialogVisible = true
-      this.deleteUserId = user.UserId
-      this.deleteUserName = user.UserName
+      this.deleteUserName = user.UName
+      this.ruleFormObj = user
     },
-    toEdit(userId) {
-      this.userId = userId
-      this.$router.push({
-        path: '/account/accountEdit',
-        query: { userId: this.userId }
-      })
+    toEdit (userId) {
+      this.editDialogVisible = true
+      this.editType = 'edit'
+      this.editDialogTitle = '编辑账号'
+      this.roleId = userId
+      this.getAccountInfo()
     },
-    addAccount() {
-      this.$router.push({
-        path: '/account/accountAdd'
-      })
+    addAccount () {
+      this.editDialogTitle = '新增账号'
+      this.editDialogVisible = true
+      this.editType = 'add'
+      this.ruleForm = {}
+      this.ruleForm.event = 1
+      // this.$router.push({
+      //   path: '/account/accountAdd'
+      // })
+    },
+    // 重置
+    resetForm (formName) {
+      this.$refs[formName].resetFields()
+      this.editDialogVisible = false
     },
     // 获取列表
-    async accountList() {
+    async accountList () {
       try {
         this.loading = true
-        const result = await GetAccountList({
-          QueryName: this.searchInfo,
-          PageIndex: this.PageIndex,
-          PageSize: this.PageSize
+        const result = await Query({
+          id: DATACONTENT_ID.accountTableId,
+          needPage: this.PageIndex,
+          dataContent: [this.searchInfo]
         })
-        if (result.code === 0) {
+        if (result.code == 0) {
           this.loading = false
-          const newDatas = result.returnData.records
+          const newDatas = result.returnData.listValues
           // console.log(newDatas[0])
           this.pages = result.returnData.pages
           newDatas.forEach(element => {
+            element.Flag = element.user_status == 1 ? true : false
             this.accountArr.push(element)
           })
         } else {
@@ -267,19 +351,30 @@ export default {
     },
 
     // 删除接口
-    async del() {
-      const result = await delAccount({
-        UserId: this.deleteUserId
+    async del () {
+      this.ruleFormObj.event = 3
+      const result = await GeneralDataReception({
+        serviceId: SERVICE_ID.accountScId,
+        dataContent: JSON.stringify(this.ruleFormObj)
       })
-      if (result.code === 0) {
+      if (result.code == 0) {
         this.dialogVisible = false
         this.$message.success(result.message)
         this.pageInit()
-      } else if (result.code === -1) {
+      } else if (result.code == -1) {
         this.$message.error('后端错误,稍后请重试')
       } else {
         this.$message.success(result.message)
       }
+    },
+
+    // 账号权限
+    authAccount (item) {
+      this.roleId = item.user_id
+      this.$router.push({
+        path: '/account/accountAuth',
+        query: { userId: this.roleId }
+      })
     }
   }
 }
@@ -415,14 +510,22 @@ export default {
           width: 14px;
           height: 14px;
           margin-left: 24px;
-          background: url('../../../assets/status/ic_edit_default.png') no-repeat;
+          background: url("../../../assets/status/ic_edit_default.png")
+            no-repeat;
           background-size: 100% 100%;
           cursor: pointer;
         }
         .loger:hover {
-          background: url('../../../assets/status/ic_edit_hovar.png') no-repeat;
+          background: url("../../../assets/status/ic_edit_hovar.png") no-repeat;
           background-size: 100% 100%;
         }
+        .cap-auth {
+          margin-left: 12px;
+          background-image: url("../../../assets/status/ic_edit_authorization.png");
+          &:hover {
+            background-image: url("../../../assets/status/ic_edit_authorization_hover.png");
+          }
+        }
       }
 
       .content {
@@ -454,4 +557,4 @@ export default {
     }
   }
 }
-</style>
+</style>