Files
income_payments_enterprise_…/src/views/standardsAssociation/CertificateManagement.vue
T
2022-07-29 11:18:40 +08:00

697 lines
26 KiB
Vue

<!--标协会员-证书管理-->
<template>
<div class="main-box">
<a-card :bordered="false">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :span="6" :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="证书类型" class="certificate-type-item">
<j-dict-select-tag
placeholder="请选择证书类型"
v-model="queryParam.certificateType"
:title="queryParam.certificateType"
dictCode="certificate_type"/>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="状态">
<j-multi-select-tag
placeholder="请选择证书状态"
v-model="queryParam.certificateStatus"
dictCode="certificate_status"
>
</j-multi-select-tag>
</a-form-item>
</a-col>
<template>
<a-col :xl="10" :lg="11" :md="12" :sm="24">
<a-form-item label="发证时间">
<j-date
placeholder="请选择开始日期"
date-format="YYYY-MM-DD 00:00:00"
class="query-group-cust"
v-model="queryParam.beginCertificationDate"
:disabled-date="disabledStartDate">
</j-date>
<span class="query-group-split-cust"></span>
<j-date
placeholder="请选择结束日期"
date-format="YYYY-MM-DD 23:59:59"
class="query-group-cust"
v-model="queryParam.endCertificationDate"
:disabled-date="disabledEndDate">
</j-date>
</a-form-item>
</a-col>
<a-col :span="6" :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="证书形式" class="certificate-type-item">
<j-dict-select-tag
placeholder="请选择证书形式"
v-model="queryParam.certificateModality"
:title="queryParam.certificateModality"
dictCode="certificate_modality" />
</a-form-item>
</a-col>
</template>
<a-col :xl="6" :lg="7" :md="8" :sm="24" v-has=" 'vin:applicationHistory'">
<a-form-item label="单位全称">
<a-input placeholder="请输入单位全称" v-model="queryParam.companyName"></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
<a-button @click="searchReset" icon="reload" style="margin-left: 8px" class="reset-button">重置</a-button>
<a-button
type="primary"
@click="applyCertificate"
class="primary"
style="margin-left: 8px">申请证书
</a-button>
</span>
</a-col>
</a-row>
</a-form>
</div>
<!-- 查询区域-END -->
<!-- table区域-begin -->
<div>
<a-table
ref="table"
size="middle"
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
class="j-table-force-nowrap"
@change="handleTableChange">
<template slot="htmlSlot" slot-scope="text">
<div v-html="text"></div>
</template>
<template slot="imgSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
<img
v-else
:src="getImgView(text)"
height="25px"
alt=""
style="max-width:80px;font-size: 12px;font-style: italic;"/>
</template>
<template slot="fileSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button
v-else
:ghost="true"
type="primary"
icon="download"
size="small"
@click="uploadFile(text)">
下载
</a-button>
</template>
<span slot="action" class="action-span-cell" slot-scope="text, record">
<!-- 待支付 不显示 -->
<a v-if="record.certificateStatus !== '0' " @click="handleWithdraw(record)">撤回</a>
<a @click="handleDetail(record)">查看</a>
<a v-show="record.certificateStatus == 4">
<a href="javascript:;" @click="(record.certificateStatus == 4) && bindMember(record)">绑定会员</a>
</a>
<!-- v-show="record.chargeType != 1 && record.certificateModality == 3 && record.certificateStatus == 5"-->
<!-- 已绑定的证书不能续费 已支付已缴费的不能续费 需要流程走完才能续费 v-has="'vin:renew'"-->
<a
v-show="Number(record.certificateStatus) === 4 ||Number(record.certificateStatus) === 5 || Number(record.certificateStatus) === 7 ">
<a href="javascript:;" @click="renewCharge(record)">续费</a>
</a>
<!-- v-has="'vin:renewal'"-->
<a
v-show="record.certificateModality == 3 && (record.certificateStatus == 1 || record.certificateStatus == 4)">
<a href="javascript:;"
@click="(record.certificateModality == 3 && (record.certificateStatus == 1 || record.certificateStatus == 4)) && replacement(record)">换证</a>
</a>
<a v-show="(record.certificateStatus == 6 && record.chargeType == 2) || record.certificateStatus == 0">
<a href="javascript:;"
@click="((record.certificateStatus == 6 && record.chargeType == 2) || record.certificateStatus == 0) && handleEditRenew(record)">编辑</a>
</a>
<!-- 会员 只有企业证书才 正常使用 已绑定的证书 可授权申请-->
<a
v-show="roleCode === 'member'&& record.certificateType == 2 && (record.certificateStatus == 4 || record.certificateStatus == 1)"
>
<a href="javascript:;" @click="authorizationFunc(record)">授权申请</a>
</a>
<a v-show="record.certificateStatus == 6 || record.certificateStatus == 0">
<a
@click="(record.certificateStatus == 6 || record.certificateStatus == 0) && handleDelete(record.id)">删除</a>
</a>
</span>
<!-- 状态渲染模板 -->
<template slot="customRenderStatus" slot-scope="certificateStatus">
<a-tag v-if="certificateStatus==0" color="#c37e00">待支付</a-tag>
<a-tag v-if="certificateStatus==1" color="#40835e">已绑定</a-tag>
<a-tag v-if="certificateStatus==2" color="#40835e">已支付</a-tag>
<a-tag v-if="certificateStatus==3" color="#40835e">支付已审核</a-tag>
<a-tag v-if="certificateStatus==4" color="#40835e">正常使用</a-tag>
<a-tag v-if="certificateStatus==5" color="#8a8c8e">已失效</a-tag>
<a-tag v-if="certificateStatus==6" color="#8a8c8e">已驳回</a-tag>
<a-tag v-if="certificateStatus==7" color="#8a8c8e">绑定已失效</a-tag>
</template>
<!-- 临近证书与超期证书-->
<template slot="codeState" slot-scope="text,record">
<span v-if="record.codeState === 0 ">{{ text }}<span class="state-0">超期证书</span></span><!--
--><span v-if="record.codeState === 1 ">{{ text }}<span class="state-1">临期证书</span></span><!--
--><span v-if="record.codeState === 2 ">{{ text }}</span>
</template>
</a-table>
</div>
<vinCertificate-modal ref="modalForm" @ok="modalFormOk"></vinCertificate-modal>
<!-- 查看证书-->
<CheckCertificateModel ref="checkModalForm"></CheckCertificateModel>
<!-- 绑定会员 窗口-->
<bind-member-model ref="bindMemberModelForm" @ok="modalFormOk"></bind-member-model>
<!-- 续费 窗口-->
<renew-charge-model ref="renewChargeModelForm" @ok="modalFormOk"></renew-charge-model>
<!-- 换证 窗口-->
<replace-ment-model ref="replaceMentModelForm" @ok="modalFormOk" @affirm="handleAffirm"></replace-ment-model>
<!-- 换证确认 窗口-->
<replace-ment-affirm-model ref="replaceMentAffirmModelForm"></replace-ment-affirm-model>
<!-- 新建VIN证书申请 免费额度内 窗口-->
<free-certificate-model ref="addFreeModalForm" @ok="modalFormOk"></free-certificate-model>
<!-- 新建VIN证书申请 付费额度内 窗口-->
<charge-certificate-model ref="addChargeModalForm" @ok="modalFormOk"></charge-certificate-model>
<!-- 免费证书申请编辑 窗口-->
<free-certificate-edit-model ref="freeCertificateEditModel" @ok="modalFormOk"></free-certificate-edit-model>
<!-- 免费证书申请换证 窗口-->
<free-certificate-replace-edit-model
ref="FreeCertificateReplaceEditModel"
@ok="modalFormOk"
@affirm="handleAffirm">
</free-certificate-replace-edit-model>
<!-- 收费证书申请编辑 窗口-->
<charge-certificate-edit-model ref="ChargeCertificateEditModel" @ok="modalFormOk"></charge-certificate-edit-model>
<!-- 证书续费编辑 窗口-->
<renew-charge-edit-model ref="RenewChargeEditModel" @ok="modalFormOk"></renew-charge-edit-model>
</a-card>
</div>
</template>
<script>
import '@/assets/less/TableExpand.less'
import {mixinDevice} from '@/utils/mixin'
import {JeroListMixin} from '@/mixins/JeroListMixin'
import {StandardListMixin} from '@/mixins/StandardListMixin'
import VinCertificateModal from './memberManagementModule/VinCertificateModal'
import JDate from '../../components/tools/JDate'
import JMultiSelectTag from '@comp/standardsAssociation/JMultiSelectTag'
import {RangeDateMixin} from '@/mixins/RangeDateMixin'
import JDictSelectTag from '../../components/standardsAssociation/JDictSelectTag'
// eslint-disable-next-line no-unused-vars
import {downloadFile, getAction, getFileAccessHttpUrl} from '@/api/memberManage'
import {withDrawChargeCertificate} from '@api/standardsAssociationApi'
import {CertificateModalityEnums, CertificateStatusEnums, ChargeTypeEnums} from '../../enums/memberEnums'
import CheckCertificateModel from '@views/standardsAssociation/model/CheckCertificateModel'
import BindMemberModel from '@views/standardsAssociation/model/BindMemberModel'
import RenewChargeModel from '@views/standardsAssociation/model/RenewChargeModel'
import ReplaceMentModel from '@views/standardsAssociation/model/ReplaceMentModel'
import ReplaceMentAffirmModel from '@views/standardsAssociation/model/ReplaceMentAffirmModel'
import FreeCertificateModel from '@views/standardsAssociation/model/FreeCertificateModel'
import ChargeCertificateModel from '@views/standardsAssociation/model/ChargeCertificateModel'
import FreeCertificateEditModel from '@views/standardsAssociation/model/FreeCertificateEditModel'
import ChargeCertificateEditModel from '@views/standardsAssociation/model/ChargeCertificateEditModel'
import RenewChargeEditModel from '@views/standardsAssociation/model/RenewChargeEditModel'
import FreeCertificateReplaceEditModel from '@views/standardsAssociation/model/FreeCertificateReplaceEditModel'
export default {
name: 'CertificateManagement',
mixins: [JeroListMixin, mixinDevice, RangeDateMixin, StandardListMixin],
components: {
JMultiSelectTag,
JDate,
VinCertificateModal,
JDictSelectTag,
CheckCertificateModel,
BindMemberModel,
RenewChargeModel,
ReplaceMentModel,
ReplaceMentAffirmModel,
FreeCertificateModel,
ChargeCertificateModel,
FreeCertificateEditModel,
ChargeCertificateEditModel,
RenewChargeEditModel,
FreeCertificateReplaceEditModel
},
data() {
return {
getAction,
getFileAccessHttpUrl,
// 时间范围查询显示的类型
rangeDateFormat: {
begin: 'YYYY-MM-DD hh:mm:ss',
end: 'YYYY-MM-DD'
},
description: 'VIN证书管理页面',
roleCode: 'member',
// 表头
columns: [
{
title: '序号',
dataIndex: '',
key: 'rowIndex',
width: 60,
align: 'center',
fixed: 'left',
customRender: function (t, r, index) {
return parseInt(index) + 1
}
},
{
title: '单位全称',
align: 'center',
width: 160,
dataIndex: 'companyName',
fixed: 'left'
},
{
title: '证书类型',
align: 'center',
width: 260,
dataIndex: 'certificateType',
customRender: function (text) {
if (text === 1) {
return '世界制造厂识别代号(WMI)证书'
} else if (text === 2) {
return '企业名称代号证书'
}
}
},
{
title: '证书代码',
align: 'center',
dataIndex: 'code',
width: 140,
scopedSlots: {customRender: 'codeState'}
},
{
title: '发证时间',
align: 'center',
dataIndex: 'certificationDate',
width: 170
},
{
title: '生效日期',
align: 'center',
width: 170,
dataIndex: 'effectDate',
customRender: function (text) {
return !text ? '' : (text.length > 10 ? text.substr(0, 10) : text)
}
},
{
title: '失效日期',
align: 'center',
dataIndex: 'invalidDate',
width: 160,
customRender: function (text) {
return !text ? '' : (text.length > 10 ? text.substr(0, 10) : text)
}
},
{
title: '备案通知书',
align: 'center',
dataIndex: 'noticeOfFiling',
width: 120,
customRender: function (text) {
if (text === 1) {
return '是'
} else if (text === 0) {
return '否'
} else {
return ''
}
}
},
{
title: '状态',
align: 'center',
width: 140,
dataIndex: 'certificateStatus',
scopedSlots: {customRender: 'customRenderStatus'}
},
{
title: '证书形式',
align: 'center',
width: 120,
dataIndex: 'certificateModality',
customRender: function (text) {
if (text === 1) {
return '换证'
} else if (text === 2) {
return '续证'
} else if (text === 3) {
return '正常'
} else if (text === 4) {
return '申请'
}
}
},
{
title: '操作',
dataIndex: 'action',
align: 'center',
fixed: 'right',
width: 147,
scopedSlots: {customRender: 'action'}
}
],
labelCol: {
xs: {span: 24},
sm: {span: 5}
},
wrapperCol: {
xs: {span: 24},
sm: {span: 16}
},
url: {
list: '/vinCertificate/vinCertificate/getMyVinCertificate',
delete: '/vinCertificate/vinCertificate/delete',
deleteBatch: '/vinCertificate/vinCertificate/deleteBatch',
exportXlsUrl: '/vinCertificate/vinCertificate/exportXls',
importExcelUrl: 'vinCertificate/vinCertificate/importExcel'
},
dictOptions: {},
dateKeyObj: {
beginKey: 'beginCertificationDate',
endKey: 'endCertificationDate'
}
}
},
computed: {
importExcelUrl: function () {
return `${window._CONFIG['memberURL']}/${this.url.importExcelUrl}`
}
},
methods: {
/**
* 撤回证书缴费
* */
handleWithdraw(record) {
const that = this
this.$confirm({
title: '确定撤回',
onOk() {
const param = {
id: record.id,
memberId: record.memberId,
certificateStatus: '2',
code: record.code
}
withDrawChargeCertificate(param).then(res => {
if (res.success) {
that.$message.success(res.message)
that.loadData()
} else {
that.$message.warning(res.message)
}
})
}
})
},
// 显示换证确认 窗口
handleAffirm() {
this.$refs.replaceMentAffirmModelForm.title = '提交成功'
this.$refs.replaceMentAffirmModelForm.show()
},
initDictConfig() {
},
// 授权
authorizationFunc(record) {
this.$router.push({
name: 'member-vinCertificate-Authorization',
query: {
id: record.id
}
})
},
/*
* 授权记录
* */
authorizationHistoryFunc(record) {
this.$router.push({
name: 'member-vinCertificate-Authorization',
query: {
id: record.id
}
})
},
// 申请证书
applyCertificate: function () {
const that = this
// 可申请的免费证书的个数
let freeCount
getAction('/vinCertificate/vinCertificate/getFreeCount').then(res => {
console.log(res)
if (res.success) {
freeCount = res.result
// that.$refs.modalForm.title = '新增申请'
// that.$refs.modalForm.disableSubmit = false
// that.$refs.modalForm.freeCount = freeCount
// freeCount 为0 打开收费证书申请窗口
if (freeCount === 0) {
// 弹出新增收费窗口操作
that.$refs.addChargeModalForm.title = '新增申请'
that.$refs.addChargeModalForm.add()
} else {
// 弹出新增免费窗口操作
// that.$refs.modalForm.pageType = 5
that.$refs.addFreeModalForm.add()
that.$refs.addFreeModalForm.title = '新增申请'
that.$refs.addFreeModalForm.freeCount = freeCount
}
// // 弹窗口操作
// that.$refs.modalForm.add()
} else {
that.$message.warning(res.message)
}
})
},
// 查看证书
handleDetail: function (record) {
this.$refs.checkModalForm.remainingTime = this.remainingTimeCount(record.certificateValidDate)
this.$refs.checkModalForm.check(record)
// this.$refs.modalForm.title = '查看证书'
// this.$refs.modalForm.disableSubmit = true
// this.$refs.modalForm.pageType = 1
// this.$refs.modalForm.remainingTime = this.remainingTimeCount(record.certificateValidDate)
// this.$refs.modalForm.edit(record)
},
// 绑定会员
bindMember: function (record) {
// 证书id
this.$refs.bindMemberModelForm.vinId = record.id
this.$refs.bindMemberModelForm.edit(record)
// this.$refs.modalForm.title = '绑定会员'
// this.$refs.modalForm.disableSubmit = true
// // 绑定会员时使用4号窗口
// this.$refs.modalForm.pageType = 4
// // 证书id
// this.$refs.modalForm.vinId = record.id
// this.$refs.modalForm.edit(record)
},
// 续费
renewCharge: function (record) {
// if(!(record.chargeType != 1 && record.certificateModality == 3 && record.certificateStatus == 5)){
// return;
// }
this.$refs.renewChargeModelForm.isChangeCer = record.certificateType
this.$refs.renewChargeModelForm.edit(record)
// this.$refs.modalForm.title = '续费'
// this.$refs.modalForm.disableSubmit = true
// // 换证显示 1是世界证书
// this.$refs.modalForm.isChangeCer = record.certificateType
// // 证书续费时使用7号窗口
// this.$refs.modalForm.pageType = 7
// this.$refs.modalForm.edit2(record)
},
// 换证
replacement: function (record) {
this.$refs.replaceMentModelForm.edit(record)
// this.$refs.modalForm.title = '换证'
// this.$refs.modalForm.disableSubmit = true
// // 换证的时候使用8号窗口
// this.$refs.modalForm.pageType = 8
// this.$refs.modalForm.edit3(record)
},
// 编辑: 包括免费证书,收费证书,续费,换证
handleEditRenew: function (record) {
console.log(record)
record.certificateModality = Number(record.certificateModality) // 证书形式
record.certificateStatus = Number(record.certificateStatus) // 证书的处理状态
// 证书是否免费 1-免费 2-付费
record.chargeType = Number(record.chargeType)
// 分为续证驳回和 非免费证书申请驳回 chargeType 1是免费证书 2是收费证书
// this.$refs.modalForm.title = ''
// this.$refs.modalForm.disableSubmit = true
// certificateStatus --证书状态-待支付
if (record.certificateStatus === CertificateStatusEnums.toPay.index) {
// 免费证书
if (record.chargeType === ChargeTypeEnums.freeCert.index) {
// 证书形式 - 申请
if (record.certificateModality === CertificateModalityEnums.applyCert.index) {
// 免费证书申请编辑
let freeCount
getAction('/vinCertificate/vinCertificate/getFreeCount').then((res) => {
freeCount = res.result
this.$refs.freeCertificateEditModel.freeCountVin = freeCount + 1
this.$refs.freeCertificateEditModel.edit(record)
// this.$refs.modalForm.freeCountVin = freeCount + 1
// this.$refs.modalForm.title = '新增申请'
// this.$refs.modalForm.disableSubmit = false
// this.$refs.modalForm.pageType = 10
// this.$refs.modalForm.edit5(record)
})
return
} else if (record.certificateModality === 1) {
// 免费证书换证编辑
this.$refs.FreeCertificateReplaceEditModel.edit(record)
// this.$refs.modalForm.title = '换证'
// this.$refs.modalForm.disableSubmit = true
// // 换证的时候使用13号窗口
// this.$refs.modalForm.pageType = 13
// this.$refs.modalForm.edit8(record)
}
} else if (record.chargeType === 2 && record.certificateModality === 4) {
// 收费证书编辑
this.$refs.ChargeCertificateEditModel.edit(record)
// this.$refs.modalForm.title = '新增申请'
// this.$refs.modalForm.disableSubmit = false
// this.$refs.modalForm.pageType = 11
// this.$refs.modalForm.edit6(record)
} else if (record.chargeType === 2 && record.certificateModality === 2) {
// 续费编辑
this.$refs.RenewChargeEditModel.edit(record)
// this.$refs.modalForm.title = '续费'
// this.$refs.modalForm.disableSubmit = true
// // 证书续费编辑时使用12号窗口
// this.$refs.modalForm.pageType = 12
// this.$refs.modalForm.edit7(record)
} else if (record.chargeType === 2 && record.certificateModality === 1) {
// // 换证编辑
this.$refs.FreeCertificateReplaceEditModel.edit(record)
// this.$refs.modalForm.title = '换证'
// this.$refs.modalForm.disableSubmit = true
// // 换证的时候使用13号窗口
// this.$refs.modalForm.pageType = 13
// this.$refs.modalForm.edit8(record)
}
} else {
// 新增证书缴费编辑窗口
if (record.chargeType === 2 && record.certificateModality === 4 && record.certificateStatus === 6) {
this.$refs.ChargeCertificateEditModel.edit(record)
// this.$refs.modalForm.title = '新增申请'
// this.$refs.modalForm.disableSubmit = false
// this.$refs.modalForm.pageType = 11
// this.$refs.modalForm.edit6(record)
} else if (record.chargeType === 2 && record.certificateModality === 2 && record.certificateStatus === 6) {
// 续费编辑
this.$refs.RenewChargeEditModel.edit(record)
// this.$refs.modalForm.title = '续费'
// this.$refs.modalForm.disableSubmit = true
// // 证书续费编辑时使用12号窗口
// this.$refs.modalForm.pageType = 12
// this.$refs.modalForm.edit7(record)
}
}
},
remainingTimeCount: function (date) {
if (date === null || date === undefined || date.length === 0) {
return 0
}
date = date.substring(11)
var strArr = (date + ' 23:59:59').split(' ')
var strDay = strArr[0].split('-')
var strTime = strArr[1].split(':')
var yy = strDay[0]
var mm = strDay[1]
var dd = strDay[2]
var hh = strTime[0]
var mi = strTime[1]
var se = strTime[2]
var date1 = new Date(Date.UTC(yy, mm - 1, dd, hh - 8, mi, se))
var date2 = new Date()
if (date1 <= date2) {
return 0
}
// var miao = (date1.getTime() - date2.getTime()) / 1000
var fen = ((date1.getTime() - date2.getTime()) / 1000) / 60
return parseInt(fen / (24 * 60)) // 得出剩bai余
}
}
}
</script>
<style scoped lang="less">
@import '~@assets/less/common.less';
@label-width: 78px;
.certificate-type-item {
/deep/ .ant-form-item-label {
min-width: @label-width !important;
}
/deep/ .ant-form-item-control-wrapper {
width: calc(100% - @label-width);
max-width: calc(100% - @label-width);
& > span {
max-width: 100%;
}
}
}
.state-0 {
display: inline-block;
margin-left: 5px;
color: red;
}
.state-1 {
display: inline-block;
margin-left: 5px;
color: #c37e00;
}
</style>