Commit 7ba666f1 authored by ztf's avatar ztf

合并代码

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