wangyi
2026-01-19 7fb0a8f0ab16c149484bf043754cd10cfa94de2f
src/views/scMould/warehouse/Sc_MouldProdBackBillList.vue
@@ -25,36 +25,34 @@
      <el-collapse v-model="activeSeach">
        <el-collapse-item title="更多" name="1">
          <el-card class="box-card">
            <el-form-item label="组织名称" prop="HStockOrgName">
              <el-input v-model="queryParams.HStockOrgName" placeholder="请输入组织名称" @keyup.enter.native="handleQuery" />
            <el-form-item label="状态" prop="HStatus">
              <el-select v-model="queryParams.HStatus" placeholder="请选择状态">
                <el-option v-for="(item, index) in HStatusList" :key="index" :label="item.name" :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
            <!-- <el-form-item label="组织">
              <el-select v-model="queryParams.HOrgID" placeholder="请选择">
            <el-form-item label="组织">
              <el-select v-model="queryParams.HStockOrgID" placeholder="请选择">
                <el-option v-for="(item, index) in organizationList" :key="index" :label="item.Name" :value="item.ID">
                </el-option>
              </el-select>
            </el-form-item> -->
            </el-form-item>
            <el-form-item label="部门信息" prop="HDept">
              <el-input v-model="queryParams.HDept" placeholder="请输入部门信息" @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="物料代码" prop="HMaterNumber">
              <el-input v-model="queryParams.HMaterNumber" placeholder="请输入物料代码" @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="器具代码" prop="HModelNumber">
              <el-input v-model="queryParams.HModelNumber" placeholder="请输入器具代码" @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="仓库" prop="HWhName">
              <el-input v-model="queryParams.HWhName" placeholder="请输入仓库" @keyup.enter.native="handleQuery" />
            <el-form-item label="容器代码" prop="HModelNumber">
              <el-input v-model="queryParams.HModelNumber" placeholder="请输入容器代码" @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="往来单位" prop="HSupName">
              <el-input v-model="queryParams.HSupName" placeholder="请输入往来单位" @keyup.enter.native="handleQuery" />
            </el-form-item>
            <div slot="header" class="clearfix"><span>过滤</span></div>
            <div slot="header" class="clearfix"><span>其他条件</span></div>
            <div>
              <el-row>
                <el-form-item label-width="0">
                  <el-row>
                    <el-col :span="7">
                    <el-col :span="2"><span>过滤</span></el-col>
                    <el-col :span="6">
                      <el-select v-model="queryParams.ColName1" placeholder="请选择" @change="riqiChange">
                        <span v-for="(item, index) in btList" :key="index">
                          <el-option :label="item.field" :value="item.field" v-if="!item.hide"></el-option>
@@ -67,7 +65,7 @@
                          :value="item.value"></el-option>
                      </el-select>
                    </el-col>
                    <el-col :span="11">
                    <el-col :span="10">
                      <el-input v-model="queryParams.ColContent1" placeholder="请输入" clearable
                        @keyup.enter.native="handleQuery" />
                    </el-col>
@@ -77,7 +75,8 @@
              <el-row>
                <el-form-item label-width="0">
                  <el-row>
                    <el-col :span="7">
                    <el-col :span="2"><span>过滤</span></el-col>
                    <el-col :span="6">
                      <el-select v-model="queryParams.ColName2" placeholder="请选择" @change="riqiChange">
                        <span v-for="(item, index) in btList" :key="index">
                          <el-option :label="item.field" :value="item.field" v-if="!item.hide"></el-option>
@@ -90,7 +89,7 @@
                          :value="item.value"></el-option>
                      </el-select>
                    </el-col>
                    <el-col :span="11">
                    <el-col :span="10">
                      <el-input v-model="queryParams.ColContent2" placeholder="请输入" clearable
                        @keyup.enter.native="handleQuery" />
                    </el-col>
@@ -99,7 +98,8 @@
              </el-row>
              <el-form-item label-width="0">
                <el-row>
                  <el-col :span="7">
                  <el-col :span="2"><span>过滤</span></el-col>
                  <el-col :span="6">
                    <el-select v-model="queryParams.ColName" placeholder="请选择" @change="riqiChange">
                      <el-option v-for="(item, index) in btList" :key="index" :label="item.field"
                        :value="item.field"></el-option>
@@ -111,7 +111,7 @@
                        :value="item.value"></el-option>
                    </el-select>
                  </el-col>
                  <el-col :span="11">
                  <el-col :span="10">
                    <el-input v-model="queryParams.ColContent" placeholder="请输入" clearable
                      @keyup.enter.native="handleQuery" />
                  </el-col>
