chenrui
3 天以前 cd8bb25c6b07c81d0740714e45c3ce77bf724054
公司切换功能开发
已修改6个文件
120 ■■■■ 文件已修改
src/api/salesManagement/receiptPayment.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/system/user.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/layout/components/Navbar.vue 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/modules/user.js 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/login.vue 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/salesManagement/receiptPaymentHistory/index.vue 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/salesManagement/receiptPayment.js
@@ -54,3 +54,12 @@
        params: query
    })
}
// 分页查询
export function receiptPaymentHistoryList(query) {
    return request({
        url: '/receiptPayment/receiptPaymentHistoryList',
        method: 'get',
        params: query
    })
}
src/api/system/user.js
@@ -142,9 +142,9 @@
  })
}
// 部门列表
export function userDeptList(params) {
export function userLoginFacotryList(params) {
  return request({
    url: '/userDeptList',
    url: '/userLoginFacotryList',
    method: 'get',
    params: params
  })
src/layout/components/Navbar.vue
@@ -6,7 +6,24 @@
    </div>
<!--    <top-nav v-if="settingsStore.topNav" id="topmenu-container" class="topmenu-container" />-->
    <div class="center-menu">
      <span class="label">MIS系统(管理信息系统)</span>
      <span class="label">{{userStore.currentFactoryName}}</span>
      <el-dropdown @command="handleFactoryChange" class="right-menu-item hover-effect" trigger="click">
        <div class="avatar-wrapper">
          <el-icon><Switch /></el-icon>
        </div>
        <template #dropdown>
          <el-dropdown-menu >
            <el-dropdown-item
                v-for="item in factoryList"
                :key="item.deptId"
                :command="item"
            >
              {{ item.deptName }}
            </el-dropdown-item>
          </el-dropdown-menu>
        </template>
      </el-dropdown>
    </div>
    <div class="right-menu">
      <div class="avatar-container">
@@ -47,11 +64,14 @@
import useAppStore from '@/store/modules/app'
import useUserStore from '@/store/modules/user'
import useSettingsStore from '@/store/modules/settings'
import { userLoginFacotryList } from "@/api/system/user.js"
import Cookies from "js-cookie";
import { decrypt } from "@/utils/jsencrypt"
const appStore = useAppStore()
const userStore = useUserStore()
const settingsStore = useSettingsStore()
const factoryList = ref([])
function toggleSideBar() {
  appStore.toggleSideBar()
}
@@ -89,6 +109,43 @@
function toggleTheme() {
  settingsStore.toggleTheme()
}
function getUserLoginFacotryList() {
  if(userStore.id){
    userLoginFacotryList({userId:userStore.id}).then(res => {
      console.log('res', res)
      factoryList.value = res.data
    })
  }else {
    factoryList.value = []
  }
}
function handleFactoryChange(command) {
  console.log('command', command)
  handleLogin(command.deptId);
}
function handleLogin(currentFatoryId){
  const loginForm = {
    username: Cookies.get("username"),
    password: Cookies.get("password") === undefined ? null : decrypt(Cookies.get("password")),
    currentFatoryId: currentFatoryId
  }
  userStore.loginCheckFactory(loginForm).then(res => {
    const query = route.query
    const otherQueryParams = Object.keys(query).reduce((acc, cur) => {
      if (cur !== "redirect") {
        acc[cur] = query[cur]
      }
      return acc
    }, {})
    router.push({ path: redirect.value || "/", query: otherQueryParams })
  }).catch(() => {
  })
}
getUserLoginFacotryList();
</script>
<style lang='scss' scoped>
src/store/modules/user.js
@@ -50,6 +50,7 @@
            this.id = user.userId
            this.name = user.userName
            this.avatar = avatar
            this.currentFactoryName = user.currentFactoryName
            this.nickName = user.nickName
            resolve(res)
          }).catch(error => {
@@ -87,7 +88,7 @@
      loginCheckFactory(userInfo) {
        const username = userInfo.username.trim()
        const password = userInfo.password
        const factoryId = userInfo.factoryId
        const factoryId = userInfo.currentFatoryId
        return new Promise((resolve, reject) => {
          loginCheckFactory(username, password, factoryId).then(res => {
            setToken(res.token)
src/views/login.vue
@@ -77,7 +77,7 @@
import Cookies from "js-cookie"
import { encrypt, decrypt } from "@/utils/jsencrypt"
import useUserStore from '@/store/modules/user'
import {userDeptList} from "@/api/system/user.js"
import {userLoginFacotryList} from "@/api/system/user.js"
const title = import.meta.env.VITE_APP_TITLE
const userStore = useUserStore()
@@ -169,21 +169,20 @@
  }
}
function deptListSearch() {
function getUserLoginFacotryList() {
  if(loginForm.value.username){
    userDeptList({userName:loginForm.value.username}).then(res => {
    userLoginFacotryList({userName:loginForm.value.username}).then(res => {
      console.log('res', res)
      factoryList.value = res.data
    })
  }else {
    factoryList.value = []
  }
}
getCode()
getCookie()
deptListSearch()
getUserLoginFacotryList()
</script>
<style lang='scss' scoped>
src/views/salesManagement/receiptPaymentHistory/index.vue
@@ -2,8 +2,8 @@
  <div class="app-container">
    <div class="search_form">
      <div>
        <span class="search_title">供应商名称:</span>
        <el-input v-model="searchForm.searchText" style="width: 240px" placeholder="输入供应商名称搜索"
        <span class="search_title">客户名称:</span>
        <el-input v-model="searchForm.searchText" style="width: 240px" placeholder="输入客户名称搜索"
                  @change="handleQuery" clearable :prefix-icon="Search" />
        <el-button type="primary" @click="handleQuery" style="margin-left: 10px">搜索</el-button>
      </div>
@@ -20,25 +20,38 @@
import { ref } from 'vue'
import { Search } from "@element-plus/icons-vue";
import {
  paymentHistoryList
} from "@/api/procurementManagement/paymentEntry.js";
  receiptPaymentHistoryList
} from "@/api/salesManagement/receiptPayment.js";
const { proxy } = getCurrentInstance()
const tableColumn = ref([
  {
    label: '回款日期',
    prop: 'paymentDate',
    prop: 'receiptPaymentDate',
  },
  {
    label: '客户名称',
    prop: 'supplierName',
    prop: 'customerName',
  },
  {
    label: '回款金额',
    prop: 'currentPaymentAmount',
    prop: 'receiptPaymentAmount',
  },
  {
    label: '回款方式',
    prop: 'paymentMethod'
    prop: 'receiptPaymentType',
    dataType: 'tag',
    formatData: (params) => {
      if (params == 0) {
        return '电汇';
      } else if (params == 1) {
        return '承兑';
      } else {
        return null
      }
    },
    formatType: (params) => {
      return "info"
    }
  },
  {
    label: '登记人',
@@ -46,7 +59,7 @@
  },
  {
    label: '登记日期',
    prop: 'registrationtDate'
    prop: 'createTime'
  }
])
const tableData = ref([])
@@ -63,6 +76,7 @@
  },
})
const { searchForm } = toRefs(data)
const { receipt_payment_type } = proxy.useDict("receipt_payment_type")
// 查询列表
/** 搜索按钮操作 */
@@ -77,7 +91,7 @@
}
const getList = () => {
  tableLoading.value = true
  paymentHistoryList({ ...searchForm.value, ...page }).then(res => {
  receiptPaymentHistoryList({ ...searchForm.value, ...page }).then(res => {
    tableLoading.value = false
    tableData.value = res.rows
    total.value = res.total