123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <template>
- <p class="inquire-button-one" @click="upDataButton">提交</p>
- </template>
- <script>
- import { addUserTeacher, putUserTeacherNew } from "@/api/system/user_teacher";
- export default {
- name: 'addPageSubPagePublic',
- 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.roleIds = self.$parent.form.position?self.$parent.form.roleIds:[];
- // obj.position = obj.position+'';
- 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();
- }else if(response.code==205){
- self.$confirm(response.msg, "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- // 确定
- self.$router.push({ path: '/comprehensive/laboratoryManagement/accessAuthorization' });
- }).catch(function() {
- // 取消
- self.$parent.outPageButton();
- });
- }
- });
- },
- addUserTeacher(obj){
- let self = this;
- addUserTeacher(obj).then(response => {
- if(response.code == 200){
- self.msgSuccess(response.msg);
- self.$parent.outPageButton();
- }else if(response.code==205){
- self.$confirm(response.msg, "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- // 确定
- self.$router.push({ path: '/comprehensive/laboratoryManagement/accessAuthorization' });
- }).catch(function() {
- // 取消
- self.$parent.outPageButton();
- });
- }
- });
- },
- }
- }
- </script>
- <style scoped>
- </style>
|