533 lines
16 KiB
Java
533 lines
16 KiB
Java
<template>
|
|
<div class='diolag-area'>
|
|
<a-spin :spinning='spinLoading'>
|
|
<a-form-model
|
|
class='tag-module'
|
|
ref='ruleForm'
|
|
:model='formData'
|
|
:rules='rules'
|
|
:label-col='labelCol'
|
|
:wrapper-col='wrapperCol'
|
|
>
|
|
<a-row :gutter='24'>
|
|
<a-col :span='11'>
|
|
<div class="box-title-text">
|
|
<div class="title-text">
|
|
<span class="Required">*</span>
|
|
<span class="title-text-text" :title="$t('title')">{{$t('title')}}</span>
|
|
</div>
|
|
<a-form-model-item class="itemModel" :prop='title'>
|
|
<a-input class="box-input"
|
|
:placeholder="$t('PleaseEnter')+$t('title')"
|
|
v-model='formData.title'/>
|
|
</a-form-model-item>
|
|
</div>
|
|
</a-col>
|
|
<a-col :span='11'>
|
|
<div class="box-title-text">
|
|
<div class="title-text">
|
|
<span class="title-text-text"
|
|
:title="$t('relatedProjectVersion')">{{$t('relatedProjectVersion')}}</span>
|
|
</div>
|
|
<a-form-model-item class="itemModel" style="height: 40px">
|
|
<a-select mode="multiple"
|
|
class="box-input"
|
|
style="width: 100%"
|
|
v-model='formData.projectVersion'
|
|
:placeholder="$t('PleaseSelect')+$t('relatedProjectVersion')">
|
|
<!-- <a-select-option :value="null">{{$t('pleaseSelect')}}</a-select-option>-->
|
|
<a-select-option v-for="(item, key) in projectVersionList"
|
|
:key="key"
|
|
:label="item"
|
|
:value="item">
|
|
<span class="itemOption" :title=" item ">
|
|
{{ item }}
|
|
</span>
|
|
</a-select-option>
|
|
</a-select>
|
|
</a-form-model-item>
|
|
</div>
|
|
</a-col>
|
|
</a-row>
|
|
<a-row :gutter="24" style="border-bottom: 1px #f5f5f5 solid;margin-bottom: 10px">
|
|
<a-col :span="22">
|
|
<div class="box-title-text">
|
|
<div class="title-text">
|
|
<span class="title-text-text" :title="$t('explain')">{{$t('explain')}}</span>
|
|
</div>
|
|
<a-form-model-item class="itemModel" prop="explanation">
|
|
<a-textarea
|
|
:placeholder="$t('PleaseEnter')+$t('explain')"
|
|
v-model.trim="formData.explanation" :rows="4"/>
|
|
</a-form-model-item>
|
|
</div>
|
|
</a-col>
|
|
</a-row>
|
|
<a-row :gutter='24'>
|
|
<a-col :span='11'>
|
|
<div class="box-title-text">
|
|
<div class="title-text">
|
|
<span class="title-text-text" :title="$t('entryName')">{{$t('entryName')}}</span>
|
|
</div>
|
|
<a-form-model-item class="itemModel">
|
|
<a-input class="box-input"
|
|
:placeholder="$t('PleaseEnter')+$t('entryName')"
|
|
v-model='formData.projectName'/>
|
|
</a-form-model-item>
|
|
</div>
|
|
</a-col>
|
|
<!-- <a-col :span='8'>-->
|
|
<!-- <a-form-model-item :label="$t('entryName')" prop='projectName'>-->
|
|
<!-- <a-input style='width: 420px'-->
|
|
<!-- :placeholder="$t('PleaseEnter')+$t('entryName')"-->
|
|
<!-- v-model='formData.projectName'/>-->
|
|
<!-- </a-form-model-item>-->
|
|
<!-- </a-col>-->
|
|
<a-col :span='11' style="margin-top: 5px">
|
|
<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>
|
|
</a-row>
|
|
</a-form-model>
|
|
</a-spin>
|
|
<a-table
|
|
class='table-area'
|
|
ref='table'
|
|
size='middle'
|
|
rowKey='id'
|
|
:columns='columns'
|
|
:dataSource='areaTable'
|
|
:pagination='false'
|
|
:loading='loading'
|
|
:scroll='{x: 600,y:400}'
|
|
:rowSelection='{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}'
|
|
@change='handleTableChange'>
|
|
<span slot='click' slot-scope='text, record'>
|
|
|
|
</span>
|
|
|
|
<span slot="parameterTemplateSlot" slot-scope="text,record">
|
|
<a class='action-edit' @click='parameterTemplateSlotHandler(record)'>{{ text }}</a>
|
|
</span>
|
|
|
|
</a-table>
|
|
<div class="page" style='display: flex;justify-content: flex-end;margin-bottom: 43px'>
|
|
<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>
|
|
<div class='drawer-bootom-button'>
|
|
<a-button style='margin-right: .8rem' @click='handleCancel'>{{ $t('cancel') }}</a-button>
|
|
<a-button @click='handleSubmit' type='primary' :loading='confirmLoading'>{{ $t('submit') }}</a-button>
|
|
</div>
|
|
<!-- 清单弹框 -->
|
|
<a-modal v-model="listVisible" :title="$t('parameterTemplate')" width='700px' :footer="null">
|
|
<parameter-template v-if='listVisible' @areaVisible='drawerhandleCancel'
|
|
@listVisibleRow='listVisibleRow'></parameter-template>
|
|
</a-modal>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { putAction, postAction, getAction, deleteAction } from '@/api/manage'
|
|
import axios from 'axios'
|
|
import Vue from 'vue'
|
|
import ParameterTemplate from '../dialog/ParameterTemplate'
|
|
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
|
|
|
export default {
|
|
name: 'ProjectCollectionParameters',
|
|
components: {
|
|
ParameterTemplate
|
|
},
|
|
data() {
|
|
return {
|
|
token: Vue.ls.get(ACCESS_TOKEN),
|
|
title: this.$t('add'),
|
|
total: 0,
|
|
selectedRowKeysDate: {},
|
|
projectVersionList: [],
|
|
loading: false,
|
|
editId: '',
|
|
columns: [
|
|
{
|
|
title: this.$t('entryName'),
|
|
dataIndex: 'projectName',
|
|
key: 'showArea',
|
|
align: 'center',
|
|
ellipsis: true
|
|
},
|
|
{
|
|
title: this.$t('ListTitle'),
|
|
align: 'center',
|
|
dataIndex: 'title',
|
|
ellipsis: true
|
|
},
|
|
{
|
|
title: this.$t('parameterTemplate'),
|
|
align: 'center',
|
|
dataIndex: 'paramsTemplateName',
|
|
ellipsis: true,
|
|
scopedSlots: { customRender: 'parameterTemplateSlot' }
|
|
}
|
|
],
|
|
newVisible: false,
|
|
labelCol: {
|
|
xs: { span: 24 },
|
|
sm: { span: 7 }
|
|
},
|
|
wrapperCol: {
|
|
xs: { span: 24 },
|
|
sm: { span: 14 }
|
|
},
|
|
form: {},
|
|
formData: {},
|
|
rules: {
|
|
title: [
|
|
{ required: true, message: this.$t('PleaseEnter') + this.$t('title'), trigger: 'blur' }
|
|
]
|
|
},
|
|
areaTable: [],
|
|
flag: false, //表单提交标识
|
|
spinLoading: false,
|
|
confirmLoading: false,
|
|
selectedRowKeys: [],
|
|
pageNo: 1,
|
|
pageSize: 10,
|
|
listVisible: false,
|
|
listVisibleRowDate: {}
|
|
}
|
|
},
|
|
props: {
|
|
version: {
|
|
type: Number,
|
|
default: '',
|
|
required: false
|
|
},
|
|
projectId: {
|
|
type: String,
|
|
default: '',
|
|
require: true
|
|
},
|
|
url: {
|
|
type: Object,
|
|
default: '',
|
|
require: true
|
|
}
|
|
},
|
|
mounted() {
|
|
this.loadData()
|
|
this.getProjectVersion()
|
|
},
|
|
methods: {
|
|
getProjectVersion() {
|
|
let query = {
|
|
id: this.projectId
|
|
}
|
|
getAction('/project/projectLibraryBase/getVersionsInfo', query).then((res) => {
|
|
if (res.success) {
|
|
this.projectVersionList = res.result || []
|
|
} else {
|
|
this.projectVersionList = []
|
|
}
|
|
})
|
|
},
|
|
// 清单列表传出数据
|
|
listVisibleRow(val) {
|
|
// this.selectedRowKeys = []
|
|
let newAreaTable = JSON.parse(JSON.stringify(this.areaTable))
|
|
newAreaTable.forEach((item, index) => {
|
|
if (item.id == this.listVisibleRowDate.id) {
|
|
let _obj = { ...item }
|
|
_obj.paramsTemplateId = val[0].id
|
|
_obj.paramsTemplateName = val[0].paramsTemplateName
|
|
this.areaTable.splice(index, 1, _obj)
|
|
}
|
|
})
|
|
console.log(this.areaTable, 'this.areaTable')
|
|
this.listVisible = false
|
|
},
|
|
parameterTemplateSlotHandler(val) {
|
|
this.listVisibleRowDate = val
|
|
console.log(val)
|
|
this.listVisible = true
|
|
},
|
|
pageOnChange(page, pageSize) {
|
|
this.pageNo = page
|
|
this.loadData()
|
|
},
|
|
SizeChange(page, pageSize) {
|
|
this.pageNo = 1
|
|
this.pageSize = pageSize
|
|
this.loadData()
|
|
},
|
|
loadData() {
|
|
let _this = this
|
|
if (!this.formData.projectName){
|
|
this.formData.projectName = ''
|
|
}
|
|
let params = {
|
|
pageNo: this.pageNo,
|
|
pageSize: this.pageSize,
|
|
projectName:this.formData.projectName
|
|
}
|
|
this.loading = true
|
|
axios({
|
|
url: `/jero-boot/params/manifest/getAllManifest`,
|
|
method: 'post',
|
|
data: params,
|
|
transformRequest: [function(data) {
|
|
let ret = ''
|
|
for (let it in data) {
|
|
ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
|
|
}
|
|
return ret
|
|
}],
|
|
headers: {
|
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
'X-Access-Token': _this.token
|
|
}
|
|
})
|
|
.then((res) => {
|
|
if (res.data.success) {
|
|
console.log(res.data)
|
|
this.loading = false
|
|
this.areaTable = res.data.result.records || []
|
|
this.total = res.data.result.total
|
|
} else {
|
|
this.loading = false
|
|
}
|
|
})
|
|
.catch((error) => {
|
|
console.log(error)
|
|
})
|
|
},
|
|
searchQuery() {
|
|
this.loadData()
|
|
},
|
|
searchReset() {
|
|
this.formData.projectName = ''
|
|
this.formData = {...this.formData}
|
|
this.loadData()
|
|
},
|
|
handleCancel() {
|
|
this.$emit('areaVisible', false)
|
|
},
|
|
drawerhandleCancel(val) {
|
|
this.listVisible = val
|
|
},
|
|
onSelectChange(selectedRowKeys, selectedRowKeysDate) {
|
|
this.selectedRowKeysDate = selectedRowKeysDate
|
|
this.selectedRowKeys = selectedRowKeys
|
|
},
|
|
handleTableChange(val) {
|
|
console.log(',,,')
|
|
},
|
|
showModal() {
|
|
this.title = this.$t('add')
|
|
this.newVisible = true
|
|
this.form = {}
|
|
},
|
|
//新增
|
|
handleSubmit() {
|
|
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 {
|
|
this.$refs.ruleForm.validate(valid => {
|
|
if (valid) {
|
|
this.flag = true
|
|
this.spinLoading = true
|
|
this.confirmLoading = true
|
|
let formData = JSON.parse(JSON.stringify(this.formData))
|
|
Object.keys(formData).forEach(res => {
|
|
if (formData[res] && formData[res] instanceof Array) {
|
|
formData[res] = formData[res].join(',')
|
|
}
|
|
})
|
|
let _tt = {
|
|
paramsTemplateId: this.selectedRowKeysDate[0].paramsTemplateId,
|
|
projectId: this.projectId,
|
|
title: formData.title,
|
|
projectVersion: formData.projectVersion,
|
|
explanation: formData.explanation,
|
|
paramsTemplatePublishVersion: this.selectedRowKeysDate[0].paramsTemplatePublishVersion,
|
|
sourceManifestId: this.selectedRowKeysDate[0].id
|
|
}
|
|
postAction('params/manifest/copy', _tt).then((res) => {
|
|
if (res.success) {
|
|
this.$emit('copysubmit')
|
|
this.$message.success(this.$t('Copysuccessful'))
|
|
this.flag = false
|
|
this.spinLoading = false
|
|
this.confirmLoading = false
|
|
} else {
|
|
this.$message.warning(this.$t('Copyfailed'))
|
|
this.flag = false
|
|
this.spinLoading = false
|
|
this.confirmLoading = false
|
|
}
|
|
})
|
|
// axios({
|
|
// url: `/jero-boot/params/manifest/copy`,
|
|
// method: 'post',
|
|
// data: _tt,
|
|
// transformRequest: [function (data) {
|
|
// let ret = ''
|
|
// for (let it in data) {
|
|
// ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
|
|
// }
|
|
// return ret
|
|
// }],
|
|
// headers: {
|
|
// 'Content-Type': 'application/x-www-form-urlencoded',
|
|
// 'X-Access-Token':_this.token
|
|
// }
|
|
// })
|
|
// .then( (res) =>{
|
|
// if (res.data.success) {
|
|
// _this.$emit('copysubmit')
|
|
// _this.$message.success(res.data.message)
|
|
// _this.flag = false
|
|
// _this.spinLoading = false
|
|
// _this.confirmLoading = false
|
|
// }else{
|
|
// _this.$message.warning(res.data.message)
|
|
// _this.flag = false
|
|
// _this.spinLoading = false
|
|
// _this.confirmLoading = false
|
|
// }
|
|
// })
|
|
// .catch( (error) =>{
|
|
// console.log(error);
|
|
// });
|
|
} else {
|
|
return false
|
|
}
|
|
})
|
|
}
|
|
}
|
|
},
|
|
watch: {
|
|
selectedRowKeyS(val) {
|
|
this.selectedRowKeys = val
|
|
}
|
|
}
|
|
|
|
}
|
|
</script>
|
|
|
|
<style lang='less' scoped>
|
|
@import '~@assets/less/common.less';
|
|
|
|
.diolag-area {
|
|
.table-area {
|
|
margin: 20px 0;
|
|
|
|
.action-edit {
|
|
margin-right: 10px;
|
|
}
|
|
}
|
|
|
|
.table-del {
|
|
color: red;
|
|
}
|
|
}
|
|
|
|
.drawer-bootom-button {
|
|
position: absolute;
|
|
bottom: 0;
|
|
width: 100%;
|
|
border-top: 1px solid #e8e8e8;
|
|
padding: 10px 16px;
|
|
text-align: right;
|
|
left: 0;
|
|
z-index: 100;
|
|
background: #fff;
|
|
border-radius: 0 0 2px 2px;
|
|
}
|
|
|
|
.Required {
|
|
color: red;
|
|
margin-right: 4px;
|
|
}
|
|
|
|
.Required {
|
|
color: red;
|
|
margin-right: 4px;
|
|
}
|
|
|
|
.box-title-text {
|
|
line-height: 1.4;
|
|
display: flex;
|
|
/*align-items: center;*/
|
|
}
|
|
|
|
.title-text {
|
|
width: 84px;
|
|
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;
|
|
}
|
|
|
|
.box-input {
|
|
display: inline-block;
|
|
height: 38px;
|
|
width: 100%;
|
|
}
|
|
|
|
.itemModel {
|
|
width: calc(100% - 100px);
|
|
display: inline-block;
|
|
margin-top: 2px;
|
|
/*height: 40px;*/
|
|
margin-bottom: 24px;
|
|
}
|
|
|
|
.itemModel-text {
|
|
width: calc(100% - 130px);
|
|
display: inline-block;
|
|
margin-top: 2px;
|
|
}
|
|
|
|
.Required {
|
|
color: red;
|
|
margin-right: 4px;
|
|
}
|
|
|
|
.title-text-text {
|
|
margin-top: 9px;
|
|
}
|
|
.box-button{
|
|
height: 38px;
|
|
}
|
|
</style>
|
|
<style lang='less'>
|
|
.area-module {
|
|
.ant-modal-wrap {
|
|
.ant-modal {
|
|
.ant-modal-content {
|
|
.ant-modal-footer {
|
|
text-align: center;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style> |