chenhaozhe
6 天以前 723793a0aa8d69cbbb463830a3344dbd6655cee5
src/views/ProductInBill/Kf_ProductInBillList.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>
@@ -169,10 +173,11 @@
          </el-table-column>
        </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="HModName" @rowEditClose="rowSetClose"
          v-if="rowHideShow" />
      </el-dialog>
        <RowSettings :colName="btResList" HModName="Kf_ProductInBillList" @rowEditClose="rowSetClose"
          v-if="rowHideShow" />
      </el-dialog>
@@ -282,9 +287,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监听事件
@@ -494,7 +507,6 @@
    //#region 查询
    getList() {
      this.pageSize = 50
      if (this.pageSize == 0) {
        this.pageSize = 50
      }
@@ -502,18 +514,19 @@
      this.loading = true
      
      // 列表查询
      axios.get(this.$baseUrl + '/Kf_ProductInBillController/GetKf_ProductInBillList_Json', {
      axios.get(this.$baseUrl + '/Kf_ProductInBillController/page', {
        params: {
          "sWhere": this.sWhere,
          "HMaker": sessionStorage["HUserName"],
          "OperationType": 1,
          "ViewName": "h_v_Kf_ProductInBillList"
          "user": sessionStorage["HUserName"],
          "page": this.page,
          "size": this.pageSize,
          "Type":'3802',
        },
      }).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 = [];//列字段数据
@@ -651,6 +664,50 @@
      this.rowHideShow = true
      this.openRowHide = true
    },
       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)
        }
      })
    },
    rowSetClose(val) {
      this.rowHideShow = false
      this.tableShow = true
@@ -763,11 +820,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
@@ -873,7 +930,7 @@
      var result = false;
      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;
          }