增加平台配置的页面
This commit is contained in:
100
jshERP-web/src/views/system/modules/PlatformConfigModal.vue
Normal file
100
jshERP-web/src/views/system/modules/PlatformConfigModal.vue
Normal file
@@ -0,0 +1,100 @@
|
||||
<template>
|
||||
<a-modal
|
||||
:title="title"
|
||||
:width="800"
|
||||
:visible="visible"
|
||||
:confirmLoading="confirmLoading"
|
||||
@ok="handleOk"
|
||||
@cancel="handleCancel"
|
||||
cancelText="关闭"
|
||||
wrapClassName="ant-modal-cust-warp"
|
||||
style="top:30%;height: 40%;overflow-y: hidden">
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<a-form :form="form" id="platformConfigModal">
|
||||
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="配置名称">
|
||||
<a-input placeholder="请输入配置名称" v-decorator.trim="[ 'platformKeyInfo' ]" :readOnly="true" />
|
||||
</a-form-item>
|
||||
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="配置值">
|
||||
<a-input placeholder="请输入配置值" v-decorator.trim="[ 'platformValue' ]" />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-spin>
|
||||
</a-modal>
|
||||
</template>
|
||||
<script>
|
||||
import pick from 'lodash.pick'
|
||||
import {addPlatformConfig,editPlatformConfig } from '@/api/api'
|
||||
import {autoJumpNextInput} from "@/utils/util"
|
||||
export default {
|
||||
name: "PlatformConfigModal",
|
||||
data () {
|
||||
return {
|
||||
title:"操作",
|
||||
visible: false,
|
||||
model: {},
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 5 },
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 16 },
|
||||
},
|
||||
confirmLoading: false,
|
||||
form: this.$form.createForm(this)
|
||||
}
|
||||
},
|
||||
created () {
|
||||
},
|
||||
methods: {
|
||||
add () {
|
||||
this.edit({});
|
||||
},
|
||||
edit (record) {
|
||||
this.form.resetFields();
|
||||
this.model = Object.assign({}, record);
|
||||
this.visible = true;
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(pick(this.model,'platformKeyInfo', 'platformValue'))
|
||||
autoJumpNextInput('platformConfigModal')
|
||||
});
|
||||
},
|
||||
close () {
|
||||
this.$emit('close');
|
||||
this.visible = false;
|
||||
},
|
||||
handleOk () {
|
||||
const that = this;
|
||||
// 触发表单验证
|
||||
this.form.validateFields((err, values) => {
|
||||
if (!err) {
|
||||
that.confirmLoading = true;
|
||||
let formData = Object.assign(this.model, values);
|
||||
let obj;
|
||||
if(!this.model.id){
|
||||
obj=addPlatformConfig(formData);
|
||||
}else{
|
||||
obj=editPlatformConfig(formData);
|
||||
}
|
||||
obj.then((res)=>{
|
||||
if(res.code === 200){
|
||||
that.$emit('ok');
|
||||
}else{
|
||||
that.$message.warning(res.data.message);
|
||||
}
|
||||
}).finally(() => {
|
||||
that.confirmLoading = false;
|
||||
that.close();
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
handleCancel () {
|
||||
this.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user