[update] 市场法规清单-历史版本

This commit is contained in:
lideqin
2024-07-03 14:18:02 +08:00
parent b6fec30026
commit 0d918c71dd
5 changed files with 41 additions and 37 deletions
+1 -4
View File
@@ -142,8 +142,6 @@ const getMarketRegulationListByIdNoPerm = (params) => getAction('', params)
const marketRegulationListAdd = (params) => postAction('/laws/marketStandard/add', params) const marketRegulationListAdd = (params) => postAction('/laws/marketStandard/add', params)
// 市场法规清单-编辑 // 市场法规清单-编辑
const marketRegulationListEdit = (params) => postAction('/laws/marketStandard/edit', params) const marketRegulationListEdit = (params) => postAction('/laws/marketStandard/edit', params)
// 市场法规清单-获取历史版本列表
const marketRegulationListHistoryList = (params) => getAction('', params)
export { export {
// 国内标准 // 国内标准
@@ -226,6 +224,5 @@ export {
getMarketRegulationListById, getMarketRegulationListById,
getMarketRegulationListByIdNoPerm, getMarketRegulationListByIdNoPerm,
marketRegulationListAdd, marketRegulationListAdd,
marketRegulationListEdit, marketRegulationListEdit
marketRegulationListHistoryList
} }
@@ -1,5 +1,10 @@
<template> <template>
<internal-detail-page :title="$route.query.title" :content-padding="0" :loading="loading"> <internal-detail-page :title="$route.query.title" :content-padding="0" :loading="loading">
<!-- 标题右侧按钮 -->
<template v-if="ids.length <= 1" v-slot:titleRightCustom>
<!-- 历史版本 -->
<a-button type="primary" ghost @click="clickHistoryVersion">{{ $t('standardRegulationLibrary.marketRegulationsList.historicalVersion') }}</a-button>
</template>
<div class="content-wrapper"> <div class="content-wrapper">
<a-row class="basic-info" v-if="ids.length <= 1"> <a-row class="basic-info" v-if="ids.length <= 1">
<!-- 国家/地区 --> <!-- 国家/地区 -->
@@ -98,12 +103,15 @@
</div> </div>
<!-- table区域-end --> <!-- table区域-end -->
</div> </div>
<!-- 历史版本弹框 -->
<history-version-modal ref="historyVersionModal"/>
</internal-detail-page> </internal-detail-page>
</template> </template>
<script> <script>
import InternalDetailPage from '../../../components/InternalDetailPage' import InternalDetailPage from '../../../components/InternalDetailPage'
import FileEcho from '../../../components/FileEcho' import FileEcho from '../../../components/FileEcho'
import HistoryVersionModal from './modules/HistoryVersionModal'
import { getMarketRegulationListById } from '../../../api/standardRegulationLibraryApi' import { getMarketRegulationListById } from '../../../api/standardRegulationLibraryApi'
import JTable from '../../../components/jero/JTable' import JTable from '../../../components/jero/JTable'
import { StandardSource } from '../../../enums/commonEnums' import { StandardSource } from '../../../enums/commonEnums'
@@ -111,7 +119,7 @@ import { mapGetters } from 'vuex'
export default { export default {
name: 'MarketRegulationsDetailPage', name: 'MarketRegulationsDetailPage',
components: { InternalDetailPage, FileEcho, JTable }, components: { InternalDetailPage, FileEcho, JTable, HistoryVersionModal },
computed: { computed: {
...mapGetters(['defaultHeight']), ...mapGetters(['defaultHeight']),
yScrollHeight () { yScrollHeight () {
@@ -292,12 +300,23 @@ export default {
ids: [] ids: []
} }
}, },
beforeRouteUpdate (to, from, next) {
if (to.query.manifestVersion !== from.query.manifestVersion) {
if (to.query.manifestVersion) {
this.filters.manifestVersion = to.query.manifestVersion
}
this.ids = to.query.ids.split(',')
this.initData(to.query.ids)
next()
} else {
next()
}
},
mounted () { mounted () {
if (this.$route.query.versionNumber) { if (this.$route.query.manifestVersion) {
this.filters.manifestVersion = this.$route.query.versionNumber this.filters.manifestVersion = this.$route.query.manifestVersion
} }
this.ids = this.$route.query.ids.split(',') this.ids = this.$route.query.ids.split(',')
console.log('----ids', this.ids)
this.initData(this.$route.query.ids) this.initData(this.$route.query.ids)
}, },
methods: { methods: {
@@ -359,6 +378,10 @@ export default {
id: record.standardId id: record.standardId
} }
}) })
},
// 点击历史版本
clickHistoryVersion () {
this.$refs.historyVersionModal.open(this.model)
} }
} }
} }
@@ -1,7 +1,7 @@
<template> <template>
<internal-detail-page :title="$route.query.title" :content-padding="0" :loading="loading"> <internal-detail-page :title="$route.query.title" :content-padding="0" :loading="loading">
<!-- 标题右侧按钮 --> <!-- 标题右侧按钮 -->
<template v-if="model.id" v-slot:titleRightCustom> <template v-if="model.manifest.id" v-slot:titleRightCustom>
<!-- 历史版本 --> <!-- 历史版本 -->
<a-button type="primary" ghost @click="clickHistoryVersion">{{ $t('standardRegulationLibrary.marketRegulationsList.historicalVersion') }}</a-button> <a-button type="primary" ghost @click="clickHistoryVersion">{{ $t('standardRegulationLibrary.marketRegulationsList.historicalVersion') }}</a-button>
</template> </template>
@@ -526,7 +526,7 @@ export default {
}, },
// 点击历史版本 // 点击历史版本
clickHistoryVersion () { clickHistoryVersion () {
this.$refs.historyVersionModal.open(this.model.id) this.$refs.historyVersionModal.open(this.model)
}, },
// 查询 // 查询
searchQuery () { searchQuery () {
@@ -113,14 +113,6 @@
</a-tooltip> </a-tooltip>
</template> </template>
<!-- 清单版本 -->
<template v-slot:manifestVersion="{text}">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? ('V' + text + '.0') : global.emptyLine }}</template>
<div class="table-text">{{ text || text === 0 ? ('V' + text + '.0') : global.emptyLine }}</div>
</a-tooltip>
</template>
</j-table> </j-table>
</div> </div>
<!-- table区域-end --> <!-- table区域-end -->
@@ -176,7 +168,7 @@ export default {
align: 'center', align: 'center',
width: 180, width: 180,
dataIndex: 'manifestVersion', dataIndex: 'manifestVersion',
scopedSlots: { customRender: 'manifestVersion' } scopedSlots: { customRender: 'text' }
}, },
{ // 发布时间 { // 发布时间
title: this.$t('standardRegulationLibrary.marketRegulationsList.releaseTime'), title: this.$t('standardRegulationLibrary.marketRegulationsList.releaseTime'),
@@ -11,10 +11,11 @@
<a-table <a-table
ref="table" ref="table"
rowKey="id" rowKey="version"
:columns="columns" :columns="columns"
:dataSource="dataSource" :dataSource="dataSource"
:loading="loading" :loading="loading"
:pagination="false"
:showHeader="false" :showHeader="false"
:scroll="{x: '100%', y: 'calc(100vh - 500px)'}"> :scroll="{x: '100%', y: 'calc(100vh - 500px)'}">
@@ -32,7 +33,6 @@
</template> </template>
<script> <script>
import { marketRegulationListHistoryList } from '../../../../api/standardRegulationLibraryApi'
export default { export default {
name: 'HistoryVersionModal', name: 'HistoryVersionModal',
@@ -50,24 +50,15 @@ export default {
scopedSlots: { customRender: 'toDetail' } scopedSlots: { customRender: 'toDetail' }
} }
], ],
dataSource: [ dataSource: []
{id: 1, version: 'V1.0'},
{id: 2, version: 'V2.0'},
{id: 3, version: 'V3.0'},
]
} }
}, },
methods: { methods: {
open (id) { open (model) {
this.visible = true this.visible = true
this.model.id = id this.model = Object.assign({}, model)
// this.initData(id) this.dataSource = this.model.historyVersions.map(item => {
}, return { version: item }
initData (id) {
marketRegulationListHistoryList({ id }).then(res => {
if (res.success) {
this.dataSource = res.result
}
}) })
}, },
// 点击版本号 // 点击版本号
@@ -76,10 +67,11 @@ export default {
path: '/standardRegulationLibrary/marketRegulationsList/marketRegulationsDetailPage', path: '/standardRegulationLibrary/marketRegulationsList/marketRegulationsDetailPage',
query: { query: {
title: this.$t('view'), title: this.$t('view'),
ids: this.model.id, ids: this.model.manifest.id,
versionNumber: record.version manifestVersion: record.version
} }
}) })
this.visible = false
}, },
handleCancel () { handleCancel () {
this.visible = false this.visible = false