/** * @Description: 相关基线 * @author 李亦康 * @date 2020/11/2 */ <template> <div class="relevant-baseline"> <dee-table :index-row="{title:'序号',width: '60'}" :data="tableData" :pagination="pagination" :columns="baselineColumns" /> </div> </template> <script> import { linkColor } from '@/styles/variables.scss' import { post } from '@/utils/http' export function getBaseline(params) { return post(`/DxBaseline/findMemberLink`, params) } export default { name: 'DxBaselineRelevantBaseline', componentName: '相关基线', modelRelationObjs: ['DxPart', 'DxDocument'], components: {}, props: { basicData: { type: Object, required: true } }, data() { const that = this const link = { color: linkColor, cursor: 'pointer' } return { pagination: { currentPage: 1, pageSize: 10, total: 0, pageSizes: [10, 20, 50] }, versionData: [{ value: '1', label: '全部版本' }, { value: '2', label: '修订版本' }, { value: '3', label: '当前版本' }], baselineData: [], baselineColumns: [ { title: '编号', key: 'source.number', align: 'center', component: { render: function(h, data) { return <span style={link} v-on:click={() => { that.jump(data) }}>{data.source.number}</span> } } }, { title: '名称', key: 'source.name', align: 'center' }, { title: '视图', key: 'target.dxView.name', align: 'center' }, { title: '包含所选件的版本', key: 'target.displayVersion', align: 'center' }, { title: '基线类型', key: 'source.subTypeDisplayName', align: 'center' }, { title: '状态', key: 'source.state', width: 80, align: 'center', fildProp: { type: 'DictDataVO', rule: { dictTypeCode: 'ObjStatus' } } }, { title: '上次修改时间', key: 'source.modifyTime', sortable: true, align: 'center' } ], dictLists: [] } }, computed: { tableData() { const start = (this.pagination.currentPage - 1) * this.pagination.pageSize const end = start + this.pagination.pageSize return this.baselineData.slice(start, end) } }, watch: { basicData: { deep: true, handler: function(val) { if (Object.keys(val).length > 0) { this.getBaseline(val) } }, immediate: true } }, async created() { await this.$dict.getDictList(this.baselineColumns).then(res => { this.dictLists = res }) }, mounted: function() { this.$nextTick(function() { }) }, methods: { // 跳转到对应对象详情页 jump(data) { this.$router.push({ path: `/configured-page/cd/${data.source.subTypeName}/${'defaultInfo'}/${data.source.id}`, query: { title: (data.source.name || data.source.id) + '详情' } }) // this.$router.push({ // path: `/generalDetail/${data.source.id}/${data.source.subTypeName}/DxBaseline` }) }, getBaseline({ id, dxClassname }) { getBaseline({ id, dxClassname }).then(res => { this.baselineData = res.items this.baselineData.forEach(row => { row.show = true row = this.$dict.displayDictValue(row, this.dictLists) }) this.pagination.total = res.items.length }) } } } </script> <style lang="scss"> .relevant-baseline{ margin-top: 10px; } </style>