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

82 lines
2.3 KiB
Vue
Raw Normal View History

2020-08-17 18:47:38 +08:00
<template>
<el-dialog
v-dialogDrag
:title="title"
:visible.sync="dialogVisible"
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>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
<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,
formModel: {
type: ''
},
rules: {
type: [
{ required: true, message: '请选择显示位置', trigger: 'change' }
]
},
typeList: [{label: '行调', value: 'DISPATCHER'}, {label: '通号', value: 'MAINTAINER'}]
};
},
computed: {
title() {
return '添加仿真角色成员';
}
},
methods: {
initData(row) {
},
doShow(row) {
this.initData(row);
this.dialogVisible = true;
},
doSave() {
this.$refs.form.validate(() => {
addSimulationMember(this.formModel, this.$route.query.group).then((res) => {
this.$message.success('添加仿真角色成员成功!');
this.$emit('addScriptMember', res.data);
this.handleClose();
}).catch(() => {
this.$message.error('添加仿真角色成员失败!');
});
});
},
handleClose() {
this.dialogVisible = false;
this.formModel = {
type: ''
};
this.$refs.form.resetFields();
}
}
};
</script>