Files
income_payments_client/src/views/functionalSafetyCenter/FunctionalSafetyCenter.vue
T

329 lines
10 KiB
Vue

<template>
<div>
<page-header-title v-if="$route.query.id" :is-level-one="false" :level-two-title="$route.query.title"></page-header-title>
<page-header-title v-else :img-for-icon="IconDraftingGruop"></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="6" :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="项目名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入项目名称" v-model="queryParam.projectName" :maxLength='50'></a-input>
</a-form-item>
</a-col>
<a-col :xxl="6" :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="负责人" :labelCol="labelCol" :wrapperCol="wrapperCol">
<select-principal placeholder="请选择负责人" v-model="queryParam.principalId"></select-principal>
</a-form-item>
</a-col>
<a-col :xl="4" :lg="7" :md="8" :sm="24">
<span class="table-page-search-submitButtons">
<a-button type="primary" icon="search" @click="searchQuery"
v-has="'safetyCenter: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="'safetyCenter:add'">新增</a-button>
<a-button type="danger" icon="delete" @click="batchDel" v-has="'safetyCenter:batchDel'">批量删除</a-button>
</div>
<!-- /操作按钮区域-end-->
<!-- table表格区域-->
<div>
<a-table
ref="table"
size="middle"
bordered
rowKey="id"
:columns="columns"
:scroll="{x: 1000}"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, getCheckboxProps: getCheckboxProps}"
@change="handleTableChange"
class="j-table-force-nowrap">
<!-- 项目名称-->
<template slot="projectName" slot-scope="text, record">
<a-tooltip>
<template slot="title">{{ text }}</template>
<div class="primary-color text-over" @click="goMemberUnitMaintenance(record)">{{ text }}</div>
</a-tooltip>
</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">
<!-- 研究组可以点击在研项目显示项目组的信息 -->
<a @click="goUnderStudyProject(record)" v-has="'safetyCenter:underStudyProject'"
v-if="record.projectType + '' === SafetyCenterProjectTypeEnums.studyGroup.value">在研项目</a>
<a @click="goFilesMaintenance(record)" v-has="'safetyCenter:fileMaintenance'">其他分发资料</a>
<a @click="goConferenceMaintenance(record)" v-has="'safetyCenter:meetingMaintenance'">项目会议</a>
<!--<a @click="handleCopy(record.id)" v-has="'safetyCenter:copy'">复制</a>-->
<a @click="handleEdit(record)" v-has="'safetyCenter:edit'">基本信息维护</a>
<a @click="handleDelete(record.id)" v-has="'safetyCenter:delete'"
v-if="record.projectType + '' === SafetyCenterProjectTypeEnums.projectGroup.value">删除</a>
</span>
</a-table>
</div>
<!-- /table表格区域-->
</a-card>
<!--新增基本信息维护-->
<safety-center-module ref="modalForm" @ok="modalFormOk"></safety-center-module>
</div>
</template>
<script>
import { JeroListMixin } from '@/mixins/JeroListMixin'
import SelectPrincipal from '@comp/company/SelectPrincipal'
import PageHeaderTitle from '@comp/layouts/PageHeaderTitle'
import IconDraftingGruop from '@/assets/imgs/icon/icon_drafting_group.png'
import { getAction } from '@api/manage'
import SafetyCenterModule from '@views/functionalSafetyCenter/modules/SafetyCenterModule'
import {MeetingTypeEnums, SafetyCenterProjectTypeEnums} from '@/enums/commonEnums'
export default {
name: 'FunctionalSafetyCenter',
components: {SafetyCenterModule, SelectPrincipal, PageHeaderTitle },
mixins: [JeroListMixin],
data() {
return {
disableMixinCreated: true,
// 混入post请求删除接口
postMethodDel: true,
SafetyCenterProjectTypeEnums,
IconDraftingGruop,
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 10 }
},
url: {
list: '/SafetyCenter/page',
delete: '/SafetyCenter/delete',
deleteBatch: '/SafetyCenter/deleteBatch'
},
columns: [
{
title: '序号',
dataIndex: '',
key: 'rowIndex',
width: 60,
align: 'center',
customRender: function (t, r, index) {
return parseInt(index) + 1
}
}, {
title: '项目名称',
align: 'center',
dataIndex: 'projectName',
scopedSlots: { customRender: 'projectName' }
}, {
title: '负责人',
align: 'center',
width: 130,
dataIndex: 'principalId_dictText'
}, {
title: '操作',
dataIndex: 'action',
align: 'center',
fixed: 'right',
width: 500,
scopedSlots: { customRender: 'action' }
}
],
queryParam: {},
lastQueryParam: {}
}
},
created () {
// 如果有id展示项目组数据接口
if (this.$route.query.id) {
this.filters.parentId = this.$route.query.id
this.url.list = '/SafetyCenter/projectGroupPage'
}
this.loadData()
},
methods: {
getCheckboxProps (record) {
return {
props: {
// 一级禁用,防止勾选删除
disabled: record.projectType + '' === SafetyCenterProjectTypeEnums.safetyCenter.value
}
}
},
loadData(arg) {
if (!this.url.list) {
this.$message.error('请设置url.list属性!')
return
}
//加载数据 若传入参数1则加载第一页的内容
if (arg === 1) {
this.ipagination.current = 1
}
var params = this.getQueryParams()//查询条件
this.loading = true
getAction(this.url.list, params).then((res) => {
if (res.success) {
//update-begin---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
this.dataSource = res.result.records || res.result
if (res.result.total) {
this.ipagination.total = res.result.total
//清空列表选中
this.onClearSelected()
} else {
this.ipagination.total = 0
}
//update-end---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
}
if (res.code === 510) {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
},
/**
* 文件维护
* @param record
*/
goFilesMaintenance(record) {
console.log(record)
this.$router.push({
path: '/projectManagement/WorkingGroupProjectDataMaintenance',
query: {
safetyCenterId: record.id,
canOperate: true
}
})
},
/**
* 会议维护
* @param record
*/
goConferenceMaintenance(record) {
this.$router.push({
path: '/functionalSafetyCenter/FunctionalSafetyConferenceMaintenance',
query: {
projectName: record.projectName,
projectId: record.id,
canOperate: true,
meetingType: MeetingTypeEnums.safetyCenter.value
}
})
},
/**
* 成员维护
* @param record
*/
goMemberUnitMaintenance(record) {
this.$router.push({
path: '/functionalSafetyCenter/FunctionalSafetyMemberUnitMaintenance',
query: {
projectName: record.projectName,
projectId: record.id,
canOperate: true
}
})
},
searchReset() {
this.lastQueryParam = {
year: new Date().getFullYear().toString()
}
this.queryParam = {
year: new Date().getFullYear().toString()
}
this.loadData(1)
},
/**
* 在研项目
* @param record
*/
goUnderStudyProject(record) {
console.log(record)
this.$router.push({
path: '/functionalSafetyCenter',
query: {
title: record.projectName,
id: record.id
}
})
},
/**
* 重写编辑
* @param record
*/
handleEdit(record) {
this.$refs.modalForm.edit(record)
this.$refs.modalForm.title = '基本信息维护'
this.$refs.modalForm.disableSubmit = false
},
// 下拉框的搜索
filterOption(input, option) {
return (
option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
)
}
}
}
</script>
<style scoped lang="less">
@import '~@assets/less/common.less';
.tooltip {
float: right;
width: auto;
display: flex;
justify-content: flex-end;
align-items: flex-end;
height: 40px;
&-item {
margin-right: 10px;
display: flex;
align-items: center;
}
&-color {
width: 13px;
height: 13px;
margin-right: 5px;
border-radius: 2px;
}
&-pay-in-full {
background: linear-gradient(0deg, #069f99 0%, #07b0a9 100%);
}
&-partial-payment {
background: linear-gradient(0deg, #0075a9 0%, #0096d8 100%);
}
&-non-payment {
background: #e8e8e8;
}
}
.text-over {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
</style>