[update] 个人中心所有模块

This commit is contained in:
lideqin
2023-09-14 11:16:33 +08:00
parent 4218865da8
commit bdb9e0d18c
10 changed files with 622 additions and 1854 deletions
@@ -2,45 +2,171 @@
<template>
<div class="collection">
<a-card :bordered="false">
<a-spin :spinning="spinning">
<a-tabs :default-active-key="1" @change="callbackTab">
<a-tab-pane v-for='item in tabArr' :key="item.value" :tab="item.showText">
<component :is='item.comp' :type='item.value' :property="item.props"></component>
</a-tab-pane>
</a-tabs>
</a-spin>
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :md="6" :sm="8">
<!--标准类别-->
<a-form-item :label="$t('personalCenter.collection.standardCategory')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-dict-select-tag
v-model="queryParam.state"
:placeholder="$t('pleaseSelect') + $t('personalCenter.collection.standardCategory')"
:type="'select'"
:triggerChange="false"
:dictCode="'state'"
/>
</a-form-item>
</a-col>
<a-col :md="6" :sm="8">
<!--标准号-->
<a-form-item :label="$t('personalCenter.collection.standardNo')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input :placeholder="$t('pleaseEnter') + $t('personalCenter.collection.standardNo')"
v-model="queryParam.standardNo"></a-input>
</a-form-item>
</a-col>
<a-col :md="6" :sm="8">
<!--标准名称-->
<a-form-item :label="$t('personalCenter.collection.standardName')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input :placeholder="$t('pleaseEnter') + $t('personalCenter.collection.standardName')"
v-model="queryParam.standardName"></a-input>
</a-form-item>
</a-col>
<div style="float: right;overflow: hidden;margin-right: 11px" class="table-page-search-submitButtons">
<a-button class="box-button" @click="searchReset">{{ $t('reset') }}</a-button>
<a-button class="box-button" style="margin-left: 8px" type="primary" @click="searchQuery">{{ $t('query') }}</a-button>
</div>
</a-row>
</a-form>
</div>
<j-table
ref="table"
:bordered="true"
size="middle"
rowKey="id"
:can-drag="true"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:scroll="{x: '100%'}"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
@change="handleTableChange">
<!--标准号、标准名称-->
<template v-slot:toDetail="{text, record}">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<a class="link-a" @click="handleGoDetail(record)">{{ text }}</a>
</a-tooltip>
</template>
<template v-slot:action="{text, record}">
<!--取消收藏-->
<a class="table-del" @click="handleCancelCollect(record)">{{$t('personalCenter.collection.cancelCollection')}}</a>
</template>
</j-table>
</a-card>
</div>
</template>
<script>
import CollectionDocumentLibraryList from './pages/CollectionDocumentLibraryList'
import CollectionKnowledgeShareList from './pages/CollectionKnowledgeShareList'
import '@assets/less/common.less'
import JTable from '@/components/jero/JTable'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import { cancelCollect } from '@/api/personCenter'
export default {
name: 'MyCollection',
components: {
CollectionDocumentLibraryList,
CollectionKnowledgeShareList
},
components: { JTable },
mixins: [JeroListMixin],
data () {
return {
spinning: false,
tabArr: [
{ name: '文档库', showText: this.$t('personalCenter.collection.documentLibrary'), value: 1, comp: CollectionDocumentLibraryList },
{ name: '知识分享', showText: this.$t('personalCenter.collection.problemKnowledgeBase'), value: 2, comp: CollectionKnowledgeShareList }
]
labelCol: {
span: 4
},
wrapperCol: {
span: 14
},
columns: [
{
title: this.$t('personalCenter.collection.standardNo'),
align: 'center',
width: 180,
dataIndex: 'standardNo',
scopedSlots: { customRender: 'toDetail' }
},
{
title: this.$t('personalCenter.collection.standardName'),
align: 'center',
width: 180,
dataIndex: 'standardName',
scopedSlots: { customRender: 'toDetail' }
},
{
title: this.$t('personalCenter.collection.releaseDate'),
align: 'center',
width: 180,
dataIndex: 'releaseDate',
scopedSlots: { customRender: 'text' }
},
{
title: this.$t('personalCenter.collection.newCarTypeDate'),
align: 'center',
width: 180,
dataIndex: 'newCarTypeDate',
scopedSlots: { customRender: 'text' }
},
{
title: this.$t('personalCenter.collection.productCarDate'),
align: 'center',
width: 180,
dataIndex: 'productCarDate',
scopedSlots: { customRender: 'text' }
},
{
title: this.$t('personalCenter.collection.standardState'),
align: 'center',
width: 180,
dataIndex: 'standardState',
scopedSlots: { customRender: 'text' }
},
{
title: this.$t('operation'),
scopedSlots: { customRender: 'action' },
align: 'center',
width: 200
}
],
url: {
list: '/personal/lawsStandardCollection/page'
}
}
},
methods: {
// 标签项管理tab切换
callbackTab (value) {
this.key = value
this.spinning = true
setTimeout(() => {
this.spinning = false
}, 1000)
// 点击跳转标准详情
handleGoDetail (record) {
let path = ''
// 需要先判断是哪种标准
if (record.type === 3) {
path = '/enterpriseStandardLibrary/enterpriseStandardDetail'
}
this.$openPageNewSheet({
path: path,
query: {
id: record.id
}
})
},
// 取消收藏
handleCancelCollect (record) {
cancelCollect({ id: record.id }).then(res => {
if (res.success) {
this.$message.success(res.message)
this.loadData()
} else {
this.$message.warning(res.message)
}
})
}
}
}