1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <template>
- <p class="inquire-button-one" style="margin:100px 50px;" @click="upButton">提交</p>
- </template>
- <script>
- import { whitelistAddList,whitelistEditList } from "@/api/laboratory/whitelist";
- export default {
- name: 'addPageSubPagePublic',
- methods:{
- // 上传按钮
- upButton(){
- let self = this;
- if(!self.$parent.$parent.userList[0]){
- self.msgError("请先添加人员")
- return
- }
- self.$confirm('是否确认提交?', "", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(function() {
- if(self.$parent.$parent.pageData.id){
- self.whitelistEditList();
- }else{
- self.whitelistAddList();
- }
- }).then(() => {}).catch(() => {});
- },
- //新增提交
- whitelistAddList(){
- let self = this;
- let labWhiteJoinSubList=[];
- self.$parent.$parent.subjectList.forEach(function (item,index){
- labWhiteJoinSubList.push({'subjectId':item.subjectId})
- })
- let obj = {
- labWhitelist:self.$parent.$parent.userList,
- labWhiteJoinSubList:labWhiteJoinSubList
- }
- whitelistAddList(obj).then(response => {
- if(response.code==200){
- self.msgSuccess("操作成功")
- self.$parent.$parent.backPage();
- }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.$parent.backPage();
- });
- }
- });
- },
- //编辑提交
- whitelistEditList(){
- let self = this;
- let labWhiteJoinSubList=[];
- //循环取出实验室id
- self.$parent.$parent.subjectList.forEach(function (item,index){
- labWhiteJoinSubList.push({'subjectId':item.subjectId})
- })
- let obj = {
- userId:self.$parent.$parent.userList[0].userId,
- labWhiteJoinSubList:labWhiteJoinSubList
- }
- whitelistEditList(obj).then(response => {
- self.msgSuccess("操作成功")
- self.$parent.$parent.backPage();
- });
- },
- }
- }
- </script>
- <style scoped>
- </style>
|