[update]-授权申请页面的增加;企业端消息的增加;列表页字段显示不正确的bug

This commit is contained in:
fengchenchen
2021-12-20 18:16:04 +08:00
parent b969ade002
commit fcd8261278
9 changed files with 725 additions and 88 deletions
@@ -0,0 +1,260 @@
<template>
<a-card :bordered="false">
<a-form :form="form">
<a-row>
<a-col :span="12">
<a-form-item label="单位名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input
v-decorator="['unitName',validatorRules.unitName]"
placeholder="请输入单位名称"
:disabled="isMember !== 'member'"
:maxLength="50"
@change="e => {e.target.value = (e.target.value + '').trim()}">
</a-input>
</a-form-item>
</a-col>
<!-- v-has=" 'vin:application' "-->
<a-col :span="2">
<a-button type="primary" @click="applicationFunc" class="apply-btn">申请授权</a-button>
</a-col>
</a-row>
</a-form>
<a-divider orientation="left">
授权记录
</a-divider>
<!-- 授权记录-->
<a-table
ref="table"
size="middle"
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
class="j-table-force-nowrap"
@change="handleTableChange">
<span slot="action" slot-scope="text, record">
<a @click="cancelOrOK(record)" v-if="record.authorizeType !== 2 ">确认授权</a>
<a @click="cancelOrOK(record)" v-else>取消授权</a>
</span>
</a-table>
<a-row class="center">
<a-button @click="cancel">返回</a-button>
</a-row>
</a-card>
</template>
<script>
import { getAction } from '@api/memberManage'
import { application, determineOrCancel } from '@api/standardsAssociationApi'
export default {
name: 'Authorization',
data() {
return {
form: this.$form.createForm(this),
isMember: 'member',
/* 分页参数 */
ipagination: {
current: 1,
pageSize: 10,
pageSizeOptions: ['10', '20', '30'],
showTotal: (total, range) => {
return range[0] + '-' + range[1] + ' 共' + total + '条'
},
showQuickJumper: true,
showSizeChanger: true,
total: 0
},
/* table加载状态 */
loading: false,
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
},
// 授权历史表头
columns: [
{
title: '序号',
dataIndex: '',
key: 'rowIndex',
width: 60,
align: 'center',
customRender: function(t, r, index) {
return parseInt(index) + 1
}
},
{
title: '单位全称',
align: 'center',
dataIndex: 'unitName'
},
{
title: '申请授权时间',
align: 'center',
dataIndex: 'createTime'
},
{
title: '授权通过时间',
align: 'center',
dataIndex: 'updateTime'
},
{
title: '授权审批人',
align: 'center',
dataIndex: 'updateBy'
},
{
title: '状态',
align: 'center',
dataIndex: 'authorizeType_dictText'
},
{
title: '操作',
dataIndex: 'action',
align: 'center',
scopedSlots: { customRender: 'action' }
}
],
dataSource: [],
url: {
list: '/vincertificateauthorize/tbVinCertificateAuthorize/list/'
},
validatorRules: {
unitName: {
rules: [
{ required: true, message: '请输入单位名称!' }
],
validateTrigger: 'blur'
}
}
}
},
created() {
if (this.isMember === 'member') {
this.columns.forEach((item, index) => {
if (item.dataIndex === 'action') {
this.columns.splice(index, 1)
}
})
}
this.loadData()
},
mounted() {
},
methods: {
/*
* 申请授权
* */
applicationFunc() {
const that = this
this.form.validateFields((err, values) => {
if (!err) {
const formData = Object.assign({}, values)
formData.certificateId = this.$route.query.id
application(formData).then(res => {
if (res.success) {
this.$message.success(res.message)
this.loadData(1)
} else {
this.$message.warning(res.message)
}
}).finally(() => {
that.form.resetFields('unitName')
})
}
})
},
/*
* 返回
* */
cancel() {
this.$router.push('/standardsAssociation/CertificateManagement')
},
/*
* 获取列表数据
* */
loadData(arg) {
if (!this.url.list) {
this.$message.error('请设置url.list属性!')
return
}
// 加载数据 若传入参数1则加载第一页的内容
if (arg === 1) {
this.ipagination.current = 1
}
const params = {}// 查询条件
params.pageNo = this.ipagination.current
params.pageSize = this.ipagination.pageSize
params.certificateId = this.$route.query.id
this.loading = true
getAction(this.url.list, params).then((res) => {
if (res.success) {
this.dataSource = res.result.records || []
if (this.isMember !== 'member' && this.dataSource.length > 0 && this.dataSource[0].unitName) {
this.form.setFieldsValue({ 'unitName': this.dataSource[0].unitName })
}
this.ipagination.total = res.result.total
}
if (res.code === 510) {
this.$message.warning(res.message)
}
this.loading = false
})
},
/*
* 确认或者取消授权 确认授权传2 取消传3
* */
cancelOrOK(record) {
const params = {
id: record.id,
unitName: record.unitName
}
if (record.authorizeType !== 2) {
params.authorizeType = 2
determineOrCancel(params).then(res => {
if (res.success) {
this.$message.success('确认授权成功')
this.loadData()
}
})
} else {
params.authorizeType = 3
determineOrCancel(params).then(res => {
if (res.success) {
this.$message.success('取消授权成功')
this.loadData()
}
})
}
},
/*
* 分页
* */
handleTableChange(pagination) {
this.ipagination = pagination
this.loadData()
}
}
}
</script>
<style scoped lang="less">
.center {
text-align: center;
margin-top: 10px;
}
.apply-btn {
margin-top: 6px;
transform: translateX(-40px);
}
</style>