@@ -129,7 +129,11 @@
      </el-col>
      <el-col :span="1.5">
        <el-button type="primary" icon="el-icon-edit" size="mini" :disabled="single"
          @click="handleEdit(row = rowForm, OperationType = 3)">编辑</el-button>
          @click="handleEdit(row = rowForm, OperationType = 2)">编辑</el-button>
      </el-col>
       <el-col :span="1.5">
        <el-button type="primary" icon="el-icon-Pallet" size="mini" :disabled="single" @click="set_PalletChange">托数变更
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="primary" icon="el-icon-document-copy" size="mini" :disabled="single"
@@ -171,7 +175,7 @@
              <el-checkbox v-model="checked" v-if="item.type == 'checkbox'"></el-checkbox>
              <div :style="item.style">
                <span v-if="column.property.includes('日期')">{{ parseTime(row[column.property], '{y}-{m}-{d}') }}</span>
                <el-button type="text" @click="handleEdit(row, OperationType = 3)"
                <el-button type="text" @click="handleEdit(row, OperationType = 2)"
                  v-else-if="column.property == '单据号'">{{
                    row.单据号
                  }}</el-button>
@@ -186,8 +190,9 @@
        <RowSettings :colName="btResList" :HModName="HModName" @rowEditClose="rowSetClose"
          v-if="rowHideShow" />
      </el-dialog>
      <!-- 编辑 -->
      <el-dialog title="编辑器具领用退库单" :visible.sync="openEdit" width="1480px" append-to-body class="xsckdBox" @close="close">
      <el-dialog title="编辑容器入库单" :visible.sync="openEdit" width="1480px" append-to-body class="xsckdBox" @close="close">
        <edit :OperationType=OperationType :linterid=this.rowForm.hmainid :HSouceBillType=this.rowForm.HSourceBillType
          :copyType="copyType" @editClose="editClose" v-if="editShow" />
      </el-dialog>
@@ -253,10 +258,10 @@
        { label: '近一年', value: 365 },
      ],
      organizationList: JSON.parse(sessionStorage.getItem('organizationList')),//组织列表
      hPriceTypeList: ['成本价', '结算价'],
      HStatusList: [{name:'全部',value:'-1'},{name:'未审核',value:'0'},{name:'已审核',value:'1'},{name:'已关闭',value:'2'}],
      addBtnShow: false,
      dialogTitle: '',
      OperationType: null,//保存类型(新增1修改3)
      OperationType: null,//保存类型(新增1修改2)
      HInterID: null,
      baseURL: process.env.VUE_APP_BASE_API,
      lastSelectedRowIndex: null, // 用于记录上次点击的行索引
