Commit 29c4c545 authored by xioln's avatar xioln

技术状态中心和资源中心详情页签处理

parent 42c06dca
// 测试环境
const VUE_APP_BASE_API = 'http://119.91.70.186:9002' // eslint-disable-line
// 开发环境
// const VUE_APP_BASE_API = '' // eslint-disable-line
// 供应商PC端地址&通飞PC端地址
// 生产
// const SUPPLIER_BASE_IP = 'http://10.19.5.12:9300/#/home' // eslint-disable-line
// const GACE_BASE_IP = 'http://10.19.5.12/#/home' // eslint-disable-line
// dev测试
// const SUPPLIER_BASE_IP = 'http://114.115.155.252:9300/#/home' // eslint-disable-line
// const GACE_BASE_IP = 'http://114.115.155.252/#/home' // eslint-disable-line
// 112测试
const SUPPLIER_BASE_IP = 'http://10.19.5.112:9300/#/home' // eslint-disable-line
const GACE_BASE_IP = 'http://10.19.5.112/#/home' // eslint-disable-line
const VUE_APP_BASE_API = 'http://119.91.70.186:9002' // eslint-disable-line
// 生产环境
// const VUE_APP_BASE_API = 'http://218.75.209.68:9351' // eslint-disable-line
// 本地
// const SUPPLIER_BASE_IP = 'localhost/#/home' // eslint-disable-line
// const GACE_BASE_IP = 'http://192.168.31.30:9303/#/home' // eslint-disable-line
......@@ -71,7 +71,7 @@ export default {
},
methods: {
getLayout () {
if (!this.itemObj) {
if (!this.itemObj || !this.itemObj.modelKey || !this.itemObj.layKey) {
return
}
this.loading = true
......
/**
* @Description: tableCellH5表格
* @author xioln
* @date 2022-08-05
* @FilePath: src/views/documentCenter/components/tableCell.vue
*/
<template>
<div class="table-cell" ref="lazyCell" @scroll="isScrollBottom">
<van-cell is-link v-for="item in tableData" :key="item.id">
<template #title>
<van-col span="24" v-for="column in tableColumns" :key="column.title">
<van-col class="van-col-span" span="8">{{ column.title }}</van-col>
<van-col class="table-cell-content" span="14" offset="1">
<template
v-if="column.hasOwnProperty('relatedDict')"
>
{{
findDictValue(
column.relatedDict,
getProperty(item, column.key)
)
}}
</template>
<template v-else-if="column.key.includes('state')">
{{ findDictValue('ObjStatus', getProperty(item, column.key)) }}
</template>
<template v-else>
{{ getProperty(item, column.key) || '—' }}
</template>
</van-col>
</van-col>
</template>
<template #right-icon>
<!-- <van-icon name="arrow" class="search-icon center" /> -->
</template>
</van-cell>
<!-- <van-loading v-if="showLoading" type="spinner" size="24px" vertical /> -->
</div>
</template>
<script>
import { getDictListByCode } from '@/api/taskDetail'
export default {
name: 'TableCell', // name写在组件的最前方,自定义组件为必填
props: {
tableColumns: {
type: Array,
default: () => []
},
tableData: {
type: Array,
default: () => []
}
},
components: {},
data () {
return {
showLoading: true,
dictObj: {}
}
},
computed: {},
watch: {
tableColumns: {
deep: true,
handler: function (val) {
if (val) {
val.forEach(item => {
// eslint-disable-next-line no-prototype-builtins
if (item.hasOwnProperty('relatedDict')) {
this.getDictListByCode(item.relatedDict)
}
if (item.key.includes('state')) {
this.getDictListByCode('ObjStatus')
}
})
}
},
immediate: true
}
},
created () {
// 初始化数据
},
methods: {
visableLoading () {
this.showLoading = false
},
isScrollBottom () {
// 是否滚动到了底部
this.box = this.$refs.lazyCell
const clientHeight = this.box.clientHeight
const scrollTop = this.box.scrollTop
const scrollHeight = this.box.scrollHeight
if (Math.abs(scrollHeight - (scrollTop + clientHeight)) < 1) {
this.showLoading = true
this.$emit('turnPage')
}
},
formatterData (column, item) {
if (typeof column.formatter === 'function') {
return column.formatter(item)
}
return item[column.key]
},
async getDictListByCode (code) {
const res = await getDictListByCode(code)
if (!res || !res.items) {
return ''
}
this.$set(this.dictObj, code, res.items.content)
},
findDictValue (dict, value) {
// 在对象数组中查找对应的字典值
return this.dictObj[dict] ? this.dictObj[dict].find(item => item.dictKey === value)?.dictValue || '' : ''
},
getProperty (obj, path) {
return path.split('.').reduce((acc, key) => acc[key], obj)
}
}
}
</script>
<style lang='scss'>
.table-cell {
.van-cell--clickable {
background: rgba(206, 209, 212, 0.3);
// background: rgba(173, 210, 255, 0.3);
border-radius: 5px;
margin-bottom: 10px;
}
.van-col-class .van-cell {
margin-bottom: 60px;
border-radius: 8px;
font-size: 12px;
}
.van-col-class-download {
padding-bottom: 0px;
}
.van-col-span {
// width:95px;
font-weight: bold;
box-sizing: border-box;
display: inline-block;
text-align: justify;
text-align-last: justify;
vertical-align: middle; /*保证文字和input框上下是对齐的*/
}
.center {
margin-top: 0;
display: flex;
align-items: center;
}
.van-loading {
height: 40px;
margin-bottom: 5px;
}
.table-cell-content {
text-align: right;
}
}
</style>
<template>
<div class="dxbase-tab">
<TableTab :importData="importData"></TableTab>
</div>
</template>
<script>
import TableTab from '../tableTab'
export default {
props: {
basicData: {
type: Object,
default: () => { }
}
},
components: { TableTab },
data () {
return {
importData: [
{
title: '相关对象',
modelDefName: 'DxBaselineMember',
layoutType: 'defaultResult',
searchItems: {
fieldName: 'sourceId',
operator: 'EQ',
value: this.basicData.id
}
}
]
}
},
watch: {
},
created () {
},
mounted () {
},
computed: {},
methods: {
}
}
</script>
<style lang="scss" scoped>
</style>
<template>
<div class="dxPart-tab">
<TableTab :importData="importData"></TableTab>
</div>
</template>
<script>
import TableTab from '../tableTab'
export default {
props: {
basicData: {
type: Object,
default: () => { }
}
},
components: { TableTab },
data () {
return {
importData: [
{
title: 'BOM清单',
modelDefName: 'ExtBOMBillLink',
layoutType: 'defaultResult',
searchItems: {
fieldName: 'sourceId',
operator: 'EQ',
value: this.basicData.versionId
}
},
{
title: '材料清单',
modelDefName: 'ExtBOMBillLink',
layoutType: 'typeMaterial',
searchItems: {
fieldName: 'sourceId',
operator: 'EQ',
value: this.basicData.versionId
},
openProps: [{ name: 'source' }, { name: 'target', openProps: [{ name: 'extMaterial' }] }]
},
{
title: '相关对象',
modelDefName: 'DxPartDescribeLink',
layoutType: '6e4b8747-014e-43b1-ae63-d4ec312ed5b6',
searchItems: {
fieldName: 'sourceId',
operator: 'EQ',
value: this.basicData.versionId
}
}
]
}
},
watch: {
},
created () {
},
mounted () {
},
computed: {},
methods: {
}
}
</script>
<style lang="scss" scoped>
</style>
<template>
<div class="ecn-tab">
<TableTab :importData="importData"></TableTab>
</div>
</template>
<script>
import TableTab from '../tableTab'
export default {
props: {
basicData: {
type: Object,
default: () => { }
}
},
components: { TableTab },
data () {
return {
importData: [
{
title: '相关变更来源',
modelDefName: 'DxAddressedBy',
layoutType: 'ecnRelatedEcr',
searchItems: {
fieldName: 'targetId',
operator: 'EQ',
value: this.basicData.masterId
}
},
{
title: '受影响文档',
modelDefName: 'DxChangeNoticeAgainst',
layoutType: 'defaultResult',
searchItems: {
fieldName: 'sourceId',
operator: 'EQ',
value: this.basicData.masterId
}
},
{
title: '更改前对象',
modelDefName: 'DxChangeAffectedData',
layoutType: 'ecrChangeAffectedData',
searchItems: {
fieldName: 'sourceId',
operator: 'EQ',
value: this.basicData.masterId
}
},
{
title: '更改后对象',
modelDefName: 'ExtEcnRecordLink',
layoutType: 'defaultResult',
searchItems: {
fieldName: 'sourceId',
operator: 'EQ',
value: this.basicData.masterId
}
}
]
}
},
watch: {
},
created () {
},
mounted () {
},
computed: {},
methods: {
}
}
</script>
<style lang="scss" scoped>
</style>
<template>
<div class="ecr-tab">
<TableTab :importData="importData"></TableTab>
</div>
</template>
<script>
import TableTab from '../tableTab'
export default {
props: {
basicData: {
type: Object,
default: () => { }
}
},
components: { TableTab },
data () {
return {
importData: [
{
title: '受影响文档',
modelDefName: 'DxChangeRequestAgainst',
layoutType: 'defaultResult',
searchItems: {
fieldName: 'sourceId',
operator: 'EQ',
value: this.basicData.masterId
}
},
{
title: '改前对象',
modelDefName: 'DxChangeAffectedData',
layoutType: 'ecrChangeAffectedData',
searchItems: {
fieldName: 'sourceId',
operator: 'EQ',
value: this.basicData.masterId
}
},
{
title: '改后对象',
modelDefName: 'ExtEcrRecordLink',
layoutType: 'defaultResult',
searchItems: {
fieldName: 'sourceId',
operator: 'EQ',
value: this.basicData.masterId
}
}
]
}
},
watch: {
},
created () {
},
mounted () {
},
computed: {},
methods: {
}
}
</script>
<style lang="scss" scoped>
</style>
<template>
<div class="extMaterialBill-tab">
<TableTab :importData="importData"></TableTab>
</div>
</template>
<script>
import TableTab from '../tableTab'
export default {
props: {
basicData: {
type: Object,
default: () => { }
}
},
components: { TableTab },
data () {
return {
importData: [
{
title: '材料清单',
modelDefName: 'ExtMaterialUsageLink',
layoutType: 'defaultResult1',
searchItems: {
fieldName: 'sourceId',
operator: 'EQ',
value: this.basicData.id
}
}
]
}
},
watch: {
},
created () {
},
mounted () {
},
computed: {},
methods: {
}
}
</script>
<style lang="scss" scoped>
</style>
<template>
<div class="ecr-tab">
<van-collapse v-model="activeNames">
<van-collapse-item
v-for="(item, index) in importData"
:key="index"
:title="item.title"
:name="item.title"
icon="orders-o"
>
<table-cell
ref="tableCell"
:tltle="item.title"
:tableData="allTableData[`${item.modelDefName}${item.layoutType}`]"
:tableColumns="allColumns[`${item.modelDefName}${item.layoutType}`]"
></table-cell>
<van-loading
v-if="!allTableData[`${item.modelDefName}${item.layoutType}`]"
type="spinner"
size="24px"
vertical
/>
<van-empty
v-if="
allTableData[`${item.modelDefName}${item.layoutType}`] &&
allTableData[`${item.modelDefName}${item.layoutType}`].length === 0
"
description="数据为空"
/>
</van-collapse-item>
</van-collapse>
</div>
</template>
<script>
import { getLayOut } from '@/api/taskDetail'
import TableCell from '@/components/tableCell'
export default {
props: {
basicData: {
type: Object,
default: () => { }
},
flowType: {
type: String,
default: () => ''
},
importData: {
type: Array,
default: () => []
}
},
components: { TableCell },
data () {
return {
// importData: [
// {
// title: '受影响文档',
// modelDefName: 'DxChangeRequestAgainst',
// layoutType: 'defaultResult',
// searchItems: {
// fieldName: 'sourceId',
// operator: 'EQ',
// value: this.basicData.masterId
// }
// },
// {
// title: '改前对象',
// modelDefName: 'DxChangeAffectedData',
// layoutType: 'ecrChangeAffectedData',
// searchItems: {
// fieldName: 'sourceId',
// operator: 'EQ',
// value: this.basicData.masterId
// }
// },
// {
// title: '改后对象',
// modelDefName: 'ExtEcrRecordLink',
// layoutType: 'defaultResult',
// searchItems: {
// fieldName: 'sourceId',
// operator: 'EQ',
// value: this.basicData.masterId
// }
// }
// ],
allColumns: {},
allTableData: {},
activeNames: []
}
},
watch: {
importData: {
deep: true,
handler: function (val) {
if (val.length > 0) {
val.forEach(item => {
this.getColumns(item.modelDefName, item.layoutType)
this.getData(item.modelDefName, item.layoutType, item.searchItems, item.openProps)
})
}
},
immediate: true
}
},
created () {
},
mounted () {
},
computed: {},
methods: {
getColumns (modelDefName, layoutType) {
getLayOut({ modelDefName: modelDefName, layoutType: layoutType }).then((res) => {
if (res.items.content.length) {
const jsonparse = JSON.parse(res.items.content[0].configDetails)
this.$nextTick(() => {
this.$set(this.allColumns, `${modelDefName}${layoutType}`, jsonparse.tableObj.tableColumns)
})
}
})
},
getData (modelDefName, layoutType, searchItems, openProps) {
const params = {
searchItems: {
children: [],
items: [searchItems],
operator: 'AND'
},
openProps: [{ name: 'source' }, { name: 'target' }],
searchOptions: [{ type: 'QUERY_LINK_BY_SOURCE_LATEST' }],
sortItem: [{ fieldName: 'modifyTime', sortOrder: 'desc' }]
}
if (openProps) {
params.openProps = openProps
}
this.$api.searchApi(modelDefName, params).then(res => {
this.$nextTick(() => {
this.$set(this.allTableData, `${modelDefName}${layoutType}`, res.items.content || [])
})
})
}
}
}
</script>
<style lang="scss" scoped>
.ecr-tab{
.van-cell {
font-size: 14px;
}
.van-collapse-item__content {
// padding: 2.2vw 8.266667vw;
}
.van-collapse-item__content {
font-size: 12px;
}
}
</style>
......@@ -18,6 +18,21 @@
<div v-if="activeTab === 'ActionItem'">
<ActionItem :basicData="form" />
</div>
<div v-if="activeTab === 'ecnTab'">
<EcnTab :basicData="form" />
</div>
<div v-if="activeTab === 'ecrTab'">
<EcrTab :basicData="form" />
</div>
<div v-if="activeTab === 'dxBaseTab'">
<DxBaseTab :basicData="form" />
</div>
<div v-if="activeTab === 'dxPartTab'">
<DxPartTab :basicData="form" />
</div>
<div v-if="activeTab === 'extMaterialBillTab'">
<ExtMaterialBillTab :basicData="form" />
</div>
</van-tab>
</van-tabs>
</div>
......@@ -26,6 +41,11 @@
<script>
import Pdf from '@/components/pdf/index'
import ActionItem from '@/components/actionItem/index'
import EcnTab from './components/ecnTab'
import EcrTab from './components/ecrTab'
import DxBaseTab from './components/dxBaseTab'
import DxPartTab from './components/dxPartTab'
import ExtMaterialBillTab from './components/extMaterialBillTab'
import { getInstancePbo, getLayOut } from '@/api/taskDetail'
import DeeForm from '@/components/form/form'
......@@ -33,7 +53,12 @@ export default {
components: {
Pdf,
DeeForm,
ActionItem
ActionItem,
EcnTab,
EcrTab,
DxBaseTab,
DxPartTab,
ExtMaterialBillTab
},
data () {
return {
......@@ -63,6 +88,51 @@ export default {
this.activeTab = 'baseInfo'
await this.getFormData()
await this.getForm()
} else if (['DxChangeNotice'].includes(this.$route.query.dxClassname)) {
// 更改单
this.tabs = [
{ title: '基本信息', key: 'baseInfo' },
{ title: '相关对象', key: 'ecnTab' }
]
this.activeTab = 'baseInfo'
await this.getFormData()
await this.getForm()
} else if (['DxChangeRequest'].includes(this.$route.query.dxClassname)) {
// 更改申请单
this.tabs = [
{ title: '基本信息', key: 'baseInfo' },
{ title: '相关对象', key: 'ecrTab' }
]
this.activeTab = 'baseInfo'
await this.getFormData()
await this.getForm()
} else if (['DxBaseline'].includes(this.$route.query.dxClassname)) {
// 基线
this.tabs = [
{ title: '基本信息', key: 'baseInfo' },
{ title: '相关对象', key: 'dxBaseTab' }
]
this.activeTab = 'baseInfo'
await this.getFormData()
await this.getForm()
} else if (['DxPart'].includes(this.$route.query.dxClassname)) {
// 产品库
this.tabs = [
{ title: '基本信息', key: 'baseInfo' },
{ title: '相关对象', key: 'dxPartTab' }
]
this.activeTab = 'baseInfo'
await this.getFormData()
await this.getForm()
} else if (['ExtMaterialBill'].includes(this.$route.query.dxClassname)) {
// 材料清单
this.tabs = [
{ title: '基本信息', key: 'baseInfo' },
{ title: '相关对象', key: 'extMaterialBillTab' }
]
this.activeTab = 'baseInfo'
await this.getFormData()
await this.getForm()
} else if (['ExtActionInfo'].includes(this.$route.query.dxClassname)) {
this.tabs = [
{ title: '基本信息', key: 'baseInfo' },
......@@ -172,7 +242,6 @@ export default {
})
},
fiiterData (formData) {
console.log('formData', formData)
formData.forEach(item => {
if (item.title && item.title !== '关联文档' && item.title !== '附件') {
// eslint-disable-next-line no-unused-vars
......
......@@ -18,7 +18,6 @@ module.exports = {
},
proxy: {
'/api': {
// target: 'http://10.19.5.112:9300',
// target: 'http://10.19.5.12:9300', // 生产
target: 'http://119.91.70.186:9002',
changeOrigin: true,
......@@ -27,7 +26,6 @@ module.exports = {
}
},
'/Windchill': {
// target: 'http://10.19.5.112:9300',
// target: 'http://10.19.5.12:9300', // 生产
target: 'http://119.91.70.186:9002',
changeOrigin: true,
......
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