| | |
| | | <template> |
| | | <view class="page-container"> |
| | | <!-- 刷新提示框 --> |
| | | <view class="success-toast" :class="{ 'show': tipShow }"> |
| | | <view class="toast-icon">✓</view> |
| | | <text class="toast-text">刷新成功</text> |
| | | </view> |
| | | <view class="page-container"> |
| | | <!-- 刷新提示框 --> |
| | | <view :class="{ 'show': tipShow }" class="success-toast"> |
| | | <view class="toast-icon">✓</view> |
| | | <text class="toast-text">刷新成功</text> |
| | | </view> |
| | | |
| | | <!-- 头部区域 --> |
| | | <view class="header-section"> |
| | | <!-- 页面标题 --> |
| | | <view class="page-header"> |
| | | <view class="header-content"> |
| | | <view class="title-section"> |
| | | <text class="page-title">OQC检验单</text> |
| | | <text class="page-subtitle">质量检验管理</text> |
| | | </view> |
| | | <view class="stats-badge"> |
| | | <text class="stats-number">{{ totalCount }}</text> |
| | | <text class="stats-label">总计</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <!-- 头部区域 --> |
| | | <view class="header-section"> |
| | | <!-- 页面标题 --> |
| | | <view class="page-header"> |
| | | <view class="header-content"> |
| | | <view class="title-section"> |
| | | <text class="page-title">OQC检验单</text> |
| | | <text class="page-subtitle">质量检验管理</text> |
| | | </view> |
| | | <view class="stats-badge"> |
| | | <text class="stats-number">{{ totalCount }}</text> |
| | | <text class="stats-label">总计</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 搜索栏 --> |
| | | <view class="search-section"> |
| | | <view class="search-container"> |
| | | <view class="search-input-wrapper"> |
| | | <uni-icons type="search" size="18" color="#94a3b8"></uni-icons> |
| | | <input class="search-input" type="text" v-model="searchValue" |
| | | @confirm="getInputValue" placeholder="搜索物料编码、物料名称、创建人员..." /> |
| | | <view v-if="searchValue" class="clear-btn" @tap="clearSearch"> |
| | | <uni-icons type="clear" size="16" color="#94a3b8"></uni-icons> |
| | | </view> |
| | | </view> |
| | | <view class="filter-btn" @tap="toggleFilter"> |
| | | <uni-icons type="tune" size="18" color="#4f46e5"></uni-icons> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 筛选器 --> |
| | | <view v-if="showFilter" class="filter-panel"> |
| | | <picker mode="selector" :range="searchOptions" v-model="selectedOption" @change="onPickerChange"> |
| | | <view class="filter-option"> |
| | | <text class="filter-label">筛选条件</text> |
| | | <text class="filter-value">{{ searchOptions[selectedOption] }}</text> |
| | | <uni-icons type="arrowdown" size="14" color="#64748b"></uni-icons> |
| | | </view> |
| | | </picker> |
| | | </view> |
| | | </view> |
| | | <!-- 搜索栏样式 --> |
| | | <view class="search-bar"> |
| | | <view class="search-card"> |
| | | <picker v-model="selectedOption" :range="searchOptions" mode="selector" @change="onPickerChange"> |
| | | <view class="picker"> |
| | | {{ searchOptions[selectedOption] }} |
| | | </view> |
| | | </picker> |
| | | <input v-model="searchValue" class="search-input" placeholder="请输入搜索值" type="text" |
| | | @keypress.enter="getInputValue"/> |
| | | <button class="search-btn" @click="getInputValue">搜索</button> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 选项卡 --> |
| | | <view class="tab-section"> |
| | | <view class="custom-tabs"> |
| | | <view v-for="(item, index) in items" :key="index" |
| | | class="tab-item" :class="{ 'active': current === index }" |
| | | @tap="onClickItem({ currentIndex: index })"> |
| | | <text class="tab-text">{{ item }}</text> |
| | | <view class="tab-indicator" v-if="current === index"></view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <!-- 选项卡 --> |
| | | <view class="tab-section"> |
| | | <view class="custom-tabs"> |
| | | <view v-for="(item, index) in items" :key="index" |
| | | :class="{ 'active': current === index }" class="tab-item" |
| | | @tap="onClickItem({ currentIndex: index })"> |
| | | <text class="tab-text">{{ item }}</text> |
| | | <view v-if="current === index" class="tab-indicator"></view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 内容区域 --> |
| | | <view class="content-container"> |
| | | <view v-show="current === 0"> |
| | | <!-- 加载状态 --> |
| | | <view v-if="isLoading" class="loading-state"> |
| | | <view class="loading-spinner"></view> |
| | | <text class="loading-text">加载中...</text> |
| | | </view> |
| | | |
| | | <!-- 空状态 --> |
| | | <view v-else-if="data.length === 0" class="empty-state"> |
| | | <view class="empty-icon">📋</view> |
| | | <text class="empty-title">暂无检验单</text> |
| | | <text class="empty-desc">点击右下角按钮创建新的检验单</text> |
| | | </view> |
| | | |
| | | <!-- 检验单列表 --> |
| | | <view v-else class="inspection-list"> |
| | | <view v-for="item in data" :key="item.id || item.releaseNo" |
| | | class="inspection-card" @tap="navigateToDetail(item)"> |
| | | |
| | | <!-- 卡片头部 --> |
| | | <view class="card-header"> |
| | | <view class="header-left"> |
| | | <view class="inspection-number"> |
| | | <text class="number-label">检验单号</text> |
| | | <text class="number-value">{{ item.releaseNo }}</text> |
| | | </view> |
| | | <view class="material-info"> |
| | | <text class="material-code">{{ item.itemNo }}</text> |
| | | <text class="material-name">{{ item.itemName || '未知物料' }}</text> |
| | | </view> |
| | | </view> |
| | | <view class="header-right"> |
| | | <view class="status-badge" |
| | | :class="{ |
| | | 'status-submitted': item.fsubmit == 1, |
| | | 'status-pending': item.fsubmit != 1 |
| | | }"> |
| | | <view class="status-dot"></view> |
| | | <text class="status-text">{{ item.fsubmit == 1 ? '已提交' : '待提交' }}</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 检验结果区域 --> |
| | | <view class="inspection-result"> |
| | | <view class="result-item"> |
| | | <view class="result-icon" |
| | | :class="{ |
| | | <!-- 内容区域 --> |
| | | <view class="content-container"> |
| | | <view v-show="current === 0"> |
| | | <!-- 加载状态 --> |
| | | <view v-if="isLoading" class="loading-state"> |
| | | <view class="loading-spinner"></view> |
| | | <text class="loading-text">加载中...</text> |
| | | </view> |
| | | |
| | | <!-- 空状态 --> |
| | | <view v-else-if="data.length === 0" class="empty-state"> |
| | | <view class="empty-icon">📋</view> |
| | | <text class="empty-title">暂无检验单</text> |
| | | <text class="empty-desc">点击右下角按钮创建新的检验单</text> |
| | | </view> |
| | | |
| | | <!-- 检验单列表 --> |
| | | <view v-else class="inspection-list"> |
| | | <view v-for="item in data" :key="item.id || item.releaseNo" |
| | | class="inspection-card" @tap="navigateToDetail(item)"> |
| | | |
| | | <!-- 卡片头部 --> |
| | | <view class="card-header"> |
| | | <view class="header-left"> |
| | | <view class="inspection-number"> |
| | | <text class="number-label">检验单号</text> |
| | | <text class="number-value">{{ item.releaseNo }}</text> |
| | | </view> |
| | | <view class="material-info"> |
| | | <text class="material-code">{{ item.itemNo }}</text> |
| | | <text class="material-name">{{ item.itemName || '未知物料' }}</text> |
| | | </view> |
| | | </view> |
| | | <view class="header-right"> |
| | | <view :class="{ |
| | | 'status-submitted': item.fsubmit == 1, |
| | | 'status-pending': item.fsubmit != 1 |
| | | }" |
| | | class="status-badge"> |
| | | <view class="status-dot"></view> |
| | | <text class="status-text">{{ item.fsubmit == 1 ? '已提交' : '待提交' }}</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 检验结果区域 --> |
| | | <view class="inspection-result"> |
| | | <view class="result-item"> |
| | | <view :class="{ |
| | | 'icon-pass': item.fcheckResu === '合格', |
| | | 'icon-fail': item.fcheckResu === '不合格', |
| | | 'icon-pending': !item.fcheckResu || item.fcheckResu === '未检验' |
| | | }"> |
| | | <text class="result-symbol">{{ |
| | | item.fcheckResu === '合格' ? '✓' : |
| | | item.fcheckResu === '不合格' ? '✗' : '○' |
| | | }}</text> |
| | | </view> |
| | | <view class="result-content"> |
| | | <text class="result-label">检验结果</text> |
| | | <text class="result-value" |
| | | :class="{ |
| | | }" |
| | | class="result-icon"> |
| | | <text class="result-symbol">{{ |
| | | item.fcheckResu === '合格' ? '✓' : |
| | | item.fcheckResu === '不合格' ? '✗' : '○' |
| | | }} |
| | | </text> |
| | | </view> |
| | | <view class="result-content"> |
| | | <text class="result-label">检验结果</text> |
| | | <text :class="{ |
| | | 'value-pass': item.fcheckResu === '合格', |
| | | 'value-fail': item.fcheckResu === '不合格', |
| | | 'value-pending': !item.fcheckResu || item.fcheckResu === '未检验' |
| | | }"> |
| | | {{ item.fcheckResu || '未检验' }} |
| | | </text> |
| | | </view> |
| | | </view> |
| | | |
| | | <view class="inspector-info"> |
| | | <text class="inspector-label">检验人</text> |
| | | <text class="inspector-name">{{ item.modify1By || '待分配' }}</text> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 详细信息 --> |
| | | <view class="card-details"> |
| | | <view class="detail-grid"> |
| | | <view class="detail-item"> |
| | | <text class="detail-label">创建时间</text> |
| | | <text class="detail-value">{{ item.createDate }}</text> |
| | | </view> |
| | | <view class="detail-item"> |
| | | <text class="detail-label">数量</text> |
| | | <text class="detail-value">{{ item.planQty }}</text> |
| | | </view> |
| | | <view class="detail-item"> |
| | | <text class="detail-label">创建人</text> |
| | | <text class="detail-value">{{ item.createUser }}</text> |
| | | </view> |
| | | <view class="detail-item"> |
| | | <text class="detail-label">送检人</text> |
| | | <text class="detail-value">{{ item.fcheckUser || '-' }}</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 操作指示器 --> |
| | | <view class="action-indicator"> |
| | | <uni-icons type="arrowright" size="16" color="#94a3b8"></uni-icons> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <!-- 第二个选项卡内容 - 已检验 --> |
| | | <view v-show="current === 1"> |
| | | <!-- 加载状态 --> |
| | | <view v-if="isLoading" class="loading-state"> |
| | | <view class="loading-spinner"></view> |
| | | <text class="loading-text">加载中...</text> |
| | | </view> |
| | | |
| | | <!-- 空状态 --> |
| | | <view v-else-if="data.length === 0" class="empty-state"> |
| | | <view class="empty-icon">✅</view> |
| | | <text class="empty-title">暂无已检验单据</text> |
| | | <text class="empty-desc">完成检验的单据将显示在这里</text> |
| | | </view> |
| | | |
| | | <!-- 检验单列表 --> |
| | | <view v-else class="inspection-list"> |
| | | <view v-for="item in data" :key="item.id || item.releaseNo" |
| | | class="inspection-card completed" @tap="navigateToDetail(item)"> |
| | | |
| | | <!-- 卡片头部 --> |
| | | <view class="card-header"> |
| | | <view class="header-left"> |
| | | <view class="inspection-number"> |
| | | <text class="number-label">检验单号</text> |
| | | <text class="number-value">{{ item.releaseNo }}</text> |
| | | </view> |
| | | <view class="material-info"> |
| | | <text class="material-code">{{ item.itemNo }}</text> |
| | | <text class="material-name">{{ item.itemName || '未知物料' }}</text> |
| | | </view> |
| | | </view> |
| | | <view class="header-right"> |
| | | <view class="status-badge status-completed"> |
| | | <view class="status-dot"></view> |
| | | <text class="status-text">已完成</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 检验结果区域 --> |
| | | <view class="inspection-result"> |
| | | <view class="result-item"> |
| | | <view class="result-icon" |
| | | :class="{ |
| | | }" |
| | | class="result-value"> |
| | | {{ item.fcheckResu || '未检验' }} |
| | | </text> |
| | | </view> |
| | | </view> |
| | | |
| | | <view class="inspector-info"> |
| | | <text class="inspector-label">检验人</text> |
| | | <text class="inspector-name">{{ item.modify1By || '待分配' }}</text> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 详细信息 --> |
| | | <view class="card-details"> |
| | | <view class="detail-grid"> |
| | | <view class="detail-item"> |
| | | <text class="detail-label">创建时间</text> |
| | | <text class="detail-value">{{ item.createDate }}</text> |
| | | </view> |
| | | <view class="detail-item"> |
| | | <text class="detail-label">数量</text> |
| | | <text class="detail-value">{{ item.planQty }}</text> |
| | | </view> |
| | | <view class="detail-item"> |
| | | <text class="detail-label">创建人</text> |
| | | <text class="detail-value">{{ item.createUser }}</text> |
| | | </view> |
| | | <view class="detail-item"> |
| | | <text class="detail-label">送检人</text> |
| | | <text class="detail-value">{{ item.fcheckUser || '-' }}</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 操作指示器 --> |
| | | <view class="action-indicator"> |
| | | <uni-icons color="#94a3b8" size="16" type="arrowright"></uni-icons> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <!-- 第二个选项卡内容 - 已检验 --> |
| | | <view v-show="current === 1"> |
| | | <!-- 加载状态 --> |
| | | <view v-if="isLoading" class="loading-state"> |
| | | <view class="loading-spinner"></view> |
| | | <text class="loading-text">加载中...</text> |
| | | </view> |
| | | |
| | | <!-- 空状态 --> |
| | | <view v-else-if="data.length === 0" class="empty-state"> |
| | | <view class="empty-icon">✅</view> |
| | | <text class="empty-title">暂无已检验单据</text> |
| | | <text class="empty-desc">完成检验的单据将显示在这里</text> |
| | | </view> |
| | | |
| | | <!-- 检验单列表 --> |
| | | <view v-else class="inspection-list"> |
| | | <view v-for="item in data" :key="item.id || item.releaseNo" |
| | | class="inspection-card completed" @tap="navigateToDetail(item)"> |
| | | |
| | | <!-- 卡片头部 --> |
| | | <view class="card-header"> |
| | | <view class="header-left"> |
| | | <view class="inspection-number"> |
| | | <text class="number-label">检验单号</text> |
| | | <text class="number-value">{{ item.releaseNo }}</text> |
| | | </view> |
| | | <view class="material-info"> |
| | | <text class="material-code">{{ item.itemNo }}</text> |
| | | <text class="material-name">{{ item.itemName || '未知物料' }}</text> |
| | | </view> |
| | | </view> |
| | | <view class="header-right"> |
| | | <view class="status-badge status-completed"> |
| | | <view class="status-dot"></view> |
| | | <text class="status-text">已完成</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 检验结果区域 --> |
| | | <view class="inspection-result"> |
| | | <view class="result-item"> |
| | | <view :class="{ |
| | | 'icon-pass': item.fcheckResu === '合格', |
| | | 'icon-fail': item.fcheckResu === '不合格' |
| | | }"> |
| | | <text class="result-symbol">{{ |
| | | item.fcheckResu === '合格' ? '✓' : '✗' |
| | | }}</text> |
| | | </view> |
| | | <view class="result-content"> |
| | | <text class="result-label">最终结果</text> |
| | | <text class="result-value" |
| | | :class="{ |
| | | }" |
| | | class="result-icon"> |
| | | <text class="result-symbol">{{ |
| | | item.fcheckResu === '合格' ? '✓' : '✗' |
| | | }} |
| | | </text> |
| | | </view> |
| | | <view class="result-content"> |
| | | <text class="result-label">最终结果</text> |
| | | <text :class="{ |
| | | 'value-pass': item.fcheckResu === '合格', |
| | | 'value-fail': item.fcheckResu === '不合格' |
| | | }"> |
| | | {{ item.fcheckResu }} |
| | | </text> |
| | | </view> |
| | | </view> |
| | | |
| | | <view class="inspector-info"> |
| | | <text class="inspector-label">检验人</text> |
| | | <text class="inspector-name">{{ item.modify1By }}</text> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 详细信息 --> |
| | | <view class="card-details"> |
| | | <view class="detail-grid"> |
| | | <view class="detail-item"> |
| | | <text class="detail-label">检验时间</text> |
| | | <text class="detail-value">{{ item.modify1Date }}</text> |
| | | </view> |
| | | <view class="detail-item"> |
| | | <text class="detail-label">数量</text> |
| | | <text class="detail-value">{{ item.planQty }}</text> |
| | | </view> |
| | | <view class="detail-item"> |
| | | <text class="detail-label">创建人</text> |
| | | <text class="detail-value">{{ item.createUser }}</text> |
| | | </view> |
| | | <view class="detail-item"> |
| | | <text class="detail-label">送检人</text> |
| | | <text class="detail-value">{{ item.fcheckUser || '-' }}</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 操作指示器 --> |
| | | <view class="action-indicator"> |
| | | <uni-icons type="arrowright" size="16" color="#94a3b8"></uni-icons> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 浮动操作按钮 --> |
| | | <view class="fab-container"> |
| | | <view class="fab-button" @tap="handleFabClick"> |
| | | <uni-icons type="plus" size="24" color="#ffffff"></uni-icons> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | }" |
| | | class="result-value"> |
| | | {{ item.fcheckResu }} |
| | | </text> |
| | | </view> |
| | | </view> |
| | | |
| | | <view class="inspector-info"> |
| | | <text class="inspector-label">检验人</text> |
| | | <text class="inspector-name">{{ item.modify1By }}</text> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 详细信息 --> |
| | | <view class="card-details"> |
| | | <view class="detail-grid"> |
| | | <view class="detail-item"> |
| | | <text class="detail-label">检验时间</text> |
| | | <text class="detail-value">{{ item.modify1Date }}</text> |
| | | </view> |
| | | <view class="detail-item"> |
| | | <text class="detail-label">数量</text> |
| | | <text class="detail-value">{{ item.planQty }}</text> |
| | | </view> |
| | | <view class="detail-item"> |
| | | <text class="detail-label">创建人</text> |
| | | <text class="detail-value">{{ item.createUser }}</text> |
| | | </view> |
| | | <view class="detail-item"> |
| | | <text class="detail-label">送检人</text> |
| | | <text class="detail-value">{{ item.fcheckUser || '-' }}</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 操作指示器 --> |
| | | <view class="action-indicator"> |
| | | <uni-icons color="#94a3b8" size="16" type="arrowright"></uni-icons> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 浮动操作按钮 --> |
| | | <view class="fab-container"> |
| | | <view class="fab-button" @tap="handleFabClick"> |
| | | <uni-icons color="#ffffff" size="24" type="plus"></uni-icons> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | components: {}, |
| | | data() { |
| | | return { |
| | | items: ['未检验', '已检验'], |
| | | current: 0, |
| | | data: [], |
| | | pageIndex: 1, |
| | | limit: 20, |
| | | totalPage: 0, |
| | | totalCount: 0, |
| | | noData: false, |
| | | isLoading: false, |
| | | tipShow: false, |
| | | searchOptions: ['物料编码', '物料名称', '创建人员'], |
| | | selectedOption: 0, |
| | | searchValue: '', |
| | | copiedText: '', |
| | | headerHeight: 0, |
| | | showFilter: false, // 控制筛选面板显示 |
| | | }; |
| | | }, |
| | | onLoad() { |
| | | this.init(); |
| | | }, |
| | | onShow() { |
| | | // 页面显示时刷新数据 |
| | | this.pageIndex = 1; |
| | | this.loadData(); |
| | | }, |
| | | methods: { |
| | | onPickerChange(e) { |
| | | this.selectedOption = e.detail.value; |
| | | }, |
| | | getInputValue() { |
| | | this.pageIndex = 1; // 搜索时重置页码 |
| | | this.loadData(); // 调用统一的数据加载方法 |
| | | }, |
| | | loadData() { |
| | | let result = "未完成"; |
| | | if (this.current === 1) { |
| | | result = "已完成"; |
| | | } |
| | | export default { |
| | | components: {}, |
| | | data() { |
| | | return { |
| | | items: ['未检验', '已检验'], |
| | | current: 0, |
| | | data: [], |
| | | pageIndex: 1, |
| | | limit: 20, |
| | | totalPage: 0, |
| | | totalCount: 0, |
| | | noData: false, |
| | | isLoading: false, |
| | | tipShow: false, |
| | | searchOptions: ['物料编码', '物料名称', '创建人员', '检验单号'], |
| | | selectedOption: 0, |
| | | searchValue: '', |
| | | copiedText: '', |
| | | headerHeight: 0 |
| | | }; |
| | | }, |
| | | onLoad() { |
| | | this.init(); |
| | | }, |
| | | onShow() { |
| | | // 页面显示时刷新数据 |
| | | this.pageIndex = 1; |
| | | this.loadData(); |
| | | }, |
| | | methods: { |
| | | onPickerChange(e) { |
| | | this.selectedOption = e.detail.value; |
| | | }, |
| | | getInputValue() { |
| | | this.pageIndex = 1; // 搜索时重置页码 |
| | | this.loadData(); // 调用统一的数据加载方法 |
| | | }, |
| | | loadData() { |
| | | let result = "未完成"; |
| | | if (this.current === 1) { |
| | | result = "已完成"; |
| | | } |
| | | |
| | | if (this.isLoading) return; |
| | | if (this.isLoading) return; |
| | | |
| | | this.isLoading = true; |
| | | this.isLoading = true; |
| | | |
| | | let userName = this.$loginInfo.account; |
| | | let url = "/MesOqcItemsDetect02/getPage"; // 默认调用getPage |
| | | let requestData = { |
| | | pageIndex: this.pageIndex, |
| | | limit: this.limit, |
| | | createUser: userName, |
| | | result: result |
| | | }; |
| | | let userName = this.$loginInfo.account; |
| | | let url = "/MesOqcItemsDetect02/getPage"; // 默认调用getPage |
| | | let requestData = { |
| | | pageIndex: this.pageIndex, |
| | | limit: this.limit, |
| | | createUser: userName, |
| | | result: result |
| | | }; |
| | | |
| | | console.log("请求参数:", requestData); |
| | | console.log("当前选项卡:", this.current); |
| | | console.log("result状态:", result); |
| | | console.log("请求参数:", requestData); |
| | | console.log("当前选项卡:", this.current); |
| | | console.log("result状态:", result); |
| | | |
| | | // 判断搜索框是否有值 |
| | | if (this.searchValue != null && this.searchValue.trim() !== '') { |
| | | // 根据选择的搜索选项设置搜索条件 |
| | | switch (this.selectedOption) { |
| | | case 0: // 物料编码 |
| | | requestData.itemNo = this.searchValue; |
| | | break; |
| | | case 1: // 物料名称 |
| | | requestData.itemName = this.searchValue; |
| | | break; |
| | | case 2: // 创建人员 |
| | | requestData.createUser = this.searchValue; |
| | | break; |
| | | } |
| | | } |
| | | // 判断搜索框是否有值 |
| | | if (this.searchValue != null && this.searchValue.trim() !== '') { |
| | | // 根据选择的搜索选项设置搜索条件 |
| | | switch (this.selectedOption) { |
| | | case 0: // 物料编码 |
| | | requestData.itemNo = this.searchValue; |
| | | break; |
| | | case 1: // 物料名称 |
| | | requestData.itemName = this.searchValue; |
| | | break; |
| | | case 2: // 创建人员 |
| | | requestData.createUser = this.searchValue; |
| | | break; |
| | | case 3: // 检验单号 |
| | | requestData.releaseNo = this.searchValue; |
| | | break; |
| | | } |
| | | requestData.searchIndex = this.selectedOption; |
| | | } |
| | | |
| | | this.$post({ |
| | | url: url, |
| | | data: requestData |
| | | }).then(res => { |
| | | console.log("API返回完整数据:", JSON.stringify(res, null, 2)); |
| | | console.log("res结构:", res); |
| | | console.log("res.data:", res.data); |
| | | console.log("res.totalCount:", res.totalCount); |
| | | |
| | | // 根据响应格式.json,正确的数据结构是: |
| | | // res.data 是数组,res.totalCount 是总数 |
| | | let dataList = null; |
| | | let totalCount = 0; |
| | | |
| | | if (res.data && Array.isArray(res.data)) { |
| | | // 正确的数据结构:data是数组 |
| | | dataList = res.data; |
| | | totalCount = res.totalCount || 0; |
| | | } else if (res.tbBillList) { |
| | | // 备用结构(兼容其他接口) |
| | | dataList = res.tbBillList; |
| | | totalCount = res.totalCount || 0; |
| | | } else { |
| | | console.error("无法解析的数据结构:", res); |
| | | console.error("期望的字段 data (数组) 不存在"); |
| | | this.$showMessage("数据格式错误,请联系技术支持"); |
| | | this.isLoading = false; |
| | | return; |
| | | } |
| | | |
| | | console.log("解析后的dataList:", dataList); |
| | | console.log("dataList长度:", dataList ? dataList.length : 0); |
| | | |
| | | if (this.pageIndex === 1) { |
| | | this.data = dataList || []; |
| | | } else { |
| | | if (dataList && dataList.length > 0) { |
| | | this.data = [...this.data, ...dataList]; |
| | | } |
| | | } |
| | | |
| | | console.log("处理后的data:", this.data); |
| | | console.log("data长度:", this.data.length); |
| | | |
| | | this.totalCount = totalCount; |
| | | this.totalPage = Math.ceil(this.totalCount / this.limit); |
| | | this.$post({ |
| | | url: url, |
| | | data: requestData |
| | | }).then(res => { |
| | | console.log("API返回完整数据:", JSON.stringify(res, null, 2)); |
| | | console.log("res结构:", res); |
| | | console.log("res.data:", res.data); |
| | | console.log("res.totalCount:", res.totalCount); |
| | | |
| | | this.noData = this.pageIndex >= this.totalPage; |
| | | this.isLoading = false; |
| | | }).catch((error) => { |
| | | console.error("API请求失败:", error); |
| | | this.isLoading = false; |
| | | this.searchValue = ''; |
| | | this.$showMessage("请求失败,请重试"); |
| | | }); |
| | | }, |
| | | init() { |
| | | this.loadData(); // 统一调用loadData方法 |
| | | }, |
| | | handleFabClick() { |
| | | uni.navigateTo({ |
| | | url: 'ScanCode' |
| | | }); |
| | | }, |
| | | onClickItem(index) { |
| | | if (this.current !== index.currentIndex) { |
| | | this.current = index.currentIndex; |
| | | this.data = []; |
| | | this.pageIndex = 1; |
| | | this.loadData(); // 选项卡切换时调用loadData |
| | | } |
| | | }, |
| | | copyText(text) { |
| | | uni.setClipboardData({ |
| | | data: text, |
| | | success: () => { |
| | | this.copiedText = text; |
| | | this.tipShow = true; |
| | | setTimeout(() => { |
| | | this.tipShow = false; |
| | | }, 1000); |
| | | } |
| | | }); |
| | | }, |
| | | // 新增方法 |
| | | navigateToDetail(item) { |
| | | uni.navigateTo({ |
| | | url: 'Add?id=' + item.id |
| | | }); |
| | | }, |
| | | toggleFilter() { |
| | | this.showFilter = !this.showFilter; |
| | | }, |
| | | clearSearch() { |
| | | this.searchValue = ''; |
| | | this.pageIndex = 1; |
| | | this.loadData(); |
| | | } |
| | | }, |
| | | onPullDownRefresh() { |
| | | this.pageIndex = 1; |
| | | this.loadData(); |
| | | this.tipShow = true; |
| | | uni.stopPullDownRefresh(); |
| | | // 根据响应格式.json,正确的数据结构是: |
| | | // res.data 是数组,res.totalCount 是总数 |
| | | let dataList = null; |
| | | let totalCount = 0; |
| | | |
| | | setTimeout(() => { |
| | | this.tipShow = false; |
| | | }, 1000); |
| | | }, |
| | | onReachBottom() { |
| | | if (this.noData || this.isLoading) return; |
| | | this.pageIndex++; |
| | | this.loadData(); // 上拉加载时调用loadData |
| | | } |
| | | }; |
| | | if (res.data && Array.isArray(res.data)) { |
| | | // 正确的数据结构:data是数组 |
| | | dataList = res.data; |
| | | totalCount = res.totalCount || 0; |
| | | } else if (res.tbBillList) { |
| | | // 备用结构(兼容其他接口) |
| | | dataList = res.tbBillList; |
| | | totalCount = res.totalCount || 0; |
| | | } else { |
| | | console.error("无法解析的数据结构:", res); |
| | | console.error("期望的字段 data (数组) 不存在"); |
| | | this.$showMessage("数据格式错误,请联系技术支持"); |
| | | this.isLoading = false; |
| | | return; |
| | | } |
| | | |
| | | console.log("解析后的dataList:", dataList); |
| | | console.log("dataList长度:", dataList ? dataList.length : 0); |
| | | |
| | | if (this.pageIndex === 1) { |
| | | this.data = dataList || []; |
| | | } else { |
| | | if (dataList && dataList.length > 0) { |
| | | this.data = [...this.data, ...dataList]; |
| | | } |
| | | } |
| | | |
| | | console.log("处理后的data:", this.data); |
| | | console.log("data长度:", this.data.length); |
| | | |
| | | this.totalCount = totalCount; |
| | | this.totalPage = Math.ceil(this.totalCount / this.limit); |
| | | |
| | | this.noData = this.pageIndex >= this.totalPage; |
| | | this.isLoading = false; |
| | | }).catch((error) => { |
| | | console.error("API请求失败:", error); |
| | | this.isLoading = false; |
| | | this.searchValue = ''; |
| | | this.$showMessage("请求失败,请重试"); |
| | | }); |
| | | }, |
| | | init() { |
| | | this.loadData(); // 统一调用loadData方法 |
| | | }, |
| | | handleFabClick() { |
| | | uni.navigateTo({ |
| | | url: 'ScanCode' |
| | | }); |
| | | }, |
| | | onClickItem(index) { |
| | | if (this.current !== index.currentIndex) { |
| | | this.current = index.currentIndex; |
| | | this.data = []; |
| | | this.pageIndex = 1; |
| | | this.loadData(); // 选项卡切换时调用loadData |
| | | } |
| | | }, |
| | | copyText(text) { |
| | | uni.setClipboardData({ |
| | | data: text, |
| | | success: () => { |
| | | this.copiedText = text; |
| | | this.tipShow = true; |
| | | setTimeout(() => { |
| | | this.tipShow = false; |
| | | }, 1000); |
| | | } |
| | | }); |
| | | }, |
| | | // 新增方法 |
| | | navigateToDetail(item) { |
| | | uni.navigateTo({ |
| | | url: 'Add?id=' + item.id |
| | | }); |
| | | }, |
| | | }, |
| | | onPullDownRefresh() { |
| | | this.pageIndex = 1; |
| | | this.loadData(); |
| | | this.tipShow = true; |
| | | uni.stopPullDownRefresh(); |
| | | |
| | | setTimeout(() => { |
| | | this.tipShow = false; |
| | | }, 1000); |
| | | }, |
| | | onReachBottom() { |
| | | if (this.noData || this.isLoading) return; |
| | | this.pageIndex++; |
| | | this.loadData(); // 上拉加载时调用loadData |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style> |
| | |
| | | margin-top: 2px; |
| | | } |
| | | |
| | | /* 搜索区域 */ |
| | | .search-section { |
| | | /* 搜索栏样式 */ |
| | | .search-bar { |
| | | margin-bottom: 16px; |
| | | } |
| | | |
| | | .search-container { |
| | | display: flex; |
| | | gap: 8px; |
| | | align-items: center; |
| | | } |
| | | |
| | | .search-input-wrapper { |
| | | flex: 1; |
| | | position: relative; |
| | | .search-card { |
| | | display: flex; |
| | | align-items: center; |
| | | background: #f8f8f8; |
| | | border: 1px solid #ddd; |
| | | border-radius: 8px; |
| | | padding: 0 12px; |
| | | background-color: white; |
| | | border-radius: 12px; |
| | | box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); |
| | | height: 44px; |
| | | } |
| | | |
| | | .search-input-wrapper:focus-within { |
| | | border-color: #007AFF; |
| | | background: white; |
| | | .picker { |
| | | width: 120px; |
| | | height: 44px; |
| | | line-height: 44px; |
| | | text-align: center; |
| | | font-size: 14px; |
| | | color: #666; |
| | | border-right: 1px solid #e0e0e0; |
| | | white-space: nowrap; |
| | | } |
| | | |
| | | .search-input { |
| | | flex: 1; |
| | | height: 40px; |
| | | border: none; |
| | | background: transparent; |
| | | height: 44px; |
| | | line-height: 44px; |
| | | font-size: 14px; |
| | | color: #333; |
| | | margin-left: 8px; |
| | | padding: 0 12px; |
| | | border: none; |
| | | outline: none; |
| | | background: transparent; |
| | | } |
| | | |
| | | .search-input::placeholder { |
| | | color: #999; |
| | | } |
| | | |
| | | .clear-btn { |
| | | padding: 4px; |
| | | cursor: pointer; |
| | | } |
| | | |
| | | .filter-btn { |
| | | width: 40px; |
| | | height: 40px; |
| | | background: #f0f0f0; |
| | | border: 1px solid #ddd; |
| | | border-radius: 8px; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | cursor: pointer; |
| | | } |
| | | |
| | | .filter-btn:active { |
| | | background: #e0e0e0; |
| | | } |
| | | |
| | | /* 筛选面板 */ |
| | | .filter-panel { |
| | | margin-top: 8px; |
| | | background: white; |
| | | border: 1px solid #ddd; |
| | | border-radius: 8px; |
| | | padding: 12px; |
| | | } |
| | | |
| | | .filter-option { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | padding: 8px 0; |
| | | cursor: pointer; |
| | | } |
| | | |
| | | .filter-label { |
| | | .search-btn { |
| | | background: linear-gradient(135deg, #007AFF, #0056D6); |
| | | color: white; |
| | | text-align: center; |
| | | font-size: 14px; |
| | | color: #666; |
| | | width: 80px; |
| | | height: 44px; |
| | | line-height: 44px; |
| | | border-radius: 0 12px 12px 0; |
| | | border: none; |
| | | cursor: pointer; |
| | | transition: all 0.3s; |
| | | box-shadow: 0 2px 6px rgba(0, 122, 255, 0.2); |
| | | } |
| | | |
| | | .filter-value { |
| | | font-size: 14px; |
| | | color: #333; |
| | | font-weight: 500; |
| | | .search-btn:hover { |
| | | background: linear-gradient(135deg, #0056D6, #004BB8); |
| | | transform: translateY(-1px); |
| | | box-shadow: 0 3px 8px rgba(0, 122, 255, 0.25); |
| | | } |
| | | |
| | | .search-btn:active { |
| | | transform: translateY(1px); |
| | | box-shadow: 0 1px 4px rgba(0, 122, 255, 0.15); |
| | | } |
| | | |
| | | /* 选项卡 */ |
| | |
| | | } |
| | | |
| | | @keyframes spin { |
| | | 0% { transform: rotate(0deg); } |
| | | 100% { transform: rotate(360deg); } |
| | | 0% { |
| | | transform: rotate(0deg); |
| | | } |
| | | 100% { |
| | | transform: rotate(360deg); |
| | | } |
| | | } |
| | | |
| | | .loading-text { |
| | |
| | | align-items: flex-start; |
| | | gap: 12px; |
| | | } |
| | | |
| | | |
| | | .stats-badge { |
| | | align-self: flex-end; |
| | | } |
| | | |
| | | |
| | | .search-container { |
| | | flex-direction: column; |
| | | gap: 8px; |
| | | } |
| | | |
| | | |
| | | .filter-btn { |
| | | align-self: flex-end; |
| | | } |
| | | |
| | | |
| | | .detail-grid { |
| | | grid-template-columns: 1fr; |
| | | } |
| | | |
| | | |
| | | .inspection-result { |
| | | flex-direction: column; |
| | | align-items: flex-start; |
| | | gap: 12px; |
| | | } |
| | | |
| | | |
| | | .inspector-info { |
| | | text-align: left; |
| | | width: 100%; |