web-zk-admin/src/views/framework/architecture/index.vue

833 lines
20 KiB
Vue
Raw Normal View History

2025-03-23 10:03:12 +08:00
<template>
<div class="page">
<topBar
v-if="topList.length > 0"
2025-08-19 11:46:15 +08:00
:top-list="topList"
2025-03-23 10:03:12 +08:00
:moren="moren"
2025-08-19 11:46:15 +08:00
/>
2025-03-23 10:03:12 +08:00
<div class="thetopbox">
<el-form ref="form" :model="queryParams" label-width="100px">
<el-row>
<el-col :span="4">
2025-05-26 10:41:35 +08:00
<el-form-item :label="'结算期数'" prop="memberSettlePeriodId">
2025-03-23 10:03:12 +08:00
<el-select
2025-08-19 11:46:15 +08:00
v-model="queryParams.memberSettlePeriodId"
2025-05-26 10:41:35 +08:00
:placeholder="'请选择'"
@change="getChildNodeList"
2025-03-23 10:03:12 +08:00
>
<el-option
v-for="item in memberSettlePeriodList"
:key="item.pkId"
:label="item.settleDate"
:value="item.pkId"
2025-08-19 11:46:15 +08:00
/>
2025-03-23 10:03:12 +08:00
</el-select>
2025-08-19 11:46:15 +08:00
</el-form-item>
</el-col>
2025-03-23 10:03:12 +08:00
<el-col :span="4">
<el-form-item :label="'会员编号'" prop="memberCode">
2025-03-23 10:03:12 +08:00
<el-input
v-model="queryParams.memberCode"
2025-08-19 11:46:15 +08:00
clearable
@blur="getChildNodeList"
/>
</el-form-item>
</el-col>
2025-03-23 10:03:12 +08:00
<el-col :span="4">
<el-form-item label="阶段" prop="stage">
<el-select
v-model="queryParams.stage"
placeholder="请选择"
@change="getChildNodeList"
>
2025-03-23 10:03:12 +08:00
<el-option
v-for="(item, index) in levelList"
2025-03-23 10:03:12 +08:00
:key="index"
:label="item.label"
:value="item.value"
2025-08-19 11:46:15 +08:00
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="状态" prop="stageStatus">
<el-select
v-model="queryParams.stageStatus"
:placeholder="'请选择'"
@change="getChildNodeList"
>
<el-option
v-for="(item, index) in statusEnum"
:key="index"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="子点位" prop="childNode">
<el-select v-model="queryParams.childNode" clearable filterable :placeholder="'请选择'">
<el-option
v-for="(item, index) in childNodeList"
:key="index"
:label="item.childNode"
:value="item.childNode"
/>
</el-select>
</el-form-item>
</el-col>
2025-03-23 10:03:12 +08:00
<el-col :span="4" style="margin-left: 30px">
<div class="searchbox">
2025-08-19 11:46:15 +08:00
<el-button
:loading="loading"
class="searchbtn"
@click="getSearch"
> {{ '搜索' }}</el-button>
<el-button @click="resetHandle"> {{ '重置' }}</el-button>
2025-03-23 10:03:12 +08:00
</div>
</el-col>
2025-08-19 11:46:15 +08:00
</el-row>
</el-form>
2025-03-23 10:03:12 +08:00
</div>
<div class="lefttop">
2025-08-19 11:46:15 +08:00
<div v-for="(item, index) in avaerInfoList" :key="index" class="single">
<!-- <img :src="item.value" alt=""> -->
<!-- <div class="singletitle">{{ item.name }}</div> -->
2025-03-23 10:03:12 +08:00
</div>
</div>
<div class="tree">
<div class="tree-content" @wheel="handleWheel" @mousedown.stop="move">
<div :style="{ transform: `scale(${scale})`, height: '100%' }">
2025-03-23 10:03:12 +08:00
<vue2-org-tree
ref="orgTree"
style="height: 100%"
:data="data"
collapsable
2025-08-19 11:46:15 +08:00
:render-content="renderContent"
2025-03-23 10:03:12 +08:00
@on-expand="onExpand"
@on-node-click="NodeClick"
@on-node-mouseover="onMouseover"
@on-node-mouseout="onMouseout"
/>
</div>
</div>
</div>
<!-- </el-scrollbar> -->
2025-08-19 11:46:15 +08:00
<div v-show="false" ref="copyContent" class="copyContent">
2025-05-26 10:41:35 +08:00
<div>{{ '会员编号' }}{{ treeData.memberCode }}</div>
<div>{{ '会员姓名' }}{{ treeData.name }}</div>
<div>{{ '支付日期' }}{{ treeData.payDate }}</div>
<div>{{ '业绩' }}({{ isLocals() }})&nbsp;&nbsp;左区&nbsp;&nbsp;右区</div>
2025-03-23 10:03:12 +08:00
<div>
真实新增&nbsp;&nbsp;{{ treeData.leftRealNewPv }}&nbsp;&nbsp;{{
treeData.rightRealNewPv
}}
</div>
<div>
首购新增&nbsp;&nbsp;{{ treeData.leftFirstPurchaseAdd }}&nbsp;&nbsp;{{
treeData.rightFirstPurchaseAdd
}}
</div>
<div>
复购新增{{ treeData.leftRepeatPurchaseAdd }}&nbsp;&nbsp;
{{ treeData.rightRepeatPurchaseAdd }}
</div>
<div>
真实累计{{ treeData.leftRealTotal }}&nbsp;&nbsp;{{
treeData.rightRealTotal
}}
</div>
<div>
首购累计{{ treeData.leftFirstTotal }}&nbsp;&nbsp;{{
treeData.rightFirstTotal
}}
</div>
<div>
复购累计 {{ treeData.leftRepeatPurchaseTotal }}&nbsp;&nbsp;{{
treeData.rightRepeatPurchaseTotal
}}
</div>
<div>
首购结余{{ treeData.leftFirstSurplus }}&nbsp;&nbsp;{{
treeData.rightFirstSurplus
}}
</div>
<div>
复购结余 {{ treeData.leftRepeatPurchaseSurplus }}&nbsp;&nbsp;{{
treeData.rightRepeatPurchaseSurplus
}}
</div>
</div>
</div>
</template>
<script>
2025-08-19 11:46:15 +08:00
import topBar from '@/components/topBar'
2025-03-23 10:03:12 +08:00
import {
getAzFramework,
getMemberSettlePeriod,
getChildList
2025-08-19 11:46:15 +08:00
} from '@/api/archityecture'
import { isLocals } from '../../../utils/numberToCurrency'
import tabBarMixin from './mixins/tab-bar'
2025-03-23 10:03:12 +08:00
export default {
2025-08-19 11:46:15 +08:00
name: 'Azjg',
2025-03-23 10:03:12 +08:00
components: {
topBar
2025-03-23 10:03:12 +08:00
},
2025-08-19 11:46:15 +08:00
mixins: [tabBarMixin],
2025-03-23 10:03:12 +08:00
data() {
return {
2025-08-19 11:46:15 +08:00
moren: 'azjg',
2025-03-23 10:03:12 +08:00
queryParams: {
2025-08-19 11:46:15 +08:00
memberSettlePeriodId: '', // 期数
2025-09-26 10:43:16 +08:00
memberCode: '', // 会员编号
stage: 1,
stageStatus: '',
childNode: ''
2025-03-23 10:03:12 +08:00
},
levelList: [
{ value: 1, label: '一阶段' },
{ value: 2, label: '二阶段' },
{ value: 3, label: '三阶段' }
],
statusEnum: [
{ value: 0, label: '已完成' },
{ value: 1, label: '未完成' }
],
2025-03-23 10:03:12 +08:00
basicSwitch: false,
basicInfo: { id: null, label: null },
data: {},
treeData: {},
ifShow: false,
avaerInfoList: [],
2025-08-19 11:46:15 +08:00
memberSettlePeriodList: [], // 期数
2025-03-23 10:03:12 +08:00
tzList: [
2025-08-19 11:46:15 +08:00
{ value: 0, label: '是' },
{ value: 1, label: '否' }
2025-03-23 10:03:12 +08:00
],
scale: 1,
loading: false,
childNodeList: []
2025-08-19 11:46:15 +08:00
}
2025-03-23 10:03:12 +08:00
},
created() {
getMemberSettlePeriod().then((res) => {
if (res.code === 200) {
this.memberSettlePeriodList = (res.data || []).filter(item => item.isThisDay !== 0)
this.queryParams.memberSettlePeriodId = this.memberSettlePeriodList[0].pkId
}
})
2025-03-23 10:03:12 +08:00
},
methods: {
handleWheel(event) {
// 暂时禁用滚轮缩放功能
// event.preventDefault()
// const delta = Math.sign(event.deltaY)
// const newScale = this.scale - delta * 0.1
// this.scale = Math.max(0.01, Math.min(newScale, 10))
return
2025-03-23 10:03:12 +08:00
},
isLocals,
copyText() {
2025-08-19 11:46:15 +08:00
const copyContent = this.$refs.copyContent
const textLines = Array.from(copyContent.querySelectorAll('div')).map(
2025-03-23 10:03:12 +08:00
(div) => div.textContent.trim()
2025-08-19 11:46:15 +08:00
)
const text = textLines.join('\n')
const tempInput = document.createElement('textarea')
tempInput.value = text
document.body.appendChild(tempInput)
tempInput.select()
2025-03-23 10:03:12 +08:00
try {
2025-08-19 11:46:15 +08:00
document.execCommand('copy')
2025-03-23 10:03:12 +08:00
this.$message({
2025-06-08 15:32:44 +08:00
message: '复制成功',
2025-08-19 11:46:15 +08:00
type: 'success'
})
2025-03-23 10:03:12 +08:00
} catch (error) {
this.$message({
2025-08-19 11:46:15 +08:00
message: '复制失败',
type: 'warning'
})
2025-03-23 10:03:12 +08:00
}
2025-08-19 11:46:15 +08:00
tempInput.remove()
window.getSelection().removeAllRanges()
2025-03-23 10:03:12 +08:00
},
2025-08-19 11:46:15 +08:00
// 返回
2025-03-23 10:03:12 +08:00
goback() {
2025-08-19 11:46:15 +08:00
this.queryParams.memberCode = this.data.parentMemberCode
this.getSearch()
2025-03-23 10:03:12 +08:00
},
2025-08-19 11:46:15 +08:00
// 拖拽移动
2025-03-23 10:03:12 +08:00
move(e) {
2025-08-19 11:46:15 +08:00
const odiv = e.currentTarget // 获取元素
console.log(e)
2025-03-23 10:03:12 +08:00
// 算出鼠标相对元素的位置
2025-08-19 11:46:15 +08:00
const disX = e.clientX - odiv.offsetLeft
const disY = e.clientY - odiv.offsetTop
2025-03-23 10:03:12 +08:00
document.onmousemove = (e) => {
// 鼠标按下并移动的事件
// 用鼠标的位置减去鼠标相对元素的位置,得到元素的位置
2025-08-19 11:46:15 +08:00
const left = e.clientX - disX
const top = e.clientY - disY
2025-03-23 10:03:12 +08:00
// 绑定元素位置到positionX和positionY上面
2025-08-19 11:46:15 +08:00
this.positionX = top
this.positionY = left
2025-03-23 10:03:12 +08:00
// 移动当前元素
2025-08-19 11:46:15 +08:00
odiv.style.left = left + 'px'
odiv.style.top = top + 'px'
}
2025-03-23 10:03:12 +08:00
document.onmouseup = () => {
2025-08-19 11:46:15 +08:00
document.onmousemove = null
document.onmouseup = null
}
2025-03-23 10:03:12 +08:00
},
2025-08-19 11:46:15 +08:00
// 鼠标移入
2025-03-23 10:03:12 +08:00
onMouseover(e, data) {
2025-08-19 11:46:15 +08:00
this.basicInfo = data
this.basicSwitch = true
2025-03-23 10:03:12 +08:00
},
2025-08-19 11:46:15 +08:00
// 鼠标移出
2025-03-23 10:03:12 +08:00
onMouseout(e, data) {
2025-08-19 11:46:15 +08:00
this.basicSwitch = false
2025-03-23 10:03:12 +08:00
},
2025-08-19 11:46:15 +08:00
// 渲染节点
2025-03-23 10:03:12 +08:00
renderContent(h, data) {
if (Object.keys(data).length > 0) {
return (
<div class='render-content-item'>
{/* 节点编号 */}
{data.nodeCode !== '0-root' && (
<div class='node-code'>
<span>{data.nodeCode}</span>
</div>
)}
{/* 会员信息或空点位 */}
<div class='node-content'>
{data.memberCode && data.memberName ? (
<div class='member-info'>
<div class='member-details'>
<div class='member-code'>{data.memberCode}</div>
<div class='member-name'>{data.memberName}</div>
</div>
</div>
) : (
<div class='empty-node'>
<div class='empty-text'>空点位</div>
</div>
)}
</div>
</div>)
} else {
return null
}
2025-03-23 10:03:12 +08:00
},
2025-08-19 11:46:15 +08:00
// 右键点击
2025-03-23 10:03:12 +08:00
rightClick(e, data) {
2025-08-19 11:46:15 +08:00
event.preventDefault()
this.queryParams.memberCode = data.memberCode
this.getSearch()
2025-03-23 10:03:12 +08:00
},
2025-08-19 11:46:15 +08:00
// 点击节点
2025-03-23 10:03:12 +08:00
NodeClick(e, data) {},
2025-08-19 11:46:15 +08:00
// 默认展开
2025-03-23 10:03:12 +08:00
toggleExpand(data, val) {
if (Array.isArray(data)) {
data.forEach((item) => {
2025-08-19 11:46:15 +08:00
this.$set(item, 'expand', val)
2025-03-23 10:03:12 +08:00
if (item.children) {
2025-08-19 11:46:15 +08:00
this.toggleExpand(item.children, val)
2025-03-23 10:03:12 +08:00
}
2025-08-19 11:46:15 +08:00
})
2025-03-23 10:03:12 +08:00
} else {
2025-08-19 11:46:15 +08:00
this.$set(data, 'expand', val)
2025-03-23 10:03:12 +08:00
if (data.children) {
2025-08-19 11:46:15 +08:00
this.toggleExpand(data.children, val)
2025-03-23 10:03:12 +08:00
}
}
},
collapse(list) {
list.forEach((child) => {
if (child.expand) {
2025-08-19 11:46:15 +08:00
child.expand = false
2025-03-23 10:03:12 +08:00
}
2025-08-19 11:46:15 +08:00
child.children && this.collapse(child.children)
})
2025-03-23 10:03:12 +08:00
},
2025-08-19 11:46:15 +08:00
// 展开
2025-03-23 10:03:12 +08:00
onExpand(e, data) {
},
getSearch() {
console.log(this.queryParams, '...this.')
if (!this.queryParams.childNode || !this.queryParams.memberCode) {
this.$message.warning('会员编号和子点位不能为空')
return
}
2025-08-19 11:46:15 +08:00
this.loading = true
2025-03-23 10:03:12 +08:00
getAzFramework(this.queryParams).then((res) => {
2025-08-19 11:46:15 +08:00
this.data = res.data[0]
this.toggleExpand(this.data, true)
}).finally(() => {
this.loading = false
})
2025-03-23 10:03:12 +08:00
},
2025-08-19 11:46:15 +08:00
resetHandle() {
2025-03-23 10:03:12 +08:00
this.queryParams = {
2025-08-19 11:46:15 +08:00
memberSettlePeriodId: '', // 期数
memberCode: '', // 会员编号
stage: 7,
2025-08-19 11:46:15 +08:00
type: 1
}
this.queryParams.memberSettlePeriodId = this.memberSettlePeriodList[0].pkId
2025-09-26 10:43:16 +08:00
this.data = {}
this.childNodeList = []
},
getChildNodeList() {
if (!this.queryParams.memberCode) {
return
}
getChildList(this.queryParams).then((res) => {
if (res.code === 200) {
this.childNodeList = res.data || []
}
})
2025-08-19 11:46:15 +08:00
}
}
}
2025-03-23 10:03:12 +08:00
</script>
<style lang="scss" scoped>
::v-deep .el-dialog__headerbtn{
top: 5px;
right: 10px;
border: 1px solid #c8c3c3;
padding: 2px 3px;
border-radius: 50%;
}
::v-deep .tree-content {
background: rgba(0, 0, 0, 0) !important;
}
.tree {
background: #fff;
// min-height: 100vh;
min-height: calc(100vh - 110px);
position: relative;
text-align: center;
// overflow-x: scroll;
width: 100%;
height: 100%;
margin: auto;
// overflow-y: hidden;
// margin-left: -60px;
// margin-top: 20px;
// background: red;
&-content {
text-align: center;
width: 100%;
height: 100%;
background: #fff;
position: absolute;
top: 0;
left: 0;
// overflow: auto;
}
}
::v-deep .org-tree-node-btn {
display: none;
}
::v-deep .org-tree-node-label {
display: block;
}
::v-deep .org-tree-node-label-inner {
background: transparent !important;
2025-03-23 10:03:12 +08:00
padding: 0 !important;
border: none;
box-shadow: none !important;
2025-03-23 10:03:12 +08:00
display: flex;
align-items: center;
justify-content: center;
margin: auto;
// margin-left: -20px;
// z-index: -1;
}
::v-deep .el-dialog__body {
padding: 0;
}
::v-deep .org-tree-container {
display: block;
background: rgba(1, 1, 1, 0) !important;
2025-08-19 11:46:15 +08:00
overflow-x: auto;
2025-03-23 10:03:12 +08:00
}
::v-deep .render-content-item {
border-radius: 12px;
2025-03-23 10:03:12 +08:00
margin: auto;
z-index: 99;
padding: 0;
border: none;
max-width: 200px;
text-align: center;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
overflow: hidden;
position: relative;
&:hover {
transform: translateY(-2px);
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}
&::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 3px;
background: linear-gradient(90deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4);
}
.node-code {
background: rgba(255, 255, 255, 0.1);
padding: 8px 12px;
display: flex;
align-items: center;
justify-content: center;
gap: 6px;
font-size: 12px;
font-weight: 600;
color: rgba(255, 255, 255, 0.9);
backdrop-filter: blur(10px);
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
i {
font-size: 14px;
color: #ffd700;
}
span {
letter-spacing: 0.5px;
}
}
.node-content {
padding: 16px;
background: rgba(255, 255, 255, 0.95);
backdrop-filter: blur(10px);
position: relative;
}
.member-info {
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
position: relative;
.member-avatar {
width: 48px;
height: 48px;
border-radius: 50%;
background: linear-gradient(135deg, #667eea, #764ba2);
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 4px;
box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
i {
font-size: 24px;
color: white;
}
}
.member-details {
text-align: center;
.member-code {
font-size: 13px;
font-weight: 600;
color: #2c3e50;
margin-bottom: 2px;
letter-spacing: 0.3px;
}
.member-name {
font-size: 12px;
color: #7f8c8d;
font-weight: 500;
}
}
.status-indicator.active {
position: absolute;
top: -2px;
right: -2px;
width: 12px;
height: 12px;
background: #27ae60;
border-radius: 50%;
border: 2px solid white;
box-shadow: 0 2px 8px rgba(39, 174, 96, 0.3);
animation: pulse-green 2s infinite;
}
}
.empty-node {
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
opacity: 0.8;
position: relative;
.empty-avatar {
width: 48px;
height: 48px;
border-radius: 50%;
background: linear-gradient(135deg, #bdc3c7, #95a5a6);
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 4px;
border: 2px dashed #95a5a6;
transition: all 0.3s ease;
i {
font-size: 20px;
color: white;
}
}
.empty-text {
font-size: 12px;
color: #7f8c8d;
font-weight: 500;
}
.status-indicator.inactive {
position: absolute;
top: -2px;
right: -2px;
width: 12px;
height: 12px;
background: #95a5a6;
border-radius: 50%;
border: 2px solid white;
box-shadow: 0 2px 8px rgba(149, 165, 166, 0.3);
}
&:hover .empty-avatar {
background: linear-gradient(135deg, #3498db, #2980b9);
border-color: #3498db;
transform: scale(1.05);
}
}
}
@keyframes pulse-green {
0%, 100% {
opacity: 1;
transform: scale(1);
}
50% {
opacity: 0.7;
transform: scale(1.1);
2025-03-23 10:03:12 +08:00
}
}
.lefttop {
display: flex;
justify-items: center;
align-items: center;
padding-left: 20px;
background: #ffffff;
.single {
margin: 0 5px;
img {
width: 36px;
height: 36px;
border-radius: 50%;
// box-shadow: 0px 2px 20px 0px rgba(204, 204, 204, 0.5);
}
.singletitle {
text-align: center;
font-size: 10px;
font-family: PingFang SC-Regular, PingFang SC;
}
}
}
::v-deep .rendercontent {
.toprender {
display: flex;
border-bottom: 1px solid #cccccc;
.leftimg {
border-right: 1px solid #cccccc;
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
padding: 10px;
.img1 {
width: 75px;
height: 75px;
border-radius: 50%;
}
.img2 {
margin-top: 10px;
width: 50px;
height: 30px;
border-radius: 8px;
}
}
.centerbox {
padding: 10px;
.lineboex {
display: flex;
align-items: center;
margin: 10px 0;
.linetitle {
margin-right: 5px;
font-size: 10px;
font-family: MicrosoftYaHei-Bold, MicrosoftYaHei;
font-weight: bold;
color: #333333;
}
.linecontent {
font-size: 10px;
font-family: MicrosoftYaHei;
color: #333333;
display: flex;
justify-content: center;
align-items: center;
padding: 10px 0;
width: 166px;
height: 20px;
background: rgba(216, 216, 216, 0.3);
border-radius: 4px;
border: 1px solid #cccccc;
}
}
}
.rightimg {
flex: 1;
padding: 10px;
font-size: 10px;
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
font-family: MicrosoftYaHei-Bold, MicrosoftYaHei;
font-weight: bold;
color: #333333;
text-align: center;
img {
width: 75px;
height: 50px;
border-radius: 8px;
margin-bottom: 10px;
}
}
}
.bottomrender {
padding: 10px;
display: flex;
.flexbox {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
.thetitle {
font-size: 10px;
font-family: MicrosoftYaHei-Bold, MicrosoftYaHei;
font-weight: bold;
color: #333333;
}
.linecontent {
margin-top: 5px;
padding: 10px 0;
font-size: 10px;
font-family: MicrosoftYaHei;
color: #333333;
display: flex;
justify-content: center;
align-items: center;
width: 110px;
height: 20px;
background: rgba(216, 216, 216, 0.3);
border-radius: 4px;
border: 1px solid #cccccc;
}
}
}
.footerbox {
display: flex;
padding: 10px;
justify-content: space-around;
.footerbtn {
width: 78px;
height: 28px;
border-radius: 5px;
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
font-family: MicrosoftYaHei;
color: #ffffff;
padding: 10px;
cursor: pointer;
}
.btn1 {
background: #ee1e26;
}
.btn2 {
background: #f37825;
}
.btn3 {
background: #21c8f4;
}
}
}
.page {
background: #ffffff;
padding: 10px 20px !important;
background: #f9f9f9;
font-size: 14px;
.thetopbox {
padding: 20px;
background: #ffffff;
border-radius: 8px;
.searchbox {
display: flex;
align-items: center;
.searchtitle {
margin-right: 10px;
}
.searchbtn {
background: #c8161d;
color: #ffffff;
}
}
}
}
</style>