ysy před 2 roky
rodič
revize
4a716e0c79

+ 350 - 0
src/views/bpm/handleTask/components/purchaseOrder/outSourceSendCk/addOrEditDialog.vue

@@ -0,0 +1,350 @@
+<template>
+  <div>
+    <el-form ref="form" :model="form" :rules="rules" label-width="120px">
+      <headerTitle title="发货信息"></headerTitle>
+
+      <el-row :gutter="20">
+        <el-col :span="12">
+          <el-form-item
+            label="选择订单"
+            prop="orderNo"
+            style="margin-bottom: 22px"
+          >
+            <el-input
+              clearable
+              v-model="form.orderNo"
+              @click.native="handleOrderBtn"
+              placeholder="请输入"
+            />
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item
+            label="外协单位"
+            prop="contactName"
+            style="margin-bottom: 22px"
+          >
+            <el-input v-model="form.supplierName" disabled></el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row :gutter="20">
+        <el-col :span="12">
+          <el-form-item
+            label="订单类型"
+            prop="sourceTypeName"
+            style="margin-bottom: 22px"
+          >
+            <el-input v-model="form.sourceTypeName" disabled></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item
+            label="外协单位联系人"
+            prop="linkName"
+            style="margin-bottom: 22px"
+          >
+            <el-input clearable v-model="form.linkName" placeholder="请输入"/>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row :gutter="20">
+        <el-col :span="12">
+          <el-form-item
+            label="计价方式"
+            style="margin-bottom: 22px">
+            <el-select v-model="form.pricingWay" disabled style="width: 100%">
+              <el-option label="按数量计费" :value="1"></el-option>
+              <el-option label="按重量计费" :value="2"></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item
+            label="外协单位电话"
+            prop="linkPhone"
+            style="margin-bottom: 22px"
+          >
+            <el-input clearable v-model="form.linkPhone" placeholder="请输入"/>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row :gutter="20">
+        <el-col :span="12">
+          <el-form-item label="车辆号" prop="carNo" style="margin-bottom: 22px">
+            <el-input clearable v-model="form.carNo" placeholder="请输入"/>
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item
+            label="送货单号"
+            prop="sendNoteNo"
+            style="margin-bottom: 22px"
+          >
+            <el-input
+              clearable
+              v-model="form.sendNoteNo"
+              placeholder="请输入"
+            />
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row :gutter="20">
+        <el-col :span="12">
+          <el-form-item prop="sendFiles" label="附件">
+            <fileUpload
+              v-model="form.files"
+              module="main"
+              :showLib="false"
+              :limit="10"
+            />
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+
+        </el-col>
+      </el-row>
+
+    </el-form>
+
+    <headerTitle title="产品清单" style="margin-top: 30px"></headerTitle>
+    <inventoryTable
+      :pricingWay="form.pricingWay"
+      ref="inventoryTableref"
+      :orderId="form.orderId"
+    ></inventoryTable>
+    <!--  采购订单  -->
+    <orderListDialog
+      :searchParams="orderSearchParams"
+      ref="orderListDialogRef"
+      @changeParent="changeOrder"
+    ></orderListDialog>
+  </div>
+</template>
+
+<script>
+
+import fileUpload from '@/components/upload/fileUpload';
+import dictMixins from '@/mixins/dictMixins';
+import {
+  savePurchaseOutSourceSendAPI,
+  updatePurchaseOutSourceSendAPI,
+  getPurchaseOutSourceSendDetailAPI,
+  submit
+} from '@/api/bpm/components/purchasingManage/outSourceSend';
+// import {getcontactlink} from '@/api/saleManage/businessFollow';
+import inventoryTable from './inventoryTable.vue';
+import orderListDialog from '../invoice/orderListDialog.vue';
+import {copyObj} from '@/utils/util';
+import {getpurchaseorderDetail} from "@/api/bpm/components/purchasingManage/purchaseOrder";
+
+export default {
+  mixins: [dictMixins],
+  components: {
+    fileUpload,
+    inventoryTable,
+    orderListDialog
+  },
+  props: {
+    businessId: {
+      default: ''
+    }
+  },
+  data() {
+    return {
+      orderSearchParams: {
+        sourceType: '3,4',
+      },
+      detailData: {},
+      payWayOptions: [],
+      delDetailIds: [],
+      linkNameOptions: [],
+      title: '',
+      row: {},
+      form: {
+        id: '',
+        carNo: '',
+        files: [],
+        linkName: '',
+        linkPhone: '',
+        orderId: '',
+        orderNo: '',
+        pricingWay: '',
+        productList: [],
+        sendNoteNo: '',
+        sourceType: '',
+        sourceTypeName: '',
+        supplierId: '',
+        supplierName: '',
+
+      },
+      rules: {
+        partaName: [
+          {required: true, message: '请选择客户名称', trigger: 'change'}
+        ],
+        linkName: [
+          {required: true, message: '请输入', trigger: ['blur', 'change']}
+        ],
+        linkPhone: [
+          {required: true, message: '请输入', trigger: ['blur', 'change']}
+        ],
+        orderNo: [
+          {required: true, message: '请选择', trigger: 'change'}
+        ],
+        receiveAddress: [
+          {required: true, message: '请输入', trigger: 'change'}
+        ],
+      },
+
+      // 提交状态
+      loading: false,
+    };
+  },
+  async created() {
+    await this.getSendSaleOrderDetail(this.businessId);
+  },
+  methods: {
+    //选择订单弹框
+    handleOrderBtn(e) {
+      if (e.target.nodeName == 'I') {
+        this.form = Object.assign({}, this.form, {
+          supplierId: '',
+          supplierName: '',
+          linkName: '',
+          linkPhone: '',
+          orderNo: '',
+          orderId: '',
+          sourceTypeName: '',
+          sourceType: '',
+          productList: [],
+          pricingWay: ''
+        });
+        this.$refs.inventoryTableref &&
+        this.$refs.inventoryTableref.putTableValue([]);
+        return
+      }
+      this.$refs.orderListDialogRef.open();
+    },
+    //选择订单回调
+    changeOrder(obj) {
+      this.getPurchaseOrderDetail(obj.id);
+    },
+    //获取订单详情
+    async getPurchaseOrderDetail(id) {
+      this.loading = true;
+      const data = await getpurchaseorderDetail(id);
+      this.loading = false;
+      if (data) {
+        this.$nextTick(() => {
+          let {
+            partbId,
+            partbName,
+            partbTel,
+            orderNo,
+            id,
+            partbLinkName,
+            productList,
+            sourceTypeName,
+            sourceType,
+            pricingWay
+          } = data;
+          if (productList && productList.length > 0) {
+            productList.forEach((v) => {
+              v.orderTotalCount = v.orderTotalCount || v.totalCount;
+            });
+          }
+          this.form = Object.assign({}, this.form, {
+            supplierId: partbId,
+            supplierName: partbName,
+            linkName: partbLinkName,
+            linkPhone: partbTel,
+            orderNo,
+            orderId: id,
+            sourceTypeName,
+            sourceType,
+            productList,
+            pricingWay
+          });
+          this.$refs.inventoryTableref &&
+          this.$refs.inventoryTableref.putTableValue(productList);
+        });
+      }
+    },
+
+    //发货单详情
+    async getSendSaleOrderDetail(id) {
+      this.businessId = id;
+
+      this.loading = true;
+      const data = await getPurchaseOutSourceSendDetailAPI(id);
+      this.loading = false;
+      if (data) {
+        this.$nextTick(() => {
+          this.form = data;
+          this.$refs.inventoryTableref &&
+          this.$refs.inventoryTableref.putTableValue(data.productList);
+        });
+      }
+    },
+
+    getValidate() {
+      return Promise.all([
+        new Promise((resolve, reject) => {
+          this.$refs.form.validate((valid) => {
+            if (!valid) {
+              reject(false);
+            } else {
+              resolve(true);
+            }
+          });
+        }),
+        new Promise((resolve, reject) => {
+          this.$refs.inventoryTableref.validateForm((valid) => {
+            if (!valid) {
+              reject(false);
+            } else {
+              resolve(true);
+            }
+          });
+        })
+      ]);
+    },
+    async getTableValue() {
+      return new Promise(async (resolve, reject) => {
+        try {
+          await this.getValidate();
+          this.form.files = this.form.files || [];
+          let commitData = Object.assign({}, this.form, {
+            productList: this.$refs.inventoryTableref.getTableValue()
+          });
+          await updatePurchaseOutSourceSendAPI(commitData)
+          resolve(true)
+
+        } catch (error) {
+          reject(false)
+          // 表单验证未通过,不执行保存操作
+        }
+      })
+
+    }
+  }
+};
+</script>
+<style scoped lang="scss">
+.TotalAmount {
+  font-size: 16px;
+  padding-right: 30px;
+}
+
+.headbox {
+  display: flex;
+  justify-content: flex-start;
+  align-items: center;
+
+  .amount {
+    font-size: 14px;
+    font-weight: bold;
+    margin-right: 20px;
+  }
+}
+</style>

+ 95 - 0
src/views/bpm/handleTask/components/purchaseOrder/outSourceSendCk/boxTabPage.vue

