xieqy 2 年之前
父節點
當前提交
64c1539b24

+ 28 - 4
package-lock.json

@@ -6080,8 +6080,7 @@
     "base64-js": {
       "version": "1.3.1",
       "resolved": "https://registry.npm.taobao.org/base64-js/download/base64-js-1.3.1.tgz",
-      "integrity": "sha1-WOzoy3XdB+ce0IxzarxfrE2/jfE=",
-      "dev": true
+      "integrity": "sha1-WOzoy3XdB+ce0IxzarxfrE2/jfE="
     },
     "batch": {
       "version": "0.6.1",
@@ -11611,6 +11610,32 @@
         "minimatch": "~3.0.2"
       }
     },
+    "gm-crypto": {
+      "version": "0.1.8",
+      "resolved": "https://registry.npmjs.org/gm-crypto/-/gm-crypto-0.1.8.tgz",
+      "integrity": "sha512-gbTkobkbj3F70HJDQNhN9JNTvcR3O1YQJ0xGc8jTc4bZ1KuikmkjuFm5kZhyUbWxK/PwWDpPuTNyGwRYOopBLw==",
+      "requires": {
+        "buffer": "^5.7.0",
+        "jsbn": "^1.1.0",
+        "to-arraybuffer": "^1.0.1"
+      },
+      "dependencies": {
+        "buffer": {
+          "version": "5.7.1",
+          "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
+          "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
+          "requires": {
+            "base64-js": "^1.3.1",
+            "ieee754": "^1.1.13"
+          }
+        },
+        "jsbn": {
+          "version": "1.1.0",
+          "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz",
+          "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A=="
+        }
+      }
+    },
     "got": {
       "version": "7.1.0",
       "resolved": "https://registry.npm.taobao.org/got/download/got-7.1.0.tgz?cache=0&sync_timestamp=1594899953650&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fgot%2Fdownload%2Fgot-7.1.0.tgz",
@@ -21131,8 +21156,7 @@
     "to-arraybuffer": {
       "version": "1.0.1",
       "resolved": "https://registry.npm.taobao.org/to-arraybuffer/download/to-arraybuffer-1.0.1.tgz",
-      "integrity": "sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M=",
-      "dev": true
+      "integrity": "sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M="
     },
     "to-buffer": {
       "version": "1.1.1",

+ 1 - 0
package.json

@@ -25,6 +25,7 @@
     "echarts-liquidfill": "^2.0.6",
     "echarts-wordcloud": "^2.0.0",
     "element-ui": "^2.15.7",
+    "gm-crypto": "^0.1.8",
     "hls.js": "^1.1.5",
     "html2canvas": "^1.0.0-rc.7",
     "jquery": "^3.5.1",

+ 335 - 335
src/layout/components/Header/AccountApply.vue

@@ -272,377 +272,377 @@
 </template>
 
 <script lang="ts">
-  import { Vue, Component, Prop, Watch } from 'vue-property-decorator'
-  import { accountApplyHistory, accountApplyFill, getCompanyAll, getAllAuditors, getAllDepartments } from '@/api/base'
-  import { getRemoteFile } from '@/api/ftp'
-  import { regPhone, regEmail, regPassword, regUserName, regRealName } from '@/utils/reg'
+import { Vue, Component, Prop, Watch } from 'vue-property-decorator'
+import { accountApplyHistory, accountApplyFill, getCompanyAll, getAllAuditors, getAllDepartments } from '@/api/base'
+import { getRemoteFile } from '@/api/ftp'
+import { regPhone, regEmail, regPassword, regUserName, regRealName } from '@/utils/reg'
 
-  // eslint-disable-next-line no-unused-vars
-  import { ElForm } from 'element-ui/types/form'
+// eslint-disable-next-line no-unused-vars
+import { ElForm } from 'element-ui/types/form'
+import { encryption } from '@/utils/encryption'
 
-  const sha1Hex = require('sha1-hex')
-  const columns = [
-    { prop: 'order', label: '序号', width: '80' },
-    { prop: 'username', label: '登录名' },
-    { prop: 'realName', label: '用户姓名' },
-    { prop: 'createTime', label: '申请时间' },
-    { prop: 'applyername', label: '申请人' },
-    {
-      prop: 'auditstatus',
-      label: '审核意见',
-      formatter: (row, col, cellValue, index) => {
-        if (cellValue === '0') return '不同意'
-        if (cellValue === '1') return '未审核'
-        if (cellValue === '2') return '同意'
-      }
-    },
-    { prop: 'audittime', label: '审核时间' },
-    { label: '操作', scopedSlot: 'actions' }
-  ]
-  const getDefaultVal = () => ({
-    username: '',
-    password: '',
-    realName: '',
-    phone: '',
-    email: '',
-    departmentId: [],
-    recipient: '', // 审核人
-    note: '',
-    job: '',
-    applystate: '',
-    file: '', // 用户头像
-    electronicFile: '' // 电子签名
-  })
+const columns = [
+  { prop: 'order', label: '序号', width: '80' },
+  { prop: 'username', label: '登录名' },
+  { prop: 'realName', label: '用户姓名' },
+  { prop: 'createTime', label: '申请时间' },
+  { prop: 'applyername', label: '申请人' },
+  {
+    prop: 'auditstatus',
+    label: '审核意见',
+    formatter: (row, col, cellValue, index) => {
+      if (cellValue === '0') return '不同意'
+      if (cellValue === '1') return '未审核'
+      if (cellValue === '2') return '同意'
+    }
+  },
+  { prop: 'audittime', label: '审核时间' },
+  { label: '操作', scopedSlot: 'actions' }
+]
+const getDefaultVal = () => ({
+  username: '',
+  password: '',
+  realName: '',
+  phone: '',
+  email: '',
+  departmentId: [],
+  recipient: '', // 审核人
+  note: '',
+  job: '',
+  applystate: '',
+  file: '', // 用户头像
+  electronicFile: '' // 电子签名
+})
 
-  @Component({
-    filters: {
-      formatteAuditStatus(val) {
-        switch (val) {
-          case '0':
-            return '不同意'
+@Component({
+  filters: {
+    formatteAuditStatus(val) {
+      switch (val) {
+        case '0':
+          return '不同意'
 
-          case '1':
-            return '未审核'
+        case '1':
+          return '未审核'
 
-          case '2':
-            return '同意'
-        }
+        case '2':
+          return '同意'
       }
     }
-  })
-  export default class AccountApply extends Vue {
-    @Prop({ default: false }) showApply: boolean
-    formatteAuditStatus: any
-    accountApply = getDefaultVal()
-    accountApplyRules = {
-      username: [
-        { required: true, message: '请输入登录名', trigger: 'blur' },
-        {
-          pattern: regUserName(),
-          message: '4-16位字母与数字,不可包含非法字符!',
-          trigger: 'blur'
-        }
-      ],
-      password: [
-        { required: true, message: '请输入密码', trigger: 'blur' },
-        {
-          pattern: regPassword(),
-          message: '密码位数8-16位,必须包含大小写字母和数字,不可包含非法字符!',
-          trigger: 'blur'
-        }
-      ],
-      realName: [
-        { required: true, message: '请输入用户姓名', trigger: 'blur' },
-        {
-          pattern: regRealName(),
-          message: '2-6位中文字符,不可包含非法字符!',
-          trigger: 'blur'
-        }
-      ],
-      phone: [{ pattern: regPhone(), message: '请输入正确的联系电话', trigger: 'blur' }],
-      email: [{ pattern: regEmail(), message: '请输入正确的邮箱', trigger: 'blur' }],
-      // role: [{ required: true, message: '请输入角色', trigger: 'blur' }],
-      departmentId: [{ required: true, message: '请选择部门', trigger: 'blur' }],
-      recipient: [{ required: true, message: '请选择审核人', trigger: 'blur' }]
-      // sign: [{ required: true, message: '请上传个性签名', trigger: 'blur' }],
-      // applyNote: [
-      //   { required: true, message: '请输入备注信息', trigger: 'blur' }
-      // ],
-      // applyState: [
-      //   { required: true, message: '请输入申请说明', trigger: 'blur' }
-      // ]
-    }
-    accountApplyTab = false
-    applyDetailTab = false
-    columns
-    activeTab = 'history'
-    departmentIdOptions = []
-    recipients = [] // 审核人列表
-    value = ''
-    fileList = []
-    applyRealName = ''
-    applyStatus = ''
-    applyTime = ''
-    applyHistory = []
-    pageSize = 10
-    page = 1
-    total = 0
-    detailInfo = null
-    activeNames = ['baseInfo']
-    esign = ''
-    head = ''
-    @Watch('showApply')
-    showApplyChange(val) {
-      if (val === false) {
-        this.accountApplyTab && (this.$refs.accountApply as ElForm).resetFields()
-        this.accountApplyTab = false
-        this.applyDetailTab = false
-        this.activeTab = 'history'
+  }
+})
+export default class AccountApply extends Vue {
+  @Prop({ default: false }) showApply: boolean
+  formatteAuditStatus: any
+  accountApply = getDefaultVal()
+  accountApplyRules = {
+    username: [
+      { required: true, message: '请输入登录名', trigger: 'blur' },
+      {
+        pattern: regUserName(),
+        message: '4-16位字母与数字,不可包含非法字符!',
+        trigger: 'blur'
       }
+    ],
+    password: [
+      { required: true, message: '请输入密码', trigger: 'blur' },
+      {
+        pattern: regPassword(),
+        message: '密码位数8-16位,必须包含大小写字母和数字,不可包含非法字符!',
+        trigger: 'blur'
+      }
+    ],
+    realName: [
+      { required: true, message: '请输入用户姓名', trigger: 'blur' },
+      {
+        pattern: regRealName(),
+        message: '2-6位中文字符,不可包含非法字符!',
+        trigger: 'blur'
+      }
+    ],
+    phone: [{ pattern: regPhone(), message: '请输入正确的联系电话', trigger: 'blur' }],
+    email: [{ pattern: regEmail(), message: '请输入正确的邮箱', trigger: 'blur' }],
+    // role: [{ required: true, message: '请输入角色', trigger: 'blur' }],
+    departmentId: [{ required: true, message: '请选择部门', trigger: 'blur' }],
+    recipient: [{ required: true, message: '请选择审核人', trigger: 'blur' }]
+    // sign: [{ required: true, message: '请上传个性签名', trigger: 'blur' }],
+    // applyNote: [
+    //   { required: true, message: '请输入备注信息', trigger: 'blur' }
+    // ],
+    // applyState: [
+    //   { required: true, message: '请输入申请说明', trigger: 'blur' }
+    // ]
+  }
+  accountApplyTab = false
+  applyDetailTab = false
+  columns
+  activeTab = 'history'
+  departmentIdOptions = []
+  recipients = [] // 审核人列表
+  value = ''
+  fileList = []
+  applyRealName = ''
+  applyStatus = ''
+  applyTime = ''
+  applyHistory = []
+  pageSize = 10
+  page = 1
+  total = 0
+  detailInfo = null
+  activeNames = ['baseInfo']
+  esign = ''
+  head = ''
+  @Watch('showApply')
+  showApplyChange(val) {
+    if (val === false) {
+      this.accountApplyTab && (this.$refs.accountApply as ElForm).resetFields()
+      this.accountApplyTab = false
+      this.applyDetailTab = false
+      this.activeTab = 'history'
     }
-    departmentId = ''
-    get reviewers() {
-      return (this.recipients || []).filter(({ departmentId: id }) => {
-        return id === this.departmentId
-      })
-    }
-    onDeptChange(val = []) {
-      this.accountApply.recipient = ''
-      this.departmentId = val[val.length - 1] || ''
-    }
-    mounted() {
-      this.columns = columns
-      this.historyList()
-      this.getdepartmentId()
-      this.getAuditors()
-    }
-    // 打开账号申请界面
-    toggleAccountApplyTab() {
-      this.accountApplyTab = true
-      if (this.accountApplyTab) this.activeTab = 'account'
+  }
+  departmentId = ''
+  get reviewers() {
+    return (this.recipients || []).filter(({ departmentId: id }) => {
+      return id === this.departmentId
+    })
+  }
+  onDeptChange(val = []) {
+    this.accountApply.recipient = ''
+    this.departmentId = val[val.length - 1] || ''
+  }
+  mounted() {
+    this.columns = columns
+    this.historyList()
+    this.getdepartmentId()
+    this.getAuditors()
+  }
+  // 打开账号申请界面
+  toggleAccountApplyTab() {
+    this.accountApplyTab = true
+    if (this.accountApplyTab) this.activeTab = 'account'
 
-      console.log(this.recipients)
-    }
-    // 打开申请详情页面
-    toggleAccountApplyDetailTab(data) {
-      this.detailInfo = data
-      this.applyDetailTab = true
-      if (this.applyDetailTab) this.activeTab = 'accountApplyDetail'
-      const arr = [this.detailInfo.avatar, this.detailInfo.esignature]
-      // arr.forEach((item, index) => {
-      // item !== null &&
-      // getRemoteFile(item).then((res) => {
-      //   if (res.status === 200) {
-      //     index === 1
-      //       ? (this.detailInfo.esignature = res.config.url)
-      //       : (this.detailInfo.avatar = res.config.url)
-      //   }
-      // })
+    console.log(this.recipients)
+  }
+  // 打开申请详情页面
+  toggleAccountApplyDetailTab(data) {
+    this.detailInfo = data
+    this.applyDetailTab = true
+    if (this.applyDetailTab) this.activeTab = 'accountApplyDetail'
+    const arr = [this.detailInfo.avatar, this.detailInfo.esignature]
+    // arr.forEach((item, index) => {
+    // item !== null &&
+    // getRemoteFile(item).then((res) => {
+    //   if (res.status === 200) {
+    //     index === 1
+    //       ? (this.detailInfo.esignature = res.config.url)
+    //       : (this.detailInfo.avatar = res.config.url)
+    //   }
+    // })
 
-      // })
-      const { departmentId } = this.accountApply
+    // })
+    const { departmentId } = this.accountApply
 
-      this.detailInfo = {
-        ...this.detailInfo,
-        departmentId: Array.isArray(departmentId) ? [...departmentId].pop() : departmentId,
-        esignature: getRemoteFile(this.detailInfo.esignature),
-        avatar: getRemoteFile(this.detailInfo.avatar)
-      }
+    this.detailInfo = {
+      ...this.detailInfo,
+      departmentId: Array.isArray(departmentId) ? [...departmentId].pop() : departmentId,
+      esignature: getRemoteFile(this.detailInfo.esignature),
+      avatar: getRemoteFile(this.detailInfo.avatar)
     }
-    // 关闭dialog
-    closeDialog() {
-      this.$emit('update:showApply', false)
+  }
+  // 关闭dialog
+  closeDialog() {
+    this.$emit('update:showApply', false)
+  }
+  // 历史申请记录
+  historyList() {
+    const data = {
+      realName: this.applyRealName,
+      auditStatus: this.applyStatus,
+      startAuditTime: (this.applyTime !== null && this.applyTime[0]) || '',
+      endAuditTime: (this.applyTime !== null && this.applyTime[1]) || '',
+      current: this.page,
+      size: this.pageSize
+      // 'orders[0].asc': false,
+      // 'orders[0].column': 'ID'
     }
-    // 历史申请记录
-    historyList() {
-      const data = {
-        realName: this.applyRealName,
-        auditStatus: this.applyStatus,
-        startAuditTime: (this.applyTime !== null && this.applyTime[0]) || '',
-        endAuditTime: (this.applyTime !== null && this.applyTime[1]) || '',
-        current: this.page,
-        size: this.pageSize
-        // 'orders[0].asc': false,
-        // 'orders[0].column': 'ID'
-      }
-      accountApplyHistory(data).then((res) => {
-        this.total = res.result.total
-        res.result.records.forEach((item, index) => {
-          item.order = index + 1
-        })
-        this.applyHistory = res.result.records
+    accountApplyHistory(data).then((res) => {
+      this.total = res.result.total
+      res.result.records.forEach((item, index) => {
+        item.order = index + 1
       })
-    }
-    // 申请账号
-    submitApply() {
-      ;(this.$refs.accountApply as ElForm).validate((valid) => {
-        if (valid) {
-          const data = new FormData()
-          for (const key in this.accountApply) {
-            if (key === 'departmentId') {
-              data.append(
-                key,
-                Array.isArray(this.accountApply[key]) ? [...this.accountApply[key]].pop() : this.accountApply[key]
-              )
-            } else {
-              data.append(key, key === 'password' ? sha1Hex(this.accountApply[key]) : this.accountApply[key])
-            }
+      this.applyHistory = res.result.records
+    })
+  }
+  // 申请账号
+  submitApply() {
+    ;(this.$refs.accountApply as ElForm).validate((valid) => {
+      if (valid) {
+        const data = new FormData()
+        for (const key in this.accountApply) {
+          if (key === 'departmentId') {
+            data.append(
+              key,
+              Array.isArray(this.accountApply[key]) ? [...this.accountApply[key]].pop() : this.accountApply[key]
+            )
+          } else {
+            data.append(key, key === 'password' ? encryption(this.accountApply[key]) : this.accountApply[key])
           }
-          accountApplyFill(data).then((res) => {
-            // 用户存在的时候, 后台返回的数据多包了一层,造成永远都是code = 1, 报错的时候是res.result.code === -1
-            if ((res.result || {}).code === -1) {
-              this.$message({
-                type: 'warning',
-                message: res.result.message
-              })
-              return
-            }
-            if (res.code === 1) {
-              this.$message({
-                type: 'success',
-                message: '用户申请成功'
-              })
-
-              this.accountApplyTab = false
-              this.accountApply = getDefaultVal()
-              this.activeTab = 'history'
-              this.$store.dispatch('user/finnishApply', true)
-              this.historyList()
-            }
-          })
-        } else {
-          return false
         }
-      })
-    }
-    // 上传之前做验证和文件转换
-    beforePicUpload(file, type) {
-      const isJPG = file.type === 'image/jpeg'
-      const isPng = file.type === 'image/png'
-      const isLt2M = file.size / 1024 / 1024 < 2
+        accountApplyFill(data).then((res) => {
+          // 用户存在的时候, 后台返回的数据多包了一层,造成永远都是code = 1, 报错的时候是res.result.code === -1
+          if ((res.result || {}).code === -1) {
+            this.$message({
+              type: 'warning',
+              message: res.result.message
+            })
+            return
+          }
+          if (res.code === 1) {
+            this.$message({
+              type: 'success',
+              message: '用户申请成功'
+            })
 
-      if (!isJPG && !isPng) {
-        this.$message.error('上传图片只能是 JPG或png 格式!')
-        return false
-      }
-      if (!isLt2M) {
-        this.$message.error('上传头像图片大小不能超过 2MB!')
+            this.accountApplyTab = false
+            this.accountApply = getDefaultVal()
+            this.activeTab = 'history'
+            this.$store.dispatch('user/finnishApply', true)
+            this.historyList()
+          }
+        })
+      } else {
         return false
       }
-      const _this = this
-      const reader = new FileReader()
-      type === 'sign' ? (this.accountApply.electronicFile = file) : (this.accountApply.file = file)
-      // 转base64
-      reader.onload = function (e) {
-        type === 'sign' ? (_this.esign = e.target.result.toString()) : (_this.head = e.target.result.toString()) // 将图片路径赋值给src
-      }
-      reader.readAsDataURL(file)
+    })
+  }
+  // 上传之前做验证和文件转换
+  beforePicUpload(file, type) {
+    const isJPG = file.type === 'image/jpeg'
+    const isPng = file.type === 'image/png'
+    const isLt2M = file.size / 1024 / 1024 < 2
+
+    if (!isJPG && !isPng) {
+      this.$message.error('上传图片只能是 JPG或png 格式!')
       return false
     }
-    // 获取部门
-    getdepartmentId() {
-      getAllDepartments().then((res) => {
-        this.departmentIdOptions = res.result || []
-      })
+    if (!isLt2M) {
+      this.$message.error('上传头像图片大小不能超过 2MB!')
+      return false
+    }
+    const _this = this
+    const reader = new FileReader()
+    type === 'sign' ? (this.accountApply.electronicFile = file) : (this.accountApply.file = file)
+    // 转base64
+    reader.onload = function (e) {
+      type === 'sign' ? (_this.esign = e.target.result.toString()) : (_this.head = e.target.result.toString()) // 将图片路径赋值给src
     }
+    reader.readAsDataURL(file)
+    return false
+  }
+  // 获取部门
+  getdepartmentId() {
+    getAllDepartments().then((res) => {
+      this.departmentIdOptions = res.result || []
+    })
+  }
 
-    get deptmentTree() {
-      const getChildren = (parent) => {
-        const { id: parentId } = parent
-        const children = this.departmentIdOptions.filter((item) => item.parentId === parentId)
-        if (!!children.length) parent.children = children.map(getChildren)
-        return parent
-      }
-      return this.departmentIdOptions.filter((item) => !item.parentId).map(getChildren)
+  get deptmentTree() {
+    const getChildren = (parent) => {
+      const { id: parentId } = parent
+      const children = this.departmentIdOptions.filter((item) => item.parentId === parentId)
+      if (!!children.length) parent.children = children.map(getChildren)
+      return parent
     }
+    return this.departmentIdOptions.filter((item) => !item.parentId).map(getChildren)
+  }
 
-    // 获取审核人
-    getAuditors() {
-      getAllAuditors(null).then((res) => {
-        this.recipients = res.result.map((item) => {
-          return {
-            name: item.realName,
-            id: item.id,
-            departmentId: item.departmentId
-          }
-        })
+  // 获取审核人
+  getAuditors() {
+    getAllAuditors(null).then((res) => {
+      this.recipients = res.result.map((item) => {
+        return {
+          name: item.realName,
+          id: item.id,
+          departmentId: item.departmentId
+        }
       })
-    }
-    handleSizeChange(size) {
-      this.pageSize = size
-      this.historyList()
-    }
-    handleCurrentChange(data) {
-      this.page = data
-      this.historyList()
-    }
+    })
+  }
+  handleSizeChange(size) {
+    this.pageSize = size
+    this.historyList()
   }
+  handleCurrentChange(data) {
+    this.page = data
+    this.historyList()
+  }
+}
 </script>
 
 <style lang="scss" scoped>
-  .apply-account-container {
-    display: flex;
-    justify-content: center;
-    align-items: center;
-    .avatar-uploader .el-upload {
-      border: 1px dashed #d9d9d9;
-      border-radius: 6px;
-      cursor: pointer;
-      position: relative;
-      overflow: hidden;
-    }
-    .avatar-uploader .el-upload:hover {
-      border-color: #409eff;
-    }
-    .avatar-uploader-icon {
-      font-size: 28px;
-      color: #8c939d;
-      width: 178px;
-      height: 178px;
-      line-height: 178px;
-      text-align: center;
-    }
-    .avatar {
-      width: 178px;
-      height: 178px;
-      display: block;
-      object-fit: cover;
-    }
-    .msg {
-      color: #c0c4cc;
-      font-size: 12px;
-      line-height: 20px;
-    }
+.apply-account-container {
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  .avatar-uploader .el-upload {
+    border: 1px dashed #d9d9d9;
+    border-radius: 6px;
+    cursor: pointer;
+    position: relative;
+    overflow: hidden;
   }
-  .base-info {
-    .el-row {
-      display: flex;
-      margin-bottom: 20px;
-      .title {
-        display: inline-block;
-        width: 100px;
-        text-align: right;
-      }
-      .title + span,
-      img {
-        display: inline-block;
-        width: 380px;
-      }
-      img {
-        width: 120px;
-      }
-    }
+  .avatar-uploader .el-upload:hover {
+    border-color: #409eff;
   }
-  .custom-row {
+  .avatar-uploader-icon {
+    font-size: 28px;
+    color: #8c939d;
+    width: 178px;
+    height: 178px;
+    line-height: 178px;
+    text-align: center;
+  }
+  .avatar {
+    width: 178px;
+    height: 178px;
+    display: block;
+    object-fit: cover;
+  }
+  .msg {
+    color: #c0c4cc;
+    font-size: 12px;
+    line-height: 20px;
+  }
+}
+.base-info {
+  .el-row {
     display: flex;
     margin-bottom: 20px;
-    span {
+    .title {
       display: inline-block;
-      width: 80%;
-      &.title {
-        width: 100px;
-        text-align: right;
-      }
+      width: 100px;
+      text-align: right;
+    }
+    .title + span,
+    img {
+      display: inline-block;
+      width: 380px;
+    }
+    img {
+      width: 120px;
+    }
+  }
+}
+.custom-row {
+  display: flex;
+  margin-bottom: 20px;
+  span {
+    display: inline-block;
+    width: 80%;
+    &.title {
+      width: 100px;
+      text-align: right;
     }
   }
+}
 </style>

+ 3 - 3
src/layout/components/Header/index.vue

@@ -171,8 +171,8 @@ import { notificationInterval } from 'staticPub/config'
 import { regPassword } from '@/utils/reg'
 import UserInfoEdit from './UserInfoEdit.vue'
 import { gisNames } from '@/utils/constant'
+import { encryption } from '@/utils/encryption'
 
-const sha1Hex = require('sha1-hex')
 @Component({
   name: 'Headerdd',
   components: {
@@ -362,8 +362,8 @@ export default class Header extends Vue {
     }
     changePassword({
       id: this.$store.state.user.userId,
-      originalPassword: sha1Hex(this.originalPassword),
-      password: sha1Hex(this.newPassword),
+      originalPassword: encryption(this.originalPassword),
+      password: encryption(this.newPassword),
       firstlog: 1
     }).then((res) => {
       if (res.code !== -1) {

+ 61 - 78
src/layout/components/Navbar.vue

@@ -1,16 +1,13 @@
 <template>
   <div class="navbarBox">
     <div class="navbar">
-      <hamburger
-        :is-active="sidebar.opened"
-        class="hamburger-container"
-        @toggleClick="toggleSideBar"
-      />
+      <hamburger :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
 
       <breadcrumb class="breadcrumb-container" />
 
       <div class="right-menu">
-        <template v-if="device !== 'mobile'" class="right-menu-btn">
+        <!--  class="right-menu-btn" -->
+        <template v-if="device !== 'mobile'">
           <el-button
             v-if="systemSettingsBtn"
             type="primary"
@@ -38,9 +35,7 @@
             <!-- <el-dropdown-item @click.native="personalCenter">
               个人中心
             </el-dropdown-item> -->
-            <el-dropdown-item @click.native="changePassword">
-              修改密码
-            </el-dropdown-item>
+            <el-dropdown-item @click.native="changePassword"> 修改密码 </el-dropdown-item>
             <el-dropdown-item divided @click.native="logout">
               <span style="display: block">退出登录</span>
             </el-dropdown-item>
@@ -101,29 +96,17 @@
       />
       <span slot="footer" class="dialog-footer">
         <el-button @click="passWord = false">取 消</el-button>
-        <el-button type="primary" @click="confirmModifyPassWord"
-          >确 定</el-button
-        >
+        <el-button type="primary" @click="confirmModifyPassWord">确 定</el-button>
       </span>
     </el-dialog>
-    <el-dialog
-      title="退出重新登录"
-      :visible.sync="dialogPassword"
-      width="500px"
-      center
-    >
+    <el-dialog title="退出重新登录" :visible.sync="dialogPassword" width="500px" center>
       <span>密码修改成功,请退出重新登录。</span>
       <span slot="footer" class="dialog-footer">
         <el-button @click="dialogPassword = false">取 消</el-button>
         <el-button type="primary" @click="confirmOut">确 定</el-button>
       </span>
     </el-dialog>
-    <el-dialog
-      title="系统设置"
-      :visible.sync="dialogConfig"
-      width="600px"
-      custom-class="config"
-    >
+    <el-dialog title="系统设置" :visible.sync="dialogConfig" width="600px" custom-class="config">
       <el-divider />
       <Configure />
     </el-dialog>
@@ -134,76 +117,76 @@
 </template>
 
 <script lang='ts'>
-import { Vue, Component, Prop, Watch } from "vue-property-decorator";
-import { changePassword } from "@/api/base";
-import Breadcrumb from "@/components/Breadcrumb/index.vue";
-import Hamburger from "@/components/Hamburger/index.vue";
-import InputItem from "@/components/FormItem/Input/index.vue";
-import { verification } from "@/utils/index";
-import { geteSessionStorage } from "@/utils/auth";
-import headPortrait from "@/assets/login/headPortrait.gif";
-import Configure from "./Configure/index.vue";
+import { Vue, Component, Prop, Watch } from 'vue-property-decorator'
+import { changePassword } from '@/api/base'
+import Breadcrumb from '@/components/Breadcrumb/index.vue'
+import Hamburger from '@/components/Hamburger/index.vue'
+import InputItem from '@/components/FormItem/Input/index.vue'
+import { verification } from '@/utils/index'
+import { geteSessionStorage } from '@/utils/auth'
+import headPortrait from '@/assets/login/headPortrait.gif'
+import Configure from './Configure/index.vue'
+import { encryption } from '@/utils/encryption'
 
-const sha1Hex = require("sha1-hex");
 @Component({
-  name: "Navbar",
+  name: 'Navbar',
   components: {
     Breadcrumb,
     Hamburger,
     InputItem,
-    Configure,
-  },
+    Configure
+  }
 })
 export default class Navbar extends Vue {
-  headPortrait = headPortrait;
-  ispersonalCenter = false;
-  passWord = false;
-  originalPassword = "";
-  newPassword = "";
-  confirmPassword = "";
-  dialogPassword = false;
-  dialogConfig = false;
-  dialogSwitch = false;
+  headPortrait = headPortrait
+  ispersonalCenter = false
+  passWord = false
+  originalPassword = ''
+  newPassword = ''
+  confirmPassword = ''
+  dialogPassword = false
+  dialogConfig = false
+  dialogSwitch = false
 
   get sidebar() {
-    return this.$store.getters.sidebar;
+    return this.$store.getters.sidebar
   }
   get device() {
-    return this.$store.getters.device;
+    return this.$store.getters.device
   }
   get avatar() {
-    return this.$store.state.user.avatar || geteSessionStorage("avatar");
+    return this.$store.state.user.avatar || geteSessionStorage('avatar')
   }
   get username() {
-    return geteSessionStorage("username");
+    return geteSessionStorage('username')
   }
   get systemSettingsBtn() {
-    return this.$store.state.settings.systemSettingsBtn;
+    return this.$store.state.settings.systemSettingsBtn
   }
   get systemSwitchingBtn() {
-    return this.$store.state.settings.systemSwitchingBtn;
+    return this.$store.state.settings.systemSwitchingBtn
   }
   // 打开或关闭左侧菜单
   toggleSideBar() {
-    this.$store.dispatch("app/toggleSideBar");
+    this.$store.dispatch('app/toggleSideBar')
   }
   // 退出登录
   async logout() {
-    await this.$store.dispatch("user/logout");
-    this.$router.push(`/login?redirect=${this.$route.fullPath}`);
+    await this.$store.dispatch('user/logout')
+    this.$router.push(`/login?redirect=${this.$route.fullPath}`)
   }
   // 个人中心
   personalCenter() {
-    console.log("个人中心");
-    this.ispersonalCenter = true;
+    console.log('个人中心')
+    this.ispersonalCenter = true
   }
   // 修改密码
   changePassword() {
-    console.log("修改密码");
-    this.passWord = true;
-    this.originalPassword = "";
-    this.newPassword = "";
-    this.confirmPassword = "";
+    console.log('修改密码')
+    this.passWord = true
+    this.originalPassword = ''
+    this.newPassword = ''
+    this.confirmPassword = ''
   }
   /**
    * 输入框组件数据绑定方法事件
@@ -211,43 +194,43 @@ export default class Navbar extends Vue {
    * @param {*} event
    */
   onInput(key, event) {
-    this[key] = event;
+    this[key] = event
   }
   // 确定修改密码
   confirmModifyPassWord() {
     const verificationPwd = verification([
-      { condition: !this.originalPassword, errmsg: "请输入原密码" },
-      { condition: !this.newPassword, errmsg: "请输入新密码" },
+      { condition: !this.originalPassword, errmsg: '请输入原密码' },
+      { condition: !this.newPassword, errmsg: '请输入新密码' },
       {
         condition: this.confirmPassword !== this.newPassword,
-        errmsg: "请确认密码",
+        errmsg: '请确认密码'
       },
       {
         condition: this.originalPassword === this.newPassword,
-        errmsg: "新密码和原始密码一样",
-      },
-    ]);
+        errmsg: '新密码和原始密码一样'
+      }
+    ])
     if (!verificationPwd.success) {
-      this.$message.error(verificationPwd.errmsg[0]);
-      return false;
+      this.$message.error(verificationPwd.errmsg[0])
+      return false
     }
     changePassword({
-      password: sha1Hex(this.newPassword),
+      password: encryption(this.newPassword)
     }).then((res) => {
-      this.passWord = false;
-      this.dialogPassword = true;
-    });
+      this.passWord = false
+      this.dialogPassword = true
+    })
   }
   confirmOut() {
-    this.logout();
+    this.logout()
   }
   // 设置
   setConfig() {
-    this.dialogConfig = true;
+    this.dialogConfig = true
   }
   // 切换
   sysSwitch() {
-    this.dialogSwitch = true;
+    this.dialogSwitch = true
   }
 }
 </script>

+ 3 - 3
src/store/modules/user.ts

@@ -1,8 +1,8 @@
-import { login, logout, loginwithcode,gisLogin,mydeskLogin } from '@/api/user'
+import { login, logout, loginwithcode, gisLogin, mydeskLogin } from '@/api/user'
 import { getToken, setToken, removeToken, setSessionStorage, removeSessionStorage } from '@/utils/auth'
 import { getRemoteFile } from '@/api/ftp'
 import { resetRouter } from '@/router'
-const sha1Hex = require('sha1-hex')
+import { encryption } from '@/utils/encryption'
 
 const getDefaultState = () => {
   return {
@@ -55,7 +55,7 @@ const actions = {
     const { username, password, msg } = userInfo
     // setSessionStorage('username', username)
     return new Promise((resolve, reject) => {
-      loginwithcode({ username: username, password: sha1Hex(password), shortMessageCode: msg })
+      loginwithcode({ username: username, password: encryption(password), shortMessageCode: msg })
         .then((response) => {
           // console.log('2222', response)
           // const data = {

+ 10 - 0
src/utils/encryption.ts

@@ -0,0 +1,10 @@
+/* 
+系统密码加密通用方法
+使用国密SM3
+*/
+import { SM3 } from 'gm-crypto';
+
+export const encryption = function (key) {
+    // return SM3.digest(key, 'utf8', 'base64')
+    return SM3.digest(key, 'utf8', 'hex')//输出格式为hex
+}

+ 15 - 0
src/views/currentSystem/authorityManagement/userRights/index.vue

@@ -31,6 +31,19 @@
             :required="false"
             @changeValue="onInput"
           />
+          <input-item
+            can-clear
+            type="text"
+            placeholder="请输入手机号"
+            title="手机号:"
+            nominate="phone"
+            custom-style="display: inline-block"
+            :value="phone"
+            :max-length="50"
+            :disabled="false"
+            :required="false"
+            @changeValue="onInput"
+          />
           <select-item
             can-clear
             placeholder="请选择部门"
@@ -637,6 +650,7 @@ export default class UserRights extends Vue {
   }
   realName = '' // 用户姓名
   username = '' // 登录名
+  phone = '' //手机号
   departmentId = '' // 部门
   enableFlag = '' // 启用状态
   lockFlag = '' // 锁定状态
@@ -1024,6 +1038,7 @@ export default class UserRights extends Vue {
       // userLevel: '1', // 默认只展示为0的用户
       realName: this.realName,
       username: this.username,
+      phone: this.phone,
       departmentId: this.departmentId,
       enableFlag: this.enableFlag,
       lockFlag: this.lockFlag,

+ 279 - 279
src/views/currentSystem/authorityManagement/userRights/mergeUser/index.vue

@@ -101,309 +101,309 @@
 </template>
 
 <script lang="ts">
-  import { Vue, Prop, Component, Watch } from 'vue-property-decorator'
-  import { addUser, editUser, getDeptUserList, getUserList } from '@/api/base'
-  import { getRemoteFile } from '@/api/ftp'
-  import { regNewUserName, regPhone, regEmail } from '@/utils/reg'
-  import { ElForm } from 'element-ui/types/form'
-  import { desCodeConvert } from '@/utils/auth'
-  const sha1Hex = require('sha1-hex')
-  @Component({
-    name: 'MergeUser'
-  })
-  export default class MergeUser extends Vue {
-    @Prop() data!: any // 编辑的数据
-    @Prop(Array) company!: any[] // 单位信息
-    @Prop(Array) optionsRole!: any[]
-    ruleForm = {
-      username: '',
-      // password: '',
-      realName: '',
-      phone: '',
-      email: '',
-      departmentId: [],
-      roles: [],
-      job: '',
-      note: '',
-      file: '',
-      electronicFile: ''
-    }
-    form = {
-      avatar: '',
-      signPic: '',
-      imageUrl: ''
-    }
-    rules = {
-      username: [
-        { required: true, message: '请输入登录名', trigger: 'blur' },
-        {
-          pattern: regNewUserName(),
-          message: '登录名只能输入英文、数字',
-          trigger: 'blur'
-        }
-      ],
-      password: [
-        { required: true, message: '请输入密码', trigger: 'blur' },
-        { min: 6, max: 12, message: '长度在 6 到 12 个字符', trigger: 'blur' }
-      ],
-      realName: [{ required: true, message: '请输入用户姓名', trigger: 'blur' }],
-      phone: [{ required: true, pattern: regPhone(), message: '请输入正确联系手机号', trigger: 'blur' }],
-      email: [{ pattern: regEmail(), message: '请输入正确邮箱', trigger: 'blur' }],
-      departmentId: [{ required: true, message: '请选择部门', trigger: 'change' }],
-      roles: [{ required: true, message: '请选择角色', trigger: 'change' }]
-    }
-    difference = false
-
-    copyRole = [] //选择的复制角色用户
-    copyUsers = [] // 用户列表
-    created() {
-      // console.log("333", JSON.stringify(this.data));
-      this.difference = JSON.stringify(this.data) !== '{}'
-      if (this.difference) {
-        this.handleEdit()
+import { Vue, Prop, Component, Watch } from 'vue-property-decorator'
+import { addUser, editUser, getDeptUserList, getUserList } from '@/api/base'
+import { getRemoteFile } from '@/api/ftp'
+import { regNewUserName, regPhone, regEmail } from '@/utils/reg'
+import { ElForm } from 'element-ui/types/form'
+import { desCodeConvert } from '@/utils/auth'
+import { encryption } from '@/utils/encryption'
+@Component({
+  name: 'MergeUser'
+})
+export default class MergeUser extends Vue {
+  @Prop() data!: any // 编辑的数据
+  @Prop(Array) company!: any[] // 单位信息
+  @Prop(Array) optionsRole!: any[]
+  ruleForm = {
+    username: '',
+    // password: '',
+    realName: '',
+    phone: '',
+    email: '',
+    departmentId: [],
+    roles: [],
+    job: '',
+    note: '',
+    file: '',
+    electronicFile: ''
+  }
+  form = {
+    avatar: '',
+    signPic: '',
+    imageUrl: ''
+  }
+  rules = {
+    username: [
+      { required: true, message: '请输入登录名', trigger: 'blur' },
+      {
+        pattern: regNewUserName(),
+        message: '登录名只能输入英文、数字',
+        trigger: 'blur'
       }
+    ],
+    password: [
+      { required: true, message: '请输入密码', trigger: 'blur' },
+      { min: 6, max: 12, message: '长度在 6 到 12 个字符', trigger: 'blur' }
+    ],
+    realName: [{ required: true, message: '请输入用户姓名', trigger: 'blur' }],
+    phone: [{ required: true, pattern: regPhone(), message: '请输入正确联系手机号', trigger: 'blur' }],
+    email: [{ pattern: regEmail(), message: '请输入正确邮箱', trigger: 'blur' }],
+    departmentId: [{ required: true, message: '请选择部门', trigger: 'change' }],
+    roles: [{ required: true, message: '请选择角色', trigger: 'change' }]
+  }
+  difference = false
 
-      // if(typeof(this.data.username) !== 'undefined'){
-      //   this.handleEdit()
-      // }else{
-      //   this.ruleForm.roles = this.data.roles
-      // }
-
-      //获取用户信息
-      this.getCopyDeptUserList()
+  copyRole = [] //选择的复制角色用户
+  copyUsers = [] // 用户列表
+  created() {
+    // console.log("333", JSON.stringify(this.data));
+    this.difference = JSON.stringify(this.data) !== '{}'
+    if (this.difference) {
+      this.handleEdit()
     }
-    // 上传之前的钩子函数
-    beforeAvatarUpload(file, type) {
-      const isJPG = file.type === 'image/jpeg'
-      const isPng = file.type === 'image/png'
-      const isLt2M = file.size / 1024 / 1024 < 2
 
-      if (!isJPG && !isPng) {
-        this.$message.error('上传图片只能是 JPG或png 格式!')
-        return false
-      }
-      if (!isLt2M) {
-        this.$message.error('上传头像图片大小不能超过 2MB!')
-        return false
-      }
-      // console.log('2222', file)
-      type === 'avatar' ? (this.ruleForm.file = file) : (this.ruleForm.electronicFile = file)
-      const _this = this
-      const reader = new FileReader()
-      // 转base64
-      reader.onload = function (e) {
-        type === 'sign'
-          ? (_this.form.signPic = e.target.result.toString())
-          : (_this.form.avatar = e.target.result.toString()) // 将图片路径赋值给src
-      }
-      reader.readAsDataURL(file)
-      return false // 屏蔽了action的默认上传
+    // if(typeof(this.data.username) !== 'undefined'){
+    //   this.handleEdit()
+    // }else{
+    //   this.ruleForm.roles = this.data.roles
+    // }
+
+    //获取用户信息
+    this.getCopyDeptUserList()
+  }
+  // 上传之前的钩子函数
+  beforeAvatarUpload(file, type) {
+    const isJPG = file.type === 'image/jpeg'
+    const isPng = file.type === 'image/png'
+    const isLt2M = file.size / 1024 / 1024 < 2
+
+    if (!isJPG && !isPng) {
+      this.$message.error('上传图片只能是 JPG或png 格式!')
+      return false
     }
-    // 图片上传成功实现本地预览
-    handleAvatarSuccess(res, file) {
-      this.form.imageUrl = URL.createObjectURL(file.raw) // 表单获取到提交时要传的图片路径
+    if (!isLt2M) {
+      this.$message.error('上传头像图片大小不能超过 2MB!')
+      return false
     }
-    // 重置
-    resetFields() {
-      ;(this.$refs.ruleForm as ElForm).resetFields()
+    // console.log('2222', file)
+    type === 'avatar' ? (this.ruleForm.file = file) : (this.ruleForm.electronicFile = file)
+    const _this = this
+    const reader = new FileReader()
+    // 转base64
+    reader.onload = function (e) {
+      type === 'sign'
+        ? (_this.form.signPic = e.target.result.toString())
+        : (_this.form.avatar = e.target.result.toString()) // 将图片路径赋值给src
     }
-    // 拼接数据
-    readyData() {
-      const data = new FormData()
-      // data.append('file', this.ruleForm.file)// 图片
-      // 传其他参数
-      for (const key in this.ruleForm) {
-        if (key === 'departmentId') {
-          data.append(key, Array.isArray(this.ruleForm[key]) ? [...this.ruleForm[key]].pop() : this.ruleForm[key])
-        } else if (key === 'password') {
-          data.append(key, sha1Hex(this.ruleForm[key]))
-        } else if (key === 'roles') {
-          data.append(key, this.ruleForm[key].toString())
-        } else if (key === 'phone') {
-          data.append(key, desCodeConvert(this.ruleForm[key], true, false))
-        } else if (key === 'email') {
-          data.append(key, desCodeConvert(this.ruleForm[key], true, false))
-        }
-        // else if (key === 'phone' || key === 'email' || key === 'job' || key === 'note') {
-        //   let tempVal = this.ruleForm[key] + ''
-        //   if (this.strIsNull(tempVal)) {
-        //     tempVal = 'null'
-        //   }
-        //   data.append(key, tempVal)
-        // }
-        else {
-          data.append(key, this.ruleForm[key])
-        }
-        // }
+    reader.readAsDataURL(file)
+    return false // 屏蔽了action的默认上传
+  }
+  // 图片上传成功实现本地预览
+  handleAvatarSuccess(res, file) {
+    this.form.imageUrl = URL.createObjectURL(file.raw) // 表单获取到提交时要传的图片路径
+  }
+  // 重置
+  resetFields() {
+    ;(this.$refs.ruleForm as ElForm).resetFields()
+  }
+  // 拼接数据
+  readyData() {
+    const data = new FormData()
+    // data.append('file', this.ruleForm.file)// 图片
+    // 传其他参数
+    for (const key in this.ruleForm) {
+      if (key === 'departmentId') {
+        data.append(key, Array.isArray(this.ruleForm[key]) ? [...this.ruleForm[key]].pop() : this.ruleForm[key])
+      } else if (key === 'password') {
+        data.append(key, encryption(this.ruleForm[key]))
+      } else if (key === 'roles') {
+        data.append(key, this.ruleForm[key].toString())
+      } else if (key === 'phone') {
+        data.append(key, desCodeConvert(this.ruleForm[key], true, false))
+      } else if (key === 'email') {
+        data.append(key, desCodeConvert(this.ruleForm[key], true, false))
       }
-      // 编辑添加id
-      if (this.difference) {
-        data.append('id', this.data.id)
+      // else if (key === 'phone' || key === 'email' || key === 'job' || key === 'note') {
+      //   let tempVal = this.ruleForm[key] + ''
+      //   if (this.strIsNull(tempVal)) {
+      //     tempVal = 'null'
+      //   }
+      //   data.append(key, tempVal)
+      // }
+      else {
+        data.append(key, this.ruleForm[key])
       }
-      return data
-    }
-    // 提交
-    submitForm() {
-      const _this = this
-      ;(this.$refs.ruleForm as ElForm).validate((valid) => {
-        if (valid) {
-          const data = _this.readyData()
-          // console.log('file', data, _this.file)
-          if (!this.difference) {
-            _this.newAddUser(data)
-          } else {
-            _this.editSubmit(data)
-          }
-          return true
-        }
-      })
+      // }
     }
-
-    // 新增提交
-    newAddUser(data) {
-      const _this = this
-      addUser(data).then((res) => {
-        if (res.code !== -1) {
-          if (res.result.code === -1) {
-            this.$message.error(res.result.message)
-          } else {
-            _this.$message.success('新增成功')
-            _this.$emit('remind', '成功')
-            _this.resetFields()
-          }
-        }
-      })
+    // 编辑添加id
+    if (this.difference) {
+      data.append('id', this.data.id)
     }
-    // 修改提交
-    editSubmit(data) {
-      const _this = this
-      editUser(data).then((res) => {
-        if (res.code !== -1) {
-          if (res.result.code === -1) {
-            this.$message.error(res.result.message)
-          } else {
-            _this.$message.success('修改成功')
-            _this.$emit('remind', '成功')
-            _this.resetFields()
-          }
+    return data
+  }
+  // 提交
+  submitForm() {
+    const _this = this
+    ;(this.$refs.ruleForm as ElForm).validate((valid) => {
+      if (valid) {
+        const data = _this.readyData()
+        // console.log('file', data, _this.file)
+        if (!this.difference) {
+          _this.newAddUser(data)
+        } else {
+          _this.editSubmit(data)
         }
-      })
-    }
+        return true
+      }
+    })
+  }
 
-    // 编辑参数回显
-    handleEdit() {
-      this.ruleForm = this.assignment(this.ruleForm, this.data) as any
-      // const arr = [this.data.avatar, this.data.esignature]
-      // arr.forEach((item, index) => {
-      //   if (item === null) return
-      //   getRemoteFile(item).then((res) => {
-      //     if (res.status === 200) {
-      //       index === 1 ? (this.form.signPic = res.config.url) : (this.form.avatar = res.config.url)
-      //     }
-      //   })
-      // })
-      this.form = {
-        ...this.form,
-        signPic: getRemoteFile(this.data.esignature),
-        avatar: getRemoteFile(this.data.avatar)
+  // 新增提交
+  newAddUser(data) {
+    const _this = this
+    addUser(data).then((res) => {
+      if (res.code !== -1) {
+        if (res.result.code === -1) {
+          this.$message.error(res.result.message)
+        } else {
+          _this.$message.success('新增成功')
+          _this.$emit('remind', '成功')
+          _this.resetFields()
+        }
       }
-    }
-    // 赋值
-    assignment(par, role) {
-      const data = {}
-      for (const key in par) {
-        if (key === 'departmentId') {
-          data[key] = typeof role[key] === 'string' ? [role[key]] : Array.isArray(role[key]) ? role[key] : role[key]
-        } else if (key === 'roles') {
-          data[key] = role.roleIdList && role.roleIdList != null && role.roleIdList.split(',')
+    })
+  }
+  // 修改提交
+  editSubmit(data) {
+    const _this = this
+    editUser(data).then((res) => {
+      if (res.code !== -1) {
+        if (res.result.code === -1) {
+          this.$message.error(res.result.message)
         } else {
-          data[key] = role[key]
+          _this.$message.success('修改成功')
+          _this.$emit('remind', '成功')
+          _this.resetFields()
         }
       }
-      return data
-    }
+    })
+  }
 
-    /**
-     * @description 获取用户信息
-     */
-    getCopyDeptUserList() {
-      let deptId = this.ruleForm.departmentId
-      // console.log('部门编码:' + deptId)
-      let data = {
-        userLevel: 1,
-        departmentId: Array.isArray(deptId) ? [...deptId].pop() : deptId,
-        current: 1,
-        size: 10000000
+  // 编辑参数回显
+  handleEdit() {
+    this.ruleForm = this.assignment(this.ruleForm, this.data) as any
+    // const arr = [this.data.avatar, this.data.esignature]
+    // arr.forEach((item, index) => {
+    //   if (item === null) return
+    //   getRemoteFile(item).then((res) => {
+    //     if (res.status === 200) {
+    //       index === 1 ? (this.form.signPic = res.config.url) : (this.form.avatar = res.config.url)
+    //     }
+    //   })
+    // })
+    this.form = {
+      ...this.form,
+      signPic: getRemoteFile(this.data.esignature),
+      avatar: getRemoteFile(this.data.avatar)
+    }
+  }
+  // 赋值
+  assignment(par, role) {
+    const data = {}
+    for (const key in par) {
+      if (key === 'departmentId') {
+        data[key] = typeof role[key] === 'string' ? [role[key]] : Array.isArray(role[key]) ? role[key] : role[key]
+      } else if (key === 'roles') {
+        data[key] = role.roleIdList && role.roleIdList != null && role.roleIdList.split(',')
+      } else {
+        data[key] = role[key]
       }
-      getUserList(data).then((res) => {
-        //console.log(res);
-        this.copyUsers = res.result.records
-      })
     }
+    return data
+  }
 
-    /**
-     * @description 获取选中用户的角色,并赋值
-     */
-    copyRoleChange(roleAry) {
-      // console.log('参数:' + roleAry)
-      //筛选出角色
-      let roleUsers = this.copyUsers.filter((item, index) => {
-        return roleAry.includes(item.id)
-      })
-
-      let roleIdAry = []
-      //获取选中的角色数据
-      roleUsers.forEach((userinfo) => {
-        let roleIdList = userinfo.roleIdList
-        if (!this.strIsNull(roleIdList)) {
-          let roleIds = roleIdList.split(',')
-          //角色ID
-          roleIds.forEach((roleId) => {
-            roleIdAry.push(roleId)
-          })
-        }
-      })
-      let roleId = Array.from(new Set(roleIdAry))
-      this.ruleForm.roles = roleId
+  /**
+   * @description 获取用户信息
+   */
+  getCopyDeptUserList() {
+    let deptId = this.ruleForm.departmentId
+    // console.log('部门编码:' + deptId)
+    let data = {
+      userLevel: 1,
+      departmentId: Array.isArray(deptId) ? [...deptId].pop() : deptId,
+      current: 1,
+      size: 10000000
     }
+    getUserList(data).then((res) => {
+      //console.log(res);
+      this.copyUsers = res.result.records
+    })
+  }
 
-    /*
-     * @description 判断字符串是否为空
-     */
-    strIsNull(strVal) {
-      strVal = strVal || ''
-      return typeof strVal == 'undefined' || strVal == null || strVal == ''
-    }
+  /**
+   * @description 获取选中用户的角色,并赋值
+   */
+  copyRoleChange(roleAry) {
+    // console.log('参数:' + roleAry)
+    //筛选出角色
+    let roleUsers = this.copyUsers.filter((item, index) => {
+      return roleAry.includes(item.id)
+    })
+
+    let roleIdAry = []
+    //获取选中的角色数据
+    roleUsers.forEach((userinfo) => {
+      let roleIdList = userinfo.roleIdList
+      if (!this.strIsNull(roleIdList)) {
+        let roleIds = roleIdList.split(',')
+        //角色ID
+        roleIds.forEach((roleId) => {
+          roleIdAry.push(roleId)
+        })
+      }
+    })
+    let roleId = Array.from(new Set(roleIdAry))
+    this.ruleForm.roles = roleId
   }
+
+  /*
+   * @description 判断字符串是否为空
+   */
+  strIsNull(strVal) {
+    strVal = strVal || ''
+    return typeof strVal == 'undefined' || strVal == null || strVal == ''
+  }
+}
 </script>
 <style lang="scss" scoped>
-  .avatar-uploader .el-upload {
-    border: 1px dashed #d9d9d9;
-    border-radius: 6px;
-    cursor: pointer;
-    position: relative;
-    overflow: hidden;
-  }
-  .avatar-uploader .el-upload:hover {
-    border-color: #409eff;
-  }
-  .avatar-uploader-icon {
-    font-size: 28px;
-    color: #8c939d;
-    width: 178px;
-    height: 178px;
-    line-height: 178px;
-    text-align: center;
-  }
-  .avatar {
-    width: 178px;
-    height: 178px;
-    display: block;
-    // object-fit: cover;
-  }
-  .msg {
-    color: #c0c4cc;
-    font-size: 12px;
-    line-height: 20px;
-  }
+.avatar-uploader .el-upload {
+  border: 1px dashed #d9d9d9;
+  border-radius: 6px;
+  cursor: pointer;
+  position: relative;
+  overflow: hidden;
+}
+.avatar-uploader .el-upload:hover {
+  border-color: #409eff;
+}
+.avatar-uploader-icon {
+  font-size: 28px;
+  color: #8c939d;
+  width: 178px;
+  height: 178px;
+  line-height: 178px;
+  text-align: center;
+}
+.avatar {
+  width: 178px;
+  height: 178px;
+  display: block;
+  // object-fit: cover;
+}
+.msg {
+  color: #c0c4cc;
+  font-size: 12px;
+  line-height: 20px;
+}
 </style>

+ 13 - 11
src/views/gislogin/index.vue

@@ -13,7 +13,6 @@ import { userFirstLogin, getMsgCode } from '@/api/user'
 import { changePassword } from '@/api/base'
 import { regNewPassword } from '@/utils/reg'
 import { ElForm } from 'element-ui/types/form'
-const sha1Hex = require('sha1-hex')
 const defaultPwd = '000000'
 import { sysTitle } from '@/settings'
 
@@ -92,16 +91,19 @@ export default class Login extends Vue {
    * @param {*} token
    */
   loginWithTokenCheck(token, prjcode) {
-    this.$store.dispatch('user/gisLogin', { token: token }).then((result) => {
-      if (result.code === 1) {
-        setTimeout(() => {
-          //this.$router.push({ path: '/prjSelection' })
-          this.$router.push({ path: '/' })
-        }, 0)
-      }
-    }).catch(err=>{
-      console.error(err);
-    })
+    this.$store
+      .dispatch('user/gisLogin', { token: token })
+      .then((result) => {
+        if (result.code === 1) {
+          setTimeout(() => {
+            //this.$router.push({ path: '/prjSelection' })
+            this.$router.push({ path: '/' })
+          }, 0)
+        }
+      })
+      .catch((err) => {
+        console.error(err)
+      })
   }
   @Watch('$route', { immediate: true })
   changeValue(route, oldvalue) {

+ 8 - 4
src/views/groupPage/baseMap/components/EchartsMap.vue

@@ -530,6 +530,7 @@ export default {
     },
     //地图初始化
     mapInit() {
+      console.log('加载一次')
       var that = this
       //容器加载
       this.groupChart = echarts.init(this.$refs.middleMap)
@@ -762,11 +763,14 @@ export default {
           notMerge: true
         })
       }
-      domImg.onload = () => {
-        // setTimeout(() => {
+      // domImg.onload = () => {
+      //   // setTimeout(() => {
+      //   mapInitialize()
+      //   // }, 1000)
+      // }
+      setTimeout(() => {
         mapInitialize()
-        // }, 1000)
-      }
+      }, 1000)
       //地图点击事件
       if (this.clickSymbol == 0) {
         // this.chartRegionClickEvent()

+ 29 - 7
src/views/login/index.vue

@@ -64,7 +64,10 @@
         <el-button type="button" class="login-btn" :loading="loading" @click.native.prevent="handleLogin"
           >登录</el-button
         >
-        <el-button type="text" class="forgetpsw-btn" @click="resetPsw()">忘记密码?</el-button>
+        <el-button type="text" class="forgetpsw-btn" style="left: 38%" @click="resetPsw()">忘记密码?</el-button>
+        <el-button type="text" class="forgetpsw-btn" style="left: 60%" @click="modifyPsw()"
+          >修改密码<i class="el-icon-edit"></i
+        ></el-button>
       </div>
     </div>
     <el-dialog
@@ -105,8 +108,10 @@
       </template>
     </el-dialog>
     <ResetPsw
+      :title="isReset ? '重置密码' : '修改密码'"
       :visible="resetPswDialog"
       :username="loginForm.username"
+      :isReset="isReset"
       @add="setContent"
       @cancel="resetPswDialog = false"
     />
@@ -121,8 +126,8 @@ import { regNewPassword } from '@/utils/reg'
 import { ElForm } from 'element-ui/types/form'
 import { sysTitle } from '@/settings'
 import ResetPsw from './resetPsw.vue'
+import { encryption } from '@/utils/encryption'
 
-const sha1Hex = require('sha1-hex')
 const defaultPwd = '000000'
 
 @Component({ components: { ResetPsw } })
@@ -164,6 +169,7 @@ export default class Login extends Vue {
   }
   //重置密码
   resetPswDialog = false // 重置密码用弹窗显隐控制
+  isReset = true // 重置or修改
   /**mydesk登录验证 */
   beforeMount() {
     const search = window.location.hash.split('?')[1]
@@ -258,7 +264,6 @@ export default class Login extends Vue {
   // 登录
   handleLogin() {
     ;(this.$refs.loginForm as ElForm).validate((valid) => {
-      // console.log('111222', this.loginForm)
       if (valid) {
         this.loading = true
         /**
@@ -285,7 +290,6 @@ export default class Login extends Vue {
             // 判断是否首次登录或者重置过密码
             userFirstLogin(id)
               .then((res) => {
-                console.log(res)
                 // 先判断用户是否被禁用了 如果是申请的用户 还需要要判断是否同意申请了
                 const { auditstatus, enableFlag } = res.result
                 if (enableFlag === '0') {
@@ -378,10 +382,10 @@ export default class Login extends Vue {
       ;(this.$refs.changePwdForm as ElForm).validate((valid) => {
         if (valid) {
           const data = {
-            originalPassword: sha1Hex(defaultPwd),
+            originalPassword: encryption(defaultPwd),
             id: this.userId,
             firstlog: 0,
-            password: sha1Hex(this.changePwd.checkPass)
+            password: encryption(this.changePwd.checkPass)
           }
           changePassword(data).then((res) => {
             if (res.code !== -1) {
@@ -419,6 +423,7 @@ export default class Login extends Vue {
   //重置密码弹窗
   resetPsw() {
     this.resetPswDialog = true
+    this.isReset = true
   }
 
   setContent(val) {
@@ -426,6 +431,12 @@ export default class Login extends Vue {
     this.loginForm.password = password
     this.loginForm.msg = code
   }
+
+  //修改密码
+  modifyPsw() {
+    this.resetPswDialog = true
+    this.isReset = false
+  }
 }
 </script>
 
@@ -536,10 +547,21 @@ export default class Login extends Vue {
       }
       .forgetpsw-btn {
         position: absolute;
-        bottom: 45px;
+        // bottom: 45px;
+        bottom: 7px;
         left: 50%;
         margin-left: -28px;
       }
+      .forgetpsw-btn:last-child::before {
+        content: '';
+        position: absolute;
+        height: 12px;
+        width: 1px;
+        background: #01a2ff;
+        margin: 0 auto;
+        left: -10px;
+        bottom: 12px;
+      }
     }
   }
 }

+ 128 - 0
src/views/login/modifyPsw.vue

@@ -0,0 +1,128 @@
+<template>
+  <el-dialog
+    title="修改密码"
+    :visible.sync="visible"
+    width="400px"
+    top="25vh"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    :show-close="false"
+    append-to-body
+  >
+    <!-- <span>修改密码</span> -->
+    <input-item
+      type="password"
+      placeholder="请输入原始密码"
+      title="原密码:"
+      nominate="originalPassword"
+      custom-style="width: 320px;line-height:32px;"
+      :value="originalPassword"
+      :max-length="50"
+      :disabled="false"
+      :required="true"
+      @changeValue="onInput"
+    />
+    <input-item
+      type="password"
+      placeholder="请输入新密码"
+      title="新密码:"
+      nominate="newPassword"
+      custom-style="width: 320px;line-height:32px; margin: 20px 0"
+      :value="newPassword"
+      :max-length="50"
+      :disabled="false"
+      :required="true"
+      @changeValue="onInput"
+    />
+    <input-item
+      type="password"
+      placeholder="请确认密码"
+      title="确认密码:"
+      nominate="confirmPassword"
+      custom-style="width: 320px;line-height:32px;"
+      :value="confirmPassword"
+      :max-length="50"
+      :disabled="false"
+      :required="true"
+      @changeValue="onInput"
+    />
+    <span slot="footer" class="dialog-footer">
+      <el-button @click="cancel()">取 消</el-button>
+      <el-button type="primary" @click="confirmModifyPassWord">确 定</el-button>
+    </span>
+  </el-dialog>
+</template>
+
+<script lang="ts">
+import { Vue, Component, Watch, Prop } from 'vue-property-decorator'
+import { changePassword } from '@/api/base'
+import { verification } from '@/utils/index'
+import { regPassword } from '@/utils/reg'
+import InputItem from '@/components/FormItem/Input/index.vue'
+
+import { encryption } from '@/utils/encryption'
+
+//修改密码
+@Component({ name: 'modifyPsw', components: { InputItem } })
+export default class modifyPsw extends Vue {
+  @Prop({ type: Boolean, default: false }) visible!: any
+  @Prop({ type: Object, default: () => {} }) modifyParam!: object
+
+  originalPassword = ''
+  newPassword = ''
+  confirmPassword = ''
+  dialogPassword = false
+  // 确定修改密码
+  confirmModifyPassWord() {
+    const verificationPwd = verification([
+      { condition: !this.originalPassword, errmsg: '请输入原密码' },
+      { condition: !this.newPassword, errmsg: '请输入新密码' },
+      {
+        condition: !regPassword().test(this.newPassword),
+        errmsg: '密码包含大小写字母和数字,不可有非法字符!'
+      },
+      {
+        condition: this.confirmPassword !== this.newPassword,
+        errmsg: '两次密码输入不相同!'
+      },
+      {
+        condition: this.originalPassword === this.newPassword,
+        errmsg: '新密码和原始密码一样'
+      }
+    ])
+    if (!verificationPwd.success) {
+      this.$message.error(verificationPwd.errmsg[0])
+      return false
+    }
+    let params = {
+      ...this.modifyParam,
+      originalPassword: encryption(this.originalPassword),
+      password: encryption(this.newPassword)
+    }
+    changePassword(params).then((res) => {
+      if (res.code !== -1) {
+        this.$message.success('密码修改成功')
+        this.$emit('refresh', this.newPassword)
+        this.cancel()
+      }
+    })
+  }
+  /**
+   * 输入框组件数据绑定方法事件
+   * @param {*} key
+   * @param {*} event
+   */
+  onInput(key, event) {
+    this[key] = event
+  }
+  cancel() {
+    this.originalPassword = ''
+    this.newPassword = ''
+    this.confirmPassword = ''
+    this.$emit('close')
+  }
+}
+</script>
+
+<style>
+</style>

+ 48 - 15
src/views/login/resetPsw.vue

@@ -1,7 +1,7 @@
 <template>
   <el-dialog
-    title="重置密码"
-    :visible.sync="visible"
+    :title="title"
+    :visible.sync="dialogVisible"
     append-to-body
     width="520px"
     top="25vh"
@@ -72,6 +72,7 @@
       <el-button type="primary" v-if="isAuth" @click="confirm()">确定</el-button>
       <el-button type="primary" v-else @click="getNext()">下一步</el-button>
     </template>
+    <ModifyPsw :visible="isModify" :modifyParam="modifyParam" @refresh="refreshPass" @close="cancel()" />
   </el-dialog>
 </template>
 
@@ -80,21 +81,35 @@ import { Vue, Component, Watch, Prop } from 'vue-property-decorator'
 import { regPhone, regNewPassword } from '@/utils/reg'
 import { ElForm } from 'element-ui/types/form'
 import { authcodeAdd, authcodeCheck, updatePasswordByUser } from '@/api/base'
-const sha1Hex = require('sha1-hex')
+import ModifyPsw from './modifyPsw.vue'
+import { encryption } from '@/utils/encryption'
+
 //重置密码
-@Component({})
-export default class Login extends Vue {
+@Component({ name: 'resetPsw', components: { ModifyPsw } })
+export default class resetPsw extends Vue {
+  @Prop({ type: String, default: '' }) title!: string
   @Prop({ type: Boolean, default: false }) visible!: any
   @Prop({ type: String, default: '' }) username!: string
+  @Prop({ type: Boolean, default: true }) isReset!: any
 
   @Watch('username', { immediate: true })
   onChange(val) {
     this.userForm.user = val
   }
 
+  @Watch('visible', { immediate: true })
+  onVisibleChange(val) {
+    this.dialogVisible = val
+  }
+
+  dialogVisible = false
+
   passParam = null
   isPass = false
   isAuth = false
+  isModify = false
+
+  modifyParam = null
 
   userForm = { user: '' }
 
@@ -119,16 +134,22 @@ export default class Login extends Vue {
             if (new RegExp(regPhone()).test(value)) {
               this.passParam = { phoneNumber: value }
               const res = await authcodeAdd(this.passParam)
-              this.$message.success(res.result)
-              if (res.code == 1) this.isPass = true
+              if (res.code == 1) {
+                this.$message.success(res.result)
+                this.isPass = true
+                this.modifyParam = { username: value }
+              }
             } else {
               this.$message.warning('请输入正确的手机号!')
             }
           } else {
             this.passParam = { username: value }
             const res = await authcodeAdd(this.passParam)
-            this.$message.success(res.result)
-            if (res.code == 1) this.isPass = true
+            if (res.code == 1) {
+              this.$message.success(res.result)
+              this.isPass = true
+              this.modifyParam = { username: value }
+            }
           }
         }
       })
@@ -137,11 +158,15 @@ export default class Login extends Vue {
         if (valid) {
           const res = await authcodeCheck({ ...this.passParam, codeInput: this.authCodeForm.code })
           if (res.result == 1) {
-            this.isAuth = true
+            if (this.isReset) {
+              this.isAuth = true
+            } else {
+              this.dialogVisible = false
+              this.isModify = true
+            }
             setTimeout(() => {
               this.authCodeForm.code = ''
             }, 60000)
-            console.log(this.authCodeForm)
           } else {
             this.$message.warning('信息验证失败')
           }
@@ -176,12 +201,13 @@ export default class Login extends Vue {
       if (valid) {
         const data = {
           ...this.passParam,
-          password: sha1Hex(this.restForm.checkPass)
+          password: encryption(this.restForm.checkPass)
         }
         updatePasswordByUser(data).then((res) => {
           if (res.code == 1) {
             this.$message.success('重置密码成功!')
-            this.$emit('add', { password: this.restForm.checkPass, code: this.authCodeForm.code })
+            // this.$emit('add', { password: this.restForm.checkPass, code: this.authCodeForm.code })
+            this.refreshPass(this.restForm.checkPass)
             this.reset()
             this.$emit('cancel')
           }
@@ -190,6 +216,10 @@ export default class Login extends Vue {
     })
   }
 
+  refreshPass(password) {
+    this.$emit('add', { password, code: this.authCodeForm.code })
+  }
+
   cancel() {
     try {
       this.reset()
@@ -200,10 +230,12 @@ export default class Login extends Vue {
   }
 
   reset() {
-    this.isPass = false
     this.passParam = null
+
+    this.isPass = false
     this.isAuth = false
-    this.userForm = { user: '' }
+    this.isModify = false
+    // this.userForm = { user: '' }
     this.authCodeForm = { code: '' }
     this.restForm = {
       pass: '',
@@ -211,6 +243,7 @@ export default class Login extends Vue {
     }
     if (this.$refs.userForm) (this.$refs.userForm as ElForm).resetFields()
     if (this.$refs.authCodeForm) (this.$refs.authCodeForm as ElForm).resetFields()
+    if (this.$refs.restForm) (this.$refs.restForm as ElForm).resetFields()
   }
 }
 </script>