春风项目四线(合箱线、总装线)
wujian
2024-09-10 51b05b093fa15dd477981372f67ae7b3b2747733
jcdm-ui/src/views/main/om/productionOrde/detail.vue
@@ -70,7 +70,14 @@
                    <span>{{ parseTime(scope.row.operateTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
                  </template>
                </el-table-column>
                <el-table-column
                  fixed="right"
                  label="操作"
                  width="100">
                  <template slot-scope="scope">
                    <el-button @click="handleClick(scope.row)" type="text" size="small">更换箱体上线</el-button>
                  </template>
                </el-table-column>
              </el-table>
              <pagination
                v-show="total>0"
@@ -84,18 +91,51 @@
        </el-col>
      </el-row>
    </div>
    <el-dialog v-dialogpop-up :title="title" :visible.sync="changeBoxFlag" width="500px" append-to-body>
       <span slot="title">
        <i class="el-icon-s-order"></i>
        {{titleName}}
      </span>
      <el-form ref="changeFrom" inline  :model="changeFrom" label-width="80px">
        <el-form-item   label="发动机号" prop="sfcCode">
          <el-input disabled v-model="changeFrom.sfcCode" style="width: 370px"/>
        </el-form-item>
        <el-form-item   label="原箱体码" prop="boxCode">
          <el-input disabled v-model="changeFrom.boxCode" style="width: 370px"/>
        </el-form-item>
        <el-form-item  label="现箱体码" v-model="changeFrom.newBoxCode" prop="newBoxCode">
          <input v-model="changeFrom.newBoxCode"
                 ref="changeBoxInput"
                 style="height: 39px; width: 370px"
                 placeholder="请扫描箱体码"
          />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFormForBoxCode">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import { engineNoIsInModel, getSumDataMethod, listOrderScheduling3 } from "../../../../api/main/bs/orderScheduling/orderScheduling";
import { engineNoIsInModel, changeBoxCode, getSumDataMethod, listOrderScheduling3 } from "../../../../api/main/bs/orderScheduling/orderScheduling";
export default {
  name: 'Detail',
  props: ['singleSelect'],
  dicts: ['order_scheduling_produce_status','quality_status','print_status','material_type'],
  data(){
    return{
      title: '更换箱体',
      changeBoxFlag: false,
      titleName: '更换箱体',
      changeFrom: {
        boxCode: '',
        newBoxCode: '',
        sfcCode: ''
      },
      // 总条数
      total: 0,
      repairFlag:false,
@@ -115,8 +155,53 @@
    handleQuery(){
    },
    submitFormForBoxCode(){
      if (this.changeFrom.newBoxCode === '' || this.changeFrom.newBoxCode === null){
        this.$message.info("新箱体码不能为空")
      } else {
        changeBoxCode({sfcCode:this.changeFrom.sfcCode,newBoxCode:this.changeFrom.newBoxCode}).then(res => {
          console.log('res',res)
          if (res.code===200){
            this.$message({
              message:'操作成功',
              type:'success'
            })
            this.changeBoxFlag = false
            this.getListData()
            this.$refs.inputdata.focus()
          }else {
            this.$message({
              message:res.msg,
              type:'warning'
            })
          }
        })
      }
    },
    handleClick(row){
      console.log('row',row)
      this.changeBoxFlag = true
      this.changeFrom.sfcCode = row.engineNo
      this.changeFrom.boxCode = row.boxCode
      this.changeFrom.newBoxCode = ''
      this.$nextTick(()=>{
        this.$refs.changeBoxInput.focus()
      })
    },
    cancel(){
      this.changeBoxFlag = false
      this.$refs.inputdata.focus()
    },
    handleChangeBoxInput(event){
      const input = event.target
      const inputValue = input.value
      this.changeFrom.newBoxCode =  inputValue
    },
    refresh() {
      location.reload();
      this.$emit("reserveChild",null)
    },
    setFocus(){
      this.$nextTick(()=>{
@@ -173,9 +258,11 @@
    this.getListData()
    this.setFocus()
    this.$refs.inputdata.addEventListener('keydown',this.handleScannerInput)
    this.$refs.changeBoxInput.addEventListener('keydown',this.handleChangeBoxInput)
  },
  beforeDestroy() {
    this.$refs.inputdata.removeEventListener('keydown',this.handleScannerInput)
    this.$refs.changeBoxInput.removeEventListener('keydown',this.handleChangeBoxInput)
  }
}
</script>