陈婷婷
2025-11-24 ff3e3dcb4b1a85bbf530c017fe3add8c0c2d5fa7
src/views/basic/gy/gySupplierEdit.vue
@@ -1,10 +1,10 @@
<template>
  <div v-loading="formLoading" v-if="formShow">
    <div style=" margin-bottom: 10px; border-bottom: 1px solid #f6f6f6;">
      <el-button type="primary" @click="handleAdd(OperationType = 1)" v-if="addBtnShow">新增</el-button>
      <!-- <el-button type="primary" @click="handleAdd(OperationType = 1)" v-if="addBtnShow">新增</el-button>
      <el-button type="primary" @click="submitForm" :disabled="subDisabled">保 存</el-button>
      <el-button type="primary" @click="set_CheckBill(0, form)">审 核</el-button>
      <el-button type="primary" @click="close">退 出</el-button>
      <el-button type="primary" @click="close">退 出</el-button> -->
      <!-- <el-button @click="cancel">取 消</el-button> -->
    </div>
    <div style="margin: 10px; font-size: 28px; font-weight: bold; text-align: center;">供应商设置</div>
@@ -14,7 +14,7 @@
          <el-row>
            <el-col :span="6">
              <el-form-item label="编码" prop="HNumber">
                <el-input v-model="form.HNumber" placeholder="请输入编码" />
                <el-input v-model="form.HNumber" placeholder="请输入编码"/>
              </el-form-item>
            </el-col>
            <el-col :span="6">
@@ -242,83 +242,19 @@
            @selection-change="handleTableZbEdit" :row-class-name="rowSysZbIndex" show-summary border>
            <el-table-column type="selection" width="55" align="center" />
            <el-table-column align="center" label="序号" type="index" width="80" />
            <el-table-column align="center" label="物料编码" width="120">
            <el-table-column align="center" label="联系人" width="120">
              <template slot-scope="scope">
                <el-input v-model="scope.row.物料代码" placeholder="请输入物料编码" @keyup.native.f7="openDataDialog(3, scope.row)"
                  @dblclick.native="openDataDialog(3, scope.row)" />
                <el-input v-model="scope.row.HLinkMan" placeholder="请输入联系人" />
              </template>
            </el-table-column>
            <el-table-column align="center" label="物料名称" width="120">
            <el-table-column align="center" label="联系电话" width="120">
              <template slot-scope="scope">
                <span>{{ scope.row.物料名称 }}</span>
              </template>
            </el-table-column>
            <el-table-column align="center" label="规格型号" width="120">
              <template slot-scope="scope">
                <span>{{ scope.row.规格型号 }}</span>
              </template>
            </el-table-column>
            <el-table-column align="center" label="计量单位" width="120">
              <template slot-scope="scope">
                <span>{{ scope.row.计量单位 }}</span>
              </template>
            </el-table-column>
            <el-table-column align="center" label="实发数量" width="120">
              <template slot-scope="scope">
                <el-input-number v-model="scope.row.HQty" :min="1" style="width: 90px;"
                  controls-position="right"></el-input-number>
              </template>
            </el-table-column>
            <el-table-column align="center" label="单价" width="120">
              <template slot-scope="scope">
                <el-input-number v-model="scope.row.HPrice" :min="0" style="width: 90px;"
                  controls-position="right"></el-input-number>
              </template>
            </el-table-column>
            <el-table-column align="center" label="含税单价" width="120">
              <template slot-scope="scope">
                <span>{{ scope.row.HTaxPrice }}</span>
              </template>
            </el-table-column>
            <el-table-column align="center" label="税率" width="120">
              <template slot-scope="scope">
                <span>{{ scope.row.HTaxRate }}</span>
              </template>
            </el-table-column>
            <el-table-column align="center" label="金额" width="120">
              <template slot-scope="scope">
                <span>{{ scope.row.HPrice * scope.row.HQty }}</span>
              </template>
            </el-table-column>
            <el-table-column align="center" label="价税合计" width="120">
              <template slot-scope="scope">
                <span>{{ scope.row.HTaxPrice * scope.row.HQty }}</span>
              </template>
            </el-table-column>
            <el-table-column align="center" label="发货仓库" width="120">
              <template slot-scope="scope">
                <el-input v-model="scope.row.发货仓库" placeholder="请输入发货仓库" @keyup.native.f7="openDataDialog(2, scope.row)"
                  @dblclick.native="openDataDialog(2, scope.row)" />
                <el-input v-model="scope.row.HLinkPhone" placeholder="请输入联系电话" />
              </template>
            </el-table-column>
            <el-table-column align="center" label="备注" width="120">
              <template slot-scope="scope">
                <el-input v-model="scope.row.HRemark" placeholder="请输入备注" />
              </template>
            </el-table-column>
            <el-table-column align="center" label="采购数量" width="120">
              <template slot-scope="scope">
                <span>{{ scope.row.HReqBuyQty }}</span>
              </template>
            </el-table-column>
            <el-table-column align="center" label="申请出库数量" width="120">
              <template slot-scope="scope">
                <span>{{ scope.row.HReqOutQty }}</span>
              </template>
            </el-table-column>
            <el-table-column align="center" label="当前库存" width="120">
              <template slot-scope="scope">
                <span>{{ scope.row.HCurrentInventory }}</span>
              </template>
            </el-table-column>
            <el-table-column align="center" label="操作" width="55" fixed="right">
