388 lines
13 KiB
Vue
388 lines
13 KiB
Vue
<template>
|
|
<div>
|
|
<page-header-title :img-for-icon="IconImg"></page-header-title>
|
|
<a-card :bordered="false">
|
|
<!-- 查询区域-start -->
|
|
<div class="table-page-search-wrapper">
|
|
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
|
<a-row>
|
|
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
|
<a-form-item label="企业名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
|
<a-input placeholder="请输入企业名称" v-model="queryParam.companyName" :maxLength='50'></a-input>
|
|
</a-form-item>
|
|
</a-col>
|
|
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
|
<a-form-item label="状态" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
|
<j-dict-select-tag v-model="queryParam.status" placeholder="请选择状态" dictCode="company_aduit_status"/>
|
|
</a-form-item>
|
|
</a-col>
|
|
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
|
<a-form-item label="企业信用代码" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
|
<a-input placeholder="请输入企业信用代码" v-model="queryParam.dutyCode" :maxLength='50'></a-input>
|
|
</a-form-item>
|
|
</a-col>
|
|
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
|
<span class="table-page-search-submitButtons">
|
|
<a-button type="primary" icon="search" @click="searchQuery" v-has="'company:search'">查询</a-button>
|
|
<a-button icon="reload" @click="searchReset" class="reset-button">重置</a-button>
|
|
</span>
|
|
</a-col>
|
|
</a-row>
|
|
</a-form>
|
|
</div>
|
|
<!-- 查询区域-end-->
|
|
|
|
<!-- 操作按钮区域-->
|
|
<div class="table-operator">
|
|
<a-button type="primary" icon="plus" @click="handleAdd" v-has="'company:add'">新增</a-button>
|
|
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl"
|
|
@change="handleImportExcel" v-has="'company:import'">
|
|
<a-button type="primary" icon="import">导入</a-button>
|
|
</a-upload>
|
|
<a-button type="primary" icon="export" @click="handleExportXls('单位/开票信息')" v-has="'company:export'">导出
|
|
</a-button>
|
|
<a-button type="primary" icon="download" @click="downTemplate('单位/开票信息导入模板')" v-has="'company:downTemplate'">
|
|
下载模板
|
|
</a-button>
|
|
<a-button type="danger" icon="delete" @click="batchDel" v-has="'company:batchDel'">批量删除</a-button>
|
|
</div>
|
|
<!-- 操作按钮区域-end-->
|
|
|
|
<!-- table表格区域-->
|
|
<div>
|
|
<a-table
|
|
ref="table"
|
|
size="middle"
|
|
bordered
|
|
rowKey="id"
|
|
:columns="columns"
|
|
:scroll="{x: 1600}"
|
|
:dataSource="dataSource"
|
|
:pagination="ipagination"
|
|
:loading="loading"
|
|
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
|
|
@change="handleTableChange"
|
|
class="j-table-force-nowrap">
|
|
|
|
<template slot="text" slot-scope="text">
|
|
<j-ellipsis :value="text" :length="18"></j-ellipsis>
|
|
</template>
|
|
<template slot="switch" slot-scope="text, record">
|
|
<a-switch :checked="text === 'true'" @change="(val) => onSwitchChange(val, record)" />
|
|
</template>
|
|
<!-- 是否为打包企业 -->
|
|
<template slot="packageEnterprise" slot-scope="text, record">
|
|
<a-switch :checked="text === 'true'" @change="(val) => onSwitchChangePackageEnterprise(val, record)" />
|
|
</template>
|
|
|
|
<span slot="action" class="action-span-cell" slot-scope="text, record">
|
|
<a @click="handleAudit(record.id)" v-if="record.status===2"
|
|
v-has="'company:confirm'">确认</a>
|
|
<a @click="handleEdit(record)" v-has="'company:edit'">编辑</a>
|
|
<a @click="confirmDelete(record)" v-has="'company:delete'">删除</a>
|
|
</span>
|
|
|
|
</a-table>
|
|
</div>
|
|
<business-management-module ref="modalForm" @ok="modalFormOk"></business-management-module>
|
|
</a-card>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { JeroListMixin } from '@/mixins/JeroListMixin'
|
|
import JEllipsis from '@comp/jero/JEllipsis'
|
|
import BusinessManagementModule from './modules/BusinessManagementModule'
|
|
import PageHeaderTitle from '@comp/layouts/PageHeaderTitle'
|
|
import IconImg from '@/assets/imgs/icon/icon_company_management.png'
|
|
import {
|
|
aduitCompany,
|
|
checkContactByCompany,
|
|
updateInternalEnterprise,
|
|
updatePackageEnterprise
|
|
} from '../../api/incomePaymentsApi'
|
|
import { getAction } from '../../api/manage'
|
|
import { judgeGlobalPermission } from '../../utils/hasPermission'
|
|
// 其他列,如果需要判断权限permission里加,不需要判断权限就写false
|
|
const otherColumns = [
|
|
{
|
|
permission: 'company:updateInternalEnterprise',
|
|
title: '是否是内部企业',
|
|
align: 'center',
|
|
width: 150,
|
|
dataIndex: 'internalEnterprise',
|
|
scopedSlots: { customRender: 'switch' }
|
|
},
|
|
{
|
|
permission: 'company:updatePackageEnterprise',
|
|
title: '是否为打包企业',
|
|
align: 'center',
|
|
width: 150,
|
|
dataIndex: 'packageEnterprise',
|
|
scopedSlots: { customRender: 'packageEnterprise' }
|
|
}
|
|
]
|
|
|
|
export default {
|
|
name: 'BusinessManagement',
|
|
components: { JEllipsis, BusinessManagementModule, PageHeaderTitle },
|
|
mixins: [JeroListMixin],
|
|
computed: {
|
|
importExcelUrl: function () {
|
|
return `${ window._CONFIG['domianURL'] }/${ this.url.importExcelUrl }`
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
IconImg,
|
|
labelCol: {
|
|
xs: { span: 24 },
|
|
sm: { span: 5 }
|
|
},
|
|
wrapperCol: {
|
|
xs: { span: 24 },
|
|
sm: { span: 10 }
|
|
},
|
|
columns: [
|
|
{
|
|
title: '序号',
|
|
dataIndex: '',
|
|
key: 'rowIndex',
|
|
width: 60,
|
|
align: 'center',
|
|
customRender: function (t, r, index) {
|
|
return parseInt(index) + 1
|
|
}
|
|
}, {
|
|
title: '企业名称',
|
|
align: 'center',
|
|
width: 280,
|
|
dataIndex: 'companyName',
|
|
scopedSlots: { customRender: 'text' }
|
|
}, {
|
|
title: '信用代码',
|
|
align: 'center',
|
|
width: 250,
|
|
dataIndex: 'dutyCode',
|
|
scopedSlots: { customRender: 'text' }
|
|
}, {
|
|
title: '公司地址',
|
|
align: 'center',
|
|
width: 280,
|
|
dataIndex: 'companyAddress',
|
|
scopedSlots: { customRender: 'text' }
|
|
}, {
|
|
title: '公司电话',
|
|
align: 'center',
|
|
width: 180,
|
|
dataIndex: 'companyPhone'
|
|
}, {
|
|
title: '状态',
|
|
align: 'center',
|
|
width: 100,
|
|
dataIndex: 'status_dictText'
|
|
}, {
|
|
title: '创建时间',
|
|
align: 'center',
|
|
width: 180,
|
|
dataIndex: 'createTime'
|
|
}, {
|
|
title: '银行户名',
|
|
align: 'center',
|
|
width: 300,
|
|
dataIndex: 'bankAccountName',
|
|
scopedSlots: { customRender: 'text' }
|
|
}, {
|
|
title: '操作',
|
|
dataIndex: 'action',
|
|
align: 'center',
|
|
fixed: 'right',
|
|
width: 160,
|
|
scopedSlots: { customRender: 'action' }
|
|
}
|
|
],
|
|
url: {
|
|
list: '/company/payCompanyManagement/queryCompanyPageList',
|
|
delete: '/company/payCompanyManagement/delete',
|
|
deleteBatch: '/company/payCompanyManagement/deleteBatch',
|
|
exportXlsUrl: '/company/payCompanyManagement/exportXls',
|
|
importExcelUrl: '/company/payCompanyManagement/importExcel',
|
|
downTemplateUrl: '/company/payCompanyManagement/downloadExcelModel'
|
|
}
|
|
}
|
|
},
|
|
methods: {
|
|
/**
|
|
* 审核
|
|
* @param id
|
|
*/
|
|
handleAudit(id) {
|
|
const that = this
|
|
this.$confirm({
|
|
title: '确认',
|
|
content: '确认该单位/开票信息吗?',
|
|
onOk: function () {
|
|
aduitCompany({ id: id }).then((res) => {
|
|
if (res.success) {
|
|
that.$message.success(res.result)
|
|
that.loadData()
|
|
} else {
|
|
that.$message.warning(res.message)
|
|
}
|
|
})
|
|
}
|
|
})
|
|
},
|
|
/**
|
|
* 单个删除的确认
|
|
* @param record
|
|
*/
|
|
confirmDelete(record) {
|
|
const that = this
|
|
checkContactByCompany({ id: record.id }).then((res) => {
|
|
if (res.success) {
|
|
let confirmContent = '确定要删除该企业吗?'
|
|
if (res.result && res.result.length > 0) {
|
|
confirmContent = `${ res.result.join(',').toString() }下有联系人,确定要删除该企业吗?`
|
|
}
|
|
this.$confirm({
|
|
title: '确认删除',
|
|
content: confirmContent,
|
|
onOk: function () {
|
|
getAction(that.url.delete, { id: record.id }).then((res) => {
|
|
if (res.success) {
|
|
that.$message.success(res.message)
|
|
// 判断当前删除的数据是否是最后一页的最后一条数据,如果是的话页码减一
|
|
if (that.ipagination.current > 1 && ((that.ipagination.current - 1) * that.ipagination.pageSize) + 1 === that.ipagination.total) {
|
|
that.ipagination.current -= 1
|
|
}
|
|
that.loadData()
|
|
} else {
|
|
if (res.message.indexOf('<br/>') > -1) {
|
|
that.messageLineFeed('删除失败', res.message)
|
|
} else {
|
|
that.$message.warning(res.message)
|
|
}
|
|
}
|
|
})
|
|
}
|
|
})
|
|
} else {
|
|
that.$message.warning(res.message)
|
|
}
|
|
})
|
|
},
|
|
batchDel() {
|
|
if (!this.url.deleteBatch) {
|
|
this.$message.error('请设置url.deleteBatch属性!')
|
|
return
|
|
}
|
|
if (this.selectedRowKeys.length <= 0) {
|
|
this.$message.warning('请选择一条记录!')
|
|
return
|
|
} else {
|
|
let ids = ''
|
|
for (let a = 0; a < this.selectedRowKeys.length; a++) {
|
|
ids += this.selectedRowKeys[a] + ','
|
|
}
|
|
checkContactByCompany({ id: ids }).then((res) => {
|
|
if (res.success) {
|
|
let confirmContent = '是否删除选中数据?'
|
|
if (res.result && res.result.length > 0) {
|
|
confirmContent = `${res.result.join(',').toString()}下有联系人,确定要删除选中企业吗?`
|
|
}
|
|
const that = this
|
|
this.$confirm({
|
|
title: '确认删除',
|
|
content: confirmContent,
|
|
onOk: function () {
|
|
that.loading = true
|
|
getAction(that.url.deleteBatch, { ids: ids }).then((res) => {
|
|
if (res.success) {
|
|
that.$message.success(res.message)
|
|
// 判断当前删除的数据是否是最后一页的全部数据,如果是的话页码减一
|
|
if (that.ipagination.current > 1 && (that.ipagination.current === Math.ceil(that.ipagination.total / that.ipagination.pageSize)) &&
|
|
that.selectedRowKeys.length === that.dataSource.length
|
|
) {
|
|
that.ipagination.current -= 1
|
|
}
|
|
that.loadData()
|
|
that.onClearSelected()
|
|
} else {
|
|
if (res.message.indexOf('<br/>') > -1) {
|
|
that.messageLineFeed('删除失败', res.message)
|
|
} else {
|
|
that.$message.warning(res.message)
|
|
}
|
|
}
|
|
}).finally(() => {
|
|
that.loading = false
|
|
})
|
|
}
|
|
})
|
|
} else {
|
|
this.$message.warning(res.message)
|
|
}
|
|
})
|
|
}
|
|
},
|
|
onSwitchChange(val, record) {
|
|
let params = {
|
|
id: record.id,
|
|
internalEnterprise: val
|
|
}
|
|
this.isLoading = true
|
|
updateInternalEnterprise(params).then(res => {
|
|
if(res.success) {
|
|
this.$message.success(res.message)
|
|
this.loadData()
|
|
} else {
|
|
this.$message.error(res.message)
|
|
this.isLoading = false
|
|
}
|
|
}, () => {
|
|
this.isLoading = false
|
|
})
|
|
},
|
|
// 修改是否为打包企业
|
|
onSwitchChangePackageEnterprise (val, record) {
|
|
let params = {
|
|
id: record.id,
|
|
packageEnterprise: val
|
|
}
|
|
this.isLoading = true
|
|
updatePackageEnterprise(params).then(res => {
|
|
if(res.success) {
|
|
this.$message.success(res.message)
|
|
this.loadData()
|
|
} else {
|
|
this.$message.error(res.message)
|
|
this.isLoading = false
|
|
}
|
|
}, () => {
|
|
this.isLoading = false
|
|
})
|
|
},
|
|
// 加载数据字典的方法,此处做其他数据的处理
|
|
initDictConfig() {
|
|
// 遍历其他列,如果需要权限则判断权限
|
|
otherColumns.forEach(col => {
|
|
// permission 如果是false 则不判断权限
|
|
if (col.permission === false) {
|
|
this.columns.splice(this.columns.length - 1, 0, col)
|
|
return
|
|
}
|
|
let hasPermission = judgeGlobalPermission(col.permission)
|
|
if(hasPermission) {
|
|
this.columns.splice(this.columns.length - 1, 0, col)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="less">
|
|
@import '~@assets/less/common.less';
|
|
</style>
|