checkResult.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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: 20rpx 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==1">合格</span>
  31. <span style="width: 30%;text-align: right;" v-if="data.state==2">不合格</span>
  32. <span style="width: 30%;text-align: right;" v-if="data.state==0">未检测</span>
  33. </li>
  34. </ul>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. import { getSampleList,getIsolationpointsList} from "../../api/sampling.js"
  40. export default {
  41. data() {
  42. return {
  43. formData: {
  44. valueIsolationPiont:'',
  45. valueSamplingBatch:''
  46. },
  47. sampleList:[],
  48. dataSamplingBatch:[
  49. { value: 1, text: "第一批" },
  50. { value: 2, text: "第二批" },
  51. { value: 3, text: "第三批" }
  52. ],
  53. IsolationPiont:[],
  54. };
  55. },
  56. methods:{
  57. search(){
  58. console.log(this.formData)
  59. getSampleList(this.formData).then(res=>{
  60. this.sampleList = res
  61. for(let i = 0 ;i<this.sampleList.length;i++){
  62. this.sampleList[i].value = this.sampleList.state
  63. }
  64. })
  65. },
  66. },
  67. onLoad() {
  68. getIsolationpointsList().then(res=>{
  69. // console.log(res.data)
  70. const arr = res.map(item=>{
  71. return {"text":item.IsolationPiontName,"value":item.Code}
  72. })
  73. console.log(arr)
  74. this.IsolationPiont = arr
  75. })
  76. }
  77. }
  78. </script>
  79. <style>
  80. page{
  81. background-color: #Faf8f8;
  82. }
  83. </style>
  84. <style lang="scss" scoped>
  85. /deep/ .uni-forms-item{
  86. display: flex;
  87. align-items: center;
  88. margin: 0 40rpx;
  89. font-size: 35rpx;
  90. }
  91. /deep/ .uni-forms{
  92. flex-grow: 1;
  93. }
  94. .samList-ul{
  95. margin: 20rpx 40rpx;
  96. background-color: white;
  97. padding: 20rpx;
  98. line-height: 100rpx;
  99. }
  100. .samList-li{
  101. display: flex;
  102. justify-content: space-between;
  103. }
  104. </style>