作者 小范

转关运抵申报权限判定

1 import http from './http.js' 1 import http from './http.js'
2 let baseUrl = 'wlpt-nmms-manage/trans' 2 let baseUrl = 'wlpt-nmms-manage/trans'
  3 +let baseUrl1 = 'cloud-user-center/perm'
3 4
4 5
5 6
@@ -12,6 +13,8 @@ export const batchSend = params => { return http.post(`${baseUrl}/batchSend`, p @@ -12,6 +13,8 @@ export const batchSend = params => { return http.post(`${baseUrl}/batchSend`, p
12 export const addTrans = params => { return http.post(`${baseUrl}/addTrans`, params); }; 13 export const addTrans = params => { return http.post(`${baseUrl}/addTrans`, params); };
13 export const ediTrans = params => { return http.post(`${baseUrl}/ediTrans`, params); }; 14 export const ediTrans = params => { return http.post(`${baseUrl}/ediTrans`, params); };
14 export const send = params => { return http.post(`${baseUrl}/send`, params); }; 15 export const send = params => { return http.post(`${baseUrl}/send`, params); };
  16 +export const role = params => { return http.get(`${baseUrl1}/getPermission`, params); };
  17 +
15 18
16 19
17 20
@@ -132,10 +132,10 @@ @@ -132,10 +132,10 @@
132 <el-button type="primary" icon="el-icon-search" @click="trnList">查&nbsp;&nbsp;询</el-button> 132 <el-button type="primary" icon="el-icon-search" @click="trnList">查&nbsp;&nbsp;询</el-button>
133 </el-form-item> 133 </el-form-item>
134 <el-form-item> 134 <el-form-item>
135 - <el-button type="success" icon="el-icon-edit" @click="addTrn">新&nbsp;&nbsp;增</el-button> 135 + <el-button type="success" :disabled="isButtonDisabled1" icon="el-icon-edit" @click="addTrn">新&nbsp;&nbsp;增</el-button>
136 </el-form-item> 136 </el-form-item>
137 <el-form-item> 137 <el-form-item>
138 - <el-button type="warning" icon="el-icon-edit" :loading="batchSendLoading" @click="batchTrn">批量申报</el-button> 138 + <el-button type="warning" icon="el-icon-edit" :disabled="isButtonDisabled" :loading="batchSendLoading" @click="batchTrn">批量申报</el-button>
139 </el-form-item> 139 </el-form-item>
140 </el-col> 140 </el-col>
141 <!-- <el-col :span="6">--> 141 <!-- <el-col :span="6">-->
@@ -282,16 +282,18 @@ @@ -282,16 +282,18 @@
282 <el-table-column label="操作" align="center" width="200" fixed="right"> 282 <el-table-column label="操作" align="center" width="200" fixed="right">
283 <template slot-scope="scope"> 283 <template slot-scope="scope">
284 <el-row> 284 <el-row>
285 - <el-button type="success" @click="editTrn(scope.$index,scope.row)">编&emsp;&emsp;辑</el-button>  
286 - <el-button type="danger" :disabled="scope.row.customResponseText && scope.row.customResponseText !== undefined && scope.row.customResponseText.length>0" @click="delTrn(scope.row)"> 285 + <el-button type="success" :disabled="isButtonDisabled3(scope.row)" @click="editTrn(scope.$index,scope.row)">编&emsp;&emsp;辑</el-button>
  286 + <el-button type="danger" :disabled="isButtonDisabled5(scope.row)" @click="delTrn(scope.row)">
287 删&emsp;&emsp;除 287 删&emsp;&emsp;除
288 </el-button> 288 </el-button>
289 </el-row> 289 </el-row>
290 <el-row> 290 <el-row>
291 - <el-button type="warning" :disabled="scope.row.customResponseText && scope.row.customResponseText !== undefined && scope.row.customResponseText.length>0" @click="declareTrn(scope.row)"> 291 + <el-button type="warning" :disabled="isButtonDisabled2(scope.row)" @click="declareTrn(scope.row)">
292 申&emsp;&emsp;报 292 申&emsp;&emsp;报
293 </el-button> 293 </el-button>
294 - <el-button type="info" @click="statusTrn(scope.row)"> 294 +<!-- :disabled="scope.row.customResponseText && scope.row.customResponseText !== undefined-->
  295 +<!-- && scope.row.customResponseText.length>0 && scope.row.dstatus ==='001'"-->
  296 + <el-button type="info" :disabled="isButtonDisabled4(scope.row)" @click="statusTrn(scope.row)">
295 修改状态 297 修改状态
296 </el-button> 298 </el-button>
297 </el-row> 299 </el-row>
@@ -547,12 +549,13 @@ @@ -547,12 +549,13 @@
547 </template> 549 </template>
548 550
549 <script> 551 <script>
550 - import {selectTrans,delTrans,batchSend,ediTrans,send,addTrans} from "../../api/trn"; 552 + import {selectTrans,delTrans,batchSend,ediTrans,send,addTrans,role} from "../../api/trn";
551 import DetailedLog from '@/components/detailedDialog' 553 import DetailedLog from '@/components/detailedDialog'
552 import uti from '@/utils' 554 import uti from '@/utils'
553 import loginedUserInfo from "@/api/user"; 555 import loginedUserInfo from "@/api/user";
554 import unloadingCode from "@/common/customs/trans_arrive_unloadingCode"; 556 import unloadingCode from "@/common/customs/trans_arrive_unloadingCode";
555 import {mapActions, mapGetters} from 'vuex' 557 import {mapActions, mapGetters} from 'vuex'
  558 + import {list} from "../../api/consigner/sort";
556 559
557 560
558 export default { 561 export default {
@@ -670,14 +673,20 @@ @@ -670,14 +673,20 @@
670 trnmode: [ 673 trnmode: [
671 { required: true, message: '请输入', trigger: 'change' } 674 { required: true, message: '请输入', trigger: 'change' }
672 ], 675 ],
673 - }  
674 - 676 + },
  677 + queryInfo:{
  678 + name:'转关运抵申报',
  679 + url:''
  680 + },
  681 + names:'',
  682 + isButtonDisabled: false,
  683 + isButtonDisabled1: false,
675 } 684 }
676 }, 685 },
677 mounted() { 686 mounted() {
678 //获取列表 687 //获取列表
679 this.trnList(); 688 this.trnList();
680 - 689 + this.hasRole();
681 }, 690 },
682 computed:{ 691 computed:{
683 ...mapGetters(['getUserInfoStore','getUserMenuStore']), 692 ...mapGetters(['getUserInfoStore','getUserMenuStore']),
@@ -737,6 +746,75 @@ @@ -737,6 +746,75 @@
737 746
738 }, 747 },
739 methods:{ 748 methods:{
  749 + hasRole(){
  750 + const _this = this
  751 + role({name:this.queryInfo.name}).then((response) => {
  752 + console.log(this.queryInfo)
  753 +
  754 + const res = response.data
  755 + console.log(response.data)
  756 + if (res.code !== '200') {
  757 + return _this.$message.error('获取权限判定失败!')
  758 + }
  759 + //返回true(关务)
  760 + else if(res.data == true){
  761 + //关务可批量申报
  762 + this.isButtonDisabled = true;
  763 + //关务不可新增
  764 + this.isButtonDisabled1 = false;
  765 + _this.names = res.data;
  766 + _this.$message.success('获取权限判定成功!')
  767 + }
  768 + //返回false(货代)
  769 + //货代不可批量申报
  770 + this.isButtonDisabled = false;
  771 + //货代可新增
  772 + this.isButtonDisabled1 = true;
  773 + _this.names = res.data;
  774 + _this.$message.success('获取权限判定成功!')
  775 + }).catch(error => {
  776 + // 关闭加载
  777 + _this.$message.error(error.toString())
  778 + })
  779 +
  780 + },
  781 + //申报按钮使用权限
  782 + isButtonDisabled2(row) {
  783 + // 已申报或货代不能申报
  784 + if (row.customResponseText && row.customResponseText !== undefined
  785 + && row.customResponseText.length>0 || row.dstatus ==='001' || this.names == false) {
  786 + return true; // 禁用按钮
  787 + } else {
  788 + return false; // 不禁用按钮
  789 + }
  790 + },
  791 + //编辑按钮使用权限
  792 + isButtonDisabled3(row) {
  793 + // 已申报或关务不能编辑
  794 + if (row.dstatus ==='001' || this.names == true) {
  795 + return true; // 禁用按钮
  796 + } else {
  797 + return false; // 不禁用按钮
  798 + }
  799 + },
  800 + //修改状态按钮使用权限
  801 + isButtonDisabled4(row) {
  802 + // 已申报或货代或关务都不能修改状态
  803 + if (row.dstatus ==='001' || this.names == false|| this.names == true) {
  804 + return true; // 禁用按钮
  805 + } else {
  806 + return false; // 不禁用按钮
  807 + }
  808 + },
  809 + //删除按钮使用权限
  810 + isButtonDisabled5(row) {
  811 + // 已申报或关务不能删除
  812 + if (row.dstatus ==='001' || this.names == true) {
  813 + return true; // 禁用按钮
  814 + } else {
  815 + return false; // 不禁用按钮
  816 + }
  817 + },
740 //查看回执按钮 818 //查看回执按钮
741 check(row) { 819 check(row) {
742 this.dialogDetailedLogVisible = true 820 this.dialogDetailedLogVisible = true
@@ -929,15 +1007,15 @@ @@ -929,15 +1007,15 @@
929 if (this.selectedWaybillList && this.selectedWaybillList.length > 0) { 1007 if (this.selectedWaybillList && this.selectedWaybillList.length > 0) {
930 batchSend(this.selectedWaybillList).then(res => { 1008 batchSend(this.selectedWaybillList).then(res => {
931 if (res.code === '200') { 1009 if (res.code === '200') {
932 - Message.success('批量申报成功') 1010 + this.$message.success('批量申报成功')
933 } else { 1011 } else {
934 - Message.error('批量申报成功,请稍后重试') 1012 + this.$message.error('批量申报失败,请稍后重试')
935 } 1013 }
936 }).catch(action => { 1014 }).catch(action => {
937 this.$message({ 1015 this.$message({
938 type: 'info', 1016 type: 'info',
939 message: action === 'cancel' 1017 message: action === 'cancel'
940 - ? '取消修改' 1018 + ? '取消批量申报'
941 : '停留在当前页面' 1019 : '停留在当前页面'
942 }) 1020 })
943 }) 1021 })
@@ -945,9 +1023,9 @@ @@ -945,9 +1023,9 @@
945 setTimeout(() => { 1023 setTimeout(() => {
946 this.trnList() 1024 this.trnList()
947 }, 1000) 1025 }, 1000)
948 - Message.success('批量申报执行完毕') 1026 + this.$message.success('批量申报执行完毕')
949 } else { 1027 } else {
950 - Message.error('请选择需要批量发送的运单') 1028 + this.$message.error('请选择需要批量发送的运单')
951 } 1029 }
952 }, 1030 },
953 unloadcodeSearchAsync(queryString, cb) { 1031 unloadcodeSearchAsync(queryString, cb) {