Files
laws_weilai/jero-web/src/views/projectManagement/projectLibrary/index.vue
T
2023-03-31 10:49:01 +08:00

573 lines
18 KiB
Java

<template>
<a-card :bordered="false">
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :md="6" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('entryName')">
<span>{{$t('entryName')}}</span>
</div>
<a-input class="box-input" :placeholder="$t('PleaseEnter')+$t('entryName')"
v-model="queryParam.projectName"></a-input>
</div>
</a-col>
<a-col :md="6" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('targetMarket')">
<span>{{$t('targetMarket')}}</span>
</div>
<j-dict-select-tag class="box-input" v-model="queryParam.targetMarket"
:placeholder="$t('PleaseSelect')+$t('targetMarket')"
:type="'select'"
:triggerChange="false" :dictCode="'region'"/>
</div>
</a-col>
<a-col :md="6" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('projectStatus')">
<span>{{$t('projectStatus')}}</span>
</div>
<j-dict-select-tag class="box-input" v-model="queryParam.projectStatus"
:placeholder="$t('PleaseSelect')+$t('projectStatus')"
:type="'select'"
:triggerChange="false" :dictCode="'project_status'"/>
</div>
</a-col>
<template v-if="toggleSearchStatus">
<a-col :md="6" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('StudioEngineer')">
<span>{{$t('StudioEngineer')}}</span>
</div>
<PersonnelSelection class="box-input"
:query="{db_field_name:'studioEngineer',db_field_txt:$t('StudioEngineer')}"
:isInput="true"
:personneQuery="queryParam"
@change="PersonnelSelectionChange"
v-model="queryParam.studioEngineerName"/>
</div>
</a-col>
<a-col :md="6" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('certifiedEngineer')">
<span>{{$t('certifiedEngineer')}}</span>
</div>
<PersonnelSelection
:query="{db_field_name:'certificationEngineer',db_field_txt:$t('certifiedEngineer')}"
:isInput="true"
class="box-input"
:personneQuery="queryParam"
@change="PersonnelSelectionChange"
v-model="queryParam.certificationEngineerName"/>
</div>
</a-col>
<a-col :md="6" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('ModelPlatform')">
<span>{{$t('ModelPlatform')}}</span>
</div>
<a-input class="box-input" :placeholder="$t('PleaseEnter')+$t('ModelPlatform')"
v-model="queryParam.vehiclePlatform"></a-input>
<!-- <j-dict-select-tag class="box-input" v-model="queryParam.vehiclePlatform"-->
<!-- :placeholder="$t('PleaseSelect')+$t('ModelPlatform')"-->
<!-- :type="'select'"-->
<!-- :triggerChange="false" :dictCode="'vehicle_platform'"/>-->
</div>
</a-col>
<a-col :md="6" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('DigitalPlatform')">
<span>{{$t('DigitalPlatform')}}</span>
</div>
<a-input class="box-input" :placeholder="$t('PleaseEnter')+$t('DigitalPlatform')"
v-model="queryParam.digitalPlatform"></a-input>
<!-- <j-dict-select-tag class="box-input" v-model="queryParam.digitalPlatform"-->
<!-- :placeholder="$t('PleaseSelect')+$t('DigitalPlatform')"-->
<!-- :type="'select'"-->
<!-- :triggerChange="false" :dictCode="'digital_platform'"/>-->
</div>
</a-col>
<a-col :md="6" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('brand')">
<span>{{$t('brand')}}</span>
</div>
<j-dict-select-tag class="box-input" v-model="queryParam.brand"
:placeholder="$t('PleaseSelect')+$t('brand')"
:type="'select'"
:triggerChange="false" :dictCode="'brand'"/>
</div>
</a-col>
</template>
<span style="float: right;overflow: hidden;margin-right: 11px" class="table-page-search-submitButtons">
<a-col :md="6" :sm="24">
<a @click="handleToggleSearch">
{{ !toggleSearchStatus ? $t('open') : $t('away') }}
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
</a>
<a-button class="box-button" style="margin-left: 8px" @click="searchReset">{{$t('reset')}}</a-button>
<a-button class="box-button" style="margin-left: 8px" type="primary" @click="searchQuery">{{$t('query')}}</a-button>
</a-col>
</span>
</a-row>
</a-form>
</div>
<div class="table-operator">
<div @click="handleAdd" class="operator-text" v-has="'projectLibraryBase:add'">
<a-icon type="plus"/>
{{$t('newlyAdded')}}
</div>
<!-- <div @click="handleDel" class="operator-text" v-has="'projectLibraryBase:deleteBatch'">-->
<!-- <a-icon type="delete"/>-->
<!-- {{$t('BatchDelete')}}-->
<!-- </div>-->
</div>
<div>
<a-table
ref="table"
size="middle"
:components="drag(columns,'columns')"
:loading="loading"
:pagination="false"
:scroll="{x: '100%'}"
rowKey="id"
@change="tableOnChange"
:data-source="dataSource"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:columns="columns"
>
<span slot="projectName" slot-scope="text,record">
<a @click="entryNameClick(record)" :title="text">{{text}}</a>
</span>
<span slot="operation" slot-scope="text,record">
<!-- <a class="text-operation" @click="edit(record)">{{$t('edit')}}</a>-->
<a class="text-operation"
v-if="!record.parentId"
@click="toppingClick(record)">
{{record.flag == '1'?$t('cancelTopping'):$t('Topping')}}
</a>
<a class="text-operation" @click="changeExtensionClick(record)">
{{$t('addSubproject')}}
</a>
<a class="text-operation"
v-has="'projectLibraryBase:delete'"
v-if="record.createBy == userInfoQuery.username || administrators"
@click="deleteLib(record)">{{$t('deleteLib')}}</a>
<!-- <a class="text-operation" @click="entryNameClick(record)">{{$t('see')}}</a>-->
</span>
</a-table>
</div>
<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"
:current="pageNo"
@change="pageOnChange"
@showSizeChange="SizeChange"
/>
</div>
<addModel :url="url" ref="addModelRef" @addModelList="addModelList"/>
<changeExtensionModel ref="changeExtensionModelRef" @changeExtensionForm="changeExtensionForm"/>
</a-card>
</template>
<script>
import { getAction, postAction, downloadFile, deleteAction } from '@/api/manage'
import addModel from '../components/addModel'
import changeExtensionModel from './components/changeExtensionModel'
import PersonnelSelection from '@/components/PersonnelSelection/index'
import { mapGetters } from 'vuex'
import { ResizeHeader, ResizeColumnProvide } from '@/mixins/header'
export default {
name: 'index',
components: {
addModel,
PersonnelSelection,
changeExtensionModel
},
mixins:[ResizeHeader, ResizeColumnProvide],
data() {
return {
loading: false,
toggleSearchStatus: false,
selectedRowKeys: [],
formInline: {},
rules: {},
visible: false,
dataSource: [],
confirmLoading: false,
url: {
list: 'project/projectLibraryBase/page',
add: 'project/projectLibraryBase/add',
edit: 'project/projectLibraryBase/edit',
deleteBatch: 'project/projectLibraryBase/delete',
deleteAll: 'project/projectLibraryBase/deleteBatch'
},
total: 0,
pageSize: 10,
pageNo: 1,
title: '新增',
columns: [
{
title: this.$t('entryName'),
align: 'left',
dataIndex: 'projectName',
width: 300,
sorter:true,
ellipsis: true,
scopedSlots: { customRender: 'projectName' }
},
// {
// title: this.$t('targetMarket'),
// width: 180,
// ellipsis: true,
// align: 'center',
// dataIndex: 'targetMarket_dictText'
// },
// {
// title: this.$t('projectStatus'),
// align: 'center',
// width: 180,
// ellipsis: true,
// dataIndex: 'projectStatus_dictText'
// },
{
title: this.$t('StudioEngineer'),
align: 'left',
width: 180,
sorter:true,
ellipsis: true,
dataIndex: 'studioEngineerName'
},
{
title: this.$t('brand'),
align: 'left',
width: 140,
ellipsis: true,
dataIndex: 'brandText'
},
{
title: this.$t('explain'),
align: 'left',
width: 300,
ellipsis: true,
dataIndex: 'explanation'
},
// {
// title: this.$t('certifiedEngineer'),
// align: 'center',
// width: 180,
// ellipsis: true,
// dataIndex: 'certificationEngineerName'
// },
{
title: this.$t('ModelPlatform'),
align: 'left',
width: 180,
ellipsis: true,
sorter:true,
dataIndex: 'vehiclePlatform'
},
{
title: this.$t('DigitalPlatform'),
align: 'left',
width: 205,
ellipsis: true,
sorter:true,
dataIndex: 'digitalPlatform'
},
{
title: this.$t('operation'),
align: 'left',
fixed: 'right',
width: 260,
scopedSlots: { customRender: 'operation' }
}
],
userInfoQuery: {},
queryParam: {},
orderBy: '1',
orderByField: '',
cut: '',
administrators: false
}
},
mounted() {
this.getList()
this.userInfoQuery = this.userInfo()
this.administrators = false
if (this.userInfo().userRoleList && this.userInfo().userRoleList.length > 0) {
this.userInfo().userRoleList.forEach(res => {
if (res.roleCode == 'admin') {
this.administrators = true
}
})
}
},
methods: {
...mapGetters(['userInfo']),
handleToggleSearch() {
this.toggleSearchStatus = !this.toggleSearchStatus
},
toppingClick(row) {
let flag = ''
if (row.flag == '1') {
flag = '0'
} else {
flag = '1'
}
let query = {
flag: flag,
id: row.id
}
getAction('/project/projectLibraryBase/top', query).then((res) => {
if (res.success) {
this.$message.success(this.$t('OperationSuccessful'))
this.getList()
} else {
this.$message.warning(this.$t('operationFailed'))
}
})
},
changeExtensionClick(val) {
this.$refs.changeExtensionModelRef.editModel(JSON.parse(JSON.stringify(val)))
},
changeExtensionForm() {
this.getList()
},
onSelectChange(value) {
this.selectedRowKeys = value
},
//添加
handleAdd() {
this.$refs.addModelRef.addModel()
},
//批量删除
handleDel() {
if (this.selectedRowKeys.length > 0) {
let _this = this
this.$confirm({
content: _this.$t('ConfirmBatchDeletion'),
onOk() {
let idList = JSON.parse(JSON.stringify(_this.selectedRowKeys))
deleteAction(_this.url.deleteAll, { ids: idList.join(',') }).then((res) => {
if (res.success) {
_this.$message.success(_this.$t('OperationSuccessful'))
_this.selectedRowKeys = []
_this.getList()
} else {
_this.$message.warning(_this.$t('operationFailed'))
}
})
}
})
} else {
this.$message.warning(this.$t('selectLeastOne'))
}
},
//编辑
edit(item) {
this.$refs.addModelRef.editModel(JSON.parse(JSON.stringify(item)))
},
//删除
deleteLib(val) {
let _this = this
this.$confirm({
content: _this.$t(val.children ? 'allsubitemsitem' : 'ConfirmDelete'),
onOk() {
deleteAction(_this.url.deleteBatch, { id: val.id }).then((res) => {
if (res.success) {
_this.$message.success(_this.$t('OperationSuccessful'))
_this.getList()
} else {
_this.$message.warning(res.message)
}
})
}
})
},
//虚拟清单名称事件
entryNameClick(item) {
let newUrl = this.$router.resolve({
path: '/ProjectDetails',
query: item
})
window.open(newUrl.href, '_blank')
},
searchQuery() {
this.pageNo = 1
this.getList()
},
searchReset() {
this.pageNo = 1
this.queryParam = {}
this.getList()
},
pageOnChange(page, pageSize) {
this.pageNo = page
this.getList()
},
SizeChange(page, pageSize) {
this.pageNo = 1
this.pageSize = pageSize
this.getList()
},
addModelList() {
this.pageNo = 1
this.getList()
},
PersonnelSelectionChange(value, id) {
this.queryParam[value] = id
this.queryParam = { ...this.queryParam }
},
tableOnChange(pagination, filters, sorter) {
this.orderBy = sorter.order == 'ascend' ? '1' : '2'
this.orderByField = sorter.columnKey
this.getList()
},
getList() {
let query = {
pageNo: this.pageNo,
pageSize: this.pageSize,
orderBy: this.orderBy,
orderByField: this.orderByField,
...this.queryParam
}
this.loading = true
postAction(this.url.list, query).then((res) => {
if (res.success) {
if (res.result.current > 1 && res.result.records.length == 0) {
this.pageNo = 1
this.getList()
return
}
this.total = res.result.total
this.cut = res.cut
this.dataSource = res.result.records || []
this.dataSource.forEach((item) => {
if(this.cut == 'en'){
item.brandText = item.brandTextEn
}else{
item.brandText = item.brandText
}
})
this.loading = false
} else {
this.loading = false
}
})
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
.box-title-text {
line-height: 1.4;
display: flex;
align-items: center;
margin-bottom: 10px;
}
.title-text {
width: 20%;
min-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 {
display: inline-block;
width: 70%;
height: 38px;
margin-top: 2px;
}
.box-button {
height: 38px;
/*margin-top: 2px;*/
}
.text-operation {
margin-right: 8px;
}
.page {
text-align: right;
margin-top: 20px;
}
.box-title-text-add {
line-height: 1.4;
display: flex;
}
.title-text-add {
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: 42px;
margin-top: 3px;
}
.box-input-add {
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;
}
.formAdd {
margin-bottom: 40px;
}
.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>