Commit 4bd9f52c authored by tianhongyang's avatar tianhongyang

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

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