[add 功能安全中心] 基础页面

This commit is contained in:
danshihao
2024-06-19 11:22:45 +08:00
parent 1f0e17bfdb
commit 7ed658f9d8
10 changed files with 2573 additions and 3 deletions
@@ -0,0 +1,348 @@
<template>
<div>
<page-header-title :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="'draftingGroup: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="'draftingGroup:add'">新增</a-button>
<a-button type="danger" icon="delete" @click="batchDel" v-has="'draftingGroup: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}"
@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="'draftingGroup:underStudyProject'">在研项目</a>
<a @click="goFilesMaintenance(record)" v-has="'draftingGroup:fileMaintenance'">其他分发资料</a>
<a @click="goConferenceMaintenance(record)" v-has="'draftingGroup:meetingMaintenance'">项目会议</a>
<a @click="handleCopy(record.id)" v-has="'draftingGroup:copy'">复制</a>
<a @click="handleEdit(record)" v-has="'draftingGroup:edit'">基本信息维护</a>
<a @click="handleDelete(record.id)" v-has="'draftingGroup:delete'">删除</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 {copyDraftingGroup} from '@api/incomePaymentsApi'
import { getAction } from '@api/manage'
import SafetyCenterModule from '@views/functionalSafetyCenter/modules/SafetyCenterModule'
import {MeetTypeEnums} from '@/enums/commonEnums'
export default {
name: 'FunctionalSafetyCenter',
components: {SafetyCenterModule, SelectPrincipal, PageHeaderTitle },
mixins: [JeroListMixin],
data() {
return {
IconDraftingGruop,
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 10 }
},
url: {
list: '/FunctionalSafetyCenter/page',
delete: '/FunctionalSafetyCenter/delete',
deleteBatch: '/FunctionalSafetyCenter/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: 'principalName'
}, {
title: '操作',
dataIndex: 'action',
align: 'center',
fixed: 'right',
width: 500,
scopedSlots: { customRender: 'action' }
}
],
queryParam: {},
lastQueryParam: {},
operateData: [] // 进行操作权限校验时使用的数据
}
},
methods: {
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
// 判断登录用户是否为负责人B 2021-10-13:修改为后端在列表字段返回checkoutOperation字段控制,1--可操作,2--不可操作
// if (this.dataSource.length > 0) {
// for (let index = 0; index < this.dataSource.length; index++) {
// this.checkWorkingGroupPrincipal(index).then((res) => {
// res.showOperate = true
// this.$set(this.dataSource, index, res)
// })
// }
// }
})
},
/**
* 判断登录用户是否为负责人B
*/
// checkWorkingGroupPrincipal(index) {
// let item = this.dataSource[index]
// // (负责人B不可操作)
// return new Promise(resolve => {
// checkoutWorkingGroupPrincipal({ id: item.id }).then(res => {
// // 不可操作则置否
// if (res.success) {
// item.canOperate = true
// } else {
// item.canOperate = false
// }
// }).finally(() => {
// resolve(item)
// })
// })
// },
/**
* 文件维护
* @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: MeetTypeEnums.safetyCenter.value
}
})
},
/**
* 复制
* @param id
*/
handleCopy (id) {
copyDraftingGroup({ id: id }).then(res => {
if (res.success) {
this.$message.success(res.message)
} else {
this.$message.warn(res.message)
}
}).finally(() => {
this.loadData()
})
},
/**
* 成员维护
* @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
*/
sgoUnderStudyProject(record) {
this.$router.push({
path: '/functionalSafetyCenter/FunctionalSafetyUnderStudyProject',
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>