dytyqx
2026-04-07 8c2293edbea20fdac6705641acdccdbdc6c8c4b6
src/views/logistics/transportGPS/WL_YayBill.vue
@@ -17,8 +17,25 @@
                </el-select>
            </el-form-item>
            <el-form-item label="单据号" prop="HBillNo">
                <el-input v-model="queryParams.HBillNo" placeholder="请输入单据号" @keyup.enter.native="handleQuery" />
                <el-input v-model="queryParams.HBillNo" placeholder="请输入单据号" @keyup.enter.native="handleQuery"
                    style="width: 150px;" />
            </el-form-item>
            <el-form-item label="车牌号" prop="HPlateNumber">
                <el-input v-model="queryParams.HPlateNumber" placeholder="请输入车牌号" @keyup.enter.native="handleQuery"
                    style="width: 120px;" />
            </el-form-item>
            <el-form-item label="发货通知单" prop="HSourceBillNo">
                <el-input v-model="queryParams.HSourceBillNo" placeholder="请输入发货通知单" @keyup.enter.native="handleQuery"
                    style="width: 120px;" />
            </el-form-item>
            <el-form-item label="物流状态" prop="HBillStatus">
                <el-select v-model="queryParams.HBillStatus" placeholder="请选择物流状态">
                    <el-option v-for="(item, index) in HBillStatusList" :key="index" :label="item.Name"
                        :value="item.Name">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="组织" prop="HOrgID">
                <el-select v-model="queryParams.HOrgID" placeholder="请选择组织">
                    <el-option v-for="(item, index) in organizationList" :key="index" :label="item.Name"
@@ -143,8 +160,32 @@
                </el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="primary" icon="el-icon-edit-outline" size="mini" :disabled="single"
                    @click="set_CheckBill(0, form = rowForm)">审核</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="primary" icon="el-icon-edit-outline" size="mini" :disabled="single"
                    @click="set_CheckBill(1, form = rowForm)">反审核</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="primary" icon="el-icon-circle-check" size="mini" :disabled="single"
                    @click="handleVolume(rowForm)">维护零单占用体积</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="primary" icon="el-icon-circle-check" size="mini" :disabled="single"
                    @click="set_ConfirmBill">供应商确认</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="primary" icon="el-icon-edit-outline" size="mini" :disabled="single"
                    @click="hanleCarOrDriver(form = rowForm)">分配车辆和司机</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="primary" icon="el-icon-edit-outline" size="mini" :disabled="single"
                    @click="openDataDialog(14, form = rowForm)">分配车辆</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="primary" icon="el-icon-edit-outline" size="mini" :disabled="single"
                    @click="openDataDialog(15, form = rowForm)">分配司机</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="primary" icon="el-icon-circle-check" size="mini" :disabled="single"
@@ -162,21 +203,9 @@
                <el-button type="primary" icon="el-icon-circle-check" size="mini" :disabled="single"
                    @click="set_ConfirmOtherBill(4)">到货签收确认</el-button>
            </el-col>
            <!-- <el-col :span="1.5">
                <el-button type="primary" icon="el-icon-circle-check" size="mini" :disabled="single"
                    @click="set_CheckBill(0, form = rowForm)">分配司机</el-button>
            </el-col> -->
            <el-col :span="1.5">
                <el-button type="primary" icon="el-icon-circle-check" size="mini" :disabled="single"
                    @click="handleVolume(rowForm)">维护零单占用体积</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="primary" icon="el-icon-edit-outline" size="mini" :disabled="single"
                    @click="set_CheckBill(0, form = rowForm)">审核</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="primary" icon="el-icon-edit-outline" size="mini" :disabled="single"
                    @click="set_CheckBill(1, form = rowForm)">反审核</el-button>
                <el-button type="primary" icon="el-icon-edit-outline" size="mini"
                    @click="handlePush(row = rowForm, OperationType = 4)">下推(费用结算单)</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="primary" icon="el-icon-edit-outline" size="mini" :disabled="single"
@@ -195,22 +224,22 @@
                    @click="set_DropBill(2, form = rowForm)">反作废</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="primary" icon="el-icon-printer" size="mini" @click="get_PrintReport">打印</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="primary" icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="primary" icon="el-icon-date" size="mini" @click="handleRowHide">隐藏列设置</el-button>
            </el-col>
            <!-- <el-col :span="1.5">
                <el-button type="primary" icon="el-icon-printer" size="mini" @click="get_PrintReport">打印</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="primary" icon="el-icon-printer" size="mini" :disabled="single"
                    @click="get_BarCodeDetail">条码明细</el-button>
                <el-button type="primary" icon="el-icon-upload" size="mini" :disabled="single"
                    @click="handleFileUpload">附件上传</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-button type="primary" icon="el-icon-download" size="mini" :disabled="multiple"
                    @click="handleBatchFileDownload">附件下载</el-button>
            </el-col> -->
        </el-row>
        <div class="tableBox" v-loading="loading">
            <el-table :data="tableData" ref="tableData" max-height="710" :summary-method="getSummaries"
@@ -238,8 +267,9 @@
                </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"
                @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" />
