spring
2025-10-15 7cf708376b46741dbee847e59c64a8e11ad088c5
src/pages/production/twist/receive/steelCore/index.vue
@@ -8,19 +8,19 @@
      @query="getList"
    >
      <template #top>
        <CardTitle title="钢芯领用" :hideAction="true" @action="addReport" />
        <CardTitle title="钢芯领用" :hideAction="true" :full="false" @action="addReport" />
      </template>
      <wd-card v-for="(item, index) in cardList" :key="index" type="rectangle" custom-class="round">
        <template #title>
          <view class="flex justify-between">
            <view>
              <wd-icon name="a-rootlist" color="#0D867F"></wd-icon>
              <text class="text-[#252525] ml-2 font-medium">JX28201021-1</text>
              <text class="text-[#252525] ml-2 font-medium">{{ item.model }}</text>
            </view>
            <view class="text-[#A8A8A8]" @click="toEdit">编辑</view>
            <view class="text-[#A8A8A8]" @click="toEdit(item.id)">编辑</view>
          </view>
        </template>
        <ProductionCard :data="cardAttr" color="#0D867F" />
        <ProductionCard :data="cardAttr" :value="item" color="#0D867F" />
      </wd-card>
    </z-paging>
  </view>
@@ -29,7 +29,7 @@
      <wd-button type="text" @click="cancel">取消</wd-button>
      <wd-button type="text" @click="submit">确定</wd-button>
    </view>
    <PlateForm />
    <SteelCore ref="steelCoreRef" @refresh="reloadList" />
  </wd-popup>
  <wd-toast />
</template>
@@ -38,46 +38,59 @@
import CardTitle from "@/components/card-title/index.vue";
import ProductionCard from "../../../components/ProductionCard.vue";
import { useToast } from "wot-design-uni";
import PlateForm from "./form.vue";
import { onLoad } from "@dcloudio/uni-app";
import SteelCore from "./form.vue";
import { onLoad, onShow } from "@dcloudio/uni-app";
import ManageApi from "@/api/product/manage";
import zPaging from "@/components/z-paging/z-paging.vue";
const paramsId = ref();
const pagingRef = ref();
const steelCoreRef = ref();
const toast = useToast();
const dialog = reactive({
  visible: false,
});
const cardList = ref<any[]>([]);
const needRefresh = ref(false); // 标记是否需要刷新
const cardAttr = ref<any[]>([
  {
    label: "盘号",
    value: "1902101",
    label: "样品编号",
    prop: "monofilamentNumber",
  },
  {
    label: "长度",
    value: "46kg",
    label: "数量",
    prop: "amount",
    unitProp: "unit",
  },
  {
    label: "重量",
    value: "10kg",
  },
  {
    label: undefined,
    value: undefined,
    prop: "weight",
    unitProp: "weightUnit",
  },
  {
    label: "厂家",
    value: "江苏省南通市芯导数字厂",
    prop: "supplier",
    span: 16,
  },
]);
const toEdit = () => {
const toEdit = (id: number) => {
  needRefresh.value = true; // 标记需要刷新
  // 确保 cardList 是数组
  const listData = Array.isArray(cardList.value) ? cardList.value : [];
  console.log("toEdit - 传递的列表数据:", listData, "编辑ID:", id);
  uni.navigateTo({
    url: "/pages/production/twist/receive/steelCore/edit",
    url: `/pages/production/twist/receive/steelCore/edit?id=${id}`,
    success: () => {
      // 页面跳转成功后发送事件传递完整列表数据和当前编辑ID
      uni.$emit("steelCoreEditData", {
        list: listData,
        editId: id,
      });
    },
  });
};
@@ -85,9 +98,11 @@
  dialog.visible = true;
};
const submit = () => {
  toast.show("提交");
  dialog.visible = false;
const submit = async () => {
  const success = await steelCoreRef.value.submit();
  if (success) {
    dialog.visible = false;
  }
};
const cancel = () => {
@@ -98,16 +113,28 @@
const getList = async () => {
  const { code, data } = await ManageApi.getStrandedWireDish({
    wireId: paramsId.value,
    type: "盘具",
    type: "钢芯",
  });
  if (code == 200) {
    pagingRef.value.complete(data);
  }
};
const reloadList = () => {
  pagingRef.value.refresh();
};
onLoad((options: any) => {
  paramsId.value = options.id;
});
onShow(() => {
  // 从编辑页返回时刷新列表
  if (needRefresh.value) {
    reloadList();
    needRefresh.value = false;
  }
});
</script>
<style lang="scss" scoped>