[add] 查看配置

This commit is contained in:
zhaomeijing
2022-05-18 17:20:58 +08:00
parent 1ce2d5aec4
commit aae12eb8d0
9 changed files with 489 additions and 48 deletions
@@ -72,17 +72,24 @@
@showSizeChange="SizeChange"
/>
</div>
<!-- 参数模板-->
<a-modal v-model="areaVisible" :title="$t('parameterTemplate')" width='750px' :footer="null">
<parameter-template v-if='areaVisible' @areaVisible='handleCancel' :templateTitle='templatetitle'
:selectedRowKeyS='selectedRowKeys' :rowId='rowId' :version='version' :projectId='this.$route.query.id'></parameter-template>
<parameter-template-add v-if='areaVisible' @areaVisible='handleCancel' :templateTitle='templatetitle'
:selectedRowKeyS='selectedRowKeys' :rowId='rowId' :version='version' :projectId='this.$route.query.id'></parameter-template-add>
</a-modal>
<!-- 配置-->
<configure ref="configureRef" :url='url' :itemId='itemId'/>
<!-- 历史版本-->
<a-modal v-model="historicalVisible" :title="$t('historicalVersion')" width='750px' :footer="null">
<historical-version v-if='historicalVisible' ></historical-version>
</a-modal>
</a-card>
</template>
<script>
import ImportFile from '@/components/ImportFile/index'
import ParameterTemplate from '../dialog/ParameterTemplate'
import ParameterTemplateAdd from '../dialog/ParameterTemplateAdd'
import HistoricalVersion from '../dialog/historicalVersion'
import { getAction,postAction } from '../../../api/manage'
import Configure from '../dialog/configure'
import axios from 'axios'
@@ -91,8 +98,9 @@
name: 'TaskParameterCollection',
components:{
ImportFile,
ParameterTemplate,
Configure
ParameterTemplateAdd,
Configure,
HistoricalVersion
},
data(){
return{
@@ -165,7 +173,8 @@
templatetitleId: '',
rowId: '',
version: 0,
itemId: ''
itemId: '',
historicalVisible: false
}
},
mounted() {
@@ -201,7 +210,8 @@
},
//
historicalVersion() {
this.historicalVisible = true
console.log('历史版本。。。。')
},
// 配置
configure(item) {
@@ -0,0 +1,265 @@
<template>
<div class='diolag-area'>
<a-table
class='table-area'
ref='table'
size='middle'
rowKey='id'
:columns='columns'
:dataSource='areaTable'
:pagination='false'
:loading='loading'
:scroll='{x: 600}'
@change='handleTableChange'>
<a slot='name' slot-scope='text'>{{ text }}</a>
<span slot='action' slot-scope='text, record'>
<a class='action-edit' @click='editArea(record.id)' v-has="'area:edit'">{{ $t('edit') }}</a>
<a style='color:red' href='javascript:;' @click=' deleteArea(record.id)'
v-has="'area:delete'">{{ $t('delete') }}</a>
</span>
</a-table>
<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>
</div>
</template>
<script>
import { putAction, postAction, getAction, deleteAction } from '@/api/manage'
export default {
name: 'diolagArea',
components: {},
data() {
return {
title: this.$t('add'),
total: 0,
selectedRowKeysDate: {},
loading: false,
editId: '',
columns: [
{
title: this.$t('VersionNumber'),
dataIndex: 'region_dictText',
key: 'showArea',
align: 'center',
ellipsis: true
},
{
title: this.$t('operation'),
align: 'center',
dataIndex: 'paramsTemplateName',
ellipsis: true
}
],
newVisible: false,
areaTable: [],
flag: false, //表单提交标识
spinLoading: false,
confirmLoading: false,
templatetitle: '',
selectedRowKeys: []
}
},
props: {
},
mounted() {
this.loadData()
},
methods: {
loadData() {
this.loading = true
let params = {
...this.form
}
getAction(`params/manifest/getParamsTemplateList`, params).then(res => {
if (res.success) {
this.areaTable = [...res.result]
this.total = res.result.total
}
}).finally(() => {
this.loading = false
})
},
searchQuery() {
this.loadData()
},
searchReset() {
this.form = {}
this.loadData()
},
handleCancel() {
this.$emit('areaVisible', false)
},
onSelectChange(selectedRowKeys, selectedRowKeysDate) {
this.selectedRowKeysDate = selectedRowKeysDate
this.selectedRowKeys = selectedRowKeys
},
handleTableChange(val) {
},
showModal() {
this.title = this.$t('add')
this.newVisible = true
this.form = {}
},
//新增
handleSubmit() {
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
// 新增編輯之前 判断 标题唯一
getAction(`params/manifest/verifyTitle?projectId=${this.$route.query.id}
&title=${this.templatetitle}`, {})
.then(res => {
if (res.success) {
let postDate = {
title: this.templatetitle,
paramsTemplateId: this.rowId || this.selectedRowKeysDate[0].id,
paramsTemplatePublishVersion: this.version || this.selectedRowKeysDate[0].version,
projectId: this.projectId
}
if (this.rowId) {
//编辑
postAction(`params/manifest/edit`, postDate).then(res => {
if (res.success) {
this.newVisible = false
this.$emit('areaVisible', false)
this.$message.success(this.$t('OperationSuccessful'))
} else {
this.$message.warning(res.message)
}
}
).finally(() => {
this.flag = false
this.spinLoading = false
this.newVisible = false
})
} else {
//新增
postAction(`params/manifest/add`, postDate).then(res => {
if (res.success) {
this.newVisible = false
this.$emit('areaVisible', false)
this.$message.success(this.$t('OperationSuccessful'))
} else {
this.$message.warning(res.message)
}
}
).finally(() => {
this.flag = false
this.spinLoading = false
this.newVisible = false
})
}
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
} else {
return false
}
})
}
},
cancelModel() {
this.newVisible = false
this.$refs.ruleForm.resetFields()
},
//删除按钮
deleteArea(val) {
this.$confirm({
title: this.$t('confirmDeletion'),
content: '',
onOk:
async () => {
getAction(`tag/onlCgformArea/delete`, { id: val }).then((res) => {
if (res.success) {
this.$message.success(this.$t('OperationSuccessful'))
if (this.areaTable.length == 1 && this.queryParams.pageNo != 1) {
this.queryParams.pageNo = this.queryParams.pageNo - 1
}
this.loadData()
} else {
// this.$message.warning(res.message)
if (res.message == '该展示区域有关联数据无法删除') {
this.$message.warning(this.$t('noDelete'))
} else {
this.$message.warning(this.$t('operationFailed'))
}
}
})
}
})
},
//编辑按钮
editArea(val) {
this.title = this.$t('edit')
this.newVisible = true
let params = {
id: val
}
getAction(`tag/onlCgformArea/queryById`, params).then((res) => {
if (res.success) {
this.form = { ...res.result }
// this.$emit('updateOk',res.result)
}
})
}
},
watch: {
templateTitle(val) {
this.templatetitle = val
},
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{
display: flex;
justify-content: center;
}
</style>
<style lang='less'>
.area-module {
.ant-modal-wrap {
.ant-modal {
.ant-modal-content {
.ant-modal-footer {
text-align: center;
}
}
}
}
}
</style>