Files
laws_weilai/jero-web/src/views/projectManagement/components/TaskParameterCollection.vue
T
2023-08-31 09:25:21 +08:00

663 lines
20 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" class='add-padding'>
<a-col :md="7" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('title')">
<span>{{$t('title')}}</span>
</div>
<a-input class="box-input" :placeholder="$t('PleaseEnter')+$t('title')"
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" @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="'params:manifest:add'">
<a-icon type="plus"/>
{{$t('addDetailList')}}
</div>
<div @click="handleModule" class="operator-text" v-has="'params:manifest:change'">
<a-icon type="file-sync"/>
{{$t('changeExtension')}}
</div>
<div @click="handleCody" class="operator-text" v-has="'params:manifest:copy'">
<a-icon type="copy"/>
{{$t('copyParamDetailList')}}
</div>
<div @click="handleDel" class="operator-text" v-has="'params:manifest:deleteBatch'">
<a-icon type="delete"/>
{{$t('BatchDelete')}}
</div>
</div>
<div style="width: 100%">
<a-table
class='table-area'
ref='table'
size='middle'
rowKey='id'
:components="drag(columns,'columns')"
:columns='columns'
:dataSource='dataSource'
:pagination='false'
:loading='loading'
:scroll="{x: '100%',y:'calc(100vh - 320px)'}"
:rowSelection='{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}'
@change='handleTableChange'>
<span slot="paramsManifestClick" slot-scope="text,record">
<a class="textName" :title="text" @click="paramsManifestClick(record)">
{{ text && text.length > 50 ? text.slice(0, 49) + '...' : text }}
</a>
</span>
<span slot="collectionCompletionTime" slot-scope="text,record">
<span class="textName" :title="record.finishTime">
{{record.finishTime ? record.finishTime : '-'}}
</span>
</span>
<span slot="operation" slot-scope="text,record">
<a class="text-operation" @click="configure(record)"
:disabled="record.isHistory == '1' ? true : false"
v-has="'params:config:list'">{{$t('configure')}}</a>
<a class="text-operation" @click="edit(record)"
:disabled="record.isHistory == '1' ? true : false"
v-has="'params:manifest:edit'">{{$t('edit')}}</a>
<a class="text-operation" @click="deleteLib(record)"
:disabled="record.isHistory == '1' ? true : false"
v-has="'params:manifest:delete'">{{$t('deleteLib')}}</a>
<!-- <a class="text-operation" @click="historicalVersion(record)" v-has="'params:manifest:history'">{{$t('historicalVersion')}}</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-drawer
:visible="areaVisible"
:maskClosable="false"
@close="handleCancel"
:title="areaTitle"
width='850px'
style="height: 100%;overflow: auto;padding-bottom: 53px;"
placement="right"
:footer="null">
<parameter-template-add :url='url' ref='templateRef' v-if='areaVisible' @areaVisible='handleCancel'
:version='version'
:projectId='this.$route.query.parentId ? this.$route.query.parentId : this.$route.query.id'>
</parameter-template-add>
</a-drawer>
<!-- 配置-->
<configure ref="configureRef" :url='url' :itemId='itemId' :itemRow='itemRow'/>
<!-- 历史版本-->
<a-modal v-model="historicalVisible" :title="$t('historicalVersion')" width='750px' :footer="null">
<historical-version v-if='historicalVisible' :historicalRow='historicalRow'></historical-version>
</a-modal>
<!-- 复制参数模板-->
<a-drawer
class="show-drawer"
:maskClosable="false"
:visible="drawerVisible"
style="height: 100%;overflow: auto;padding-bottom: 53px;"
placement="right"
@close="drawerhandleCancel"
:title="$t('Copyparameterlist')"
width="850px"
:footer="null">
<project-collection-parameters v-if='drawerVisible' @areaVisible='drawerhandleCancel'
:templateTitle='templatetitle' @copysubmit='copysubmit'
:selectedRowKeyS='selectedRowKeys' :rowId='rowId' :version='version' :url='url'
:projectId='this.$route.query.parentId ? this.$route.query.parentId : this.$route.query.id'>
</project-collection-parameters>
</a-drawer>
</a-card>
</template>
<script>
import ImportFile from '@/components/ImportFile/index'
import ParameterTemplateAdd from '../dialog/ParameterTemplateAdd'
import ProjectCollectionParameters from '../dialog/ProjectCollectionParameters'
import HistoricalVersion from '../dialog/historicalVersion'
import { getAction, postAction } from '../../../api/manage'
import Configure from '../dialog/configure'
import axios from 'axios'
import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import eventBUs from '@/common/event'
import store from '@/store/'
import { ResizeHeader, ResizeColumnProvide } from '@/mixins/header'
export default {
name: 'TaskParameterCollection',
components: {
ImportFile,
ParameterTemplateAdd,
Configure,
HistoricalVersion,
ProjectCollectionParameters
},
mixins:[ResizeHeader, ResizeColumnProvide],
data() {
return {
columns: [
{
title: this.$t('title'),
align: 'left',
dataIndex: 'title',
width: 280,
scopedSlots: { customRender: 'paramsManifestClick' }
},
{
title: this.$t('status'),
align: 'left',
width: 100,
ellipsis: true,
sorter:true,
dataIndex: 'state'
},
{
title: this.$t('parameterTemplateName'),
align: 'left',
width: 200,
ellipsis: true,
dataIndex: 'paramsTemplateName'
},
{
title: this.$t('relatedProjectVersion'),
align: 'left',
width: 150,
ellipsis: true,
sorter:true,
dataIndex: 'projectVersion'
},
{
title: this.$t('collectionCompletionTime'),
align: 'left',
dataIndex: 'finishTime',
width: 200,
ellipsis: true,
sorter:true,
scopedSlots: { customRender: 'collectionCompletionTime' }
},
{
title: this.$t('Version'),
align: 'left',
width: 100,
ellipsis: true,
sorter:true,
dataIndex: 'version'
},
{
title: this.$t('creator'),
align: 'left',
width: 110,
ellipsis: true,
dataIndex: 'createBy'
},
{
title: this.$t('created'),
align: 'left',
width: 200,
ellipsis: true,
sorter:true,
dataIndex: 'createTime'
},
{
title: this.$t('operation'),
align: 'left',
fixed: 'right',
width: localStorage.getItem('language') == 'zh-cn' ? 170:210,
scopedSlots: { customRender: 'operation' }
}
],
token: Vue.ls.get(ACCESS_TOKEN),
selectedRowKeys: [],
queryParam: {},
orderBy: '1',
orderByField: '',
url: {
list: 'params/manifest/page',
add: 'params/manifest/add',
edit: 'params/manifest/edit',
queryById: 'params/manifest/queryById',
deleteBatch: 'params/manifest/delete',
deleteAll: 'params/manifest/deleteBatch',
conAdd: 'params/config/addBatch',
conList: 'params/config/list',
changeExtension: 'params/manifest/changeExtension',
verifyConfig: 'params/manifest/verifyConfig',
configurelist: 'params/manifest/getConfigFlag'
},
loading: false,
dataSource: [],
areaVisible: false, // 弹框的控制
configureareaVisible: false, // 配置的彈框
pageNo: 1,
pageSize: 10,
total: 0,
selectedRowKeysArray: '',
templatetitle: '',
templatetitleId: '',
areaTitle:'',
rowId: '',
version: 0,
itemId: '', // 配置id
itemRow: {}, // 配置一行数据
configFlag: '',
historicalVisible: false,
historicalRow: {}, // 历史版本得数据
drawerVisible: false,
drawerVisibleitem: false,
titleTag: '',
selectedRowKeysvalArray: []
}
},
created() {
if (store.getters.userInfo) {
this.$socketPublicOne.dispatch('webSocketInit')//初始化ws
}
},
watch: {
'$socketPublicOne.state.msg': {
//处理接收到的消息
handler: function(res) {
let that = this
if (res.data == '1') {
this.getlist()
}
}
}
},
mounted() {
this.getlist()
},
methods: {
paramsManifestClick(item) {
let _this = this
// 先调取接口判断是否有配置信息
if (item.isHistory == '1'){
item.projectName = this.$route.query.projectName
let newUrl = _this.$router.resolve({
path: '/ParameterItemCollection',
query: {it: item.id,
...item
}
// projectName:this.$route.query.projectName
})
window.open(newUrl.href, '_blank')
}else{
getAction(this.url.verifyConfig, { paramsManifestId: item.id }).then((res) => {
if (res.result) {
// localStorage.setItem('paramsManifest', JSON.stringify(item))
item.projectName = this.$route.query.projectName
let newUrl = _this.$router.resolve({
path: '/ParameterItemCollection',
query: item
// projectName:this.$route.query.projectName
})
window.open(newUrl.href, '_blank')
} else {
_this.$message.warning(_this.$t('NoConfigurationNotStart'))
}
})
}
},
deleteLib(val) {
if (val.state === '已完成' || val.state === 'Finished' || val.state === '未收集' || val.state === 'Uncollected') {
let _this = this
this.$confirm({
content: _this.$t('ConfirmDelete'),
onOk() {
getAction(_this.url.deleteBatch, { id: val.id }).then((res) => {
if (res.success) {
_this.$message.success(_this.$t('OperationSuccessful'))
_this.getlist()
} else {
_this.$message.warning(_this.$t('operationFailed'))
}
})
}
})
} else {
this.$message.warning(this.$t('thisbuttonCompleted'))
}
},
// 历史版本
historicalVersion(historicalRow) {
this.historicalVisible = true
this.historicalRow = historicalRow
},
// 配置
configure(item) {
this.itemId = item.id
this.itemRow = item
this.$refs.configureRef.addModel(item.id, item)
},
handleCancel(val) {
this.areaVisible = false
this.getlist()
},
// 项目收集参数
drawerhandleCancel(val) {
this.drawerVisible = false
},
copysubmit() {
this.drawerVisible = false
this.getlist()
},
searchQuery() {
this.pageNo = 1
this.getlist()
},
searchReset() {
this.queryParam = {}
this.pageNo = 1
this.getlist()
},
onSelectChange(val, valArray) {
this.selectedRowKeys = val
this.selectedRowKeysArray = val.join(',')
this.selectedRowKeysvalArray = valArray
},
edit(edit) {
this.areaVisible = true
this.areaTitle = this.$t('editDetailList')
setTimeout(() => {
this.$refs.templateRef.editData(edit,1)
}, 50)
},
handleAdd() {
this.areaTitle = this.$t('addDetailList')
this.areaVisible = true
},
// 变更扩展
handleModule() {
let _this = this
if (this.selectedRowKeys.length == 0) {
this.$message.warning(_this.$t('pleaseSelectData'))
} else if (this.selectedRowKeys.length > 1) {
this.$message.warning(_this.$t('OnlyOneSelected'))
} else if (this.selectedRowKeysvalArray[0].state === '已完成' || this.selectedRowKeysvalArray[0].state === 'Finished') {
getAction(_this.url.changeExtension, { id: this.selectedRowKeys[0] }).then((res) => {
if (res.success) {
_this.$message.success(_this.$t('OperationSuccessful'))
_this.getlist()
} else {
_this.$message.warning(res.message)
this.selectedRowKeys = []
}
})
} else {
this.$message.warning(_this.$t('thisbuttonCompleted'))
}
},
handleDel() {
// 默认为0 可全部删除
let flag = 1
this.selectedRowKeysvalArray.forEach((item) => {
if (item.state !== '已完成' && item.state !== 'Finished' && item.state !== '未收集' && item.state !== 'Uncollected') {
flag = 0
}
})
if (flag) {
let param = {
ids: this.selectedRowKeys.join(',')
}
if (this.selectedRowKeys.length > 0) {
let _this = this
this.$confirm({
content: _this.$t('ConfirmBatchDeletion'),
onOk() {
postAction(_this.url.deleteAll, param).then((res) => {
if (res.success) {
_this.$message.success(_this.$t('OperationSuccessful'))
_this.getlist()
} else {
_this.$message.warning(_this.$t('operationFailed'))
this.selectedRowKeys = []
}
})
}
})
} else {
this.$message.warning(this.$t('selectLeastOne'))
}
} else {
this.$message.warning(this.$t('thisbuttonCompleted'))
}
},
handleCody() {
this.drawerVisible = true
},
pageOnChange(page, pageSize) {
this.pageNo = page
this.getlist()
},
SizeChange(page, pageSize) {
this.pageNo = 1
this.pageSize = pageSize
this.getlist()
},
handleTableChange(pagination, filters, sorter) {
this.orderBy = sorter.order == 'ascend' ? '1' : '2'
if(sorter.columnKey == 'projectVersion'){
this.orderByField = 'project_version'
} else if(sorter.columnKey == 'finishTime') {
this.orderByField = 'finish_time'
} else if(sorter.columnKey == 'createTime') {
this.orderByField = 'create_time'
} else{
this.orderByField = sorter.columnKey
}
this.getlist()
},
getlist() {
this.selectedRowKeys = []
let query = {
projectId: this.$route.query.parentId ? this.$route.query.parentId : this.$route.query.id,
// pageSize: this.pageSize,
// pageNo: this.pageNo,
orderBy: this.orderBy,
orderByField: this.orderByField,
...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.total = res.result.total
this.dataSource = res.result.records || []
this.loading = false
} else {
this.loading = false
}
})
}
}
}
</script>
<style lang="less" scoped>
@import '~@assets/less/common.less';
/*/deep/ .ant-table td {*/
/* white-space: normal;*/
/*}*/
.doc-detail {
background: #fff;
height: 100%;
.Virtual-detail-header {
width: 100%;
height: 68px;
line-height: 68px;
padding: 0 32px 0 32px;
box-sizing: border-box;
display: flex;
justify-content: space-between;
border-bottom: 2px #eff1f3 solid;
background: #fff;
.Virtual-detail-title {
display: inline-block;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
font-size: 20px;
font-weight: 400;
color: #040B29;
line-height: 68px;
}
.doc-detail-right {
width: 800px;
line-height: 68px;
display: flex;
}
}
.Virtual-detail-content {
padding: 0 38px 0 38px;
box-sizing: border-box;
font-size: 16px;
.box-title-text-add {
line-height: 1.4;
}
.title-text-add {
display: inline-block;
font-weight: 500;
margin-right: 16px;
height: 42px;
line-height: 42px;
}
}
}
.header-text {
font-size: 16px;
font-weight: 400;
height: 60px;
color: #000F16;
line-height: 40px;
}
.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;
}
.text-operation {
margin-right: 8px;
}
.page {
text-align: right;
margin-top: 20px;
}
.operator-text-left {
font-size: 14px;
margin-right: 20px;
background: #eff1f3;
padding: 8px 8px;
cursor: pointer;
border-radius: 4px;
}
///deep/ .add-padding {
// margin-left: -89px !important;
//}
.textName {
width: 100%;
overflow: hidden;
display: -webkit-box;
text-overflow: ellipsis;
/*! autoprefixer: off */
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
/*! autoprefixer: on;*/
text-justify: inter-ideograph;
word-break: break-all
}
::v-deep .ant-table-row:first-child {
background: #fff !important;
opacity: 0.95;
}
::v-deep .ant-table-body {
background: transparent !important;
}
///deep/.ant-table-thead > tr > th {
// font-weight: bolder;
//}
///deep/.ant-table-tbody > tr > td {
// color: #040B29 ;
//}
</style>
<style>
.box-input .ant-select-selection {
height: 38px !important;
}
.box-input .ant-select-selection__rendered {
line-height: 38px;
}
</style>