@@ -0,0 +1,95 @@
+<template>
+  <div>
+    <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
+      <el-tab-pane
+        v-for="item in tabOption"
+        :label="item.label"
+        :name="item.name"
+      >
+      </el-tab-pane>
+    </el-tabs>
+    <component
+      v-if="activeName && isValidComponent(activeName)"
+      :is="activeName"
+      :key="cKey"
+      ref="componentRef"
+      :taskDefinitionKey="taskDefinitionKey"
+      :activeComp="activeComp"
+      :businessId="businessId"
+      :infoData="{}"
+      :permissionType="permissionType"
+    />
+  </div>
+</template>
+
+<script>
+  export default {
+    name: 'boxTabPage',
+    components: {
+      tab1: () => import('./detailDialog.vue'),
+      tab2: () => import('./outsourcingOutbound.vue')
+    },
+    props: {
+      taskDefinitionKey: {
+        type: String,
+        default: ''
+      },
+      activeComp: {
+        type: String,
+        default: ''
+      },
+      permissionType: {
+        type: String,
+        default: 'view'
+      },
+      businessId: {
+        type: String,
+        default: ''
+      }
+    },
+    data() {
+      return {
+        form: {},
+        activeName: 'tab1',
+        cKey: 1
+      };
+    },
+    computed: {
+      tabOption() {
+        let list = [
+          {
+            label: '发货单详情',
+            name: 'tab1',
+            isShow: true
+          },
+          {
+            label: '出库',
+            name: 'tab2',
+            isShow: true
+          }
+        ];
+        return list.filter((item) => item.isShow);
+      }
+    },
+    async created() {},
+    methods: {
+      isValidComponent(componentName) {
+        const validComponents = ['tab1', 'tab2'];
+        return validComponents.includes(componentName);
+      },
+      handleClick(val) {
+        this.activeName = val.name;
+      },
+      async getTableValue() {
+        console.log(this.$refs.componentRef);
+        return {
+          form: this.$refs.componentRef.form,
+          returnStorageData: this.$refs.componentRef.getReturnStorage
+            ? await this.$refs.componentRef.getReturnStorage()
+            : ''
+        };
+      }
+    }
+  };
+</script>
+<style scoped lang="scss"></style>

+ 391 - 0
src/views/bpm/handleTask/components/purchaseOrder/outSourceSendCk/detailDialog.vue

@@ -0,0 +1,391 @@
+<template>
+ <div>
+   <el-form ref="form" :model="form" :rules="rules" label-width="130px">
+     <headerTitle title="发货信息"></headerTitle>
+     <el-row :gutter="20">
+       <el-col :span="12">
+         <el-form-item
+           label="委外发货单编码:"
+           prop="code"
+           style="margin-bottom: 22px"
+         >
+           {{ form.code }}
+         </el-form-item>
+       </el-col>
+       <el-col :span="12">
+         <el-form-item
+           label="采购订单编码:"
+           prop="orderNo"
+           style="margin-bottom: 22px"
+         >
+           {{ form.orderNo }}
+         </el-form-item>
+       </el-col>
+     </el-row>
+     <el-row :gutter="20">
+       <el-col :span="12">
+         <el-form-item
+           label="外协单位:"
+           prop="contactName"
+           style="margin-bottom: 22px"
+         >
+           {{ form.supplierName }}
+         </el-form-item>
+       </el-col>
+
+       <el-col :span="12">
+         <el-form-item
+           label="外协单位联系人:"
+           prop="linkName"
+           style="margin-bottom: 22px"
+         >
+           {{ form.linkName }}
+         </el-form-item>
+       </el-col>
+     </el-row>
+     <el-row :gutter="20">
+       <el-col :span="12">
+         <el-form-item
+           label="计价方式:"
+           style="margin-bottom: 22px">
+           {{ form.pricingWay == 1 ? '按数量计费' : '按重量计费' }}
+         </el-form-item>
+       </el-col>
+       <el-col :span="12">
+         <el-form-item
+           label="外协单位电话:"
+           prop="linkPhone"
+           style="margin-bottom: 22px"
+         >
+           {{ form.linkPhone }}
+         </el-form-item>
+       </el-col>
+     </el-row>
+     <el-row :gutter="20">
+       <el-col :span="12">
+         <el-form-item label="车辆号:" prop="carNo" style="margin-bottom: 22px">
+           {{ form.carNo }}
+         </el-form-item>
+       </el-col>
+       <el-col :span="12">
+         <el-form-item
+           label="送货单号:"
+           prop="sendNoteNo"
+           style="margin-bottom: 22px"
+         >
+           {{ form.sendNoteNo }}
+         </el-form-item>
+       </el-col>
+     </el-row>
+     <el-row :gutter="20">
+       <el-col :span="12">
+         <el-form-item
+           label="订单类型:"
+           prop="sourceTypeName"
+           style="margin-bottom: 22px"
+         >
+           {{ form.sourceTypeName }}
+         </el-form-item>
+       </el-col>
+       <el-col :span="12">
+         <el-form-item prop="files" label="附件:">
+           <div v-if="form.files && form.files?.length">
+             <el-link
+               v-for="link in form.files"
+               :key="link.id"
+               type="primary"
+               :underline="false"
+               @click="downloadFile(link)">
+               {{ link.name }}
+             </el-link>
+           </div>
+         </el-form-item>
+       </el-col>
+       <el-col :span="12">
+
+       </el-col>
+     </el-row>
+   </el-form>
+
+   <headerTitle title="产品清单"></headerTitle>
+   <ele-pro-table
+     ref="table"
+     :needPage="false"
+     :columns="competAnalysisListcolumns"
+     :toolkit="[]"
+     :datasource="detailData.productList"
+     row-key="id"
+   >
+     <!-- <template v-slot:toolbar>
+       <div class="headbox">
+       <span class="amount">总计:{{detailData.totalAmount}}元</span>
+       <span class="amount">应付金额:{{detailData.payAmount}}元</span>
+     </div>
+     </template> -->
+     <template v-slot:technicalDrawings="{ row }">
+       <div v-if="row.technicalDrawings && row.technicalDrawings?.length">
+         <el-link
+           v-for="link in row.technicalDrawings"
+           :key="link.id"
+           type="primary"
+           :underline="false"
+           @click="downloadFile(link)"
+         >
+           {{ link.name }}
+         </el-link
+         >
+       </div>
+     </template>
+   </ele-pro-table>
+ </div>
+</template>
+
+<script>
+import {getFile} from '@/api/system/file';
+import {
+  getPurchaseOutSourceSendDetailAPI,
+} from '@/api/bpm/components/purchasingManage/outSourceSend';
+
+
+export default {
+  props: {
+    businessId: {
+      default: ''
+    }
+  },
+  data() {
+    return {
+      detailId: '',
+      form: {},
+      detailData: {},
+      competAnalysisListcolumns: [
+        {
+          width: 45,
+          type: 'index',
+          columnKey: 'index',
+          align: 'center',
+          fixed: 'left'
+        },
+        {
+          minWidth: 140,
+          prop: 'productName',
+          label: '名称',
+          slot: 'productName',
+          align: "center"
+        },
+        {
+          minWidth: 120,
+          prop: 'productCode',
+          label: '编码',
+          slot: 'productCode',
+          align: "center"
+        },
+        {
+          minWidth: 100,
+          prop: 'productCategoryName',
+          label: '类型',
+          slot: 'productCategoryName',
+          align: "center"
+        },
+        {
+          width: 160,
+          prop: 'productBrand',
+          label: '牌号',
+          slot: 'productBrand',
+          align: "center"
+        },
+        {
+          width: 120,
+          prop: 'modelType',
+          label: '型号',
+          slot: 'modelType',
+          align: "center"
+        },
+        {
+          width: 120,
+          prop: 'specification',
+          label: '规格',
+          slot: 'specification',
+          align: "center"
+        },
+        {
+          width: 200,
+          prop: 'customerMark',
+          label: '客户代号',
+          slot: 'customerMark',
+          align: "center"
+        },
+        {
+          width: 200,
+          prop: 'warehouseName',
+          label: '仓库名称',
+          slot: 'warehouseName',
+          align: "center"
+        },
+
+        {
+          width: 120,
+          prop: 'totalCount',
+          label: '发货数量',
+          slot: 'totalCount',
+          align: "center"
+        },
+        {
+          width: 120,
+          prop: 'measuringUnit',
+          label: '计量单位',
+          slot: 'measuringUnit',
+          align: "center"
+        },
+        {
+          width: 120,
+          prop: 'singleWeight',
+          label: '单重',
+          slot: 'singleWeight',
+          align: "center"
+        },
+        {
+          width: 100,
+          prop: 'sendTotalWeight',
+          label: '发货总重',
+          slot: 'sendTotalWeight',
+          align: "center"
+        },
+        {
+          width: 100,
+          prop: 'weightUnit',
+          label: '重量单位',
+          slot: 'weightUnit',
+          align: "center"
+        },
+        {
+          width: 160,
+          prop: 'singlePrice',
+          label: '单价',
+          slot: 'singlePrice',
+          align: "center"
+        },
+        {
+          width: 100,
+          prop: 'discountSinglePrice',
+          label: '折让单价',
+          slot: 'discountSinglePrice',
+          align: "center"
+        },
+
+        {
+          width: 120,
+          prop: 'totalPrice',
+          label: '合计',
+          slot: 'totalPrice',
+          formatter: (_row, _column, cellValue) => {
+            return _row.totalPrice + '元';
+          },
+          align: "center"
+        },
+        {
+          width: 100,
+          prop: 'discountTotalPrice',
+          label: '折让合计',
+          slot: 'discountTotalPrice',
+          align: "center"
+        },
+        {
+          width: 120,
+          prop: 'deliveryDays',
+          label: '交期(天)',
+          slot: 'deliveryDays',
+          align: "center"
+        },
+        {
+          width: 200,
+          prop: 'guaranteePeriod',
+          label: '质保期',
+          slot: 'guaranteePeriod',
+          formatter: (_row, _column, cellValue) => {
+            return (_row.guaranteePeriod || '') + _row.guaranteePeriodUnitName;
+          },
+          align: "center"
+        },
+        // {
+        //   width: 120,
+        //   prop: 'guaranteePeriodUnitCode',
+        //   label: '',
+        //   slot: 'guaranteePeriodUnitCode'
+        // },
+        {
+          width: 120,
+          prop: 'technicalAnswerName',
+          label: '技术答疑人',
+          slot: 'technicalAnswerName',
+          align: "center"
+        },
+        {
+          width: 220,
+          prop: 'technicalParams',
+          label: '技术参数',
+          slot: 'technicalParams',
+          align: "center"
+        },
+        {
+          width: 240,
+          prop: 'technicalDrawings',
+          label: '技术图纸',
+          slot: 'technicalDrawings',
+          formatter: (_row, _column, cellValue) => {
+            return (_row.guaranteePeriod || '') + _row.guaranteePeriodUnitName;
+          },
+          align: "center"
+        },
+        {
+          width: 220,
+          prop: 'remark',
+          label: '备注',
+          slot: 'remark',
+          align: "center"
+        }
+      ]
+    };
+  },
+  created() {
+    this.getDetailData(this.businessId);
+  },
+  methods: {
+    downloadFile(file) {
+      getFile({objectName: file.storePath}, file.name);
+    },
+    async getDetailData(id) {
+      this.loading = true;
+      const data = await getPurchaseOutSourceSendDetailAPI(id);
+      this.loading = false;
+      if (data) {
+        this.form = data;
+        this.detailData = data;
+      }
+    },
+    getTableValue(){
+      return Promise.resolve(this.form)
+    }
+  }
+};
+</script>
+
+<style scoped lang="scss">
+.ele-dialog-form {
+  .el-form-item {
+    margin-bottom: 10px;
+  }
+}
+
+.headbox {
+  display: flex;
+  justify-content: flex-start;
+  align-items: center;
+
+  .amount {
+    font-size: 14px;
+    font-weight: bold;
+    margin-right: 20px;
+  }
+}
+</style>

