inputDetectionResult.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <template>
  2. <view>
  3. <view style="display: flex;justify-content: space-around;">
  4. <uni-forms ref="form" :modelValue="formData" >
  5. <uni-forms-item label="隔离点" name="IsolationPiontName" >
  6. <uni-data-select
  7. v-model="formData.valueIsolationPiont"
  8. :localdata="IsolationPiont"
  9. @change="changeIsolationPiont"
  10. :clear="false"
  11. ></uni-data-select>
  12. <!-- <input type="text" v-model="formData.IsolationPiontName" placeholder="请输入隔离点" /> -->
  13. </uni-forms-item>
  14. <uni-forms-item label="批次" name="SamplingBatch">
  15. <uni-data-select style="width: 100%;"
  16. v-model="formData.valueSamplingBatch"
  17. :localdata="dataSamplingBatch"
  18. @change="changeSamplingBatch"
  19. :clear="false"
  20. ></uni-data-select>
  21. </uni-forms-item>
  22. </uni-forms>
  23. <button @click="search()" style="margin: 10rpx;background-color: #1296db;color: white;text-align: center;">搜索</button>
  24. </view>
  25. <view>
  26. <text style="margin: 60rpx 60rpx;font-weight: bold;font-size: 40rpx;">样品列表</text>
  27. <ul class="samList-ul">
  28. <li class="samList-li" v-for="data in sampleList" :key="data.id">
  29. <span>{{data.name}}</span>
  30. <span style="width: 30%;text-align: right;" v-if="data.state==2||data.state==1">已检测</span>
  31. <span v-else style="width: 30%;">
  32. <uni-data-select
  33. v-model="data.value"
  34. :localdata="range"
  35. @change="change()"
  36. :clear="false"
  37. ></uni-data-select>
  38. </span>
  39. </li>
  40. </ul>
  41. </view>
  42. <view class="btn-box" style="position: fixed;bottom: 10%;width: 100%;">
  43. <button @click="submitF()" style="margin: 20rpx 40rpx;background-color: #1296db;color: #ffffff;" >提交</button>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. import { getSampleList,getIsolationpointsList,addResult } from "../../api/sampling.js"
  49. export default {
  50. data() {
  51. return {
  52. formData: {
  53. valueIsolationPiont:'',
  54. valueSamplingBatch:''
  55. },
  56. sampleList:[
  57. ],
  58. range: [
  59. { value: 1, text: "合格" },
  60. { value: 2, text: "不合格" },
  61. ],
  62. IsolationPiont:[],
  63. dataSamplingBatch:[
  64. { value: 1, text: "第一批" },
  65. { value: 2, text: "第二批" },
  66. { value: 3, text: "第三批" }
  67. ],
  68. };
  69. },
  70. methods:{
  71. search(){
  72. console.log(this.formData)
  73. getSampleList(this.formData).then(res=>{
  74. this.sampleList = res
  75. for(let i = 0 ;i<this.sampleList.length;i++){
  76. this.sampleList[i].value = this.sampleList.state
  77. }
  78. })
  79. },
  80. change(e,data) {
  81. console.log("e:", e)
  82. },
  83. changeIsolationPiont(e){
  84. console.log("e:", e);
  85. },
  86. changeSamplingBatch(e){
  87. console.log("e:", e);
  88. },
  89. submitF(){
  90. console.log(this.sampleList)
  91. for(let i = 0 ; i< this.sampleList.length;i++){
  92. if(this.sampleList[i].value===undefined){
  93. this.$delete(this.sampleList[i],"value")
  94. }else{
  95. this.sampleList[i].state = this.sampleList[i].value
  96. this.$delete(this.sampleList[i],"value")
  97. }
  98. }
  99. console.log(this.sampleList)
  100. const data={
  101. IsolationPiont:this.formData.valueIsolationPiont,
  102. SamplingBatch:this.formData.valueSamplingBatch,
  103. SampleList:this.sampleList
  104. }
  105. addResult(data).then(res=>{
  106. console.log(res)
  107. })
  108. }
  109. },
  110. onLoad() {
  111. getIsolationpointsList().then(res=>{
  112. // console.log(res.data)
  113. const arr = res.map(item=>{
  114. return {"text":item.IsolationPiontName,"value":item.Code}
  115. })
  116. console.log(arr)
  117. this.IsolationPiont = arr
  118. // console.log("a",this.IsolationPiont)
  119. })
  120. }
  121. }
  122. </script>
  123. <style>
  124. page{
  125. background-color: #Faf8f8;
  126. }
  127. </style>
  128. <style lang="scss" scoped>
  129. /deep/ .uni-forms-item{
  130. display: flex;
  131. align-items: center;
  132. margin: 0 40rpx;
  133. font-size: 35rpx;
  134. }
  135. /deep/ .uni-forms{
  136. flex-grow: 1;
  137. }
  138. .samList-ul{
  139. margin: 20rpx 40rpx;
  140. background-color: white;
  141. padding: 20rpx;
  142. line-height: 100rpx;
  143. }
  144. .samList-li{
  145. display: flex;
  146. justify-content: space-between;
  147. }
  148. </style>