@@ -247,14 +277,14 @@
            <!-- 编辑 -->
            <el-dialog title="编辑" :visible.sync="openEdit" width="1480px" append-to-body class="xsckdBox"
                @close="close">
                <edit :OperationType=OperationType :linterid=this.rowForm.HInterID
                <Edit :OperationType=OperationType :linterid=this.rowForm.HInterID
                    :HSouceBillType=this.rowForm.HSourceBillType :copyType="copyType" @editClose="editClose"
                    v-if="editShow" />
            </el-dialog>
            <!-- 打印 -->
            <el-dialog title="打印模板选择" :visible.sync="openPrintList" width="800px" append-to-body>
                <PrintList :linterid=this.rowForm.HInterID :MyMsg=this.rowForm.HInterID :Type='HBillType'
                    :HModName="HModName" @rowEditClose="rowSetClose" v-if="printListShow" />
                <PrintList :linterid='printIds' :MyMsg='printIds' :Type='HBillType' :HModName="HBillType"
                    @rowEditClose="rowSetClose" v-if="printListShow" />
                <!-- <div>111</div> -->
            </el-dialog>
@@ -264,7 +294,8 @@
                        <el-input v-model="formVolume.单据号" placeholder="请输入单据号" disabled />
                    </el-form-item>
                    <el-form-item label="零单占用体积">
                        <el-input-number v-model="formVolume.currentVolume" placeholder="请输入零单占用体积" />
                        <el-input-number v-model="formVolume.currentVolume"
                            :placeholder="`零担体积: ${formVolume.零担体积 || 0}`" />
                    </el-form-item>
                </el-form>
                <div slot="footer" class="dialog-footer">
@@ -276,6 +307,102 @@
            <BarCodeDetail :visible.sync="barCodeDetailShow" ref="barcodeDetail" />
            <!-- 包装容器出入库明细 -->
            <PackStockDetail :visible.sync="packStockDetailShow" ref="packStockDetail" />
            <!-- 下推 -->
            <el-dialog title="下推运单结算单" :visible.sync="openPush" width="1480px" append-to-body class="xsckdBox"
                @close="close">
                <PayMentOtherBillTranEdit :OperationType='4' :propsData='pushData'
                    :HSouceBillType=this.rowForm.HSourceBillType @editClose="pushClose" v-if="pushShow" />
            </el-dialog>
            <el-dialog :title="dialogTitle" :visible.sync="openData" width="1280px" append-to-body>
                <GyCar @deptEmitDb="dbEmitData" @deptEmit="emitData" :openPage="HModName" v-if="gyCarShow" />
                <GyDriver @deptEmitDb="dbEmitData" @deptEmit="emitData" :openPage="HModName" v-if="gyDriverShow" />
                <div slot="footer" class="dialog-footer">
                    <el-button type="primary" @click="deptClickSub">确 定</el-button>
                    <el-button @click="deptClose">取 消</el-button>
                </div>
            </el-dialog>
            <!-- 分配车辆和司机 -->
            <el-dialog title="分配车辆和司机" :visible.sync="openCarDriver" width="500px" append-to-body>
                <el-form ref="carDriverForm" :model="carDriverForm" :rules="carDriverRules" label-width="100px">
                    <el-form-item label="车牌号" prop="CarHNumber">
                        <el-input v-model="carDriverForm.CarHNumber" placeholder="请输入车牌号" />
                    </el-form-item>
                    <el-form-item label="车辆名称" prop="CarHName">
                        <el-input v-model="carDriverForm.CarHName" placeholder="请输入车辆名称" />
                    </el-form-item>
                    <el-form-item label="驾驶员" prop="DriverHName">
                        <el-input v-model="carDriverForm.DriverHName" placeholder="请输入驾驶员" />
                    </el-form-item>
                    <el-form-item label="身份证号" prop="DriverHIDCard">
                        <el-input v-model="carDriverForm.DriverHIDCard" placeholder="请输入身份证号" />
                    </el-form-item>
                </el-form>
                <div slot="footer" class="dialog-footer">
                    <el-button type="primary" @click="submitCarDriver">确 定</el-button>
                    <el-button @click="openCarDriver = false">取 消</el-button>
                </div>
            </el-dialog>
            <!-- 附件上传 -->
            <el-dialog title="附件上传" :visible.sync="openFileUpload" width="600px" append-to-body>
                <el-form ref="fileUploadForm" label-width="100px">
                    <el-form-item label="单据号">
                        <el-input v-model="fileUploadForm.billNo" disabled />
                    </el-form-item>
                    <el-form-item label="附件">
                        <el-upload class="upload-demo" ref="fileUpload" :headers="upload.headers" action="http://220.189.218.155:9010/File" :on-preview="handleFilePreview"
                            :on-remove="handleFileRemove" :on-change="handleFileChange" :file-list="fileList"  :on-success="handleFileSuccess" :on-error="handleFileError"
                             :limit="10" :on-exceed="handleFileExceed"
                            accept=".jpg,.png,.jpeg,.pdf,.doc,.docx,.xls,.xlsx,.zip,.rar">
                            <el-button size="small" type="primary">点击上传</el-button>
                            <div slot="tip" class="el-upload__tip">
                                支持上传jpg/png/jpeg/pdf/doc/docx/xls/xlsx/zip/rar格式文件,最多10个</div>
                        </el-upload>
                    </el-form-item>
                    <el-form-item label="已上传附件" v-if="uploadedFileList.length > 0">
                        <el-table :data="uploadedFileList" border size="small" max-height="200">
                            <el-table-column label="文件名" prop="name" align="center" show-overflow-tooltip />
                            <el-table-column label="上传时间" prop="uploadTime" align="center" width="150" />
                            <el-table-column label="操作" align="center" width="100">
                                <template slot-scope="scope">
                                    <el-button type="text" size="small" @click="downloadFile(scope.row)">下载</el-button>
                                    <el-button type="text" size="small" style="color: red;"
                                        @click="deleteUploadedFile(scope.row, scope.$index)">删除</el-button>
                                </template>
                            </el-table-column>
                        </el-table>
                    </el-form-item>
                </el-form>
                <div slot="footer" class="dialog-footer">
                    <!-- <el-button type="primary" @click="submitFileUpload" :loading="fileUploadLoading">上传</el-button> -->
                    <el-button @click="openFileUpload = false">关 闭</el-button>
                </div>
            </el-dialog>
            <!-- 附件批量下载 -->
            <el-dialog title="附件批量下载" :visible.sync="openBatchDownload" width="900px" append-to-body>
                <div style="margin-bottom: 10px;">
                    <el-alert :title="`已选择 ${selectedBillCount} 条单据,共 ${batchFileList.length} 个附件`" type="info"
                        show-icon :closable="false" />
                </div>
                <el-table :data="batchFileList" border v-loading="batchDownloadLoading" max-height="400"
                    @selection-change="handleBatchFileSelectionChange">
                    <el-table-column type="selection" width="55" align="center" />
                    <el-table-column label="单据号" prop="billNo" align="center" width="150" show-overflow-tooltip />
                    <el-table-column label="文件名" prop="name" align="center" show-overflow-tooltip />
                    <el-table-column label="文件类型" prop="fileType" align="center" width="100" />
                    <el-table-column label="上传时间" prop="uploadTime" align="center" width="150" />
                    <el-table-column label="操作" align="center" width="80">
                        <template slot-scope="scope">
                            <el-button type="text" size="small" @click="downloadSingleFile(scope.row)">下载</el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <div slot="footer" class="dialog-footer">
                    <el-button type="primary" @click="batchDownloadFiles" :loading="batchDownloadLoading"
                        :disabled="selectedBatchFiles.length === 0">批量下载选中</el-button>
                    <el-button type="primary" @click="downloadAllFiles" :loading="batchDownloadLoading">下载全部</el-button>
                    <el-button @click="openBatchDownload = false">关 闭</el-button>
                </div>
            </el-dialog>
        </div>
    </div>
