陈婷婷
2026-04-07 8d0dec5466aef7a6a90a717d0de1d9c7875371e8
src/views/KCGL/MoveStockBill/Kf_MoveStockBillList.vue
@@ -114,6 +114,10 @@
          @click="handleEdit(row = rowForm, OperationType = 3)">编辑</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"
          @click="handleEdit(row = rowForm, OperationType = 1, copyType = 1)">复制</el-button>
      </el-col>
@@ -141,6 +145,9 @@
      <el-col :span="1.5">
        <el-button type="primary" icon="el-icon-printer" size="mini" :disabled="single" @click="get_BarCodeDetail">条码明细</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="primary" icon="el-icon-printer" size="mini" :disabled="single" @click="get_PackStockDetail">包装容器出入库明细</el-button>
      </el-col>
    </el-row>
    <div class="tableBox" v-loading="loading">
      <el-table :data="tableData" ref="tableData" max-height="710" :summary-method="getSummaries"
@@ -167,7 +174,7 @@
        </template>
      </el-table>
      <!-- 记录数、页数、当前页 -->
      <pagination v-show="total > 0" :total="total" :page.sync="page" :limit.sync="pageSize" @pagination="handleQuery" />
      <pagination v-show="total > 0" :total="total" :page.sync="page" :limit.sync="pageSize" :pageSizes="pageSizes" @pagination="getList" />
      <!-- 列设置 -->
      <el-dialog title="隐藏列设置" :visible.sync="openRowHide" width="816px" append-to-body>
        <RowSettings :colName="btResList" HModName="Kf_MoveStockBillList" @rowEditClose="rowSetClose"
@@ -186,6 +193,8 @@
      </el-dialog>
      <!-- 条码明细 -->
      <BarCodeDetail :visible.sync="barCodeDetailShow" ref="barcodeDetail"/>
      <!-- 包装容器出入库明细 -->
      <PackStockDetail :visible.sync="packStockDetailShow" ref="packStockDetail"/>
    </div>
  </div>
