cb420d31add52b5eeee840ac0fa6c0f9a9a93c93.svn-base 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <template>
  2. <div class="app-container">
  3. <el-row :gutter="20">
  4. <el-col :span="12">
  5. <el-form ref="temp" :rules="rules" :model="temp" label-position="right" label-width="130px" style="width: 100%">
  6. <el-row>
  7. <el-col :span="24">
  8. <el-form-item label="TMR列表:" prop="eqcode">
  9. <el-autocomplete v-model="temp.eqcode" class="inline-input" :fetch-suggestions="tmrSearch" placeholder="TMR列表" style="width:100%" @select="handleTmrSelect">
  10. <template slot-scope="{ item }">
  11. <b>设备名称:</b>{{ item.tname }}
  12. &nbsp;&nbsp;|&nbsp;&nbsp;<b>设备编号:</b>{{ item.eqcode }}
  13. </template>
  14. </el-autocomplete>
  15. </el-form-item>
  16. </el-col>
  17. </el-row>
  18. <el-row>
  19. <el-col :span="12">
  20. <el-form-item label="开始重量:" prop="startW">
  21. <el-input v-model="temp.startW" type="number" style="width:100%" />
  22. </el-form-item>
  23. </el-col>
  24. <el-col :span="12">
  25. <el-form-item label="结束重量:" prop="stopW">
  26. <el-input v-model="temp.stopW" type="number" style="width:100%" />
  27. </el-form-item>
  28. </el-col>
  29. </el-row>
  30. <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;">
  31. <el-row>信息:{{ temp.feedstr }}</el-row>
  32. </div>
  33. <el-row style="width: 500px;margin: 0 auto;">
  34. <el-button :disabled="isokDisable" class="successBorder" style="height:60px;width:80px;" @click="handleSubmit(1)">F1</el-button>
  35. <el-button :disabled="isokDisable" class="successBorder" style="height:60px;width:80px;" @click="handleSubmit(2)">F2</el-button>
  36. <el-button :disabled="isokDisable" class="successBorder" style="height:60px;width:80px;" @click="handleSubmit(3)">F3</el-button>
  37. <el-button :disabled="isokDisable" class="successBorder" style="height:60px;width:80px;" @click="handleSubmit(4)">F4</el-button>
  38. <el-button :disabled="isokDisable" class="successBorder" style="height:60px;width:80px;" @click="handleSubmit(5)">F5</el-button>
  39. </el-row>
  40. </el-form>
  41. </el-col>
  42. <el-col :span="12">
  43. <el-form ref="temp" :rules="rules" :model="temp" label-position="right" label-width="130px" style="width: 100%">
  44. <el-row>
  45. <el-row>
  46. <el-col :span="12">
  47. <el-form-item label="实时重量:">
  48. <el-input v-model="temp.SW" type="number" style="width:100%" />
  49. </el-form-item>
  50. </el-col>
  51. <el-col :span="12">
  52. <el-button :disabled="isokDisable" class="successBorder" style="margin-left: 10px;" @click="handleInput()">录入</el-button>
  53. </el-col>
  54. </el-row>
  55. </el-row>
  56. </el-form></el-col>
  57. </el-row>
  58. </div>
  59. </template>
  60. <script>
  61. import { GetDataByName, failproccess } from '@/api/common'
  62. import Cookies from 'js-cookie'
  63. export default {
  64. name: 'HardwareTest',
  65. data() {
  66. return {
  67. rules: {
  68. eqcode: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
  69. startW: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
  70. stopW: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }]
  71. },
  72. getTmrListParam: {
  73. name: 'getTMRListTest',
  74. page: 1,
  75. offset: 1,
  76. pagecount: 10,
  77. returntype: 'Map',
  78. parammaps: {
  79. pastureid: Cookies.get('pastureid'),
  80. eqcode: ''
  81. }
  82. },
  83. searchList: [],
  84. temp: {
  85. tmrid: '',
  86. startW: '',
  87. stopW: '',
  88. SW: ''
  89. },
  90. requestParam: {},
  91. isokDisable: false
  92. }
  93. },
  94. created() { },
  95. methods: {
  96. tmrSearch(queryString, cb) {
  97. this.getTmrListParam.parammaps.eqcode = queryString
  98. GetDataByName(this.getTmrListParam).then(response => {
  99. if (response.data.list !== null) {
  100. this.searchList = response.data.list
  101. cb(this.searchList)
  102. } else {
  103. cb([])
  104. }
  105. })
  106. },
  107. handleTmrSelect(item) {
  108. console.log(item)
  109. this.temp.eqcode = item.eqcode
  110. this.temp.tmrid = item.id
  111. this.temp.datacaptureno = item.datacaptureno
  112. },
  113. handleSubmit(item) {
  114. this.$refs['temp'].validate(valid => {
  115. if (valid) {
  116. this.isokDisable = true
  117. setTimeout(() => {
  118. this.isokDisable = false
  119. }, 1000)
  120. this.requestParam.name = 'ProcNewButtonTest'
  121. this.requestParam.parammaps = {}
  122. this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
  123. if (item == 1) {
  124. this.requestParam.parammaps.InButtonType = '241'
  125. } else if (item == 2) {
  126. this.requestParam.parammaps.InButtonType = '242'
  127. } else if (item == 3) {
  128. this.requestParam.parammaps.InButtonType = '243'
  129. } else if (item == 4) {
  130. this.requestParam.parammaps.InButtonType = '244'
  131. } else if (item == 5) {
  132. this.requestParam.parammaps.InButtonType = '245'
  133. }
  134. this.requestParam.parammaps.startW = this.temp.startW
  135. this.requestParam.parammaps.stopW = this.temp.stopW
  136. this.requestParam.parammaps.tmrid = this.temp.tmrid
  137. GetDataByName(this.requestParam).then(response => {
  138. if (response.msg !== 'fail') {
  139. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  140. if (response.data.list !== null) {
  141. this.temp.feedstr = response.data.list[0].feedstr
  142. } else {
  143. this.temp.feedstr = ''
  144. }
  145. this.temp.startW = this.temp.stopW
  146. } else {
  147. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  148. }
  149. })
  150. }
  151. })
  152. },
  153. handleInput() {
  154. this.isokDisable = true
  155. setTimeout(() => {
  156. this.isokDisable = false
  157. }, 1000)
  158. this.requestParam.name = 'setRealWeighttest'
  159. this.requestParam.parammaps = {}
  160. this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
  161. this.requestParam.parammaps.SW = this.temp.SW
  162. this.requestParam.parammaps.datacaptureno = this.temp.datacaptureno
  163. this.requestParam.parammaps.tmrid = this.temp.tmrid
  164. GetDataByName(this.requestParam).then(response => {
  165. if (response.msg !== 'fail') {
  166. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  167. // if (response.data.list !== null) {
  168. // this.temp.feedstr = response.data.list[0].feedstr
  169. // } else {
  170. // this.temp.feedstr = ''
  171. // }
  172. } else {
  173. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  174. }
  175. })
  176. }
  177. }
  178. }
  179. </script>