From 53d1d1f2cb352e21c1909c7de06a6d1352507e55 Mon Sep 17 00:00:00 2001 From: sunzehua Date: Thu, 18 Apr 2024 10:08:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/modular/system/loginManage.js | 34 +++-- src/components/GlobalHeader/GlobalHeader.vue | 1 + src/components/tools/UserMenu.vue | 63 ++++++++-- src/store/modules/user.js | 81 ++++++++---- .../detail/modules/basicInfo.vue | 6 +- .../detail/modules/goodsTable.vue | 118 +++++++++--------- src/views/main/BookingGangjie/list/index.vue | 20 ++- .../BookingLedger/detail/modules/preOrder.vue | 16 ++- src/views/main/BookingLedger/list/index.vue | 14 ++- src/views/main/CommondbPortFoward/addForm.vue | 2 +- src/views/main/Taskmanage/BCModify/index.vue | 47 ++++++- 11 files changed, 275 insertions(+), 127 deletions(-) diff --git a/src/api/modular/system/loginManage.js b/src/api/modular/system/loginManage.js index d91d02f..6c624a3 100644 --- a/src/api/modular/system/loginManage.js +++ b/src/api/modular/system/loginManage.js @@ -12,7 +12,7 @@ import { axios } from '@/utils/request' * @author yubaoshan * @date 2020/5/26 19:06 */ -export function login (parameter) { +export function login(parameter) { return axios({ url: '/login', method: 'post', @@ -26,12 +26,12 @@ export function login (parameter) { * @author 蛋蛋 * @date 2022/4/13 22:06 */ -export function simulationTenantLogin(parameter){ - return axios({ - url: '/simulationTenantLogin', - method: 'post', - data: parameter - }) +export function simulationTenantLogin(parameter) { + return axios({ + url: '/simulationTenantLogin', + method: 'post', + data: parameter + }) } /** @@ -40,7 +40,7 @@ export function simulationTenantLogin(parameter){ * @author yubaoshan * @date 2020/5/26 19:07 */ -export function logout (parameter) { +export function logout(parameter) { return axios({ url: '/logout', method: 'get', @@ -54,7 +54,7 @@ export function logout (parameter) { * @author yubaoshan * @date 2020/5/26 19:08 */ -export function getLoginUser (parameter) { +export function getLoginUser(parameter) { return axios({ url: '/getLoginUser', method: 'get', @@ -68,7 +68,7 @@ export function getLoginUser (parameter) { * @author yubaoshan * @date 2020/5/26 19:29 */ -export function getSmsCaptcha (parameter) { +export function getSmsCaptcha(parameter) { return axios({ url: '/getSmsCaptcha', method: 'get', @@ -82,7 +82,7 @@ export function getSmsCaptcha (parameter) { * @author Jax * @date 2021/1/22 00:00 */ -export function getCaptchaOpen (parameter) { +export function getCaptchaOpen(parameter) { return axios({ url: '/getCaptchaOpen', method: 'get', @@ -124,10 +124,18 @@ export function reqCheck(data) { * @author yubaoshan * @date 2020/6/23 23:09 */ -export function loginWithCode (parameter) { +export function loginWithCode(parameter) { return axios({ url: '/loginWithCode', method: 'post', params: parameter }) -} \ No newline at end of file +} + +export function ChangeLogin(parameter) { + return axios({ + url: '/ChangeLogin', + method: 'post', + params: parameter + }) +} diff --git a/src/components/GlobalHeader/GlobalHeader.vue b/src/components/GlobalHeader/GlobalHeader.vue index cf4cf6e..a6347d5 100644 --- a/src/components/GlobalHeader/GlobalHeader.vue +++ b/src/components/GlobalHeader/GlobalHeader.vue @@ -59,6 +59,7 @@ import { ALL_APPS_MENU } from '@/store/mutation-types' import Vue from 'vue' import { message } from 'ant-design-vue/es' + export default { name: 'GlobalHeader', components: { diff --git a/src/components/tools/UserMenu.vue b/src/components/tools/UserMenu.vue index ee1bce0..ab61176 100644 --- a/src/components/tools/UserMenu.vue +++ b/src/components/tools/UserMenu.vue @@ -44,6 +44,13 @@ 账户设置 + + + + + 切换租户 + + @@ -54,13 +61,7 @@ - + @@ -71,6 +72,13 @@ + + + + 选择 + + + @@ -98,6 +106,27 @@ export default { data() { return { production: config.production, + userFlag: false, + columns: [ + { + title: '租户名称', + dataIndex: 'tenantName', + key: 'tenantName' + }, + { + title: '账号名称', + dataIndex: 'userName', + key: 'userName' + }, + { + title: '操作', + dataIndex: 'action', + key: 'action', + scopedSlots: { customRender: 'action' } + } + ], + userList: [], + userLoad: false, labelCol: { xs: { span: 24 }, sm: { span: 5 } @@ -112,7 +141,9 @@ export default { defApp: [] } }, - + created() { + this.userList = this.userInfo.userAccountRelation ? JSON.parse(JSON.stringify(this.userInfo.userAccountRelation)) : [] + }, computed: { ...mapGetters(['token', 'nickname', 'avatar', 'userInfo']) }, @@ -121,11 +152,15 @@ export default { await this.$socket.authenticate(this.token) }, methods: { - ...mapActions(['Logout', 'MenuChange']), + ...mapActions(['Logout', 'MenuChange', 'changeUser']), loadError() { console.log('加载失败失败失败') this.$store.commit('SET_AVATAR', '/avatar2.jpg') // }, + switchUser(record) { + this.userLoad = true + this.changeUser(record) + }, handleLogout() { this.$confirm({ title: '提示', @@ -146,7 +181,7 @@ export default { }) }) }, - onCancel() {} + onCancel() { } }) }, @@ -157,7 +192,13 @@ export default { this.visible = true this.defApp.push(Vue.ls.get(ALL_APPS_MENU)[0].code) }, - + handleChangeUser() { + if (this.userList.length > 0) { + this.userFlag = true + } else { + this.$message.warning('暂无租户可切换') + } + }, switchApp(appCode) { this.visible = false this.defApp = [] diff --git a/src/store/modules/user.js b/src/store/modules/user.js index acb1c4f..e3a6bae 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -1,5 +1,5 @@ import Vue from 'vue' -import { login, getLoginUser, logout,loginWithCode } from '@/api/modular/system/loginManage' +import { login, getLoginUser, logout, loginWithCode, ChangeLogin } from '@/api/modular/system/loginManage' import { sysDictTypeTree } from '@/api/modular/system/dictManage' import { sysMenuChange } from '@/api/modular/system/menuManage' import { ACCESS_TOKEN, ALL_APPS_MENU, DICT_TYPE_TREE_DATA, NOTICE_RECEIVED } from '@/store/mutation-types' @@ -234,6 +234,35 @@ const user = { }) }) }, + changeUser({ commit, state }, record) { + ChangeLogin({ changeTo: record.id }).then(res => { + if (res.success) { + const token = res.data + logout(state.token).then(res => { + commit('SET_TOKEN', '') + commit('SET_ROLES', []) + commit('SET_BUTTONS', []) + commit('SET_ADMINTYPE', '') + commit('SET_INFO', null) + Vue.ls.remove(ACCESS_TOKEN) + Vue.ls.remove(ALL_APPS_MENU) + Vue.ls.remove(DICT_TYPE_TREE_DATA) + Vue.ls.remove('FIRSTFLAG') + localStorage.removeItem('formTableData'); + localStorage.removeItem('bookingSetting'); + localStorage.removeItem('booking_form_copy'); + localStorage.removeItem('booking_form_yard'); + localStorage.removeItem('vesselinfoSetting'); + localStorage.removeItem('mskOrderSetting'); + Vue.ls.set(ACCESS_TOKEN, token, 7 * 24 * 60 * 60 * 1000) + commit('SET_TOKEN', token) + location.reload(); + }) + } else { + this.$message.error(res.message) + } + }) + }, // scoket订舱未读消息数量 scoketMessage({ commit, state }) { GetNumSum({ module: 'Booking' }) @@ -280,31 +309,31 @@ const user = { } }) }, - // 跨平台登录 - LoginWithCode({ commit }, userInfo) { - return new Promise((resolve, reject) => { - loginWithCode(userInfo) - .then(response => { - if (!response.success) { - reject(response) - return - } - const result = response.data - console.log(response, 1111) - Vue.ls.set(ACCESS_TOKEN, result, 7 * 24 * 60 * 60 * 1000) - Vue.ls.set('FIRSTFLAG', true, 7 * 24 * 60 * 60 * 1000) - commit('SET_TOKEN', result) - commit('SET_LOADING', false) - resolve() - }) - .catch(error => { - console.log(error) - reject(error) - }) - }) - }, - // 登出 - ClearnInfo({ commit, state }) { + // 跨平台登录 + LoginWithCode({ commit }, userInfo) { + return new Promise((resolve, reject) => { + loginWithCode(userInfo) + .then(response => { + if (!response.success) { + reject(response) + return + } + const result = response.data + console.log(response, 1111) + Vue.ls.set(ACCESS_TOKEN, result, 7 * 24 * 60 * 60 * 1000) + Vue.ls.set('FIRSTFLAG', true, 7 * 24 * 60 * 60 * 1000) + commit('SET_TOKEN', result) + commit('SET_LOADING', false) + resolve() + }) + .catch(error => { + console.log(error) + reject(error) + }) + }) + }, + // 登出 + ClearnInfo({ commit, state }) { return new Promise(resolve => { commit('SET_TOKEN', '') commit('SET_ROLES', []) diff --git a/src/views/main/BookingGangjie/detail/modules/basicInfo.vue b/src/views/main/BookingGangjie/detail/modules/basicInfo.vue index f02a511..b2f4cae 100644 --- a/src/views/main/BookingGangjie/detail/modules/basicInfo.vue +++ b/src/views/main/BookingGangjie/detail/modules/basicInfo.vue @@ -349,7 +349,7 @@ v-if="!vesselFrom" :openSearch="true" @change="getSelectViewRes"> - - + @@ -959,7 +959,7 @@ export default { }, computed: { ...mapGetters([ - 'projectDict','vesselFrom' + 'projectDict', 'vesselFrom' ]) }, methods: { diff --git a/src/views/main/BookingGangjie/detail/modules/goodsTable.vue b/src/views/main/BookingGangjie/detail/modules/goodsTable.vue index 83a2a2f..e236d2f 100644 --- a/src/views/main/BookingGangjie/detail/modules/goodsTable.vue +++ b/src/views/main/BookingGangjie/detail/modules/goodsTable.vue @@ -4,8 +4,10 @@
- 添加 - 删除 + 添加 + 删除 多品名 @@ -21,22 +23,15 @@ 展开箱量 - 刷新 + 刷新
-
- - +
@@ -49,18 +44,9 @@
-
暂无数据
@@ -68,19 +54,10 @@ -
-
新增 @@ -88,15 +65,9 @@ 保存
-
暂无数据
@@ -635,7 +606,7 @@ export default { return (
- + -
) @@ -1919,6 +1890,12 @@ export default { this.tableData = [] const lastNum = this.tableData.length > 0 ? Number(this.tableData[this.tableData.length - 1].rowKey) + 1 : 0 const yardSetArr = localStorage.getItem('booking_form_yard') ? JSON.parse(localStorage.getItem('booking_form_yard')) : [] + const arr = [] + yardSetArr.forEach(item => { + if (item.code === 'VESSEL' || item.code === 'VOYNO') { + arr.push(1) + } + }) const ctnSetArr = [] const infoSetArr = [] yardSetArr.forEach(item => { @@ -1967,19 +1944,42 @@ export default { }) } this.tableData = [...this.tableData, ...addTable] - if (infoSetArr.length > 0) { - const arr = [] - infoSetArr.forEach(item => { - for (const key in data[0]) { - if (item.code === key) { - item.value = data[0][key] - arr.push(item) + if ((data[0].VESSEL || data[0].VOYNO) && (this.details.vessel || this.details.voyno) && arr.length > 0) { + const that = this + this.$confirm({ + title: '提示', + content: '已经录入船名航次,是否要覆盖', + onOk() { + if (infoSetArr.length > 0) { + const arr = [] + infoSetArr.forEach(item => { + for (const key in data[0]) { + if (item.code === key) { + item.value = data[0][key] + arr.push(item) + } + } + }) + that.$emit('getInfoSet', arr) } + that.$forceUpdate() } - }) - this.$emit('getInfoSet', arr) + }); + } else { + if (infoSetArr.length > 0) { + const arr = [] + infoSetArr.forEach(item => { + for (const key in data[0]) { + if (item.code === key) { + item.value = data[0][key] + arr.push(item) + } + } + }) + this.$emit('getInfoSet', arr) + } + this.$forceUpdate() } - this.$forceUpdate() } else { this.$message.error(res.message) } diff --git a/src/views/main/BookingGangjie/list/index.vue b/src/views/main/BookingGangjie/list/index.vue index 7d6741f..e6928e2 100644 --- a/src/views/main/BookingGangjie/list/index.vue +++ b/src/views/main/BookingGangjie/list/index.vue @@ -317,7 +317,7 @@