chenrui 4 년 전
부모
커밋
1ba7a37b1f

+ 7 - 7
src/api/power-user.js

@@ -3,7 +3,7 @@ import { axios } from '@/utils/request'
 // 重置密码
 export const resetPSD = params => {
   return axios({
-    url: '/user/resetPwd',
+    url: '/mduser/resetPwd',
     data: params,
     method: 'POST'
   })
@@ -11,7 +11,7 @@ export const resetPSD = params => {
 
 // 获取列表数据
 export const getPowerUserList = params => {
-  const url = `/user/queryLike/${params.pageNo}/${params.pageSize}`
+  const url = `/mduser/queryLike/${params.pageNo}/${params.pageSize}`
   delete params.pageNo
   delete params.pageSize
   return axios({
@@ -24,7 +24,7 @@ export const getPowerUserList = params => {
 // 改变权限状态接口
 export const updateEnableStatus = params => {
   return axios({
-    url: `/user/enable/${params.id}/${params.flag}`,
+    url: `/mduser/enable/${params.id}/${params.flag}`,
     data: {},
     method: 'get'
   })
@@ -33,7 +33,7 @@ export const updateEnableStatus = params => {
 // 删除用户接口
 export const delectUserPower = params => {
   return axios({
-    url: `/user/delete/${params.id}`,
+    url: `/mduser/delete/${params.id}`,
     data: {},
     method: 'get'
   })
@@ -42,7 +42,7 @@ export const delectUserPower = params => {
 // 新增/编辑保存接口
 export const saveUserPower = params => {
   return axios({
-    url: '/user/save',
+    url: '/mduser/save',
     data: params,
     method: 'POST'
   })
@@ -51,8 +51,8 @@ export const saveUserPower = params => {
 // 获取角色列表接口
 export const getRoleList = params => {
   return axios({
-    url: '/role/findAll',
+    url: '/mdrole/findAll',
     data: params,
     method: 'POST'
   })
-}
+}

+ 68 - 0
src/api/powerRole-md.js

@@ -0,0 +1,68 @@
+import { axios } from '@/utils/request'
+
+// 获取列表数据
+export const getPowerRoleList = params => {
+  const url = `/mdrole/queryLike/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'POST'
+  })
+}
+
+// 改变权限状态接口 flag 0:禁用 1:启用
+export const updateEnableStatus = params => {
+  return axios({
+    url: `/mdrole/enable/${params.id}/${params.flag}`,
+    data: {},
+    method: 'get'
+  })
+}
+
+// 删除用户接口
+export const delectRolePower = params => {
+  return axios({
+    url: `/mdrole/delete/${params.id}`,
+    data: {},
+    method: 'get'
+  })
+}
+
+// 新增/编辑保存接口
+export const saveRolePower = params => {
+  return axios({
+    url: '/mdrole/save',
+    data: params,
+    method: 'POST'
+  })
+}
+
+// 获取菜单树数据
+export const getMenuList = params => {
+  const url = `/mdrole/findAllMenu/${params.id}`
+  return axios({
+    url: url,
+    method: 'get'
+  })
+}
+
+// 保存权限分配
+export const addMenuPower = params => {
+  const url = `/mdrole/saveRoleMenu`
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+
+// 获取角色列表接口
+export const getRoleList = params => {
+  return axios({
+    url: '/mdrole/findAll',
+    data: params,
+    method: 'POST'
+  })
+}

+ 2 - 2
src/config/router.config.js

@@ -1004,7 +1004,7 @@ export const asyncRouterMap = [
             name: 'productCategory',
             component: RouteView,
             meta: {
-              title: '产品类管理',
+              title: '产品类管理',
               icon: 'sliders'
               // permission: 'M_goodsManage_list'
             },
@@ -1015,7 +1015,7 @@ export const asyncRouterMap = [
                 name: 'productCategoryList',
                 component: () => import(/* webpackChunkName: "shop" */ '@/views/productManagement/productCategory/list.vue'),
                 meta: {
-                  title: '产品类列表',
+                  title: '产品类列表',
                   icon: 'sliders',
                   hidden: true
                   // permission: 'M_goodsManage_list'

+ 1 - 0
src/store/getters.js

@@ -5,6 +5,7 @@ const getters = {
   token: state => state.user.token,
   avatar: state => state.user.avatar,
   nickname: state => state.user.name,
+  mustChangePwd: state => state.user.mustChangePwd,
   welcome: state => state.user.welcome,
   roles: state => state.user.roles,
   userInfo: state => state.user.info,

+ 6 - 0
src/store/modules/user.js

@@ -7,6 +7,7 @@ const user = {
   state: {
     token: '',
     name: '',
+    mustChangePwd: null,
     welcome: '',
     avatar: '',
     roles: { permissionList: [] },
@@ -31,6 +32,9 @@ const user = {
     },
     SET_INFO: (state, info) => {
       state.info = info
+    },
+    SET_MUSTCHANGEPWD: (state, status) => {
+      state.mustChangePwd = status
     }
   },
 
@@ -49,6 +53,7 @@ const user = {
               commit('SET_TOKEN', res.access_token)
               commit('SET_INFO', users)
               commit('SET_NAME', { name: users.userNameCN, welcome: welcome() })
+              commit('SET_MUSTCHANGEPWD', users.mustChangePwd)
               Vue.ls.set('rolesAccess', { permissionList: users.permCodes }, 7 * 24 * 60 * 60 * 1000)
               commit('SET_AVATAR', res.avatar ? res.avatar : '')
               // 记住密码
@@ -90,6 +95,7 @@ const user = {
         }).finally(() => {
           commit('SET_INFO', {})
           commit('SET_NAME', { name: '', welcome: '' })
+          commit('SET_MUSTCHANGEPWD', '')
           commit('SET_AVATAR', '')
           commit('SET_TOKEN', '')
           commit('SET_ROLES', { permissionList: [] })

+ 32 - 3
src/views/Home.vue

@@ -1,22 +1,51 @@
 <template>
   <div class="home">
     <a-alert :message="message" type="info" showIcon />
+    <!-- 重置密码 -->
+    <a-modal
+      class="resetPwdModal"
+      title="重置密码"
+      width="60%"
+      centered
+      :footer="null"
+      :closable="false"
+      :maskClosable="false"
+      :destroyOnClose="true"
+      @cancel="openResetPwd=false"
+      v-model="openResetPwd">
+      <ResetPwd />
+    </a-modal>
   </div>
 </template>
 
 <script>
+import { mapGetters } from 'vuex'
+import ResetPwd from '@/views/user/ResetPwd.vue'
 export default {
   name: 'Home',
-  components: {
-  },
+  components: { ResetPwd },
   data () {
     return {
-      message: '欢迎登录' + process.env.VUE_APP_PRO_NAME
+      message: '欢迎登录' + process.env.VUE_APP_PRO_NAME,
+      openResetPwd: false //  重置密码是否显示
     }
   },
+  computed: {
+    ...mapGetters(['mustChangePwd'])
+  },
   created () {
   },
   methods: {
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {
+      //  判断登录用户是否重置过密码(首次登陆需强制重置密码)
+      if (vm.mustChangePwd == 0) {
+        vm.openResetPwd = false
+      } else {
+        vm.openResetPwd = true
+      }
+    })
   }
 }
 </script>

+ 1 - 1
src/views/basicData/customerTypeManagement/list.vue

@@ -81,7 +81,7 @@ export default {
   methods: {
     //  重置
     resetSearchForm () {
-      this.queryParam.name = ''
+      this.queryParam.customersTypeName = ''
       this.$refs.table.refresh(true)
     },
     //  新增/编辑

+ 2 - 2
src/views/power/role/menuModal.vue

@@ -26,7 +26,7 @@
 
 <script>
 import { STable, VSelect } from '@/components'
-import { addMenuPower } from '@/api/power-role.js'
+import { addMenuPower } from '@/api/powerRole-md.js'
 export default {
   name: 'RoleModal',
   components: {
@@ -104,7 +104,7 @@ export default {
       this.$confirm({
         title: '提示',
         content: '确定取消吗?',
-		centered: true,
+        centered: true,
         onOk () {
           _this.clear()
           _this.cancel()

+ 2 - 2
src/views/power/role/roleList.vue

@@ -77,7 +77,7 @@ import {
   updateEnableStatus,
   delectRolePower,
   getMenuList
-} from '@/api/power-role.js'
+} from '@/api/powerRole-md.js'
 export default {
   name: 'RoleList',
   components: {
@@ -203,7 +203,7 @@ export default {
       this.$confirm({
         title: '警告',
         content: '删除后无法恢复,确认删除?',
-		centered: true,
+        centered: true,
         onOk () {
           delectRolePower({
             id: row.id

+ 2 - 2
src/views/power/role/roleModal.vue

@@ -58,7 +58,7 @@
 
 <script>
 import { STable, VSelect } from '@/components'
-import { saveRolePower } from '@/api/power-role.js'
+import { saveRolePower } from '@/api/powerRole-md.js'
 export default {
   name: 'RoleModal',
   components: {
@@ -123,7 +123,7 @@ export default {
       this.$confirm({
         title: '提示',
         content: '确定取消吗?',
-		centered: true,
+        centered: true,
         onOk () {
           _this.clear()
           _this.cancel()

+ 18 - 10
src/views/power/user/userList.vue

@@ -158,16 +158,24 @@ export default {
     },
     // 重置密码
     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,7 +184,7 @@ export default {
       this.$confirm({
         title: '警告',
         content: '删除后无法恢复,确认删除?',
-		centered: true,
+        centered: true,
         onOk () {
           delectUserPower({
             id: row.id

+ 6 - 6
src/views/productManagement/productCategory/editModal.vue

@@ -18,11 +18,11 @@
         :label-col="formItemLayout.labelCol"
         :wrapper-col="formItemLayout.wrapperCol"
       >
-        <a-form-model-item label="所属类" v-if="parentType">
+        <a-form-model-item label="所属类" v-if="parentType">
           {{ parentType }}
         </a-form-model-item>
-        <a-form-model-item label="产品类名称" prop="productTypeName">
-          <a-input v-model.trim="form.productTypeName" id="productCategoryEdit-name" :maxLength="30" allowClear placeholder="请输入产品类名称(最多30个字符)" />
+        <a-form-model-item label="产品类名称" prop="productTypeName">
+          <a-input v-model.trim="form.productTypeName" id="productCategoryEdit-name" :maxLength="30" allowClear placeholder="请输入产品类名称(最多30个字符)" />
         </a-form-model-item>
       </a-form-model>
       <div class="btn-cont">
@@ -55,7 +55,7 @@ export default {
   },
   computed: {
     modalTit () {
-      return (this.itemId ? '编辑' : '新增') + '产品类'
+      return (this.itemId ? '编辑' : '新增') + '产品类'
     }
   },
   data () {
@@ -66,11 +66,11 @@ export default {
         wrapperCol: { span: 16 }
       },
       form: {
-        productTypeName: '', // 产品类名称
+        productTypeName: '', // 产品类名称
       },
       rules: {
         productTypeName: [
-          { required: true, message: '请输入产品类名称', trigger: 'blur' }
+          { required: true, message: '请输入产品类名称', trigger: 'blur' }
         ],
       },
       parentType: '',  //  父级分类

+ 16 - 17
src/views/productManagement/productCategory/list.vue

@@ -43,7 +43,7 @@
           @click="handleDel(record)">删除</a-button>
       </template>
     </s-table>
-    <!-- 新增/编辑产品类 -->
+    <!-- 新增/编辑产品类 -->
     <product-category-edit-modal :openModal="openModal" :nowData="nowData" :itemId="itemId" @ok="handleOk" @close="closeModal" />
   </a-card>
 </template>
@@ -61,10 +61,9 @@ export default {
         wrapperCol: { span: 16 }
       },
       columns: [
-        { title: '产品类别名称', dataIndex: 'productTypeName', width: 200, align: 'left' },
-        { title: '首字母', dataIndex: 'firstChar', width: 150, align: 'center' },
-        { title: '创建时间', dataIndex: 'createDate', width: 150, align: 'center' },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: 150, align: 'center' }
+        { title: '分类名称', dataIndex: 'productTypeName', align: 'left' },
+        { title: '创建时间', dataIndex: 'createDate', align: 'center' },
+        { title: '操作', scopedSlots: { customRender: 'action' }, align: 'center' }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -72,29 +71,29 @@ export default {
         return dealerProductTypeQuery({}).then(res => {
           //  递归去除空children
           this.recursionFun(res.data)
-          if(res.data.length > 0){
+          if (res.data.length > 0) {
             this.defaultExpandedRowKeys[0] = res.data[0].id
-          }else{
+          } else {
             this.defaultExpandedRowKeys = []
           }
           return res.data
         })
       },
       defaultExpandedRowKeys: [], //  树形数据默认展开项
-      openModal: false,  //  新增编辑  弹框
-      itemId: '',  //  当前id
-      nowData: null  //  当前记录数据
+      openModal: false, //  新增编辑  弹框
+      itemId: '', //  当前id
+      nowData: null //  当前记录数据
     }
   },
   methods: {
     //  新增子级
     handleAdd (row) {
       this.itemId = null
-      if(row){  //  新增子级
-        let nowData = row
+      if (row) { //  新增子级
+        const nowData = row
         nowData.psn = nowData && nowData.productTypeSn ? nowData.productTypeSn : null
         this.nowData = nowData
-      }else{  //  最高级
+      } else { //  最高级
         this.nowData = null
       }
       this.openModal = true
@@ -102,18 +101,18 @@ export default {
     //  编辑
     handleEdit (row) {
       this.itemId = row && row.id ? row.id : null
-      let nowData = row
+      const nowData = row
       nowData.psn = nowData && nowData.productTypeSn ? nowData.productTypeSn : null
       this.nowData = nowData
       this.openModal = true
     },
     //  关闭弹框
-    closeModal(){
+    closeModal () {
       this.itemId = ''
       this.openModal = false
     },
     //  新增/编辑  成功
-    handleOk(){
+    handleOk () {
       this.$refs.table.refresh(true)
     },
     //  删除
@@ -171,4 +170,4 @@ export default {
       }
     }
   }
-</style>
+</style>

+ 1 - 1
src/views/productManagement/productInfo/detailModal.vue

@@ -16,7 +16,7 @@
         <a-descriptions-item label="原厂编码:">{{ detailsData.origCode || '--' }}</a-descriptions-item>
         <a-descriptions-item label="基本单位:">{{ detailsData.unit || '--' }}</a-descriptions-item>
         <a-descriptions-item label="产品品牌:">{{ detailsData.productBrandName || '--' }}</a-descriptions-item>
-        <a-descriptions-item label="产品类:">{{ productTypeName || '--' }}</a-descriptions-item>
+        <a-descriptions-item label="产品类:">{{ productTypeName || '--' }}</a-descriptions-item>
         <a-descriptions-item label="经销批发价:">{{ (detailsData.wholesalePrice || detailsData.wholesalePrice==0) ? detailsData.wholesalePrice : '--' }}</a-descriptions-item>
         <a-descriptions-item label="终端价:">{{ (detailsData.terminalPrice || detailsData.terminalPrice==0) ? detailsData.terminalPrice : '--' }}</a-descriptions-item>
         <a-descriptions-item label="车主价:">{{ (detailsData.carOwnerPrice || detailsData.carOwnerPrice==0) ? detailsData.carOwnerPrice : '--' }}</a-descriptions-item>

+ 8 - 8
src/views/productManagement/productInfo/edit.vue

@@ -47,8 +47,8 @@
         </a-select>
         <a-button @click="openModal=true" icon="plus" size="small" id="productInfoEdit-add-btn" style="margin-left: 5px;"></a-button>
       </a-form-model-item>
-      <a-form-model-item label="产品类" prop="productType">
-        <a-cascader :disabled="!!$route.params.id" @change="changeProductType" :options="productTypeList" :fieldNames="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }" id="productInfoEdit-productType" placeholder="请选择产品类" allowClear v-model="form.productType" />
+      <a-form-model-item label="产品类" prop="productType">
+        <a-cascader :disabled="!!$route.params.id" @change="changeProductType" :options="productTypeList" :fieldNames="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }" id="productInfoEdit-productType" placeholder="请选择产品类" allowClear v-model="form.productType" />
       </a-form-model-item>
       <a-form-model-item label="经销批发价" prop="wholesalePrice">
         <a-input-number
@@ -114,8 +114,8 @@ export default {
         origCode: '',  //  原厂编码
         unit: '',  //  基本单位
         productBrandSn: undefined,  //  产品品牌
-        productTypeSn3: '',  //  产品三级类
-        productType: [], //  产品类
+        productTypeSn3: '',  //  产品三级
+        productType: [], //  产品
         wholesalePrice: '',  //  经销价
         terminalPrice: '',  //  终端价
         carOwnerPrice: '',  //  车主价
@@ -131,11 +131,11 @@ export default {
           { required: true, message: '请选择产品品牌', trigger: 'change' }
         ],
         productType: [
-          { required: true, message: '请选择产品类', trigger: 'change' }
+          { required: true, message: '请选择产品类', trigger: 'change' }
         ],
       },
       productBrandList: [],  //  品牌下拉数据
-      productTypeList: [],  //  类下拉数据
+      productTypeList: [],  //  类下拉数据
       openModal: false,  //  新增编辑  弹框
     }
   },
@@ -177,7 +177,7 @@ export default {
         }
       })
     },
-    //  产品类  change
+    //  产品类  change
     changeProductType(val, opt){
       this.form.productTypeSn3 = val[2] ? val[2] : ''
     },
@@ -208,7 +208,7 @@ export default {
         }
       })
     },
-    //  产品类  列表
+    //  产品类  列表
     getProductType(){
       dealerProductTypeQuery({}).then(res => {
         if(res.status == 200){

+ 10 - 10
src/views/productManagement/productInfo/list.vue

@@ -28,8 +28,8 @@
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
-              <a-form-item label="产品类">
-                <a-cascader @change="changeProductType" change-on-select :options="productTypeList" :fieldNames="{ label: 'productTypeName', value: 'id', children: 'children' }" id="productInfoList-productType" placeholder="请选择产品类" allowClear />
+              <a-form-item label="产品类">
+                <a-cascader @change="changeProductType" change-on-select :options="productTypeList" :fieldNames="{ label: 'productTypeName', value: 'id', children: 'children' }" id="productInfoList-productType" placeholder="请选择产品类" allowClear />
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
@@ -75,14 +75,14 @@
       :columns="columns"
       :data="loadData"
       bordered>
-      <!-- 产品类 -->
+      <!-- 产品类 -->
       <!-- 自定义表头 -->
       <template slot="productTypeCustomTitle">
         <a-tooltip placement="top">
           <template slot="title">
             <span>列表中只显示第三级分类的名称,鼠标移动至文字上,查看上级分类。“>”为分隔符</span>
           </template>
-          产品类<a-icon type="question-circle" :style="{ color: '#ed1c24', marginLeft: '10px' }" />
+          产品类<a-icon type="question-circle" :style="{ color: '#ed1c24', marginLeft: '10px' }" />
         </a-tooltip>
       </template>
       <template slot="productType" slot-scope="text, record">
@@ -131,9 +131,9 @@ export default {
         productName: '', //  产品名称
         origCode: '',  //  原厂编码
         productBrandSn: undefined,  //  产品品牌
-        productTypeSn1: '',  //  产品一级类
-        productTypeSn2: '',  //  产品二级类
-        productTypeSn3: '',  //  产品三级类
+        productTypeSn1: '',  //  产品一级
+        productTypeSn2: '',  //  产品二级
+        productTypeSn3: '',  //  产品三级
         enabledFlag: undefined,  //  状态
         beginDate: '',  //  创建时间  开始时间
         endDate: '',  //  创建时间  结束时间
@@ -173,7 +173,7 @@ export default {
       openModal: false,  //  查看客户详情  弹框
       itemId: '',  //  当前产品id
       productBrandList: [],  //  品牌下拉数据
-      productTypeList: [],  //  类下拉数据
+      productTypeList: [],  //  类下拉数据
     }
   },
   methods: {
@@ -227,7 +227,7 @@ export default {
       this.itemId = ''
       this.openModal = false
     },
-    //  产品类  change
+    //  产品类  change
     changeProductType(val, opt){
       this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
       this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
@@ -293,7 +293,7 @@ export default {
         }
       })
     },
-    //  产品类  列表
+    //  产品类  列表
     getProductType(){
       dealerProductTypeQuery({}).then(res => {
         if(res.status == 200){

+ 9 - 0
src/views/salesManagement/salesQuery/list.vue

@@ -143,6 +143,7 @@
 </template>
 
 <script>
+import moment from 'moment'
 import { STable, VSelect } from '@/components'
 import chooseCustomModal from './chooseCustomModal.vue'
 import { custAllList } from '@/api/customer'
@@ -189,6 +190,14 @@ export default {
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
+        // 创建时间
+        if (this.time && this.time.length > 0) {
+          this.queryParam.beginDate = moment(this.time[0]).format(this.dateFormat)
+          this.queryParam.endDate = moment(this.time[1]).format(this.dateFormat)
+        } else {
+          this.queryParam.beginDate = undefined
+          this.queryParam.endDate = undefined
+        }
         return salesList(Object.assign(parameter, this.queryParam)).then(res => {
           const data = res.data
           const no = (data.pageNo - 1) * data.pageSize

+ 11 - 144
src/views/user/ChangePwd.vue

@@ -1,158 +1,25 @@
 <template>
-
-  <a-card size="small" :bordered="false" class="change-pwd-card">
-    <a-row :gutter="24" class="change-pwd">
-      <a-col span="8" offset="8">
-        <a-form @submit="handleSubmit" :form="form">
-          <!-- 原始密码 -->
-          <a-form-item
-            label="原始密码"
-            prop="oldPwd"
-            :label-col="formLayout.labelCol"
-            :wrapper-col="formLayout.wrapperCol">
-            <a-input
-              type="password"
-              v-decorator="[
-                'formCustom.oldPwd',
-                { initialValue: formCustom.oldPwd,
-                  rules: [
-                    { required: true, message: '请输入原始密码' },
-                  ]
-                },
-              ]">
-            </a-input>
-          </a-form-item>
-          <!-- 新密码 -->
-          <a-form-item
-            label="新密码"
-            prop="passwd"
-            :label-col="formLayout.labelCol"
-            :wrapper-col="formLayout.wrapperCol">
-            <a-input
-              type="password"
-              v-decorator="[
-                'formCustom.passwd',
-                { initialValue: formCustom.passwd,
-                  rules: [
-                    { required: true, message: '请输入新密码' }
-                  ]
-                },
-              ]">
-            </a-input>
-          </a-form-item>
-          <!-- 再次确认 -->
-          <a-form-item
-            label="再次确认"
-            prop="passwdCheck"
-            :label-col="formLayout.labelCol"
-            :wrapper-col="formLayout.wrapperCol">
-            <a-input
-              type="password"
-              v-decorator="[
-                'formCustom.passwdCheck',
-                { initialValue: formCustom.passwdCheck,
-                  rules: [
-                    { required: true, message: '请再次输入密码' },
-                    { validator: compareToFirstPassword }
-                  ]
-                },
-              ]">
-            </a-input>
-          </a-form-item>
-          <a-col span="16" offset="8">
-            <a-form-item>
-              <a-button type="primary" htmlType="submit" :loading="loading">保存</a-button>
-              <a-button @click="handleReset('formCustom')" style="margin-left: 8px">重置</a-button>
-            </a-form-item>
-          </a-col>
-        </a-form>
+	<a-card :bordered="false" class="change-pwd-card">
+    <a-row :gutter="24">
+      <a-col span="12" offset="6">
+        <ResetPwd />
       </a-col>
     </a-row>
   </a-card>
-
 </template>
 
 <script>
-import { changePwd } from '@/api/login.js'
-import { mapActions, mapGetters } from 'vuex'
-
+import ResetPwd from '@/views/user/ResetPwd.vue'
 export default {
   name: 'ChangePwd',
-  data () {
-    return {
-      formLayout: {
-        labelCol: {
-          xs: { span: 24 },
-          sm: { span: 6 }
-        },
-        wrapperCol: {
-          xs: { span: 24 },
-          sm: { span: 18 }
-        }
-      },
-      form: this.$form.createForm(this),
-      loading: false,
-      formCustom: {
-        passwd: '',
-        passwdCheck: '',
-        oldPwd: ''
-      }
-    }
-  },
-  methods: {
-    ...mapActions(['Logout']),
-    // 密码校验
-    compareToFirstPassword (rule, value, callback) {
-      const form = this.form
-      if (value && value !== form.getFieldValue('formCustom.passwd')) {
-        callback('两次输入的密码不一致, 请重新输入!')
-      } else {
-        callback()
-      }
-    },
-    handleSubmit (e) {
-      e.preventDefault()
-      const _this = this
-      this.form.validateFields((err, values) => {
-        console.log(values, 'values')
-        if (!err) {
-          changePwd({
-            oldPassword: values.formCustom.oldPwd,
-            password: values.formCustom.passwd
-          }).then(res => {
-            console.log(res, 'res111111')
-            if (res.status === '200') {
-              _this.$message.success('修改成功, 请重新登录')
-              _this.logout()
-            } else {
-              // _this.$message.error(res.message)
-            }
-          })
-        }
-      })
-    },
-    logout () {
-      this.Logout({}).then(() => {
-        setTimeout(() => {
-          this.$router.push({ path: '/user/login' })
-        }, 16)
-      })
-    },
-    handleReset () {
-      this.form.resetFields()
-    }
+  components: {
+    ResetPwd
   }
-
 }
 </script>
 
-<style scoped>
-  .change-pwd {
-    margin-top: 15vh;
-  }
-
-  .change-pwd-card {
-    height: 70vh;
-    /* border-top: 2px solid #FFB01B; */
-  }
+<style lang="less" scoped>
+.change-pwd-card {
+  padding-top: 50px;
+}
 </style>

+ 166 - 0
src/views/user/ResetPwd.vue

@@ -0,0 +1,166 @@
+<template>
+  <div class="change-pwd">
+    <a-form @submit="handleSubmit" :form="form">
+      <!-- 原始密码 -->
+      <a-form-item
+        label="原始密码"
+        prop="oldPwd"
+        :label-col="formLayout.labelCol"
+        :wrapper-col="formLayout.wrapperCol">
+        <a-input
+          type="password"
+          :maxLength="12"
+          placeholder="请输入原始密码(6~12位)"
+          v-decorator="[
+            'formCustom.oldPwd',
+            { initialValue: formCustom.oldPwd,
+              rules: [
+                { required: true, message: '请输入原始密码' },
+              ]
+            },
+          ]">
+        </a-input>
+      </a-form-item>
+      <!-- 新密码 -->
+      <a-form-item
+        label="新密码"
+        prop="passwd"
+        :label-col="formLayout.labelCol"
+        :wrapper-col="formLayout.wrapperCol">
+        <a-input
+          type="password"
+          :maxLength="12"
+          placeholder="请输入新密码(6~12位)"
+          v-decorator="[
+            'formCustom.passwd',
+            { initialValue: formCustom.passwd,
+              rules: [
+                { required: true, message: '请输入新密码' },
+                { validator: passwordValid }
+              ]
+            },
+          ]">
+        </a-input>
+      </a-form-item>
+      <!-- 再次确认 -->
+      <a-form-item
+        label="再次确认"
+        prop="passwdCheck"
+        :label-col="formLayout.labelCol"
+        :wrapper-col="formLayout.wrapperCol">
+        <a-input
+          type="password"
+          :maxLength="12"
+          placeholder="请再次输入新密码(6~12位)"
+          v-decorator="[
+            'formCustom.passwdCheck',
+            { initialValue: formCustom.passwdCheck,
+              rules: [
+                { required: true, message: '请再次输入密码' },
+                { validator: compareToFirstPassword }
+              ]
+            },
+          ]">
+        </a-input>
+      </a-form-item>
+      <!-- <a-col span="16" offset="8"> -->
+      <a-form-item>
+        <div style="text-align: center;">
+          <a-button type="primary" htmlType="submit" :loading="loading">保存</a-button>
+          <a-button @click="handleReset('formCustom')" style="margin-left: 8px">重置</a-button>
+        </div>
+      </a-form-item>
+      <!-- </a-col> -->
+    </a-form>
+  </div>
+  <!-- <a-row :gutter="24" class="change-pwd">
+    <a-col span="16" offset="8">
+
+    </a-col>
+  </a-row> -->
+</template>
+
+<script>
+import { changePwd } from '@/api/login.js'
+import { mapActions } from 'vuex'
+export default {
+  name: 'ResetPwd',
+  data () {
+    return {
+      // formLayout: {
+      //   labelCol: {
+      //     xs: { span: 24 },
+      //     sm: { span: 6 },
+      //     md: { span: 4 }
+      //   },
+      //   wrapperCol: {
+      //     xs: { span: 24 },
+      //     sm: { span: 18 },
+      //     md: { span: 20 }
+      //   }
+      // },
+      formLayout: {
+        labelCol: { span: 4 },
+        wrapperCol: { span: 20 }
+      },
+      form: this.$form.createForm(this),
+      loading: false,
+      formCustom: {
+        passwd: '',
+        passwdCheck: '',
+        oldPwd: ''
+      }
+    }
+  },
+  methods: {
+    ...mapActions(['Logout']),
+    //  密码位数校验
+    passwordValid (rule, value, callback) {
+      if (value.length < 6 || value.length > 12) {
+        callback('请输入6-12位密码!')
+      } else {
+        callback()
+      }
+    },
+    // 密码校验
+    compareToFirstPassword (rule, value, callback) {
+      const form = this.form
+      if (value && value !== form.getFieldValue('formCustom.passwd')) {
+        callback('两次输入的密码不一致, 请重新输入!')
+      } else {
+        callback()
+      }
+    },
+    handleSubmit (e) {
+      e.preventDefault()
+      const _this = this
+      this.form.validateFields((err, values) => {
+        if (!err) {
+          changePwd({
+            oldPassword: values.formCustom.oldPwd,
+            password: values.formCustom.passwd
+          }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success('修改成功, 请重新登录')
+              _this.logout()
+            }
+          })
+        }
+      })
+    },
+    logout () {
+      this.Logout({}).then(() => {
+        setTimeout(() => {
+          this.$router.push({ path: '/user/login' })
+        }, 16)
+      })
+    },
+    handleReset () {
+      this.form.resetFields()
+    }
+  }
+}
+</script>
+
+<style>
+</style>

+ 1 - 1
vue.config.js

@@ -108,7 +108,7 @@ const vueConfig = {
     // If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
     proxy: {
       '/api': {
-        target: 'http://192.168.16.102:8503/qpls-md',
+        target: 'http://192.168.16.103:8503/qpls-md',
         // target: 'http://it.test.zyucgj.com/zyit',
         // target: 'https://it.test.qiubcar.com/zyit',
         ws: false,