@@ -271,11 +276,10 @@
      queryParams: {
        HBillNo: '',
        HInitTimeCycle: 29,
        HStockOrgName: '',
        HStockOrgID: sessionStorage["OrganizationID"] - 0,
        HStatus:'-1',
        HDept:'',
        HMaterNumber: '',
        HModelNumber:'',
        HWhName:'',
        HSupName:'',
        ColName1: '',
        ColName2: '',
@@ -374,20 +378,24 @@
      this.tableShow = false
      this.loading = true
      if (this.sTime && !this.sWhere) {
        this.sWhere += " and CONVERT(varchar(100),日期, 23) >= '" + this.sTime + "'"
        this.sWhere += " and CONVERT(varchar(100),日期, 23) <= '" + this.eTime + "'"
        this.sTime = moment(this.sTime).format('YYYY-MM-DD')
        this.eTime = moment(this.eTime).format('YYYY-MM-DD')
        this.sWhere += " and 日期 >= '" + this.sTime + "'";
        this.sWhere += " and 日期 <= '" + this.eTime + "'";
      }
      this.sWhere += " and HSTOCKORGID=" + this.queryParams.HStockOrgID
      if (this.pageSize == 0) {
        this.pageSize = 50
      }
      // 销售出库单列表
      axios.get(this.baseURL + '/Sc_MouldProdBackBill/list_byPage', {
      axios.get(this.$baseUrl + '/Sc_MouldProdBackBillController/page', {
        params: {
          "sWhere": this.sWhere,
          "user": sessionStorage["HUserName"],
          "Organization": sessionStorage["Organization"],
          "page": this.page,
          "size": this.pageSize
          "size": this.pageSize,
          "Type": '3803'
        },
      }).then(response => {
        this.tyResList = response.data.data//总数据
@@ -425,6 +433,8 @@
          option.data = data1.data
          this.dataList = option
          this.DisPlay_HideColumn(this.HModName, sessionStorage["HUserName"], option, this.dataList);
        }else{
          this.$modal.msgError(response.data.Message);
        }
      }).catch(error => {
        this.$modal.msgError("接口请求失败!");
@@ -432,7 +442,7 @@
    },
    DisPlay_HideColumn(HModName, user, option, dataOption) {
      this.totalNameList = []
      axios.get(this.baseURL + '/Xt_grdAlignment_WMES/grdAlignmentWMESList', {
      axios.get(this.$baseUrl + '/Xt_grdAlignment_WMES/grdAlignmentWMESList', {
        params: {
          "HModName": HModName,
          "user": user,
@@ -573,6 +583,9 @@
      this.selectedRow = row; // 记录当前选中的行
      this.lastSelectedRowIndex = this.tableData.indexOf(row);
      this.$refs.tableData.toggleRowSelection(row);
      if (this.openPage) {
        this.$emit('deptEmit', this.rowList, this.BillType)
      }
    },
    //选中行高亮样式
    rowStyle({ row, rowIndex }) {
@@ -582,8 +595,8 @@
    },
    //双击行
    handleDblclick(row, column, cell, event) {
      this.OperationType = 3
      this.handleEdit()
      this.OperationType = 2
      this.handleEdit(row)
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
@@ -661,34 +674,43 @@
        }
        this.sWhere += " and " + this.queryParams.ColName2 + " " + com2;
      }
      if (this.queryParams.HStatus) {
          switch (this.queryParams.HStatus) {
              case '-1':   //全部
                  this.sWhere += "";
                  break;
              case '0':    //未审核
                  this.sWhere += " and 审核人=''";
                  break;
              case '1':    //已审核
                  this.sWhere += " and 审核人<>''";
                  break;
              case '2':    //已关闭
                  this.sWhere += " and 关闭人<>''";
              default:
          }
      }
      if (this.sTime) {
        this.sTime = moment(this.sTime).format('YYYY-MM-DD')
        this.eTime = moment(this.eTime).format('YYYY-MM-DD')
        console.log(this.sTime, this.eTime)
        this.sWhere += " and CONVERT(varchar(100),日期, 23) >= '" + this.sTime + "'" + " and CONVERT(varchar(100),日期, 23) <= '" + this.eTime + "'";
        this.sWhere += " and 日期 >= '" + this.sTime + "'";
      }
      if (this.eTime) {
        this.eTime = moment(this.eTime).format('YYYY-MM-DD')
        this.sWhere += " and 日期 <= '" + this.eTime + "'";
      }
      if (this.queryParams.HBillNo) {
        this.sWhere += " and 单据号 like '%" + this.queryParams.HBillNo + "%'";
      }
      if (this.queryParams.HStockOrgName) {
        this.sWhere += " and 组织名称 like '%" + this.queryParams.HStockOrgName + "%'";
      }
      if (this.queryParams.HDept) {
          this.sWhere += " and 部门 like '%" + this.queryParams.HDept + "%'";
      }
      if (this.queryParams.HMaterNumber) {
          this.sWhere += " and 物料代码 like '%" + this.queryParams.HMaterNumber + "%'";
      }
      if (this.queryParams.HModelNumber) {
          this.sWhere += " and 模具代码 like '%" + this.queryParams.HModelNumber + "%'";
      }
      if (this.queryParams.HWhName) {
          this.sWhere += " and 仓库 like '%" + this.queryParams.HWhName + "%'";
          this.sWhere += " and 器具代码 like '%" + this.queryParams.HModelNumber + "%'";
      }
      if (this.queryParams.HSupName) {
          this.sWhere += " and 往来单位 like '%" + this.queryParams.HSupName + "%'";
      }
      this.clearData()
      this.getList()
    },
    /** 重置按钮操作 */
@@ -697,11 +719,10 @@
      this.queryParams = {
        HBillNo: '',
        HInitTimeCycle: 29,
        HStockOrgName: '',
        HStockOrgID: sessionStorage["OrganizationID"] - 0,
        HStatus:'-1',
        HDept:'',
        HMaterNumber: '',
        HModelNumber:'',
        HWhName:'',
        HSupName:'',
        ColName1: '',
        ColName2: '',
@@ -715,6 +736,7 @@
      }
      this.riqiChange()
      this.resetForm("queryForm")
      this.clearData()
      this.getList()
    },
@@ -724,6 +746,7 @@
      this.tableShow = true
      this.openEdit = false
      this.editShow = false
      this.clearData()
      this.getList()
    },
    //打开新增组件弹窗
@@ -743,19 +766,74 @@
      this.open = val
      this.editShow = false
      this.openEdit = val
      this.clearData()
      this.getList()
    },
    //清除选中数据的缓存
    clearData(){
      this.ids = []
      this.multiple = true
      this.single = true
      this.OperationType = 0
      this.copyType = 0
    },
   //托数变更
    set_PalletChange() {
      if (!this.rowForm || !this.rowForm.hmainid) {
        this.$modal.msgError('请先选择一条记录!')
        return
      }
      const rowData = this.rowForm // 使用 rowForm 而不是 rowList
      const currentPallet = rowData.托数 || 0
      // 将"请输入新托数"作为输入框的placeholder
      this.$prompt(`当前托数:${currentPallet}`, {
        confirmButtonText: '保存',
        cancelButtonText: '取消',
        inputValue: currentPallet,
        inputType: 'number',
        inputValidator: (value) => {
          if (!value) return '请输入托数!'
          const num = parseInt(value)
          if (isNaN(num)) return '请输入有效的数字!'
          if (num.toString() !== value) return '托数不能为小数!'
          if (num <= 0) return '托数必须大于0!'
          return true
        }
      }).then(({ value }) => {
        const newPallet = parseInt(value)
        return axios.post(this.$baseUrl + '/Sc_MouldProdBackBillController/UpdatePallet', {
          hmainid: rowData.hmainid,
          newPallet: newPallet,
          operator: sessionStorage["HUserName"]
        })
      }).then(response => {
        if (response.data && response.data.count == 1) {
          this.$modal.msgSuccess('托数变更成功!')
          this.getList()
        } else {
          this.$modal.msgError('错误:' + (response.data.Message || '保存失败'))
        }
      }).catch(error => {
        if (error !== 'cancel') {
          this.$modal.msgError('操作失败:' + error.message)
        }
      })
    },
    /** 删除按钮操作 */
    handleDelete() {
      this.$modal.confirm('确认要删除吗,删除后不能恢复').then(() => {
        axios.get(this.baseURL + "/Sc_MouldProdBackBill/DeltetMouldProdBackBill", {
          params: { 'HInterID': this.rowForm.hmainid.toString(), 'user': sessionStorage["HUserName"] }
        axios.get(this.$baseUrl + "/Sc_MouldProdBackBillController/GetSc_MouldProdBackBill_Delete_Json", {
          params: { 'HInterID': this.rowForm.hmainid.toString(), 'HMaker': sessionStorage["HUserName"] }
        }).then(response => {
          if (response.data.count == 1) {
            this.getList()
            this.$modal.msgSuccess("删除成功")
          } else {
            this.$modal.msgError("错误:" + result.code + result.Message);
            this.$modal.msgError("错误:" + response.data.code + response.data.Message);
          }
        }).catch(error => {
          this.$modal.msgError("接口请求失败!");
@@ -766,12 +844,13 @@
    set_CheckBill(num, form) {
      var InterID = form.hmainid || form.HInterID
      //逻辑审核方法
      axios.get(this.baseURL + "/Sc_MouldProdBackBill/AuditMouldProdBackBill", {
      axios.get(this.$baseUrl + "/Sc_MouldProdBackBill/AuditMouldProdBackBill", {
        params: { "HInterID": InterID, "flag": num, "user": sessionStorage["HUserName"] }
      }).then(response => {
        let result = response.data
        if (result.count == 1) {
          this.$modal.msgSuccess('操作成功');
          this.clearData()
          this.getList();
        }
        else {
@@ -795,7 +874,7 @@
      } else if (this.rowForm.状态 != "已审核" && !this.defaintOperationByCompanyName()) {
        this.$modal.msgError("打印失败!原因:单据状态不为'已审核'状态!!");
      } else {
        axios.get(this.baseURL + "/Kf_SellOutBill/CheckSellOutBill_IsExist", {
        axios.get(this.$baseUrl + "/Kf_SellOutBill/CheckSellOutBill_IsExist", {
          params: { "HInterID": this.rowForm.hmainid }
        }).then(response => {
          var result = response.data
@@ -818,7 +897,7 @@
    //#region 获取公司名,根据公司进行定制化开发
    defaintOperationByCompanyName() {
      var result = false;
      axios.get(this.baseURL + '/Xt_getInfo/getCompanyName').then(response => {
      axios.get(this.$baseUrl + '/Xt_getInfo/getCompanyName').then(response => {
        var data1 = response.data
        if (data1.count == 1) {
          if (data1.data == "水务") {