spring
5 小时以前 3ea1ff641e1c680a5a1727fb4034797bfe65d93e
src/pages/qualityManagement/rawMaterial/index.vue
@@ -31,7 +31,11 @@
      <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">
@@ -56,8 +60,9 @@
          </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>
@@ -96,7 +101,8 @@
</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,
@@ -195,9 +201,10 @@
};
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) => {
@@ -214,7 +221,8 @@
const handleDelete = (row) => {
  showConfirm('确认删除该记录吗?').then(res => {
    if (res.confirm) {
      deleteRawMaterial({ id: row.id }).then(() => {
      // 对齐 PC 端:删除接口接收 id 数组
      deleteRawMaterial([row.id]).then(() => {
        toast('删除成功');
        handleQuery();
      });
@@ -222,11 +230,24 @@
  });
};
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>
@@ -309,10 +330,19 @@
.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;