Files
laws_weilai/jero-web/src/views/projectManagement/components/rxswinModel.vue
T
2023-09-01 17:30:03 +08:00

733 lines
23 KiB
Java

<template>
<div>
<a-drawer
:title="'RXSWIN'"
:width="1280"
: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('standard')">
<span>{{$t('standard')}}</span>
</div>
<a-input class="box-input-search" allowClear :placeholder="$t('PleaseEnter') + $t('standard')"
v-model="queryParam.serialNumber"></a-input>
</div>
</a-col>
<template v-if="toggleSearchStatus">
<a-col :md="12" :sm="8">
<div class="box-title-text-search">
<div class="title-text-search" :title="$t('theme')">
<span>{{$t('theme')}}</span>
</div>
<a-input class="box-input-search" allowClear :placeholder="$t('PleaseEnter') + $t('theme')"
v-model="queryParam.theme"></a-input>
</div>
</a-col>
<a-col :md="12" :sm="8">
<div class="box-title-text-search">
<div class="title-text-search" :title="'RXSWIN'">
<span>RXSWIN</span>
</div>
<a-input class="box-input-search" allowClear :placeholder="$t('PleaseEnter') + 'RXSWIN'"
v-model="queryParam.rxswin"></a-input>
</div>
</a-col>
<a-col :md="12" :sm="8">
<div class="box-title-text-search">
<div class="title-text-search" :title="$t('Correspondingversion')">
<span>{{$t('Correspondingversion')}}</span>
</div>
<a-select :placeholder="$t('PleaseSelect')+$t('Correspondingversion')"
allowClear
show-search
class="box-input-search"
optionFilterProp="label"
showSearch
:autoClearSearchValue="false"
:getPopupContainer="triggerNode=> triggerNode.parentNode"
v-model="queryParam.version">
<a-select-option v-for="(item, key) in firstLevelDutyTerritoryList"
:key="key"
:label="item"
:value="item">
<span style="display: inline-block;width: 100%" :title=" item ">
{{ item }}
</span>
</a-select-option>
</a-select>
</div>
</a-col>
</template>
<span style="float: right;overflow: hidden;margin-right: 11px;margin-bottom: 20px"
class="table-page-search-submitButtons">
<a @click="handleToggleSearch">
{{ !toggleSearchStatus ? $t('open') : $t('away') }}
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
</a>
<a-button class="box-button-search" style="margin-left: 8px"
@click="searchReset">{{$t('reset')}}</a-button>
<a-button class="box-button-search" style="margin-left: 8px" type="primary" @click="searchQuery">{{$t('query')}}</a-button>
</span>
</a-row>
</a-form>
<div class="table-operator">
<!-- 提交-->
<div v-show="staFlag != '1'" class="operator-text" @click="submit" v-has="'rxswin:submit'">
<a-icon type="check-circle"/>
{{$t('submit')}}
</div>
<!-- 新增-->
<div v-show="staFlag != '1'" class="operator-text" @click="handleAdd" v-has="'rxswin:add'">
<a-icon type="plus"/>
{{$t('newlyAdded')}}
</div>
<!-- 模板下载-->
<div v-show="staFlag != '1'" @click="handleModule" v-has="'rxswin:templatedownload'" class="operator-text">
<a-icon type="download"/>
{{$t('templateDownload')}}
</div>
<!-- 导出-->
<div @click="handleExport" v-has="'rxswin:export'" class="operator-text">
<a-icon type="export" :rotate="-90"/>
{{$t('export')}}
</div>
<!-- 导入-->
<div v-show="staFlag != '1'" class="operator-text"
v-has="'rxswin:Import'">
<ImportFile :url="url" :projectId="$route.query.id" :version="$route.query.projectVersion" :accept="'.xls'"
:isTrue="true"
@getList="getList"/>
</div>
<!-- 批量删除-->
<div v-show="staFlag != '1'" class="operator-text"
@click="batDeleteClick"
v-has="'rxswin:batchdelete'">
<a-icon type="delete"/>
{{$t('BatchDelete')}}
</div>
<!-- 调取-->
<div v-show="staFlag != '1'" @click="transferClick"
v-has="'rxswin:fetch'"
class="operator-text">
<a-icon type="profile"/>
{{$t('Transfer')}}
</div>
</div>
<!-- rowKey="id"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"-->
<a-table
class="table"
:components="drag(columns,'columns')"
:columns="columns"
rowKey="id"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
@change="tableOnChange"
:pagination="false"
:scroll="{x:800,y: 500}"
:data-source="dataSource"
:loading="loading"
>
<span slot="operation" slot-scope="record">
<a class="text" v-has="'rxswin:edit'" @click="edit(record)" v-if="staFlag != '1'">
{{$t('edit')}}
</a>
<a class="text" v-has="'rxswin:delete'" @click="del(record)" v-if="staFlag != '1'">
{{$t('delete')}}
</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>
<div class="drawer-bootom-button">
<a-button style="margin-right: 8px" @click="handleCancel">{{$t('cancel')}}</a-button>
<a-button @click="handleSubmit" type="primary" :loading="confirmLoading">{{$t('determine')}}</a-button>
</div>
</a-drawer>
<!-- 新增编辑-->
<a-modal
:title="title"
: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('standard')">{{$t('standard')}}</span>
</div>
<a-form-model-item class="itemModel" prop="serialNumber">
<Standardselection
:query="{'db_field_txt':$t('standard')}"
:standard="formInline"
@change="StandardselectionChange"
v-model="formInline.serialNumber"/>
</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" :title="$t('theme')">
<span class="Required">*</span>
<span class="title-text-text">{{$t('theme')}}</span>
</div>
<a-form-model-item class="itemModel" prop="theme">
<a-input class="box-input" :placeholder="$t('PleaseEnter') + $t('theme')"
v-model="formInline.theme" :maxLength="100"></a-input>
</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" :title="'RXSWIN'">
<span class="Required">*</span>
<span class="title-text-text">RXSWIN</span>
</div>
<a-form-model-item class="itemModel" prop="rxswin">
<a-input class="box-input" :placeholder="$t('PleaseEnter') + 'RXSWIN'"
v-model="formInline.rxswin" :maxLength="100"></a-input>
</a-form-model-item>
</div>
</a-col>
</a-row>
</a-form-model>
</a-spin>
</a-modal>
<transferList :url="url" @transferListForm="transferListForm" ref="transferListRef"/>
<transferListvirtal :url="url" @transferListFormHomo="transferListFormHomo" ref="transferListvirtalRef"/>
</div>
</template>
<script>
import PersonnelSelection from '@/components/PersonnelSelection/index'
import SelectedBy from '@/components/SelectedBy/index'
import personBatting from './personBatting'
import Standardselection from '@/components/StandardselectionRxswin/index'
import { getAction, postAction, downloadFile, putAction, deleteAction } from '@/api/manage'
import ImportFile from '@/components/ImportFile/index'
import transferList from './transferListRxswin'
import transferListvirtal from './transferListvirtalRxswin'
import { mapGetters } from 'vuex'
import { ResizeHeader, ResizeColumnProvide } from '@/mixins/header'
export default {
name: 'listOfRelevantPersonnel',
components: {
PersonnelSelection,
Standardselection,
transferList,
transferListvirtal,
ImportFile,
personBatting,
SelectedBy
},
mixins: [ResizeHeader, ResizeColumnProvide],
data() {
return {
toggleSearchStatus: false,
firstLevelDutyTerritoryList:[],
visible: false,
queryParam: {},
title:'',
selectVisible: false,
submitLoading: false,
selectLoading: false,
columns: [
{
title: this.$t('standard'),
align: 'left',
dataIndex: 'serialNumber',
ellipsis: true,
sorter:true,
width: 170
},
{
title: this.$t('theme'),
align: 'left',
dataIndex: 'theme',
ellipsis: true,
sorter:true,
width: 300
},
{
title: 'RXSWIN',
align: 'left',
dataIndex: 'rxswin',
ellipsis: true,
sorter:true,
width: 170
},
{
title: this.$t('Correspondingversion'),
align: 'left',
dataIndex: 'version',
ellipsis: true,
sorter:true,
width: 170
},
{
title: this.$t('operation'),
align: 'left',
width: 110,
scopedSlots: { customRender: 'operation' }
}
],
dataSource: [],
selectDataSource:[],
loading: false,
editVisible: false,
confirmLoading: false,
formInline: {},
rules: {
serialNumber: [
{
required: true,
message: this.$t('standard') + this.$t('cannotEmpty'),
trigger: 'blur'
},
],
theme: [
{
required: true,
message: this.$t('theme') + this.$t('cannotEmpty'),
trigger: 'blur'
},
],
rxswin: [
{
required: true,
message: 'RXSWIN' + this.$t('cannotEmpty'),
trigger: 'blur'
},
],
},
// pageSize: 10,
// pageNo: 1,
url: {
page: '/project/projectRxswinEO/page',
edit: '/project/projectRelatedPersonnel/edit',
exportData: '/project/projectRxswinEO/exportXls',
importZipUrl: '/project/projectRxswinEO/importExcel',
queryCertificationEngineer: '/project/projectRelatedPersonnel/queryCertificationEngineer'
},
selectedRowKeys: [],
dictOptionsValue: [],
administrators: false,
userIds:'',
userName:'',
orderBy: '1',
orderByField: '',
total: 0,
pageNo: 1,
pageSize: 10,
staFlag:'',
}
},
computed: {
},
methods: {
...mapGetters(['userInfo']),
getFirstLevelDutyTerritory() {
getAction('/project/projectRxswinEO/getVersionList', {projectId: this.$route.query.id}).then((res) => {
if (res.success) {
this.firstLevelDutyTerritoryList = res.result
} else {
this.firstLevelDutyTerritoryList = []
}
})
},
getData() {
this.visible = true
this.queryParam = {}
this.administrators = false
this.getFirstLevelDutyTerritory()
this.getList()
},
handleToggleSearch() {
this.toggleSearchStatus = !this.toggleSearchStatus
},
tableOnChange(pagination, filters, sorter) {
this.orderBy = sorter.order == 'ascend' ? '1' : '2'
if (sorter.columnKey == 'dutyTerritory_dictText') {
this.orderByField = 'dutyTerritory'
} else if (sorter.columnKey == 'lawEngineerName') {
this.orderByField = 'lawEngineer'
}else if (sorter.columnKey == 'engineeringInterfacePersonName') {
this.orderByField = 'engineeringInterfacePerson'
}else if (sorter.columnKey == 'engineerLawSetName') {
this.orderByField = 'engineerLawSet'
} else if (sorter.columnKey == 'engineerAttSetName') {
this.orderByField = 'engineerAttSet'
} else {
this.orderByField = sorter.columnKey
}
this.getList()
},
personBattingTable() {
this.selectedRowKeys = []
this.getList()
},
handleCancel() {
this.visible = false
},
handleSubmit() {
this.visible = false
},
submit(){
let ids = []
this.dataSource.forEach(item => {
ids.push(item.id)
})
let query = {
projectId: this.$route.query.id,
ids: ids.join(',')
}
getAction('/project/projectRxswinEO/submitInfo', query).then((res) => {
if (res.success) {
this.$message.success(this.$t('OperationSuccessful'))
this.getList()
} else {
this.$message.warning(this.$t('operationFailed'))
}
})
},
batDeleteClick() {
if (this.selectedRowKeys && this.selectedRowKeys.length > 0) {
let _this = this
this.$confirm({
content: _this.$t('ConfirmDelete'),
onOk() {
deleteAction('/project/projectRxswinEO/deleteBatch', { ids: _this.selectedRowKeys.join(',') }).then((res) => {
if (res.success) {
_this.$message.success(_this.$t('OperationSuccessful'))
_this.getList()
} else {
_this.$message.warning(res.message)
}
})
}
})
} else {
this.$message.warning(this.$t('selectLeastOne'))
}
},
deleteData(name) {
this.formInline[name] = ''
this.formInline = { ...this.formInline }
},
getPersonnelList() {
this.getList()
},
StandardselectionChange(value, id) {
this.formInline.documentId = id
this.formInline = { ...this.formInline }
},
editOk() {
this.$refs.ruleForm.validate(valid => {
if (valid) {
let url = ''
let Action = ''
if(this.title == this.$t('newlyAdded')){
url = '/project/projectRxswinEO/add'
Action = postAction
}else{
url = '/project/projectRxswinEO/edit'
Action = putAction
}
let query = {
projectId: this.$route.query.id,
...this.formInline,
version:this.$route.query.projectVersion
}
this.confirmLoading = true
Action(url, query).then((res) => {
if (res.success) {
this.editVisible = false
this.$message.success(this.$t('OperationSuccessful'))
this.confirmLoading = false
this.getList()
} else {
this.$message.warning(res.message)
this.confirmLoading = false
}
})
}
})
},
edit(item) {
this.editVisible = true
this.title = this.$t('edit')
this.$nextTick(() => {
this.formInline = JSON.parse(JSON.stringify(item))
this.$refs.ruleForm.clearValidate()
})
},
handleAdd(){
this.editVisible = true
this.title = this.$t('newlyAdded')
this.$nextTick(() => {
this.formInline = {}
this.$refs.ruleForm.clearValidate()
})
},
del(item){
let _this = this
this.$confirm({
content: _this.$t('ConfirmDelete'),
onOk() {
deleteAction('/project/projectRxswinEO/deleteBatch', { ids: item.id }).then((res) => {
if (res.success) {
_this.$message.success(_this.$t('OperationSuccessful'))
_this.getList()
} else {
_this.$message.warning(res.message)
}
})
}
})
},
onSelectChange(value) {
this.selectedRowKeys = value
},
searchQuery() {
this.getList()
},
searchReset() {
this.queryParam = {}
this.getList()
},
getList() {
let query = {
projectId: this.$route.query.id,
...this.queryParam,
orderBy: this.orderBy,
orderByField: this.orderByField,
pageNo: this.pageNo,
pageSize: this.pageSize
}
this.loading = true
getAction(this.url.page, query).then((res) => {
if (res.success) {
if (res.result.current > 1 && res.result.records.length == 0) {
this.pageNo = 1
this.getList()
return
}
this.dataSource = res.result.records || []
if(this.dataSource.length != 0 && this.dataSource[0].state == '1'){
this.staFlag = '1'
}
this.total = res.result.total
this.loading = false
} else {
this.loading = false
}
})
},
pageOnChange(page, pageSize) {
this.pageNo = page
this.getList()
},
SizeChange(page, pageSize) {
this.pageNo = 1
this.pageSize = pageSize
this.getList()
},
handleExport() {
let selectedRowKeys = JSON.parse(JSON.stringify(this.selectedRowKeys))
let long = localStorage.getItem('language')
let cut = ''
if (long && long == 'zh-cn') {
this.cut = 'cn'
} else if (long && long == 'en-us') {
this.cut = 'en'
}
let query = {
ids: selectedRowKeys.join(','),
cut:cut,
projectId: this.$route.query.id
}
downloadFile(this.url.exportData, 'RXSWIN' + '.xls', query, this.Deselect)
},
Deselect() {
this.selectedRowKeys = []
},
handleModule() {
downloadFile('project/projectRxswinEO/exportTemplate', 'RXSWIN' + '.xls', {})
},
//调取
transferClick() {
this.$refs.transferListRef.transferModel()
},
transferListForm(id) {
this.$refs.transferListvirtalRef.transferModel(id)
},
transferListFormHomo() {
this.$refs.transferListRef.handleCancel()
this.getList()
},
}
}
</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: 110px;
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;
}
/*/deep/.table .ant-table-thead > tr > th {*/
/* font-weight: bolder;*/
/*}*/
/*/deep/.table .ant-table-tbody > tr > td {*/
/* color: #040B29 ;*/
/*}*/
.table {
margin-bottom: 60px;
}
</style>