Files
income_payments_client/src/views/projectManagement/WorkingGroupProjectDataMaintenance.vue
T

241 lines
8.3 KiB
Vue

<template>
<div>
<page-header-title level-two-title="分发资料维护" :is-level-one="false"></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 :xxl="4" :xl="10" :lg="12" :md="12" :sm="24">
<a-form-item label="文件名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入文件名称" v-model="queryParam.fileName" :maxLength='50'></a-input>
</a-form-item>
</a-col>
<span class="table-page-search-submitButtons">
<a-button type="primary" icon="search" @click="searchQuery" v-has="'fileMaintenance:search'">查询</a-button>
<a-button icon="reload" @click="searchReset" class="reset-button">重置</a-button>
</span>
</a-row>
</a-form>
</div>
<!-- /查询区域-end-->
<!-- 操作按钮区域-->
<div class="table-operator" v-if="canOperate">
<a-button type="primary" icon="plus" @click="handleAdd" v-has="'fileMaintenance:add'">上传</a-button>
<a-button type="danger" icon="delete" @click="batchDel" v-has="'fileMaintenance:batchDel'">批量删除</a-button>
<a-button type="primary" @click="batchDistribute" v-has="'fileMaintenance:batchDistribute'">批量分发</a-button>
<a-button type="primary" icon="export" @click="handleExportXls('资料维护列表')" v-has="'fileMaintenance:export'">导出
</a-button>
</div>
<!-- 操作按钮区域-end-->
<!-- table表格区域-->
<div>
<a-table
size="middle"
ref="table"
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:scroll="{x: 1200}"
@change="handleTableChange"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
class="j-table-force-nowrap main-table">
<!-- 项目名称-->
<template slot="projectName" slot-scope="text, record">
<j-ellipsis :value="text" :length="18" class="primary-color"
@click="openDetailModal(record)"></j-ellipsis>
</template>
<template slot="text" slot-scope="text">
<j-ellipsis :value="text" :length="20"></j-ellipsis>
</template>
<span slot="action" class="action-span-cell" slot-scope="text, record" v-if="canOperate">
<a @click="handleDistribute(record.id)" v-has="'fileMaintenance:distribute'">分发</a>
<a @click="handleDownload(record)" v-has="'fileMaintenance:download'">下载</a>
<a @click="handleDelete(record.id)" v-has="'fileMaintenance:delete'">删除</a>
</span>
</a-table>
</div>
</a-card>
<!-- 上传-->
<work-group-file-upload-modal
ref="modalForm"
@ok="modalFormOk"
:project-id="projectId"
:project-type="projectType"></work-group-file-upload-modal>
<!-- 分发-->
<work-group-distribute-module
ref="distributeModal"
:visible.sync="distributeModalVisible"
:project-id="projectId"
:project-type="projectType"
:is-batch="isBatchDistribute"
:record-id="dataId"
@ok="modalFormOk"></work-group-distribute-module>
</div>
</template>
<script>
import { JeroListMixin } from '../../mixins/JeroListMixin'
import PageHeaderTitle from '../../components/layouts/PageHeaderTitle'
import WorkGroupFileUploadModal from './modules/WorkGroupFileUploadModal'
import WorkGroupDistributeModule from './modules/WorkGroupDistributeModule'
import { downloadFile } from '../../api/manage'
export default {
name: 'WorkingGroupProjectDataMaintenance',
components: { PageHeaderTitle, WorkGroupFileUploadModal, WorkGroupDistributeModule },
mixins: [JeroListMixin],
data() {
return {
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 10 }
},
url: {
list: '/project/payWorkingGroupDataFile/list',
exportXlsUrl: '/project/payWorkingGroupDataFile/exportXls',
delete: '/project/payWorkingGroupDataFile/delete',
deleteBatch: '/project/payWorkingGroupDataFile/deleteBatch'
},
columns: [
{
title: '序号',
dataIndex: '',
key: 'rowIndex',
width: 100,
align: 'center',
customRender: function (t, r, index) {
return parseInt(index) + 1
}
}, {
title: '文件名称',
align: 'center',
dataIndex: 'fileName',
scopedSlots: { customRender: 'text' }
}, {
title: '下载次数',
align: 'center',
width: 160,
dataIndex: 'downloadCount',
scopedSlots: { customRender: 'text' }
}, {
title: '上传时间',
align: 'center',
width: 220,
dataIndex: 'createTime',
scopedSlots: { customRender: 'text' }
}, {
title: '上传人',
align: 'center',
width: 160,
dataIndex: 'createBy',
scopedSlots: { customRender: 'text' }
}, {
title: '操作',
dataIndex: 'action',
align: 'center',
fixed: 'right',
width: 160,
scopedSlots: { customRender: 'action' }
}
],
disableMixinCreated: true,
projectId: null, // 项目id
projectType: null, // 1--工作组;2--分标委;4--起草组
distributeModalVisible: false,
isBatchDistribute: false,
dataId: '', // 资料id,传给分发
canOperate: true // 是否可操作(负责人B不可操作)
}
},
created() {
// 工作组
if (this.$route.query.hasOwnProperty.call(this.$route.query, 'workingGroupId')) {
this.filters.projectId = this.$route.query.workingGroupId
this.canOperate = this.$route.query.canOperate === 'true'
this.projectType = 1
this.filters.projectType = 1
} else if (this.$route.query.hasOwnProperty.call(this.$route.query, 'id')) {
// 分标委
this.filters.projectId = this.$route.query.id
this.projectType = 2
this.filters.projectType = 2
} else if (this.$route.query.hasOwnProperty.call(this.$route.query, 'councilId')) {
// 理事会
this.filters.projectId = this.$route.query.councilId
this.projectType = 3
this.filters.projectType = 3
} else if (this.$route.query.hasOwnProperty.call(this.$route.query, 'draftingGroupId')) {
// 起草组
this.filters.projectId = this.$route.query.draftingGroupId
this.canOperate = this.$route.query.canOperate === 'true'
this.projectType = 4
this.filters.projectType = 4
}
this.projectId = this.filters.projectId
this.loadData()
},
methods: {
/**
* 批量分发
*/
batchDistribute() {
if (this.selectedRowKeys.length === 0) {
this.$message.warn('请至少选中一个资料')
return
}
this.dataId = this.selectedRowKeys.join(',')
this.distributeModalVisible = true
this.isBatchDistribute = true
},
/**
* 分发
*/
handleDistribute(id) {
this.dataId = id
this.distributeModalVisible = true
this.isBatchDistribute = false
},
/**
* 下载
* @param record
*/
handleDownload(record) {
downloadFile(`sys/common/download/${record.fileId}`, record.fileName)
},
handleExportXls(fileName) {
if (!fileName || typeof fileName != 'string') {
fileName = '导出文件'
}
let param = this.getQueryParams()
if (this.selectedRowKeys && this.selectedRowKeys.length > 0) {
param['selections'] = this.selectedRowKeys.join(',')
}
console.log('导出参数', param)
downloadFile(this.url.exportXlsUrl, fileName + '.zip', param)
},
handleAdd() {
this.$refs.modalForm.add()
this.$refs.modalForm.title = '上传文件'
this.$refs.modalForm.disableSubmit = false
}
}
}
</script>
<style scoped lang="less">
@import '~@assets/less/common.less';
</style>