Files
laws_weilai/jero-web/src/views/businessSupport/problemKnowledgeBase/components/countryCardRelease.vue
T
2022-09-02 18:27:43 +08:00

494 lines
15 KiB
Java

<template>
<div class="doc-detail">
<div class="doc-detail-wrap">
<div class="doc-detail-header" style="position: fixed;top: 0">
<div class="doc-detail-title">
<!-- <span style="line-height: 66px;display: inline-block;float: left">-->
<!-- <a-icon type="arrow-left" style="margin-right: 6px;"/>-->
<!-- </span>-->
{{$t('managePublishing')}}
</div>
</div>
<div style="padding-top: 68px;background: #fff">
<div class="detail-content" style="padding: 24px">
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :md="6" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('applicableMarket')">
<span>{{$t('applicableMarket')}}</span>
</div>
<a-select class="box-input"
:getPopupContainer="triggerNode=> triggerNode.parentNode"
:placeholder="$t('PleaseSelect')+$t('applicableMarket')"
style="width: 100%;"
v-model="queryParam.applyMarket">
<a-select-option v-for="(item, key) in applyMarketList"
:key="key"
:value="item.value">
<span style="display: inline-block;width: 100%" :title=" item.title ">
{{ item.title}}
</span>
</a-select-option>
</a-select>
</div>
</a-col>
<a-col :md="6" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('releaseStatus')">
<span>{{$t('releaseStatus')}}</span>
</div>
<a-select class="box-input"
:getPopupContainer="triggerNode=> triggerNode.parentNode"
:placeholder="$t('PleaseSelect')+$t('releaseStatus')"
style="width: 100%;"
v-model="queryParam.releaseStatus">
<a-select-option v-for="(item, key) in releaseStatusList"
:key="key"
:value="item.value">
<span style="display: inline-block;width: 100%" :title=" item.name ">
{{ item.name}}
</span>
</a-select-option>
</a-select>
</div>
</a-col>
<span style="float: right;overflow: hidden;margin-right: 11px" class="table-page-search-submitButtons">
<a-col :md="6" :sm="24">
<a-button class="box-button" type="primary" @click="searchQuery">{{$t('query')}}</a-button>
<a-button class="box-button" style="margin-left: 8px" @click="searchReset">{{$t('reset')}}</a-button>
</a-col>
</span>
</a-row>
</a-form>
</div>
<div class="box-content-right">
<div @click="BatchDeleteClick" class="operator-text">
<a-icon type="delete"/>
{{$t('BatchDelete')}}
</div>
<div @click="templateMaintenanceClick" class="operator-text">
<a-icon type="carry-out"/>
{{$t('templateMaintenance')}}
</div>
<div @click="newlyAddedClick" class="operator-text">
<a-icon type="plus"/>
{{$t('newlyAdded')}}
</div>
</div>
<div>
<a-table
ref="table"
size="middle"
:loading="loading"
:pagination="false"
:scroll="{x: '100%'}"
rowKey="id"
:data-source="dataSource"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:columns="columns"
>
<span slot="operation" slot-scope="text,record">
<a class="text-operation" @click="viewClick(record)">{{$t('view')}}</a>
<a class="text-operation"
@click="subscribe(record)">
{{!record.releaseStatus || record.releaseStatus == 'Draft' ? $t('release') :$t('withdraw')}}
</a>
<a class="text-operation"
v-if="record.releaseStatus == 'Draft'"
@click="edit(record)">{{$t('edit')}}</a>
<a class="text-operation"
v-if="record.releaseStatus == 'Draft'"
@click="deleteData(record)">{{$t('delete')}}</a>
</span>
</a-table>
<div class="page" v-if="dataSource && dataSource.length > 0">
<a-pagination
:show-total="total => $t('total')+` ${total} `+$t('strip')"
show-quick-jumper
show-size-changer
:page-size.sync="pageSize"
:total="total"
:current="pageNo"
@change="pageOnChange"
@showSizeChange="SizeChange"
/>
</div>
</div>
</div>
</div>
</div>
<countryCardReleaseModel ref="countryCardReleaseModelRef"/>
<countryCardReleaseAdd ref="countryCardReleaseAddRef" @countryCardReleaseAddForm="countryCardReleaseAddForm"/>
</div>
</template>
<script>
import { getAction, postAction, deleteAction, downloadFile } from '@/api/manage'
import countryCardReleaseModel from './countryCardReleaseModel'
import countryCardReleaseAdd from './countryCardReleaseAdd'
import { mapGetters } from 'vuex'
export default {
name: 'countryCardRelease',
components: {
countryCardReleaseModel,
countryCardReleaseAdd
},
data() {
return {
queryParam: {},
releaseStatusList: [
{
value: 'Draft',
name: this.$t('draft')
},
{
value: 'Have released',
name: this.$t('HaveReleased')
}
],
loading: false,
dataSource: [],
selectedRowKeysRecord: [],
total: 0,
pageSize: 10,
pageNo: 1,
url: {
list: '/problemKnowledgeBase/countryCardManageReleaseEO/page',
deleteBatch: '/problemKnowledgeBase/countryCardManageReleaseEO/deleteBatch'
},
userInfoQuery: {},
applyMarketList: [],
selectedRowKeys: [],
columns: [
{
title: this.$t('applicableMarket'),
align: 'center',
dataIndex: 'applyMarket_dictText',
ellipsis: true
},
{
title: this.$t('releaseStatus'),
align: 'center',
dataIndex: 'releaseStatus_dictText',
ellipsis: true
},
{
title: this.$t('creater'),
align: 'center',
dataIndex: 'createBy',
ellipsis: true
},
{
title: this.$t('operation'),
align: 'center',
fixed: 'right',
width: 260,
scopedSlots: { customRender: 'operation' }
}
]
}
},
mounted() {
document.title = 'Country Card-' + this.$t('managePublishing')
this.getList()
this.getApplyMarketList()
this.userInfoQuery = this.userInfo()
},
methods: {
...mapGetters(['userInfo']),
getApplyMarketList() {
getAction('/problemKnowledgeBase/countryCardManageReleaseEO/getApplyMarketList', { queryFlag: '3' }).then((res) => {
if (res.success) {
this.applyMarketList = res.result || []
} else {
this.applyMarketList = []
}
})
},
searchQuery() {
this.pageNo = 1
this.getList()
},
searchReset() {
this.queryParam = {}
this.pageNo = 1
this.getList()
},
pageOnChange(page) {
this.pageNo = page
this.getList()
},
SizeChange(page, pageSize) {
this.pageNo = 1
this.pageSize = pageSize
this.getList()
},
countryCardReleaseAddForm() {
this.getApplyMarketList()
this.pageNo = 1
this.getList()
},
getList() {
let queryParam = JSON.parse(JSON.stringify(this.queryParam))
Object.keys(queryParam).forEach(val => {
if (queryParam[val] instanceof Array) {
queryParam[val] = queryParam[val].join(',')
}
})
let query = {
pageNo: this.pageNo,
pageSize: this.pageSize,
createBy: this.userInfo().username,
...queryParam
}
this.loading = true
getAction(this.url.list, query).then((res) => {
if (res.success) {
if (res.result.current > 1 && res.result.records.length == 0) {
this.pageNo = 1
this.getList()
return
}
this.dataSource = res.result.records || []
this.total = res.result.total
this.loading = false
} else {
this.loading = false
}
})
},
onSelectChange(value, record) {
this.selectedRowKeys = value
this.selectedRowKeysRecord = record
},
newlyAddedClick() {
this.$refs.countryCardReleaseAddRef.add()
},
templateMaintenanceClick() {
this.$refs.countryCardReleaseModelRef.getData()
},
BatchDeleteClick() {
if (this.selectedRowKeys.length > 0) {
let _this = this
this.$confirm({
content: _this.$t('ConfirmBatchDeletion'),
onOk() {
let idList = []
let selectedRowKeysRecord = JSON.parse(JSON.stringify(_this.selectedRowKeysRecord))
for (let i = 0; i < selectedRowKeysRecord.length; i++) {
if (selectedRowKeysRecord[i].releaseStatus == 'Draft') {
idList.push(selectedRowKeysRecord[i].id)
}
}
if (idList.length > 0) {
deleteAction(_this.url.deleteBatch, { ids: idList.join(',') }).then((res) => {
if (res.success) {
_this.$message.success(_this.$t('OperationSuccessful'))
_this.selectedRowKeys = []
_this.getList()
_this.getApplyMarketList()
} else {
_this.$message.warning(res.message)
}
})
} else {
_this.$message.warning(_this.$t('doNotHavePermissionDeleteData'))
}
}
})
} else {
this.$message.warning(this.$t('selectLeastOne'))
}
},
edit(record) {
this.$refs.countryCardReleaseAddRef.edit(JSON.parse(JSON.stringify(record)))
},
subscribe(record) {
let _this = this
this.$confirm({
content: record.releaseStatus == 'Draft' ? _this.$t('confirmRelease') : _this.$t('confirmWithdraw'),
onOk() {
let releaseCondition = ''
if (record.releaseStatus == 'Draft') {
releaseCondition = 'Have released'
} else {
releaseCondition = 'Draft'
}
let query = {
releaseStatus: releaseCondition,
ids: record.id
}
postAction('/problemKnowledgeBase/countryCardManageReleaseEO/batchUpdateReleaseStatus', query).then((res) => {
if (res.success) {
_this.$message.success(_this.$t('OperationSuccessful'))
_this.getList()
} else {
_this.$message.warning(_this.$t('operationFailed'))
}
})
}
})
},
viewClick(row) {
let newUrl = this.$router.resolve({
path: '/countryCardView',
query: {
applyMarket: row.applyMarket,
id: row.id
}
})
window.open(newUrl.href, '_blank')
},
deleteData(val) {
let _this = this
this.$confirm({
content: _this.$t('ConfirmDelete'),
onOk() {
deleteAction(_this.url.deleteBatch, { ids: val.id }).then((res) => {
if (res.success) {
_this.$message.success(_this.$t('OperationSuccessful'))
_this.getList()
_this.getApplyMarketList()
} else {
_this.$message.warning(res.message)
}
})
}
})
}
}
}
</script>
<style scoped lang="less">
@import '~@assets/less/common.less';
.doc-detail {
background: #fff;
height: 100%;
.doc-detail-wrap {
.doc-detail-header {
width: 100%;
height: 68px;
line-height: 68px;
padding: 0 0 0 32px;
box-sizing: border-box;
display: flex;
justify-content: space-between;
border-bottom: 2px #eff1f3 solid;
z-index: 1000;
background: #fff;
.doc-detail-title {
display: inline-block;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
font-size: 20px;
font-weight: 400;
color: #040B29;
line-height: 68px;
}
.doc-detail-right {
width: 800px;
line-height: 68px;
display: flex;
.doc-detail-btn {
margin-left: 10px;
}
}
}
.content-box {
padding: 0 32px;
box-sizing: border-box;
}
.header-text {
font-size: 16px;
font-weight: 400;
height: 80px;
color: #000F16;
line-height: 80px;
}
.processBackground-text {
font-size: 16px;
color: #000F16;
}
}
}
.page {
text-align: right;
margin-top: 20px;
}
.box-title-text {
line-height: 1.4;
display: flex;
align-items: center;
margin-bottom: 10px;
}
.title-text {
width: 20%;
min-width: 110px;
color: #000F16;
display: inline-block;
font-weight: 500;
font-size: 14px;
margin-right: 16px;
margin-top: 3px;
text-align: right;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.box-input {
display: inline-block;
width: 70%;
height: 38px;
margin-top: 2px;
}
.box-button {
height: 38px;
/*margin-top: 2px;*/
}
.box-content-right {
width: 100%;
text-align: right;
margin-top: 20px;
margin-bottom: 20px;
}
.operator-text {
cursor: pointer;
margin-right: 53px;
font-size: 14px;
font-weight: 400;
color: #040B29;
display: inline-block;
}
.operator-text:last-child {
margin-right: 13px;
}
.text-operation {
margin-right: 8px;
}
::v-deep .ant-select-dropdown {
z-index: 100;
}
</style>