</template>
@@ -196,11 +205,12 @@
import RowSettings from '@/views/component/rowSettings'                   //列设置组件
import PrintList from '@/views/component/printList'                       //打印组件
import BarCodeDetail from '@/views/component/BarCodeDetail'               //条码明细组件
import PackStockDetail from '@/views/component/PackStockDetail'               //条码明细组件
import Edit from '@/views/KCGL/MoveStockBill/Kf_MoveStockBillEdit.vue'    //编辑页面组件
export default {
  name: 'Kf_MoveStockBillList',
  components: { RowSettings, Edit, PrintList,BarCodeDetail },
  components: { RowSettings, Edit, PrintList,BarCodeDetail,PackStockDetail },
  data() {
    return {
      baseURL: process.env.VUE_APP_BASE_API,                //后端接口前缀(后端服务器ip地址)
@@ -252,6 +262,7 @@
      openRowHide: false,                                   //列设置组件显示标记
      rowHideShow: false,                                   //列设置组件容器显示标记
      barCodeDetailShow: false,                             //条码明细组件容器显示标记
      packStockDetailShow:false,                            //包装容器出入库明细容器显示标记
      
      
      
@@ -274,9 +285,17 @@
        ColContent: '',
      },
      
      page: 1,                                                      //page页索引
      pageSize: 0,                                                  //page页面记录数
      total: 0,                                                     //记录合计数
      loading: true,
      tyResList: [],//列表(接口数据)
      btList: [],//表头列表显示
      btResList: [],
      tableData: [],//列表(分页显示)
      dataList: [],
      titleData: [],//不需要显示的字段 可扩展
      pageSizes: [ 50,100, 500, 5000, 50000],
      page: 1,
      pageSize: 0,
      total: 0,
      tableShow: true,                                              // table显示标记
      totalNameList: [],                                            // 需要设置合计行的列数组
      tableData: [],                                                // 列表数据。用于table监听事件
@@ -295,11 +314,12 @@
    };
  },
  created() {
    this.fetchData()                //加载组织下拉列表数据
    this.riqiChange()
    this.handleQuery();
  },
  mounted() { // 对于需要加载组件完成后才需要渲染的数据,需要放在mounted钩子函数中
    this.fetchData()                //加载组织下拉列表数据
  },
  methods: {
    //#region 设置表头
    renderHeader(h, { column, $index }) {// 新建一个 span
@@ -366,7 +386,7 @@
    
    //#region 加载组织下拉列表数据
    fetchData() {
      axios.get(this.baseURL + "/Web/GetOrganizations", {
      axios.get(this.$baseUrl + "/Web/GetOrganizations", {
      }).then(response => {
        if (response.data.count == 1) {
          this.organizationList = response.data.data;//组织列表
@@ -485,7 +505,6 @@
    //#region 查询
    getList() {
      this.pageSize = 50
      if (this.pageSize == 0) {
        this.pageSize = 50
      }
@@ -493,16 +512,19 @@
      this.loading = true
      
      // 列表查询
      axios.get(this.baseURL + '/Kf_MoveStockBill/GetMoveStockBillList', {
      axios.get(this.$baseUrl + '/Kf_MoveStockBill/page', {
        params: {
          "sWhere": this.sWhere,
          "user": sessionStorage["HUserName"]
          "user": sessionStorage["HUserName"],
          "page": this.page,
          "size": this.pageSize,
          "Type":'1207',
        },
      }).then(response => {
        this.tyResList = response.data.data//总数据
        let data1 = response.data
        let option = []
        if (data1.count == 1) {
        if (data1.list && data1.list.length > 0) {
          this.btResList = data1.list             //列表表头数据
          this.total = data1.count;
          var data = [];//列字段数据
@@ -595,7 +617,7 @@
    handleDelete() {
      this.$modal.confirm('确认要删除吗,删除后不能恢复').then(() => {
        if (this.rowForm.状态 == "创建") {
          axios.get(this.baseURL + "Kf_MoveStockBill/DelteteGetMoveStockBill", {
          axios.get(this.$baseUrl + "Kf_MoveStockBill/DelteteGetMoveStockBill", {
            params: { 'HInterID': this.rowForm.hmainid.toString(), 'user': sessionStorage["HUserName"] }
          }).then(response => {
            if (response.data.count == 1) {
@@ -618,7 +640,7 @@
    set_CheckBill(num, form) {
      var InterID = form.hmainid || form.HInterID
      //逻辑审核方法
      axios.get(this.baseURL + "/Kf_MoveStockBill/CheckKf_MoveStockBill", {
      axios.get(this.$baseUrl + "/Kf_MoveStockBill/CheckKf_MoveStockBill", {
        params: { "HInterID": InterID, "Type": num, "user": sessionStorage["HUserName"] }
      }).then(response => {
        let result = response.data
@@ -634,6 +656,50 @@
      });
    },
    //#endregion
           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 + '/Kf_POStockInBill/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)
        }
      })
    },
    //#region 列设置
    handleRowHide() {
@@ -648,7 +714,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,
@@ -752,11 +818,11 @@
              this.totalNameList.push(item)
            }
          })
          if (data1.data[0].HPageSize == 0) {
            this.pageSize = 50
          } else {
            this.pageSize = data1.data[0].HPageSize
          }
          // if (data1.data[0].HPageSize == 0) {
          //   this.pageSize = 50
          // } else {
          //   this.pageSize = data1.data[0].HPageSize
          // }
          this.tableData = option.data
          this.tableShow = true
          this.loading = false
@@ -800,7 +866,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
@@ -834,6 +900,19 @@
      },
    //#endregion
    //#region 包装容器出入库明细
    get_PackStockDetail() {
      // if (this.selectedRow.length !== 1) {
      //   this.$message.warning('请选择一行数据查看条码明细!')
      //   return
      // }
      this.packStockDetailShow = true
      this.$nextTick(() => {
        this.$refs.packStockDetail.open(this.rowForm)
      })
      },
    //#endregion
    //#region 退出
    close() {
      // this.reset()
@@ -847,9 +926,9 @@
    //#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.list && data1.list.length > 0) {
          if (data1.data == "水务") {
            result = true;
          }