Files
laws_weilai/jero-web/src/views/projectManagement/components/listOfRelevantPersonnel.vue
T

459 lines
15 KiB
Java

<template>
<div>
<a-modal
:title="$t('ListOfRelevantPersonnel')"
:width="1000"
:visible="visible"
:maskClosable="false"
@ok="visible = false"
@cancel="visible = false"
>
<div class="table-operator">
<div @click="handleModule" class="operator-text">
<a-icon type="download"/>
{{$t('templateDownload')}}
</div>
<div @click="handleExport" class="operator-text">
<a-icon type="export" :rotate="-90"/>
{{$t('export')}}
</div>
<div class="operator-text" v-if="this.$route.query.studioEngineer == this.userInfo().id">
<ImportFile :url="url" :projectId="$route.query.id" :isTrue="true" :accept="'.xls'"
@getList="getPersonnelList"/>
</div>
</div>
<!-- rowKey="id"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"-->
<a-table
class="table"
:columns="columns"
:pagination="false"
:scroll="{x:800,y: 400}"
:data-source="dataSource"
:loading="loading"
>
<span slot="operation" slot-scope="record">
<a class="text" @click="edit(record)">
{{$t('edit')}}
</a>
</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>-->
</a-modal>
<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>
<a-form-model-item class="itemModel" :prop="'lawEngineerName'">
<PersonnelSelection
:query="{db_field_name:'lawEngineer',db_field_txt:$t('regulatoryEngineer')}"
:personneQuery="formInline"
@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>
<a-form-model-item class="itemModel" :prop="'engineeringInterfacePersonName'">
<PersonnelSelection
:query="{db_field_name:'engineeringInterfacePerson',db_field_txt:$t('engineeringInterfacePerson')}"
:personneQuery="formInline"
@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>
<a-form-model-item class="itemModel" :prop="'certificationEngineer'">
<a-select allowClear
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>
</div>
</template>
<script>
import PersonnelSelection from '@/components/PersonnelSelection/index'
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
},
data() {
return {
visible: false,
columnsAll: [
{
title: this.$t('areaOfResponsibility'),
align: 'center',
dataIndex: 'dutyTerritory_dictText',
ellipsis: true
},
{
title: this.$t('regulatoryEngineer'),
align: 'center',
dataIndex: 'lawEngineerName',
ellipsis: true
},
{
title: this.$t('engineeringInterfacePerson'),
align: 'center',
dataIndex: 'engineeringInterfacePersonName',
ellipsis: true
},
{
title: this.$t('certifiedEngineer'),
align: 'center',
dataIndex: 'certificationEngineerName',
ellipsis: true
},
{
title: this.$t('remarks'),
align: 'center',
dataIndex: 'remark',
ellipsis: true
},
{
title: this.$t('operation'),
align: 'center',
width: 100,
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 = []
}
})
},
getData() {
this.visible = true
this.getList()
this.queryCertificationEngineer()
},
getPersonnelList() {
this.getList()
},
editOk() {
this.$refs.ruleForm.validate(valid => {
if (valid) {
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))
this.$refs.ruleForm.clearValidate()
})
},
PersonnelSelectionChange(value, id) {
this.formInline[value] = id
this.formInline = { ...this.formInline }
},
// pageOnChange(page, pageSize) {
// this.pageNo = page
// this.getList()
// },
// SizeChange(page, pageSize) {
// this.pageNo = 1
// this.pageSize = pageSize
// this.getList()
// },
onSelectChange(value) {
this.selectedRowKeys = value
},
getList() {
let query = {
projectId: this.$route.query.id
}
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 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;
}
</style>