chenrui  2 سال پیش
والد
کامیت
75ed148712
3فایلهای تغییر یافته به همراه119 افزوده شده و 5 حذف شده
  1. 2 0
      public/config.js
  2. 116 5
      src/views/newUserManagement/index.vue
  3. 1 0
      vue.config.js

+ 2 - 0
public/config.js

@@ -5,4 +5,6 @@ window.SERVICE_ID = {
   getJqId: 10023, //获取机器维护列表
   getTableColumnId: 18122, //获取表头
   authTreeId: 18126, //获取表头
+  roleListId: 10024,//角色列表
+  userAuthorizationId: 10027,//用户授权
 };

+ 116 - 5
src/views/newUserManagement/index.vue

@@ -52,8 +52,9 @@
               </el-table-column>
               <el-table-column prop="user_comment" label="描述">
               </el-table-column>
-              <el-table-column label="操作">
+              <el-table-column label="操作" width="325">
                 <template slot-scope="scope">
+                  <el-button @click="handleTablepaswod(scope.row)" type="primary" plain size="small">修改密码 </el-button>
                   <el-button @click="handleTableEdit(scope.row)" type="primary" plain size="small">编辑 </el-button>
                   <el-button @click="handleTableAuth(scope.row)" type="primary" plain size="small">账号授权 </el-button>
                   <el-button @click="handleTableDel(scope.row)" type="danger" size="small">删除 </el-button>
@@ -64,6 +65,25 @@
         </div>
       </div>
     </div>
+    <Dialog :flag="paswordFlag">
+      <div class="dialog-content">
+        <div class="title">{{ dataTitle }}</div>
+        <div class="contents">
+          <el-form ref="ruleForm" :model="ruleForm" :rules="tableRules" label-width="100px" class="demo-ruleForm">
+            <el-form-item label="账号密码" prop="user_pwd">
+              <div class="flex-wrap">
+                <el-input v-model="ruleForm.user_pwd" class="r25" size="small" placeholder="请输入密码" />
+                <el-button size="small" @click="restPwd" style="position: relative;top: 4px;" class="r26" type="primary">生成密码</el-button>
+              </div>
+            </el-form-item>
+          </el-form>
+        </div>
+        <div class="foot right">
+          <el-button size="small" @click="handleOk" class="r24" type="primary">确定</el-button>
+          <el-button @click="eledite" size="small">取消</el-button>
+        </div>
+      </div>
+    </Dialog>
     <Dialog :flag="tableFlag">
       <div class="dialog-content">
         <div class="title">{{ dataTitle }}</div>
@@ -77,12 +97,12 @@
             <el-form-item label="账号名称" prop="user_name">
               <el-input v-model="ruleForm.user_name" size="small" placeholder="请输入账号名称" />
             </el-form-item>
-            <el-form-item label="账号密码" prop="user_pwd">
+            <!-- <el-form-item label="账号密码" prop="user_pwd">
               <div class="flex-wrap">
                 <el-input v-model="ruleForm.user_pwd" class="r25" size="small" placeholder="请输入密码" />
                 <el-button size="small" @click="restPwd" style="position: relative;top: 4px;" class="r26" type="primary">生成密码</el-button>
               </div>
-            </el-form-item>
+            </el-form-item> -->
             <el-form-item label="二级密码" prop="user_sec_pwd">
               <el-input v-model="ruleForm.user_sec_pwd" size="small" placeholder="请输入二级密码" />
             </el-form-item>
@@ -104,6 +124,22 @@
         </div>
       </div>
     </Dialog>
+    <Dialog :flag="dialogFlag" class="dialog-check-group">
+      <div class="dialog-wrapper">
+        <div class="title">角色列表</div>
+        <div class="content">
+          <!-- <el-tree ref="columnSetTree" :data="tableCols" :class="colsCheckClass" show-checkbox node-key="index" :default-expand-all="true" :props="{
+              label: 'role_name',
+              children: 'role_ID',
+            }" :default-checked-keys="checkedKeysTemp" @check="handleCheck" /> -->
+            <el-checkbox v-model="city.start"  v-for="city in tableCols" :key="city.index" @change="handleCheckedCitiesChange(city)">{{ city.role_name }}</el-checkbox>
+        </div>
+        <div class="foot right t30">
+          <!-- <el-button size="medium" class="r24" type="primary" @click="onCheck">确定</el-button> -->
+          <el-button size="medium" @click="hide">取消</el-button>
+        </div>
+      </div>
+    </Dialog>
     <Dialog :flag="rmFlag">
       <div class="airportInfoDialog">
         <div class="title del-title">删除</div>
