From 41afb20b6b3776f1242ce2aba29d8e51fa8110d6 Mon Sep 17 00:00:00 2001 From: admin <15939171744@163.com> Date: 星期六, 17 五月 2025 09:45:52 +0800 Subject: [PATCH] - --- billion-ui/src/views/main/bq/workstationOperation/index.vue | 233 ++++++++++++++++------------------------------------------ 1 files changed, 65 insertions(+), 168 deletions(-) diff --git a/billion-ui/src/views/main/bq/workstationOperation/index.vue b/billion-ui/src/views/main/bq/workstationOperation/index.vue index 1639348..1522332 100644 --- a/billion-ui/src/views/main/bq/workstationOperation/index.vue +++ b/billion-ui/src/views/main/bq/workstationOperation/index.vue @@ -1,202 +1,99 @@ <template> <div class="app-container"> - <el-row :gutter="5"> - <el-col :span="6"> - <el-card class="box-card"> - <div class="card-item"> - <span class="label">宸ヤ綅缂栧彿:</span> - <el-select v-model="locationCode" placeholder="璇烽�夋嫨" class="content-item" @change="handleLocationChange"> - <el-option - v-for="item in locationCodeOptions" - :key="item.locationCode" - :label="item.locationCode" - :value="item.locationCode"> - </el-option> - </el-select> - </div> - </el-card> - </el-col> - <el-col :span="6"> - <el-card class="box-card"> - <div class="card-item"> - <span class="label">鏍锋満缂栧彿:</span> - <span class="content-item">{{prototypeNumber}}</span> - </div> - </el-card> - </el-col> - <el-col :span="12"> - <el-card class="box-card"> - <div class="card-item"> - <span class="label">鐗╂枡缂栧彿:</span> - <el-input class="content-item" v-model="materialCode" placeholder="璇疯緭鍏ョ墿鏂欑紪鍙�" @keyup.enter.native="handleMaterialCodeEnter"></el-input> - <el-button @click="test1" type="primary">涓昏鎸夐挳</el-button> - <el-button type="success">鎴愬姛鎸夐挳</el-button> - </div> - </el-card> - </el-col> - </el-row> - <el-row> + <el-row :gutter="20"> <el-col :span="24"> <el-card class="box-card"> - <el-table - ref="formulaTable" - :data="sortedFormulaData" - height="350" - style="width: 100%" - :row-class-name="tableRowClassName" - > - <el-table-column show-overflow-tooltip label="宸ヤ綅缂栧彿" align="center" prop="locationCode" /> - <el-table-column show-overflow-tooltip label="浜у搧缂栧彿" align="center" prop="productCode" /> - <el-table-column show-overflow-tooltip label="鎿嶄綔鍐呭" align="center" prop="operationContent" /> - <el-table-column show-overflow-tooltip label="鐗╂枡缂栫爜" align="center" prop="materialCode" /> - <el-table-column show-overflow-tooltip label="閲囬泦鍊�" align="center" prop="collectData" /> - <el-table-column show-overflow-tooltip label="缁撴灉" align="center" prop="results" /> - </el-table> + <div slot="header" class="clearfix"> + <span>鎵爜涓嬬嚎</span> + </div> + <el-form ref="form" :model="form" :rules="rules" label-width="100px" @submit.native.prevent> + <el-form-item label="搴忓垪鍙�" prop="SNCode"> + <input + v-model="form.SNCode" + ref="inputdata" + placeholder="璇疯緭鍏ュ簭鍒楀彿" + style="width: 100%; height: 40px; font-size: 30px" + /> + </el-form-item> + + </el-form> </el-card> </el-col> </el-row> - <el-row> - <el-col :span="24"> - <el-card class="box-card"> - <span>缂洪櫡璁板綍:</span> - <el-input style="width: 70%" v-model="defectInformation" placeholder="璇疯緭鍏ョ己闄疯褰�"></el-input> - </el-card> - </el-col> - </el-row> + </div> </template> <script> import { listLocationInfo, getLocationInfo, delLocationInfo, addLocationInfo, updateLocationInfo } from "@/api/main/bs/locationInfo"; import {addInfo, delInfo, getInfo, listInfo, updateCollectData, updateInfo} from "@/api/main/bs/formulaChildinfo"; +import {addPassStationCollection} from "@/api/main/da/stationCollection"; export default { name: "workstationOperation", data() { return { - printInfoData: { - softwareVersion: 'SW001.001', //杞欢鐗堟湰鍙� - hardwareVersion: 'HW001.001', //纭欢鐗堟湰鍙� - printModel: 'H2155D', //鍨嬪彿 - partNumber: '0', //闆堕儴浠跺彿 - supplierCode: '993983', //渚涘簲鍟嗙紪鐮� + scannerFlag: false, + form: { + SNCode: '', + LocationCode: 'OP450' }, - locationCode: '', - prototypeNumber: '', - materialCode: '', - defectInformation: '', - locationCodeOptions: [], - formulaTableData: [], - isFirstEnter: true - } - }, - created() { - this.initLocationOptions() - }, - computed: { - sortedFormulaData() { - // 瀵规暟鎹繘琛屾帓搴忥紝OK鐨勬斁鍦ㄥ墠闈� - return [...this.formulaTableData].sort((a, b) => { - if (a.results === 'OK' && b.results !== 'OK') return -1; - if (a.results !== 'OK' && b.results === 'OK') return 1; - return 0; - }); + rules: { + SNCode: [ + { required: true, message: '璇疯緭鍏ュ簭鍒楀彿', trigger: 'blur' } + ] + }, } }, methods: { - async initLocationOptions() { - try { - const res = await listLocationInfo() - this.locationCodeOptions = res.rows - } catch (error) { - this.$message.error('鑾峰彇宸ヤ綅鍒楄〃澶辫触') - } + setFocus(){ + this.$nextTick(()=>{ + this.$refs.inputdata.focus() + }) }, - handleLocationChange(value) { - if (!value) { - this.prototypeNumber = '' - this.materialCode = '' - this.formulaTableData = [] - return + + handleScannerInput(event){ + if (this.scannerFlag){ + this.form.SNCode = '' + this.$refs.inputdata.value = '' + this.scannerFlag = false } - this.isFirstEnter = true - this.prototypeNumber = '' - this.materialCode = '' - this.formulaTableData = [] - }, - async handleMaterialCodeEnter() { - if (!this.locationCode) { - this.$message.warning('璇峰厛閫夋嫨宸ヤ綅') - return - } + const input = event.target + this.form.SNCode = input.value + if (event.key === 'Enter'){ + this.scannerFlag = true + //鎵弿瀹屾垚 + addPassStationCollection({SNCode:this.form.SNCode,LocationCode: this.form.LocationCode}).then(res => { - if (this.isFirstEnter) { - this.prototypeNumber = this.materialCode - this.materialCode = '' - this.isFirstEnter = false - - try { - const res = await listInfo({ - locationCode: this.locationCode, - pageFlag: true, - }) - console.log(res) - this.formulaTableData = res.rows - } catch (error) { - this.$message.error('鑾峰彇閰嶆柟鏁版嵁澶辫触') - } - } else { - try { - const res = await updateCollectData({ - locationCode: this.locationCode, - inputValue: this.materialCode - }) - - if (res.code === 200) { - this.formulaTableData = res.data - this.$message.success('鏇存柊鎴愬姛') - this.materialCode = '' // 娓呯┖杈撳叆妗� - - // 鍦ㄦ暟鎹洿鏂板悗锛屾粴鍔ㄥ埌鍚堥�傜殑浣嶇疆 - this.$nextTick(() => { - const table = this.$refs.formulaTable; - const completedCount = this.sortedFormulaData.filter(item => item.results === 'OK').length; - const totalCount = this.sortedFormulaData.length; - - if (completedCount < totalCount) { - // 璁$畻闇�瑕佹粴鍔ㄧ殑浣嶇疆锛氬皢绗竴涓湭瀹屾垚鐨勮鏄剧ず鍦ㄤ腑闂� - const rowHeight = 40; // 棰勪及鐨勮楂� - const scrollPosition = completedCount * rowHeight - (table.$el.clientHeight / 2) + rowHeight; - - // 璁剧疆琛ㄦ牸鐨勬粴鍔ㄤ綅缃� - table.bodyWrapper.scrollTop = Math.max(0, scrollPosition); - } - }); + if (res.code === 200){ + this.$message({ + message: "鎵爜瀹屾垚", + type: "success" + }) } else { - this.$message.warning(res.msg) + this.$message({ + message: "鎵爜閿欒锛岃閲嶈瘯", + type: "error" + }) } - } catch (error) { - this.$message.error('鏇存柊澶辫触') - } + }) } }, - - // 娣诲姞琛屾牱寮忔柟娉� - tableRowClassName({row}) { - if (row.results === 'OK') { - return 'success-row' + }, + mounted() { + console.log('00') + this.setFocus(); + this.$nextTick(() => { + if (this.$refs.inputdata){ + this.$refs.inputdata.addEventListener('keydown',this.handleScannerInput) } - return '' - }, - test1(){ - let scanValue = '0RSMB05A132E3AF3V0000001' - if(scanValue.includes("0RSMB")){ - this.$message.warning("鎴愬姛"+scanValue) - }else { - this.$message.error('鎵爜璇嗗埆閿欒鐨勪骇鍝佸簭鍒楀彿'+scanValue+'璇烽噸鏂版壂鐮�'); - } - } + }) + + }, + + beforeDestroy() { + this.$refs.inputdata.removeEventListener('keydown',this.handleScannerInput) } } </script> -- Gitblit v1.9.3