@@ -331,92 +267,33 @@
        </el-tab-pane>
        <el-tab-pane label="付款计划" name="second">
          <div style="margin-bottom: 10px;">
            <el-button type="success" plain icon="el-icon-plus" @click="handleAddSysZb()" size="mini">增加一行</el-button>
            <el-button type="success" plain icon="el-icon-plus" @click="handleAddSysZb(zbIndex, 1)"
            <el-button type="success" plain icon="el-icon-plus" @click="handleAddSysZb1()" size="mini">增加一行</el-button>
            <el-button type="success" plain icon="el-icon-plus" @click="handleAddSysZb1(zbIndex, 1)"
              size="mini">插入一行</el-button>
            <el-button type="success" plain icon="el-icon-plus" @click="handleCopyZbRow" size="mini">复制一行</el-button>
            <el-button type="success" plain icon="el-icon-plus" @click="handleCopyZbRow1" size="mini">复制一行</el-button>
          </div>
          <el-table :data="editData" style="width: 100%" height="300" width="100%" ref="zbTable"
            @selection-change="handleTableZbEdit" :row-class-name="rowSysZbIndex" show-summary border>
          <el-table :data="editData1" style="width: 100%" height="300" width="100%" ref="zbTable1"
            @selection-change="handleTableZbEdit1" :row-class-name="rowSysZbIndex1" show-summary border >
            <el-table-column type="selection" width="55" align="center" />
            <el-table-column align="center" label="序号" type="index" width="80" />
            <el-table-column align="center" label="物料编码" width="120">
            <el-table-column align="center" label="付款阶段" width="120">
              <template slot-scope="scope">
                <el-input v-model="scope.row.物料代码" placeholder="请输入物料编码" @keyup.native.f7="openDataDialog(3, scope.row)"
                  @dblclick.native="openDataDialog(3, scope.row)" />
                <el-input v-model="scope.row.HPayType" placeholder="请输入付款阶段" />
              </template>
            </el-table-column>
            <el-table-column align="center" label="物料名称" width="120">
            <el-table-column align="center" label="付款比例%" width="120">
              <template slot-scope="scope">
                <span>{{ scope.row.物料名称 }}</span>
                <el-input v-model="scope.row.HPayRate" placeholder="请输入付款比例%" />
              </template>
            </el-table-column>
            <el-table-column align="center" label="规格型号" width="120">
            <el-table-column align="center" label="结算周期" width="120">
              <template slot-scope="scope">
                <span>{{ scope.row.规格型号 }}</span>
                <el-input v-model="scope.row.HPayTime" placeholder="请输入结算周期" />
              </template>
            </el-table-column>
            <el-table-column align="center" label="计量单位" width="120">
            <el-table-column align="center" label="备注说明" width="120">
              <template slot-scope="scope">
                <span>{{ scope.row.计量单位 }}</span>
              </template>
            </el-table-column>
            <el-table-column align="center" label="实发数量" width="120">
              <template slot-scope="scope">
                <el-input-number v-model="scope.row.HQty" :min="1" style="width: 90px;"
                  controls-position="right"></el-input-number>
              </template>
            </el-table-column>
            <el-table-column align="center" label="单价" width="120">
              <template slot-scope="scope">
                <el-input-number v-model="scope.row.HPrice" :min="0" style="width: 90px;"
                  controls-position="right"></el-input-number>
              </template>
            </el-table-column>
            <el-table-column align="center" label="含税单价" width="120">
              <template slot-scope="scope">
                <span>{{ scope.row.HTaxPrice }}</span>
              </template>
            </el-table-column>
            <el-table-column align="center" label="税率" width="120">
              <template slot-scope="scope">
                <span>{{ scope.row.HTaxRate }}</span>
              </template>
            </el-table-column>
            <el-table-column align="center" label="金额" width="120">
              <template slot-scope="scope">
                <span>{{ scope.row.HPrice * scope.row.HQty }}</span>
              </template>
            </el-table-column>
            <el-table-column align="center" label="价税合计" width="120">
              <template slot-scope="scope">
                <span>{{ scope.row.HTaxPrice * scope.row.HQty }}</span>
              </template>
            </el-table-column>
            <el-table-column align="center" label="发货仓库" width="120">
              <template slot-scope="scope">
                <el-input v-model="scope.row.发货仓库" placeholder="请输入发货仓库" @keyup.native.f7="openDataDialog(2, scope.row)"
                  @dblclick.native="openDataDialog(2, scope.row)" />
              </template>
            </el-table-column>
            <el-table-column align="center" label="备注" width="120">
              <template slot-scope="scope">
                <el-input v-model="scope.row.HRemark" placeholder="请输入备注" />
              </template>
            </el-table-column>
            <el-table-column align="center" label="采购数量" width="120">
              <template slot-scope="scope">
                <span>{{ scope.row.HReqBuyQty }}</span>
              </template>
            </el-table-column>
            <el-table-column align="center" label="申请出库数量" width="120">
              <template slot-scope="scope">
                <span>{{ scope.row.HReqOutQty }}</span>
              </template>
            </el-table-column>
            <el-table-column align="center" label="当前库存" width="120">
              <template slot-scope="scope">
                <span>{{ scope.row.HCurrentInventory }}</span>
                <el-input v-model="scope.row.HPayRemark" placeholder="请输入备注说明" />
              </template>
            </el-table-column>
            <el-table-column align="center" label="操作" width="55" fixed="right">
