ソースを参照

Merge branch 'deploy' of http://git.chelingzhu.com/jianguan-web/jg-ocs-html into deploy

lilei 4 年 前
コミット
f037578f65

+ 2 - 3
src/views/power/register/register.vue

@@ -1,5 +1,5 @@
 <template>
-  <a-card :bordered="false">
+  <a-card size="small" :bordered="false">
     <a-row :gutter="24">
       <!-- 左侧菜单树列表 -->
       <a-col :span="8">
@@ -341,8 +341,7 @@ export default {
       this.$confirm({
         title: '警告',
         content: `确定要删除您选择的 ${_this.formData.dispname} 的数据吗?`,
-        okText: '确定',
-        cancelText: '取消',
+		centered: true,
         onOk () {
           delRegisterNode({
             id: _this.formData.id

+ 10 - 17
src/views/power/role/menuModal.vue

@@ -1,6 +1,12 @@
 <template>
   <div>
-    <a-modal class="modalBox" :title="roleName" v-model="isshow" @cancle="cancel" :centered="true">
+    <a-modal
+      centered
+      class="modalBox"
+      :title="roleName"
+      v-model="isshow"
+      @cancle="cancel"
+      :maskClosable="false">
       <a-form class="form-box" style="max-height: 600px;" :form="form" @submit="handleSubmit">
         <a-tree
           checkable
@@ -16,7 +22,7 @@
         <a-button type="primary" @click="handleSubmit()" id="menuModal-handleSubmit">
           保存
         </a-button>
-        <a-button :style="{ marginLeft: '8px' }" @click="handleCancel()" id="menuModal-handleCancel">
+        <a-button :style="{ marginLeft: '8px' }" @click="cancel" id="menuModal-handleCancel">
           取消
         </a-button>
       </a-form-item>
@@ -98,20 +104,6 @@ export default {
         }
       })
     },
-    // 取消
-    handleCancel () {
-      const _this = this
-      this.$confirm({
-        title: '提示',
-        content: '确定取消吗?',
-        okText: '确定',
-        cancelText: '取消',
-        onOk () {
-          _this.clear()
-          _this.cancel()
-        }
-      })
-    },
     clear () {
       this.form.resetFields()
       this.roleName = ''
@@ -166,7 +158,8 @@ export default {
 </script>
 
 <style >
-  .modalBox{
+  .ant-modal-title{
+    padding-right: 30px;
   }
   .ant-modal-footer {
     display: none;

+ 16 - 15
src/views/power/role/roleList.vue

@@ -1,5 +1,5 @@
 <template>
-  <a-card :bordered="false">
+  <a-card size="small" :bordered="false">
     <div class="table-page-search-wrapper">
       <a-form layout="inline">
         <a-row :gutter="48">
@@ -14,7 +14,6 @@
                 @pressEnter="$refs.table.refresh(true)" />
             </a-form-item>
           </a-col>
-
           <a-col :md="6" :sm="24">
             <a-form-item label="状态">
               <v-select code="CHECK_ENABLE_STATE" v-model="queryParam.isEnable" allowClear placeholder="请选择状态" id="roleList-isEnable"></v-select>
@@ -27,9 +26,9 @@
         </a-row>
       </a-form>
     </div>
-    <a-divider />
     <div class="table-operator">
-      <a-button type="primary" icon="plus" class="button-error" @click="openModal" id="roleList-openModal">新增</a-button>
+      <!-- <a-button v-if="$hasPermissions('B_powerMD_role_add')" type="primary" class="button-error" @click="openModal" id="roleList-openModal">新增</a-button> -->
+      <a-button type="primary" class="button-error" @click="openModal" id="roleList-openModal">新增</a-button>
     </div>
 
     <s-table
@@ -42,7 +41,14 @@
       bordered>
       <!-- 启用禁用 -->
       <span slot="status" slot-scope="text, record">
-        <a-switch checkedChildren="启用" unCheckedChildren="禁用" id="roleList-isEnable" v-model="record.isEnable" @change="changeFlagHandle(text, record)" />
+        <a-switch
+          v-if="$hasPermissions('B_powerMD_role_enable')"
+          checkedChildren="启用"
+          unCheckedChildren="禁用"
+          id="roleList-isEnable"
+          v-model="record.isEnable"
+          @change="changeFlagHandle(text, record)" />
+        <span v-else>{{ record.isEnable==1?'已启用':'已禁用' }}</span>
       </span>
       <!-- 角色描述 -->
       <template slot="remarks" slot-scope="text, record">
@@ -50,13 +56,13 @@
       </template>
       <!-- 操作 -->
       <span slot="action" slot-scope="text, record">
-        <a-icon type="setting" title="菜单权限" :style="{ fontSize: '20px', color: '#e29e14', padding: '0 10px' }" @click="openMenuModal(record)" />
-        <a-icon type="edit" title="编辑" :style="{fontSize: '20px',color:' #1890FF',padding:' 0 10px'}" @click="handleEdit(record)" />
+        <a-icon v-if="$hasPermissions('M_powerMD_role_menu')" type="setting" title="菜单权限" :style="{ fontSize: '20px', color: '#e29e14', padding: '0 10px' }" @click="openMenuModal(record)" />
+        <a-icon v-if="$hasPermissions('B_powerMD_role_edit')" type="edit" title="编辑" :style="{fontSize: '20px',color:' #1890FF',padding:' 0 10px'}" @click="handleEdit(record)" />
         <a-icon
           type="delete"
           title="删除"
           :style="{fontSize: '20px',color: '#f00',padding: '0 10px'}"
-          v-if="!record.isEnable"
+          v-if="!record.isEnable && $hasPermissions('B_powerMD_role_del')"
           @click="delect(record)" />
       </span>
     </s-table>
@@ -174,7 +180,7 @@ export default {
       this.queryParam.isEnable = ''
       this.refreshTable()
     },
-    // 新
+    // 新
     openModal () {
       this.showModal = true
       this.itemData = {}
@@ -203,8 +209,7 @@ export default {
       this.$confirm({
         title: '警告',
         content: '删除后无法恢复,确认删除?',
-        okText: '确定',
-        cancelText: '取消',
+        centered: true,
         onOk () {
           delectRolePower({
             id: row.id
@@ -241,10 +246,6 @@ export default {
 }
 </script>
 <style scoped>
-	.table-page-search-wrapper .ant-form-inline .ant-form-item {
-		margin-bottom: 0;
-	}
-
 	.action-button {
 		line-height: 40px;
 		white-space: nowrap;

+ 11 - 19
src/views/power/role/roleModal.vue

@@ -1,6 +1,13 @@
 <template>
   <div>
-    <a-modal class="modalBox" :title="titleText" v-model="isshow" @cancle="cancel" width="45%">
+    <a-modal
+      centered
+      class="modalBox"
+      :title="titleText"
+      v-model="isshow"
+      @cancle="cancel"
+      :maskClosable="false"
+      width="45%">
       <a-form :form="form" @submit="handleSubmit">
         <!-- 用户名称 -->
         <a-form-item label="角色名称" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
@@ -9,6 +16,7 @@
             :maxLength="30"
             v-decorator="['formData.name', {
               initialValue: formData.name,
+              getValueFromEvent: $filterEmpty,
               rules: [{ required: true, message: '请输入角色名称(最多30个字符)!' },{pattern:'^[^<|>]{1,30}$',message:'请输入不含<或>的字符,最多30个字符'}] }]"
           />
         </a-form-item>
@@ -46,7 +54,7 @@
           <a-button type="primary" @click="handleSubmit()">
             保存
           </a-button>
-          <a-button :style="{ marginLeft: '8px' }" @click="handleCancel()">
+          <a-button :style="{ marginLeft: '8px' }" @click="cancel">
             取消
           </a-button>
         </a-form-item>
@@ -91,11 +99,10 @@ export default {
     }
   },
   methods: {
-    cancel (e) {
+    cancel () {
       this.clear()
       this.$emit('close')
     },
-
     // 保存提交
     handleSubmit () {
       const _this = this
@@ -117,20 +124,6 @@ export default {
         }
       })
     },
-    // 取消
-    handleCancel () {
-      const _this = this
-      this.$confirm({
-        title: '提示',
-        content: '确定取消吗?',
-        okText: '确定',
-        cancelText: '取消',
-        onOk () {
-          _this.clear()
-          _this.cancel()
-        }
-      })
-    },
     clear () {
       this.form.resetFields()
       delete this.formData.id
@@ -138,7 +131,6 @@ export default {
       this.formData.isEnable = ''
       this.formData.remarks = ''
     }
-
   },
   mounted () {
   },

+ 41 - 29
src/views/power/user/userList.vue

@@ -1,34 +1,33 @@
 <template>
-  <a-card :bordered="false">
+  <a-card size="small" :bordered="false">
     <div class="table-page-search-wrapper">
       <a-form layout="inline">
-        <a-row :gutter="48">
+        <a-row :gutter="15">
           <a-col :md="6" :sm="24">
             <a-form-item label="用户名称">
-              <a-input allowClear v-model="queryParam.name" placeholder="请输入用户名称"/>
+              <a-input allowClear v-model.trim="queryParam.name" placeholder="请输入用户名称"/>
             </a-form-item>
           </a-col>
-
           <a-col :md="6" :sm="24">
             <a-form-item label="手机号码">
-              <a-input allowClear v-model="queryParam.phone" placeholder="请输入手机号码"/>
+              <a-input allowClear v-model.trim="queryParam.phone" placeholder="请输入手机号码"/>
             </a-form-item>
           </a-col>
-
           <a-col :md="6" :sm="24">
             <a-form-item label="状态">
               <v-select code="CHECK_ENABLE_STATE" v-model="queryParam.loginFlag" allowClear placeholder="请选择状态"></v-select>
             </a-form-item>
           </a-col>
           <a-col :md="4" :sm="24">
-            <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
+            <a-button type="primary" @click="$refs.table.refresh(true)" style="margin-right: 10px;">查询</a-button>
+            <a-button type="" @click="reset" id="roleList-reset">重置</a-button>
           </a-col>
         </a-row>
       </a-form>
     </div>
-    <a-divider/>
     <div class="table-operator">
-      <a-button type="primary" icon="plus" class="button-error" @click="openModal">新增</a-button>
+      <!-- <a-button v-if="$hasPermissions('B_powerMD_user_add')" type="primary" class="button-error" @click="openModal">新增</a-button> -->
+      <a-button type="primary" class="button-error" @click="openModal">新增</a-button>
     </div>
     <s-table
       ref="table"
@@ -40,26 +39,28 @@
       bordered
     >
       <span slot="status" slot-scope="text, record">
-        <a-switch checkedChildren="启用" unCheckedChildren="禁用" v-model="record.loginFlag" @change="changeFlagHandle(text, record)"/>
+        <a-switch v-if="$hasPermissions('B_powerMD_user_enable')" checkedChildren="启用" unCheckedChildren="禁用" v-model="record.loginFlag" @change="changeFlagHandle(text, record)"/>
+        <span v-else>{{ record.loginFlag==1?'已启用':'已禁用' }}</span>
       </span>
       <span slot="action" slot-scope="text, record">
         <a-icon
           type="edit"
           title="编辑"
           :style="{fontSize: '20px',color:' #1890FF',padding:' 0 10px'}"
+          v-if="$hasPermissions('B_powerMD_user_edit')"
           @click="handleEdit(record)"
         />
         <a-icon
           type="unlock"
           title="重置密码"
-          v-if="record.loginFlag==1"
+          v-if="record.loginFlag==1 && $hasPermissions('B_powerMD_user_restPwd')"
           :style="{fontSize: '20px',color:' #ffaa00',padding: '0 10px'}"
           @click="resetPassword(record)" />
         <a-icon
           type="delete"
           title="删除"
           :style="{fontSize: '20px',color: '#f00',padding: '0 10px'}"
-          v-if="record.loginFlag==0"
+          v-if="record.loginFlag==0 && $hasPermissions('B_powerMD_user_del')"
           @click="delect(record)"/>
       </span>
     </s-table>
@@ -151,23 +152,38 @@ export default {
     refreshTable () {
       this.$refs.table.refresh(true)
     },
-    // 新
+    // 新
     openModal () {
       this.showModal = true
       this.itemData = {}
     },
+    // 重置
+    reset () {
+      this.queryParam.name = ''
+      this.queryParam.phone = ''
+      this.queryParam.loginFlag = ''
+      this.refreshTable()
+    },
     // 重置密码
     resetPassword (row) {
-      resetPSD({
-        id: row.id
-      }).then(res => {
-        if (res.status == 200) {
-          this.$message.success(res.message)
-        } else {
-          this.$message.error(res.message)
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '确认重置密码吗?',
+        centered: true,
+        onOk () {
+          resetPSD({
+            id: row.id
+          }).then(res => {
+            if (res.status == 200) {
+              this.$message.success(res.message)
+            } else {
+              this.$message.error(res.message)
+            }
+          }).catch(() => {
+            this.$message.success(res.message)
+          })
         }
-      }).catch(() => {
-        this.$message.success(res.message)
       })
     },
     // 删除
@@ -176,8 +192,7 @@ export default {
       this.$confirm({
         title: '警告',
         content: '删除后无法恢复,确认删除?',
-        okText: '确定',
-        cancelText: '取消',
+        centered: true,
         onOk () {
           delectUserPower({
             id: row.id
@@ -224,12 +239,9 @@ export default {
 }
 </script>
 <style scoped>
-  .table-page-search-wrapper .ant-form-inline .ant-form-item{
-    margin-bottom: 0;
-  }
   .action-button{
-   line-height: 40px;
-   white-space: nowrap;
+    line-height: 40px;
+    white-space: nowrap;
     padding: 5px 10px;
     background-color: #1890ff;
     border-radius: 4px;

+ 41 - 44
src/views/power/user/userModal.vue

@@ -1,12 +1,13 @@
 <template>
   <div>
     <a-modal
+      centered
       class="modalBox"
+      :maskClosable="false"
       :title="titleText"
       v-model="isshow"
       @cancle="cancel"
-      width="45%"
-      :centered="true">
+      width="45%">
       <a-form :form="form" @submit="handleSubmit">
         <a-row :gutter="24">
           <a-col :span="12">
@@ -17,6 +18,7 @@
                 :maxLength="30"
                 v-decorator="['formData.name', {
                   initialValue: formData.name,
+                  getValueFromEvent: $filterEmpty,
                   rules: [{ required: true, message: '请输入用户名称(30个字以内)!' },{pattern:'^[^<|>]{1,30}$',message:'请输入不含<或>的字符,最多30个字符'}] }]"
               />
             </a-form-item>
@@ -34,7 +36,33 @@
             </a-form-item>
           </a-col>
         </a-row>
-
+        <a-row :gutter="24">
+          <a-col :span="12">
+            <!-- 用户账号 -->
+            <a-form-item label="用户账号" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }">
+              <a-input
+                placeholder="请输入用户账号"
+                :maxLength="50"
+                v-decorator="['formData.loginName', {
+                  initialValue: formData.loginName,
+                  rules: [{ required: true, message: '请输入用户账号!' },{pattern: /^[0-9A-Za-z]+$/, message: '用户账号为数字或大小写字母组成!'}] }]"
+              />
+            </a-form-item>
+          </a-col>
+          <a-col :span="12" v-if="!data.id">
+            <!-- 用户密码 -->
+            <a-form-item label="用户密码" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }">
+              <a-input
+                placeholder="请输入用户密码"
+                :maxLength="16"
+                type="password"
+                v-decorator="['formData.password', {
+                  initialValue: formData.password,
+                  rules: [{ required: true, message: '请输入用户密码!' },{pattern: /^[0-9A-Za-z]{6,16}$/, message: '用户密码为6到16位数字或大小写字母组成!'}] }]"
+              />
+            </a-form-item>
+          </a-col>
+        </a-row>
         <a-row :gutter="24">
           <!-- 性别 -->
           <a-col :span="12">
@@ -108,7 +136,7 @@
                 style="min-height: 50px;"
                 :maxLength="500"
                 placeholder="请输入备注(最多500个字符)"
-                autosize />
+                autoSize />
             </a-form-item>
           </a-col>
         </a-row>
@@ -117,7 +145,7 @@
           <a-button type="primary" @click="handleSubmit()" :style="{ marginRight: '8px' }">
             保存
           </a-button>
-          <a-button :style="{ marginLeft: '8px' }" @click="handleCancel()">
+          <a-button :style="{ marginLeft: '8px' }" @click="cancel">
             取消
           </a-button>
         </a-form-item>
@@ -159,18 +187,18 @@ export default {
         name: '',
         loginFlag: '', // 活动状态
         phone: '',
+        loginName: '',
+        password: '',
         sex: '',
         remarks: ''
       }
-
     }
   },
   methods: {
-    cancel (e) {
+    cancel () {
       this.clear()
       this.$emit('close')
     },
-
     // 保存提交
     handleSubmit () {
       const _this = this
@@ -178,12 +206,8 @@ export default {
         console.log(values, 'values222')
         if (!err) {
           values.formData.roleNames = values.formData.roleNames.join(',')
-
-          console.log(values.formData, ' formData.type222222222')
-          console.log(Object.assign({ id: this.data.id ? this.data.id : '' }, values.formData))
           saveUserPower(Object.assign({ id: this.data.id ? this.data.id : '' }, values.formData)).then(res => {
-            console.log(res, 'res--save')
-            if (res.status + '' === '200') {
+            if (res.status == 200) {
               this.$message.success(res.message ? res.message : '保存成功')
               this.$emit('refresh')
               setTimeout(function () {
@@ -194,21 +218,6 @@ export default {
         }
       })
     },
-    // 取消
-    handleCancel () {
-      const _this = this
-      this.$confirm({
-        title: '提示',
-        content: '确定取消吗?',
-        centered: true,
-        okText: '确定',
-        cancelText: '取消',
-        onOk () {
-          _this.clear()
-          _this.cancel()
-        }
-      })
-    },
     clear () {
       this.form.resetFields()
       delete this.formData.id
@@ -216,22 +225,21 @@ export default {
       this.formData.name = ''
       this.formData.loginFlag = ''
       this.formData.phone = ''
+      this.formData.loginName = ''
+      this.formData.password = ''
       this.formData.sex = ''
       this.formData.remarks = ''
     },
-
     // 获取角色列表接口
     getRoleList () {
       getRoleList().then(res => {
-        console.log(res, 'res--role')
-        if (res.status + '' === '200') {
+        if (res.status == 200) {
           this.roleList = res.data
         } else {
           this.$message.warning(res.message)
         }
       })
     }
-
   },
   mounted () {
     this.getRoleList()
@@ -250,13 +258,9 @@ export default {
           this.formData = Object.assign({}, this.data)
           delete this.formData.no
           let roleNames = this.formData.roleNames
-          console.log(roleNames, 'roleNames')
           if (roleNames) {
             roleNames = roleNames.split(',')
-            console.log(roleNames, 'roleNames22')
             const arr = []
-            console.log(this.roleList, 'this.roleList')
-
             roleNames.map(item => {
               const row = this.roleList.find(a => {
                 return a.name == item
@@ -265,16 +269,11 @@ export default {
                 arr.push(row.id)
               }
             })
-
-            console.log(arr, 'arrs')
             this.formData.roleNames = arr
           } else {
             this.formData.roleNames = []
           }
-
           this.formData.loginFlag = Number(this.formData.loginFlag)
-          // this.formData.sex = Number(this.formData.sex)
-          console.log(this.formData, 'this.formData')
         } else {
           this.titleText = '添加用户'
         }
@@ -286,9 +285,7 @@ export default {
 }
 </script>
 
-<style >
-  .modalBox{
-  }
+<style>
   .ant-modal-footer {
     display: none;
   }