+ 716 - 0
src/views/bpm/handleTask/components/purchaseOrder/outSourceSendCk/inventoryTable.vue

@@ -0,0 +1,716 @@
+<template>
+  <el-form ref="form" :model="form" :rules="rules">
+    <ele-pro-table
+      ref="table"
+      :needPage="false"
+      :columns="columns"
+      :toolkit="[]"
+      :datasource="form.datasource"
+      cache-key="systemRoleTable17"
+      class="time-form"
+    >
+      <!-- 表头工具栏 -->
+      <template v-slot:toolbar>
+        <div class="headbox" v-if="!contractId&&isShowAdd">
+          <el-button
+            size="small"
+            type="primary"
+            icon="el-icon-plus"
+            class="ele-btn-icon"
+            @click="handlAdd"
+          >
+            新增
+          </el-button>
+        </div>
+      </template>
+      <template v-slot:technicalDrawings="{ row, $index }">
+        <el-form-item
+          style="margin-bottom: 20px"
+          :prop="'datasource.' + $index + '.technicalDrawings'"
+        >
+          <div v-if="row.technicalDrawings && row.technicalDrawings?.length">
+            <el-link
+              v-for="link in row.technicalDrawings"
+              :key="link.id"
+              type="primary"
+              :underline="false"
+              @click="downloadFile(link)"
+            >
+              {{ link.name }}
+            </el-link
+            >
+          </div>
+        </el-form-item>
+      </template>
+      <template v-slot:industryArtFiles="{ row, $index }">
+        <el-form-item
+          style="margin-bottom: 20px"
+          :prop="'datasource.' + $index + '.industryArtFiles'"
+        >
+          <div v-if="row.industryArtFiles && row.industryArtFiles?.length">
+            <el-link
+              v-for="link in row.industryArtFiles"
+              :key="link.id"
+              type="primary"
+              :underline="false"
+              @click="downloadFile(link)"
+            >
+              {{ link.name }}
+            </el-link
+            >
+          </div>
+        </el-form-item>
+      </template>
+      <template v-slot:otherFiles="{ row, $index }">
+        <el-form-item
+          style="margin-bottom: 20px"
+          :prop="'datasource.' + $index + '.otherFiles'"
+        >
+          <div v-if="row.otherFiles && row.otherFiles?.length">
+            <el-link
+              v-for="link in row.otherFiles"
+              :key="link.id"
+              type="primary"
+              :underline="false"
+              @click="downloadFile(link)"
+            >
+              {{ link.name }}
+            </el-link
+            >
+          </div>
+        </el-form-item>
+      </template>
+      <template v-slot:customerReqFiles="{ row, $index }">
+        <el-form-item
+          style="margin-bottom: 20px"
+          :prop="'datasource.' + $index + '.customerReqFiles'"
+        >
+          <div v-if="row.customerReqFiles && row.customerReqFiles?.length">
+            <el-link
+              v-for="link in row.customerReqFiles"
+              :key="link.id"
+              type="primary"
+              :underline="false"
+              @click="downloadFile(link)"
+            >
+              {{ link.name }}
+            </el-link
+            >
+          </div>
+        </el-form-item>
+      </template>
+
+      <template v-slot:remark="{ row, $index }">
+        <el-form-item
+          style="margin-bottom: 20px"
+          :prop="'datasource.' + $index + '.remark'"
+        >
+          <el-input
+            clearable
+            v-model="row.remark"
+            type="textarea"
+            placeholder="请输入"
+          />
+        </el-form-item>
+      </template>
+      <template v-slot:totalCount="scope">
+        <el-form-item
+          style="margin-bottom: 20px"
+          :prop="'datasource.' + scope.$index + '.totalCount'"
+          :rules="[
+            { required: true, message: '请输入数字', trigger: 'blur' },
+
+          ]"
+        >
+          <!--           { validator: validateTotalCount(scope.row), trigger: 'blur' }-->
+          <el-input
+            v-model="scope.row.totalCount"
+            @input="(val) => changeNum(val,scope.row, scope.$index)"
+          ></el-input>
+        </el-form-item>
+      </template>
+      <template v-slot:warehouseId="scope">
+        <el-form-item
+          style="margin-bottom: 20px"
+          :prop="'datasource.' + scope.$index + '.warehouseId'"
+          :rules="[{ required: true, message: '请选择仓库', trigger: 'blur' }]"
+        >
+          <el-select
+            v-model="scope.row.warehouseId"
+            placeholder="请选择"
+            @change="warehouseChange(scope.$index, scope.row)"
+          >
+            <el-option
+              v-for="item in warehouseList"
+              :key="item.id"
+              :label="item.name"
+              :value="item.id"
+            >
+            </el-option>
+          </el-select>
+        </el-form-item>
+      </template>
+      <template v-slot:warehouseNum="scope">
+        <el-form-item style="margin-bottom: 20px">
+          {{ scope.row.warehouseNum }}
+        </el-form-item>
+      </template>
+      <template v-slot:headerTotalCount="{ column }">
+        <span class="is-required">{{ column.label }}</span>
+      </template>
+      <template v-slot:headerWarehouseId="{ column }">
+        <span class="is-required">{{ column.label }}</span>
+      </template>
+      <!-- 操作列 -->
+      <template v-slot:action="scope">
+        <el-popconfirm
+          class="ele-action"
+          title="确定要删除吗?"
+          @confirm="remove(scope.$index)"
+        >
+          <template v-slot:reference>
+            <el-link type="danger" :underline="false" icon="el-icon-delete">
+              删除
+            </el-link>
+          </template>
+        </el-popconfirm>
+      </template>
+    </ele-pro-table>
+    <product-list
+      ref="productListRef"
+      :orderId="orderId"
+      @changeParent="changeParent"
+    ></product-list>
+  </el-form>
+</template>
+<script>
+import {emailReg, phoneReg, numberReg} from 'ele-admin';
+import dictMixins from '@/mixins/dictMixins';
+import productList from './product-list.vue';
+import {
+  getWarehouseList,
+  getWarehouseOutStock
+} from '@/api/bpm/components/saleManage/saleorder';
+
+import {copyObj} from '@/utils/util';
+import {getFile} from "@/api/system/file";
+
+export default {
+  mixins: [dictMixins],
+  props: {
+    orderId: String,
+    isShowAdd: {
+      type: Boolean,
+      default: true
+    },
+    pricingWay: [String, Number]
+  },
+  components: {
+    productList
+  },
+  data() {
+    const defaultForm = {
+      key: null,
+      endTime: '',
+      isFirst: 0,
+      name: '',
+      startTime: '',
+      workHour: '',
+      technicalDrawings: []
+      // warehouseCode:"",
+      // warehouseId:'',
+      // warehouseName:'',
+    };
+    return {
+      discountTotalPrice: 0.0,
+      allPrice: 0.0,
+      numberReg,
+      defaultForm,
+      warehouseList: [],
+      form: {
+        datasource: []
+      },
+      rules: {},
+
+      columns: [
+        {
+          width: 45,
+          type: 'index',
+          columnKey: 'index',
+          align: 'center',
+          fixed: 'left'
+        },
+        {
+          minWidth: 200,
+          prop: 'productName',
+          label: '名称',
+          slot: 'productName',
+          align: "center"
+        },
+        {
+          minWidth: 120,
+          prop: 'productCode',
+          label: '编码',
+          slot: 'productCode',
+          align: "center"
+        },
+        {
+          minWidth: 150,
+          prop: 'productCategoryName',
+          label: '类型',
+          slot: 'productCategoryName',
+          align: "center"
+        },
+        {
+          minWidth: 100,
+          prop: 'productBrand',
+          label: '牌号',
+          slot: 'productBrand',
+          align: "center"
+        },
+        {
+          minWidth: 120,
+          prop: 'modelType',
+          label: '型号',
+          slot: 'modelType',
+          align: "center"
+        },
+        {
+          minWidth: 120,
+          prop: 'specification',
+          label: '规格',
+          slot: 'specification',
+          align: "center"
+        },
+        {
+          minWidth: 150,
+          prop: 'customerMark',
+          label: '客户代号',
+          slot: 'customerMark',
+          align: "center"
+        },
+        {
+          minWidth: 200,
+          prop: 'warehouseId',
+          label: '仓库名称',
+          slot: 'warehouseId',
+          headerSlot: 'headerWarehouseId',
+          align: "center"
+        },
+        {
+          minWidth: 80,
+          prop: 'warehouseNum',
+          label: '库存',
+          slot: 'warehouseNum',
+          align: "center"
+        },
+        {
+          width: 100,
+          prop: 'totalCount',
+          label: '发货数量',
+          slot: 'totalCount',
+          headerSlot: 'headerTotalCount',
+          align: "center"
+        },
+        // {
+        //   width: 120,
+        //   prop: 'orderTotalCount',
+        //   label: '总数量',
+        //   slot: 'orderTotalCount'
+        // },
+        {
+          minWidth: 100,
+          prop: 'measuringUnit',
+          label: '计量单位',
+          slot: 'measuringUnit',
+          align: "center"
+        },
+        {
+          width: 120,
+          prop: 'singleWeight',
+          label: '单重',
+          slot: 'singleWeight',
+          align: "center"
+        },
+        {
+          width: 100,
+          prop: 'sendTotalWeight',
+          label: '发货总重',
+          slot: 'sendTotalWeight',
+          align: "center"
+        },
+        {
+          width: 100,
+          prop: 'weightUnit',
+          label: '重量单位',
+          slot: 'weightUnit',
+          align: "center"
+        },
+        {
+          width: 80,
+          prop: 'singlePrice',
+          label: '单价',
+          slot: 'singlePrice',
+          align: "center"
+        },
+        {
+          width: 100,
+          prop: 'discountSinglePrice',
+          label: '折让单价',
+          slot: 'discountSinglePrice',
+          align: "center"
+        },
+        {
+          width: 80,
+          prop: 'totalPrice',
+          label: '合计',
+          slot: 'totalPrice',
+          align: "center"
+        },
+        {
+          width: 100,
+          prop: 'discountTotalPrice',
+          label: '折让合计',
+          slot: 'discountTotalPrice',
+          align: "center"
+        },
+
+        // {
+        //   width: 80,
+        //   prop: 'deliveryDays',
+        //   label: '交期(天)',
+        //   slot: 'deliveryDays'
+        // },
+        // {
+        //   width: 160,
+        //   prop: 'deliveryDeadline',
+        //   label: '交期截止日期',
+        //   slot: 'deliveryDeadline',
+        //   show: this.isDeliveryDeadline
+        // },
+        {
+          minWidth: 140,
+          prop: 'customerExpectDeliveryDeadline',
+          label: '客户期望交期',
+          slot: 'customerExpectDeliveryDeadline',
+          headerSlot: 'headerCustomerExpectDeliveryDeadline',
+          align: "center"
+        },
+        {
+          minWidth: 140,
+          prop: 'produceDeliveryDeadline',
+          label: '生产交付交期',
+          slot: 'produceDeliveryDeadline',
+          align: "center"
+        },
+        {
+          width: 100,
+          prop: 'guaranteePeriod',
+          label: '质保期',
+          slot: 'guaranteePeriod',
+          formatter: (_row, _column, cellValue) => {
+            return (_row.guaranteePeriod || '') + _row.guaranteePeriodUnitName;
+          },
+          align: "center"
+        },
+        {
+          minWidth: 120,
+          prop: 'guaranteePeriodDeadline',
+          label: '质保截止日期',
+          align: "center"
+        },
+        {
+          minWidth: 200,
+          prop: 'customerReqFiles',
+          label: '客户需求',
+          slot: 'customerReqFiles',
+          align: "center"
+        },
+        {
+          width: 130,
+          prop: 'technicalAnswerName',
+          label: '技术答疑人',
+          slot: 'technicalAnswerName',
+          align: "center"
+        },
+        {
+          width: 220,
+          prop: 'technicalParams',
+          label: '技术参数',
+          slot: 'technicalParams',
+          align: "center"
+        },
+        {
+          width: 240,
+          prop: 'technicalDrawings',
+          label: '技术图纸',
+          slot: 'technicalDrawings',
+          align: "center"
+        },
+        {
+          width: 240,
+          prop: 'industryArtFiles',
+          label: '工艺附件',
+          slot: 'industryArtFiles',
+          align: "center"
+        },
+        {
+          width: 240,
+          prop: 'otherFiles',
+          label: '其他附件',
+          slot: 'otherFiles',
+          align: "center"
+        },
+        {
+          width: 220,
+          prop: 'remark',
+          label: '备注',
+          slot: 'remark',
+          align: "center"
+        },
+        {
+          columnKey: 'action',
+          label: '操作',
+          width: 120,
+          align: 'center',
+          resizable: false,
+          slot: 'action',
+          fixed: 'right',
+          showOverflowTooltip: true
+        }
+      ]
+    };
+  },
+  created() {
+    getWarehouseList().then((res) => {
+      this.warehouseList = res;
+    });
+  },
+  computed: {
+    canHandl() {
+      return this.form.datasource.length;
+    },
+    contractId() {
+      return this.$store.state.order.contractId;
+    }
+  },
+  methods: {
+    downloadFile(file) {
+      getFile({objectName: file.storePath}, file.name);
+    },
+    async warehouseChange(index, row) {
+      let warehouseIds =
+        this.form.datasource
+          .filter(
+            (item, i) => row.productCode == item.productCode && index != i
+          )
+          .map((item) => item.warehouseId) || [];
+      const data = this.warehouseList.find(
+        (item) => item.id == row.warehouseId
+      );
+      if (warehouseIds.length > 0 && warehouseIds.includes(row.warehouseId)) {
+        row.warehouseId = '';
+        return this.$message.error('同一个产品不能选择相同的仓库');
+      }
+
+      this.$set(this.form.datasource[index], 'warehouseName', data.name);
+      this.$set(this.form.datasource[index], 'warehouseCode', data.code);
+      const warehouseOutStock = await getWarehouseOutStock({
+        warehouseId: data.id,
+        code: row.productCode
+      });
+      this.$set(
+        this.form.datasource[index],
+        'warehouseNum',
+        warehouseOutStock
+      );
+    },
+//修改数量更新合计
+    changeNum(val, row, index) {
+      this.$set(this.form.datasource[index], 'sendTotalWeight', val ? val * row.singleWeight : '');
+      this.$set(this.form.datasource[index], 'totalPrice', this.getTotalPrice(row).toFixed(2));
+      this.$set(this.form.datasource[index], 'discountTotalPrice', this.getDiscountTotalPrice(row).toFixed(2));
+    },
+    getTotalPrice(row) {
+      let num = 0
+      switch (this.pricingWay) {
+        case 1: //按数量计价计算总金额
+          num = Number(row.singlePrice) * Number(row.totalCount)
+          break;
+        case 2 ://按重量计价计算总金额
+          num = Number(row.singlePrice) * Number(row.totalCount) * Number(row.singleWeight)
+      }
+      return num
+    },
+    getDiscountTotalPrice(row) {
+      let num = 0
+      switch (this.pricingWay) {
+        case 1: //按数量计价计算总金额
+          num = Number(row.discountSinglePrice) * Number(row.totalCount)
+          break;
+        case 2 ://按重量计价计算总金额
+          num = Number(row.discountSinglePrice) * Number(row.totalCount) * Number(row.singleWeight)
+      }
+      return num
+    },
+    //选择产品回调
+    changeParent(obj, idx) {
+      obj.orderTotalCount = obj.totalCount;
+      obj.id = '';
+      this.$set(
+        this.form.datasource,
+        this.form.datasource.length,
+        copyObj(obj)
+      );
+    },
+    validateTotalCount(row) {
+      return (rule, value, callback) => {
+        if (isNaN(value) || Number(value) <= 0) {
+          this.$message.error('请输入大于0的数');
+          callback(new Error('请输入大于0的数字'));
+        } else if (Number(value) > row.warehouseNum) {
+          // this.$message.error('输入的数字不能大于仓库物品数');
+          // callback(new Error('输入的数字不能大于仓库物品数'));
+          callback();
+        } else if (Number(value) > row.orderTotalCount) {
+          this.$message.error('输入的数字不能大于最大发货值');
+          callback(new Error('输入的数字不能大于最大发货值'));
+        } else {
+          callback();
+        }
+      };
+    },
+    // 返回列表数据
+    getTableValue() {
+      let comitDatasource = this.form.datasource;
+      if (comitDatasource.length === 0) return [];
+      comitDatasource.forEach(async (v) => {
+        v.totalCount = Number(v.totalCount);
+        v.technicalDrawings = Array.isArray(v.technicalDrawings) ? v.technicalDrawings : [];
+        v.customerReqFiles = Array.isArray(v.customerReqFiles) ? v.customerReqFiles : [];
+        v.industryArtFiles = v.industryArtFiles || [];
+        v.otherFiles = v.otherFiles || [];
+      });
+      return comitDatasource;
+    },
+    getPrice() {
+      return [this.allPrice];
+    },
+
+    //修改回显
+    putTableValue(data) {
+      if (data) {
+        this.form.datasource = data;
+        data.forEach(async (item, index) => {
+          if (item.warehouseId) {
+            this.$set(
+              this.form.datasource[index],
+              'warehouseNum',
+              await getWarehouseOutStock({
+                warehouseId: item.warehouseId,
+                code: item.productCode
+              })
+            );
+          }
+          if(!item.sendTotalWeight)this.$set(item, 'sendTotalWeight', Number(item.totalCount) * Number(item.singleWeight) );
+        });
+      }
+    },
+    //选择产品
+    handParent(row, index) {
+      let item = {
+        id: row.productCode
+      };
+      this.$refs.productListRef.open(item, index);
+    },
+    //选择技术人回调
+    changeAnswer(obj, idx) {
+      this.$set(this.form.datasource[idx], 'technicalAnswerId', obj.id);
+      this.$set(this.form.datasource[idx], 'technicalAnswerName', obj.name);
+    },
+    handHead(row, index) {
+      let item = {
+        id: row.technicalAnswerId
+      };
+      this.$refs.headRef.open(item, index);
+    },
+
+    remove(i) {
+      this.form.datasource.splice(i, 1);
+      this.setSort();
+    },
+    // 清空表格
+    restTable() {
+      this.form.datasource = [];
+    },
+    // 重新排序
+    setSort() {
+      this.form.datasource.forEach((n, index) => {
+        n.key = index + 1;
+      });
+    },
+    // 添加
+    handlAdd() {
+      if (!this.orderId) return this.$message.error('请先选择订单');
+      this.$refs.productListRef.open(this.form.datasource);
+    },
+
+    validateForm(callback) {
+      //开始表单校验
+      this.$refs.form.validate((valid) => {
+        callback(valid);
+      });
+    }
+  }
+};
+</script>
+<style lang="scss" scoped>
+.headbox {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+
+  .amount {
+    font-size: 14px;
+    font-weight: bold;
+    padding-right: 30px;
+  }
+}
+
+.time-form .el-form-item {
+  margin-bottom: 0 !important;
+}
+
+::v-deep .period {
+  display: flex;
+
+  .borderleftnone {
+    .el-input--medium .el-input__inner {
+      border-top-right-radius: 0;
+      border-bottom-right-radius: 0;
+    }
+  }
+
+  .borderrightnone {
+    .el-input--medium .el-input__inner {
+      border-top-left-radius: 0;
+      border-bottom-left-radius: 0;
+    }
+  }
+}
+
+::v-deep .time-form tbody > tr:hover > td {
+  background-color: transparent !important;
+}
+
+::v-deep .time-form .el-table tr {
+  background-color: #ffffff;
+}
+
+.pricebox {
+  display: flex;
+  justify-content: flex-start;
+  align-items: center;
+  font-weight: bold;
+}
+</style>

