Z há 1 ano atrás
pai
commit
6109fabec8

+ 80 - 7
src/views/bpm/handleTask/components/contractBook/addDialog.vue

@@ -56,7 +56,17 @@
               </el-option>
             </el-select>
           </el-form-item>
-
+          <el-form-item
+            prop="remark"
+            label="是否首工序"
+            v-if="form.categoryId == '1752993827954225153'"
+          >
+            <el-radio-group v-model="form.isFirstProcess">
+              <el-radio v-for="item in processList" :label="item.value">{{
+                item.label
+              }}</el-radio>
+            </el-radio-group>
+          </el-form-item>
           <el-form-item
             label="核价单"
             prop="sourceName"
@@ -478,7 +488,7 @@
         </el-col>
       </el-row>
 
-      <headerTitle title="产品清单" style="margin-top: 30px"></headerTitle>
+      <!-- <headerTitle title="产品清单" style="margin-top: 30px"></headerTitle>
       <inventoryTable
         ref="inventoryTable"
         :contractStartDate="this.form.contractStartDate"
@@ -486,7 +496,52 @@
         :isDiscountTotalPrice="true"
         :contractBookType="form.type"
         :pricingWay="form.pricingWay"
-      ></inventoryTable>
+      ></inventoryTable> -->
+      <el-tabs v-model="activeName" style="margin-top: 15px" type="border-card">
+        <el-tab-pane label="物品清单" name="1">
+          <inventoryTable
+            ref="inventoryTable"
+            :contractStartDate="this.form.contractStartDate"
+            :isCustomerMark="form.type == '1'"
+            :customerMark="form.customerMark"
+            :isDiscountTotalPrice="true"
+            :contractBookType="form.type"
+            :pricingWay="form.pricingWay"
+          ></inventoryTable>
+        </el-tab-pane>
+        <el-tab-pane
+          label="带料清单"
+          name="2"
+          v-if="form.categoryId == '1752993827954225153'"
+        >
+          <inventoryTable
+            ref="rawDetailListRef"
+            :detailType="1"
+            :contractStartDate="this.form.contractStartDate"
+            :isCustomerMark="form.type == '1'"
+            :customerMark="form.customerMark"
+            :isDiscountTotalPrice="true"
+            :contractBookType="form.type"
+            :pricingWay="form.pricingWay"
+          ></inventoryTable>
+        </el-tab-pane>
+        <el-tab-pane
+          label="产出清单"
+          name="3"
+          v-if="form.categoryId == '1752993827954225153'"
+        >
+          <inventoryTable
+            ref="outputDetailListRef"
+            :detailType="2"
+            :contractStartDate="this.form.contractStartDate"
+            :isCustomerMark="form.type == '1'"
+            :customerMark="form.customerMark"
+            :isDiscountTotalPrice="true"
+            :contractBookType="form.type"
+            :pricingWay="form.pricingWay"
+          ></inventoryTable>
+        </el-tab-pane>
+      </el-tabs>
       <headerTitle
         :title="form.type == '2' ? '付款方式' : '收款方式'"
         style="margin-top: 30px"
