[update] 复制
This commit is contained in:
@@ -0,0 +1,335 @@
|
||||
<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='9'>
|
||||
<a-form-model-item ref='region' :label="$t('zoneOfApplication')" prop='region'>
|
||||
<a-form-model-item class='itemModel' prop='region'>
|
||||
<j-dict-select-tag class='box-input' v-model='form.region'
|
||||
:placeholder="$t('PleaseSelect')+$t('zoneOfApplication')"
|
||||
:type="'select'"
|
||||
:triggerChange='false' :dictCode="'region'" />
|
||||
</a-form-model-item>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span='9'>
|
||||
<a-form-model-item ref='paramsTemplateName' :label="$t('parameterTemplate')" prop='paramsTemplateName'>
|
||||
<a-input
|
||||
:placeholder="$t('PleaseEnter')+$t('parameterTemplate')"
|
||||
v-model='form.paramsTemplateName' />
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span='6' style='margin-top: 4px;'>
|
||||
<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}'
|
||||
:rowSelection='{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}'
|
||||
@change='handleTableChange'>
|
||||
<span slot='click' slot-scope='text, record'>
|
||||
<a class='action-edit' @click='editArea(record.id)' v-has="'area:edit'">{{ text }}</a>
|
||||
</span>
|
||||
</a-table>
|
||||
<div class="page" style='display: flex;justify-content: flex-end;'>
|
||||
<a-pagination
|
||||
:show-total="total => $t('total')+` ${total} `+$t('strip')"
|
||||
show-quick-jumper
|
||||
show-size-changer
|
||||
:page-size.sync="pageSize"
|
||||
:total="total"
|
||||
@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>
|
||||
</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: 'diolagArea',
|
||||
components: {
|
||||
ParameterTemplate
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
token:Vue.ls.get(ACCESS_TOKEN),
|
||||
title: this.$t('add'),
|
||||
total: 0,
|
||||
selectedRowKeysDate: {},
|
||||
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: 'click' }
|
||||
}
|
||||
],
|
||||
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('enterTitle'), trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
areaTable: [],
|
||||
flag: false, //表单提交标识
|
||||
spinLoading: false,
|
||||
confirmLoading: false,
|
||||
selectedRowKeys: [],
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
listVisible: false
|
||||
}
|
||||
},
|
||||
props: {},
|
||||
mounted() {
|
||||
this.loadData()
|
||||
},
|
||||
methods: {
|
||||
editArea() {
|
||||
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
|
||||
let params = {
|
||||
pageNo: this.pageNo,
|
||||
pageSize: this.pageSize,
|
||||
...this.form
|
||||
}
|
||||
this.loading = true
|
||||
axios({
|
||||
url: `/jero-boot/params/manifest/getParamsTemplatePageOfCopy`,
|
||||
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 = {}
|
||||
this.loadData()
|
||||
},
|
||||
handleCancel() {
|
||||
this.$emit('areaVisible', false)
|
||||
},
|
||||
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() {
|
||||
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.formData.title}`, {})
|
||||
.then(res => {
|
||||
if (res.result) {
|
||||
let postDate = {
|
||||
title: this.formData.title,
|
||||
paramsTemplateId: this.paramsTemplateId || this.selectedRowKeys[0],
|
||||
paramsTemplatePublishVersion: this.version,
|
||||
projectId: this.projectId
|
||||
}
|
||||
if (this.formData.id) {
|
||||
//编辑
|
||||
postDate = {
|
||||
id : this.formData.id,
|
||||
...postDate
|
||||
}
|
||||
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(this.$t('changeTheTitle'))
|
||||
this.spinLoading = false
|
||||
}
|
||||
}).finally(() => {
|
||||
this.loading = false
|
||||
})
|
||||
} 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{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
.Required {
|
||||
color: red;
|
||||
margin-right: 4px;
|
||||
}
|
||||
</style>
|
||||
<style lang='less'>
|
||||
.area-module {
|
||||
.ant-modal-wrap {
|
||||
.ant-modal {
|
||||
.ant-modal-content {
|
||||
.ant-modal-footer {
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -51,6 +51,9 @@
|
||||
:scroll='{x: 600}'
|
||||
:rowSelection='{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}'
|
||||
@change='handleTableChange'>
|
||||
<span slot='click' slot-scope='text, record'>
|
||||
<a class='action-edit' @click='editArea(record.id)' v-has="'area:edit'">{{ text }}</a>
|
||||
</span>
|
||||
</a-table>
|
||||
<div class="page" style='display: flex;justify-content: flex-end;'>
|
||||
<a-pagination
|
||||
@@ -67,6 +70,10 @@
|
||||
<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'></parameter-template>
|
||||
</a-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -74,11 +81,14 @@
|
||||
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: 'diolagArea',
|
||||
components: {},
|
||||
components: {
|
||||
ParameterTemplate
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
token:Vue.ls.get(ACCESS_TOKEN),
|
||||
@@ -105,7 +115,8 @@ export default {
|
||||
title: this.$t('parameterTemplate'),
|
||||
align: 'center',
|
||||
dataIndex: 'paramsTemplateName',
|
||||
ellipsis: true
|
||||
ellipsis: true,
|
||||
scopedSlots: { customRender: 'click' }
|
||||
}
|
||||
],
|
||||
newVisible: false,
|
||||
@@ -130,7 +141,8 @@ export default {
|
||||
confirmLoading: false,
|
||||
selectedRowKeys: [],
|
||||
pageNo: 1,
|
||||
pageSize: 10
|
||||
pageSize: 10,
|
||||
listVisible: false
|
||||
}
|
||||
},
|
||||
props: {
|
||||
@@ -154,6 +166,9 @@ export default {
|
||||
this.loadData()
|
||||
},
|
||||
methods: {
|
||||
editArea() {
|
||||
this.listVisible = true
|
||||
},
|
||||
pageOnChange(page, pageSize) {
|
||||
this.pageNo = page
|
||||
this.loadData()
|
||||
|
||||
Reference in New Issue
Block a user