xiaojiao
2026-01-12 c3b60d865c3457c35054446e81b352e93e00a696
ÏîÄ¿´úÂë/PDA/pages/Inbound/InboundBoxing_New.vue
@@ -27,7 +27,7 @@
               <u-td width="30%">轴承条码</u-td>
               <u-td>
                  <u-input v-model="value_qrcode" :border="true" :focus="qrcodeFocus"
                     placeholder="请输入轴承条码" />
                     placeholder="请输入轴承条码" @input="barcodeChange" />
               </u-td>
            </u-tr>
            <u-tr>
@@ -35,8 +35,8 @@
               <!-- <u-td>
                  <u-input v-model="materielId" :border="true"  placeholder="" />
               </u-td> -->
               <xfl-select :list="CxTypes" :initValue="'请选择'" :clearable="false" @change="Get_VehicleType_Alls"
                  ref="Get_VehicleType_All">
               <xfl-select :list="CxTypes" :initValue="stateInitValueCarmodel" :clearable="false" @change="Get_VehicleType_Alls"
                  ref="Get_VehicleType_All" :key="CarmodelKey">
               </xfl-select>
            </u-tr>
            <u-tr>
@@ -46,7 +46,7 @@
                <xfl-select 
                    v-if="showBearingSelect"
                    :list="BearingModels" 
                    :initValue="'请选择'"
                    :initValue="stateInitValueBearingModel"
                    :clearable="false" 
                    @change="BearingModelss"
                    ref="BearingModelsss" 
@@ -67,7 +67,7 @@
                  <u-input v-model="NewOrOld" :border="true"  placeholder="" />
               </u-td> -->
               <u-td>
                  <xfl-select :list="StateArray" :initValue="'请选择'" :clearable="false" @change="StateChange"
                  <xfl-select :key="stateKey" :list="StateArray" :initValue="stateInitValue" :clearable="false" @change="StateChange"
                     ref="StateSelect">
                  </xfl-select>
               </u-td>
@@ -105,7 +105,15 @@
   export default {
      data() {
         return {
            bearingSelectKey: 0, // ä¿ç•™key作为双保险
            stateKey: 0, // æ–°å¢žï¼šæŽ§åˆ¶ç»„件重建 ã€è½´æ‰¿ç±»åˆ«ã€‘
            stateInitValue: '请选择', // åˆå§‹å€¼ï¼ŒåŽç»­åŠ¨æ€ä¿®æ”¹ã€è½´æ‰¿ç±»åˆ«ã€‘
            bearingSelectKey: 0, // ä¿ç•™key作为双保险 ã€è½´æ‰¿åž‹å·ã€‘
            stateInitValueBearingModel:'请选择', //【轴承型号】
            CarmodelKey: 0, //【车型】
            stateInitValueCarmodel:'请选择', // ã€è½¦åž‹ã€‘
            showBearingSelect: true, // æ–°å¢žï¼šæŽ§åˆ¶ç»„件销毁/创建
            date: '',
            CurrentUser: '', //当前用户
@@ -140,6 +148,48 @@
         }
      },
      methods: {
         barcodeChange(){
            // 1. æ‹¿åˆ°åŽŸå§‹çš„ç±»JSON字符串(如:{'轴承条码':'1','车型':'2',...})
            if(_this.value_qrcode.length > 60){
               const rawStr = _this.value_qrcode;
               // 2. ä¿®å¤æ ¼å¼ï¼ˆå•引号→双引号 + åˆ å°¾é€—号)
               const fixedStr = rawStr.replace(/'/g, '"').replace(/,\s*}/, '}');
               console.log(fixedStr)
               // 3. è§£æžä¸ºå­—典(对象)
               const temp_dict = JSON.parse(fixedStr);
               console.log(temp_dict)
               // 4. æ­£ç¡®èŽ·å–å€¼
               console.log(temp_dict['轴承条码']); // è¾“出:1(不再是undefined)
               _this.value_qrcode = temp_dict['轴承条码'];
               _this.madeUnit = temp_dict["厂家"]
               _this.LotNumber = temp_dict["轴承单号"]
               _this.Bearing_Category(temp_dict["轴承类别"])
               _this.BearingModel(temp_dict["轴承型号"])
               _this.Carmodel(temp_dict["车型"])
            }
         },
         Bearing_Category (type_name){
            _this.stateKey += 1; // 1. å…ˆæ”¹key,强制销毁旧组件
            _this.stateInitValue = type_name;
            const matchedItem = _this.StateArray.find(item => item.value == type_name);
                if (matchedItem) {
                  _this.NewOrOld = matchedItem.label;
                }
               console.log(_this.NewOrOld)
         },
         Carmodel(type_name){ // è½¦åž‹
            _this.CarmodelKey += 1;
            _this.stateInitValueCarmodel = type_name;
            _this.materielId = type_name;
         },
         BearingModel(type_name){ // è½´æ‰¿åž‹å·
            _this.bearingSelectKey += 1;
            _this.stateInitValueBearingModel = type_name;
            _this.materielType = type_name;
         },
         UserChange(value) {
         },
@@ -368,7 +418,6 @@
         _this.rfidFocus = true;
         _this.ProductDate = this.getCurrentDate();
         this.VehicleType();
      },