|
@@ -18,14 +18,14 @@
|
|
|
placeholder="请输入框架名称"
|
|
|
v-model="searchText"
|
|
|
:remote-method="searchHandle"
|
|
|
- value-key="frameId"
|
|
|
+ value-key="ChartFrameworkId"
|
|
|
clearable
|
|
|
>
|
|
|
<i slot="prefix" class="el-input__icon el-icon-search"></i>
|
|
|
<el-option
|
|
|
v-for="item in searchOptions"
|
|
|
- :key="item.frameId"
|
|
|
- :label="item.name"
|
|
|
+ :key="item.ChartFrameworkId"
|
|
|
+ :label="item.FrameworkName"
|
|
|
:value="item"
|
|
|
/>
|
|
|
</el-select>
|
|
@@ -38,7 +38,7 @@
|
|
|
ref="catalogTree"
|
|
|
class="catalog-tree other-tree"
|
|
|
empty-text="暂无分类"
|
|
|
- :data="mockPublic"
|
|
|
+ :data="publicFrameList"
|
|
|
node-key="nodeKeyId"
|
|
|
:expand-on-click-node="false"
|
|
|
@current-change="(data,node)=>{nodeChange(data,node)}"
|
|
@@ -79,26 +79,20 @@
|
|
|
</span>
|
|
|
<el-dropdown-menu slot="dropdown">
|
|
|
<el-dropdown-item
|
|
|
- :command="{key:'own'}"
|
|
|
- :class="item.IsPublic === 0 ? 'el-dropdown-menu-item-chat-act' : ''"
|
|
|
+ :command="{key:'own',value:item}"
|
|
|
class="el-dropdown-menu-item-chat"
|
|
|
>
|
|
|
<div style="display: flex;align-items: center;">
|
|
|
- <img v-if="item.IsPublic === 0" src="~@/assets/img/chart_m/Group_act.png">
|
|
|
- <img v-else src="~@/assets/img/chart_m/Group.png">
|
|
|
+ <img src="~@/assets/img/chart_m/Group.png">
|
|
|
<span style="margin-left:5px">仅自己可见</span>
|
|
|
-
|
|
|
</div>
|
|
|
-
|
|
|
</el-dropdown-item>
|
|
|
<el-dropdown-item
|
|
|
- :command="{key:'public'}"
|
|
|
- :class="item.IsPublic === 1 ? 'el-dropdown-menu-item-chat-act' : ''"
|
|
|
+ :command="{key:'public',value:item}"
|
|
|
class="el-dropdown-menu-item-chat"
|
|
|
>
|
|
|
<div style="display: flex;align-items: center;">
|
|
|
- <img v-if="item.IsPublic === 1" src="~@/assets/img/chart_m/User_act.png">
|
|
|
- <img v-else src="~@/assets/img/chart_m/User.png">
|
|
|
+ <img src="~@/assets/img/chart_m/User.png">
|
|
|
<span style="margin-left:5px">所有人可见</span>
|
|
|
</div>
|
|
|
|
|
@@ -130,7 +124,7 @@
|
|
|
<div class="list" v-if="model==='list'">
|
|
|
<div class="list-item"
|
|
|
v-for="item in currentList" :key="item.nodeKeyId"
|
|
|
- @click="changeModel('frame',item)"
|
|
|
+ @click="nodeChange(item,{level:2})"
|
|
|
>
|
|
|
<div class="item-title text_oneLine">
|
|
|
<span>{{item.name}}</span>
|
|
@@ -138,6 +132,10 @@
|
|
|
<div style="height:1px;background:#ECECEC;margin:0 -10px;"></div>
|
|
|
<div class="item-image"
|
|
|
:style="`background-image:url(${item.CoverImg?item.CoverImg:require('@/assets/img/document_m/default-img.png')})`"></div>
|
|
|
+ <div style="height:1px;background:#ECECEC;margin:10px -10px;"></div>
|
|
|
+ <div class="item-time">
|
|
|
+ 创建时间:{{item.CreateTime}}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div class="empty" v-if="currentList.length===0">
|
|
|
<tableNoData text="暂无数据"/>
|
|
@@ -149,7 +147,7 @@
|
|
|
<span class="title text_oneLine">{{currentFrame.FrameworkName}}</span>
|
|
|
<div class="tool">
|
|
|
<el-button type="text" @click="handleOption('edit',currentFrame)" v-if="frameType==='my'">编辑</el-button>
|
|
|
- <el-button type="text" @click="handleOption('copy',currentFrame)">复制图片</el-button>
|
|
|
+ <el-button type="text" @click="handleOption('copy',currentFrame)" :disabled="!currentFrame.FrameworkContent">复制图片</el-button>
|
|
|
<el-button type="text" @click="handleOption('del',currentFrame)" style="color:red;"
|
|
|
v-if="frameType==='my'">删除</el-button>
|
|
|
</div>
|
|
@@ -235,6 +233,7 @@ import draggable from 'vuedraggable';
|
|
|
import FrameContainer from './components/frameContainer.vue';
|
|
|
import chartDetail from '@/views/mychart_manage/components/chartDetailDia.vue';
|
|
|
import { mychartInterface,chartFrameInterface } from '@/api/api.js';
|
|
|
+import {copyBlob} from '@/utils/svgToblob.js';
|
|
|
export default {
|
|
|
components:{ draggable, FrameContainer,chartDetail},
|
|
|
directives: {
|
|
@@ -261,50 +260,28 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
isSlideLeft:false,//控制左侧目录栏是否显示
|
|
|
+
|
|
|
+ /* drag 我的框架相关 */
|
|
|
+ dragStartIndex:0,
|
|
|
+ dragFrame:null,
|
|
|
+ prevFrame:null,
|
|
|
+ nextFrame:null,
|
|
|
+
|
|
|
+ /* search */
|
|
|
searchText:'',
|
|
|
searchOptions:[],
|
|
|
- mockPublic:[
|
|
|
- {
|
|
|
- catalogId:1,
|
|
|
- name:'XXX的框架',
|
|
|
- nodeKeyId:1,
|
|
|
- children:[{
|
|
|
- frameId:1,
|
|
|
- name:'黄金稳住了吗?aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
|
|
|
- nodeKeyId:'1-1',
|
|
|
- updateTime:'2023/10/13'
|
|
|
- }]
|
|
|
- },
|
|
|
- {
|
|
|
- catalogId:2,
|
|
|
- name:'aaa的框架',
|
|
|
- nodeKeyId:2,
|
|
|
- children:[]
|
|
|
- }
|
|
|
- ],
|
|
|
+
|
|
|
+ /* select frame*/
|
|
|
+ model:'frame',
|
|
|
+ frameType:'my',
|
|
|
publicFrameList:[],
|
|
|
currentList:[],
|
|
|
- mockFrameList:[
|
|
|
- {
|
|
|
- frameId:2,
|
|
|
- name:'框架1',
|
|
|
- IsPublic:0,
|
|
|
- updateTime:'2023/10/10'
|
|
|
- },
|
|
|
- {
|
|
|
- frameId:3,
|
|
|
- name:'框架2',
|
|
|
- IsPublic:1,
|
|
|
- updateTime:'2023/10/11'
|
|
|
- }
|
|
|
- ],
|
|
|
myFrameList:[],
|
|
|
currentFrame:{},
|
|
|
+ /* frame node */
|
|
|
+ myETADetailDialogShow:false,
|
|
|
modifyFrame:{},
|
|
|
isRenameDialogShow:false,
|
|
|
- model:'frame',
|
|
|
- frameType:'my',
|
|
|
- myETADetailDialogShow:false,
|
|
|
chartClassify:0,
|
|
|
classifyUserId:0,
|
|
|
chartCode:'',
|
|
@@ -313,8 +290,19 @@ export default {
|
|
|
myETAClassArr:[],
|
|
|
copyToClassify:[],
|
|
|
modeId:0,
|
|
|
+ lockLoding:null,
|
|
|
};
|
|
|
},
|
|
|
+ watch:{
|
|
|
+ searchText(newVal){
|
|
|
+ newVal&&this.chooseFrame(newVal)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed:{
|
|
|
+ adminId(){
|
|
|
+ return Number(localStorage.getItem('AdminId'))
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
slideHandle(){
|
|
|
this.isSlideLeft = !this.isSlideLeft;
|
|
@@ -323,40 +311,111 @@ export default {
|
|
|
chartFrameInterface.getPublicFrameList().then(res=>{
|
|
|
if(res.Ret!==200) return
|
|
|
this.publicFrameList = res.Data||[]
|
|
|
+ this.publicFrameList = this.publicFrameList.map(list=>{
|
|
|
+ list.name = list.MenuName
|
|
|
+ list.nodeKeyId = 'list'+list.AdminId
|
|
|
+ if(list.Frameworks){
|
|
|
+ list.children = list.Frameworks.map(item=>{
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ ...{
|
|
|
+ nodeKeyId:'item'+item.ChartFrameworkId,
|
|
|
+ name:item.FrameworkName
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return list
|
|
|
+ })
|
|
|
})
|
|
|
},
|
|
|
async getMyList(type){
|
|
|
- const res = await chartFrameInterface.getMyFrameList()
|
|
|
+ const res = await chartFrameInterface.getMyFrameList({AdminId:this.adminId})
|
|
|
if(res.Ret!==200) return
|
|
|
this.myFrameList = res.Data||[]
|
|
|
if(type!=='init') return
|
|
|
//如果是其他页面跳转来的
|
|
|
if(this.$route.query.frameId){
|
|
|
- this.currentFrame = this.myFrameList.find(i=>i.frameId===Number(this.$route.query.frameId))||{}
|
|
|
+ this.currentFrame = this.myFrameList.find(i=>i.ChartFrameworkId===Number(this.$route.query.frameId))||{}
|
|
|
}else{
|
|
|
//否则选择myFrameList的第一个
|
|
|
this.currentFrame = this.myFrameList[0]||{}
|
|
|
}
|
|
|
- this.$nextTick(()=>{
|
|
|
- this.$refs.container.init()
|
|
|
+ this.handleInitGraph()
|
|
|
+ },
|
|
|
+ searchHandle(keyword){
|
|
|
+ chartFrameInterface.getMyFrameList({
|
|
|
+ AdminId:this.adminId,
|
|
|
+ Keyword:keyword,
|
|
|
+ }).then(res=>{
|
|
|
+ if(res.Ret!==200) return
|
|
|
+ this.searchOptions = res.Data||[]
|
|
|
})
|
|
|
},
|
|
|
- searchHandle(){},
|
|
|
nodeChange(data,node){
|
|
|
this.frameType = 'public'
|
|
|
this.changeModel(node.level===2?'frame':'list',data)
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ this.$refs.catalogTree.setCurrentKey(data.nodeKeyId)
|
|
|
+ })
|
|
|
},
|
|
|
changeModel(type,data){
|
|
|
+ if(type==='frame'&&this.frameType==='my'&&data.ChartFrameworkId===this.currentFrame.ChartFrameworkId) return
|
|
|
this.model = type
|
|
|
+ //销毁画布
|
|
|
+ this.$refs.container&&this.$refs.container.dispose()
|
|
|
if(type==='frame'){
|
|
|
this.currentFrame = data
|
|
|
+ this.handleInitGraph()
|
|
|
}else{
|
|
|
this.currentList = data.children||[]
|
|
|
}
|
|
|
},
|
|
|
- menuDragStart(){},
|
|
|
- menuDragenter(){},
|
|
|
- menuDragOver(){},
|
|
|
+ handleInitGraph(){
|
|
|
+ //判断一下框架内容是否是合法的JSON,否则置为空
|
|
|
+ try{
|
|
|
+ JSON.parse(this.currentFrame.FrameworkContent)
|
|
|
+ }catch(e){
|
|
|
+ this.currentFrame.FrameworkContent = ''
|
|
|
+ }
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ //若框架有内容,才加载画布
|
|
|
+ this.currentFrame.FrameworkContent&&this.$refs.container.init()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ menuDragStart({oldIndex}){
|
|
|
+ this.dragStartIndex = oldIndex
|
|
|
+ this.dragFrame = this.myFrameList[oldIndex]
|
|
|
+ },
|
|
|
+ menuDragenter({newIndex}){
|
|
|
+ //置顶
|
|
|
+ if(newIndex===0){
|
|
|
+ this.prevFrame=null
|
|
|
+ this.nextFrame=this.myFrameList[newIndex+1]
|
|
|
+ }
|
|
|
+ //置底
|
|
|
+ if(newIndex===this.myFrameList.length-1){
|
|
|
+ this.prevFrame = this.myFrameList[newIndex-1]
|
|
|
+ this.nextFrame = null
|
|
|
+ }
|
|
|
+ if(newIndex!==0&&newIndex!==this.myFrameList.length-1){
|
|
|
+ this.prevFrame = this.myFrameList[newIndex-1]
|
|
|
+ this.nextFrame = this.myFrameList[newIndex+1]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ menuDragOver({newIndex}){
|
|
|
+ if(newIndex===this.drageStartIndex) return
|
|
|
+ if(!this.dragFrame) return
|
|
|
+ chartFrameInterface.moveFrame({
|
|
|
+ ChartFrameworkId:this.dragFrame.ChartFrameworkId,
|
|
|
+ PrevChartFrameworkId:this.prevFrame?this.prevFrame.ChartFrameworkId:0,
|
|
|
+ NextChartFrameworkId:this.nextFrame?this.nextFrame.ChartFrameworkId:0,
|
|
|
+ }).then(res=>{
|
|
|
+ if(res.Ret!==200) return
|
|
|
+ this.$message.success("移动成功")
|
|
|
+ this.getMyList()
|
|
|
+ })
|
|
|
+ },
|
|
|
handleCommand(command){
|
|
|
if(command.key==='edit'){
|
|
|
this.modifyFrame = _.cloneDeep(this.currentFrame)
|
|
@@ -365,6 +424,17 @@ export default {
|
|
|
if(command.key==='del'){
|
|
|
this.deleteFrame(this.currentFrame)
|
|
|
}
|
|
|
+ if(['own','public'].includes(command.key)){
|
|
|
+ chartFrameInterface.changePublicFrame({
|
|
|
+ ChartFrameworkId:command.value.ChartFrameworkId,
|
|
|
+ IsPublic:command.key==='own'?0:1
|
|
|
+ }).then(res=>{
|
|
|
+ if(res.Ret!==200) return
|
|
|
+ this.getPublicList()
|
|
|
+ this.getMyList()
|
|
|
+ this.$message.success(`操作成功`)
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
chooseFrame(item){
|
|
|
this.frameType = 'my'
|
|
@@ -373,7 +443,7 @@ export default {
|
|
|
handleOption(type,data){
|
|
|
const optionMap = {
|
|
|
'edit':this.handleEditFrame,
|
|
|
- 'copy':this.copyFrame,
|
|
|
+ 'copy':this.copyFrameImg,
|
|
|
'del':this.deleteFrame,
|
|
|
}
|
|
|
optionMap[type](data)
|
|
@@ -381,17 +451,33 @@ export default {
|
|
|
handleEditFrame(data){
|
|
|
this.$router.push({path:'/editframe',query:{frameId:data.ChartFrameworkId}})
|
|
|
},
|
|
|
- copyFrame(data){},
|
|
|
+ copyFrameImg(data){
|
|
|
+ this.lockLoding = this.$loading({
|
|
|
+ lock: true,
|
|
|
+ text: '复制图片中...',
|
|
|
+ target: '.frame-container-wrap',
|
|
|
+ spinner: 'el-icon-loading',
|
|
|
+ background: 'rgba(255, 255, 255, 0.8)'
|
|
|
+ });
|
|
|
+ copyBlob(data.FrameworkImg,()=>{
|
|
|
+ this.lockLoding && this.lockLoding.close();
|
|
|
+ },1,'normal')
|
|
|
+ },
|
|
|
deleteFrame(data){
|
|
|
this.$confirm("删除后不可恢复,确认删除吗?","提示",{
|
|
|
confirmButtonText:"确定",
|
|
|
cancelButtonText:"取消",
|
|
|
type:"warning"
|
|
|
}).then(()=>{
|
|
|
- //删除
|
|
|
- this.$message.success("删除成功")
|
|
|
- this.getPublicList()
|
|
|
- this.getMyList()
|
|
|
+ chartFrameInterface.deleteFrame({
|
|
|
+ ChartFrameworkId:data.ChartFrameworkId
|
|
|
+ }).then(res=>{
|
|
|
+ if(res.Ret!==200) return
|
|
|
+ this.$message.success("删除成功")
|
|
|
+ this.getPublicList()
|
|
|
+ this.getMyList()
|
|
|
+ this.currentFrame = {}
|
|
|
+ })
|
|
|
}).catch(()=>{})
|
|
|
},
|
|
|
renameFrame(){
|
|
@@ -401,6 +487,7 @@ export default {
|
|
|
this.getPublicList()
|
|
|
this.getMyList()
|
|
|
},
|
|
|
+ //点击框架内节点
|
|
|
handleShowDialog({id,userId}){
|
|
|
//请求接口看有没有数据
|
|
|
mychartInterface.myList({
|