yyb
5 天以前 e9ebe0b65f45b5ecb5729f22bc7e54ce479314d7
pages/product/report/index.vue
@@ -43,8 +43,8 @@
      <u-form-item label="零件描述" :border-bottom="false" prop="partName">
        <u-input v-model="form.partName" placeholder="" disabled />
      </u-form-item>
      <u-form-item label="批量大小" :border-bottom="false" prop="qtyrequired">
        <u-input v-model="form.qtyrequired" placeholder="" disabled />
      <u-form-item label="批量大小" :border-bottom="false" prop="qtyRequired">
        <u-input v-model="form.qtyRequired" placeholder="" disabled />
      </u-form-item>
      <u-form-item
        label="剩余数量"
@@ -68,19 +68,19 @@
          <u-radio name="part">替代零件</u-radio>
        </u-radio-group>
      </u-form-item>
      <u-form-item label="物料" prop="materialcost">
        <u-radio-group v-model="form.materialcost" :disabled="true">
      <u-form-item label="物料" prop="materialCost">
        <u-radio-group v-model="form.materialCost" :disabled="true">
          <u-radio name="倒冲">倒冲</u-radio>
          <u-radio name="投料">投料</u-radio>
        </u-radio-group>
      </u-form-item>
      <u-form-item label="工序" prop="value11">
      <u-form-item label="工序">
        <u-checkbox-group>
          <u-checkbox
            :name="item.name"
            v-for="(item, index) in checkboxList"
            :key="index"
            v-model="item.value11"
            v-model="item.value"
            @change="changeCheckbox"
            :disabled="subdisabled || item.disabled"
          >
@@ -111,7 +111,7 @@
                  <view class="_label-name">批号:</view>
                </view>
                <view class="_content">
                  {{ item.productNo }}
                  {{ item.outBatchNo }}
                </view>
              </view>
              <view class="row-list">
@@ -119,7 +119,7 @@
                  <view class="_label-name">数量:</view>
                </view>
                <view class="_content">
                  {{ item.value1 }}
                  {{ item.netWeight }}
                </view>
              </view>
              <view class="row-list">
@@ -147,7 +147,7 @@
    </modalBg>
    <saveForm
      ref="saveForm"
      :operationTaskId="this.form"
      :operationTaskList="this.form"
      @update="handleUpdate"
    />
    <scan></scan>
@@ -180,18 +180,19 @@
      ],
      InventoryReceiptList: [],
      form: {
        workstationId: "",
        work: "",
        taskNo: "",
        name: "",
        moOn: "",
        partNo: "",
        partName: "",
        qtyrequired: "",
        qtyRequired: "",
        Jianqtyfinished: "",
        proposedLocation: "",
        productType: "dep",
        receive: "mo", // 复选框组的值
        materialcost: "",
        receive: "mo",
        materialCost: "",
        autoReport: false,
        simplifyMaterials: false,
      },
@@ -242,32 +243,30 @@
      showSave: false,
      operationTaskId: "",
      subdisabled: false,
      codeInfoId: "",
    };
  },
  // 点击提交按钮的事件处理函数
  onNavigationBarButtonTap() {
    this.$refs.uForm.validate((valid) => {
      if (valid) {
      uni.showLoading({
      if (valid) {
        uni.showLoading({
          mask: true,
          title: "加载中",
        });
        console.log("验证通过");
        // 处理提交逻辑
        this.$u.api.workReporting
          .operationTask({
            id: this.form.id,
          })
          .then((res) => {
            console.log("res", res);
            res.data.name = this.form.name
            this.$refs.saveForm.open(res);
            uni.hideLoading();
          });
      } else {
        console.log("验证失败");
        // 可以获取具体的错误信息
        const errors = this.$refs.uForm.getError();
        console.log("错误信息:", errors);
      }
    });
  },
@@ -276,42 +275,38 @@
  },
  onShow() {
    let that = this;
    console.log("1111111111111");
    uni.$off("scan"); // 每次进来先 移除全局自定义事件监听器
    uni.$on("scan", function (data) {
      console.log("onscan");
      //扫码成功后的回调,你可以写自己的逻辑代码在这里
      console.log("页面扫码结果:", data.code);
      if (data.code) {
        let codeInfo = JSON.parse(data.code);
        that.codeInfoId = codeInfo.id;
        if (codeInfo.moOn) {
          // 扫描报工单二维码
          that.saveForm(codeInfo);
          that.$u.api.workReporting
            .getProductMainV1({
              current: 1,
              size: -1,
              operationTaskId: codeInfo.id,
            })
            .then((res) => {
              console.log("res", res);
              let InventoryReceiptList = JSON.parse(res.data.records);
              that.saveInventory(InventoryReceiptList);
            });
          console.log("this.InventoryReceiptList", that.InventoryReceiptList);
          that.getHandelList();
        }
      }
    });
  },
  watch: {
    "form.taskNo": function (newVal, oldVal) {
      console.log("taskNo changed:", newVal, oldVal);
      this.subdisabled = false;
      this.checkboxList[1].value = false;
      this.checkboxList[0].value = false;
    },
  },
  methods: {
    saveInventory(val) {
      this.InventoryReceiptList = val;
    getHandelList() {
      this.$u.api.workReporting
        .getProductMainV1({
          current: 1,
          size: -1,
          id: this.codeInfoId,
        })
        .then((res) => {
          this.InventoryReceiptList = res.data.productOutputList;
        });
    },
    // 多选处理
    changeCheckbox(val) {
@@ -324,15 +319,14 @@
    },
    handleUpdate() {
      this.subdisabled = true;
      this.getHandelList();
    },
    // 打开弹框--后面还需要监听扫码枪扫码结果,赋值给报工单号字段,然后打开弹框选择订单号等操作
    open() {
      this.$refs.modalBg.open();
    },
    // 弹框保存
    confirm() {
      console.log("保存", this.form.taskNo);
    },
    confirm() {},
    // 选择订单号
    openList() {
      if (this.form.taskNo === "") {
@@ -352,25 +346,27 @@
    },
    // 回显扫码的信息-报工单
    saveForm(val) {
      console.log("回显的数据", val);
      this.form = {
        id: val.id,
        workstationId: val.workstationId,
        work: val.work,
        taskNo: val.taskNo,
        name: val.name,
        moOn: val.moOn,
        partNo: val.partNo,
        partName: val.partName,
        qtyrequired: val.qtyrequired,
        Jianqtyfinished: val.qtyrequired - val.qtyfinished,
        qtyRequired: val.qtyRequired,
        Jianqtyfinished: val.qtyRequired - val.qtyFinished,
        proposedLocation: val.proposedLocation,
        productType: "dep",
        receive: "mo", // 复选框组的值
        materialcost: val.materialcost,
        materialCost: val.materialCost,
        autoReport: false,
        simplifyMaterials: false,
      };
      if (this.form.materialcost == "倒冲") {
      this.checkboxList[1].value = false;
      this.checkboxList[0].value = false;
      if (this.form.materialCost == "倒冲") {
        this.checkboxList[1].disabled = true;
      }
    },