Files
laws_weilai/jero-web/src/views/parameter/escalationlibrary/index.vue
T

368 lines
9.4 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('ListTitle')">
<span>{{$t('ListTitle')}}</span>
</div>
<a-input class="box-input" :placeholder="$t('PleaseEnter')+$t('ListTitle')"
v-model="queryParam.title"></a-input>
</div>
</a-col>
<span style="float: right;overflow: hidden;margin-right: 11px" class="table-page-search-submitButtons">
<a-col :md="6" :sm="24">
<a-button class="box-button" type="primary" @click="searchQuery">{{$t('query')}}</a-button>
<a-button class="box-button" style="margin-left: 8px" @click="searchReset">{{$t('reset')}}</a-button>
</a-col>
</span>
</a-row>
</a-form>
</div>
<div>
<a-table
ref="table"
size="middle"
:loading="loading"
:pagination="false"
:scroll="{x: true}"
rowKey="id"
:data-source="dataSource"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:columns="columns"
>
<span slot="projectName" slot-scope="text,record" :title="text">
<a @click="entryNameClick(record)">
{{ text && text.length > 15 ? text.slice(0, 14) + '...' : text }}
</a>
</span>
<span slot="operation" slot-scope="text,record">
<a class="text-operation" @click="handlecody(record)">{{$t('Exporthistory')}}</a>
<a class="text-operation" @click="deleteLib(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>
<!-- 导出历史模板-->
<a-modal class="show-drawer" :title="titleTag" width="900px" v-model="drawerVisible" :footer="null">
<export-history v-if='drawerVisible' @areaVisible='drawerVisible = false' :paramsManifestId='paramsManifestId'></export-history>
</a-modal>
</a-card>
</template>
<script>
import ExportHistory from '@/components/exporthistory/index'
import { getAction, postAction, downloadFile, deleteAction } from '@/api/manage'
import axios from 'axios'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import eventBUs from '../../../common/event'
import Vue from 'vue'
export default {
name: 'index',
components: {
ExportHistory
},
data() {
return {
token: Vue.ls.get(ACCESS_TOKEN),
loading: false,
toggleSearchStatus: false,
selectedRowKeys: [],
paramsManifestId:'',
selectedRowKeysArray: '',
formInline: {},
rules: {
paramsTemplateName: [
{ required: true, message: this.$t('PleaseEnter') + this.$t('templateName'), trigger: 'change' }
]
},
visible: false,
dataSource: [],
confirmLoading: false,
url: {
list: 'params/report/page'
},
total: 0,
pageSize: 10,
pageNo: 1,
title: '新增',
columns: [
{
title: this.$t('entryName'),
align: 'center',
width: '10%',
dataIndex: 'projectName'
},
{
title: this.$t('ListTitle'),
align: 'center',
dataIndex: 'title'
},
{
title: this.$t('Version'),
align: 'center',
dataIndex: 'version'
},
{
title: this.$t('operation'),
align: 'center',
fixed: 'right',
width: 200,
scopedSlots: { customRender: 'operation' }
}
],
queryParam: {},
areaVisible: false,
paramsTemplateName: '',
drawerVisible: false,
titleTag: '导出历史'
}
},
mounted() {
this.getList()
},
methods: {
handleCancel() {
this.areaVisible = false
},
handleSubmit() {
if (this.formInline.paramsTemplateName !== undefined) {
this.formInline.paramsTemplateName = this.formInline.paramsTemplateName.trim()
}
this.$refs.ruleForm.validate(valid => {
if (valid) {
getAction(this.url.copy + `?id=${this.selectedRowKeys[0]}&paramsTemplateName=${this.formInline.paramsTemplateName}`, {}).then((res) => {
if (res.success) {
this.areaVisible = false
this.$message.success(res.message)
this.selectedRowKeys = []
this.getList()
} else {
this.$message.warning(res.message)
}
})
}
})
},
handleToggleSearch() {
this.toggleSearchStatus = !this.toggleSearchStatus
},
onSelectChange(value) {
this.selectedRowKeys = value
this.selectedRowKeysArray = this.selectedRowKeys.join(',')
},
// 导出历史
handlecody(e) {
this.drawerVisible = true
this.paramsManifestId = e.id
},
hideModal() {
this.visible = false
},
//编辑
edit(item) {
this.$refs.addModelRef.editModel(JSON.parse(JSON.stringify(item)))
},
//删除
deleteLib(val) {
let newUrl = this.$router.resolve({
path: '/managementdetails',
query: val
})
window.open(newUrl.href, '_blank')
},
//虚拟清单名称事件
entryNameClick(item) {
this.$router.push({
path: '/ParameterTemplateList',
query: item
})
},
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 }
},
getList() {
let query = {
pageNo: this.pageNo,
pageSize: this.pageSize,
...this.queryParam
}
this.loading = true
getAction(this.url.list, query).then((res) => {
if (res.success) {
if (res.result.current > 1 && res.result.records.length == 0) {
this.pageNo = res.result.current - 1
this.getList()
return
}
this.dataSource = res.result.records || []
this.total = res.result.total
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;
}
.add-input {
width: 82%;
}
.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;
z-index: 100;
width: 100%;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
left: 0;
background: #fff;
border-radius: 0 0 2px 2px;
}
.add-text-text {
margin-top: -14px;
}
</style>