| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 | <template>  <div class="app-container">    <el-row :gutter="20">      <el-col :span="12">        <el-form ref="temp" :rules="rules" :model="temp" label-position="right" label-width="130px" style="width: 100%">          <el-row>            <el-col :span="24">              <el-form-item label="TMR列表:" prop="eqcode">                <el-autocomplete v-model="temp.eqcode" class="inline-input" :fetch-suggestions="tmrSearch" placeholder="TMR列表" style="width:100%" @select="handleTmrSelect">                  <template slot-scope="{ item }">                    <b>设备名称:</b>{{ item.tname }}                      |  <b>设备编号:</b>{{ item.eqcode }}                  </template>                </el-autocomplete>              </el-form-item>            </el-col>          </el-row>          <el-row>            <el-col :span="12">              <el-form-item label="开始重量:" prop="startW">                <el-input v-model="temp.startW" type="number" style="width:100%" />              </el-form-item>            </el-col>            <el-col :span="12">              <el-form-item label="结束重量:" prop="stopW">                <el-input v-model="temp.stopW" type="number" style="width:100%" />              </el-form-item>            </el-col>          </el-row>          <div style="width: 100%;height: 100px;border-radius: 10px;border: 1px solid #001528;color: #000;font-size: 20px;line-height: 100px;margin-top: 20px;margin-bottom: 20px;padding-left: 20px;">            <el-row>信息:{{ temp.feedstr }}</el-row>          </div>          <el-row style="width: 500px;margin: 0 auto;">            <el-button :disabled="isokDisable" class="successBorder" style="height:60px;width:80px;" @click="handleSubmit(1)">F1</el-button>            <el-button :disabled="isokDisable" class="successBorder" style="height:60px;width:80px;" @click="handleSubmit(2)">F2</el-button>            <el-button :disabled="isokDisable" class="successBorder" style="height:60px;width:80px;" @click="handleSubmit(3)">F3</el-button>            <el-button :disabled="isokDisable" class="successBorder" style="height:60px;width:80px;" @click="handleSubmit(4)">F4</el-button>            <el-button :disabled="isokDisable" class="successBorder" style="height:60px;width:80px;" @click="handleSubmit(5)">F5</el-button>          </el-row>        </el-form>      </el-col>      <el-col :span="12">        <el-form ref="temp" :rules="rules" :model="temp" label-position="right" label-width="130px" style="width: 100%">          <el-row>            <el-row>              <el-col :span="12">                <el-form-item label="实时重量:">                  <el-input v-model="temp.SW" type="number" style="width:100%" />                </el-form-item>              </el-col>              <el-col :span="12">                <el-button :disabled="isokDisable" class="successBorder" style="margin-left: 10px;" @click="handleInput()">录入</el-button>              </el-col>            </el-row>          </el-row>        </el-form></el-col>    </el-row>  </div></template><script>import { GetDataByName, failproccess } from '@/api/common'import Cookies from 'js-cookie'export default {  name: 'HardwareTest',  data() {    return {      rules: {        eqcode: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],        startW: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],        stopW: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }]      },      getTmrListParam: {        name: 'getTMRListTest',        page: 1,        offset: 1,        pagecount: 10,        returntype: 'Map',        parammaps: {          pastureid: Cookies.get('pastureid'),          eqcode: ''        }      },      searchList: [],      temp: {        tmrid: '',        startW: '',        stopW: '',        SW: ''      },      requestParam: {},      isokDisable: false    }  },  created() { },  methods: {    tmrSearch(queryString, cb) {      this.getTmrListParam.parammaps.eqcode = queryString      GetDataByName(this.getTmrListParam).then(response => {        if (response.data.list !== null) {          this.searchList = response.data.list          cb(this.searchList)        } else {          cb([])        }      })    },    handleTmrSelect(item) {      console.log(item)      this.temp.eqcode = item.eqcode      this.temp.tmrid = item.id      this.temp.datacaptureno = item.datacaptureno    },    handleSubmit(item) {      this.$refs['temp'].validate(valid => {        if (valid) {          this.isokDisable = true          setTimeout(() => {            this.isokDisable = false          }, 1000)          this.requestParam.name = 'ProcNewButtonTest'          this.requestParam.parammaps = {}          this.requestParam.parammaps.pastureid = Cookies.get('pastureid')          if (item == 1) {            this.requestParam.parammaps.InButtonType = '241'          } else if (item == 2) {            this.requestParam.parammaps.InButtonType = '242'          } else if (item == 3) {            this.requestParam.parammaps.InButtonType = '243'          } else if (item == 4) {            this.requestParam.parammaps.InButtonType = '244'          } else if (item == 5) {            this.requestParam.parammaps.InButtonType = '245'          }          this.requestParam.parammaps.startW = this.temp.startW          this.requestParam.parammaps.stopW = this.temp.stopW          this.requestParam.parammaps.tmrid = this.temp.tmrid          GetDataByName(this.requestParam).then(response => {            if (response.msg !== 'fail') {              this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })              if (response.data.list !== null) {                this.temp.feedstr = response.data.list[0].feedstr              } else {                this.temp.feedstr = ''              }              this.temp.startW = this.temp.stopW            } else {              failproccess(response, this.$notify)            }          })        }      })    },    handleInput() {      this.isokDisable = true      setTimeout(() => {        this.isokDisable = false      }, 1000)      this.requestParam.name = 'setRealWeighttest'      this.requestParam.parammaps = {}      this.requestParam.parammaps.pastureid = Cookies.get('pastureid')      this.requestParam.parammaps.SW = this.temp.SW      this.requestParam.parammaps.datacaptureno = this.temp.datacaptureno      this.requestParam.parammaps.tmrid = this.temp.tmrid      GetDataByName(this.requestParam).then(response => {        if (response.msg !== 'fail') {          this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })          // if (response.data.list !== null) {          //   this.temp.feedstr = response.data.list[0].feedstr          // } else {          //   this.temp.feedstr = ''          // }        } else {          failproccess(response, this.$notify)        }      })    }  }}</script>
 |