Files
laws_weilai/jero-web/src/views/projectManagement/components/listOfRelevantPersonnel.vue
T
2022-10-12 12:13:36 +08:00

664 lines
22 KiB
Java

<template>
<div>
<a-drawer
:title="$t('ListOfRelevantPersonnel')"
:width="1000"
:visible="visible"
:maskClosable="false"
@close="handleCancel"
>
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :md="12" :sm="8">
<div class="box-title-text-search">
<div class="title-text-search" :title="$t('areaOfResponsibility')">
<span>{{$t('areaOfResponsibility')}}</span>
</div>
<j-dict-select-tag class="box-input-search" v-model="queryParam.dutyTerritory"
:placeholder="$t('PleaseSelect')+$t('areaOfResponsibility')"
:type="'select'"
:triggerChange="false" :dictCode="'duty_territory'"/>
</div>
</a-col>
<a-col :md="12" :sm="8">
<div class="box-title-text-search">
<div class="title-text-search" :title="$t('engineeringInterfacePerson')">
<span>{{$t('engineeringInterfacePerson')}}</span>
</div>
<PersonnelSelection class="box-input-search"
:query="{db_field_name:'engineeringInterfacePerson',db_field_txt:$t('engineeringInterfacePerson')}"
:isInput="true"
:personneQuery="queryParam"
@change="PersonnelSelectionChange"
v-model="queryParam.engineeringInterfacePersonName"/>
</div>
</a-col>
<a-col :md="12" :sm="8">
<div class="box-title-text-search">
<div class="title-text-search" :title="$t('regulatoryEngineer')">
<span>{{$t('regulatoryEngineer')}}</span>
</div>
<PersonnelSelection class="box-input-search"
:query="{db_field_name:'lawEngineer',db_field_txt:$t('regulatoryEngineer')}"
:isInput="true"
:personneQuery="queryParam"
@change="PersonnelSelectionChange"
v-model="queryParam.lawEngineerName"/>
</div>
</a-col>
<a-col :md="12" :sm="8">
<div class="box-title-text-search">
<div class="title-text-search" :title="$t('certifiedEngineer')">
<span>{{$t('certifiedEngineer')}}</span>
</div>
<a-select class="box-input-search"
v-model="queryParam.certificationEngineer"
:placeholder="$t('PleaseSelect')+$t('certifiedEngineer')">
<a-select-option v-for="(item, key) in dictOptionsValue"
:key="item.certificationEngineer"
:value="item.certificationEngineer">
<span class="itemOption" :title=" item.certificationEngineerName ">
{{ item.certificationEngineerName }}
</span>
</a-select-option>
</a-select>
</div>
</a-col>
<span style="float: right;overflow: hidden;margin-right: 11px;margin-bottom: 20px"
class="table-page-search-submitButtons">
<a-button class="box-button-search" type="primary" @click="searchQuery">{{$t('query')}}</a-button>
<a-button class="box-button-search" style="margin-left: 8px"
@click="searchReset">{{$t('reset')}}</a-button>
</span>
</a-row>
</a-form>
<div class="table-operator">
<div @click="handleModule" v-has="'projectRelatedPersonnel:exportTemplate'" class="operator-text">
<a-icon type="download"/>
{{$t('templateDownload')}}
</div>
<div @click="handleExport" v-has="'projectRelatedPersonnel:exportXls'" class="operator-text">
<a-icon type="export" :rotate="-90"/>
{{$t('export')}}
</div>
<div class="operator-text"
v-has="'projectRelatedPersonnel:importExcel'"
v-if="this.$route.query.studioEngineer == this.userInfo().id">
<ImportFile :url="url" :projectId="$route.query.id" :isTrue="true" :accept="'.xls'"
@getList="getPersonnelList"/>
</div>
<div class="operator-text"
@click="batSettingClick"
v-has="'projectRelatedPersonnel:setting'"
v-if="this.$route.query.studioEngineer == this.userInfo().id">
<a-icon type="setting"/>
{{$t('batSetting')}}
</div>
</div>
<!-- rowKey="id"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"-->
<a-table
class="table"
:columns="columns"
rowKey="id"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:pagination="false"
:scroll="{x:800,y: 500}"
:data-source="dataSource"
:loading="loading"
>
<span slot="operation" slot-scope="record">
<a class="text" v-has="'projectRelatedPersonnel:edit'" @click="edit(record)">
{{$t('edit')}}
</a>
</span>
<span slot="regulatoryEngineer">
<span :title="$t('regulatoryEngineer')">
{{$t('regulatoryEngineer')}}
</span>
</span>
<span slot="engineeringInterfacePerson" :title="$t('engineeringInterfacePerson')">
{{$t('engineeringInterfacePerson')}}
</span>
<span slot="certifiedEngineer" :title="$t('certifiedEngineer')">
{{$t('certifiedEngineer')}}
</span>
</a-table>
<!-- <div class="page">-->
<!-- <a-pagination-->
<!-- :show-total="total => $t('total')+` ${total} `+$t('strip')"-->
<!-- show-quick-jumper-->
<!-- show-size-changer-->
<!-- :page-size.sync="pageSize"-->
<!-- :total="total"-->
<!-- @change="pageOnChange"-->
<!-- @showSizeChange="SizeChange"-->
<!-- />-->
<!-- </div>-->
<div class="drawer-bootom-button">
<a-button style="margin-right: .8rem" @click="handleCancel">{{$t('cancel')}}</a-button>
<a-button @click="handleSubmit" type="primary" :loading="confirmLoading">{{$t('determine')}}</a-button>
</div>
</a-drawer>
<a-modal
:title="$t('ListOfRelevantPersonnel')"
:width="600"
:visible="editVisible"
:maskClosable="false"
@ok="editOk"
@cancel="editVisible = false"
>
<a-spin :spinning="confirmLoading">
<a-form-model :model="formInline" class="formAdd" :rules="rules" ref="ruleForm">
<a-row :gutter="24">
<a-col :span="24">
<div class="box-title-text">
<div class="title-text">
<span class="Required">*</span>
<span class="title-text-text"
:title="$t('areaOfResponsibility')">{{$t('areaOfResponsibility')}}</span>
</div>
<a-form-model-item class="itemModel-multi" prop="dutyTerritory">
<j-multi-select-tag class="box-input" v-model="formInline.dutyTerritory"
:disabled="true"
:placeholder="$t('PleaseSelect')+$t('areaOfResponsibility')"
:type="'select'"
:triggerChange="false" :dictCode="'duty_territory'"/>
</a-form-model-item>
</div>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :span="24">
<div class="box-title-text">
<div class="title-text">
<!-- <span class="Required">*</span>-->
<span class="title-text-text" :title="$t('regulatoryEngineer')">{{$t('regulatoryEngineer')}}</span>
</div>
<!-- :prop="'lawEngineerName'"-->
<a-form-model-item class="itemModel-multi">
<PersonnelSelection
v-if="editVisible"
:query="{db_field_name:'lawEngineer',db_field_txt:$t('regulatoryEngineer')}"
:personneQuery="formInline"
:isDelete='true'
@deleteData='deleteData'
@change="PersonnelSelectionChange"
v-model="formInline.lawEngineerName"/>
</a-form-model-item>
</div>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :span="24">
<div class="box-title-text">
<div class="title-text">
<!-- <span class="Required">*</span>-->
<span class="title-text-text" :title="$t('engineeringInterfacePerson')">{{$t('engineeringInterfacePerson')}}</span>
</div>
<!-- :prop="'engineeringInterfacePersonName'"-->
<a-form-model-item class="itemModel-multi">
<PersonnelSelection
v-if="editVisible"
:query="{db_field_name:'engineeringInterfacePerson',db_field_txt:$t('engineeringInterfacePerson')}"
:personneQuery="formInline"
:isDelete='true'
@deleteData='deleteData'
@change="PersonnelSelectionChange"
v-model="formInline.engineeringInterfacePersonName"/>
</a-form-model-item>
</div>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :span="24">
<div class="box-title-text">
<div class="title-text">
<!-- <span class="Required">*</span>-->
<span class="title-text-text" :title="$t('certifiedEngineer')">{{$t('certifiedEngineer')}}</span>
</div>
<!-- :prop="'certificationEngineer'"-->
<a-form-model-item class="itemModel">
<a-select allowClear
class="box-input"
v-model="formInline.certificationEngineer"
:placeholder="$t('certifiedEngineer')+$t('areaOfResponsibility')">
<a-select-option v-for="(item, key) in dictOptionsValue"
:key="item.certificationEngineer"
:value="item.certificationEngineer">
<span class="itemOption" :title=" item.certificationEngineerName ">
{{ item.certificationEngineerName }}
</span>
</a-select-option>
</a-select>
</a-form-model-item>
</div>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :span="24">
<div class="box-title-text">
<div class="title-text">
<span class="title-text-text" :title="$t('remarks')">{{$t('remarks')}}</span>
</div>
<a-form-model-item class="itemModel" prop="remark">
<a-textarea
:placeholder="$t('PleaseEnter')+$t('remarks')"
:disabled="false"
v-model="formInline.remark" :rows="4"/>
</a-form-model-item>
</div>
</a-col>
</a-row>
</a-form-model>
</a-spin>
</a-modal>
<personBatting ref="personBattingRef" @personBattingTable="personBattingTable"/>
</div>
</template>
<script>
import PersonnelSelection from '@/components/PersonnelSelection/index'
import personBatting from './personBatting'
import { getAction, postAction, downloadFile, putAction } from '@/api/manage'
import ImportFile from '@/components/ImportFile/index'
import { mapGetters } from 'vuex'
export default {
name: 'listOfRelevantPersonnel',
components: {
PersonnelSelection,
ImportFile,
personBatting
},
data() {
return {
visible: false,
queryParam: {},
columnsAll: [
{
title: this.$t('areaOfResponsibility'),
align: 'center',
dataIndex: 'dutyTerritory_dictText',
ellipsis: true
},
{
align: 'center',
dataIndex: 'lawEngineerName',
slots: { title: 'regulatoryEngineer' },
ellipsis: true
},
{
align: 'center',
slots: { title: 'engineeringInterfacePerson' },
dataIndex: 'engineeringInterfacePersonName',
ellipsis: true
},
{
align: 'center',
slots: { title: 'certifiedEngineer' },
dataIndex: 'certificationEngineerName',
ellipsis: true
},
{
title: this.$t('remarks'),
align: 'center',
dataIndex: 'remark',
ellipsis: true
},
{
title: this.$t('operation'),
align: 'center',
width: 110,
fixed: 'right',
scopedSlots: { customRender: 'operation' }
}
],
dataSource: [],
loading: false,
editVisible: false,
confirmLoading: false,
formInline: {},
rules: {
certificationEngineer: [
{
required: true,
message: this.$t('certifiedEngineer') + this.$t('cannotEmpty'),
trigger: 'change'
},
{
max: 100,
message: this.$t('certifiedEngineer') + this.$t('cannotExceed') + 100 + this.$t('Characters'),
trigger: 'change'
}
],
dutyTerritory: [
{
required: true,
message: this.$t('areaOfResponsibility') + this.$t('cannotEmpty'),
trigger: 'change'
},
{
max: 100,
message: this.$t('areaOfResponsibility') + this.$t('cannotExceed') + 100 + this.$t('Characters'),
trigger: 'change'
}
],
lawEngineerName: [
{
required: true,
message: this.$t('regulatoryEngineer') + this.$t('cannotEmpty'),
trigger: 'change'
},
{
max: 100,
message: this.$t('regulatoryEngineer') + this.$t('cannotExceed') + 100 + this.$t('Characters'),
trigger: 'change'
}
],
engineeringInterfacePersonName: [
{
required: true,
message: this.$t('engineeringInterfacePerson') + this.$t('cannotEmpty'),
trigger: 'change'
},
{
max: 100,
message: this.$t('engineeringInterfacePerson') + this.$t('cannotExceed') + 100 + this.$t('Characters'),
trigger: 'change'
}
],
remark: [
{
max: 500,
message: this.$t('remarks') + this.$t('cannotExceed') + 500 + this.$t('Characters'),
trigger: 'blur'
}
]
},
// total: 0,
// pageSize: 10,
// pageNo: 1,
url: {
page: '/project/projectRelatedPersonnel/page',
edit: '/project/projectRelatedPersonnel/edit',
exportData: '/project/projectRelatedPersonnel/exportXls',
importZipUrl: '/project/projectRelatedPersonnel/importExcel',
queryCertificationEngineer: '/project/projectRelatedPersonnel/queryCertificationEngineer'
},
selectedRowKeys: [],
dictOptionsValue: []
}
},
computed: {
columns() {
let columnResult = JSON.parse(JSON.stringify(this.columnsAll))
if (this.$route.query.studioEngineer != this.userInfo().id) {
for (var i = 0; i < columnResult.length; i++) {
if (columnResult[i].title === this.$t('operation')) {
columnResult.splice(i, 1)
i--
}
}
}
return columnResult
}
},
methods: {
...mapGetters(['userInfo']),
queryCertificationEngineer() {
getAction(this.url.queryCertificationEngineer, { projectId: this.$route.query.id }).then((res) => {
if (res.success) {
this.dictOptionsValue = res.result
} else {
this.dictOptionsValue = []
}
})
},
personBattingTable() {
this.selectedRowKeys = []
this.getList()
},
handleCancel() {
this.visible = false
},
handleSubmit() {
this.visible = false
},
batSettingClick() {
if (this.selectedRowKeys && this.selectedRowKeys.length > 0) {
let selectedRowKeys = JSON.parse(JSON.stringify(this.selectedRowKeys))
this.$refs.personBattingRef.getData(selectedRowKeys.join(','))
} else {
this.$message.warning(this.$t('selectLeastOne'))
}
},
deleteData(name) {
this.formInline[name] = ''
this.formInline = { ...this.formInline }
},
getData() {
this.visible = true
this.queryParam = {}
this.getList()
this.queryCertificationEngineer()
},
getPersonnelList() {
this.getList()
},
editOk() {
this.$refs.ruleForm.validate(valid => {
if (valid) {
if (!this.formInline.certificationEngineer) {
this.formInline.certificationEngineer = ''
}
this.confirmLoading = true
putAction(this.url.edit, this.formInline).then((res) => {
if (res.success) {
this.editVisible = false
this.$message.success(this.$t('OperationSuccessful'))
this.confirmLoading = false
this.getList()
} else {
this.$message.warning(this.$t('operationFailed'))
this.confirmLoading = false
}
})
}
})
},
edit(item) {
this.editVisible = true
this.$nextTick(() => {
this.formInline = JSON.parse(JSON.stringify(item))
if (!(this.dictOptionsValue.some(val => val.certificationEngineer == this.formInline.certificationEngineer))) {
this.formInline.certificationEngineer = undefined
}
this.$refs.ruleForm.clearValidate()
})
},
PersonnelSelectionChange(value, id) {
if (this.editVisible) {
this.formInline[value] = id
this.formInline = { ...this.formInline }
} else {
this.queryParam[value] = id
this.queryParam = { ...this.queryParam }
}
},
// pageOnChange(page, pageSize) {
// this.pageNo = page
// this.getList()
// },
// SizeChange(page, pageSize) {
// this.pageNo = 1
// this.pageSize = pageSize
// this.getList()
// },
onSelectChange(value) {
this.selectedRowKeys = value
},
searchQuery() {
this.getList()
},
searchReset() {
this.queryParam = {}
this.getList()
},
getList() {
let query = {
projectId: this.$route.query.id,
...this.queryParam
}
this.loading = true
postAction(this.url.page, query).then((res) => {
if (res.success) {
this.dataSource = res.result || []
// this.total = res.result.total
this.loading = false
} else {
this.loading = false
}
})
},
handleExport() {
let selectedRowKeys = JSON.parse(JSON.stringify(this.selectedRowKeys))
let query = {
id: selectedRowKeys.join(','),
projectId: this.$route.query.id
}
downloadFile(this.url.exportData, this.$t('ListOfRelevantPersonnel') + '.xls', query, this.Deselect)
},
Deselect() {
this.selectedRowKeys = []
},
handleModule() {
downloadFile('project/projectRelatedPersonnel/exportTemplate', this.$t('ListOfRelevantPersonnel') + '.xls', {})
}
}
}
</script>
<style>
.box-input-search .ant-select-selection--single {
height: 38px;
}
.box-input-search .ant-select-selection--multiple {
height: 38px;
}
.box-input-search .ant-select-selection__rendered {
line-height: 38px;
height: 38px;
}
</style>
<style scoped>
@import '~@assets/less/common.less';
.box-title-text {
line-height: 1.4;
display: flex;
/*align-items: center;*/
}
.title-text {
width: 114px;
text-align: right;
display: inline-block;
font-weight: 500;
font-size: 14px;
margin-right: 16px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
height: 42px;
line-height: 48px;
}
.box-input {
display: inline-block;
height: 38px;
width: 100%;
}
.itemModel {
width: calc(100% - 130px);
display: inline-block;
margin-top: 2px;
}
.Required {
color: red;
margin-right: 4px;
}
.title-text-text {
margin-top: 9px;
}
.page {
text-align: right;
margin-top: 20px;
}
.table-operator {
text-align: right;
margin-bottom: 20px;
}
.itemOption {
display: inline-block;
width: 100%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
}
.box-title-text-search {
line-height: 1.4;
display: flex;
align-items: center;
margin-bottom: 10px;
}
.title-text-search {
width: 90px;
color: #000F16;
display: inline-block;
font-weight: 500;
font-size: 14px;
margin-right: 16px;
margin-top: 3px;
text-align: right;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.box-input-search {
display: inline-block;
width: calc(100% - 100px);
height: 38px;
margin-top: 2px;
}
.box-button-search {
height: 38px;
/*margin-top: 2px;*/
}
.drawer-bootom-button {
position: absolute;
bottom: 0;
width: 100%;
z-index: 100;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
left: 0;
background: #fff;
border-radius: 0 0 2px 2px;
}
</style>