Commit 4bd9f52c authored by tianhongyang's avatar tianhongyang

bug 修改,重写原有tab跳转逻辑

parent 066a12fe
...@@ -50,11 +50,12 @@ ...@@ -50,11 +50,12 @@
</template> </template>
<script> <script>
import draggable from 'vuedraggable' import draggable from 'vuedraggable';
import ScrollPane from './ScrollPane' import ScrollPane from './ScrollPane';
import path from 'path' import path from 'path';
import { cloneDeep } from 'lodash-es';
export default { export default {
components: { ScrollPane, draggable }, components: { ScrollPane, draggable },
data() { data() {
return { return {
...@@ -71,7 +72,7 @@ ...@@ -71,7 +72,7 @@
sort: true, // 是否启用排序功能 sort: true, // 是否启用排序功能
draggable: '.tags-view-item', // 可拖拽元素的选择器 draggable: '.tags-view-item', // 可拖拽元素的选择器
}, },
havemore:false, havemore: false,
}; };
}, },
computed: { computed: {
...@@ -107,7 +108,7 @@ ...@@ -107,7 +108,7 @@
this.addTags(); this.addTags();
this.moveToCurrentTag(); this.moveToCurrentTag();
this.getviews(); this.getviews();
this.getviewswidth() this.getviewswidth();
}, },
visible(value) { visible(value) {
if (value) { if (value) {
...@@ -121,7 +122,7 @@ ...@@ -121,7 +122,7 @@
this.$nextTick(() => { this.$nextTick(() => {
this.initTags(); this.initTags();
this.addTags(); this.addTags();
this.getviewswidth() this.getviewswidth();
}); });
}, },
methods: { methods: {
...@@ -143,11 +144,11 @@ ...@@ -143,11 +144,11 @@
}); });
sessionStorage.setItem("views", JSON.stringify(viewlist)); sessionStorage.setItem("views", JSON.stringify(viewlist));
}, },
getviewswidth(){ getviewswidth() {
let fatherwidth = this.$refs.getviews.offsetWidth-6 let fatherwidth = this.$refs.getviews.offsetWidth - 6;
let viewlength = this.$store.state.tagsView.visitedViews.length let viewlength = this.$store.state.tagsView.visitedViews.length;
//是否超出了能展示最多的个数 //是否超出了能展示最多的个数
this.havemore = fatherwidth/80<viewlength this.havemore = fatherwidth / 80 < viewlength;
}, },
changetags() { changetags() {
this.showall = false; this.showall = false;
...@@ -358,8 +359,10 @@ ...@@ -358,8 +359,10 @@
padding-top: 20px; padding-top: 20px;
} }
.tags-view-wrapper { .tags-view-wrapper {
::v-deep .el-scrollbar__view{ ::v-deep .el-scrollbar__view {
>div{display: flex;} > div {
display: flex;
}
} }
.tags-view-item { .tags-view-item {
display: inline-block; display: inline-block;
...@@ -399,7 +402,7 @@ ...@@ -399,7 +402,7 @@
/*&:first-of-type {*/ /*&:first-of-type {*/
/*margin-left: 64px;*/ /*margin-left: 64px;*/
/*}*/ /*}*/
.hoverclass{ .hoverclass {
padding: 0 20px 0 8px; padding: 0 20px 0 8px;
height: 28px; height: 28px;
line-height: 28px; line-height: 28px;
...@@ -410,13 +413,12 @@ ...@@ -410,13 +413,12 @@
white-space: nowrap; white-space: nowrap;
border-radius: 4px; border-radius: 4px;
&:hover { &:hover {
background: #F5F5F5; background: #f5f5f5;
color: #232323; color: #232323;
} }
} }
.el-icon-close:hover { .el-icon-close:hover {
background: #EEEEEE;; background: #eeeeee;
color: #999999; color: #999999;
} }
&.active { &.active {
...@@ -470,15 +472,15 @@ ...@@ -470,15 +472,15 @@
.imgs { .imgs {
border-radius: 4px; border-radius: 4px;
&:hover{ &:hover {
background: #EEEEEE; background: #eeeeee;
} }
> img { > img {
width: 16px; width: 16px;
} }
} }
.showall{ .showall {
background: #EEEEEE; background: #eeeeee;
} }
.tagslist { .tagslist {
transition: all 0.2s; transition: all 0.2s;
...@@ -570,5 +572,4 @@ ...@@ -570,5 +572,4 @@
} }
} }
} }
</style> </style>
import store from '@/store'; import store from '@/store';
import router from '@/router'; import router from '@/router';
import { paramsToQuery } from "@/utils/"; import { paramsToQuery, getUrlSearchQuery } from "@/utils/";
export default { export default {
// 刷新当前tab页签 // 刷新当前tab页签 刷新参数无变化时使用
refreshPage(obj) { refreshPage(obj) {
const { path, query, matched } = router.currentRoute; const { path, query, matched } = router.currentRoute;
if (obj === undefined) { if (obj === undefined) {
...@@ -30,6 +30,17 @@ export default { ...@@ -30,6 +30,17 @@ export default {
return router.push(obj); return router.push(obj);
} }
}, },
// 关闭当前tab页签并刷新 参数变动时用
async refershCurrent(title, url, params) {
// 删除当前页签
await store.dispatch("tagsView/delView", router.currentRoute);
const { tagRoutes, defaultRoutes } = this.createDifferentTabData(title, url, params);
await store.dispatch('tagsView/addView', tagRoutes);
router.push({
...defaultRoutes,
path: `/redirect${defaultRoutes.fullPath}`,
});
},
// 关闭指定tab页签 // 关闭指定tab页签
closePage(obj) { closePage(obj) {
if (obj === undefined) { if (obj === undefined) {
...@@ -60,13 +71,30 @@ export default { ...@@ -60,13 +71,30 @@ export default {
return store.dispatch('tagsView/delOthersViews', obj || router.currentRoute); return store.dispatch('tagsView/delOthersViews', obj || router.currentRoute);
}, },
// 添加tab页签 // 添加tab页签
async openPage(title, url, params) { async openPage(title, url, params = {}) {
const obj = { path: url, fullPath: url, query: params, meta: { title: title } }; const { tagRoutes, defaultRoutes } = this.createDifferentTabData(title, url, params);
if (params && Object.keys(params).length) { await store.dispatch('tagsView/addView', tagRoutes);
return router.push(defaultRoutes);
},
createDifferentTabData(title, url, params = {}) {
const origin = location.origin;
// 拼接完整路径
const integrityUrl = `${origin}${url}`;
const paramsResult = getUrlSearchQuery(integrityUrl);
// 链接上带有参数 合并到query对象
if (paramsResult && Object.keys(paramsResult).length) {
params ? null : params = {};
params = { ...JSON.parse(JSON.stringify(params)), ...paramsResult };
url = url.slice(0, url.indexOf("?"));
}
const obj = { path: url, meta: { title }, fullPath: url, query: params, };
const _obj = JSON.parse(JSON.stringify(obj));
if (params && Object?.keys(params)?.length) {
obj.fullPath = `${obj.path}${paramsToQuery(params) ? "?" + paramsToQuery(params) : ""}`; obj.fullPath = `${obj.path}${paramsToQuery(params) ? "?" + paramsToQuery(params) : ""}`;
// 用于匹配 router跳转的fullPath 默认会 encodeURIComponent
_obj.fullPath = `${_obj.path}${paramsToQuery(params, false) ? "?" + paramsToQuery(params, false) : ""}`;
} }
await store.dispatch('tagsView/addView', obj); return { tagRoutes: _obj, defaultRoutes: obj };
return router.push({ path: url, query: params });
}, },
// 修改tab页签 // 修改tab页签
updatePage(obj) { updatePage(obj) {
......
...@@ -18,7 +18,7 @@ const mutations = { ...@@ -18,7 +18,7 @@ const mutations = {
if (state.visitedViews.some(v => v.fullPath === view.fullPath)) return; if (state.visitedViews.some(v => v.fullPath === view.fullPath)) return;
state.visitedViews.push( state.visitedViews.push(
Object.assign({}, view, { Object.assign({}, view, {
title: view.meta.title || 'no-name' title: view.meta.title || 'no-name',
}) })
); );
}, },
......
...@@ -423,14 +423,14 @@ export const getUrlSearchQuery = (originUrl = location.href, reg = new RegExp("\ ...@@ -423,14 +423,14 @@ export const getUrlSearchQuery = (originUrl = location.href, reg = new RegExp("\
* 对象转换为查询字符串 * 对象转换为查询字符串
* @param {{[key:string] : any}} query * @param {{[key:string] : any}} query
*/ */
export const paramsToQuery = (query) => { export const paramsToQuery = (query, decode = true) => {
try { try {
if (Object.prototype.toString.call(query) !== "[object Object]") return ""; if (Object.prototype.toString.call(query) !== "[object Object]") return "";
const params = new URLSearchParams(query); const params = new URLSearchParams(query);
let searchStrArray = []; let searchStrArray = [];
params.forEach((value, key) => { params.forEach((value, key) => {
if (params.has(key)) { if (params.has(key)) {
searchStrArray.push(`${key}=${decodeURIComponent(value)}`); searchStrArray.push(`${key}=${decode ? decodeURIComponent(value) : encodeURIComponent(decodeURIComponent(value))}`);
} }
}); });
return searchStrArray.join("&"); return searchStrArray.join("&");
......
...@@ -127,13 +127,10 @@ export default { ...@@ -127,13 +127,10 @@ export default {
if (result.code == 200 && customFormResult.code == 200) { if (result.code == 200 && customFormResult.code == 200) {
this.$message.success("更新咨询机构结算信息成功"); this.$message.success("更新咨询机构结算信息成功");
this.isModify = false; this.isModify = false;
this.$tab.closeOpenPage({ this.$tab.refershCurrent(this.projectDetailInfo.projectName, `/consultingOrgManagement/projectDetail`, {
path: `/redirect/${"consultingOrgManagement/projectDetail"}`,
query: {
projectKey: this.projectKey, projectKey: this.projectKey,
advisoryBodyCid: this.advisoryBodyCid ? this.advisoryBodyCid : data.advisoryBodyCid, advisoryBodyCid: this.advisoryBodyCid ? this.advisoryBodyCid : data.advisoryBodyCid,
currentKey: "consultingAgency" currentKey: "consultingAgency"
}
}); });
} }
} catch (error) { } catch (error) {
......
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
import TableListCom from "@/components/TableListCom"; import TableListCom from "@/components/TableListCom";
import Skeleton from "@/components/Skeleton"; import Skeleton from "@/components/Skeleton";
import { getConsultingOrgEenterpriseListWithSearchApi } from "@/api/consultingOrgManagement"; import { getConsultingOrgEenterpriseListWithSearchApi } from "@/api/consultingOrgManagement";
import { queryConditionFiltering } from "@/utils"; import { queryConditionFiltering, replaceDomTags } from "@/utils";
import { v4 } from 'uuid'; import { v4 } from 'uuid';
import { encodeStr } from "@/assets/js/common"; import { encodeStr } from "@/assets/js/common";
export default { export default {
...@@ -139,7 +139,7 @@ export default { ...@@ -139,7 +139,7 @@ export default {
}, },
toCooperateDetail(row) { toCooperateDetail(row) {
if (!row.advisoryBodyCid) return this.$message.warning("缺少咨询机构id"); if (!row.advisoryBodyCid) return this.$message.warning("缺少咨询机构id");
this.$tab.openPage(`${row.advisoryBodyName}合作明细`, `/consultingOrgManagement/detailsOfCooperation/${row.advisoryBodyCid}`); this.$tab.openPage(`${row.advisoryBodyName}合作明细`, `/enterprise/${encodeStr(row.advisoryBodyCid)}?path=cooperationRecord&companyName=${replaceDomTags(row.advisoryBodyName)}`);
}, },
// 跳转到企业详情 // 跳转到企业详情
viewEnterprise(row) { viewEnterprise(row) {
......
...@@ -354,7 +354,7 @@ export default { ...@@ -354,7 +354,7 @@ export default {
}, },
// 业主单位跳转企业详情 // 业主单位跳转企业详情
viewOwnerUnit(row) { viewOwnerUnit(row) {
this.$tab.openPage(row.ownerName ? row.ownerName : "业主单位详情", `/enterprise/${encodeStr(row.ownerUnitCid)}?companyName=${row.ownerName}`);
} }
}, },
} }
......
...@@ -51,6 +51,8 @@ import mixin from '@/views/detail/party-a/mixins/mixin'; ...@@ -51,6 +51,8 @@ import mixin from '@/views/detail/party-a/mixins/mixin';
import { getCooperativeOwnerUnitsListApi, getCooperativeOwnerUnitsDetailApi, getCooperativeOwnerUnitsOptionsApi, getCooperativeOwnerUnitsCountAmountApi } from "@/api/consultingTransaction"; import { getCooperativeOwnerUnitsListApi, getCooperativeOwnerUnitsDetailApi, getCooperativeOwnerUnitsOptionsApi, getCooperativeOwnerUnitsCountAmountApi } from "@/api/consultingTransaction";
import DialogHeadFormNew from "../component/HeadFormNew"; import DialogHeadFormNew from "../component/HeadFormNew";
import DialogTables from "../component/Tables"; import DialogTables from "../component/Tables";
import { replaceDomTags } from "@/utils";
import { encodeStr } from "@/assets/js/common";
export default { export default {
name: "cooperativeConstructionUnit", name: "cooperativeConstructionUnit",
mixins: [mixin], mixins: [mixin],
...@@ -240,7 +242,9 @@ export default { ...@@ -240,7 +242,9 @@ export default {
} }
}, },
viewEnterprise(row) { viewEnterprise(row) {
this.$tab.openPage(`${replaceDomTags(row.companyName)}详情`, `/enterprise/${encodeStr(row.companyId)}`, {
companyName: replaceDomTags(row.companyName)
});
}, },
async sortChange({ column, order, prop }) { async sortChange({ column, order, prop }) {
let sort = null; let sort = null;
......
...@@ -93,6 +93,8 @@ import { getCooperativeOwnerUnitsListApi, getCooperativeOwnerUnitsDetailApi, get ...@@ -93,6 +93,8 @@ import { getCooperativeOwnerUnitsListApi, getCooperativeOwnerUnitsDetailApi, get
import DialogHeadFormNew from "../component/HeadFormNew"; import DialogHeadFormNew from "../component/HeadFormNew";
import DialogTables from "../component/Tables"; import DialogTables from "../component/Tables";
import DskTabToggle from "@/components/DskTabToggle"; import DskTabToggle from "@/components/DskTabToggle";
import { replaceDomTags } from "@/utils";
import { encodeStr } from "@/assets/js/common";
export default { export default {
name: "cooperativeGroup", name: "cooperativeGroup",
mixins: [mixin], mixins: [mixin],
...@@ -217,7 +219,10 @@ export default { ...@@ -217,7 +219,10 @@ export default {
const optionsKey = [["businessType", "businessTypes"], ["counterpartCompanyRole", "counterpartCompanyRoles"], ["projectType", "projectTypes"]]; const optionsKey = [["businessType", "businessTypes"], ["counterpartCompanyRole", "counterpartCompanyRoles"], ["projectType", "projectTypes"]];
optionsKey.forEach(([key, value]) => { optionsKey.forEach(([key, value]) => {
this.$set(this.formData.find(formItem => value == formItem.fieldName), "options", this.selectOptions[key]); const _temp = this.formData.find(formItem => value == formItem.fieldName);
if (_temp) {
this.$set(_temp, "options", this.selectOptions[key]);
}
}); });
} }
} catch (error) { } catch (error) {
...@@ -305,7 +310,7 @@ export default { ...@@ -305,7 +310,7 @@ export default {
} }
}, },
viewEnterprise(row) { viewEnterprise(row) {
// this.$router.push(`/enterprise/${encodeStr(row.companyId)}?companyName=${replaceDomTags(row.companyName)}`);
}, },
async sortChange({ column, order, prop }) { async sortChange({ column, order, prop }) {
let sort = null; let sort = null;
......
...@@ -51,6 +51,8 @@ import mixin from '@/views/detail/party-a/mixins/mixin'; ...@@ -51,6 +51,8 @@ import mixin from '@/views/detail/party-a/mixins/mixin';
import { getCooperativeOwnerUnitsListApi, getCooperativeOwnerUnitsDetailApi, getCooperativeOwnerUnitsOptionsApi, getCooperativeOwnerUnitsCountAmountApi } from "@/api/consultingTransaction"; import { getCooperativeOwnerUnitsListApi, getCooperativeOwnerUnitsDetailApi, getCooperativeOwnerUnitsOptionsApi, getCooperativeOwnerUnitsCountAmountApi } from "@/api/consultingTransaction";
import DialogHeadFormNew from "../component/HeadFormNew"; import DialogHeadFormNew from "../component/HeadFormNew";
import DialogTables from "../component/Tables"; import DialogTables from "../component/Tables";
import { replaceDomTags } from "@/utils";
import { encodeStr } from "@/assets/js/common";
export default { export default {
name: "cooperativeOwnerUnits", name: "cooperativeOwnerUnits",
mixins: [mixin], mixins: [mixin],
...@@ -240,7 +242,10 @@ export default { ...@@ -240,7 +242,10 @@ export default {
} }
}, },
viewEnterprise(row) { viewEnterprise(row) {
// this.$router.push(`/enterprise/${encodeStr(row.companyId)}?companyName=${replaceDomTags(row.companyName)}`);
this.$tab.openPage(`${replaceDomTags(row.companyName)}详情`, `/enterprise/${encodeStr(row.companyId)}`, {
companyName: replaceDomTags(row.companyName)
});
}, },
async sortChange({ column, order, prop }) { async sortChange({ column, order, prop }) {
let sort = null; let sort = null;
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
<!-- 2、准入情况 --> <!-- 2、准入情况 -->
<access-condition v-if="currentPath.pathName=='accessCondition'" :company-id="companyId" :companyInfo="companyInfo"></access-condition> <access-condition v-if="currentPath.pathName=='accessCondition'" :company-id="companyId" :companyInfo="companyInfo"></access-condition>
<!-- 3、供应商合作记录 --> <!-- 3、供应商合作记录 -->
<cooperation-record v-if="currentPath.pathName=='cooperationRecord'" :company-id="companyId"></cooperation-record> <cooperation-record v-if="currentPath.pathName=='cooperationRecord'" :company-id="companyId" :company-name="companyName"></cooperation-record>
</template> </template>
<template v-if="customerId && isCustomer"> <template v-if="customerId && isCustomer">
<!-- 商务信息 --> <!-- 商务信息 -->
...@@ -277,8 +277,8 @@ export default { ...@@ -277,8 +277,8 @@ export default {
if (this.$route.params.id) { // 获取companyId if (this.$route.params.id) { // 获取companyId
let companyId = this.$route.params.id; let companyId = this.$route.params.id;
// 有企业名的情况下带上企业名称 // 有企业名的情况下带上企业名称
let companyName = this.$route.query.companyName; this.companyName = this.$route.query.companyName ? this.$route.query.companyName : "";
await this.getCompanyId(companyId, companyName); await this.getCompanyId(companyId);
} }
} catch (error) { } catch (error) {
console.log(error); console.log(error);
...@@ -288,8 +288,7 @@ export default { ...@@ -288,8 +288,7 @@ export default {
this.currentPath = e; this.currentPath = e;
}, },
// 解密 // 解密
async getCompanyId(companyId, companyName = "") { async getCompanyId(companyId) {
if (companyName) this.companyName = companyName;
let { data } = await idRemark({ mark: companyId }); let { data } = await idRemark({ mark: companyId });
if (data) { if (data) {
this.companyId = data; this.companyId = data;
...@@ -298,7 +297,6 @@ export default { ...@@ -298,7 +297,6 @@ export default {
await this.getStatistic(this.companyName); await this.getStatistic(this.companyName);
await this.handleQuery(); await this.handleQuery();
await this.association(this.$route.query.customerId); await this.association(this.$route.query.customerId);
console.log(this.$refs.sidebar,"sidebar");
this.$refs.sidebar.getFinancial(data); this.$refs.sidebar.getFinancial(data);
} }
}, },
......
...@@ -57,15 +57,15 @@ export default { ...@@ -57,15 +57,15 @@ export default {
}, },
forData: [ forData: [
{ label: '项目列表', prop: 'projectName', width: '222', slot: true, showOverflowTooltip: true }, { label: '项目列表', prop: 'projectName', width: '222', slot: true, showOverflowTooltip: true },
{ label: '项目编码', prop: 'projectCode', width: '123' }, { label: '项目编码', prop: 'projectCode', width: '140' },
{ label: '省市', prop: 'provinceName', minWidth: '110', slot: true }, { label: '省市', prop: 'provinceName', minWidth: '140', slot: true },
{ label: '项目承接类型', prop: 'isinvestproject', width: '102', showOverflowTooltip: true }, { label: '项目承接类型', prop: 'isinvestproject', width: '120', showOverflowTooltip: true },
{ label: '工程基础大类', prop: 'projectType1', width: '98', showOverflowTooltip: true }, { label: '工程基础大类', prop: 'projectType1', width: '120', showOverflowTooltip: true },
{ label: '工程类别明细', prop: 'projectType', width: '98', showOverflowTooltip: true }, { label: '工程类别明细', prop: 'projectType', width: '120', showOverflowTooltip: true },
{ label: '项目负责人姓名', prop: 'projectLeader', width: '110' }, { label: '项目负责人姓名', prop: 'projectLeader', width: '120' },
{ label: '项目负责人专业', prop: 'projectLeaderMajor', width: "110" }, { label: '项目负责人专业', prop: 'projectLeaderMajor', width: "120" },
{ label: '项目负责人联系电话', prop: 'projectLeaderPhone', width: "135" }, { label: '项目负责人联系电话', prop: 'projectLeaderPhone', width: "160" },
{ label: '合同金额(元)', prop: 'contractOrigValue', width: "110", align: "right" }, { label: '合同金额(元)', prop: 'contractOrigValue', width: "160", align: "right" },
{ label: '业主单位', prop: 'ownerName', slot: true, width: "185", showOverflowTooltip: true }, { label: '业主单位', prop: 'ownerName', slot: true, width: "185", showOverflowTooltip: true },
{ label: '项目承接单位', prop: 'contractOrgName', width: "196", slot: true }, { label: '项目承接单位', prop: 'contractOrgName', width: "196", slot: true },
{ label: '咨询机构名称', prop: 'advisoryBodyName', width: "172", slot: true }, { label: '咨询机构名称', prop: 'advisoryBodyName', width: "172", slot: true },
......
...@@ -47,11 +47,12 @@ export default { ...@@ -47,11 +47,12 @@ export default {
DialogHeadFormNew, DialogHeadFormNew,
DialogTables DialogTables
}, },
props: ['companyId'], props: ['companyId', "companyName"],
data() { data() {
return { return {
queryParams: { queryParams: {
customerId: this.companyId, customerId: this.companyId,
companyName: this.companyName,
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment