| | |
| | | filterable |
| | | remote |
| | | reserve-keyword |
| | | placeholder="请输入生产订单号" |
| | | placeholder="请输入生产订单号搜索" |
| | | :loading="npsNoLoading" |
| | | :remote-method="handleNpsNoSearch" |
| | | @change="handleSearch" |
| | |
| | | :key="option.id" |
| | | :label="option.npsNo + '-' + option.productName + '-' + option.model" |
| | | :value="option.id" /> |
| | | <template #footer> |
| | | <div v-if="npsNoHasMore" |
| | | class="select-load-more" |
| | | @click="loadMoreNpsNo"> |
| | | <span v-if="npsNoLoadingMore">加载中...</span> |
| | | <span v-else>点击加载更多</span> |
| | | </div> |
| | | <div v-else-if="npsNoOptions.length > 0" |
| | | class="select-load-more no-more"> |
| | | 没有更多了 |
| | | </div> |
| | | </template> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-form> |
| | |
| | | }); |
| | | const selectedNpsNo = ref(null); |
| | | const npsNoLoading = ref(false); |
| | | const npsNoLoadingMore = ref(false); |
| | | const npsNoOptions = ref([]); |
| | | const npsNoPage = reactive({ current: 1, size: 20, total: 0 }); |
| | | const npsNoHasMore = computed(() => npsNoOptions.value.length < npsNoPage.total); |
| | | const npsNoSearchKeyword = ref(""); |
| | | |
| | | // 详情数据 |
| | | const rowData = reactive({ |
| | |
| | | return "#67c23a"; |
| | | }; |
| | | |
| | | // 模拟搜索方法 |
| | | const handleNpsNoSearch = async query => { |
| | | npsNoSearchKeyword.value = query || ""; |
| | | npsNoPage.current = 1; |
| | | npsNoOptions.value = []; |
| | | npsNoLoading.value = true; |
| | | try { |
| | | const res = await productOrderListPage({ |
| | | npsNo: query || "", |
| | | pageNum: 1, |
| | | pageSize: 50, |
| | | current: npsNoPage.current, |
| | | size: npsNoPage.size, |
| | | }); |
| | | // 参照 productionOrder/index.vue 的数据结构 res.data.records |
| | | npsNoOptions.value = res.data?.records || res.rows || []; |
| | | const records = res.data?.records || []; |
| | | npsNoOptions.value = records; |
| | | npsNoPage.total = res.data?.total || 0; |
| | | } catch (error) { |
| | | console.error(error); |
| | | } finally { |
| | | npsNoLoading.value = false; |
| | | } |
| | | }; |
| | | |
| | | const loadMoreNpsNo = async () => { |
| | | if (npsNoLoadingMore.value || !npsNoHasMore.value) return; |
| | | npsNoLoadingMore.value = true; |
| | | npsNoPage.current++; |
| | | try { |
| | | const res = await productOrderListPage({ |
| | | npsNo: npsNoSearchKeyword.value, |
| | | current: npsNoPage.current, |
| | | size: npsNoPage.size, |
| | | }); |
| | | const records = res.data?.records || []; |
| | | npsNoOptions.value = [...npsNoOptions.value, ...records]; |
| | | npsNoPage.total = res.data?.total || 0; |
| | | } catch (error) { |
| | | console.error(error); |
| | | npsNoPage.current--; |
| | | } finally { |
| | | npsNoLoadingMore.value = false; |
| | | } |
| | | }; |
| | | |
| | |
| | | .param-detail-list { |
| | | padding: 10px; |
| | | } |
| | | |
| | | .select-load-more { |
| | | text-align: center; |
| | | padding: 8px 0; |
| | | font-size: 13px; |
| | | color: #409eff; |
| | | cursor: pointer; |
| | | border-top: 1px solid #ebeef5; |
| | | |
| | | &:hover { |
| | | background-color: #f5f7fa; |
| | | } |
| | | |
| | | &.no-more { |
| | | color: #c0c4cc; |
| | | cursor: default; |
| | | |
| | | &:hover { |
| | | background-color: transparent; |
| | | } |
| | | } |
| | | } |
| | | </style> |