</template>
@@ -286,23 +413,48 @@
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 PackStockDetail from '@/views/component/PackStockDetail'           //条码明细组件
import Edit from '@/views/logistics/transportGPS/Add_Edit_WL_YayBill'   //编辑页面组件
import PayMentOtherBillTranEdit from "@/views/logistics/WayBillPaymentBill/Pay_WayBillPaymentBillEdit.vue";  //编辑页面组件
import GyCar from "@/views/basic/gyCar/gyCarList.vue"
import GyDriver from "@/views/system/user/GyDriver.vue"
export default {
    name: 'WL_YayBill',
    components: { RowSettings, Edit, PrintList, BarCodeDetail, PackStockDetail },
    components: { BarCodeDetail, PackStockDetail, Edit, RowSettings, PrintList, PayMentOtherBillTranEdit, GyCar, GyDriver },
    data() {
        return {
            upload: {
                // 是否显示弹出层
                open: false,
                // 弹出层标题
                title: "",
                // 是否禁用上传
                isUploading: false,
                // 是否更新已经存在的数据
                updateSupport: 0,
                // 设置上传的请求头部
                 headers: {  'Content-Type': 'multipart/form-data'},
                // 上传的地址
                url: 'http://220.189.218.155:9010/File'
            },
            baseURL: process.env.VUE_APP_BASE_API,                //后端接口前缀(后端服务器ip地址)
            HModName: "Cg_ContractTransportBillMainList",
            HBillType: "Cg_ContractTransportBillMainList",
            HBillType: "WL_YayBill",
            OperationType: null,                                  //保存类型(新增1修改3)
            copyType: 0,                                          //复制标记。打开编辑组件时,用于区分编辑还是复制
            HInterID: null,
            hPriceTypeList: ['成本价', '结算价'],
            HBillStatusList:[
                {ID: 1, Name: "申请中" },
                {ID: 2, Name: "待供应商确认" },
                {ID: 3, Name: "指定驾驶员、车辆中" },
                {ID: 4, Name: "正在前往始发地" },
                {ID: 5, Name: "提货中" },
                {ID: 6, Name: "准备离厂" },
                {ID: 7, Name: "送货中" },
                {ID: 8, Name: "已签收" },
                {ID: 9, Name: "已核算" },
            ],
            rqsgList: [                                           //日期间隔下拉列表数据
                { label: '今天', value: 0 },
                { label: '近两天', value: 1 },
@@ -334,11 +486,14 @@
            title: "",                                            // 弹出层标题
            open: false,                                          // 是否显示弹出层
            loading: true,                                        // 遮罩层
            rowList: [],                                          // 选中行数据集合
            activeSeach: '',
            // addBtnShow: false,                                    //编辑组件容器显示标记
            editShow: false,                                      //编辑组件容器显示标记
            openEdit: false,                                      //编辑组件显示标记
            pushShow: false,
            openPush: false,
            pushData: '',
            openPrintList: false,                                 //打印组件容器显示标记
            printListShow: false,                                 //打印组件显示标记
            openBtnHide: false,                                   //按钮组件容器显示标记
@@ -348,13 +503,46 @@
            barCodeDetailShow: false,                             //条码明细组件容器显示标记
            packStockDetailShow: false,                            //包装容器出入库明细容器显示标记
            openVolume: false,                                    //维护零单占用体积弹窗标记
            openData: false,                                                           //数据弹窗
            openCarDriver: false,                                                      //分配车辆和司机弹窗标记
            carDriverForm: {                                                           //分配车辆和司机表单
                CarHNumber: '',
                CarHName: '',
                DriverHName: '',
                DriverHIDCard: ''
            },
            carDriverRules: {                                                          //分配车辆和司机表单验证
                CarHNumber: [{ required: true, message: '请输入车牌号', trigger: 'blur' }],
                CarHName: [{ required: true, message: '请输入车辆名称', trigger: 'blur' }],
                DriverHName: [{ required: true, message: '请输入驾驶员', trigger: 'blur' }],
                DriverHIDCard: [{ required: true, message: '请输入身份证号', trigger: 'blur' }],
            },
            openFileUpload: false,                                                     //附件上传弹窗标记
            fileUploadForm: {                                                          //附件上传表单
                billNo: '',
                hInterID: 0
            },
            fileList: [],                                                              //待上传文件列表
            uploadFiles: [],                                                           //待上传文件数据
            fileUploadLoading: false,                                                  //上传加载状态
            uploadedFileList: [],                                                      //已上传文件列表
            openBatchDownload: false,                                                  //批量下载弹窗标记
            batchFileList: [],                                                         //批量下载文件列表
            selectedBatchFiles: [],                                                    //选中的批量下载文件
            batchDownloadLoading: false,                                               //批量下载加载状态
            selectedBillCount: 0,                                                      //选中的单据数量
            dialogTypeNum: null,                                                       //部门弹窗1,仓库弹窗2
            gyCarShow: false,                                                          //车辆数据组件显示标记
            gyDriverShow: false,                                                       //司机数据组件显示标记
            deptform: {},                                                              //弹窗选中数据
            // 查询参数
            sWhere: '',                                                   // 拼接过滤条件
            queryParams: {                                                // form数据
                HBillNo: '',
                HPlateNumber: '',
                HInitTimeCycle: 29,
                HSourceBillNo:'',
                HBillStatus:'',
                sTime: '',
                eTime: '',
                HOrgID: sessionStorage["OrganizationID"] - 0,
@@ -371,7 +559,14 @@
                ColContent2: '',
                ColContent: '',
            },
            loading: true,
            tyResList: [],//列表(接口数据)
            btList: [],//表头列表显示
            btResList: [],
            tableData: [],//列表(分页显示)
            dataList: [],
            titleData: [],//不需要显示的字段 可扩展
            pageSizes: [ 50,100, 500, 5000, 50000],
            page: 1,                                                      //page页索引
            pageSize: 0,                                                  //page页面记录数
            total: 0,                                                     //记录合计数
@@ -379,6 +574,7 @@
            totalNameList: [],                                            // 需要设置合计行的列数组
            tableData: [],                                                // 列表数据。用于table监听事件
            ids: [],                                                      // 选中行的hmainid数组
            printIds: '',                                                   //打印选择Id字段
            single: true,                                                 // 当选中的行数不为1时为true。用于禁用相关操作
            multiple: true,                                               // 当选中的行数为0时为true。用于禁用相关操作
            lastSelectedRowIndex: null,                                   // 用于记录上次点击的行索引
@@ -399,6 +595,7 @@
    },
    methods: {
        //#region 设置表头
        renderHeader(h, { column, $index }) {// 新建一个 span
            let span = document.createElement(span)// 设置表头名称
@@ -437,6 +634,7 @@
        //#region 多选框选中数据
        handleSelectionChange(selection) {
            // this.rowForm = {}
            this.rowList = selection
            this.ids = selection.map(item => item.HInterID)
            this.single = selection.length != 1
            this.multiple = !selection.length
@@ -486,10 +684,29 @@
            this.handleQuery()
        },
        //#endregion
        //#region 权限判断
        async set_ModCheck(ModRightNameCheck) {
            var Permission = false;
            const res = await axios.get(this.$baseUrl + '/LMES/getReportByModRightNameCheck', {
                params: {
                    "ModRightNameCheck": ModRightNameCheck,
                    "user": sessionStorage["HUserName"],
                },
            }).then(result => {
                if (result.data.count != 1) {
                    Permission = true;
                    this.sWhere = this.sWhere + " and 承运商ID =" + sessionStorage["HSupID"]
                }
            }).catch(error => {
                this.$modal.msgError("接口请求失败!");
            });
        },
        //#endregion
        //#region 快速过滤
        handleQuery() {
        async handleQuery() {
            this.sWhere = ''
            await this.set_ModCheck("WLYayBill_SUPQuery")
            if (this.queryParams.ColName && this.queryParams.Comparator) {
                var com = "";
                switch (this.queryParams.Comparator) {
@@ -561,35 +778,48 @@
            if (this.queryParams.HBillNo) {
                this.sWhere += " and 单据号 like '%" + this.queryParams.HBillNo + "%'";
            }
            if (this.queryParams.HPlateNumber) {
                this.sWhere += " and 车牌号 like '%" + this.queryParams.HPlateNumber + "%'";
            }
            if (this.queryParams.HSourceBillNo) {
                this.sWhere += " and 发货通知单号 like '%" + this.queryParams.HSourceBillNo + "%'";
            }
            if (this.queryParams.HBillStatus) {
                this.sWhere += " and 物流状态 like '%" + this.queryParams.HBillStatus + "%'";
            }
            // if (this.queryParams.HOrgID) {
            //     this.sWhere += " and HOrgID = '" + this.queryParams.HOrgID + "'";
            // }
            console.log("swhere", this.sWhere)
            this.clearData()
            this.getList()
        },
        //#endregion
        //#region 查询
        getList() {
            this.pageSize = 50
            if (this.pageSize == 0) {
                this.pageSize = 50
            }
            this.tableShow = false
            this.loading = true
            console.log("swhere", this.sWhere)
            // 列表查询
            axios.get(this.baseURL + '/WLYayBillController/GetListPage', {
            axios.get(this.$baseUrl + '/WLYayBillController/page', {
                params: {
                    "sWhere": this.sWhere,
                    "user": sessionStorage["HUserName"],
                    "page": this.page,
                    "size": this.pageSize
                    "size": this.pageSize,
                    "Type":3321
                },
            }).then(response => {
                this.tyResList = response.data.data//总数据
                let data1 = response.data
                let option = []
                if (data1.code == 1) {
                if (data1.list && data1.list.length > 0) {
                    this.btResList = data1.list             //列表表头数据
                    this.total = data1.count;
                    var data = [];//列字段数据
@@ -681,7 +911,7 @@
        //#region 删除
        handleDelete() {
            this.$modal.confirm('确认要删除吗,删除后不能恢复').then(() => {
                axios.get(this.baseURL + "/WLYayBillController/deleteBill", {
                axios.get(this.$baseUrl + "/WLYayBillController/deleteBill", {
                    params: { 'HItemID': this.rowForm.HInterID.toString(), 'user': sessionStorage["HUserName"] }
                }).then(response => {
                    if (response.data.count == 1) {
@@ -708,7 +938,7 @@
            }
            this.$modal.confirm(confirmMes).then(() => {
                axios.get(this.baseURL + "/WLYayBillController/ConfrimBillNo", {
                axios.get(this.$baseUrl + "/WLYayBillController/ConfrimBillNo", {
                    params: { 'HInterID': this.rowForm.HInterID.toString(), "IsAudit": 0, 'CurUserName': sessionStorage["HUserName"] }
                }).then(response => {
                    let result = response.data
@@ -744,7 +974,7 @@
                confirmMes = "是否确认承运商确认时间?"
            }
            this.$modal.confirm(confirmMes).then(() => {
                axios.get(this.baseURL + "/WLYayBillController/ConfrimOtherBillNo", {
                axios.get(this.$baseUrl + "/WLYayBillController/ConfrimOtherBillNo", {
                    params: { 'HInterID': this.rowForm.HInterID.toString(), "IsAudit": nums, 'CurUserName': sessionStorage["HUserName"] }
                }).then(response => {
                    let result = response.data
@@ -768,6 +998,7 @@
                HInterID: 0,
                HEntryID0: 0,
                currentVolume: 0,
                单据号: ''
            }
        },
@@ -775,23 +1006,39 @@
        //#region 维护零单占用体积重置
        handleVolume(form) {
            this.resetVolume()
            axios.get(this.baseURL + "/WLYayBillController/WL_YayBillDetail", {
            axios.get(this.$baseUrl + "/WLYayBillController/WL_YayBillDetail", {
                params: { 'HID': form.HInterID }
            }).then(response => {
                console.log(response.data.data.h_v_WL_YayBillEdit)
                // this.formVolume = response.data.data.h_v_WL_YayBillEdit[form.HEntryID-1]
                this.formVolume=form
                this.formVolume = form
                this.openVolume = true
            })
        },
        //#endregion
        //#region 下推运单费用
        SelectPayWayBill() {
            this.editShow = true
            this.openEdit = true
            this.OperationType = 4
        },
        //关闭下推页面
        pushClose(val) {
            this.open = val
            this.pushShow = false
            this.openPush = val
            this.clearData()
            this.getList()
        },
        //#endregion
        cancelVolume() {
            this.openVolume = false
            this.resetVolume()
            this.handleQuery()
        },
        //#region 维护零单占用体积提交
        set_HScatteredVolumeList() {
            axios.get(this.baseURL + "/WLYayBillController/updateBillMEs", {
            axios.get(this.$baseUrl + "/WLYayBillController/updateBillMEs", {
                params: {
                    'HInterID': this.formVolume.HInterID.toString(),
                    "HEntryID": this.formVolume.HEntryID.toString(),
@@ -802,7 +1049,7 @@
                let result = response.data
                if (result.count == 1) {
                    this.handleQuery()
                    this.openVolume = true
                    this.openVolume = true
                    this.$modal.msgSuccess(result.Message)
                } else {
                    this.$modal.msgError(result.code + result.Message);
@@ -818,7 +1065,7 @@
        set_CheckBill(num, form) {
            var InterID = form.hmainid || form.HInterID
            //逻辑审核方法
            axios.get(this.baseURL + "/WLYayBillController/AuditWLYayBill", {
            axios.get(this.$baseUrl + "/WLYayBillController/AuditWLYayBill", {
                params: { "HInterID": InterID, "IsAudit": num, "CurUserName": sessionStorage["HUserName"] }
            }).then(response => {
                let result = response.data
@@ -834,11 +1081,43 @@
            });
        },
        //#endregion
        //#region 打开下推组件弹窗
        handlePush() {
            if (this.rowList && this.rowList.length > 0) {
                var dataArray = [];
                for (var i = 0; i < this.rowList.length; i++) {
                    if (this.rowList[i].单据状态 != "已审核") {
                        this.$modal.msgError("下推失败!所选单据【" + this.rowList[i].单据号 + "】不为已审核状态,不允许下推!")
                        return;
                    }
                    if (this.rowList[i].HQtyMust <= 0) {
                        this.$modal.msgError("下推失败!所选单据【" + this.rowList[i].单据号 + "】对应可下推数量必须大于 0 !")
                        return;
                    }
                    var temp = {
                        "HInterID": this.rowList[i].HInterID
                        , "HEntryID": this.rowList[i].HEntryID
                        , "HBillStatus": this.rowList[i].单据状态
                    }
                    dataArray.push(temp);
                }
                var datajson = {
                    "data": dataArray
                };
                this.pushData = JSON.stringify(datajson)
                this.pushShow = true
                this.openPush = true
            } else {
                this.$modal.msgError("请选择数据下推!")
            }
        },
        //#endregion
        //#region 关闭/反关闭
        set_CloseBills(num) {
            var InterID = form.hmainid || form.HInterID
            //逻辑审核方法
            axios.get(this.baseURL + "/Cg_ContractTransportBillEdit/CloseCg_ContractTransportBillEdit", {
            axios.get(this.$baseUrl + "/Cg_ContractTransportBillEdit/CloseCg_ContractTransportBillEdit", {
                params: { "HInterID": InterID, "Type": num, "CurUserName": sessionStorage["HUserName"] }
            }).then(response => {
                let result = response.data
@@ -858,7 +1137,7 @@
        set_DropBill(num) {
            var InterID = form.hmainid || form.HInterID
            //逻辑审核方法
            axios.get(this.baseURL + "/Cg_ContractTransportBillEdit/DropCg_ContractTransportBillEdit", {
            axios.get(this.$baseUrl + "/Cg_ContractTransportBillEdit/DropCg_ContractTransportBillEdit", {
                params: { "HInterID": InterID, "Type": num, "CurUserName": sessionStorage["HUserName"] }
            }).then(response => {
                let result = response.data
@@ -887,7 +1166,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,
@@ -991,11 +1270,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
@@ -1034,29 +1313,13 @@
        //#region 打印
        get_PrintReport() {
            if (this.ids.length != 1) {
                this.$modal.msgError("请选择一行数据")
            } else if (this.rowForm.单据状态 != "已审核" && !this.defaintOperationByCompanyName()) {
                this.$modal.msgError("打印失败!原因:单据状态不为'已审核'状态!!");
            if (this.ids.length == 0) {
                this.$modal.msgError("请至少选择一行数据")
            } else {
                axios.get(this.baseURL + "/Kf_SellOutBill/CheckSellOutBill_IsExist", {
                    params: { "HInterID": this.rowForm.HInterID }
                }).then(response => {
                    var result = response.data
                    if (result.count == 1) {
                        this.printListShow = true
                        this.openPrintList = true
                        // this.$router.push({ path:'/printList', query: { linterid: this.rowForm.hmainid,MyMsg:this.rowForm.hmainid,Type:'Kf_SellOutBillList' }})
                    } else {
                        this.$modal.msgError(result.code + result.Message)
                    }
                }).catch(error => {
                    this.$modal.msgError("接口请求失败!");
                });
                this.printIds = this.ids.join(',')
                this.printListShow = true
                this.openPrintList = true
            }
            //  var content= ['../../BaseSet/SRM_OpenTmpList.html?linterid=' + data[0].hmainid.toString() + '&MyMsg=' + data[0].hmainid.toString() + '&Type=Kf_SellOutBillList', 'yes']
        },
        //#endregion
@@ -1092,6 +1355,8 @@
            this.tableShow = true
            this.openEdit = false
            this.editShow = false
            this.pushShow = false
            this.openPush = false
            this.handleQuery()
        },
        //#endregion
@@ -1099,7 +1364,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 == "水务") {
@@ -1112,6 +1377,388 @@
            return result;
        },
        //#endregion
        //#region 数据弹窗
        //#region 打开数据列表弹窗
        openDataDialog(num, row) {
            this.showReset()
            if (num == 14) {
                this.dialogTitle = '车辆列表'
                this.gyCarShow = true
                this.openData = true
            } else if (num == 15) {
                this.dialogTitle = '司机列表'
                this.gyDriverShow = true
                this.openData = true
            }
        },
        //#region 将数据弹窗全部取消加载
        showReset() {
            this.gyCarShow = false
            this.gyDriverShow = false
        },
        //#endregion
        //#endregion
        //#region 弹窗数据双击返回表单赋值事件
        async dbEmitData(deptRow, num) {
            let IsAudit = null
            if (num == 14) {
                IsAudit = 1
            } else if (num == 15) {
                IsAudit = 2
            }
            try {
                console.log(deptRow)
                const response = await axios.get(this.baseURL + '/WLYayBillController/selectDriver', {
                    params: {
                        "HInterID": this.rowForm.HInterID.toString(),
                        "HcheckID": deptRow.HItemID,
                        "IsAudit": IsAudit,
                        "CurUserName": sessionStorage["HUserName"]
                    },
                });
                if (response.data.code == 1) {
                    // return response.data.data[0];
                    if (num == 14) {
                        this.gyCarShow = false
                        this.openData = false
                        this.$modal.msgSuccess(response.data.msg || "车辆添加成功");
                        num = 15
                        this.$nextTick(() => {
                            this.gyDriverShow = true
                            this.openData = true
                        })
                    } else if (num == 15) {
                        this.gyDriverShow = false
                        this.openData = false
                        this.$modal.msgSuccess(response.data.msg || "司机添加成功");
                    }
                } else {
                    this.$modal.msgError(response.data.msg || "请先供应商确认");
                }
            } catch (error) {
                this.$modal.msgError("获取源单数据时发生错误,请稍后重试!");
            }
        },
        //#endregion
        //#region 弹窗数据单击事件
        emitData(deptRow, num) {
            this.dialogTypeNum = num
            this.deptform = deptRow
        },
        //#endregion
        //#region 弹窗确定事件
        deptClickSub() {
            this.dbEmitData(this.deptform, this.dialogTypeNum)
            this.deptform = {}
        },
        //#endregion
        //#region 弹窗取消事件
        deptClose() {
            this.deptform = {}
            this.openData = false
        },
        //#endregion
        //#endregion
        //#region 分配车辆和司机
        hanleCarOrDriver(form) {
            this.carDriverForm = {
                CarHNumber: '',
                CarHName: '',
                DriverHName: '',
                DriverHIDCard: ''
            }
            this.openCarDriver = true
        },
        submitCarDriver() {
            this.$refs.carDriverForm.validate((valid) => {
                if (valid) {
                    axios({
                        method: 'GET',
                        url: this.baseURL + "WLYayBillController/selectDriver1",
                        params: {
                            "CarHNumber": this.carDriverForm.CarHNumber,
                            "CarHName": this.carDriverForm.CarHName,
                            "DriverHName": this.carDriverForm.DriverHName,
                            "DriverHIDCard": this.carDriverForm.DriverHIDCard,
                            "CurUserName": sessionStorage["HUserName"],
                            "HInterID": this.rowForm.HInterID
                        },
                    }).then(response => {
                        let result = response.data
                        if (result.code == 1) {
                            this.$modal.msgSuccess(result.Message || "分配成功");
                            this.openCarDriver = false
                            this.handleQuery()
                        } else {
                            this.$modal.msgError(result.code + result.Message);
                        }
                    }).catch(error => {
                        console.log(error)
                        this.$modal.msgError("接口请求失败!");
                    });
                }
            })
        },
        //#endregion
        //#region 附件上传
        handleFileUpload() {
            this.fileUploadForm = {
                billNo: this.rowForm.单据号,
                hInterID: this.rowForm.HInterID
            }
            this.fileList = []
            this.uploadFiles = []
            this.uploadedFileList = []
            // this.getUploadedFileList()
            this.openFileUpload = true
        },
        handleFileChange(file, fileList) {
            console.log(file, fileList)
            // this.uploadFiles = fileList
        },
        handleFileRemove(file, fileList) {
            console.log(file, fileList)
            this.uploadFiles = fileList
        },
        handleFileSuccess(response, file, fileList){
                       console.log(response, file, fileList)
        },
          handleFileError(response, file, fileList){
            console.log(response, file, fileList)
        },
        handleFilePreview(file) {
            if (file.url) {
                window.open(file.url, '_blank')
            } else if (file.raw) {
                const url = URL.createObjectURL(file.raw)
                window.open(url, '_blank')
            } else {
                this.$modal.msgWarning('无法预览该文件')
            }
        },
        handleFileExceed(files, fileList) {
            this.$modal.msgWarning(`当前限制选择 10 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`)
        },
        submitFileUpload() {
            if (this.uploadFiles.length === 0) {
                this.$modal.msgWarning('请先选择要上传的文件')
                return
            }
            console.log(this.uploadFiles)
            this.fileUploadLoading = true
            const formData = new FormData()
            this.uploadFiles.forEach(file => {
                formData.append('files', file.raw)
            })
            // formData.append('HBillNo', this.fileUploadForm.billNo)
            formData.append('HInterID', this.fileUploadForm.hInterID)
            formData.append('HUserName', sessionStorage["HUserName"] || '')
            // axios.get(this.$baseUrl + '/WLYayBillController/saveFileAddress', formData, {
            //     headers: {
            //         'Content-Type': 'multipart/form-data'
            //     },
            //     params:{
            //         HInterID:this.fileUploadForm.hInterID,
            //         HFileAddress:this.fileUploadPath + '/' + this.uploadFiles[0].name,
            //         CurUserName:sessionStorage["HUserName"]
            //     }
            // })
            axios('', {
                headers: {
                    'Content-Type': 'multipart/form-data'
                },
                methods: 'post',
                data: formData
            }).then(response => {
                console.log(response)
                this.fileUploadLoading = false
                if (response.data.code == 1) {
                    this.$modal.msgSuccess(response.data.Message || '文件上传成功')
                    this.fileList = []
                    this.uploadFiles = []
                    this.getUploadedFileList()
                } else {
                    this.$modal.msgError(response.data.code + response.data.Message || '上传失败')
                }
            }).catch(error => {
                this.fileUploadLoading = false
                this.$modal.msgError('上传请求失败')
                console.error('上传错误:', error)
            })
        },
        getUploadedFileList() {
            axios.get(this.$baseUrl + '/WLYayBillController/GetFileList', {
                params: {
                    HInterID: this.fileUploadForm.hInterID
                }
            }).then(response => {
                if (response.data.code == 1) {
                    this.uploadedFileList = response.data.data || []
                }
            }).catch(error => {
                console.error('获取文件列表失败:', error)
            })
        },
        downloadFile(row) {
            if (row.url) {
                window.open(row.url, '_blank')
            } else {
                axios.get(this.$baseUrl + '/WLYayBillController/DownloadFile', {
                    params: {
                        fileId: row.id || row.fileId
                    },
                    responseType: 'blob'
                }).then(response => {
                    const blob = new Blob([response.data])
                    const url = window.URL.createObjectURL(blob)
                    const link = document.createElement('a')
                    link.href = url
                    link.download = row.name || row.fileName
                    link.click()
                    window.URL.revokeObjectURL(url)
                }).catch(error => {
                    this.$modal.msgError('下载失败')
                    console.error('下载错误:', error)
                })
            }
        },
        deleteUploadedFile(row, index) {
            this.$modal.confirm('确认要删除该文件吗?').then(() => {
                axios.get(this.$baseUrl + '/WLYayBillController/DeleteFile', {
                    params: {
                        fileId: row.id || row.fileId,
                        HInterID: this.fileUploadForm.hInterID,
                        HUserName: sessionStorage["HUserName"]
                    }
                }).then(response => {
                    if (response.data.code == 1) {
                        this.$modal.msgSuccess('删除成功')
                        this.uploadedFileList.splice(index, 1)
                    } else {
                        this.$modal.msgError(response.data.Message || '删除失败')
                    }
                }).catch(error => {
                    this.$modal.msgError('删除请求失败')
                    console.error('删除错误:', error)
                })
            }).catch(() => { })
        },
        //#endregion
        //#region 附件批量下载
        handleBatchFileDownload() {
            if (this.rowList.length === 0) {
                this.$modal.msgWarning('请先选择要下载附件的单据')
                return
            }
            this.selectedBillCount = this.rowList.length
            this.batchFileList = []
            this.selectedBatchFiles = []
            this.getBatchFileList()
            this.openBatchDownload = true
        },
        getBatchFileList() {
            this.batchDownloadLoading = true
            const interIds = this.rowList.map(item => item.HInterID).join(',')
            axios.get(this.$baseUrl + '/WLYayBillController/GetBatchFileList', {
                params: {
                    HInterIDs: interIds
                }
            }).then(response => {
                this.batchDownloadLoading = false
                if (response.data.code == 1) {
                    this.batchFileList = response.data.data || []
                } else {
                    this.$modal.msgError(response.data.Message || '获取文件列表失败')
                }
            }).catch(error => {
                this.batchDownloadLoading = false
                this.$modal.msgError('获取文件列表失败')
                console.error('获取文件列表错误:', error)
            })
        },
        handleBatchFileSelectionChange(selection) {
            this.selectedBatchFiles = selection
        },
        downloadSingleFile(row) {
            if (row.url) {
                window.open(row.url, '_blank')
            } else {
                axios.get(this.$baseUrl + '/WLYayBillController/DownloadFile', {
                    params: {
                        fileId: row.id || row.fileId
                    },
                    responseType: 'blob'
                }).then(response => {
                    const blob = new Blob([response.data])
                    const url = window.URL.createObjectURL(blob)
                    const link = document.createElement('a')
                    link.href = url
                    link.download = row.name || row.fileName
                    link.click()
                    window.URL.revokeObjectURL(url)
                }).catch(error => {
                    this.$modal.msgError('下载失败')
                    console.error('下载错误:', error)
                })
            }
        },
        batchDownloadFiles() {
            if (this.selectedBatchFiles.length === 0) {
                this.$modal.msgWarning('请先选择要下载的文件')
                return
            }
            this.downloadFiles(this.selectedBatchFiles)
        },
        downloadAllFiles() {
            if (this.batchFileList.length === 0) {
                this.$modal.msgWarning('没有可下载的文件')
                return
            }
            this.downloadFiles(this.batchFileList)
        },
        downloadFiles(fileList) {
            this.batchDownloadLoading = true
            const fileIds = fileList.map(item => item.id || item.fileId).join(',')
            axios.get(this.$baseUrl + '/WLYayBillController/BatchDownloadFiles', {
                params: {
                    fileIds: fileIds
                },
                responseType: 'blob'
            }).then(response => {
                this.batchDownloadLoading = false
                const blob = new Blob([response.data], { type: 'application/zip' })
                const url = window.URL.createObjectURL(blob)
                const link = document.createElement('a')
                link.href = url
                const now = new Date()
                const timestamp = `${now.getFullYear()}${(now.getMonth() + 1).toString().padStart(2, '0')}${now.getDate().toString().padStart(2, '0')}_${now.getHours().toString().padStart(2, '0')}${now.getMinutes().toString().padStart(2, '0')}${now.getSeconds().toString().padStart(2, '0')}`
                link.download = `附件下载_${timestamp}.zip`
                link.click()
                window.URL.revokeObjectURL(url)
                this.$modal.msgSuccess('下载成功')
            }).catch(error => {
                this.batchDownloadLoading = false
                this.$modal.msgError('批量下载失败')
                console.error('批量下载错误:', error)
            })
        },
        //#endregion
        //清除选中数据的缓存
        clearData() {
            this.ids = []
            this.multiple = true
            this.single = true
            this.OperationType = 0
            this.copyType = 0
        },
    }
};
</script>