Selaa lähdekoodia

修改扫码枪

achao 3 vuotta sitten
vanhempi
commit
510ed33979
1 muutettua tiedostoa jossa 112 lisäystä ja 0 poistoa
  1. 112 0
      src/layout/index/top/index.vue

+ 112 - 0
src/layout/index/top/index.vue

@@ -22,6 +22,20 @@
     </div>
     <div class="top-bar__right">
       <!-- 使用租户 -->
+      <div class="hidden-content">
+           <el-input ref="hiddenFocus" class="input-Style" v-model="barCode" size="small" @focus="focus" @blur="blur" @keyup.enter.native="payCode" placeholder="扫码枪内容"></el-input>
+      <div v-show="isOpenCodeGun">扫码枪已连接</div>
+      <div v-show="!isOpenCodeGun" @click="setCodeGun">点我扫码</div>
+        <el-dialog title="扫描二维码" :visible.sync="smAlert">
+          <el-button v-hasPermission="`acquisitionManagement.acquisitionQuality.initial`" @click="goToPage(1)">去初检</el-button>
+          <el-button v-hasPermission="`acquisitionManagement.acquisitionQuality.con`" @click="goToPage(2)">去确认质检</el-button>
+          <el-button v-hasPermission="`acquisitionManagement.acquisitionQuality.again`" @click="goToPage(3)">去复检</el-button>
+          <el-button v-hasPermission="`acquisitionManagement.acquisitionWeight.mao`" @click="goToPage(4)">去称毛重</el-button>
+          <el-button v-hasPermission="`acquisitionManagement.acquisitionPay.add`" @click="goToPage(5)">去结算</el-button>
+          <el-button v-hasPermission="`acquisitionManagement.acquisitionWeight.weight`" @click="goToPage(6)">去称皮重</el-button>
+          <el-button @click="smAlert = false" class="btn">关闭</el-button>
+      </el-dialog>
+     </div>
       <div v-if="getDay" class="right-menu-item hover-effect dayClass">
         {{ $t('common.trialDays') }}
         <span style="padding: 0 2px">{{ getDay }}</span
@@ -214,6 +228,7 @@ import breadCrumb from '@/components/Breadcrumb'
 import { EventBus } from 'base-core-lib'
 import { validPassword } from '@/utils/validate'
 import smallTips from '@/components/WinseaCom/smallTips'
+import {getLook } from '@/model/warehouse/index'
 
 const validPasswordRule = function (rule, value, callback) {
   if (!validPassword(value)) {
@@ -246,6 +261,10 @@ export default {
   name: 'top',
   data() {
     return {
+      userINfo:{},
+      barCode:'',
+      isOpenCodeGun:false,
+      smAlert:false,
       showList: [
         'maintenancePlanList',
         'maintenanceReportList',
@@ -299,6 +318,12 @@ export default {
   filters: {},
   created() {
     // this.getUserInfo()
+    this.getUserWorseHouse();
+    this.userINfo = {
+      userCompany:localStorage.getItem('ws-pf_compId'),
+      userName:localStorage.getItem('ws-pf_staffName'),
+      userJurisdiction:""
+    }
   },
   mounted() {
     listenfullscreen(this.setScreen)
@@ -337,6 +362,82 @@ export default {
   },
   methods: {
     ...mapActions('common', ['setLocalVessels']),
+    payCode(){
+      console.log("input",this.barCode)
+      let _userCompId = this.barCode.split(',')[0]
+      let _userId = this.barCode.split(',')[1]
+      let _userFlag = this.barCode.split(',')[2]
+      let _userHouseId = this.barCode.split(',')[3]
+        
+      //判断当前账号公司
+      if(this.userINfo.userCompany!=_userCompId){
+          this.$message.error('当前身份不可操作');
+          return
+      }
+      //判断当前账号仓库
+      this.getLook(_userHouseId,this.userINfo.userName)
+      //扫码枪扫码后显示弹框
+      this.smAlert = true
+      //根据判断显示不同按钮
+      //获取跳转数据
+    },
+     async getLook(compId,userName) {
+      await getLook({
+        id: compId,
+      })
+        .toPromise()
+        .then((response) => {
+          if(response.personCharge!=userName||response.otherPersonCharge.indexOf(userName)<=-1){
+            this.$message.error('当前身份不可操作');
+            return
+          }
+          // this.deptBudgetList = response
+          
+        })
+    },
+    setCodeGun(){
+      this.$refs['hiddenFocus'].focus()
+    },
+    focus(){
+      console.log("当前焦点状态")
+      this.isOpenCodeGun = true
+    },
+    blur(){
+       console.log("当前已失去焦点状态")
+       this.isOpenCodeGun = false
+    },
+    goToPage(type){
+      let _url = ''
+      if(type===1){
+        // this.$router.push({
+				// 	path: 'inspectInfo',
+				// 	query: {
+				// 		type: index,
+				// 		cangid: this.cangid,
+				// 		id: row.id,
+				// 		warehouseName: this.warehouseName,
+				// 		count: this.warehouseCount,
+				// 		warehouseNo: this.warehouseNo,
+				// 		allowEdit:this.allowEdit,
+				// 		status:row.status
+				// 	},
+				// })
+      }else if(type===2){
+        _url = ''
+      }else if(type===3){
+        _url = ''
+      }else if(type===4){
+        _url = ''
+      }else if(type===5){
+        _url = ''
+      }else if(type===6){
+        _url = ''
+      }
+    },
+    //获取当前用户管理的仓库
+    getUserWorseHouse(){
+
+    },
     handleScreen() {
       fullscreenToggel()
     },
@@ -492,4 +593,15 @@ export default {
     }
   }
 }
+.hidden-content{
+  display: flex;
+  font-size: 16px;
+}
+.input-Style{
+  opacity: 0;
+}
+.btn{
+  background: #5878e8;
+  color: white;
+}
 </style>