+ 865 - 0
src/views/bpm/handleTask/components/purchaseOrder/outSourceSendCk/outsourcingOutbound.vue

@@ -0,0 +1,865 @@
+<!-- 采购委外发货审批(委外发货出库) 出库标识 -->
+<template>
+  <div class="ele-body">
+    <el-card shadow="never">
+      <el-form
+        :model="formData"
+        ref="formName"
+        label-width="110px"
+        :rules="rules"
+      >
+        <el-row :gutter="20">
+          <el-col :span="8">
+            <el-form-item label="出库场景" prop="bizType">
+              <span>{{ outboundTypeMapping[formData.bizType] }}</span>
+            </el-form-item></el-col
+          >
+          <el-col :span="8">
+            <el-form-item label="退货处理单" prop="sourceBizNo">
+              <span>{{ formData.sourceBizNo }}</span>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="出库物品类型" prop="extInfo.assetType">
+              <span>{{ assetTypeMapping[formData.extInfo.assetType] }}</span>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="权属部门" prop="deptName">
+              <el-input
+                v-if="!isStorage"
+                placeholder="权属部门"
+                disabled
+                v-model="formData.extInfo.deptName"
+                clearable
+              />
+              <span v-else>{{ formData.extInfo.deptName }}</span>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="出库登记人">
+              <el-input
+                v-if="!isStorage"
+                placeholder="登记人"
+                disabled
+                v-model="formData.extInfo.createUserName"
+                clearable
+              />
+              <span v-else>{{ formData.extInfo.createUserName }}</span>
+            </el-form-item></el-col
+          >
+          <el-col :span="8">
+            <el-form-item label="领料人部门" prop="verifyDeptName">
+              <selectTree
+                v-if="!isStorage"
+                ref="tree"
+                class="form-ipt"
+                size="medium"
+                style="width: 100%"
+                clearable
+                :options="treeList"
+                :props="{
+                  value: 'code',
+                  label: 'name',
+                  children: 'children'
+                }"
+                @getValue="auditorDeptClick"
+              />
+              <span v-else>{{ formData.extInfo.verifyDeptName }}</span>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="领料人" prop="fromUser">
+              <el-select
+                v-if="!isStorage"
+                v-model="formData.fromUser"
+                filterable
+                placeholder="请选择领料人"
+              >
+                <el-option
+                  v-for="item in llrLsit"
+                  :key="item.id"
+                  :label="item.name"
+                  :value="item.id"
+                  @click.native="
+                    () => (formData.extInfo.fromUserPhone = item.phone)
+                  "
+                >
+                </el-option>
+              </el-select>
+              <span v-else>{{ formData.fromUser }}</span>
+            </el-form-item></el-col
+          >
+          <el-col :span="8">
+            <el-form-item label="领料人联系方式" prop="fromUserPhone">
+              <el-input
+                v-if="!isStorage"
+                placeholder="请输入"
+                disabled
+                v-model="formData.extInfo.fromUserPhone"
+                clearable
+              />
+              <span v-else>{{ formData.fromUserPhone }}</span>
+            </el-form-item></el-col
+          >
+          <el-col :span="24">
+            <el-form-item label="备注" prop="remark">
+              <el-input
+                v-if="!isStorage"
+                v-model="formData.remark"
+                clearable
+                type="textarea"
+                placeholder="请详细说明"
+                :rows="4"
+              ></el-input>
+              <span v-else>{{ formData.remark }}</span>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+      <div v-if="!isStorage">
+        <el-button
+          style="margin-bottom: 20px; float: right; margin-right: 20px"
+          type="primary"
+          @click="addStock"
+          >添加</el-button
+        >
+      </div>
+      <div class="material">
+        <div style="width: 100%; text-align: right"></div>
+        <div>
+          <header-title title="物品清单"></header-title>
+          <div class="mt10 form-table">
+            <el-form
+              ref="warehousingMaterialListRef"
+              :model="{ warehousingMaterialList: warehousingMaterialList }"
+              :show-message="false"
+            >
+              <el-table
+                ref="multipleTable"
+                :data="warehousingMaterialList"
+                tooltip-effect="dark"
+                style="width: 100%"
+                stripe
+                :header-cell-style="{ background: '#EEEEEE', border: 'none' }"
+              >
+                <el-table-column label="序号" type="index" width="50">
+                </el-table-column>
+                <el-table-column
+                  label="编码"
+                  prop="assetCode"
+                  width="150"
+                ></el-table-column>
+
+                <el-table-column
+                  label="名称"
+                  prop="assetName"
+                  width="150"
+                ></el-table-column>
+
+                <el-table-column
+                  v-for="(item, index) in tableHeader"
+                  :key="index"
+                  align="center"
+                  :label="item.label"
+                  width="150"
+                  :prop="item.prop"
+                >
+                  <template slot-scope="{ row }">
+                    <template v-if="item.formatter">{{
+                      item.formatter(row)
+                    }}</template>
+                    <template v-else>{{ row[item.prop] }}</template>
+                  </template>
+                </el-table-column>
+                <el-table-column
+                  label="批号"
+                  prop="manualBatchNo"
+                  width="100"
+                ></el-table-column>
+                <el-table-column
+                  label="批次号"
+                  prop="batchNo"
+                ></el-table-column>
+                <el-table-column label="最小包装单元" width="120">
+                  <template slot-scope="{ row }">
+                    {{ row.minPackingCount }}{{ row.measuringUnit }}/{{
+                      row.minUnit
+                    }}
+                  </template>
+                </el-table-column>
+                <el-table-column label="包装数量" prop="availableCountBase">
+                  <template slot-scope="{ row }">
+                    {{ row.packingCountBase }}{{ row.minUnit }}
+                  </template>
+                </el-table-column>
+                <el-table-column
+                  label="计量数量"
+                  prop="availableCountBase"
+                ></el-table-column>
+                <el-table-column
+                  label="计量单位"
+                  prop="measuringUnit"
+                ></el-table-column>
+                <el-table-column label="重量" prop="weight"></el-table-column>
+                <el-table-column
+                  label="重量单位"
+                  prop="weightUnit"
+                ></el-table-column>
+                <el-table-column
+                  v-if="!isStorage"
+                  label="仓库"
+                  width="300"
+                  prop="warehouseName"
+                ></el-table-column>
+                <el-table-column
+                  v-else
+                  label="仓库"
+                  width="300"
+                  prop="position"
+                >
+                </el-table-column>
+                <!-- <el-table-column v-if="!isStorage" label="操作" width="200">
+                  <template slot-scope="{ row, $index }">
+                    <el-button type="text" @click="listDel(row, $index)"
+                      >删除</el-button
+                    >
+                  </template>
+                </el-table-column> -->
+              </el-table>
+            </el-form>
+          </div>
+          <header-title class="mt20" title="包装清单"></header-title>
+          <div class="mt10 form-table">
+            <BatchDetail
+              :assetType="formData.extInfo.assetType"
+              :data="batchDetailsVOList"
+            />
+          </div>
+        </div>
+        <div class="mt20">
+          <el-tabs v-model="activeName" type="card">
+            <el-tab-pane :label="`${title}明细`" name="a">
+              <el-table
+                ref="multipleTable"
+                :data="materialCodeReqList"
+                tooltip-effect="dark"
+                style="width: 100%"
+                stripe
+                :header-cell-style="rowClass"
+              >
+                <el-table-column label="序号" type="index" width="50">
+                </el-table-column>
+
+                <el-table-column
+                  :label="`编码`"
+                  width="150"
+                  prop="assetCode"
+                ></el-table-column>
+                <el-table-column label="名称" prop="name" width="150">
+                </el-table-column>
+                <el-table-column
+                  label="批号"
+                  prop="manualBatchNo"
+                  width="100"
+                ></el-table-column>
+                <el-table-column label="批次号" prop="batchNo">
+                </el-table-column>
+                <el-table-column
+                  label="发货条码"
+                  prop="barcodes"
+                  width="80"
+                  :show-overflow-tooltip="true"
+                ></el-table-column>
+                <el-table-column
+                  v-if="dimension == 4"
+                  label="包装编码"
+                  width="150"
+                  prop="onlyCode"
+                ></el-table-column>
+                <el-table-column
+                  v-for="(item, index) in tableHeader"
+                  :key="index"
+                  align="center"
+                  :label="item.label"
+                  width="150"
+                  :prop="item.prop"
+                >
+                  <template slot-scope="{ row }">
+                    <template v-if="item.formatter">{{
+                      item.formatter(row)
+                    }}</template>
+                    <template v-else>{{ row[item.prop] }}</template>
+                  </template>
+                </el-table-column>
+                <el-table-column
+                  label="物料编码"
+                  width="250"
+                  prop="no"
+                ></el-table-column>
+                <el-table-column label="计量数量" prop="">
+                  <template slot-scope="{ row }">1</template>
+                </el-table-column>
+                <el-table-column
+                  label="计量单位"
+                  prop="measuringUnit"
+                ></el-table-column>
+                <el-table-column
+                  label="物料代号"
+                  prop="meterielCode"
+                  width="130"
+                >
+                </el-table-column>
+                <el-table-column
+                  label="客户代号"
+                  prop="clientCode"
+                ></el-table-column>
+                <el-table-column label="刻码" prop="engrave"></el-table-column>
+                <el-table-column label="重量" prop="weight"></el-table-column>
+                <el-table-column
+                  label="重量单位"
+                  prop="weightUnit"
+                ></el-table-column>
+              </el-table>
+            </el-tab-pane>
+          </el-tabs>
+        </div>
+      </div>
+    </el-card>
+
+    <AssetsDialog
+      ref="assetsDialogRef"
+      :title="title"
+      :warehousingMaterialList="selectionList"
+      :assetType="formData.extInfo.assetType"
+      @detailData="detailData"
+    />
+  </div>
+</template>
+
+<script>
+  import outin from '@/api/warehouseManagement/outin';
+  import { getPurchaseOutSourceSendDetailAPI } from '@/api/bpm/components/purchasingManage/outSourceSend';
+  import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
+  import { deepClone } from '@/components/FormGenerator/utils/index';
+  import {
+    getTreeByPid,
+    getTreeByGroup,
+    getOutInBySourceBizNoOrError
+  } from '@/api/classifyManage';
+  import pickOrder from '@/views/bpm/outgoingManagement/components/pickOrder.vue';
+  import {
+    warehousingType,
+    outputSceneState,
+    emergencyState,
+    materialType
+  } from '@/utils/dict/index';
+  import selectTree from '@/components/selectTree';
+  import AssetsDialog from '@/views/bpm/outgoingManagement/components/AssetsDialog.vue';
+  import { tableHeader } from '@/views/bpm/handleTask/components/inoutBound/common';
+  import BatchDetail from '@/views/bpm/outgoingManagement/components/batchDetail.vue';
+  import { getLoginUser } from '@/api/login';
+  export default {
+    components: {
+      BatchDetail,
+      pickOrder,
+      selectTree,
+      AssetsDialog
+    },
+    props: {
+      taskDefinitionKey: {
+        type: String,
+        default: ''
+      },
+      activeComp: {
+        type: String,
+        default: ''
+      },
+      businessId: {
+        type: String,
+        default: ''
+      }
+    },
+    data() {
+      return {
+        form: {}, // 用于传参
+        outboundTypeMapping: {}, // 出库类型映射表
+        outputSceneState, // 出库类型类型
+        codeList: [], // 物品类型列表
+        assetTypeMapping: {}, // 物品类型映射表
+        isStorage: false, // 是否出库
+        dimension: '3',
+        materialType,
+        warehousingType,
+        emergencyState,
+        title: '',
+        warehousingMaterialList: [],
+        activeName: 'a',
+        treeList: [],
+        formData: {
+          extInfo: {
+            assetType: '', //物品类型
+            deptCode: '', //部门code
+            deptName: '', //部门名称
+            verifyDeptCode: '', //审核部门编码
+            verifyDeptName: '', //审核部门名称
+            deliveryName: '', //送货人名称
+            fromUserPhone: '', //送货人电话
+            sourceBizNo: '', //销售订单
+            urgent: '', //紧急状态
+            supplierId: '', //供应商ID
+            supplierName: '', //供应商名称
+            createUserName: '' //创建人名字
+          },
+          fromUser: '', //送货人
+          bizType: '', //物品类型
+          verifyId: '', //审核人Id
+          verifyName: '', //审核人名称
+          createUserId: '',
+          remark: ''
+        },
+
+        rules: {
+          bizType: {
+            required: true,
+            message: '请选择出库场景',
+            trigger: 'change'
+          },
+          fromUser: {
+            required: true,
+            message: '请选择领料人',
+            trigger: 'change'
+          }
+        },
+        llrLsit: [],
+        options: [],
+        onSelectTableDataVal: [],
+        batchDetailsVOList: [],
+        materialCodeReqList: [],
+        selectionList: [],
+        materialObj: {},
+        wlParams: {}
+      };
+    },
+    computed: {
+      tableHeader() {
+        return tableHeader(this.formData.extInfo.assetType);
+      }
+    },
+    async mounted() {
+      await this.initData();
+      let returnDetailsForm = await getPurchaseOutSourceSendDetailAPI(
+        this.businessId
+      );
+      this.form = returnDetailsForm;
+      console.log(returnDetailsForm);
+      getOutInBySourceBizNoOrError(returnDetailsForm.code)
+        .then((data) => {
+          // 已经出库(详情)
+          console.log('有订单来源');
+          this.isStorage = true; // 已经出库
+          this.formData = deepClone(data);
+          // 填充遍历数据
+          console.log('this.formData-----', this.formData);
+          if (this.formData.outInDetailVOList?.length > 0) {
+            this.warehousingMaterialList = []; // 物品列表
+            this.batchDetailsVOList = []; // 包装列表
+            this.materialCodeReqList = []; // 物料列表
+            this.formData.outInDetailVOList.forEach((goodsiItem) => {
+              goodsiItem.assetName = goodsiItem.name;
+              goodsiItem.assetCode = goodsiItem.categoryCode;
+              goodsiItem.outInNum = goodsiItem.packingCount;
+              this.warehousingMaterialList.push(goodsiItem);
+              goodsiItem.outInDetailRecordVOList.forEach((wrapItem) => {
+                wrapItem.assetName = goodsiItem.name;
+                wrapItem.assetCode = goodsiItem.categoryCode;
+                // wrapItem.count =
+                //   wrapItem.outInDetailRecordMaterialDetailVOList.length; // 增加包装计量数量
+                this.batchDetailsVOList.push(wrapItem);
+                wrapItem.outInDetailRecordMaterialDetailVOList.forEach(
+                  (materialItem) => {
+                    materialItem.isPack = true;
+                    this.materialCodeReqList.push(materialItem);
+                  }
+                );
+              });
+            });
+          }
+        })
+        .catch(() => {
+          //未出库
+          this.isStorage = false;
+          // 物品类型
+          this.formData.extInfo.assetType =
+            returnDetailsForm.categoryLevelTopId;
+          // 出库类型(委外出库)
+          this.formData.bizType = '6';
+          // 增加添加物品判断条件
+          this.title = this.assetTypeMapping[this.formData.extInfo.assetType];
+          // 添加单据来源
+          this.formData.sourceBizNo = returnDetailsForm.code;
+          // 将出库状态改成出库状态 2出库 1入库
+          this.formData.type = 2;
+          this.$forceUpdate();
+        });
+    },
+    methods: {
+      //获取回执附件
+      getQualityFile() {
+        return {};
+      },
+      detailData(data, dimension) {
+        this.dimension = dimension;
+        console.log('总数居', data);
+        this.onSelectTableDataVal = data.realTimeInventoryVOList;
+        this.warehousingMaterialList = data.realTimeInventoryVOList.map(
+          (next) => {
+            delete next.updateTime;
+            delete next.createTime;
+            return {
+              ...next,
+              realInventoryAmount: 0,
+              assetType: this.formData.extInfo.assetType,
+              outInNum: '',
+              assetCode: next.code,
+              assetName: next.name,
+              bizStatus: 2,
+              contactCode: next.contactCode
+            };
+          }
+        );
+        // this.batchDetailsVOList = data.batchDetailsVOList;
+
+        if (dimension == 4) {
+          this.materialCodeReqList = data.wlList;
+          this.selectionList = data.wlList;
+
+          //包装维度出库
+          const list = data.realTimeInventoryVOList;
+          //获取包装维度
+          let packArr = [];
+          for (const item of list) {
+            if (item.inventoryDetailsVOList.length != 0) {
+              for (const iterator of item.inventoryDetailsVOList) {
+                packArr.push({ ...iterator, batchNo: iterator.batchNum });
+              }
+            }
+          }
+          this.batchDetailsVOList = packArr.map((item) => {
+            return {
+              ...item,
+              packingCountBase:
+                dimension == 4 || dimension == 3 ? 1 : item.packingCountBase
+              // weight: 0
+            };
+          });
+
+          let params = {
+            realTimeInventoryNewPOList: data.realTimeInventoryVOList
+          };
+
+          for (const item of params.realTimeInventoryNewPOList) {
+            item.inventoryDetailsNewPOList = item.inventoryDetailsVOList;
+
+            for (const detail of item.inventoryDetailsNewPOList) {
+              detail.outInMaterialDetailsAddPOList = [];
+
+              for (const wlItem of data.wlList) {
+                if (detail.id === wlItem.recordId) {
+                  detail.outInMaterialDetailsAddPOList.push({
+                    ...wlItem
+                  });
+                }
+              }
+            }
+          }
+          this.wlParams = params;
+
+          this.materialObj = data;
+        } else if (dimension == 3) {
+          //包装维度出库
+          const list = data.realTimeInventoryVOList;
+          //获取包装维度
+          let packArr = [];
+          for (const item of list) {
+            if (item.inventoryDetailsVOList.length != 0) {
+              for (const iterator of item.inventoryDetailsVOList) {
+                packArr.push({ ...iterator, batchNo: iterator.batchNum });
+              }
+            }
+          }
+          this.batchDetailsVOList = packArr.map((item) => {
+            return {
+              ...item,
+              packingCountBase:
+                dimension == 4 || dimension == 3 ? 1 : item.packingCountBase
+              // weight: 0
+            };
+          });
+          //物料维度数据
+          let meteArr = [];
+          for (const item of packArr) {
+            if (item.materialDetailsVOList.length != 0) {
+              for (const iterator of item.materialDetailsVOList) {
+                meteArr.push({
+                  ...iterator
+                });
+              }
+            }
+          }
+          this.materialCodeReqList = meteArr;
+          //再次打开选择上
+          this.selectionList = list;
+          //send数据
+          this.wlParams = { realTimeInventoryNewPOList: list };
+          this.wlParams.realTimeInventoryNewPOList.forEach((item) => {
+            item.inventoryDetailsNewPOList = item.inventoryDetailsVOList;
+            item.inventoryDetailsNewPOList.forEach((ite) => {
+              ite.weight = 0;
+              ite.outInMaterialDetailsAddPOList = ite.materialDetailsVOList;
+            });
+          });
+        } else {
+          //   else if (dimension == 2) {
+          //   this.batchDetailsVOList = data.wlList;
+          //   this.selectionList = data.wlList;
+          // }
+          //物品维度出库
+          const list = data.realTimeInventoryVOList;
+          //获取包装维度
+          let packArr = [];
+          for (const item of list) {
+            if (item.inventoryDetailsVOList.length != 0) {
+              for (const iterator of item.inventoryDetailsVOList) {
+                packArr.push({ ...iterator, batchNo: iterator.batchNum });
+              }
+            }
+          }
+          this.batchDetailsVOList = packArr.map((item) => {
+            return {
+              ...item,
+              packingCountBase: dimension == 3 ? 1 : item.packingCountBase
+              // weight: 0
+            };
+          });
+          //物料维度数据
+          let meteArr = [];
+          for (const item of packArr) {
+            if (item.materialDetailsVOList.length != 0) {
+              for (const iterator of item.materialDetailsVOList) {
+                meteArr.push({
+                  ...iterator
+                });
+              }
+            }
+          }
+          this.materialCodeReqList = meteArr;
+          //再次打开选择上
+          this.selectionList = list;
+          //send数据
+          this.wlParams = { realTimeInventoryNewPOList: list };
+          this.wlParams.realTimeInventoryNewPOList.forEach((item) => {
+            item.inventoryDetailsNewPOList = item.inventoryDetailsVOList;
+            item.inventoryDetailsNewPOList.forEach((ite) => {
+              ite.weight = 0;
+              ite.outInMaterialDetailsAddPOList = ite.materialDetailsVOList;
+            });
+          });
+        }
+      },
+      getStatus() {
+        return true;
+      },
+      getReturnStorage() {
+        return new Promise((resolve) => {
+          this.$refs.formName.validate((valid) => {
+            if (valid) {
+              if (!this.warehousingMaterialList?.length) {
+                return this.$message.error('请添加出库明细!');
+              }
+              let obj = { ...this.formData, type: 2 };
+              obj.extInfo.sourceBizNo = obj.sourceBizNo;
+              obj.fromType = obj.type;
+              obj = { ...obj, ...this.wlParams };
+              if (this.dimension == 4) {
+                obj.num = this.materialObj.wlList.length;
+              } else {
+                obj.num = this.materialCodeReqList.length;
+              }
+              let isPass = false;
+              // 1按数量计费 2按重量计费
+              if (this.form.pricingWay == 2) {
+                if (this.materialCodeReqList.length > 0) {
+                  // 判断物料
+                  isPass = this.materialCodeReqList.every(
+                    (item) => item.weight > 0
+                  );
+                } else {
+                  // 判断包装重量是否全部大于0
+                  isPass = this.batchDetailsVOList.every(
+                    (item) => item.weight > 0
+                  );
+                }
+              } else {
+                isPass = true;
+              }
+              if (isPass) {
+                resolve(obj);
+              } else {
+                this.$message.error('委外发货重量不能为空');
+              }
+            }
+          });
+        });
+      },
+      rowClass({ row, column, rowIndex, columnIndex }) {
+        if (rowIndex === 1) {
+          return {
+            display: 'none',
+            background: '#EEEEEE',
+            border: 'none'
+          };
+        }
+        return { background: '#EEEEEE', border: 'none' };
+      },
+      // 部门点击事件
+      async auditorDeptClick(data) {
+        console.log(data);
+        this.formData.extInfo.verifyDeptCode = data?.id;
+        this.formData.extInfo.verifyDeptName = data?.name;
+        this.formData.verifyId = '';
+        this.formData.verifyName = '';
+
+        this.$refs.formName.validateField('verifyDeptName');
+        if (data) {
+          this.getStaffList(data);
+        }
+      },
+      // 获取领料人列表
+      async getStaffList(data) {
+        let res = await warehouseDefinition.getUserPage({
+          groupId: data.id,
+          size: 9999,
+          page: 1
+        });
+        this.llrLsit = res.list;
+      },
+      //出库明细删除
+      listDel(row, index) {
+        this.warehousingMaterialList.splice(index, 1);
+        if (this.warehousingMaterialList.length == 0) {
+          this.formData.sourceBizNo = '';
+          this.formData.extInfo.clientName = '';
+          this.formData.extInfo.clientUser = '';
+          this.formData.extInfo.clientUserPhone = '';
+        }
+        // 从 this.batchDetailsVOList 中删除满足条件的对象
+        this.removeItemsFromArray(
+          this.batchDetailsVOList,
+          (item) => item.code.substr(0, 12) === row.code
+        );
+
+        // 从 this.materialCodeReqList 中删除满足条件的对象
+        this.removeItemsFromArray(
+          this.materialCodeReqList,
+          (item) => item.assetCode === row.code
+        );
+      },
+      // 删除数组中满足条件的对象
+      removeItemsFromArray(arr, condition) {
+        for (let i = arr.length - 1; i >= 0; i--) {
+          if (condition(arr[i])) {
+            arr.splice(i, 1);
+          }
+        }
+      },
+      // 获取物品类型列表
+      async getAssetTypeOptions() {
+        const { data } = await getTreeByGroup({ type: 1 });
+        this.codeList = data;
+        let obj = {};
+        data.forEach((item) => {
+          obj[item.id] = item.name;
+        });
+        this.assetTypeMapping = obj;
+      },
+      // 出库类型映射表
+      async getOutboundTypeMapping() {
+        let obj = {};
+        this.outputSceneState.forEach((item) => {
+          obj[item.code] = item.label;
+        });
+        this.outboundTypeMapping = obj;
+      },
+      async initData() {
+        await this.getAssetTypeOptions();
+        await this.getOutboundTypeMapping();
+        const res = await warehouseDefinition.tree();
+        this.treeList = this.$util.toTreeData({
+          data: res,
+          idField: 'id',
+          parentIdField: 'parentId'
+        });
+        const info = await getLoginUser();
+        let obj = res.find(
+          (item) => item.id === info.deptId[info.deptId.length - 1]
+        );
+        if (!obj) return;
+        this.formData.extInfo.deptCode = obj.id;
+        this.formData.extInfo.deptName = obj.name;
+        this.formData.extInfo.createUserName = info.name;
+        this.formData.createUserId = info.id;
+      },
+      addStock() {
+        if (!this.title) return this.$message.error('请选择出库产品类型');
+        if (!this.formData.bizType && this.formData.bizType !== 0) {
+          return this.$message.error('请选择出库场景');
+        }
+        this.$refs.assetsDialogRef.open();
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  ::v-deep.form-table {
+    .el-form-item {
+      margin-bottom: 0;
+    }
+    .el-input__inner {
+      padding: 0 10px;
+    }
+  }
+
+  .p20 {
+    padding: 20px;
+  }
+  .el-select,
+  .el-date-editor {
+    width: 100%;
+  }
+  .el-form-item {
+    margin-bottom: 22px;
+  }
+  .material {
+    margin-top: 20px;
+    .flex {
+      display: flex;
+      justify-content: space-between;
+      font-size: 14px;
+      align-items: center;
+      .red {
+        color: #ff4949;
+      }
+    }
+  }
+  .mt10 {
+    margin-top: 10px;
+  }
+  .mt20 {
+    margin-top: 20px;
+  }
+  .center {
+    text-align: center;
+  }
+</style>

+ 244 - 0
src/views/bpm/handleTask/components/purchaseOrder/outSourceSendCk/product-list.vue

@@ -0,0 +1,244 @@
+<template>
+  <el-dialog
+    title="选择产品"
+    :visible.sync="visible"
+    :before-close="handleClose"
+    :close-on-click-modal="false"
+    top="5vh"
+    :close-on-press-escape="false"
+    append-to-body
+    width="80%"
+  >
+    <el-card shadow="never">
+      <ele-pro-table
+        ref="table"
+        :columns="columns"
+        :datasource="datasource"
+        row-key="id"
+        height="calc(100vh - 350px)"
+        class="dict-table"
+        @cell-click="cellClick"
+      >
+        <!-- 表头工具栏 -->
+        <template v-slot:action="{ row }">
+          <el-radio class="radio" v-model="radio" :label="row.id"
+          ><i></i
+          ></el-radio>
+        </template>
+      </ele-pro-table>
+    </el-card>
+
+    <div class="btns">
+      <el-button type="primary" size="small" @click="selected">选择</el-button>
+      <el-button size="small" @click="handleClose">关闭</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+
+// import {getSaleOrderDetail} from '@/api/saleManage/saleorder';
+import {getpurchaseorderDetail} from '@/api/bpm/components/purchasingManage/purchaseOrder';
+// import {getReceiveSaleOrderrecordDetail} from '@/api/purchasingManage/purchaseorderreceive';
+// import {getSendSaleOrderrecordDetail} from '@/api/saleManage/saleordersendrecord';
+
+export default {
+  props: {
+    orderId: String,
+    type: String
+  },
+
+  data() {
+    return {
+      visible: false,
+      currentIndex: null,
+      currentData: [], //已经存在的产品
+      datasource: [],
+      columns: [
+        {
+          action: 'action',
+          slot: 'action',
+          align: 'center',
+          label: '选择',
+          width: 50,
+        },
+        {
+          columnKey: 'index',
+          type: 'index',
+          width: 50,
+          align: 'center',
+          showOverflowTooltip: true,
+          label: '序号'
+        },
+        {
+          width: 200,
+          prop: 'productName',
+          label: '名称',
+          slot: 'productName',
+          align: "center"
+        },
+        {
+          width: 200,
+          prop: 'productCode',
+          label: '编码',
+          slot: 'productCode',
+          align: "center"
+        },
+        {
+          width: 200,
+          prop: 'productCategoryName',
+          label: '类型',
+          slot: 'productCategoryName',
+          align: "center"
+        },
+        {
+          width: 150,
+          prop: 'productBrand',
+          label: '牌号',
+          slot: 'productBrand',
+          align: "center"
+        },
+        {
+          minWidth: 120,
+          prop: 'modelType',
+          label: '型号',
+          slot: 'modelType',
+          align: "center"
+        },
+        {
+          minWidth: 120,
+          prop: 'specification',
+          label: '规格',
+          slot: 'specification',
+          align: "center"
+        },
+
+        {
+          width: 80,
+          prop: 'singlePrice',
+          label: '单价',
+          slot: 'singlePrice',
+          align: "center"
+        },
+        {
+          width: 80,
+          prop: 'totalCount',
+          label: '数量',
+          slot: 'totalCount',
+          align: "center"
+        },
+        {
+          width: 120,
+          prop: 'totalPrice',
+          label: '采购总金额',
+          slot: 'totalPrice',
+          formatter: (_row, _column, cellValue) => {
+            return _row.totalPrice + '元';
+          },
+          align: "center"
+        }
+      ],
+
+      radio: null
+    };
+  },
+
+  watch: {
+    orderId(id) {
+      if (id) {
+        this.getSaleOrderDetail(id);
+      }
+    }
+  },
+  methods: {
+    open(data) {
+      this.currentData = data || [];
+      this.visible = true;
+    },
+    //获取订单详情
+    async getSaleOrderDetail(id) {
+      this.loading = true;
+      const data = await getpurchaseorderDetail(id)
+      this.loading = false;
+      if (data) {
+        this.$nextTick(() => {
+          let {productList} = data;
+          this.datasource = productList;
+        });
+      }
+    },
+
+    /* 刷新表格 */
+    reload(where) {
+      this.$refs.table.reload({pageNum: 1, where: where});
+    },
+
+    handleNodeClick(data, node) {
+      this.curNodeData = data;
+      this.reload({categoryLevelId: data.id});
+    },
+
+    // 单击获取id
+    cellClick(row) {
+      this.current = row;
+      this.radio = row.id;
+    },
+    handleClose() {
+      this.visible = false;
+      this.current = null;
+      this.radio = '';
+    },
+
+    selected() {
+      if (!this.current) {
+        return this.$message.warning('请至少选择一条数据');
+      }
+      let idKey =
+        this.type == 'receive' ? 'receiveProductId' : 'sendProductId';
+      console.log(this.current);
+      console.log(this.currentData);
+      // return;
+      let index = this.currentData.findIndex(
+        (r) => r[idKey] == this.current.id
+      );
+      if (index != -1 && ['receive', 'send'].includes(this.type)) {
+        return this.$message.error('选择的产品已经存在列表了');
+      }
+      this.$emit('changeParent', this.current, this.currentIndex);
+      this.handleClose();
+    }
+  }
+};
+</script>
+
+<style lang="scss" scoped>
+.tree_col {
+  border: 1px solid #eee;
+  padding: 10px 0;
+  box-sizing: border-box;
+  height: 500px;
+  overflow: auto;
+}
+
+.table_col {
+  padding-left: 10px;
+
+  ::v-deep .el-table th.el-table__cell {
+    background: #f2f2f2;
+  }
+}
+
+.pagination {
+  text-align: right;
+  padding: 10px 0;
+}
+
+.btns {
+  text-align: center;
+  padding: 10px 0;
+}
+
+.topsearch {
+  margin-bottom: 15px;
+}
+</style>

+ 237 - 0
src/views/bpm/handleTask/components/purchaseOrder/outSourceSendCk/submit.vue

@@ -0,0 +1,237 @@
+<template>
+  <el-col :span="16" :offset="6">
+    <el-form label-width="100px" ref="formRef" :model="form">
+      <el-form-item
+        label="审批建议"
+        prop="reason"
+        style="margin-bottom: 20px"
+        :rules="{
+          required: true,
+          message: '请选择',
+          trigger: 'change'
+        }"
+      >
+        <el-input
+          type="textarea"
+          v-model="form.reason"
+          placeholder="请输入审批建议"
+        />
+      </el-form-item>
+    </el-form>
+    <div style="margin-left: 10%; margin-bottom: 20px; font-size: 14px">
+      <el-button
+        icon="el-icon-edit-outline"
+        type="success"
+        size="mini"
+        :loading="isLoading"
+        @click="handleAudit(1)"
+        >通过
+      </el-button>
+      <el-button
+        icon="el-icon-circle-close"
+        type="danger"
+        size="mini"
+        @click="handleAudit(0)"
+        v-if="!['starter'].includes(taskDefinitionKey)"
+        >驳回
+      </el-button>
+
+      <el-dropdown
+        @command="(command) => handleCommand(command)"
+        style="margin-left: 30px"
+      >
+        <span class="el-dropdown-link"
+          >更多<i class="el-icon-arrow-down el-icon--right"></i
+        ></span>
+        <el-dropdown-menu slot="dropdown">
+          <el-dropdown-item command="cancel">作废</el-dropdown-item>
+        </el-dropdown-menu>
+      </el-dropdown>
+
+      <!-- <el-button
+        icon="el-icon-circle-close"
+        type="danger"
+        size="mini"
+        @click="handleBackList"
+        >退回
+      </el-button> -->
+      <!-- <el-button
+        icon="el-icon-circle-close"
+        type="danger"
+        size="mini"
+        @click="handleAudit(0)"
+        v-if="taskDefinitionKey != 'productionSupervisorApprove1'"
+        >不通过
+      </el-button>
+      <el-button
+        icon="el-icon-edit-outline"
+        type="primary"
+        size="mini"
+        v-if="taskDefinitionKey != 'productionSupervisorApprove1'"
+        @click="handleUpdateAssignee"
+        >转办
+      </el-button> -->
+    </div>
+  </el-col>
+</template>
+
+<script>
+  import outin from '@/api/warehouseManagement/outin';
+  import { cancel } from '@/api/bpm/components/purchasingManage/outSourceSend';
+  import { approveTaskWithVariables } from '@/api/bpm/task';
+  import { getWarehouseListByIds } from '@/api/bpm/components/saleManage/saleorder';
+
+  // 流程实例的详情页,可用于审批
+  export default {
+    name: '',
+    components: {
+      //   Parser
+    },
+    props: {
+      businessId: {
+        default: ''
+      },
+      taskId: {
+        default: ''
+      },
+      id: {
+        default: ''
+      },
+      taskDefinitionKey: {
+        default: ''
+      }
+    },
+    data() {
+      return {
+        isLoading: false,
+        form: {
+          reason: ''
+        },
+        tabOptions: [
+          { key: 'starter', permissionType: 'update', name: '发起人申请' },
+          {
+            key: 'deptLeaderApprove',
+            permissionType: 'view',
+            name: '部门主管审批'
+          },
+          { key: 'storeman', permissionType: 'view', name: '仓管出库' }
+        ]
+      };
+    },
+    created() {},
+    methods: {
+      /** 处理转办审批人 */
+      handleUpdateAssignee() {
+        this.$emit('handleUpdateAssignee');
+      },
+      /** 退回 */
+      handleBackList() {
+        this.$emit('handleBackList');
+      },
+
+      async handleAudit(status) {
+        let storemanIds = '';
+        let permissionType = this.tabOptions.find(
+          (item) => item.key == this.taskDefinitionKey
+        )?.permissionType;
+        if (permissionType === 'update') {
+          await this.getTableValue();
+        }
+        if (this.taskDefinitionKey === 'deptLeaderApprove') {
+          let arr = await this.getTableValue();
+          let ids = arr.productList.map((item) => item.warehouseId);
+          let data = await getWarehouseListByIds(ids || []);
+          storemanIds = [...new Set(data.map((item) => item.ownerId))].join(
+            ','
+          );
+        }
+        if (this.taskDefinitionKey === 'storeman') {
+          let data = await this.getTableValue();
+          let storageData = data.returnStorageData;
+          // 入库来源storageSource 0-正常  1-外部(外部跳过内部审核流程)
+          storageData.storageSource = 1;
+          console.log(storageData);
+          try {
+            this.isLoading = true;
+            const res = await outin.saveNew(storageData);
+            if (res.code == 0) {
+              approveTaskWithVariables({
+                id: this.taskId,
+                reason: this.form.reason,
+                variables: {
+                  pass: !!status
+                }
+              }).then((res) => {
+                if (res.code != '-1') {
+                  this.$emit('handleAudit', {
+                    status: status,
+                    title: !status ? '驳回' : ''
+                  });
+                }
+                this.isLoading = false;
+              });
+            }
+          } catch (error) {
+            this.isLoading = false;
+            console.error('保存失败:', error);
+          }
+        } else {
+          await this._approveTaskWithVariables(status, storemanIds);
+        }
+      },
+      async _approveTaskWithVariables(status, storemanIds) {
+        let variables = {
+          pass: !!status,
+          storemanIds
+        };
+        approveTaskWithVariables({
+          id: this.taskId,
+          reason: this.form.reason,
+          variables
+        }).then((res) => {
+          if (res.data.code != '-1') {
+            this.$emit('handleAudit', {
+              status,
+              title: status === 0 ? '驳回' : ''
+            });
+          }
+        });
+      },
+
+      getTableValue() {
+        return new Promise((resolve, reject) => {
+          this.$emit('getTableValue', async (data) => {
+            resolve(await data);
+          });
+        });
+      },
+
+      //更多
+      handleCommand(command) {
+        if (command === 'cancel') {
+          this.$confirm('是否确认作废?', {
+            type: 'warning',
+            cancelButtonText: '取消',
+            confirmButtonText: '确定'
+          })
+            .then(() => {
+              cancel({
+                id: this.taskId,
+                reason: this.form.reason,
+                businessId: this.businessId
+              })
+                .then(() => {
+                  this.$emit('handleClose');
+                })
+                .catch(() => {
+                  this.$message.error('流程作废失败');
+                });
+            })
+            .catch(() => {});
+        }
+      }
+    }
+  };
+</script>
+
+<style lang="scss"></style>