options.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <template>
  2. <view class="page-container uni-column">
  3. <view class="option-container uni-column">
  4. <!-- 搜索框 -->
  5. <view class="search-container uni-row">
  6. <input type="text" v-model="standard" placeholder="请输入检查标准" />
  7. <view class="btn" @click="handleSelect">搜索</view>
  8. </view>
  9. <!-- 选项 -->
  10. <view class="option-item" v-for="(item, index) in optionList" :key="index" @click="handleOptionChecked(item)">
  11. <view class="uni-row">
  12. <view class="label">检查标准</view>
  13. <view class="value">{{ item.standard }}</view>
  14. </view>
  15. <uni-icons class="arrow-right" type="right" size="24" />
  16. </view>
  17. </view>
  18. </view>
  19. </template>
  20. <script setup>
  21. import { ref } from 'vue'
  22. import { onLoad, onReady, onUnload, onShow } from '@dcloudio/uni-app'
  23. import {
  24. getInspectionStandardsList
  25. } from '@/api/business/inspectionStandards.js'
  26. const standard = ref('')
  27. const optionList = ref([])
  28. const productId = ref(null)
  29. const processId = ref(null)
  30. // 页面生命周期函数
  31. onLoad((options) => {
  32. productId.value = options.param1
  33. processId.value = options.param2
  34. init();
  35. })
  36. function init() {
  37. //查询该产品,当前工序,当前检查绑定的检查
  38. getInspectionStandardsList({
  39. productId:productId.value,
  40. processId:processId.value,
  41. inspectionCode:"firstArticleInspection"
  42. }).then(res =>{
  43. optionList.value = res.rows
  44. })
  45. }
  46. function handleSelect() {
  47. getInspectionStandardsList({
  48. productId:productId.value,
  49. processId:processId.value,
  50. inspectionCode:"firstArticleInspection",
  51. standard:standard.value
  52. }).then(res =>{
  53. if(res.rows &&res.rows.length>0){
  54. optionList.value = res.rows
  55. }
  56. else{
  57. optionList.value = []
  58. }
  59. })
  60. }
  61. const handleOptionChecked = (data) => {
  62. console.log(data)
  63. uni.$emit('addWasteInfoEvent', {
  64. id: data.id,
  65. standard: data.standard
  66. })
  67. uni.navigateBack()
  68. }
  69. </script>
  70. <style lang="scss">
  71. .page-container {
  72. height: 100%;
  73. background-color: #ececec;
  74. font-size: 28rpx;
  75. padding: 24rpx;
  76. box-sizing: border-box;
  77. }
  78. .option-container {
  79. background-color: #ffffff;
  80. padding: 24rpx;
  81. border-radius: 12rpx;
  82. }
  83. .tab-bars {
  84. height: 56rpx;
  85. > view {
  86. flex: 1;
  87. text-align: center;
  88. .line {
  89. width: 50%;
  90. height: 2px;
  91. margin:8rpx auto 0 auto;
  92. background-color: #FFFFFF;
  93. }
  94. &.active {
  95. .line {
  96. background-color: #1684FC;
  97. }
  98. }
  99. }
  100. }
  101. .search-container {
  102. margin-top: 16rpx;
  103. align-items: center;
  104. input {
  105. flex: 1;
  106. height: 72rpx;
  107. border: 1px solid #bbbbbb;
  108. padding: 0 8rpx;
  109. box-sizing: border-box;
  110. }
  111. .btn {
  112. display: flex;
  113. flex-direction: row;
  114. width: 112rpx;
  115. height: 72rpx;
  116. align-items: center;
  117. justify-content: center;
  118. background-color: #1684FC;
  119. color: #ffffff;
  120. }
  121. }
  122. .option-item {
  123. position: relative;
  124. margin-top: 24rpx;
  125. padding-bottom: 8rpx;
  126. border-bottom: 1px solid #BBBBBB;
  127. .uni-row {
  128. padding-bottom: 16rpx;
  129. .label {
  130. width: 144rpx;
  131. }
  132. .value {
  133. flex: 1;
  134. }
  135. }
  136. .uni-row:first-child {
  137. font-size: 32rpx;
  138. font-weight: 700;
  139. }
  140. .arrow-right {
  141. position: absolute;
  142. right: 24rpx;
  143. }
  144. }
  145. </style>