@@ -123,6 +159,7 @@
 <script>
 import pb from '@/layout/mixin/getPublicData'
 import Dialog from '@/layout/components/Dialog'
+import MD5 from 'blueimp-md5'
 export default {
   name: 'NewManageMent',
   components: { Dialog },
@@ -166,6 +203,7 @@ export default {
         user_group_id: [{ required: true, message: '请选择账号组', trigger: 'change' }],
         user_pwd: [{ required: true, message: "请输入密码", trigger: "blur" }],
       },
+      paswordFlag: false,//修改密码
       tableFlag: false,
       title: '新增',
       type: 'add',
@@ -181,12 +219,20 @@ export default {
       rmObj: {},
       rmTitle: '',
       options: [],
-      rmType: '1'
+      rmType: '1',
+      tableCols: [],
+      dialogFlag: false,
+      checkedKeysTemp: [],
     }
   },
   mounted () {
     this.getTreeData()
   },
+  computed: {
+    colsCheckClass() {
+      return this.tableCols.some(col => col.children?.length) ? 'has-children' : 'no-children'
+    }
+  },
   methods: {
     async getTreeData () {
       const result = await this.getQuery(this.queryId)
@@ -305,18 +351,81 @@ export default {
       this.dataTitle = '编辑账号'
       this.ruleForm = _.cloneDeep(row)
     },
-    handleTableAuth () { },
+    async handleTableAuth (row) {
+      this.dialogFlag = true
+      const result = await this.getQuery(SERVICE_ID.roleListId)
+      const code = await this.getQuery(SERVICE_ID.userAuthorizationId, false, {
+        user_id: row.user_id
+      })
+      // console.log(code)
+      // console.log(result)
+      code.forEach(element => {
+        result.forEach(res => {
+          // res.user_id = row.user_id
+            if (res.role_ID === element.role_id) {
+              res.start = true
+            }
+          });
+        });
+      this.tableCols = result
+      this.tableCols.forEach(element => {
+        element.user_id = row.user_id
+      });
+    },
+    handleTablepaswod (row) {
+      this.paswordFlag = true
+      this.dataType = 'edit'
+      this.dataTitle = '修改密码'
+      this.ruleForm = _.cloneDeep(row)
+    },
     async handleTableDel (row) {
       this.dataObj = row
       this.rmTitle = row.user_name
       this.rmFlag = true
       this.rmType = '2'
     },
+    async handleCheckedCitiesChange (data) {
+      let code = null
+      let arr = {}
+      let event = null
+      if (data.start) {
+        event = 1
+        arr = {
+          value: {
+            role_id: data.role_ID,
+            user_id:  data.user_id
+          }
+        }
+      } else {
+        event = 3
+        arr = {
+          filter: {
+            role_id: data.role_ID,
+            user_id:  data.user_id
+          }
+        }
+      }
+      code = await this.generalDataReception(SERVICE_ID.userAuthorizationId,[arr], event)
+    },
+    async onCheck () {
+      let code = null
+      let arr = this.tableCols.filter(i => i.start === true)
+      let ar = []
+      arr.forEach(element => {
+        ar.push({value:element})
+      });
+      code = await this.generalDataReception(SERVICE_ID.userAuthorizationId,ar, 2)
+      this.dialogFlag = false
+    },
+    hide () {
+      this.dialogFlag = false
+    },
     async handleOk () {
       this.$refs['ruleForm'].validate(async (valid) => {
         if (valid) {
           let code = null
           const data = this.ruleForm
+          this.ruleForm.user_pwd= MD5(this.ruleForm.user_pwd)
           if (this.dataType == 'add') {
             code = await this.generalDataReception(SERVICE_ID.getUserTableId, data, 1)
           } else {
@@ -335,6 +444,7 @@ export default {
             this.tableData = result
           }
           this.tableFlag = false
+          this.paswordFlag = false
         }
         else {
           return false
@@ -342,6 +452,7 @@ export default {
       })
     },
     eledite () {
+      this.paswordFlag = false
       this.tableFlag = false
       this.clearTableForm()
     }

+ 1 - 0
vue.config.js

@@ -66,6 +66,7 @@ module.exports = {
     }
   },
   chainWebpack(config) {
+    config.externals({ './cptable': 'var cptable' })
     // it can improve the speed of the first screen, it is recommended to turn on preload
     config.plugin('preload').tap(() => [
       {