Commit 89766cb2 authored by wangdanlei's avatar wangdanlei

基线

parent 5c2556f5
......@@ -1628,6 +1628,22 @@ export function findByNameVnode(obj, targetName) {
return findByNameVnode(obj.$parent, targetName)
}
}
function addQueryParams(url, params) {
let queryString = ''
if (!(params && typeof params === 'object') || !Object.keys(params).length) {
return url
}
for (const key in params) {
if (params.hasOwnProperty(key)) {
let val = params[key]
val = Array.isArray(val) ? val.join(',') : val
queryString += `${queryString.length > 0? '&' : ''}${key}=${val}`
}
}
return `${url}${queryString.length > 0? '?' : ''}${queryString}`
}
export default {
treeSetProp,
treeFindBackArray,
......@@ -1715,5 +1731,6 @@ export default {
getUserRoleInfo,
loadThirdJs,
utilsList,
findByNameVnode
findByNameVnode,
addQueryParams
}
<template>
<div class="choose_baseline">
<span style="color: #4a4a4a; font-size: 14px;">请选择基线:</span>
<el-select v-model="chooseVal" size="small" placeholder="请选择基线" @change="getChoosed">
<el-option
v-for="item in options"
:key="item.baselineId"
:label="item.label"
:value="item.value"
/>
</el-select>
</div>
</template>
<script>
export default {
name: 'BaselineDiffHeader',
props: {
value: {
type: [Number, String],
default: -1
}
},
data() {
return {
chooseVal: this.value,
options: []
}
},
computed: {
},
watch: {
value(val) {
this.chooseVal = val
}
},
mounted() {
this.getBaselineDate()
},
methods: {
getBaselineDate() {
const params = {
'pageFrom': 1,
'pageSize': 10,
'searchItems': {
'children': [],
'items': [],
'operator': 'AND'
},
'openProps': [
{
'name': 'creator',
'pageFrom': 1,
'pageSize': 9999
}
],
'sortItem': [
{
'fieldName': 'modifyTime',
'sortOrder': 'desc'
}
]
}
this.$api.searchApi('ExtPlanBaseLine', params).then(res => {
if (res.code === 0) {
this.options = res.items.content.map(item => {
return {
label: item.name + '(' + item.planDisPlayName + ')',
value: item.id
}
})
}
})
},
getChoosed(val) {
if (val) {
this.$emit('chooseBaseline', val)
}
}
}
}
</script>
<style lang="scss">
.choose_baseline{
padding: 10px;
}
</style>
......@@ -28,21 +28,21 @@
</div>
<div class="flex-start">
<div class="compare-item">
<div class="title">{{ `原始基线: ${originalForm.name || ''}(${originalForm.planName || ''})` }}</div>
<baselineSelect :value="leftDefault" @chooseBaseline="getLeftChoose" />
<dee-up-table
table-height="auto"
:columns="showColumns"
:data="rightTableData"
:data="leftTableData"
:row-style="set_right_row_style"
:cell-style="set_cell_style"
/>
</div>
<div class="compare-item left-item">
<div class="title">{{ `目标基线: ${targetForm.name || ''}(${targetForm.planName || ''})` }}</div>
<baselineSelect :value="rightDefault" @chooseBaseline="getRightChoose" />
<dee-up-table
table-height="auto"
:columns="showColumns"
:data="leftTableData"
:data="rightTableData"
:row-style="set_left_row_style"
:cell-style="set_cell_style"
/>
......@@ -56,10 +56,12 @@
import FilterColumn from './filterColumn'
import { getLayOut } from '@/api/config'
import { getPlanTreeAndTask } from '@/api/plan'
import baselineSelect from './baselineSelect.vue'
import { post } from '@/utils/http'
export default {
name: 'BaselineCompare',
componentName: '基线对比',
components: { FilterColumn },
components: { FilterColumn, baselineSelect },
props: {
selectedData: {
type: Array,
......@@ -85,7 +87,10 @@ export default {
changedDataObj: {},
leftTableData: [],
rightTableData: [],
showColumns: []
showColumns: [],
baselineData: [],
leftDefault: '',
rightDefault: ''
}
},
computed: {
......@@ -191,6 +196,92 @@ export default {
})
return data
},
getLeftChoose(id) {
const params = {
'pageFrom': 1,
'pageSize': 9999,
'searchItems': {
'items': [
{
'fieldName': 'id',
'operator': 'EQ',
'value': id
}
],
'operator': 'AND'
},
'openProps': [
{
'name': 'extPlanBaseLineLinks',
'openProps': [
{
'name': 'target'
}
]
}
],
'sortItem': [
{
'fieldName': 'modifyTime',
'sortOrder': 'desc'
}
]
}
post(`/ExtPlanBaseLine/find/recursion`, params).then(res => {
if (res.code === 0) {
res.items.content.map(item => {
if (item.extPlanBaseLineLinks) {
item.extPlanBaseLineLinks.forEach(x => {
this.leftTableData.push(x.target)
})
}
})
}
})
},
getRightChoose(id) {
const params = {
'pageFrom': 1,
'pageSize': 9999,
'searchItems': {
'items': [
{
'fieldName': 'id',
'operator': 'EQ',
'value': id
}
],
'operator': 'AND'
},
'openProps': [
{
'name': 'extPlanBaseLineLinks',
'openProps': [
{
'name': 'target'
}
]
}
],
'sortItem': [
{
'fieldName': 'modifyTime',
'sortOrder': 'desc'
}
]
}
post(`/ExtPlanBaseLine/find/recursion`, params).then(res => {
if (res.code === 0) {
res.items.content.map(item => {
if (item.extPlanBaseLineLinks) {
item.extPlanBaseLineLinks.forEach(x => {
this.rightTableData.push(x.target)
})
}
})
}
})
},
// 查询原始基线相关的任务
getOriginalData(leftArr, tarIsOrigPlan) {
const origId = this.selectedDataDisplay[0].targetId
......
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