Browse Source

merge

zhangyong/milestone-20250913-现金管理二期^2
zhangrenyuan 4 weeks ago
parent
commit
85dd249a97
  1. 14
      src/store/index.js
  2. 13
      src/views/home.vue
  3. 32
      src/views/usergold/gold/clientCountDetail.vue

14
src/store/index.js

@ -6,6 +6,7 @@ export const useAdminStore = defineStore('admin', {
adminData: null, // 用户信息 adminData: null, // 用户信息
menuTree: [], // 菜单权限树 menuTree: [], // 菜单权限树
marketList: {}, // 市场列表 marketList: {}, // 市场列表
flag: 0, //员工数据开关状态,0=不包含员工数据,1=包含员工数据
}), }),
actions: { actions: {
// 设置用户信息并同步到localStorage // 设置用户信息并同步到localStorage
@ -24,11 +25,18 @@ export const useAdminStore = defineStore('admin', {
localStorage.setItem('marketList', JSON.stringify(list)) localStorage.setItem('marketList', JSON.stringify(list))
}, },
// 设置员工数据开关状态(使用数字0和1)
setFlag(flag) {
this.flag = flag
localStorage.setItem('flag', JSON.stringify(flag))
},
// 从localStorage初始化数据 // 从localStorage初始化数据
initFromLocalStorage() { initFromLocalStorage() {
const adminData = localStorage.getItem('adminData') const adminData = localStorage.getItem('adminData')
const menuTree = localStorage.getItem('menuTree') const menuTree = localStorage.getItem('menuTree')
const marketList = localStorage.getItem('marketList') const marketList = localStorage.getItem('marketList')
const flag = localStorage.getItem('flag')
if (adminData) { if (adminData) {
this.adminData = JSON.parse(adminData) this.adminData = JSON.parse(adminData)
@ -41,6 +49,10 @@ export const useAdminStore = defineStore('admin', {
if (marketList) { if (marketList) {
this.marketList = JSON.parse(marketList) this.marketList = JSON.parse(marketList)
} }
if (flag) {
this.flag = JSON.parse(flag)
}
}, },
// 清空状态并移除localStorage数据 // 清空状态并移除localStorage数据
@ -48,9 +60,11 @@ export const useAdminStore = defineStore('admin', {
this.adminData = null this.adminData = null
this.menuTree = [] this.menuTree = []
this.marketList = {} this.marketList = {}
this.flag = 0
localStorage.removeItem('adminData') localStorage.removeItem('adminData')
localStorage.removeItem('menuTree') localStorage.removeItem('menuTree')
localStorage.removeItem('marketList') localStorage.removeItem('marketList')
localStorage.removeItem('flag')
// localStorage.removeItem('token') // localStorage.removeItem('token')
} }
} }

13
src/views/home.vue

@ -79,7 +79,7 @@ const menuList = ref([])
// //
const adminStore = useAdminStore() const adminStore = useAdminStore()
// adminData menuTree // adminData menuTree
const { adminData, menuTree } = storeToRefs(adminStore)
const { adminData, menuTree, flag } = storeToRefs(adminStore)
// ,menuTree // ,menuTree
menuList.value = filterMenu(menuTree.value) menuList.value = filterMenu(menuTree.value)
@ -156,6 +156,13 @@ function logout() {
ElMessage.success('退出成功') ElMessage.success('退出成功')
} }
//
const toggleFlag = () => {
const newFlag = flag.value === 1 ? 0 : 1
adminStore.setFlag(newFlag)
ElMessage.success(newFlag === 1 ? '员工数据已隐藏' : '员工数据已显示')
console.log('flag',newFlag)
}
</script> </script>
@ -243,6 +250,10 @@ function logout() {
<template #dropdown> <template #dropdown>
<el-dropdown-menu> <el-dropdown-menu>
<el-dropdown-item @click="refreshData()">数据刷新</el-dropdown-item> <el-dropdown-item @click="refreshData()">数据刷新</el-dropdown-item>
<!-- 员工数据开关 -->
<el-dropdown-item @click="toggleFlag()">
{{ flag === 1 ? '显示员工数据' : '隐藏员工数据' }}
</el-dropdown-item>
<el-dropdown-item @click="message()">查看个人信息</el-dropdown-item> <el-dropdown-item @click="message()">查看个人信息</el-dropdown-item>
<el-dropdown-item @click="openChangePassword">修改密码</el-dropdown-item> <el-dropdown-item @click="openChangePassword">修改密码</el-dropdown-item>
<el-dropdown-item @click="logout">退出登录</el-dropdown-item> <el-dropdown-item @click="logout">退出登录</el-dropdown-item>

32
src/views/usergold/gold/clientCountDetail.vue

@ -1,5 +1,5 @@
<script setup> <script setup>
import { onMounted, ref } from 'vue'
import { onMounted, ref, watch } from 'vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import moment from 'moment' import moment from 'moment'
@ -10,9 +10,18 @@ import { useAdminStore } from "@/store/index.js"
import { storeToRefs } from "pinia" import { storeToRefs } from "pinia"
import { findMenuById, permissionMapping } from "@/utils/menuTreePermission.js" import { findMenuById, permissionMapping } from "@/utils/menuTreePermission.js"
const adminStore = useAdminStore() const adminStore = useAdminStore()
const { adminData, menuTree } = storeToRefs(adminStore)
const { adminData, menuTree, flag } = storeToRefs(adminStore)
// //
const showEmployeeData = ref(false)
// const showEmployeeData = ref(false)
// flag
watch(flag, (newFlag, oldFlag) => {
// flag
if (newFlag !== oldFlag) {
console.log('员工数据flag状态改变,重新加载数据', newFlag)
get()
}
})
// //
@ -165,7 +174,10 @@ const get = async function (val) {
const result = await API({ const result = await API({
url: '/goldDetail/getGoldDetail', url: '/goldDetail/getGoldDetail',
method: 'post', method: 'post',
data: { ...getObj.value, goldDetail: { ...goldDetail.value, flag: showEmployeeData.value ? 0 : 1 } }
data: { ...getObj.value, goldDetail: { ...goldDetail.value,
// flag: showEmployeeData.value ? 0 : 1
flag: flag.value
} }
}) })
console.log('响应数据', result) console.log('响应数据', result)
tableData.value = result.data.list tableData.value = result.data.list
@ -174,7 +186,10 @@ const get = async function (val) {
url: '/goldDetail/getTotal', url: '/goldDetail/getTotal',
method: 'post', method: 'post',
data: { data: {
goldDetail: { ...goldDetail.value, flag: showEmployeeData.value ? 0 : 1 },
goldDetail: { ...goldDetail.value,
// flag: showEmployeeData.value ? 0 : 1
flag: flag.value
},
/* jwcode: goldDetail.value.jwcode || '', /* jwcode: goldDetail.value.jwcode || '',
payPlatform: goldDetail.value.payPlatform || '', payPlatform: goldDetail.value.payPlatform || '',
type: goldDetail.value.type || '', type: goldDetail.value.type || '',
@ -300,7 +315,8 @@ const exportExcel = async function () {
endTime: goldDetail.value.endTime || '', endTime: goldDetail.value.endTime || '',
sortField: goldDetail.value.sortField || '', sortField: goldDetail.value.sortField || '',
sortOrder: goldDetail.value.sortOrder || '', sortOrder: goldDetail.value.sortOrder || '',
flag: showEmployeeData.value ? 0 : 1 // flag
// flag: showEmployeeData.value ? 0 : 1 // flag
flag: flag.value
}, },
} }
@ -485,9 +501,9 @@ const format3 = (num) => {
<el-cascader class="selectContent" v-model="selectedMarketPath" :options="markets" placeholder="请选择所属地区" <el-cascader class="selectContent" v-model="selectedMarketPath" :options="markets" placeholder="请选择所属地区"
style="width:10vw" clearable @change="handleMarketChange" /> style="width:10vw" clearable @change="handleMarketChange" />
</div> </div>
<div>
<!-- <div>
<el-checkbox v-model="showEmployeeData" @change="search()">员工数据</el-checkbox> <el-checkbox v-model="showEmployeeData" @change="search()">员工数据</el-checkbox>
</div>
</div> -->
</div> </div>
</el-col> </el-col>

Loading…
Cancel
Save