@@ -456,7 +333,7 @@
import moment from 'moment';
export default {
  name: 'SellOutBillEdit',
  name: 'GySupplierEdit',
  components: { Dept, Warehouse, Material, RowSettings },
  props: {
    OperationType: { type: Number, },
@@ -476,7 +353,9 @@
      hPriceTypeList: ['成本价', '结算价'],
      addBtnShow: false,
      zbIndex: null,
      zbIndex1: null,
      zbSelForm: {},//子表选中数据
      zbSelForm1: {},//子表选中数据
      dialogTypeNum: null,//部门弹窗1,仓库弹窗2
      deptShow: false,//部门数据组件
      warehouseShow: false,//仓库数据组件
@@ -491,6 +370,7 @@
      baseURL: process.env.VUE_APP_BASE_API,
      checkedSysZb: [],
      editData: [],//销售出库单子表
      editData1:[],
      editBtData: [],//子表表头
      activeName: 'first',
      activeNameZB: 'first',
@@ -827,6 +707,7 @@
        HStopDate: null,
      }
      this.editData = []
      this.editData1 = []
      this.editBtData = []
      this.ids = []
      this.subDisabled = false
@@ -866,6 +747,7 @@
      this.form.HDate = moment(date).format('YYYY-MM-DDTHH:mm:ss')
      if (this.OperationType == 1) {
        this.handleAddSysZb()
        this.handleAddSysZb1()
      }
      this.$nextTick(() => {
        this.formShow = true
@@ -926,139 +808,53 @@
        if (response.data.count == 1) {
          var result = response.data
          var data = response.data.data[0]
          this.form.BillType = data.HSourceBillType
          if (this.copyType == 1) {
            this.getHBillNo()
            let date = new Date()
            this.form.HDate = moment(date).format('YYYY-MM-DDTHH:mm:ss')
          } else {
            this.form.HBillNo = data.单据号
            this.form.HInterID = data.hmainid
            this.form.HDate = data.日期
            this.form.HMaker = data.制单人
            this.form.HUpDater = data.修改人
            this.form.HChecker = data.审核人
            this.form.HMakeDate = data.制单日期
            this.form.HUpDateDate = data.修改日期
            this.form.HCheckDate = data.审核日期
            this.form.HCloseMan = data.关闭人
            this.form.HDeleteMan = data.作废人
            this.form.HCloseDate = data.关闭日期
            this.form.HDeleteDate = data.作废日期
          this.form = {
            HCREATEORGID:data.HCREATEORGID,
            HUSEORGID:data.HUSEORGID,
            HUseOrg:data.使用组织,
            HNumber:data.编码,
            HHelpCode:data.助记码,
            HShortName:data.简称,
            HAddress:data.地址,
            HLinkMan: data.联系人,
            HLinkPhone: data.联系电话,
            HMobilePhone: data.手机,
            HFax: data.传真,
            HPostalCode: data.邮编,
            HEmail: data.电子邮件,
            HCorMan: data.法人代表,
            HBank: data.开户银行,
            HTaxNum: data.税务登记号,
            HEnglishName: data.英文名称,
            HEnglishAddress: data.英文地址,
            HCountry: data.国家,
            HAreaID: data.地区ID,
            HAreaName: data.地区名称,
            HTaxRate: data.增值税率,
            HCurID: data.默认货币ID,
            HCurName: data.默认货币,
            HSSID: data.结算方式ID,
            HSSName: data.结算方式,
            HBankAccount: data.银行账号,
            HName: data.名称,
            HPSStyleID: data.采购方式ID,
            HPSStyleName: data.采购方式名称,
            HRemark: data.备注,
            HUpDater: sessionStorage["HUserName"],
            HStopflag: data.禁用标志,
            HMaterClass: data.供货材料类别,
            HSupTypeID: data.HSupTypeID,
            HSupClsName: data.供应商分类,
            HMaker: data.制单人,
            HMakeDate: data.制单日期,
            HChecker: data.审核人,
            HCheckDate: data.审核时间,
            HStopMan: data.禁用人,
            HStopDate: data.禁用时间,
          }
          this.form.HBillSubType = data.HBillSubType
          this.form.HMainSourceInterID = data.HMainSourceInterID
          this.form.HMainSourceEntryID = data.HMainSourceEntryID
          this.form.HMainSourceBillType = data.HMainSourceBillType
          this.form.HMainSourceBillNo = data.HMainSourceBillNo
          this.form.HEmpName = data.业务员
          this.form.HEmpID = data.HEmpID
          this.form.HDeptName = data.部门
          this.form.HDeptID = data.HDeptID
          this.form.HManagerName = data.主管
          this.form.HManagerID = data.HManagerID
          this.form.HSupName = data.客户
          this.form.HSupID = data.HSupID
          this.form.HLinkMan = data.联系人
          this.form.HLinkPhone = data.联系电话
          this.form.HSecManagerName = data.发货人
          this.form.HSecManagerID = data.HSecManagerID
          this.form.HKeeperName = data.保管员
          this.form.HKeeperID = data.HKeeperID
          this.form.HRemark = data.表头备注
          this.form.HProjectNumber = data.项目编码
          this.form.HProjectID = data.HProjectID
          this.form.HProjectName = data.项目名称
          this.form.HGroupName = data.班组
          this.form.HGroupID = data.HGroupID
          this.form.HWHName = data.主表仓库
          this.form.HWHID = data.HWHID_Main
          this.form.HConveyCompName = data.运输公司
          this.form.HConveyCompID = data.HConveyCompID
          this.form.HConveyTypeName = data.运输方式
          this.form.HConveyTypeID = data.HConveyTypeID
          this.form.HConveyMoney = data.HConveyMoney
          this.form.HCarriage = data.运费
          this.form.HSTOCKORGID = data.HSTOCKORGID
          this.form.HOWNERID = data.HOWNERID
          this.form.HSCWHName = data.主表调出仓库
          this.form.HSCWHID = data.HSCWHID
          this.form.HCheckStatusMan = data.核销人
          this.form.HExplanation = data.摘要
          this.form.HInnerBillNo = data.内部单据号
          this.form.HCurName = data.币别
          this.form.HCurID = data.HCurID
          this.form.HExRate = data.汇率
          this.form.HSellSName = data.销售方式
          this.form.HSellSID = data.HSellSID
          //  this.form.HCusBalance=data
          //  this.form.HCreditRating_Now=HConveyMoney
          //  this.form.HAvailableBalance=data
          this.form.HPriceType = data.单价类型
          this.form.HOrgID = data.HOrgID
          this.getCustomerByCusID(response.data.data[0].HSupID)//根据客户获取联系人,联系人电话
          this.getBarCodeNoteBySellOutBill(rowHmainid)//获取销售出库单对应的条码明细是否可编辑
          for (var i = 0; i < result.data.length; i++) {
            this.editData.push(
              {
                "HMaterID": result.data[i].HMaterID
                , "物料代码": result.data[i].物料代码
                , "物料名称": result.data[i].物料名称
                , "规格型号": result.data[i].规格型号
                , "HUnitID": result.data[i].HUnitID
                , "计量单位": result.data[i].计量单位
                , "HQtyMust": result.data[i].应发数量.toFixed(6)
                , "HQty": result.data[i].数量.toFixed(6)
                , "HPieceQty": result.data[i].件数.toFixed(0)
                , "HPrice": result.data[i].单价.toFixed(4)
                , "HTaxPrice": result.data[i].含税单价.toFixed(4)
                , "HTaxRate": result.data[i].税率
                , "HMoney": (result.data[i].数量 * result.data[i].单价).toFixed(2)
                , "HTaxMoney": (result.data[i].数量 * result.data[i].含税单价, 2).toFixed(2)
                , "HWHID": result.data[i].hwhid
                , "发货仓库": result.data[i].发货仓库
                , "HRemark": result.data[i].表体备注
                , "HQty_Full": result.data[i].满车重量
                , "HQty_Empty": result.data[i].空车重量
                , "HQty_Back": result.data[i].回车重量
                , "HCostPrice": result.data[i].成本单价
                , "HCostMoney": result.data[i].成本金额
                , "HSalePrice": result.data[i].销售单价
                , "HSeOrderInterID": result.data[i].HSeOrderInterID
                , "HSeOrderEntryID": result.data[i].HSeOrderEntryID
                , "HSeOrderBillNo": result.data[i].销售订单号
                , "HSourceInterID": result.data[i].HSourceInterID
                , "HSourceEntryID": result.data[i].HSourceEntryID
                , "HSourceBillNo": result.data[i].源单单号
                , "HSourceBillType": result.data[i].HSourceBillType
                , "HRelationQty": result.data[i].关联数量
                , "HRelationMoney": result.data[i].关联金额
                , 'HSPID': result.data[i].HSPID
                , 'HSPName': result.data[i].仓位
                , 'HSPGroupID': result.data[i].HSPGroupID
                , "HSPGroupName": result.data[i].仓位组
                , 'HSCWHID': result.data[i].HSCWHID
                , 'HSCWHName': result.data[i].调出仓库
                , 'HSCSPID': result.data[i].HSCSPID
                , 'HSCSPName': result.data[i].调出仓位
                , 'HBatchNo': result.data[i].批次
                , 'HPOOrderInterID': result.data[i].采购订单内码
                , 'HPOOrderEntryID': result.data[i].采购订单子内码
                , 'HPOOrderBillNo': result.data[i].采购订单号
                , 'HPropertyID': result.data[i].HPropertyID
                , 'HPropertyName': result.data[i].辅助属性
                , 'HSecUnitID': result.data[i].HSecUnitID
                , 'HSecUnitName': result.data[i].辅助计量单位
                , 'HSecUnitRate': result.data[i].换算率
                , 'HEngineNum': result.data[i].发动机号
                , 'HUnderPanNum': result.data[i].地盘号
                , 'HLeaveFactCard': result.data[i].出厂证
                , 'HReqBuyQty': result.data[i].申请采购数量
                , 'HReqOutQty': result.data[i].申请出库数量
                , 'HCurrentInventory': result.data[i].当前库存
              }
            );
          }
          this.editData = result.list[1].Gy_Supplier_Link
          this.editData1 = result.list[0].Gy_Supplier_PayPlan
          console.log(856,this.form,this.editData,this.editData1)
          if (data.状态 != '创建' && this.copyType != 1) {
            this.$modal.msgError("此条数据不是创建状态,不能修改");
            this.subDisabled = true
@@ -1090,67 +886,18 @@
    rowSysZbIndex({ row, rowIndex }) {
      row.index = rowIndex + 1;
    },
    rowSysZbIndex1({ row, rowIndex }) {
      row.index = rowIndex + 1;
    },
    /** 编辑页子表添加按钮操作 */
    handleAddSysZb(index, num) {
      if (num == 1 && !index) {
        this.$modal.msgError("请选择一行数据编辑!");
      } else {
        let obj = {
          HMaterID: 0,
          物料代码: '',
          物料名称: '',
          规格型号: '',
          HUnitID: 0,
          计量单位: '',
          HQtyMust: 1,
          HQty: 1,
          HPieceQty: 0,
          HPrice: 0,
          HTaxPrice: 0,
          HTaxRate: 0,
          HMoney: 0,
          HTaxMoney: 0,
          HWHID: 0,
          发货仓库: '',
          HRemark: '',
          HQty_Full: 0,
          HQty_Empty: 0,
          HQty_Back: 0,
          HCostPrice: 0,
          HCostMoney: 0,
          HSalePrice: 0,
          HSeOrderInterID: 741,
          HSeOrderEntryID: 18,
          HSeOrderBillNo: 'XSFH00000747',
          HSourceInterID: 741,
          HSourceEntryID: 18,
          HSourceBillNo: 'XSFH00000747',
          HSourceBillType: 1402,
          HRelationQty: 0,
          HRelationMoney: 0,
          HSPID: 0,
          HSPName: '',
          HSPGroupID: 0,
          HSPGroupName: '',
          HSCWHID: 0,
          HSCWHName: '',
          HSCSPID: 0,
          HSCSPName: '',
          HBatchNo: '',
          HPOOrderInterID: 0,
          HPOOrderEntryID: 0,
          HPOOrderBillNo: '',
          HPropertyID: 0,
          HPropertyName: '',
          HSecUnitID: 0,
          HSecUnitName: '',
          HSecUnitRate: 0,
          HEngineNum: '',
          HUnderPanNum: '',
          HLeaveFactCard: '',
          HReqBuyQty: 0,
          HReqOutQty: 0,
          HCurrentInventory: 0,
          HLinkMan:'',
          HLinkPhone:'',
          HRemark:'',
        }
        if (index) {
          this.editData.splice(index, 0, obj);
@@ -1160,12 +907,38 @@
        }
      }
    },
    handleAddSysZb1(index, num) {
      if (num == 1 && !index) {
        this.$modal.msgError("请选择一行数据编辑!");
      } else {
        let obj = {
          HPayType:'',
          HPayRate:'',
          HPayTime:'',
          HPayRemark:'',
        }
        if (index) {
          this.editData1.splice(index, 0, obj);
          this.$set(this.editData1, index, obj)
        } else {
          this.editData1.push(obj);
        }
      }
    },
    handleCopyZbRow() {
      if (!this.zbIndex) {
        this.$modal.msgError("请选择一行数据")
      } else {
        let copyRow = JSON.parse(JSON.stringify(this.zbSelForm))
        this.editData.push(copyRow);
      }
    },
    handleCopyZbRow1() {
      if (!this.zbIndex1) {
        this.$modal.msgError("请选择一行数据")
      } else {
        let copyRow = JSON.parse(JSON.stringify(this.zbSelForm1))
        this.editData1.push(copyRow);
      }
    },
    handleMoveRowUp(zbSelForm) {
@@ -1218,6 +991,15 @@
        this.$refs.zbTable.toggleRowSelection(del_row, false) //设置这一行取消选中
      }
    },
    handleTableZbEdit1(selection) {
      this.checkedSysZb = selection.map(item => item.index)
      this.zbSelForm = selection[0]
      this.zbIndex = this.checkedSysZb[0]
      if (selection.length > 1) {
        const del_row = selection.shift()
        this.$refs.zbTable1.toggleRowSelection(del_row, false) //设置这一行取消选中
      }
    },
    //获取最大单据号_任务类(Type为0时只获取不新增流水号,为1时新增且获取流水号)
    get_MAXNum_Task(Type) {
      var sql = `exec h_p_Xt_GetMaxBillNo_SubType '1205','${this.form.HDate}',0,0,0,'${Type}','${this.form.HDeptID}'`;