1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <template>
- <p class="inquire-button-one" @click="upDataButton">提交</p>
- </template>
- <script>
- import { addUserTeacher, putUserTeacherNew } from "@/api/system/user_teacher";
- export default {
- name: 'addPageSubPageSZDX',
- methods:{
- upDataButton(){
- let self = this;
- self.$parent.$refs["form"].validate(valid => {
- if (valid) {
- if(self.$parent.form.email){
- let re = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
- if(!re.test(self.$parent.form.email)){
- self.msgError('请输入正确的邮箱地址')
- return
- }
- }
- let list = self.$parent.toArray();
- let obj = JSON.parse(JSON.stringify(self.$parent.form));
- obj.permitMenus = [];
- if(obj.status == 0){
- for(let i=0;i<list.length;i++){
- let minObj = {
- menuId:list[i].menuId,
- }
- if(list[i].dataScope){
- minObj.dataScope = list[i].dataScope
- if(list[i].dataScope == 3){
- minObj.deptIds = list[i].deptIds;
- minObj.deptIdsList = list[i].deptIdsList;
- }
- }else{
- minObj.dataScope = 0
- }
- obj.permitMenus.push(minObj)
- }
- }
- if(self.$parent.propsData.userId){
- //修改
- obj.userId = self.$parent.propsData.userId;
- self.putUserTeacherNew(obj);
- }else{
- //发布
- self.addUserTeacher(obj);
- }
- }
- });
- },
- putUserTeacherNew(obj){
- let self = this;
- putUserTeacherNew(obj).then(response => {
- if(response.code == 200){
- self.msgSuccess(response.msg);
- self.$parent.outPageButton();
- }
- });
- },
- addUserTeacher(obj){
- let self = this;
- addUserTeacher(obj).then(response => {
- if(response.code == 200){
- self.msgSuccess(response.msg);
- self.$parent.outPageButton();
- }
- });
- },
- }
- }
- </script>
- <style scoped>
- </style>
|