| | |
| | | <view v-for="(item, index) in tableData" :key="index" class="list-item"> |
| | | <view class="item-header"> |
| | | <text class="product-name">{{ item.productName }}</text> |
| | | <up-tag :text="item.inspectState ? '已提交' : '未提交'" :type="item.inspectState ? 'success' : 'warning'" size="mini"></up-tag> |
| | | <up-tag |
| | | :text="item.inspectState == 1 ? '已提交' : '未提交'" |
| | | :type="item.inspectState == 1 ? 'success' : 'warning'" |
| | | size="mini" |
| | | ></up-tag> |
| | | </view> |
| | | <view class="item-content"> |
| | | <view class="item-row"> |
| | |
| | | </view> |
| | | </view> |
| | | <view class="item-actions"> |
| | | <up-button v-if="!item.inspectState" type="primary" size="mini" @click.stop="openForm('edit', item)">编辑</up-button> |
| | | <up-button v-if="!item.inspectState" type="success" size="mini" @click.stop="handleConfirmSubmit(item)">提交</up-button> |
| | | <up-button v-if="item.inspectState != 1" type="primary" size="mini" @click.stop="openForm('edit', item)">编辑</up-button> |
| | | <up-button type="info" size="mini" @click.stop="openFiles(item)">附件</up-button> |
| | | <up-button v-if="item.inspectState != 1" type="success" size="mini" @click.stop="handleConfirmSubmit(item)">提交</up-button> |
| | | <up-button type="error" size="mini" @click.stop="handleDelete(item)">删除</up-button> |
| | | </view> |
| | | </view> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, onMounted, computed } from 'vue'; |
| | | import { ref, reactive, computed } from 'vue'; |
| | | import { onShow } from '@dcloudio/uni-app'; |
| | | import { |
| | | findRawMaterialListPage, |
| | | submitRawMaterial, |
| | |
| | | }; |
| | | |
| | | const openForm = (type, item) => { |
| | | // Mobile usually navigates to a new page for add/edit if complex |
| | | // Here we'll just show a toast for now as the actual form components are many |
| | | toast('功能开发中,请在PC端操作'); |
| | | const id = item?.id |
| | | uni.navigateTo({ |
| | | url: `/pages/qualityManagement/rawMaterial/form?type=${type}${id ? `&id=${id}` : ''}` |
| | | }) |
| | | }; |
| | | |
| | | const handleConfirmSubmit = (row) => { |
| | |
| | | const handleDelete = (row) => { |
| | | showConfirm('确认删除该记录吗?').then(res => { |
| | | if (res.confirm) { |
| | | deleteRawMaterial({ id: row.id }).then(() => { |
| | | // 对齐 PC 端:删除接口接收 id 数组 |
| | | deleteRawMaterial([row.id]).then(() => { |
| | | toast('删除成功'); |
| | | handleQuery(); |
| | | }); |
| | |
| | | }); |
| | | }; |
| | | |
| | | const openFiles = (row) => { |
| | | if (!row?.id) { |
| | | toast('请先保存后再上传附件') |
| | | return |
| | | } |
| | | try { |
| | | uni.setStorageSync('rawMaterialFilesCtx', JSON.stringify({ id: row.id })) |
| | | } catch (e) {} |
| | | uni.navigateTo({ |
| | | url: `/pages/qualityManagement/rawMaterial/files?id=${row.id}` |
| | | }) |
| | | } |
| | | |
| | | const goBack = () => { |
| | | uni.navigateBack(); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | onShow(() => { |
| | | handleQuery(); |
| | | }); |
| | | </script> |
| | |
| | | .item-actions { |
| | | display: flex; |
| | | justify-content: flex-end; |
| | | gap: 20rpx; |
| | | gap: 16rpx; |
| | | border-top: 1rpx solid #ebeef5; |
| | | padding-top: 20rpx; |
| | | } |
| | | .item-actions :deep(.u-button), |
| | | .item-actions :deep(.up-button) { |
| | | min-width: 140rpx; |
| | | height: 64rpx; |
| | | line-height: 64rpx; |
| | | font-size: 26rpx; |
| | | border-radius: 999rpx; |
| | | padding: 0 24rpx; |
| | | } |
| | | |
| | | .no-data { |
| | | padding-top: 200rpx; |