rt-sim-training-client/src/views/scriptManage/addScriptMember.vue

93 lines
2.9 KiB
Vue
Raw Normal View History

2020-08-17 18:47:38 +08:00
<template>
<el-dialog
v-dialogDrag
:title="title"
:visible.sync="dialogVisible"
append-to-body
2020-08-17 18:47:38 +08:00
width="500px"
:before-close="handleClose"
center
:close-on-click-modal="false"
>
<el-form ref="form" :model="formModel" label-width="120px" :rules="rules">
<el-form-item label="添加仿真成员:" prop="type">
<el-select v-model="formModel.type" placeholder="请选择" size="small">
<el-option
v-for="item in typeList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
2020-08-21 14:16:44 +08:00
<el-form-item label="仿真成员名称:" prop="name">
<el-input v-model="formModel.name" placeholder="请输入成员名称" />
</el-form-item>
2020-08-17 18:47:38 +08:00
</el-form>
<span slot="footer" class="dialog-footer">
2020-08-21 14:16:44 +08:00
<el-button type="primary" :lodaing="lodaing" @click="doSave">{{ $t('global.confirm') }}</el-button>
2020-08-17 18:47:38 +08:00
<el-button @click="handleClose">{{ $t('global.cancel') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { addSimulationMember } from '@/api/jointSimulation';
export default {
name: 'AddMember',
data() {
return {
dialogVisible: false,
2020-08-21 14:16:44 +08:00
lodaing:false,
2020-08-17 18:47:38 +08:00
formModel: {
2020-08-21 14:16:44 +08:00
type: '',
name:''
2020-08-17 18:47:38 +08:00
},
rules: {
type: [
2020-08-21 14:16:44 +08:00
{ required: true, message: '请选择成员类型', trigger: 'change' }
2020-08-17 18:47:38 +08:00
]
2020-08-21 14:55:28 +08:00
// name:[
// { required: true, message: '请输入成员名称', trigger: 'blur' }
// ]
2020-08-17 18:47:38 +08:00
},
typeList: [{label: '行调', value: 'DISPATCHER'}, {label: '通号', value: 'MAINTAINER'}]
};
},
computed: {
title() {
return '添加仿真角色成员';
}
},
methods: {
doShow(row) {
this.dialogVisible = true;
},
doSave() {
2020-08-21 14:16:44 +08:00
this.$refs.form.validate((valid) => {
if (valid) {
this.lodaing = true;
addSimulationMember(this.formModel, this.$route.query.group).then((res) => {
this.$message.success('添加仿真角色成员成功!');
this.$emit('addScriptMember', res.data);
2020-09-01 18:27:36 +08:00
this.lodaing = false;
2020-08-21 14:16:44 +08:00
this.handleClose();
}).catch(() => {
this.lodaing = false;
this.$message.error('添加仿真角色成员失败!');
});
}
2020-08-17 18:47:38 +08:00
});
},
handleClose() {
this.dialogVisible = false;
this.formModel = {
2020-08-21 14:16:44 +08:00
type: '',
name:''
2020-08-17 18:47:38 +08:00
};
this.$refs.form.resetFields();
}
}
};
</script>