addPageSubPagePublic.vue 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <template>
  2. <p class="inquire-button-one" style="margin:100px 50px;" @click="upButton">提交</p>
  3. </template>
  4. <script>
  5. import { whitelistAddList,whitelistEditList } from "@/api/laboratory/whitelist";
  6. export default {
  7. name: 'addPageSubPagePublic',
  8. methods:{
  9. // 上传按钮
  10. upButton(){
  11. let self = this;
  12. if(!self.$parent.$parent.userList[0]){
  13. self.msgError("请先添加人员")
  14. return
  15. }
  16. self.$confirm('是否确认提交?', "", {
  17. confirmButtonText: "确定",
  18. cancelButtonText: "取消",
  19. type: "warning"
  20. }).then(function() {
  21. if(self.$parent.$parent.pageData.id){
  22. self.whitelistEditList();
  23. }else{
  24. self.whitelistAddList();
  25. }
  26. }).then(() => {}).catch(() => {});
  27. },
  28. //新增提交
  29. whitelistAddList(){
  30. let self = this;
  31. let labWhiteJoinSubList=[];
  32. self.$parent.$parent.subjectList.forEach(function (item,index){
  33. labWhiteJoinSubList.push({'subjectId':item.subjectId})
  34. })
  35. let obj = {
  36. labWhitelist:self.$parent.$parent.userList,
  37. labWhiteJoinSubList:labWhiteJoinSubList
  38. }
  39. whitelistAddList(obj).then(response => {
  40. if(response.code==200){
  41. self.msgSuccess("操作成功")
  42. self.$parent.$parent.backPage();
  43. }else if(response.code==205){
  44. self.$confirm(response.msg, "警告", {
  45. confirmButtonText: "确定",
  46. cancelButtonText: "取消",
  47. type: "warning"
  48. }).then(() => {
  49. // 确定
  50. self.$router.push({ path: '/comprehensive/laboratoryManagement/accessAuthorization' });
  51. }).catch(function() {
  52. // 取消
  53. self.$parent.$parent.backPage();
  54. });
  55. }
  56. });
  57. },
  58. //编辑提交
  59. whitelistEditList(){
  60. let self = this;
  61. let labWhiteJoinSubList=[];
  62. //循环取出实验室id
  63. self.$parent.$parent.subjectList.forEach(function (item,index){
  64. labWhiteJoinSubList.push({'subjectId':item.subjectId})
  65. })
  66. let obj = {
  67. userId:self.$parent.$parent.userList[0].userId,
  68. labWhiteJoinSubList:labWhiteJoinSubList
  69. }
  70. whitelistEditList(obj).then(response => {
  71. self.msgSuccess("操作成功")
  72. self.$parent.$parent.backPage();
  73. });
  74. },
  75. }
  76. }
  77. </script>
  78. <style scoped>
  79. </style>