zuozhengqing
2023-12-12 b4b3cb3641ecdf56cdfdf3532e5acf4af46fbe48
src/views/overview/AddOverviewDialog.vue
@@ -6,7 +6,7 @@
      <div slot="title" class="dialog-header">
        <span>{{ editCommonConfig.title === "查看" ? editCommonConfig.title : editCommonConfig.title + addName }}</span>
        <div class="header_btns">
          <span class="btn" @click="btnPrint">
          <span class="btn" :style="{cursor:thatCursor,color:thatColor}" @click="btnPrint" :disabled="true">
            <i class="el-icon-printer"></i>
            <span>打印</span>
          </span>
@@ -183,13 +183,13 @@
            </div>
            <!-- 物流信息 -->
            <div v-if="activeName === 'two' && this.workType === 2">
              <el-form :rules="rules" ref="shipmentsInfo" label-position="right" :model="shipmentsInfo" label-width="120px" size="mini"
              <el-form :rules="rules2" ref="shipmentsInfo" label-position="right" :model="editConfig.infomation" label-width="120px" size="mini"
                style="margin-top: 20px;">
                <el-col :span="12">
                  <el-form-item label="承运商">
                    <el-select size="mini" :disabled="!showFooter" v-model="editConfig.infomation.logisticCompanyId"
                      placeholder="请选择" style="width: 90%;">
                      <el-option v-for="item in shipmentsInfo.carrier" :key="item.id" :label="item.name" :value="item.id">
                      <el-option v-for="item in editConfig.infomation.carrier" :key="item.id" :label="item.name" :value="item.id">
                      </el-option>
                    </el-select>
                  </el-form-item>
@@ -257,7 +257,7 @@
      <!-- 尾 -->
      <div slot="footer" class="dialog-footer">
        <!-- <el-button type="primary" size="small" @click="editConfig.visible = false">保并提交审批</el-button> -->
        <el-button type="primary" size="small" @click="saveClick('form','shipmentsInfo')" :disabled="!showFooter">保存</el-button>
        <el-button type="primary" size="small" @click="saveClick" :disabled="!showFooter">保存</el-button>
        <el-button size="small" @click="editConfig.visible = false">取消</el-button>
      </div>
    </el-dialog>
@@ -317,8 +317,10 @@
        toLocationId: [{ required: true, message: "请选择仓库位置", trigger: "change" }],
        fromLocationId: [{ required: true, message: "请选择源位置", trigger: "change" }],
        operationTypeId: [{ required: true, message: "请选择入库类型", trigger: "change" }],
      },
      rules2:{
        receiverPhone: [
          {required: true, message: "请输入手机号", trigger: "change" },
          // {required: true, message: "请输入手机号", trigger: "change" },
          {
            pattern:
              /^1(3\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\d|9[0-35-9])\d{8}$/,
@@ -326,7 +328,6 @@
            trigger: ["blur",'change' ],
          },
        ] 
      }, 
      companyOptions: [], // 公司
      supplierOptions: [],//供应商
@@ -359,10 +360,13 @@
        waybillNumber: '',
        weight: 0,
        logisticWeight: 0,
        receiverPhone:''
      },
      showCancel: false, // 取消是否可以显示
      list: [],
      pdfParams:{}
      pdfParams:{},
      thatCursor:this.workType===3?"no-drop":'pointer',
      thatColor:this.workType===3?'#ccc':'#000'
    }
  },
  created() {
@@ -531,14 +535,24 @@
    async getLogisticCompanyList() {
      await getLogisticCompanyList().then((res) => {
        if (res.code === 200) {
          this.shipmentsInfo.carrier = res.data
          this.editConfig.infomation.carrier = res.data
        }
      })
    },
    // 保存
    saveClick(formName,shipmentsInfo) {
      this.$refs[formName,shipmentsInfo].validate((valid) => {
        if (valid) {
    saveClick() {
      let validArr=[]
      if(this.workType === 2){
         console.log("出库")
         validArr=[this.$refs.form.validate(),this.$refs.shipmentsInfo.validate()]
      }else{
        console.log("入库")
        validArr=[this.$refs.form.validate()]
      }
      console.log(validArr,"xxx")
      Promise.all(validArr)
      .then((results) => {
        console.log(results,"执行成功")
          for (let i = 0; i < this.tableData.length; i++) {
            if (this.tableData[i].productName.length === 0) {
              this.isNoProduct = true
@@ -558,13 +572,19 @@
              console.log(res)
              this.editConfig.visible = false
              if (res.code === 200) {
              if(this.editConfig.title === "新建"){
                this.$message.success("添加成功")
              }else {
                this.$message.success("编辑成功")
              }
                this.$parent.getData()
              }
            })
          }
        }
      })
      .catch((error) => {
        console.error('表单校验未通过:', error);
      });
    },
    saveParams() {
      let data = this.editConfig.infomation
@@ -801,6 +821,7 @@
    },
    //打印
    async btnPrint() {
      if(this.workType!==3){
      localStorage.removeItem('pdfParams');
      try {
        let res = await printReceipts(this.editCommonConfig.infomation.id);
@@ -825,6 +846,8 @@
        console.error(error);
      }
    }
    }
  }
}
</script>
@@ -847,6 +870,7 @@
    .btn:nth-of-type(2) {
      cursor: no-drop;
      color:#ccc;
    }
  }
}