MS-CIAZDCOIXVRW\Administrator vor 3 Jahren
Ursprung
Commit
3508ef60ad

+ 1 - 10
src/constant/index.js

@@ -1,17 +1,8 @@
 // token
 export const TOKEN = 'token'
 
-// // 用户姓名
-// export const realName = 'realName'
-
-// // 用户权限
-// export const AdminType = 'adminType'
-
-// // 用户id
-// export const AdminId = 'adminType'
-
 // 用户信息
-export const USERINFO = 'token'
+export const USERINFO = 'userInfo'
 
 // token 时间戳
 export const TIME_STAMP = 'timeStamp'

+ 8 - 3
src/layout/components/Navbar.vue

@@ -85,21 +85,26 @@ import { ElMessage, ElMessageBox } from 'element-plus'
 import { RSAencrypt } from '@/utils/jsencrypt'
 import { editPassword } from '@/api/user'
 
+// 修改密码弹窗显示隐藏控制
 const dialogVisible = ref(false)
-
+// 修改密码弹窗数据
 const password = ref('')
 const newPassword = ref('')
 const newPassword2 = ref('')
-
+// 仓库
 const store = useStore()
+
+// 退出登录按钮回调
 const logout = () => {
   store.dispatch('user/logout')
 }
 
+// 修改密码按钮回调
 const handleEditPassword = () => {
   dialogVisible.value = true
 }
 
