1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<template>
<div class="relate-object">
<dee-table
:columns="columns"
:data="cacheTableData"
selection-row
:options="options"
:pagination="pagination"
:index-row="{
title: '序号',
align: 'center',
width: '70'
}"
/>
</div>
</template>
<script>
import { post } from '@/utils/http'
export function getBaseline(params) {
return post(`/DxBaseline/find/recursion`, params)
}
export default {
name: 'DxBaselinesRelatedObjects',
displayName: '相关对象',
modelRelationObjs: ['DxBaseline'],
// import引入的组件需要注入到对象中才能使用
components: {},
props: {
basicData: {
type: Object,
default: () => null
}
},
data() {
// 这里存放数据
return {
columns: [
{
title: '编号',
key: 'number'
},
{
title: '名称',
key: 'name'
},
{
title: '类型',
key: 'subTypeDisplayName'
},
{
title: '视图', key: 'dxView.name', align: 'center'
},
{
title: '版本',
key: 'displayVersion'
},
{
title: '状态',
key: 'state',
fildProp: {
type: 'DictDataVO',
rule: {
dictTypeCode: 'ObjStatus' }
}
},
{
title: '创建者',
key: 'creator.userName'
},
{
title: '修改时间',
key: 'modifyTime'
}
],
tableData: [],
pagination: {
currentPage: 1,
pageSize: 10,
total: 0,
pageSizes: [10, 20, 50]
},
options: {
},
dictLists: {}
}
},
// 监听属性 类似于data概念
computed: {
cacheTableData() {
const start = (this.pagination.currentPage - 1) * this.pagination.pageSize
const end = start + this.pagination.pageSize
return this.tableData.slice(start, end)
}
},
// 监控data中的数据变化
watch: {},
// 生命周期 - 创建完成(可以访问当前this实例)
async created() {
await this.$dict.getDictList(this.columns).then(res => {
this.dictLists = res
})
},
// 生命周期 - 挂载完成(可以访问DOM元素)
mounted() {
this.$nextTick(() => {
const id = this.basicData && this.basicData.id
const params = {
'openProps': [{
'name': 'baselineMembers',
'pageFrom': 1,
'pageSize': 1000,
'openProps': [{ 'name': 'target', 'pageFrom': 1, 'pageSize': 1000 }]
}],
'pageFrom': 1,
'pageSize': 1000,
'searchItems': {
'items': [{ 'fieldName': 'id', 'operator': 'EQ', 'value': id }],
'operator': 'AND'
}
}
getBaseline(params).then(res => {
this.addData = res.items.content[0]
this.tableData = res.items.content[0].baselineMembers.map(x => {
Object.assign(x, x.target)
x = this.$dict.displayDictValue(x, this.dictLists)
return x
})
this.pagination.total = this.tableData.length
}).catch(e => {})
})
},
activated() {
},
// 方法集合
methods: {}
}
</script>
<style lang='scss'>
.relevant-object{
margin-top: 10px;
}
</style>