From d1e57ad10fcb0adb1a23a1e5a1a887ef46e3cd8b Mon Sep 17 00:00:00 2001 From: xy <271556543@qq.com> Date: Wed, 6 Nov 2024 15:57:12 +0800 Subject: [PATCH] init --- .env.development | 2 +- .env.production | 2 +- src/layout/components/Sidebar/index.vue | 4 +- src/permission.js | 13 +++++- .../contract/components/contractSign.vue | 41 +++++++++++++------ .../components/paymentRegistration.vue | 3 +- src/views/contract/contractList.vue | 20 ++++----- .../contract/paymentRegistrationList.vue | 22 ++++++---- 8 files changed, 69 insertions(+), 38 deletions(-) diff --git a/.env.development b/.env.development index b17c67a..e0d38ab 100644 --- a/.env.development +++ b/.env.development @@ -3,7 +3,7 @@ ENV = 'development' # base api VUE_APP_BASE_API='https://cz-hjjc.115.langye.net' -VUE_APP_UPLOAD_API='https://cz-hjjc.115.langye.net/api/admin/upload-file' +VUE_APP_UPLOAD_API='https://cz-hjjc.115.langye.net/api/upload-file' VUE_APP_PREVIEW=//view.langye.net/preview/onlinePreview VUE_APP_OUT_OLD=https://cz-hjjc.115.langye.net/oa VUE_APP_OUT_URL=https://cz-hjjc.115.langye.net/oa diff --git a/.env.production b/.env.production index ee89fd9..4ff1e0a 100644 --- a/.env.production +++ b/.env.production @@ -3,7 +3,7 @@ ENV = 'production' # base api VUE_APP_BASE_API='https://cz-hjjc.115.langye.net' -VUE_APP_UPLOAD_API='https://cz-hjjc.115.langye.net/api/admin/upload-file' +VUE_APP_UPLOAD_API='https://cz-hjjc.115.langye.net/api/upload-file' VUE_APP_PREVIEW=//view.langye.net/preview/onlinePreview VUE_APP_OUT_OLD = https://cz-hjjc.115.langye.net/oa VUE_APP_OUT_URL = https://cz-hjjc.115.langye.net/oa diff --git a/src/layout/components/Sidebar/index.vue b/src/layout/components/Sidebar/index.vue index 7954c9e..fe1741b 100644 --- a/src/layout/components/Sidebar/index.vue +++ b/src/layout/components/Sidebar/index.vue @@ -63,7 +63,9 @@ } }, methods: { - + toggleSideBar() { + this.$store.dispatch('app/toggleSideBar') + }, async logout() { await this.$store.dispatch('user/logout') this.$router.push(`/login?redirect=${this.$route.fullPath}`) diff --git a/src/permission.js b/src/permission.js index 7c0251b..a61bbd7 100644 --- a/src/permission.js +++ b/src/permission.js @@ -19,6 +19,7 @@ router.beforeEach(async(to, from, next) => { if(to.query.auth_token) { setToken(window.decodeURIComponent(to.query.auth_token)) } + // determine whether the user has logged in const hasToken = getToken() if (hasToken) { @@ -29,7 +30,11 @@ router.beforeEach(async(to, from, next) => { } else { if (store.state.permission.addRoutes && store.state.permission.addRoutes instanceof Array && store.state.permission.addRoutes.length > 0) { - next() + if (to.query.to && /^\/.*/.test(to.query.to)) { + next(to.query.to) + } else { + next() + } } else { try { // get user info @@ -40,7 +45,11 @@ router.beforeEach(async(to, from, next) => { // hack method to ensure that addRoutes is complete // set the replace: true, so the navigation will not leave a history record - next({ ...to, replace: true }) + if (to.query.to && /^\/.*/.test(to.query.to)) { + next({ ...to, replace: true, path: to.query.to }) + } else { + next({ ...to, replace: true }) + } } catch (error) { // remove token and go to login page to re-login await store.dispatch('user/resetToken') diff --git a/src/views/contract/components/contractSign.vue b/src/views/contract/components/contractSign.vue index f5e2b5c..45db3d5 100644 --- a/src/views/contract/components/contractSign.vue +++ b/src/views/contract/components/contractSign.vue @@ -240,14 +240,10 @@ parseTime, moneyFormatter } from "@/utils" - import { getOutDetail, httpCurl } from '@/api/out' import { getparameter } from "@/api/system/dictionary" - import detailContractSign from "@/views/contract/components/detailContractSign"; - import { - getOatoken - } from "@/api/oatoken"; import axios from "axios"; + import {getToken} from "@/utils/auth"; export default { components: { detailContractSign @@ -536,14 +532,33 @@ }, async getOutContract() { - let url = `${process.env.VUE_APP_OUT_URL}/flow/view/${this.form.join_last_flow_id}` - const res = await httpCurl({ auth_token: this.$store.getters.oa_token ,get_raw:1 },true,"/Api/flowDetail", "GET",url) - console.log(res) - if (res.flow["合同编号"]) this.form.number = "HT-"+res.flow["合同编号"] - if (res.flow["合同金额"]) this.form.money = Number(res.flow["合同金额"]) - if (res.flow["合同乙方"]) this.form.supply = res.flow["合同乙方"] - //if (res.flow.dept_name) this.form.carryDepartment = res.flow?.dept_name - if (res.flow["合同主要内容"]) this.form.content = res.flow["合同主要内容"] + // let url = `${process.env.VUE_APP_OUT_URL}/flow/view/${this.form.join_last_flow_id}` + // const res = await httpCurl({ auth_token: this.$store.getters.oa_token ,get_raw:1 },true,"/Api/flowDetail", "GET",url) + try { + let oaId = this.contract.flow_list.find(i => i.tag === 'contract')?.detail.id + const response = await axios.get(`${process.env.VUE_APP_BASE_API}/api/oa/flow/view/${oaId}`,{ + headers: { + Authorization: `Bearer ${getToken()}` + } + }) + if (response.status === 200) { + if (response.data.code) { + this.$message.warning(response.data.msg) + return + } + const data = response.data.data.flow.data + if (data["bianhao"]) this.form.number = "HT-"+data["bianhao"] + if (data["amt"]) this.form.money = Number(data["amt"]) + if (data["yifang"]) this.form.supply = data["yifang"] + if (data["zhuyaoneirong"]) this.form.content = data["zhuyaoneirong"] + } + } catch (err) { + console.error(err) + } + // if (res.flow["合同编号"]) this.form.number = "HT-"+res.flow["合同编号"] + // if (res.flow["合同金额"]) this.form.money = Number(res.flow["合同金额"]) + // if (res.flow["合同乙方"]) this.form.supply = res.flow["合同乙方"] + // if (res.flow["合同主要内容"]) this.form.content = res.flow["合同主要内容"] }, //获取oa合同信息 // async getOaContractInfo() { diff --git a/src/views/contract/components/paymentRegistration.vue b/src/views/contract/components/paymentRegistration.vue index 56c1d47..a25a47d 100644 --- a/src/views/contract/components/paymentRegistration.vue +++ b/src/views/contract/components/paymentRegistration.vue @@ -552,7 +552,8 @@ export default { zhifucishu: this.contract?.sign_plan?.length || 0, total: data.apply_money, out_pay_id: res, - applyMoney: data.apply_money + applyMoney: data.apply_money, + contract_id: this.contract.id, }); this.isShowPaymentRegistration = false; Message({ diff --git a/src/views/contract/contractList.vue b/src/views/contract/contractList.vue index 92e2094..99b0bc3 100644 --- a/src/views/contract/contractList.vue +++ b/src/views/contract/contractList.vue @@ -337,7 +337,7 @@ -