+// 修改密码弹窗确定按钮回调
 const handleEditPasswordConfirm = () => {
   if (password.value === '') {
     ElMessage.error('请输入原密码')
@@ -128,7 +133,7 @@ const handleEditPasswordConfirm = () => {
         password: RSAencrypt(password.value),
         newPassword: RSAencrypt(newPassword.value)
       })
-      console.log(res)
+      // console.log(res)
       if (res == null) {
         dialogVisible.value = false
         ElMessage.success('修改成功')

+ 1 - 1
src/main.js

@@ -3,7 +3,7 @@ import App from './App.vue'
 import router from './router'
 import store from './store'
 // 导入权限控制模块
-// import './permission'
+import './permission'
 
 // 引入初始化样式
 import '@/styles/index.scss'

+ 0 - 1
src/store/getters.js

@@ -1,7 +1,6 @@
 const getters = {
   token: (state) => state.user.token,
   userInfo: (state) => state.user.userInfo,
-  // name: (state) => state.user.name,
   // true 表示已存在用户信息
   hasUserInfo: (state) => {
     return JSON.stringify(state.user.userInfo) !== '{}'

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

@@ -37,7 +37,6 @@ export default {
           password: RSAencrypt(password)
         })
           .then((data) => {
-            console.log(data)
             this.commit('user/setToken', data.token)
             this.commit('user/setInfo', data)
             router.push('/')

+ 41 - 51
src/views/account-management/index.vue

@@ -37,7 +37,7 @@
         </el-col>
 
         <el-col :span="4">
-          <el-button type="primary" @click="handleSearch">
+          <el-button type="primary" @click="getData">
             <el-icon><Search /></el-icon>
             <span> 查询</span>
           </el-button>
@@ -244,20 +244,57 @@ import {
 } from '@/api/user'
 import { RSAencrypt } from '@/utils/jsencrypt'
 
+onMounted(() => {
+  getData()
+})
+
+// 获取账号管理列表
+const getData = async () => {
+  const res = await getUserList({
+    userName: searchAccount.value,
+    name: searchName.value,
+    time: searchTime.value,
+    currPage: currentPage.value,
+    pageSize: pageSize.value
+  })
+  // console.log(res)
+  tableData.value = res.list
+  total.value = res.totalCount
+  currentPage.value = res.currPage
+}
+
+// 筛选区域数据
+const searchAccount = ref('')
+const searchName = ref('')
+const searchTime = ref('')
+// 账号管理列表数据
+const tableData = ref([])
+// 编辑弹窗数据
 const editInfo = ref({
   userName: '',
   name: '',
   newPassword: '',
   newPassword2: ''
 })
-
+// 新增账号弹窗数据
 const addInfo = ref({
   userName: '',
   name: '',
   newPassword: '',
   newPassword2: ''
 })
+// 总条数
+const total = ref(0)
+// 当前页
+const currentPage = ref(1)
+// 每页多少条
+const pageSize = ref(8)
+// 编辑弹窗显示隐藏控制
+const dialogVisible = ref(false)
+// 新增账号弹窗显示隐藏控制
+const dialogVisibleAdd = ref(false)
 
+// 删除按钮回调
 const handleDelete = (id) => {
   ElMessageBox.confirm('确定删除吗?', '提示', {
     confirmButtonText: '确定',
@@ -279,47 +316,6 @@ const handleDelete = (id) => {
     })
 }
 
-// 获取账号管理列表
-const getData = async () => {
-  const res = await getUserList({
-    userName: searchAccount.value,
-    name: searchName.value,
-    time: searchTime.value,
-    currPage: currentPage.value,
-    pageSize: pageSize.value
-  })
-  // console.log(res)
-  tableData.value = res.list
-  total.value = res.totalCount
-  currentPage.value = res.currPage
-}
-
-onMounted(() => {
-  getData()
-})
-
-// 筛选区域数据
-const searchAccount = ref('')
-const searchName = ref('')
-const searchTime = ref('')
-
-// 总条数
-const total = ref(0)
-// 当前页
-const currentPage = ref(1)
-// 每页多少条
-const pageSize = ref(8)
-
-// 编辑弹窗显示隐藏控制
-const dialogVisible = ref(false)
-
-const dialogVisibleAdd = ref(false)
-
-// 查询按钮回调
-const handleSearch = () => {
-  getData()
-}
-
 // 新增按钮回调
 const handleAdd = () => {
   dialogVisibleAdd.value = true
@@ -333,12 +329,10 @@ const handleAdd = () => {
 
 // 每页条数改变时的回调
 const handleSizeChange = (val) => {
-  // console.log(`${val} items per page`)
   pageSize.value = val
 }
 // 当前页改变时的回调
 const handleCurrentChange = (val) => {
-  // console.log(`current page: ${val}`)
   currentPage.value = val
 }
 
@@ -346,13 +340,10 @@ const handleCurrentChange = (val) => {
 const handleEdit = (row) => {
   dialogVisible.value = true
   editInfo.value = Object.assign(editInfo.value, row)
-  // editInfo.value.name = row.name
-  // editInfo.value.userName = row.userName
-  // console.log(editInfo.value)
 }
 
+// 编辑弹窗确定按钮回调
 const handleEditConfirm = async () => {
-  // console.log(editInfo.value)
   if (editInfo.value.newPassword === '') {
     ElMessage.error('请输入密码')
     return
@@ -381,6 +372,7 @@ const handleEditConfirm = async () => {
   }
 }
 
+// 新增账号弹窗确定按钮回调
 const handleEditConfirmAdd = async () => {
   if (addInfo.value.userName === '') {
     ElMessage.error('请输入账号')
@@ -414,8 +406,6 @@ const handleEditConfirmAdd = async () => {
     getData()
   }
 }
-
-const tableData = ref([])
 </script>
 
 <style lang="scss" scoped>

+ 38 - 56
src/views/project-management/index.vue

@@ -47,7 +47,7 @@
         </el-col>
 
         <el-col :span="4">
-          <el-button type="primary" @click="handleSearch">
+          <el-button type="primary" @click="getData">
             <el-icon><Search /></el-icon>
             <span> 查询</span>
           </el-button>
@@ -66,11 +66,12 @@
       <el-table
         stripe
         height="481"
+        ref="multipleTable"
         :data="tableData"
         style="width: 100%"
         :header-cell-style="{ backgroundColor: '#F0F3F7' }"
-        @select="handleCurrentChangeTable"
-        @select-all="handleCurrentChangeAll"
+        @select="handleChooseList"
+        @select-all="handleChooseList"
       >
         <el-table-column type="selection" width="55" />
         <el-table-column width="100" align="center" prop="name" label="姓名" />
@@ -171,29 +172,9 @@ import { useStore } from 'vuex'
 import { ElMessage, ElMessageBox } from 'element-plus'
 import { getProjectList, deleteProjectList } from '@/api/project'
 
-const store = useStore()
-
-const downIds = ref([])
-
-const handleCurrentChangeTable = (list) => {
-  downIds.value = []
-  if (list.length !== 0) {
-    list.forEach((item) => {
-      downIds.value.push(item.id)
-    })
-  }
-  console.log(downIds.value)
-}
-
-const handleCurrentChangeAll = (list) => {
-  downIds.value = []
-  if (list.length !== 0) {
-    list.forEach((item) => {
-      downIds.value.push(item.id)
-    })
-  }
-  console.log(downIds.value)
-}
+onMounted(() => {
+  getData()
+})
 
 // 获取项目管理列表
 const getData = async () => {
@@ -211,43 +192,62 @@ const getData = async () => {
   currentPage.value = res.currPage
 }
 
-onMounted(() => {
-  getData()
-})
-
 // 筛选区域绑定数据
 const searchName = ref('')
 const searchAddress = ref('')
 const searchPhone = ref('')
 const searchTime = ref('')
+// 表单元素DOM标识
+const multipleTable = ref(null)
+// 仓库
+const store = useStore()
+// 勾选的数据id
+const downIds = ref([])
+// 控制详情弹窗显示隐藏
+const dialogVisible = ref(false)
+// 控制详情弹窗数据
+const dialogInfo = ref({})
+// 一共多少条
+const total = ref(0)
+// 分页器当前页
+const currentPage = ref(1)
+// 每页条数
+const pageSize = ref(8)
+// 表格数据
+const tableData = ref([])
 
-// 点击查询按钮回调
-const handleSearch = () => {
-  // ElMessage.success('查询')
-  getData()
+// 点击勾选框回调
+const handleChooseList = (list) => {
+  downIds.value = []
+  if (list.length !== 0) {
+    list.forEach((item) => {
+      downIds.value.push(item.id)
+    })
+  }
 }
-
 // 导出表单按钮回调
 const hanleExportForm = () => {
+  const id = downIds.value.join(',')
   ElMessageBox.confirm('确定导出表单吗?', '提示', {
     confirmButtonText: '确定',
     cancelButtonText: '取消',
     type: 'warning'
   })
     .then(() => {
-      window.location.href = `/reporting/informationReporting/download?name=${searchName.value}&phone=${searchPhone.value}&company=${searchAddress.value}&reportingTime=${searchTime.value}&ids=${downIds.value}`
+      window.location.href = `/reporting/informationReporting/download?name=${searchName.value}&phone=${searchPhone.value}&company=${searchAddress.value}&reportingTime=${searchTime.value}&ids=${id}`
+      multipleTable.value.clearSelection()
     })
     .catch(() => {
       ElMessage.info('取消')
+      multipleTable.value.clearSelection()
     })
+  downIds.value = []
 }
-
 // 点击详情按钮回调
 const handleCheckDetail = (row) => {
   dialogVisible.value = true
   dialogInfo.value = row
 }
-
 // 点击删除按钮回调
 const handleDelete = (id) => {
   ElMessageBox.confirm('确定删除吗?', '提示', {
@@ -271,34 +271,16 @@ const handleDelete = (id) => {
       ElMessage.info('已取消')
     })
 }
-
-// 控制详情弹窗显示隐藏
-const dialogVisible = ref(false)
-
-const dialogInfo = ref({})
-
-// 一共多少条
-const total = ref(0)
-// 分页器当前页
-const currentPage = ref(1)
-// 每页条数
-const pageSize = ref(8)
-
 // 改变每页条数回调
 const handleSizeChange = (val) => {
-  // console.log(`每条${val}页`)
   pageSize.value = val
   getData()
 }
 // 改变当前页回调
 const handleCurrentChange = (val) => {
-  // console.log(`当前页: ${val}`)
   currentPage.value = val
   getData()
 }
-
-// 表格数据
-const tableData = ref([])
 </script>
 
 <style lang="scss" scoped>