Commit 7ba666f1 authored by ztf's avatar ztf

合并代码

parent 2c7ea38c
<template>
<div>
<span
:class="[showLink?'link':'']"
@click="click"
>{{ linkLabel }}</span>
<span :class="[showLink?'link':'']" @click="click">{{ linkLabel }}</span>
</div>
</template>
<script>
import _get from 'lodash.get'
export default {
// import引入的组件需要注入到对象中才能使用
components: {},
export default {
props: {
scope: {
type: Object,
......@@ -39,12 +34,6 @@ export default {
default: () => 'subTypeName'
}
},
data() {
// 这里存放数据
return {}
},
// 监听属性 类似于data概念
computed: {
showLink() {
if (this.scope && this.scope.row && _get(this.scope.row, this.showAttr) && this.perm) {
......@@ -58,62 +47,39 @@ export default {
return _get(row, filedName)
},
linkName() {
if (this.scope.column.property.split('.').length > 1) {
return this.scope.column.property.split('.')[0]
} else {
return ''
const property = this.scope.column.property.split('.')
return property.length > 1 ? property[0] : ''
}
}
},
// 监控data中的数据变化
watch: {
},
// 生命周期 - 创建完成(可以访问当前this实例)
created() {
},
// 生命周期 - 挂载完成(可以访问DOM元素)
mounted() {
},
activated() {
},
// 方法集合
methods: {
click() {
if (!this.showLink) {
return
}
let subTypeName = ''
// let modelName = ''
let id = ''
if (this.linkName) {
id = this.scope.row[this.linkName].id || this.scope.row.targetId
// const list = this.scope.row[this.linkName].dxClassname.split('.')
// modelName = list.slice(list.length - 1)[0].slice(0, list.slice(list.length - 1)[0].length - 2)
subTypeName = this.scope.row[this.linkName].subTypeName
const data = this.scope.row[this.linkName]
id = data.id || this.scope.row.targetId
subTypeName = data.subTypeName
this.$router.push({
path: `/configured-page/cd/${subTypeName}/defaultInfo/${id}`,
query: { title: `${data.name}_${data.number || data.id}详情` }
})
return
} else {
// const list = _get(this.scope.row, this.dxClassname)
subTypeName = _get(this.scope.row, this.subTypeName)
// modelName = this.$utils.getModelName4dxClassName(list)
id = _get(this.scope.row, this.idName) || this.scope.row.targetId
}
this.$router.push({
path: `/configured-page/cd/${subTypeName}/defaultInfo/${id}`,
query: { title: `${this.scope.row.name}_${this.scope.row.number || this.scope.row.id}详情` }
})
// this.$router.push({
// name: 'generalDetail',
// params: {
// id: id,
// subTypeName: subTypeName,
// modelName: modelName
// }
// })
}
}
}
</script>
<style lang="scss">
@import "../styles/variables";
......
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