@@ -605,6 +660,7 @@ export default {
       settlementModeName: '结算方式',
       settlementMode: '4',
       pricingWay: 1,
+      isFirstProcess: 0,
       totalPrice: null,
       type: '', //1=销售合同  2=采购合同
       typeName: '',
@@ -614,6 +670,17 @@ export default {
     return {
       payWayOptions: [],
       delDetailIds: [],
+      activeName: '1',
+      processList: [
+          {
+            label: '是',
+            value: 1
+          },
+          {
+            label: '否',
+            value: 0
+          }
+        ],
       paymentTypeOptions: [
         { id: 1, name: '固定' },
         { id: 2, name: '分期' }
@@ -651,7 +718,6 @@ export default {
       opportunityDialogFlag: false,
       title: '',
       row: {},
-      activeName: 'base',
       formDef,
       form: copyObj(formDef),
       // removeBankList: [],
@@ -800,10 +866,12 @@ export default {
       const data = await getDetail(id);
       this.loading = false;
       if (data) {
+        let { contractVO } = data;
+          this.form = contractVO;
         this.$nextTick(() => {
-          let { contractVO } = data;
+
+
           this.dictChange(contractVO.type, 'init');
-          this.form = contractVO;
           if (this.form.fileId) {
             this.form.fileId = JSON.parse(this.form.fileId);
           }
@@ -811,6 +879,12 @@ export default {
             this.$refs.inventoryTable.putTableValue(data);
           this.$refs.paymentListTable &&
             this.$refs.paymentListTable.putTableValue(data.receiptPaymentList);
+            this.$refs.rawDetailListRef &&
+              this.$refs.rawDetailListRef.putTableValueNew(contractVO.rawList); //原料
+            this.$refs.outputDetailListRef &&
+              this.$refs.outputDetailListRef.putTableValueNew(
+                contractVO.outputList
+              );
           this.getLinkInfo(
             contractVO.type == '2' ? contractVO.partbId : contractVO.partaId
           );
@@ -1263,7 +1337,6 @@ export default {
     },
     cancel() {
       this.$nextTick(() => {
-        this.activeName = 'base';
         // 关闭后,销毁所有的表单数据
         this.$refs['otherForm'] && this.$refs['otherForm'].resetFields();
         this.$refs['formRef'] && this.$refs['formRef'].resetFields();

+ 20 - 5
src/views/bpm/handleTask/components/contractBook/inventoryTable.vue

@@ -22,7 +22,7 @@
           >
             新增
           </el-button>
-          <div class="pricebox">
+          <div class="pricebox"  v-if="!detailType">
             <span class="amount">总计:{{ allPrice }}元</span>
             <span v-if="isDiscountTotalPrice"></span>
             <el-form-item
@@ -112,14 +112,14 @@
           :prop="'datasource.' + scope.$index + '.totalCount'"
           :rules="{
             required: pageName == 'businessOpportunity' ? false : true,
-            pattern: numberReg,
-            message: '请输入数字',
+            message: '请输入',
             trigger: 'blur'
           }"
         >
           <el-input
             :disabled="isContractId"
             v-model="scope.row.totalCount"
+            type="number"
             placeholder="请输入"
             @input="changeCount(scope.row,scope.$index)"
           ></el-input>
@@ -594,6 +594,9 @@ export default {
       type: [Number, String],
       default: 1
     },
+      detailType: {
+        default: 0
+      }
   },
   data() {
     const defaultForm = {
@@ -719,7 +722,9 @@ export default {
           label: '单价',
           slot: 'singlePrice',
           headerSlot: 'headerSinglePrice',
-          align: "center"
+          align: "center",
+          show: !this.detailType
+
         },
         // {
         //   width: 160,
@@ -732,7 +737,9 @@ export default {
           prop: 'totalPrice',
           label: '合计',
           slot: 'totalPrice',
-          align: "center"
+          align: "center",
+          show: !this.detailType
+
         },
         // {
         //   width: 160,
@@ -996,6 +1003,7 @@ export default {
       let comitDatasource = this.form.datasource;
       if (comitDatasource.length === 0) return [];
       comitDatasource.forEach((v) => {
+        v.detailType = this.detailType;
         v.guaranteePeriodUnitName = this.getDictValue(
           '保质期单位',
           v.guaranteePeriodUnitCode
@@ -1013,6 +1021,9 @@ export default {
     },
     //改变数量
     changeCount(row, index) {
+      if (this.detailType) {
+          return;
+        }
       this.singleWeightChange(row, index);
       this.getTotalPrice()
     },
@@ -1111,6 +1122,10 @@ export default {
       }
       return isNaN(num) ? '' : num.toFixed(2)
     },
+    //带料 产出品
+    putTableValueNew(data) {
+        this.form.datasource = data;
+      },
     //修改回显
     putTableValue(data) {
       let productList =

+ 634 - 580
src/views/bpm/handleTask/components/purchaseOrder/addDialog.vue

@@ -15,9 +15,7 @@
               placeholder="请输入"
             />
           </el-form-item>
-          <el-form-item
-            label="采购计划单名称"
-            prop="planCode">
+          <el-form-item label="采购计划单名称" prop="planCode">
             <el-input
               @click.native="handPurchasePlan"
               v-model="form.purchasePlanName"
@@ -35,7 +33,6 @@
               clearable
               v-model="form.sourceType"
               :disabled="isFlag"
-
             >
               <!--  v-if="form.sourceType != 1" -->
             </DictSelection>
@@ -60,12 +57,18 @@
           <el-form-item
             label="计价方式"
             prop="pricingWay"
-            style="margin-bottom: 22px">
-            <el-radio-group v-model="form.pricingWay" @change="changePricingWay" :disabled="!!form.contractId">
-              <el-radio v-for="item in pricingWayList" :label="item.id">{{ item.name }}</el-radio>
+            style="margin-bottom: 22px"
+          >
+            <el-radio-group
+              v-model="form.pricingWay"
+              @change="changePricingWay"
+              :disabled="!!form.contractId"
+            >
+              <el-radio v-for="item in pricingWayList" :label="item.id">{{
+                item.name
+              }}</el-radio>
             </el-radio-group>
           </el-form-item>
-
         </el-col>
         <el-col :span="12">
           <el-form-item
@@ -93,18 +96,18 @@
             >
             </el-date-picker>
           </el-form-item> -->
-<!--          <el-form-item-->
-<!--            label="采购订单类型"-->
-<!--            prop="purchaseType"-->
-<!--            style="margin-bottom: 22px"-->
-<!--          >-->
-<!--            <DictSelection-->
-<!--              dictName="采购订单类型"-->
-<!--              clearable-->
-<!--              v-model="form.purchaseType"-->
-<!--            >-->
-<!--            </DictSelection>-->
-<!--          </el-form-item>-->
+          <!--          <el-form-item-->
+          <!--            label="采购订单类型"-->
+          <!--            prop="purchaseType"-->
+          <!--            style="margin-bottom: 22px"-->
+          <!--          >-->
+          <!--            <DictSelection-->
+          <!--              dictName="采购订单类型"-->
+          <!--              clearable-->
+          <!--              v-model="form.purchaseType"-->
+          <!--            >-->
+          <!--            </DictSelection>-->
+          <!--          </el-form-item>-->
           <el-form-item label="结算方式" prop="settlementMode">
             <DictSelection
               dictName="结算方式"
@@ -123,13 +126,13 @@
             />
           </el-form-item>
           <el-form-item prop="orderFiles" label="附件">
-            <fileMain v-model="form.orderFiles" ></fileMain>
-<!--            <fileUpload-->
-<!--              v-model="form.orderFiles"-->
-<!--              module="main"-->
-<!--              :showLib="false"-->
-<!--              :limit="10"-->
-<!--            />-->
+            <fileMain v-model="form.orderFiles"></fileMain>
+            <!--            <fileUpload-->
+            <!--              v-model="form.orderFiles"-->
+            <!--              module="main"-->
+            <!--              :showLib="false"-->
+            <!--              :limit="10"-->
+            <!--            />-->
           </el-form-item>
         </el-col>
       </el-row>
@@ -141,7 +144,7 @@
             prop="partaName"
             style="margin-bottom: 22px"
           >
-            <el-input clearable v-model="form.partaName" placeholder="请输入"/>
+            <el-input clearable v-model="form.partaName" placeholder="请输入" />
           </el-form-item>
           <el-form-item
             label="采购方统一社会信用代码"
@@ -184,7 +187,7 @@
             prop="partaFax"
             style="margin-bottom: 22px"
           >
-            <el-input clearable v-model="form.partaFax" placeholder="请输入"/>
+            <el-input clearable v-model="form.partaFax" placeholder="请输入" />
           </el-form-item>
           <el-form-item
             label="	采购方Email"
@@ -257,10 +260,10 @@
             </el-select>
           </el-form-item>
           <el-form-item prop="partbTel" label="供应商联系电话">
-            <el-input clearable v-model="form.partbTel" placeholder="请输入"/>
+            <el-input clearable v-model="form.partbTel" placeholder="请输入" />
           </el-form-item>
           <el-form-item prop="partbFax" label="供应商传真">
-            <el-input clearable v-model="form.partbFax" placeholder="请输入"/>
+            <el-input clearable v-model="form.partbFax" placeholder="请输入" />
           </el-form-item>
 
           <el-form-item
@@ -289,14 +292,47 @@
         </el-col>
       </el-row>
 
-      <headerTitle title="产品清单" style="margin-top: 30px"></headerTitle>
+      <el-tabs v-model="activeName" style="margin-top: 15px" type="border-card">
+        <el-tab-pane label="物品清单" name="1">
+          <inventoryTable
+            ref="inventoryTable"
+            @orderDiscountAmount="orderDiscountAmount"
+            :pricingWay="form.pricingWay"
+            :is-show-supplier-mark="true"
+            :isContractId="!!form.contractId"
+          >
+          </inventoryTable>
+        </el-tab-pane>
+        <el-tab-pane
+          label="带料清单"
+          name="2"
+          v-if="['3', '4', '5', '6'].includes(form.sourceType)"
+        >
+          <inventoryTable
+            ref="rawDetailListRef"
+            :pricingWay="form.pricingWay"
+            :is-show-supplier-mark="true"
+            :isContractId="!!form.contractId"
+            :detailType="1"
+          >
+          </inventoryTable>
+        </el-tab-pane>
+        <el-tab-pane
+          label="产出清单"
+          name="2"
+          v-if="['3', '4', '5', '6'].includes(form.sourceType)"
+        >
+          <inventoryTable
+            ref="outputDetailListRef"
+            :pricingWay="form.pricingWay"
+            :is-show-supplier-mark="true"
+            :isContractId="!!form.contractId"
+            :detailType="2"
+          >
+          </inventoryTable>
+        </el-tab-pane>
+      </el-tabs>
 
-      <inventoryTable ref="inventoryTable"
-                      @orderDiscountAmount="orderDiscountAmount"
-                      :pricingWay="form.pricingWay"
-                      :is-show-supplier-mark="true"
-                      :isContractId='!!form.contractId'>
-      </inventoryTable>
       <el-row style="margin-top: 20px">
         <el-col :span="12">
           <el-form-item
@@ -304,10 +340,14 @@
             prop="payAmount"
             style="margin-bottom: 22px"
           >
-            <el-input clearable v-model="form.payAmount" :disabled="!!form.contractId||!allcountAmount"
-                      type="number"
-                      @blur="discountInput"
-                      placeholder="请输入">
+            <el-input
+              clearable
+              v-model="form.payAmount"
+              :disabled="!!form.contractId || !allcountAmount"
+              type="number"
+              @blur="discountInput"
+              placeholder="请输入"
+            >
               <template slot="append">元</template>
             </el-input>
           </el-form-item>
@@ -358,572 +398,586 @@
 </template>
 
 <script>
-import {emailReg, numberReg} from 'ele-admin';
-import inventoryTable from './inventoryTable.vue';
-import fileUpload from '@/components/upload/fileUpload';
-import dictMixins from '@/mixins/dictMixins';
-import personSelect from '@/components/CommomSelect/person-select.vue';
-import parentList from '@/views/bpm/handleTask/components/quotation/parentList.vue';
-import {getDetail} from '@/api/bpm/components/contractManage/contractBook';
-import headList from '@/components/headList';
-
-import {getpurchaseorderDetail} from '@/api/bpm/components/purchasingManage/purchaseOrder';
-import {getcontactlink} from '@/api/bpm/components/saleManage/businessOpportunity.js';
-
-import contractListDialog from '@/views/bpm/handleTask/components/saleOrder/contractListDialog.vue';
-import {listOrganizations} from '@/api/system/organization';
-import {copyObj} from '@/utils/util';
-import {getpurchaseinquiry} from "@/api/bpm/components/purchasingManage/inquiryManage";
-import InquiryManageList from "@/views/bpm/handleTask/components/inquiryManage/inquiryManage-list.vue";
-import {getplanDetail, getPurchasePlanByContractIdAPI} from "@/api/bpm/components/purchasingManage/purchasePlanManage";
-import fileMain from "@/components/addDoc/index.vue";
-export default {
-  mixins: [dictMixins],
-  components: {
-    fileMain,
-    InquiryManageList,
-    fileUpload,
-    contractListDialog,
-    inventoryTable,
-    parentList,
-    personSelect,
-    headList
-  },
-  props: {
-    businessId: {
-      default: ''
-    }
-  },
-  data() {
-    let formDef = {
-      id: '',
-      contractId: '',
-      orderFiles: [],
-      contractName: '',
-      deliveryDate: '',
-      payAmount: '',
-      projectName: '',
-      projectId: '',
-      receiveAddress: '',
-      sourceType: '',
-      sourceTypeName: '',
-      pricingWay: 1,
-      remark: '',
-      saleType: '',
-      saleTypeName: '',
-      totalAmount: '',
-      settlementMode: '',
-      settlementModeName: '',
-      partaUnifiedSocialCreditCode: '',
-      partbUnifiedSocialCreditCode: '',
-      partaAddress: '',
-      partaEmail: '',
-      partaFax: '',
-      partaId: '',
-      partaLinkId: '',
-      partaLinkName: '',
-      partaName: '',
-      partaTel: '',
-      partbAddress: '',
-      partbEmail: '',
-      partbFax: '',
-      partbId: '',
-      partbLinkId: '',
-      partbLinkName: '',
-      partbName: '',
-      partbTel: '',
-      purchasePlanId: '',
-      purchasePlanNo: '',
-      purchasePlanName: '',
-
-    };
-
-    return {
-      clearing: false, //是否清除合同
-      isFlag: false, //需求类型是否可以修改
-      payWayOptions: [],
-      delDetailIds: [],
-      linkNameOptions: [],
-      visible: false,
-      title: '',
-      row: {},
-      activeName: 'base',
-      pricingWayList: [
-        {id: 1, name: '按数量计价'},
-        {id: 2, name: '按重量计价'}
-      ],
-      formDef,
-      form: copyObj(formDef),
-      tableBankData: [],
-      tableLinkData: [],
-      // 组织机构树形结构数据
-      groupTreeData: [],
-      groupData: [],
-      rules: {
-        deliveryDate: [
-          {required: true, message: '请选择交货日期', trigger: 'change'}
-        ],
-        // purchaseType: [
-        //   {required: true, message: '请选择采购订单类型', trigger: 'change'}
-        // ],
-        settlementMode: [
-          {required: true, message: '请选择结算方式', trigger: 'change'}
-        ],
-        partaName: [
-          {required: true, message: '请选择供应商名称', trigger: 'change'}
-        ],
-        partaLinkName: [
-          {required: true, message: '请选择供应商联系人', trigger: 'change'}
-        ],
-        acceptUnpack: [
-          {required: true, message: '请选择是否接受', trigger: 'change'}
-        ],
-        sourceType: [
-          {required: true, message: '请选择需求类型', trigger: 'change'}
-        ],
-        partaTel: [
-          {
-            required: true,
-            pattern: numberReg,
-            message: '请输入供应商联系电话',
-            trigger: 'blur'
-          }
-        ],
-
-        partbName: [
-          {required: true, message: '请输入供采购方名称', trigger: 'change'}
-        ],
-        partbLinkName: [
-          {
-            required: true,
-            message: '请输入供采购方联系人',
-            trigger: 'change'
-          }
-        ],
-        partbTel: [
-          {
-            required: true,
-            pattern: numberReg,
-            message: '请输入供采购方联系电话',
-            trigger: 'blur'
-          }
-        ],
-        partaEmail: [
-          {pattern: emailReg, message: '邮箱格式不正确', trigger: 'blur'}
-        ]
-      },
-
-      // 提交状态
-      loading: false,
-      // 是否是修改
-      isUpdate: false
-    };
-  },
-  computed: {
-    allcountAmount() {
-      return this.$store.state.order.allcountAmount;
-    }
-  },
-
-  created() {
-    this.getpurchaseorderDetail(this.businessId);
-    this.getGroupAll();
-  },
-
-  methods: {
-    // 选择负责人部门
-    change_principalDep(id) {
-      const info = this.groupData.find((e) => e.id == id);
-      this.form.requireDeptName = info.name;
-      // this.form.requireUserId = '';
-      // this.form.requireUserName = '';
-      this.$set(this.form, 'requireUserId', '');
-      this.$set(this.form, 'requireUserName', '');
-      // 根据部门获取人员
-
-      this.getrequireUser(id);
-    },
-    //切换计价方式重新算费用
-    changePricingWay() {
-      this.$refs.inventoryTable.getTotalPrice()
-    },
-    //选择采购计划
-    handPurchasePlan() {
-      this.$refs.inquiryManageRef.open(this.form.planCode);
-    },
-//选择采购计划回调
-    async changeInquiryManageList(data) {
-      this.form.purchasePlanId = data.id;
-      this.form.purchasePlanNo = data.planCode;
-      this.form.purchasePlanName = data.planName;
-
-
-      let info = await getplanDetail(data.id)
-      let cusInfo = {}
-      this.$set(this.form, 'purchasePlanName', data.planName);
-      this.$set(this.form, 'purchasePlanId', data.id);
-      this.$set(this.form, 'purchasePlanNo', data.planCode);
-      let form = {
-        contractVO: {
-          ...this.form
-        },
-        productList: info.detailList || []
-      }
-
-      this.$refs.inventoryTable &&
-      this.$refs.inventoryTable.putTableValue(form.productList);
-      await this.getLinkInfo(cusInfo.base.id)
-
+  import { emailReg, numberReg } from 'ele-admin';
+  import inventoryTable from './inventoryTable.vue';
+  import fileUpload from '@/components/upload/fileUpload';
+  import dictMixins from '@/mixins/dictMixins';
+  import personSelect from '@/components/CommomSelect/person-select.vue';
+  import parentList from '@/views/bpm/handleTask/components/quotation/parentList.vue';
+  import { getDetail } from '@/api/bpm/components/contractManage/contractBook';
+  import headList from '@/components/headList';
+
+  import { getpurchaseorderDetail } from '@/api/bpm/components/purchasingManage/purchaseOrder';
+  import { getcontactlink } from '@/api/bpm/components/saleManage/businessOpportunity.js';
+
+  import contractListDialog from '@/views/bpm/handleTask/components/saleOrder/contractListDialog.vue';
+  import { listOrganizations } from '@/api/system/organization';
+  import { copyObj } from '@/utils/util';
+  import { getpurchaseinquiry } from '@/api/bpm/components/purchasingManage/inquiryManage';
+  import InquiryManageList from '@/views/bpm/handleTask/components/inquiryManage/inquiryManage-list.vue';
+  import {
+    getplanDetail,
+    getPurchasePlanByContractIdAPI
+  } from '@/api/bpm/components/purchasingManage/purchasePlanManage';
+  import fileMain from '@/components/addDoc/index.vue';
+  export default {
+    mixins: [dictMixins],
+    components: {
+      fileMain,
+      InquiryManageList,
+      fileUpload,
+      contractListDialog,
+      inventoryTable,
+      parentList,
+      personSelect,
+      headList
     },
-    // //选择需求来源类型
-    // chaengSource(data) {
-    //   this.form.sourceType = data?.dictValue;
-    // },
-    getrequireUser(groupId) {
-      if (groupId) {
-        this.$refs.directorRef.getList({groupId});
+    props: {
+      businessId: {
+        default: ''
       }
     },
-    salesmanChange(val, info) {
-      this.$set(this.form, 'requireUserId', val);
-      this.$set(this.form, 'requireUserName', info.name);
-      // this.form.requireUserName = info.name;
-    },
-    // 获取公司数据
-    getGroupAll() {
-      listOrganizations().then((list) => {
-        this.groupData = list;
-        this.groupTreeData = this.$util.toTreeData({
-          data: list,
-          idField: 'id',
-          parentIdField: 'parentId'
-        });
-      });
-    },
-    discountInput() {
-      this.$refs.inventoryTable.discountInputByOrder(this.form.payAmount)
-    },
-    //产品清单修改单价或者数量重置优惠金额
-    orderDiscountAmount(val=0){
-      this.form.payAmount = val
-    },
-    //选择供应商
-    changeSupplier(obj) {
-      this.form = Object.assign({}, this.form, {
-        partbId: obj.id,
-        partbName: obj.name,
-        partbAddress: obj.addressName + obj.address,
+    data() {
+      let formDef = {
+        id: '',
+        contractId: '',
+        orderFiles: [],
+        contractName: '',
+        deliveryDate: '',
+        payAmount: '',
+        projectName: '',
+        projectId: '',
+        receiveAddress: '',
+        sourceType: '',
+        sourceTypeName: '',
+        pricingWay: 1,
+        remark: '',
+        saleType: '',
+        saleTypeName: '',
+        totalAmount: '',
+        settlementMode: '',
+        settlementModeName: '',
+        partaUnifiedSocialCreditCode: '',
+        partbUnifiedSocialCreditCode: '',
+        partaAddress: '',
+        partaEmail: '',
+        partaFax: '',
+        partaId: '',
+        partaLinkId: '',
+        partaLinkName: '',
+        partaName: '',
+        partaTel: '',
+        partbAddress: '',
+        partbEmail: '',
+        partbFax: '',
+        partbId: '',
         partbLinkId: '',
         partbLinkName: '',
-        partbEmail: '',
-        partbTel: ''
-      });
-      this.getLinkInfo(obj.id);
-    },
-    //选择合同获取合同的详情
-    async getDetailData(id) {
-      this.loading = true;
-      const data = await getDetail(id);
-      this.loading = false;
-      if (data) {
-        this.$nextTick(() => {
-          let {contractVO} = data;
-          // this.form=contractVOform.receiveAddress
-          let {
-            partaAddress,
-            partaEmail,
-            partaFax,
-            partaId,
-            partaLinkId,
-            partaLinkName,
-            partaName,
-            partaTel,
-            partbAddress,
-            partbEmail,
-            partbFax,
-            partbId,
-            partbLinkId,
-            partbLinkName,
-            partbName,
-            partbTel,
-            totalPrice,
-            discountTotalPrice,
-            partaUnifiedSocialCreditCode,
-            partbUnifiedSocialCreditCode,
-            settlementMode,
-            settlementModeName,
-            pricingWay
-          } = contractVO;
-          this.form = Object.assign({}, this.form, {
-            partaAddress,
-            partaEmail,
-            partaFax,
-            partaId,
-            partaLinkId,
-            partaLinkName,
-            partaName,
-            partaTel,
-            partbAddress,
-            partbEmail,
-            partbFax,
-            partbId,
-            partbLinkId,
-            partbLinkName,
-            partbName,
-            partbTel,
-            totalPrice,
-            discountTotalPrice,
-            partaUnifiedSocialCreditCode,
-            partbUnifiedSocialCreditCode,
-            pricingWay,
-            totalAmount: totalPrice,
-            payAmount: discountTotalPrice,
-            receiveAddress: partaAddress,
-            settlementMode,
-            settlementModeName
-          });
-          this.getLinkInfo(partaId);
-
-          this.$refs.inventoryTable &&
-          this.$refs.inventoryTable.putTableValue(
-            data.productList,
-            contractVO.contractStartDate
-          );
-          this.$store.commit('order/setAllcountAmount', totalPrice);
-        });
-      }
-    },
-
-    //获取订单详情
-    async getpurchaseorderDetail(id) {
-      this.loading = true;
-      const data = await getpurchaseorderDetail(id);
-      this.loading = false;
-      if (data) {
-        this.$nextTick(() => {
-          this.form = data;
-          this.$refs.inventoryTable &&
-          this.$refs.inventoryTable.putTableValue(data.productList);
-          this.getLinkInfo(data.partaId);
-          this.getrequireUser(this.form.requireDeptId);
-
-          this.$store.commit('order/setAllcountAmount', data.totalAmount);
-          this.$store.commit('order/setContractId', data.contractId);
-        });
-      }
-    },
-
-    //更新联系人数据
-    async getLinkInfo(contactId) {
-      const data = await getcontactlink({contactId});
-      if (data && data?.length) {
-        this.linkNameOptions = data;
-      }
-    },
-    selectFocus() {
-      if (this.linkNameOptions.length === 0) {
-        return this.$message.error('请先选择名称');
-      }
-    },
-
-    //选择下拉框
-    onchangeLink(selectedOptions) {
-      const option = this.linkNameOptions.find(
-        (opt) => opt.id === selectedOptions
-      );
-      this.form = Object.assign({}, this.form, {
-        partbEmail: option?.email,
-        partbLinkName: option?.linkName || '',
-        partbTel: option?.mobilePhone || option?.phone || '',
-        partbLinkId: option?.id
-      });
-    },
-
-    handHead() {
-      let item = {
-        id: this.form.partaLinkId
+        partbName: '',
+        partbTel: '',
+        purchasePlanId: '',
+        purchasePlanNo: '',
+        purchasePlanName: ''
       };
-      this.$refs.headRef.open(item);
-    },
 
-    //选择供采购方人回调
-    changePersonel(obj) {
-      this.$set(this.form, 'partaLinkId', obj.id);
-      this.$set(this.form, 'partaLinkName', obj.name);
-      this.$set(this.form, 'partaTel', obj.phone);
-      this.$set(this.form, 'partaEmail', obj.email);
-    },
-    //选择供应商回调
-    changeParent(obj) {
-      this.form = Object.assign({}, this.form, {
-        partbId: obj.id,
-        partbName: obj.name,
-        partbAddress: obj.addressName + obj.address,
-        partbLinkId: '',
-        partbLinkName: '',
-        partbEmail: '',
-        partbTel: ''
-      });
-      this.getLinkInfo(obj.id);
-    },
+      return {
+        clearing: false, //是否清除合同
+        isFlag: false, //需求类型是否可以修改
+        payWayOptions: [],
+        delDetailIds: [],
+        linkNameOptions: [],
+        visible: false,
+        title: '',
+        row: {},
+        activeName: 'base',
+        pricingWayList: [
+          { id: 1, name: '按数量计价' },
+          { id: 2, name: '按重量计价' }
+        ],
+        formDef,
+        form: copyObj(formDef),
+        tableBankData: [],
+        tableLinkData: [],
+        // 组织机构树形结构数据
+        groupTreeData: [],
+        groupData: [],
+        rules: {
+          deliveryDate: [
+            { required: true, message: '请选择交货日期', trigger: 'change' }
+          ],
+          // purchaseType: [
+          //   {required: true, message: '请选择采购订单类型', trigger: 'change'}
+          // ],
+          settlementMode: [
+            { required: true, message: '请选择结算方式', trigger: 'change' }
+          ],
+          partaName: [
+            { required: true, message: '请选择供应商名称', trigger: 'change' }
+          ],
+          partaLinkName: [
+            { required: true, message: '请选择供应商联系人', trigger: 'change' }
+          ],
+          acceptUnpack: [
+            { required: true, message: '请选择是否接受', trigger: 'change' }
+          ],
+          sourceType: [
+            { required: true, message: '请选择需求类型', trigger: 'change' }
+          ],
+          partaTel: [
+            {
+              required: true,
+              pattern: numberReg,
+              message: '请输入供应商联系电话',
+              trigger: 'blur'
+            }
+          ],
+
+          partbName: [
+            { required: true, message: '请输入供采购方名称', trigger: 'change' }
+          ],
+          partbLinkName: [
+            {
+              required: true,
+              message: '请输入供采购方联系人',
+              trigger: 'change'
+            }
+          ],
+          partbTel: [
+            {
+              required: true,
+              pattern: numberReg,
+              message: '请输入供采购方联系电话',
+              trigger: 'blur'
+            }
+          ],
+          partaEmail: [
+            { pattern: emailReg, message: '邮箱格式不正确', trigger: 'blur' }
+          ]
+        },
 
-    //选择合同回调
-    changeContract(obj) {
-      this.form = Object.assign({}, this.form, {
-        contractId: obj.id,
-        contractName: obj.contractName,
-        contractNo: obj.contractNo
-      });
-
-      this.getDetailData(obj.id);
-      // //采购询价表
-      // this.getPurchaseinquiry(obj.sourceId);
-      //获取合同采购计划
-      this.getPlanInfo(this.form.contractId)
-      this.$store.commit('order/setContractId', obj.id);
-    },
-    async getPlanInfo(id) {
-      let res = await getPurchasePlanByContractIdAPI(id)
-      this.form = Object.assign({}, this.form, {
-        purchasePlanId: res.data?.id,
-        purchasePlanName: res.data?.planName,
-        purchasePlanNo: res.data?.planCode,
-        sourceType: res.data?.sourceType,
-        sourceTypeName: res.data?.sourceTypeName,
-      });
-    },
-    //选择合同弹框
-    handleContractBtn() {
-      if (this.clearing) return;
-      let item = {
-        id: this.form.contractId
+        // 提交状态
+        loading: false,
+        // 是否是修改
+        isUpdate: false
       };
-      this.$refs.selectContractRef.open(item);
-    },
-    //清除合同
-    clearContrcat() {
-      this.clearing = true;
-      this.isFlag = false;
-      let {
-        id,
-        projectName,
-        saleType,
-        saleTypeName,
-        deliveryDate,
-        orderFiles,
-        remark
-      } = this.form;
-      this.form = Object.assign({}, copyObj(this.formDef), {
-        id,
-        projectName,
-        saleType,
-        saleTypeName,
-        deliveryDate,
-        orderFiles,
-        remark
-      });
-
-      this.$store.commit('order/setContractId', '');
-      this.$store.commit('order/setAllcountAmount', 0);
-      this.$refs.inventoryTable.putTableValue([]);
-
-      setTimeout(() => {
-        this.clearing = false;
-      }, 500);
     },
-
-    handParent() {
-      if (this.form.contractId) {
-        return this.$message.error('选择了合同不能更改供应商名称');
+    computed: {
+      allcountAmount() {
+        return this.$store.state.order.allcountAmount;
       }
-      let item = {
-        id: this.form.contactId
-      };
-      this.$refs.parentRef.open(item);
     },
 
-    settlementModeChange(info) {
-      this.form.settlementModeName = info.dictValue;
-    },
-    ifChiefChange(value, idx) {
-      if (value === 1) {
-        this.tableLinkData.forEach((e) => (e.ifChief = 0));
-        this.tableLinkData[idx].ifChief = 1;
-      }
+    created() {
+      this.getpurchaseorderDetail(this.businessId);
+      this.getGroupAll();
     },
 
-    getValidate() {
-      return Promise.all([
-        new Promise((resolve, reject) => {
-          this.$refs.form.validate((valid) => {
-            if (!valid) {
-              reject(false);
-            } else {
-              resolve(true);
-            }
+    methods: {
+      // 选择负责人部门
+      change_principalDep(id) {
+        const info = this.groupData.find((e) => e.id == id);
+        this.form.requireDeptName = info.name;
+        // this.form.requireUserId = '';
+        // this.form.requireUserName = '';
+        this.$set(this.form, 'requireUserId', '');
+        this.$set(this.form, 'requireUserName', '');
+        // 根据部门获取人员
+
+        this.getrequireUser(id);
+      },
+      //切换计价方式重新算费用
+      changePricingWay() {
+        this.$refs.inventoryTable.getTotalPrice();
+      },
+      //选择采购计划
+      handPurchasePlan() {
+        this.$refs.inquiryManageRef.open(this.form.planCode);
+      },
+      //选择采购计划回调
+      async changeInquiryManageList(data) {
+        this.form.purchasePlanId = data.id;
+        this.form.purchasePlanNo = data.planCode;
+        this.form.purchasePlanName = data.planName;
+
+        let info = await getplanDetail(data.id);
+        let cusInfo = {};
+        this.$set(this.form, 'purchasePlanName', data.planName);
+        this.$set(this.form, 'purchasePlanId', data.id);
+        this.$set(this.form, 'purchasePlanNo', data.planCode);
+        let form = {
+          contractVO: {
+            ...this.form
+          },
+          productList: info.detailList || []
+        };
+
+        this.$refs.inventoryTable &&
+          this.$refs.inventoryTable.putTableValue(form.productList);
+        await this.getLinkInfo(cusInfo.base.id);
+      },
+      // //选择需求来源类型
+      // chaengSource(data) {
+      //   this.form.sourceType = data?.dictValue;
+      // },
+      getrequireUser(groupId) {
+        if (groupId) {
+          this.$refs.directorRef.getList({ groupId });
+        }
+      },
+      salesmanChange(val, info) {
+        this.$set(this.form, 'requireUserId', val);
+        this.$set(this.form, 'requireUserName', info.name);
+        // this.form.requireUserName = info.name;
+      },
+      // 获取公司数据
+      getGroupAll() {
+        listOrganizations().then((list) => {
+          this.groupData = list;
+          this.groupTreeData = this.$util.toTreeData({
+            data: list,
+            idField: 'id',
+            parentIdField: 'parentId'
           });
-        }),
-        new Promise((resolve, reject) => {
-          this.$refs.inventoryTable.validateForm((valid) => {
-            if (!valid) {
-              reject(false);
-            } else {
-              resolve(true);
-            }
+        });
+      },
+      discountInput() {
+        this.$refs.inventoryTable.discountInputByOrder(this.form.payAmount);
+      },
+      //产品清单修改单价或者数量重置优惠金额
+      orderDiscountAmount(val = 0) {
+        this.form.payAmount = val;
+      },
+      //选择供应商
+      changeSupplier(obj) {
+        this.form = Object.assign({}, this.form, {
+          partbId: obj.id,
+          partbName: obj.name,
+          partbAddress: obj.addressName + obj.address,
+          partbLinkId: '',
+          partbLinkName: '',
+          partbEmail: '',
+          partbTel: ''
+        });
+        this.getLinkInfo(obj.id);
+      },
+      //选择合同获取合同的详情
+      async getDetailData(id) {
+        this.loading = true;
+        const data = await getDetail(id);
+        this.loading = false;
+        if (data) {
+          this.$nextTick(() => {
+            let { contractVO } = data;
+            // this.form=contractVOform.receiveAddress
+            let {
+              partaAddress,
+              partaEmail,
+              partaFax,
+              partaId,
+              partaLinkId,
+              partaLinkName,
+              partaName,
+              partaTel,
+              partbAddress,
+              partbEmail,
+              partbFax,
+              partbId,
+              partbLinkId,
+              partbLinkName,
+              partbName,
+              partbTel,
+              totalPrice,
+              discountTotalPrice,
+              partaUnifiedSocialCreditCode,
+              partbUnifiedSocialCreditCode,
+              settlementMode,
+              settlementModeName,
+              pricingWay
+            } = contractVO;
+            this.form = Object.assign({}, this.form, {
+              partaAddress,
+              partaEmail,
+              partaFax,
+              partaId,
+              partaLinkId,
+              partaLinkName,
+              partaName,
+              partaTel,
+              partbAddress,
+              partbEmail,
+              partbFax,
+              partbId,
+              partbLinkId,
+              partbLinkName,
+              partbName,
+              partbTel,
+              totalPrice,
+              discountTotalPrice,
+              partaUnifiedSocialCreditCode,
+              partbUnifiedSocialCreditCode,
+              pricingWay,
+              totalAmount: totalPrice,
+              payAmount: discountTotalPrice,
+              receiveAddress: partaAddress,
+              settlementMode,
+              settlementModeName
+            });
+            this.getLinkInfo(partaId);
+
+            this.$refs.inventoryTable &&
+              this.$refs.inventoryTable.putTableValue(
+                data.productList,
+                contractVO.contractStartDate
+              );
+            this.$store.commit('order/setAllcountAmount', totalPrice);
           });
-        })
-      ]);
-    },
-    async getTableValue() {
-      try {
-        await this.getValidate();
-        // 表单验证通过,执行保存操作
+        }
+      },
+
+      //获取订单详情
+      async getpurchaseorderDetail(id) {
         this.loading = true;
+        const data = await getpurchaseorderDetail(id);
+        this.loading = false;
+        if (data) {
+          this.$nextTick(() => {
+            this.form = data;
+            this.$refs.inventoryTable &&
+              this.$refs.inventoryTable.putTableValue(data.productList);
+            this.$refs.rawDetailListRef &&
+              this.$refs.rawDetailListRef.putTableValue(data.rawDetailList); //原料
+            this.$refs.outputDetailListRef &&
+              this.$refs.outputDetailListRef.putTableValue(
+                data.outputDetailList
+              ); //产成品
+            this.getLinkInfo(data.partaId);
+            this.getrequireUser(this.form.requireDeptId);
+
+            this.$store.commit('order/setAllcountAmount', data.totalAmount);
+            this.$store.commit('order/setContractId', data.contractId);
+          });
+        }
+      },
 
-        if (!this.form.contractId) {
-          this.form.totalAmount = this.allcountAmount;
+      //更新联系人数据
+      async getLinkInfo(contactId) {
+        const data = await getcontactlink({ contactId });
+        if (data && data?.length) {
+          this.linkNameOptions = data;
         }
+      },
+      selectFocus() {
+        if (this.linkNameOptions.length === 0) {
+          return this.$message.error('请先选择名称');
+        }
+      },
 
-        let commitData = Object.assign({}, this.form, {
-          productList: this.$refs.inventoryTable.getTableValue(),
-          // purchaseTypeName: this.getDictValue(
-          //   '采购订单类型',
-          //   this.form.purchaseType
-          // ),
-          sourceTypeName: this.getDictValue(
-            '需求来源类型',
-            this.form.sourceType
-          )
+      //选择下拉框
+      onchangeLink(selectedOptions) {
+        const option = this.linkNameOptions.find(
+          (opt) => opt.id === selectedOptions
+        );
+        this.form = Object.assign({}, this.form, {
+          partbEmail: option?.email,
+          partbLinkName: option?.linkName || '',
+          partbTel: option?.mobilePhone || option?.phone || '',
+          partbLinkId: option?.id
+        });
+      },
+
+      handHead() {
+        let item = {
+          id: this.form.partaLinkId
+        };
+        this.$refs.headRef.open(item);
+      },
+
+      //选择供采购方人回调
+      changePersonel(obj) {
+        this.$set(this.form, 'partaLinkId', obj.id);
+        this.$set(this.form, 'partaLinkName', obj.name);
+        this.$set(this.form, 'partaTel', obj.phone);
+        this.$set(this.form, 'partaEmail', obj.email);
+      },
+      //选择供应商回调
+      changeParent(obj) {
+        this.form = Object.assign({}, this.form, {
+          partbId: obj.id,
+          partbName: obj.name,
+          partbAddress: obj.addressName + obj.address,
+          partbLinkId: '',
+          partbLinkName: '',
+          partbEmail: '',
+          partbTel: ''
+        });
+        this.getLinkInfo(obj.id);
+      },
+
+      //选择合同回调
+      changeContract(obj) {
+        this.form = Object.assign({}, this.form, {
+          contractId: obj.id,
+          contractName: obj.contractName,
+          contractNo: obj.contractNo
         });
-        return commitData;
-      } catch (error) {
-        console.log(error);
-        // 表单验证未通过,不执行保存操作
-      }
-    },
 
-    //查找合同分类对应name
-    findNameById(tree, targetId) {
-      for (let i = 0; i < tree.length; i++) {
-        const node = tree[i];
-        if (node.id === targetId) {
-          return node.name;
+        this.getDetailData(obj.id);
+        // //采购询价表
+        // this.getPurchaseinquiry(obj.sourceId);
+        //获取合同采购计划
+        this.getPlanInfo(this.form.contractId);
+        this.$store.commit('order/setContractId', obj.id);
+      },
+      async getPlanInfo(id) {
+        let res = await getPurchasePlanByContractIdAPI(id);
+        this.form = Object.assign({}, this.form, {
+          purchasePlanId: res.data?.id,
+          purchasePlanName: res.data?.planName,
+          purchasePlanNo: res.data?.planCode,
+          sourceType: res.data?.sourceType,
+          sourceTypeName: res.data?.sourceTypeName
+        });
+      },
+      //选择合同弹框
+      handleContractBtn() {
+        if (this.clearing) return;
+        let item = {
+          id: this.form.contractId
+        };
+        this.$refs.selectContractRef.open(item);
+      },
+      //清除合同
+      clearContrcat() {
+        this.clearing = true;
+        this.isFlag = false;
+        let {
+          id,
+          projectName,
+          saleType,
+          saleTypeName,
+          deliveryDate,
+          orderFiles,
+          remark
+        } = this.form;
+        this.form = Object.assign({}, copyObj(this.formDef), {
+          id,
+          projectName,
+          saleType,
+          saleTypeName,
+          deliveryDate,
+          orderFiles,
+          remark
+        });
+
+        this.$store.commit('order/setContractId', '');
+        this.$store.commit('order/setAllcountAmount', 0);
+        this.$refs.inventoryTable.putTableValue([]);
+
+        setTimeout(() => {
+          this.clearing = false;
+        }, 500);
+      },
+
+      handParent() {
+        if (this.form.contractId) {
+          return this.$message.error('选择了合同不能更改供应商名称');
+        }
+        let item = {
+          id: this.form.contactId
+        };
+        this.$refs.parentRef.open(item);
+      },
+
+      settlementModeChange(info) {
+        this.form.settlementModeName = info.dictValue;
+      },
+      ifChiefChange(value, idx) {
+        if (value === 1) {
+          this.tableLinkData.forEach((e) => (e.ifChief = 0));
+          this.tableLinkData[idx].ifChief = 1;
         }
-        if (node.children && node.children.length > 0) {
-          const name = this.findNameById(node.children, targetId);
-          if (name) {
-            return name;
+      },
+
+      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.inventoryTable.validateForm((valid) => {
+              if (!valid) {
+                reject(false);
+              } else {
+                resolve(true);
+              }
+            });
+          })
+        ]);
+      },
+      async getTableValue() {
+        try {
+          await this.getValidate();
+          // 表单验证通过,执行保存操作
+          this.loading = true;
+
+          if (!this.form.contractId) {
+            this.form.totalAmount = this.allcountAmount;
           }
+          const rawDetailList =
+            (this.$refs.rawDetailListRef &&
+              this.$refs.rawDetailListRef.getTableValue()) ||
+            [];
+          const outputDetailList =
+            (this.$refs.outputDetailListRef &&
+              this.$refs.outputDetailListRef.getTableValue()) ||
+            [];
+   
+          let commitData = Object.assign({}, this.form, {
+            productList: [...this.$refs.inventoryTable.getTableValue(),...rawDetailList,...outputDetailList],
+            // purchaseTypeName: this.getDictValue(
+            //   '采购订单类型',
+            //   this.form.purchaseType
+            // ),
+            sourceTypeName: this.getDictValue(
+              '需求来源类型',
+              this.form.sourceType
+            )
+          });
+          return commitData;
+        } catch (error) {
+          console.log(error);
+          // 表单验证未通过,不执行保存操作
         }
+      },
+
+      //查找合同分类对应name
+      findNameById(tree, targetId) {
+        for (let i = 0; i < tree.length; i++) {
+          const node = tree[i];
+          if (node.id === targetId) {
+            return node.name;
+          }
+          if (node.children && node.children.length > 0) {
+            const name = this.findNameById(node.children, targetId);
+            if (name) {
+              return name;
+            }
+          }
+        }
+        return null;
       }
-      return null;
     }
-  }
-};
+  };
 </script>
 <style scoped lang="scss">
-.TotalAmount {
-  font-size: 16px;
-  padding-right: 30px;
-}
+  .TotalAmount {
+    font-size: 16px;
+    padding-right: 30px;
+  }
 </style>

+ 328 - 83
src/views/bpm/handleTask/components/purchaseOrder/detailDialog.vue

@@ -32,29 +32,29 @@
           >
             {{ form.sourceTypeName }}
           </el-form-item>
-<!--          <el-form-item-->
-<!--            label="采购订单类型:"-->
-<!--            prop="purchaseTypeName"-->
-<!--            style="margin-bottom: 16px"-->
-<!--          >-->
-<!--            {{ form.purchaseTypeName }}-->
-<!--          </el-form-item>-->
+          <!--          <el-form-item-->
+          <!--            label="采购订单类型:"-->
+          <!--            prop="purchaseTypeName"-->
+          <!--            style="margin-bottom: 16px"-->
+          <!--          >-->
+          <!--            {{ form.purchaseTypeName }}-->
+          <!--          </el-form-item>-->
 
           <el-form-item prop="orderFiles" label="附件:">
             <fileMain v-model="form.orderFiles" type="view"></fileMain>
-<!--            <div-->
-<!--              v-if="detailData.orderFiles && detailData.orderFiles?.length"-->
-<!--            >-->
-<!--              <el-link-->
-<!--                v-for="link in detailData.orderFiles"-->
-<!--                :key="link.id"-->
-<!--                type="primary"-->
-<!--                :underline="false"-->
-<!--                @click="downloadFile(link)"-->
-<!--              >-->
-<!--                {{ link.name }}</el-link-->
-<!--              >-->
-<!--            </div>-->
+            <!--            <div-->
+            <!--              v-if="detailData.orderFiles && detailData.orderFiles?.length"-->
+            <!--            >-->
+            <!--              <el-link-->
+            <!--                v-for="link in detailData.orderFiles"-->
+            <!--                :key="link.id"-->
+            <!--                type="primary"-->
+            <!--                :underline="false"-->
+            <!--                @click="downloadFile(link)"-->
+            <!--              >-->
+            <!--                {{ link.name }}</el-link-->
+            <!--              >-->
+            <!--            </div>-->
           </el-form-item>
 
           <el-form-item prop="remark" label="备注:">
@@ -105,11 +105,8 @@
           >
             {{ form.totalAmount }}元
           </el-form-item>
-          <el-form-item
-            label="计价方式:"
-            style="margin-bottom: 16px"
-          >
-            {{ form.pricingWay==1?'按数量计费':'按重量计费' }}
+          <el-form-item label="计价方式:" style="margin-bottom: 16px">
+            {{ form.pricingWay == 1 ? '按数量计费' : '按重量计费' }}
           </el-form-item>
         </el-col>
       </el-row>
@@ -242,36 +239,64 @@
         </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 }">
-        <fileMain v-model="row.technicalDrawings" type="view"></fileMain>
-<!--        <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>
+    <el-tabs v-model="activeName" style="margin-top: 15px" type="border-card">
+      <el-tab-pane label="物品清单" name="1">
+        <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 }">
+            <fileMain v-model="row.technicalDrawings" type="view"></fileMain>
+          </template>
+        </ele-pro-table>
+      </el-tab-pane>
+      <el-tab-pane
+        label="带料清单"
+        name="2"
+        v-if="['3', '4', '5', '6'].includes(form.sourceType)"
+      >
+        <ele-pro-table
+          ref="table"
+          :needPage="false"
+          :columns="competAnalysisListcolumns1"
+          :toolkit="[]"
+          :datasource="detailData.rawList"
+          row-key="id"
+        >
+          <template v-slot:technicalDrawings="{ row }">
+            <fileMain v-model="row.technicalDrawings" type="view"></fileMain>
+          </template>
+        </ele-pro-table>
+      </el-tab-pane>
+      <el-tab-pane
+        label="产出清单"
+        name="3"
+        v-if="['3', '4', '5', '6'].includes(form.sourceType)"
+      >
+        <ele-pro-table
+          ref="table"
+          :needPage="false"
+          :columns="competAnalysisListcolumns1"
+          :toolkit="[]"
+          :datasource="detailData.outputList"
+          row-key="id"
+        >
+          <template v-slot:technicalDrawings="{ row }">
+            <fileMain v-model="row.technicalDrawings" type="view"></fileMain>
+          </template>
+        </ele-pro-table>
+      </el-tab-pane>
+    </el-tabs>
   </div>
 </template>
 
@@ -281,11 +306,11 @@
   import { getFile } from '@/api/system/file';
   import dictMixins from '@/mixins/dictMixins';
   import { copyObj } from '@/utils/util';
-  import fileMain from "@/components/addDoc/index.vue";
+  import fileMain from '@/components/addDoc/index.vue';
 
   export default {
     mixins: [dictMixins],
-    components: {fileMain},
+    components: { fileMain },
     props: {
       businessId: {
         default: ''
@@ -297,7 +322,7 @@
         detailId: '',
         title: '详情',
         row: {},
-        activeName: 'base',
+        activeName: '1',
         form: {
           orderFiles: [{ name: '222' }]
         },
@@ -360,49 +385,49 @@
             prop: 'productName',
             label: '名称',
             slot: 'productName',
-            align: "center"
+            align: 'center'
           },
           {
             width: 120,
             prop: 'productCode',
             label: '编码',
             slot: 'productCode',
-            align: "center"
+            align: 'center'
           },
           {
             width: 200,
             prop: 'productCategoryName',
             label: '类型',
             slot: 'productCategoryName',
-            align: "center"
+            align: 'center'
           },
           {
             width: 160,
             prop: 'productBrand',
             label: '牌号',
             slot: 'productBrand',
-            align: "center"
+            align: 'center'
           },
           {
             width: 120,
             prop: 'modelType',
             label: '型号',
             slot: 'modelType',
-            align: "center"
+            align: 'center'
           },
           {
             width: 120,
             prop: 'supplierMark',
             label: '供应商代号',
             slot: 'supplierMark',
-            align: "center"
+            align: 'center'
           },
           {
             width: 120,
             prop: 'specification',
             label: '规格',
             slot: 'specification',
-            align: "center"
+            align: 'center'
           },
 
           {
@@ -410,49 +435,49 @@
             prop: 'totalCount',
             label: '数量',
             slot: 'totalCount',
-            align: "center"
+            align: 'center'
           },
           {
             width: 120,
             prop: 'measuringUnit',
             label: '计量单位',
             slot: 'measuringUnit',
-            align: "center"
+            align: 'center'
           },
           {
             width: 120,
             prop: 'singleWeight',
             label: '单重',
             slot: 'singleWeight',
-            align: "center"
+            align: 'center'
           },
           {
             width: 120,
             prop: 'totalWeight',
             label: '总重',
             slot: 'totalWeight',
-            align: "center"
+            align: 'center'
           },
           {
             width: 120,
             prop: 'weightUnit',
             label: '重量单位',
             slot: 'weightUnit',
-            align: "center"
+            align: 'center'
           },
           {
             width: 160,
             prop: 'singlePrice',
             label: '单价',
             slot: 'singlePrice',
-            align: "center"
+            align: 'center'
           },
           {
             width: 160,
             prop: 'discountSinglePrice',
             label: '折后单价',
             slot: 'discountSinglePrice',
-            align: "center"
+            align: 'center'
           },
           {
             width: 120,
@@ -462,7 +487,7 @@
             formatter: (_row, _column, cellValue) => {
               return _row.totalPrice + '元';
             },
-            align: "center"
+            align: 'center'
           },
           {
             width: 120,
@@ -472,9 +497,225 @@
             formatter: (_row, _column, cellValue) => {
               return _row.discountTotalPrice + '元';
             },
-            align: "center"
+            align: 'center'
+          },
+
+          {
+            width: 120,
+            prop: 'deliveryDays',
+            label: '交期(天)',
+            slot: 'deliveryDays'
+          },
+          {
+            width: 160,
+            prop: 'deliveryDeadline',
+            label: '交期截止日期',
+            slot: 'deliveryDeadline',
+            align: 'center'
+          },
+          {
+            width: 200,
+            prop: 'guaranteePeriod',
+            label: '质保期',
+            slot: 'guaranteePeriod',
+            formatter: (_row, _column, cellValue) => {
+              return (
+                (_row.guaranteePeriod || '') + _row.guaranteePeriodUnitName
+              );
+            },
+            align: 'center'
+          },
+          {
+            width: 160,
+            prop: 'guaranteePeriodDeadline',
+            label: '质保截止日期',
+            slot: 'guaranteePeriodDeadline',
+            align: 'center'
+          },
+          {
+            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'
+          }
+        ],
+        competAnalysisListcolumns1: [
+          {
+            width: 45,
+            type: 'index',
+            columnKey: 'index',
+            align: 'center',
+            fixed: 'left'
+          },
+          {
+            width: 200,
+            prop: 'productName',
+            label: '名称',
+            slot: 'productName',
+            align: 'center'
+          },
+          {
+            width: 120,
+            prop: 'productCode',
+            label: '编码',
+            slot: 'productCode',
+            align: 'center'
+          },
+          {
+            width: 200,
+            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: 'supplierMark',
+            label: '供应商代号',
+            slot: 'supplierMark',
+            align: 'center'
+          },
+          {
+            width: 120,
+            prop: 'specification',
+            label: '规格',
+            slot: 'specification',
+            align: 'center'
+          },
+          {
+            minWidth: 200,
+            prop: 'taskName',
+            label: '工序',
+            slot: 'taskName',
+            align: 'center'
+          },
+          {
+            width: 120,
+            prop: 'requirementTotalCount',
+            label: '采购需求数量',
+            slot: 'requirementTotalCount',
+            align: 'center'
+          },
+          {
+            width: 120,
+            prop: 'planTotalCount',
+            label: '采购计划数量',
+            slot: 'planTotalCount',
+            align: 'center'
+          },
+          {
+            width: 120,
+            prop: 'inquiryTotalCount',
+            label: '采购核价数量',
+            slot: 'inquiryTotalCount',
+            align: 'center'
           },
+          {
+            width: 120,
+            prop: 'contractTotalCount',
+            label: '采购合同数量',
+            slot: 'contractTotalCount',
+            align: 'center'
+          },
+          {
+            width: 80,
+            prop: 'doneTotalCount',
+            label: '已采数量',
+            slot: 'doneTotalCount',
+            align: 'center'
+          },
+          {
+            width: 80,
+            prop: 'waitTotalCount',
+            label: '待采数量',
+            // slot: 'waitTotalCount',
+            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: 120,
+            prop: 'totalWeight',
+            label: '总重',
+            slot: 'totalWeight',
+            align: 'center'
+          },
+          {
+            width: 120,
+            prop: 'weightUnit',
+            label: '重量单位',
+            slot: 'weightUnit',
+            align: 'center'
+          },
+          
 
+          {
+            width: 110,
+            prop: 'batchNo',
+            label: '批次号',
+            slot: 'batchNo',
+            align: 'center'
+          },
           {
             width: 120,
             prop: 'deliveryDays',
@@ -486,7 +727,7 @@
             prop: 'deliveryDeadline',
             label: '交期截止日期',
             slot: 'deliveryDeadline',
-            align: "center"
+            align: 'center'
           },
           {
             width: 200,
@@ -494,30 +735,32 @@
             label: '质保期',
             slot: 'guaranteePeriod',
             formatter: (_row, _column, cellValue) => {
-              return (_row.guaranteePeriod||'') + _row.guaranteePeriodUnitName;
+              return (
+                (_row.guaranteePeriod || '') + _row.guaranteePeriodUnitName
+              );
             },
-            align: "center"
+            align: 'center'
           },
           {
             width: 160,
             prop: 'guaranteePeriodDeadline',
             label: '质保截止日期',
             slot: 'guaranteePeriodDeadline',
-            align: "center"
+            align: 'center'
           },
           {
             width: 120,
             prop: 'technicalAnswerName',
             label: '技术答疑人',
             slot: 'technicalAnswerName',
-            align: "center"
+            align: 'center'
           },
           {
             width: 220,
             prop: 'technicalParams',
             label: '技术参数',
             slot: 'technicalParams',
-            align: "center"
+            align: 'center'
           },
           {
             width: 240,
@@ -525,16 +768,18 @@
             label: '技术图纸',
             slot: 'technicalDrawings',
             formatter: (_row, _column, cellValue) => {
-              return (_row.guaranteePeriod||'') + _row.guaranteePeriodUnitName;
+              return (
+                (_row.guaranteePeriod || '') + _row.guaranteePeriodUnitName
+              );
             },
-            align: "center"
+            align: 'center'
           },
           {
             width: 220,
             prop: 'remark',
             label: '备注',
             slot: 'remark',
-            align: "center"
+            align: 'center'
           }
         ]
       };

+ 6 - 3
src/views/bpm/handleTask/components/purchaseOrder/inventoryTable.vue

@@ -76,14 +76,14 @@
             :prop="'datasource.' + scope.$index + '.totalCount'"
             :rules="{
               required: true,
-              pattern: numberReg,
-              message: '请输入数字',
+              message: '请输入',
               trigger: 'blur'
             }"
           >
             <el-input
               :disabled="isContractId"
               v-model="scope.row.totalCount"
+              type="number"
               placeholder="请输入"
               @input="changeCount(scope.row,scope.$index)"
             ></el-input>
@@ -444,7 +444,7 @@ export default {
         },
 
         {
-          width: 80,
+          width: 150,
           prop: 'totalCount',
           label: '数量',
           slot: 'totalCount',
@@ -616,6 +616,9 @@ export default {
     },
     //改变数量
     changeCount(row, index) {
+      if (this.detailType) {
+          return;
+        }
       this.singleWeightChange(row, index);
       this.getTotalPrice()
     },

+ 252 - 206
src/views/bpm/handleTask/components/purchasePlanManage/detailDialog.vue

@@ -54,15 +54,13 @@
         </el-col>
         <el-col :span="12">
           <el-form-item prop="remark" label="是否接受拆单:">
-            {{form.acceptUnpack === 1 ? '接受' : '不接受'}}
+            {{ form.acceptUnpack === 1 ? '接受' : '不接受' }}
           </el-form-item>
-
         </el-col>
         <el-col :span="12">
           <el-form-item prop="remark" label="是否需要核价:">
-            {{form.acceptUnpack === 1 ? '是' : '否'}}
+            {{ form.acceptUnpack === 1 ? '是' : '否' }}
           </el-form-item>
-
         </el-col>
         <!-- <el-col :span="12">
           <el-form-item
@@ -87,234 +85,282 @@
         <el-col :span="12">
           <el-form-item prop="files" label="附件:">
             <fileMain v-model="form.files" type="view"></fileMain>
-<!--            <el-link-->
-<!--              v-if="form.files && form.files !== ''"-->
-<!--              type="primary"-->
-<!--              :underline="false"-->
-<!--              @click="downloadFile(form.files)"-->
-<!--            >-->
-<!--              {{ form.files.name }}-->
-<!--            </el-link-->
-<!--            >-->
+            <!--            <el-link-->
+            <!--              v-if="form.files && form.files !== ''"-->
+            <!--              type="primary"-->
+            <!--              :underline="false"-->
+            <!--              @click="downloadFile(form.files)"-->
+            <!--            >-->
+            <!--              {{ form.files.name }}-->
+            <!--            </el-link-->
+            <!--            >-->
           </el-form-item>
         </el-col>
       </el-row>
       <headerTitle title="计划清单" style="margin-top: 15px"></headerTitle>
-      <ele-pro-table
-        ref="table"
-        :needPage="false"
-        :columns="columns"
-        :toolkit="[]"
-        :datasource="form.detailList"
-        row-key="id"
-      >
-        <template v-slot:totalCount="scope">
-          <el-input-number :controls='false' :min="1" style="width: 100%" v-model="scope.row.totalCount"></el-input-number>
-        </template>
-      </ele-pro-table>
+      <el-tabs v-model="activeName" style="margin-top: 15px" type="border-card">
+        <el-tab-pane label="物品清单" name="1">
+          <ele-pro-table
+            ref="table"
+            :needPage="false"
+            :columns="columns"
+            :toolkit="[]"
+            :datasource="form.detailList"
+            row-key="id"
+          >
+            <template v-slot:totalCount="scope">
+              <el-input-number
+                :controls="false"
+                :min="1"
+                style="width: 100%"
+                v-model="scope.row.totalCount"
+              ></el-input-number>
+            </template>
+          </ele-pro-table>
+        </el-tab-pane>
+        <el-tab-pane label="带料清单" name="2" v-if="['3', '4', '5', '6'].includes(form.sourceType)">
+          <ele-pro-table
+            ref="table"
+            :needPage="false"
+            :columns="columns"
+            :toolkit="[]"
+            :datasource="form.rawDetailList"
+            row-key="id"
+          >
+            <template v-slot:totalCount="scope">
+              <el-input-number
+                :controls="false"
+                :min="1"
+                style="width: 100%"
+                v-model="scope.row.totalCount"
+              ></el-input-number>
+            </template>
+          </ele-pro-table>
+        </el-tab-pane>
+        <el-tab-pane label="产出品清单" name="3" v-if="['3', '4', '5', '6'].includes(form.sourceType)">
+          <ele-pro-table
+            ref="table"
+            :needPage="false"
+            :columns="columns"
+            :toolkit="[]"
+            :datasource="form.outputDetailList"
+            row-key="id"
+          >
+            <template v-slot:totalCount="scope">
+              <el-input-number
+                :controls="false"
+                :min="1"
+                style="width: 100%"
+                v-model="scope.row.totalCount"
+              ></el-input-number>
+            </template>
+          </ele-pro-table>
+        </el-tab-pane>
+      </el-tabs>
     </el-form>
-
-
   </div>
 </template>
 
 <script>
-import {getplanDetail} from '@/api/bpm/components/purchasingManage/purchasePlanManage';
+  import { getplanDetail } from '@/api/bpm/components/purchasingManage/purchasePlanManage';
 
-import {getFile} from '@/api/system/file';
-import dictMixins from '@/mixins/dictMixins';
-import {getInventoryTotalAPI} from "@/api/bpm/components/wms";
-import fileMain from "@/components/addDoc/index.vue";
+  import { getFile } from '@/api/system/file';
+  import dictMixins from '@/mixins/dictMixins';
+  import { getInventoryTotalAPI } from '@/api/bpm/components/wms';
+  import fileMain from '@/components/addDoc/index.vue';
 
-export default {
-  mixins: [dictMixins],
-  components: {fileMain},
-  props: {
-    taskDefinitionKey: {
-      type: String,
-      default: 'starter',
-    },
-    businessId: {
-      default: ''
-    }
-  },
-  data() {
-    return {
-      visible: false,
-      detailId: '',
-      title: '详情',
-      row: {},
-      form: {
-        files:[]
+  export default {
+    mixins: [dictMixins],
+    components: { fileMain },
+    props: {
+      taskDefinitionKey: {
+        type: String,
+        default: 'starter'
       },
-      columns: [
-        {
-          width: 45,
-          type: 'index',
-          columnKey: 'index',
-          align: 'center',
-          fixed: 'left'
-        },
-        {
-          width: 150,
-          prop: 'productCategoryName',
-          label: '分类',
-          align: 'center',
-          slot: 'productCategoryName'
-        },
-        {
-          width: 140,
-          prop: 'productCode',
-          label: '编码',
-          align: 'center',
-          slot: 'productCode'
-        },
-        {
-          width: 240,
-          prop: 'productName',
-          label: '名称',
-          align: 'center',
-          slot: 'productName'
+      businessId: {
+        default: ''
+      }
+    },
+    data() {
+      return {
+        activeName:'1',
+        visible: false,
+        detailId: '',
+        title: '详情',
+        row: {},
+        form: {
+          files: []
         },
+        columns: [
+          {
+            width: 45,
+            type: 'index',
+            columnKey: 'index',
+            align: 'center',
+            fixed: 'left'
+          },
+          {
+            width: 150,
+            prop: 'productCategoryName',
+            label: '分类',
+            align: 'center',
+            slot: 'productCategoryName'
+          },
+          {
+            width: 140,
+            prop: 'productCode',
+            label: '编码',
+            align: 'center',
+            slot: 'productCode'
+          },
+          {
+            width: 240,
+            prop: 'productName',
+            label: '名称',
+            align: 'center',
+            slot: 'productName'
+          },
 
-        {
-          width: 150,
-          prop: 'productBrand',
-          label: '牌号',
-          align: 'center',
-          slot: 'productBrand'
-        },
-        {
-          width: 100,
-          prop: 'totalCount',
-          label: '数量',
-          align: 'center',
-          slot: 'totalCount'
-        },
-        {
-          width: 80,
-          prop: 'availableCountBase',
-          label: '库存数量',
-          align: 'center',
-          slot: 'availableCountBase'
-        },
-        {
-          width: 100,
-          prop: 'measuringUnit',
-          label: '单位',
-          align: 'center',
-          slot: 'measuringUnit'
-        },
-        {
-          width: 130,
-          prop: 'modelType',
-          label: '型号',
-          align: 'center',
-          slot: 'modelType'
-        },
+          {
+            width: 150,
+            prop: 'productBrand',
+            label: '牌号',
+            align: 'center',
+            slot: 'productBrand'
+          },
+          {
+            width: 100,
+            prop: 'totalCount',
+            label: '数量',
+            align: 'center',
+            slot: 'totalCount'
+          },
+          {
+            width: 80,
+            prop: 'availableCountBase',
+            label: '库存数量',
+            align: 'center',
+            slot: 'availableCountBase'
+          },
+          {
+            width: 100,
+            prop: 'measuringUnit',
+            label: '单位',
+            align: 'center',
+            slot: 'measuringUnit'
+          },
+          {
+            width: 130,
+            prop: 'modelType',
+            label: '型号',
+            align: 'center',
+            slot: 'modelType'
+          },
 
-        {
-          width: 120,
-          prop: 'specification',
-          label: '规格',
-          align: 'center',
-          slot: 'specification'
-        },
-        // {
-        //   width: 130,
-        //   prop: 'modelType',
-        //   label: '品牌',
-        //   slot: 'modelType'
-        // },
-        {
-          width: 170,
-          prop: 'receiveDate',
-          label: '到货日期',
-          align: 'center',
-          slot: 'receiveDate'
-        },
-        {
-          width: 140,
-          prop: 'files',
-          label: '附件',
-          align: 'center',
-          slot: 'files'
-        },
-        {
-          minWidth: 220,
-          prop: 'remark',
-          label: '备注',
-          align: 'center',
-          slot: 'remark'
-        }
-      ]
-    };
-  },
-  created() {
-    this.getPlanData(this.businessId);
-  },
-  methods: {
-    downloadFile(file) {
-      getFile({objectName: file.storePath}, file.name);
+          {
+            width: 120,
+            prop: 'specification',
+            label: '规格',
+            align: 'center',
+            slot: 'specification'
+          },
+          // {
+          //   width: 130,
+          //   prop: 'modelType',
+          //   label: '品牌',
+          //   slot: 'modelType'
+          // },
+          {
+            width: 170,
+            prop: 'receiveDate',
+            label: '到货日期',
+            align: 'center',
+            slot: 'receiveDate'
+          },
+          {
+            width: 140,
+            prop: 'files',
+            label: '附件',
+            align: 'center',
+            slot: 'files'
+          },
+          {
+            minWidth: 220,
+            prop: 'remark',
+            label: '备注',
+            align: 'center',
+            slot: 'remark'
+          }
+        ]
+      };
     },
-    async getPlanData(id) {
-      this.loading = true;
-      const data = await getplanDetail(id);
-      this.loading = false;
-      if (data) {
-        let codeList = data.detailList.map((item) => item.productCode);
-        let inventoryTotalList = await getInventoryTotalAPI(codeList);
-        data.detailList.forEach((item) => {
-          let find = inventoryTotalList.find((key) => key.code == item.productCode) || {};
-          item.availableCountBase = find.availableCountBase;
-        });
-        this.form = data;
-        // if (data.files && data.files.length > 0) {
-        //   this.form.files = data.files[0];
-        // } else {
-        //   this.form.files = null;
-        // }
-
-      }
+    created() {
+      this.getPlanData(this.businessId);
     },
+    methods: {
+      downloadFile(file) {
+        getFile({ objectName: file.storePath }, file.name);
+      },
+      async getPlanData(id) {
+        this.loading = true;
+        const data = await getplanDetail(id);
+        this.loading = false;
+        if (data) {
+          let codeList = data.detailList.map((item) => item.productCode);
+          let inventoryTotalList = await getInventoryTotalAPI(codeList);
+          data.detailList.forEach((item) => {
+            let find =
+              inventoryTotalList.find((key) => key.code == item.productCode) ||
+              {};
+            item.availableCountBase = find.availableCountBase;
+          });
+          this.form = data;
+          // if (data.files && data.files.length > 0) {
+          //   this.form.files = data.files[0];
+          // } else {
+          //   this.form.files = null;
+          // }
+        }
+      },
 
-    //查看详情
-    openDetail(row) {
-      this.$refs.contactDetailDialogRef.open(row);
-    },
-    async getTableValue() {
-      try {
-        if( this.form.detailList.some(item => !!item.totalCount == '')){
-          this.$message.warning('数量不能为空')
-          return  ''
+      //查看详情
+      openDetail(row) {
+        this.$refs.contactDetailDialogRef.open(row);
+      },
+      async getTableValue() {
+        try {
+          if (this.form.detailList.some((item) => !!item.totalCount == '')) {
+            this.$message.warning('数量不能为空');
+            return '';
+          }
+          // 表单验证通过,执行保存操作
+          this.loading = true;
+          this.form.detailList=[...this.form.detailList,...this.form.rawDetailList,...this.form.outputDetailList]
+          return Object.assign({}, this.form);
+        } catch (error) {
+          console.log(error);
+          // 表单验证未通过,不执行保存操作
         }
-        // 表单验证通过,执行保存操作
-        this.loading = true;
-        return Object.assign({}, this.form);
-      } catch (error) {
-        console.log(error);
-        // 表单验证未通过,不执行保存操作
       }
     }
-  }
-};
+  };
 </script>
 
 <style scoped lang="scss">
-.ele-dialog-form {
-  .el-form-item {
-    margin-bottom: 10px;
+  .ele-dialog-form {
+    .el-form-item {
+      margin-bottom: 10px;
+    }
   }
-}
 
-.headbox {
-  display: flex;
-  justify-content: space-between;
-  align-items: center;
+  .headbox {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
 
-  .amount {
-    font-size: 14px;
-    font-weight: bold;
+    .amount {
+      font-size: 14px;
+      font-weight: bold;
+    }
   }
-}
 </style>