查询
This commit is contained in:
@@ -17,7 +17,7 @@ export const reqGetWeldJointByWeldJointId = (id) => get(`PipeJoint/getWeldJointB
|
||||
|
||||
/**
|
||||
* 搜索筛选焊口(下料/组对等中间页)
|
||||
* @param {Object} params - { projectId, keyword?, pageIndex?, pageSize? }
|
||||
* @param {Object} params - { projectId, pipelineCode?, weldJointCode?, pageIndex?, pageSize? }
|
||||
*/
|
||||
export const reqPipeJointWeldedJoints = (params = {}) => request('PipeJoint/GetWeldedJoints', {
|
||||
method: 'GET',
|
||||
@@ -246,13 +246,6 @@ export const reqAuditWeldingDaily = (data = {}) => post(`/PreWeldingDaily/AuditP
|
||||
*/
|
||||
export const reqDeleteWeldingDaily = (data = {}) => post(`/PreWeldingDaily/DeletePendingWeldingDailyTempDetails`, data)
|
||||
|
||||
// ========================= 焊缝外观检测 ====================================
|
||||
/**
|
||||
* 分页查询当前项目中已焊接的焊口
|
||||
* @param {Object} params - { projectId, pipelineCode?, weldJointCode?, pageIndex?, pageSize? }
|
||||
*/
|
||||
export const reqWeldedJoints = (params = {}) => get('/WeldAppearanceCheck/GetWeldedJoints', params)
|
||||
|
||||
/**
|
||||
* 查询焊口基础信息及历史外观检测记录
|
||||
* @param {String} weldJointId 焊口ID
|
||||
|
||||
+2
-2
@@ -90,7 +90,7 @@ import { ref, onMounted } from 'vue'
|
||||
import { onShow, onReachBottom } from '@dcloudio/uni-app'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { useUserStore } from '@/store'
|
||||
|
||||
import { reqToDoItemByProjectIdUserId } from '@/api/base'
|
||||
const userStore = useUserStore()
|
||||
const { userInfo, currentProject } = storeToRefs(userStore)
|
||||
|
||||
@@ -140,7 +140,7 @@ async function onRefresh() {
|
||||
}
|
||||
|
||||
// ===== 模拟数据(开发调试用,上线前改为 false) =====
|
||||
const USE_MOCK = true
|
||||
const USE_MOCK = false
|
||||
|
||||
const mockData = [
|
||||
{
|
||||
|
||||
@@ -1,33 +1,52 @@
|
||||
<template>
|
||||
<view class="search-page">
|
||||
<!-- 顶部:输入框内扫码(类似淘宝搜索) -->
|
||||
<view class="search-bar">
|
||||
<view class="search-bar__input-wrap">
|
||||
<!-- 顶部固定筛选:扫码 + 管线号/焊口号 + 重置/查询 -->
|
||||
<view class="filter-panel">
|
||||
<view class="filter-panel__row">
|
||||
<view
|
||||
class="filter-panel__scan"
|
||||
@click="handleScan"
|
||||
>
|
||||
<u-icon
|
||||
name="scan"
|
||||
:size="28"
|
||||
:size="36"
|
||||
color="#2979ff"
|
||||
@click="handleScan"
|
||||
/>
|
||||
</view>
|
||||
<view class="filter-panel__fields">
|
||||
<view class="filter-panel__item filter-panel__item--pipe">
|
||||
<input
|
||||
class="search-bar__input"
|
||||
v-model="keyword"
|
||||
class="filter-panel__input"
|
||||
v-model="pipelineCode"
|
||||
type="text"
|
||||
placeholder="管线号"
|
||||
confirm-type="search"
|
||||
:placeholder="placeholder"
|
||||
:focus="autoFocus"
|
||||
@input="handleSearchInput"
|
||||
@confirm="handleSearchConfirm"
|
||||
@confirm="handleSearch"
|
||||
/>
|
||||
<u-icon
|
||||
v-if="keyword"
|
||||
name="close-circle-fill"
|
||||
:size="28"
|
||||
color="#ccc"
|
||||
@click="handleClear"
|
||||
</view>
|
||||
<view class="filter-panel__item filter-panel__item--joint">
|
||||
<input
|
||||
class="filter-panel__input"
|
||||
v-model="weldJointCode"
|
||||
type="text"
|
||||
placeholder="焊口号"
|
||||
confirm-type="search"
|
||||
@confirm="handleSearch"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="filter-panel__actions">
|
||||
<view
|
||||
class="filter-panel__btn filter-panel__btn--reset"
|
||||
@click="handleReset"
|
||||
>重置</view>
|
||||
<view
|
||||
class="filter-panel__btn filter-panel__btn--search"
|
||||
@click="handleSearch"
|
||||
>查询</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 结果列表 -->
|
||||
<scroll-view
|
||||
@@ -66,7 +85,7 @@
|
||||
v-if="!searched && !loading"
|
||||
class="result-hint"
|
||||
>
|
||||
<text>扫码或输入焊口/管线编号搜索</text>
|
||||
<text>扫码,或输入管线号 / 焊口号后点击查询</text>
|
||||
</view>
|
||||
|
||||
<view
|
||||
@@ -93,7 +112,7 @@
|
||||
|
||||
<script setup>
|
||||
/**
|
||||
* 焊口搜索中间页:扫码进入业务页,或关键字搜索后点选进入
|
||||
* 焊口搜索中间页:扫码进入业务页,或按管线号/焊口号搜索后点选进入
|
||||
* 入参:target(业务页路径)、title(导航标题)
|
||||
*/
|
||||
import { ref } from 'vue'
|
||||
@@ -109,17 +128,20 @@ const { currentProject } = storeToRefs(userStore)
|
||||
|
||||
/** 业务目标页,如 /scanpages/hj/material_sampling */
|
||||
const targetPath = ref('')
|
||||
const placeholder = ref('搜索焊口')
|
||||
const autoFocus = ref(true)
|
||||
|
||||
const keyword = ref('')
|
||||
const pipelineCode = ref('')
|
||||
const weldJointCode = ref('')
|
||||
const listData = ref([])
|
||||
const loading = ref(false)
|
||||
const searched = ref(false)
|
||||
const hasMore = ref(true)
|
||||
const currentPage = ref(1)
|
||||
const pageSize = 20
|
||||
let searchTimer = null
|
||||
|
||||
/**
|
||||
* 是否有可搜索条件
|
||||
*/
|
||||
const hasKeyword = () => !!(pipelineCode.value.trim() || weldJointCode.value.trim())
|
||||
|
||||
/**
|
||||
* 从接口响应取出列表
|
||||
@@ -146,14 +168,13 @@ const clearList = () => {
|
||||
* @param {boolean} isRefresh
|
||||
*/
|
||||
const loadList = async (isRefresh = true) => {
|
||||
const kw = keyword.value.trim()
|
||||
const projectId = currentProject.value?.ProjectId
|
||||
if (!projectId) {
|
||||
uni.showToast({ title: '请先选择项目', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (!kw) {
|
||||
clearList()
|
||||
if (!hasKeyword()) {
|
||||
uni.showToast({ title: '请输入管线号或焊口号', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (loading.value) return
|
||||
@@ -169,7 +190,8 @@ const loadList = async (isRefresh = true) => {
|
||||
try {
|
||||
const res = await reqPipeJointWeldedJoints({
|
||||
projectId,
|
||||
keyword: kw,
|
||||
pipelineCode: pipelineCode.value.trim() || undefined,
|
||||
weldJointCode: weldJointCode.value.trim() || undefined,
|
||||
pageIndex: currentPage.value,
|
||||
pageSize,
|
||||
})
|
||||
@@ -195,30 +217,20 @@ const loadList = async (isRefresh = true) => {
|
||||
}
|
||||
}
|
||||
|
||||
const handleSearchInput = () => {
|
||||
if (searchTimer) clearTimeout(searchTimer)
|
||||
searchTimer = setTimeout(() => {
|
||||
const kw = keyword.value.trim()
|
||||
if (!kw) {
|
||||
clearList()
|
||||
return
|
||||
}
|
||||
loadList(true)
|
||||
}, 400)
|
||||
}
|
||||
|
||||
const handleSearchConfirm = () => {
|
||||
if (searchTimer) clearTimeout(searchTimer)
|
||||
/** 点击查询 */
|
||||
const handleSearch = () => {
|
||||
loadList(true)
|
||||
}
|
||||
|
||||
const handleClear = () => {
|
||||
keyword.value = ''
|
||||
/** 重置条件与结果 */
|
||||
const handleReset = () => {
|
||||
pipelineCode.value = ''
|
||||
weldJointCode.value = ''
|
||||
clearList()
|
||||
}
|
||||
|
||||
const loadMore = () => {
|
||||
if (!loading.value && hasMore.value && keyword.value.trim()) {
|
||||
if (!loading.value && hasMore.value && hasKeyword()) {
|
||||
currentPage.value += 1
|
||||
loadList(false)
|
||||
}
|
||||
@@ -298,31 +310,91 @@ onLoad((opt) => {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.search-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.filter-panel {
|
||||
flex-shrink: 0;
|
||||
padding: 16rpx 24rpx;
|
||||
background: #fff;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 10;
|
||||
|
||||
&__input-wrap {
|
||||
flex: 1;
|
||||
&__row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
&__scan {
|
||||
flex-shrink: 0;
|
||||
width: 72rpx;
|
||||
height: 72rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
padding: 0 20rpx;
|
||||
justify-content: center;
|
||||
background: #f5f6f8;
|
||||
border-radius: 36rpx;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
|
||||
&__fields {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
}
|
||||
|
||||
&__item {
|
||||
min-width: 0;
|
||||
height: 72rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 16rpx;
|
||||
background: #f5f6f8;
|
||||
border-radius: 12rpx;
|
||||
|
||||
&--pipe {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
&--joint {
|
||||
flex: none;
|
||||
width: 140rpx;
|
||||
}
|
||||
}
|
||||
|
||||
&__input {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
height: 72rpx;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
&__actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
margin-top: 16rpx;
|
||||
}
|
||||
|
||||
&__btn {
|
||||
flex: 1;
|
||||
height: 72rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 28rpx;
|
||||
border-radius: 12rpx;
|
||||
|
||||
&--reset {
|
||||
color: #666;
|
||||
background: #f5f6f8;
|
||||
}
|
||||
|
||||
&--search {
|
||||
color: #fff;
|
||||
background: #2979ff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -91,8 +91,7 @@ export const defaultApps = [{
|
||||
name: '焊缝检测',
|
||||
icon: 'search',
|
||||
menuId: "",
|
||||
path: "/scanpages/hj/weld_appearance",
|
||||
isScan: true,
|
||||
path: "/scanpages/hj/weld_joint_search?target=%2Fscanpages%2Fhj%2Fweld_appearance&title=%E7%84%8A%E7%BC%9D%E6%A3%80%E6%B5%8B",
|
||||
prefix: 'uicon',
|
||||
selected: false
|
||||
},
|
||||
|
||||
+3
-4
@@ -95,12 +95,11 @@ export function request(url, options = {}) {
|
||||
* 兼容两种调用方式:
|
||||
* get('/path?key=val') 旧风格(URL 自带参数)
|
||||
* get('/path', { key: 'val' }) 新风格(参数对象,自动编码)
|
||||
* 不可对形参 url 做 += 重赋值,正式版 Babel 会把形参编译为只读,触发 "a" is read-only
|
||||
*/
|
||||
export const get = (url, params) => {
|
||||
if (params) {
|
||||
url += toQueryString(params)
|
||||
}
|
||||
return request(url, { method: 'GET' })
|
||||
const fullUrl = params ? `${url}${toQueryString(params)}` : url
|
||||
return request(fullUrl, { method: 'GET' })
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user