|
|
|
@ -59,6 +59,7 @@
|
|
|
|
|
<a-button
|
|
|
|
|
type="primary"
|
|
|
|
|
icon="plus"
|
|
|
|
|
@click="()=>this.formVisible=true"
|
|
|
|
|
>新增</a-button>
|
|
|
|
|
</div>
|
|
|
|
|
<div style="margin-top:15px">
|
|
|
|
@ -115,13 +116,18 @@
|
|
|
|
|
</span>
|
|
|
|
|
<span
|
|
|
|
|
slot="action"
|
|
|
|
|
slot-scope="text, record"
|
|
|
|
|
>
|
|
|
|
|
<a href="javascript:void(0);">编辑</a>
|
|
|
|
|
<a
|
|
|
|
|
href="javascript:void(0);"
|
|
|
|
|
@click="handleEditOption(record)"
|
|
|
|
|
>编辑</a>
|
|
|
|
|
<a-divider type="vertical" />
|
|
|
|
|
<a-popconfirm
|
|
|
|
|
:title="'你确定要永久删除该变量?'"
|
|
|
|
|
okText="确定"
|
|
|
|
|
cancelText="取消"
|
|
|
|
|
@confirm="handleDeleteOption(record.id)"
|
|
|
|
|
>
|
|
|
|
|
<a href="javascript:;">删除</a>
|
|
|
|
|
</a-popconfirm>
|
|
|
|
@ -141,10 +147,38 @@
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</a-card>
|
|
|
|
|
<a-modal
|
|
|
|
|
v-model="formVisible"
|
|
|
|
|
:title="formTitle"
|
|
|
|
|
:afterClose="onFormClose"
|
|
|
|
|
>
|
|
|
|
|
<template slot="footer">
|
|
|
|
|
<a-button
|
|
|
|
|
key="submit"
|
|
|
|
|
type="primary"
|
|
|
|
|
@click="createOrUpdateOption()"
|
|
|
|
|
>保存</a-button>
|
|
|
|
|
</template>
|
|
|
|
|
<a-alert
|
|
|
|
|
v-if="optionToStage.type === optionType.INTERNAL.value"
|
|
|
|
|
message="注意:在不知道系统变量的具体用途时,请不要随意修改!"
|
|
|
|
|
banner
|
|
|
|
|
closable
|
|
|
|
|
/>
|
|
|
|
|
<a-form layout="vertical">
|
|
|
|
|
<a-form-item label="Key:">
|
|
|
|
|
<a-input v-model="optionToStage.key" />
|
|
|
|
|
</a-form-item>
|
|
|
|
|
<a-form-item label="Value:">
|
|
|
|
|
<a-input v-model="optionToStage.value" />
|
|
|
|
|
</a-form-item>
|
|
|
|
|
</a-form>
|
|
|
|
|
</a-modal>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
|
|
|
|
import optionApi from '@/api/option'
|
|
|
|
|
import { mapActions } from 'vuex'
|
|
|
|
|
const columns = [
|
|
|
|
|
{
|
|
|
|
|
title: 'Key',
|
|
|
|
@ -187,6 +221,7 @@ export default {
|
|
|
|
|
return {
|
|
|
|
|
optionType: optionApi.type,
|
|
|
|
|
columns: columns,
|
|
|
|
|
formVisible: false,
|
|
|
|
|
pagination: {
|
|
|
|
|
page: 1,
|
|
|
|
|
size: 10,
|
|
|
|
@ -199,6 +234,7 @@ export default {
|
|
|
|
|
keyword: null,
|
|
|
|
|
status: null
|
|
|
|
|
},
|
|
|
|
|
optionToStage: {},
|
|
|
|
|
loading: false,
|
|
|
|
|
options: []
|
|
|
|
|
}
|
|
|
|
@ -209,13 +245,17 @@ export default {
|
|
|
|
|
option.typeProperty = this.optionType[option.type]
|
|
|
|
|
return option
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
formTitle() {
|
|
|
|
|
return this.optionToStage.id ? '编辑' : '新增'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.loadOptions()
|
|
|
|
|
this.loadOptionsList()
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
loadOptions() {
|
|
|
|
|
...mapActions(['loadOptions']),
|
|
|
|
|
loadOptionsList() {
|
|
|
|
|
this.loading = true
|
|
|
|
|
this.queryParam.page = this.pagination.page - 1
|
|
|
|
|
this.queryParam.size = this.pagination.size
|
|
|
|
@ -229,16 +269,64 @@ export default {
|
|
|
|
|
handleQuery() {
|
|
|
|
|
this.handlePaginationChange(1, this.pagination.size)
|
|
|
|
|
},
|
|
|
|
|
handleDeleteOption(id) {
|
|
|
|
|
optionApi.delete(id).then(response => {
|
|
|
|
|
this.$message.success('删除成功!')
|
|
|
|
|
this.loadOptionsList()
|
|
|
|
|
this.loadOptions()
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
handleEditOption(option) {
|
|
|
|
|
this.optionToStage = option
|
|
|
|
|
this.formVisible = true
|
|
|
|
|
},
|
|
|
|
|
handlePaginationChange(page, pageSize) {
|
|
|
|
|
this.$log.debug(`Current: ${page}, PageSize: ${pageSize}`)
|
|
|
|
|
this.pagination.page = page
|
|
|
|
|
this.pagination.size = pageSize
|
|
|
|
|
this.loadOptions()
|
|
|
|
|
this.loadOptionsList()
|
|
|
|
|
},
|
|
|
|
|
handleResetParam() {
|
|
|
|
|
this.queryParam.keyword = null
|
|
|
|
|
this.queryParam.type = null
|
|
|
|
|
this.handlePaginationChange(1, this.pagination.size)
|
|
|
|
|
},
|
|
|
|
|
onFormClose() {
|
|
|
|
|
;(this.formVisible = false), (this.optionToStage = {})
|
|
|
|
|
},
|
|
|
|
|
createOrUpdateOption() {
|
|
|
|
|
if (!this.optionToStage.key) {
|
|
|
|
|
this.$notification['error']({
|
|
|
|
|
message: '提示',
|
|
|
|
|
description: 'Key 不能为空!'
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (!this.optionToStage.value) {
|
|
|
|
|
this.$notification['error']({
|
|
|
|
|
message: '提示',
|
|
|
|
|
description: 'Value 不能为空!'
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (this.optionToStage.id) {
|
|
|
|
|
optionApi.update(this.optionToStage.id, this.optionToStage).then(response => {
|
|
|
|
|
this.$message.success('更新成功!')
|
|
|
|
|
this.loadOptionsList()
|
|
|
|
|
this.loadOptions()
|
|
|
|
|
this.optionToStage = {}
|
|
|
|
|
this.formVisible = false
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
this.optionToStage.type = this.optionType.CUSTOM.value
|
|
|
|
|
optionApi.create(this.optionToStage).then(response => {
|
|
|
|
|
this.$message.success('保存成功!')
|
|
|
|
|
this.loadOptionsList()
|
|
|
|
|
this.loadOptions()
|
|
|
|
|
this.optionToStage = {}
|
|
|
|
|
this.formVisible = false
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|