diff --git a/apis/axios.js b/apis/axios.js index bbdd282..ba04463 100644 --- a/apis/axios.js +++ b/apis/axios.js @@ -1,6 +1,7 @@ import Axios from 'axios'; import { Toast } from 'vant'; -import store from 'store'; +// import store from 'store'; +import { createApp } from 'vue'; const app = createApp(); app.use(Toast); @@ -15,7 +16,7 @@ const instance = Axios.create({ // request instance.interceptors.request.use( config => { - const token = store.getters['user/token'] || sessionStorage.getItem('token'); + const token = sessionStorage.getItem('token') || ''; if (token) { config.headers.Authorization = `Bearer ${token}`; } diff --git a/apis/finance.js b/apis/finance.js index da07926..4e74a91 100644 --- a/apis/finance.js +++ b/apis/finance.js @@ -1,14 +1,37 @@ -// noinspection SpellCheckingInspection - import http from 'apis/axios'; const apiUrl = import.meta.env.VITE_API_URL; -console.log('apiUrl: ', apiUrl); const ptccsens = `${apiUrl}/ptccsens/v1.0`; const finance = `${ptccsens}/finance`; +const projectFinance = `${ptccsens}/projectFinance`; + +// 发起申请 +export const apply = params => http.post(`${finance}/apply`, params); + +// 审批 +export const audit = params => http.post(`${finance}/audit`, params); + +// 查询申请详情 +export const getApplyDetail = params => http.post(`${finance}/getApplyDetail`, params); + +// 通过任务id查看任务关联的财务信息 +export const getByTask = params => http.post(`${finance}/getByTask`, params); + +// 查询费用申请类型 +export const queryType = params => http.post(`${finance}/queryType`, params); + + +// 追加预算 +export const addBudget = params => http.post(`${projectFinance}/addBudget`, params); + +// 查看项目下的财务信息 +export const queryFinanceOfProject = params => http.post(`${projectFinance}/queryFinanceOfProject`, params); // 查看项目下的所有任务对应的财务信息 -export const financeInfo = params => http.post(`${finance}/getByTask`, params); +export const queryProjectFinance = params => http.post(`${projectFinance}/queryProjectFinance`, params); // 修改任务或项目的预算和奖金信息 -// export const edit = params => http.post(`${finance}/info`, params); +export const updateFinance = params => http.post(`${projectFinance}/updateFinance`, params); + +// 查看自己需要审批的申请 +export const queryNeedCheckByMe = params => http.post(`${projectFinance}/queryNeedCheckByMe`, params); diff --git a/apis/index.js b/apis/index.js index d0432be..47ff077 100644 --- a/apis/index.js +++ b/apis/index.js @@ -1,9 +1,8 @@ -// noinspection SpellCheckingInspection - import http from 'apis/axios'; -const apiUrl = 'https://test.tall.wiki'; -const users = `${apiUrl}/gateway/ptostall/users`; +const apiUrl = import.meta.env.VITE_API_URL; +const ptccsens = `${apiUrl}/gateway/tall3/v3.0`; +const users = `${ptccsens}/users`; // 根据userId 获取token export const getToken = userId => http.get(`${users}/userId`, { params: { userId } }); diff --git a/app.vue b/app.vue index 8f62b8b..af56958 100644 --- a/app.vue +++ b/app.vue @@ -1,3 +1,53 @@ + + diff --git a/components/FinanceExamine.vue b/components/FinanceExamine.vue index 8c51e35..fe8bc66 100644 --- a/components/FinanceExamine.vue +++ b/components/FinanceExamine.vue @@ -1,5 +1,5 @@ diff --git a/components/FinanceManage.vue b/components/FinanceManage.vue index 42f9385..8f61d31 100644 --- a/components/FinanceManage.vue +++ b/components/FinanceManage.vue @@ -1,106 +1,126 @@ diff --git a/pages/index.vue b/pages/index.vue index ca67f1b..4357815 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -1,43 +1,52 @@ + diff --git a/plugins/vant.js b/plugins/vant.js index 648ecb3..d064fb7 100644 --- a/plugins/vant.js +++ b/plugins/vant.js @@ -20,7 +20,8 @@ import { Popup, Cascader, Circle, - Sticky, + Empty, + Popover, } from 'vant'; import { defineNuxtPlugin } from '#app'; @@ -44,6 +45,7 @@ export default defineNuxtPlugin(nuxtApp => { .use(Cascader) .use(Popup) .use(Circle) - .use(Sticky) - .use(Tabs); + .use(Tabs) + .use(Empty) + .use(Popover); }); diff --git a/rest/http-client.env.json b/rest/http-client.env.json new file mode 100644 index 0000000..523f84c --- /dev/null +++ b/rest/http-client.env.json @@ -0,0 +1,15 @@ +{ + "$shared": { + "version": "v1", + "identifier": "wally", + "credential": "111111" + }, + "dev": { + "name": "dev", + "url": "https://test.tall.wiki/gateway" + }, + "local": { + "version": "v2", + "url": "https://test.tall.wiki/gateway" + } +} diff --git a/rest/财务条.http b/rest/财务条.http new file mode 100644 index 0000000..bb135da --- /dev/null +++ b/rest/财务条.http @@ -0,0 +1,109 @@ +@localhost = http://localhost:7320/v1.0 +@localhost_tall = http://localhost:7130/v3.0 +@test_tall = http://192.168.0.99:7130/v3.0 +@test = https://test.tall.wiki/ptccsens/v1.0 +@www_tall = http://www.tall.wiki:7130/v3.0 +@www = http://www.tall.wiki/ptccsens/v1.0 +@type = content-type: application/json;charset=utf-8 + +### 登录 +# song 1218763410024566784 +# @name login +POST {{localhost_tall}}/users/signin +{{type}} + +{ + "client": 1, + "type": 3, + "data": { + "identifier": "whj", + "credential": "123456" + } +} + +### debug +GET {{test}}/debug +{{type}} +Authorization: Bearer {{login.response.body.$.data.token}} + +###查询费用申请类型 +POST {{localhost}}/finance/queryType +{{type}} +Authorization: Bearer {{login.response.body.$.data.token}} + +{ + "param":{ + "parentId":"4", + "type":2 + } +} + +###发起申请 +POST {{localhost}}/finance/apply +{{type}} +Authorization: Bearer {{login.response.body.$.data.token}} + +{ + "param":{ + + "checkerList": [ + 123 + ], + "invoiceList": [ + { + "invoiceCode": "014002100112", + "invoiceNumber": "86610940", + "invoiceTime": 1643075118954, + "money": 4190, + "remark": "业务招待支出", + "taxMoney": 126, + "url": "https://alifei04.cfp.cn/creative/vcg/800/new/VCG211363439424.jpg" + } + ], + "projectId": 2, + "taskDetailId": 3, + "remark": "", + "department": "视觉传达事业部", + "submitName": "黛西", + "money": 4190, + "typeId": 1, + "categoryId": 4, + "rowId": 7 + + } +} + +###查询申请详情 +POST {{localhost}}/finance/getApplyDetail +{{type}} +Authorization: Bearer {{login.response.body.$.data.token}} + +{ + "param":{ + "applyId":"1485797754654695424" + } +} + +###审批 +POST {{localhost}}/finance/audit +{{type}} +Authorization: Bearer {{login.response.body.$.data.token}} + +{ + "param":{ + "checkStatus":"2", + "financeCheckId":"1485797754923130880", + "remark":"测试" + } +} + +###通过任务id查看任务关联的财务信息 +POST {{localhost}}/finance/getByTask +{{type}} +Authorization: Bearer {{login.response.body.$.data.token}} + +{ + "param":{ + "taskDetailId":"3" + } +} diff --git a/store/index.js b/store/index.js deleted file mode 100644 index 67956f5..0000000 --- a/store/index.js +++ /dev/null @@ -1,10 +0,0 @@ -import { createStore } from 'vuex'; -import user from './user'; - -export default createStore({ - modules: { user }, - state: {}, - getters: {}, - mutations: {}, - actions: {}, -}); diff --git a/store/user.js b/store/user.js deleted file mode 100644 index cb0a360..0000000 --- a/store/user.js +++ /dev/null @@ -1,61 +0,0 @@ -import { getToken } from 'apis/index'; - -export default { - namespaced: true, - - state: { user: null }, - - getters: { - token({ user }) { - if (!user) return null; - return user.token; - }, - userId({ user }) { - if (!user) return null; - return user.id; - }, - account({ user }) { - if (!user) return null; - return user.account; - }, - isAdmin({ user }) { - if (!user) return false; - return user.account === 'iacdadmin'; - }, - }, - - mutations: { - /** - * 设置state.user - * @param {*} state - * @param {object|null} user 用户信息 - */ - setUser(state, user) { - state.user = user; - if (user) { - sessionStorage.setItem('token', user.token); - sessionStorage.setItem('user', JSON.stringify(user)); - } else { - sessionStorage.removeItem('token'); - sessionStorage.removeItem('user'); - } - }, - }, - - actions: { - /** - * 根据userId获取token级user信息 - * @param {*} param0 - * @param {string} userId 用户id - */ - async getTokenByUserId({ commit }, userId) { - try { - const data = await getToken(userId); - commit('setUser', data || null); - return data; - } catch (error) { - throw new Error(error); - } - }, - }, -};