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
147
148
/**
* @Description:
* @author 李亦康
* @date 2020/10/12
*/
<template>
<div class="special-part">
<dee-table
:data="tableData"
:columns="columns"
:index-row="{title: '序号',width: '70px'}"
:options="{maxHeight: 300}"
/>
</div>
</template>
<script>
import { post } from '@/utils/http'
export default {
name: 'DxPartSpecialPart',
displayName: '特定替换件',
modelRelationObjs: ['DxPart'],
components: {},
props: {
basicData: {
type: Object,
required: true,
default: () => {
}
},
businessData: {
type: Object,
default: () => {}
}
},
data() {
return {
tableData: [],
columns: [
{ title: '装配编号', key: 'source.number', headerAlign: 'center' },
{ title: '装配版本', key: 'source.displayVersion', headerAlign: 'center' },
{ title: '视图', key: 'target.dxView.name', headerAlign: 'center' },
{ title: '对象类型', key: 'target.subTypeDisplayName', headerAlign: 'center' },
{ title: '编号', key: 'target.number', headerAlign: 'center', component:
{ name: 'jumpDetailsPage', show: true }},
{ title: '名称', key: 'target.name', headerAlign: 'center' },
{ title: '开始时间', key: 'startTime', headerAlign: 'center', formatter(row, column) { if (row.startTime) { return row.startTime.split(' ')[0] } else { return '' } } },
{ title: '结束时间', key: 'endTime', headerAlign: 'center', formatter(row, column) { if (row.endTime) { return row.endTime.split(' ')[0] } else { return '' } } },
{ title: '创建者', key: 'target.creator.userName', headerAlign: 'center' },
{ title: '上次修改时间', key: 'target.modifyTime', headerAlign: 'center' }
]
}
},
computed: {},
watch: {
basicData: {
immediate: true,
deep: true,
handler: function(val) {
}
},
businessData: {
deep: true,
handler: function(data) {
this.getPartSubstituteLinks(data)
}
}
},
created() {
},
mounted() {
this.getPartSubstituteLinks(this.businessData)
},
methods: {
getPartSubstituteLinks(businessData) {
if (businessData && businessData.nodeData && businessData.nodeData.id && businessData.nodeData.target) {
this.load(businessData.nodeData.target, businessData.nodeData.id)
}
},
load(partId, linkId) {
this.tableData = []
const partQuery = {
pageFrom: 1,
pageSize: 9999,
searchItems: {
items: [{
fieldName: 'id',
operator: 'EQ',
value: partId
}]
},
openProps: [{
name: 'targetUsageLinks',
pageFrom: 1,
pageSize: 9999,
searchItems: {
items: [{
fieldName: 'id',
operator: 'EQ',
value: linkId
}]
},
openProps: [{
name: 'source'
},
{
name: 'partSubstituteLinks',
pageFrom: 1,
pageSize: 9999,
openProps: [{
pageFrom: 1,
pageSize: 9999,
name: 'target'
}
]
}]
}]
}
post('/DxPart/find/recursion', partQuery).then(res => {
if (res.items &&
res.items.content &&
res.items.content[0] &&
res.items.content[0].targetUsageLinks &&
res.items.content[0].targetUsageLinks[0] &&
res.items.content[0].targetUsageLinks[0].partSubstituteLinks) {
const source = res.items.content[0].targetUsageLinks[0].source
this.tableData = res.items.content[0].targetUsageLinks[0].partSubstituteLinks.map(row => {
return {
source: source,
id: row.id,
startTime: row.startTime,
endTime: row.endTime,
target: row.target
}
})
}
}).finally(() => {
})
}
}
}
</script>
<style lang='scss'>
.special-part {
margin-top: 10px;
margin-bottom: 20px;
}
</style>