chenhaozhe
2026-01-04 08132eb6a645b4a42205d142feb14c9118a4a16a
components/BillListPopup/BillListPopup.vue
@@ -10,6 +10,11 @@
                    <view class="title"><text>物料: </text></view>
                    <view class="right"><input type="text" :focus="enablefocus" v-model="HMater"
                            @confirm="getBillList" /></view>
               <view class="icon-wrapper-big">
                   <uni-icons class="right-icon"
                  :class="'enable-icon-button'"
                  type="scan" size="20" @click="toScanCode"></uni-icons>
               </view>
                </view>
                <view class="search-condition">
                    <view class="title"><text>关联项: </text></view>
@@ -25,31 +30,35 @@
                    <view class="options-wrapper" v-show="HBillList.length != 0">
                        <uni-card :is-active="bill.isActive" :class="bill.isActive?'uni-card--is-active':''"
                            v-for="(bill, index) in HBillList[curPage-1]" :key="index" :title="bill['物料名称']"
                            :extra="`数量: ${bill['数量']}`" @tap="clickCard(bill['HSourceInterID'], bill['单据号'], index)">
                            <view class="item">
                                <view class="left">单据号: </view>
                                <view class="right">{{bill['单据号']}}</view>
                            :extra="`数量: ${bill['数量']}`"
                            @tap="clickCard(bill['HSourceInterID'], bill['单据号'], index, bill['HSourceEntryID'],bill)">
                            <view class="item" v-for="(field, index) in HFieldList" :key="index">
                                <view class="left">{{ field.ColmCols}}: </view>
                                <view class="right" v-if="field.ColmType == 'DateTime'">{{
                                    dayjs(bill[field.ColmCols]).format("YYYY-MM-DD")
                                }}</view>
                                <view class="right" v-else>{{bill[field.ColmCols]}}</view>
                            </view>
                            <view class="item">
                            <!-- <view class="item">
                                <view class="left">物料代码: </view>
                                <view class="right">{{bill['物料代码']}}</view>
                            </view>
                            </view> -->
                            <!-- <view class="item">
                        <view class="left">物料名称: </view>
                        <view class="right">{{}}</view>
                     </view> -->
                            <view class="item">
                            <!-- <view class="item">
                                <view class="left">规格型号: </view>
                                <view class="right">{{bill['规格型号']}}</view>
                            </view>
                            <view class="item" v-if="bill['生产任务单号']">
                            </view> -->
                            <!-- <view class="item" v-if="bill['生产任务单号']">
                                <view class="left">生产订单号: </view>
                                <view class="right">{{bill['生产任务单号']}}</view>
                            </view>
                     <view class="item" v-if="bill['款号']">
                            </view> -->
                            <!-- <view class="item" v-if="bill['款号']">
                         <view class="left">款号: </view>
                         <view class="right">{{bill['款号']}}</view>
                     </view>
                     </view> -->
                        </uni-card>
                    </view>
                    <view class="over" v-show="HBillList.length == 0">暂无数据</view>
@@ -66,10 +75,15 @@
    import {
        CommonUtils
    } from '../../utils/common';
    import dayjs from 'dayjs';
   import {
       MpaasScan
   } from "../../utils/mpaasScan";
    export default {
        name: "BillListPopup",
        data() {
            return {
                dayjs,
                enablefocus: false,
                size: 20,
                curPage: 1,
@@ -79,6 +93,7 @@
                HMater: '',
                HCustom: '',
                HBillList: [],
                HFieldList: [], // 表单对应字段
                panelHeight: 0,
                multiSouceBillList: []
@@ -101,13 +116,22 @@
                type: Boolean,
                default: false,
                required: false
            }
            },
        },
        model: {
            prop: "HSourceBill",
            event: 'change'
        },
        methods: {
         //扫码
         toScanCode() {
             MpaasScan.scanCode((res) => {
                 if (res) {
                  this.HMater = res;
                     this.getBillList();
                 }
             });
         },
            popupChangeHandler(e) {
                if (e.show === true) {
                    this.getBillList()
@@ -143,12 +167,23 @@
            showPopup() {
                this.$refs.popup.open();
            },
            clickCard(interid, billno, index) {
            clickCard(interid, billno, index, entryid,bill=[]) {
                if (this.MultiSourceBill == false) { // 非多源单模式
                    // 总线方式传递数据 (可跨组件传递)
                    uni.$emit('BillSelectComplete', {
                        HInterID: interid,
                        HBillNo: billno,
                        enableMultiSourceBill: this.MultiSourceBill
                        enableMultiSourceBill: this.MultiSourceBill,
                        HEntryID: entryid || 0
                    })
                    // 父子组件之间传递数据
                    this.$emit("BillSelectComplete", {
                        HInterID: interid,
                        HBillNo: billno,
                        enableMultiSourceBill: this.MultiSourceBill,
                        HEntryID: entryid || 0,
                  billInfo:bill
                    })
                } else {
                    this.$set(this.HBillList[this.curPage - 1][index], 'isActive', !this.HBillList[this.curPage - 1][
@@ -178,7 +213,7 @@
                        // 如果对应单据传入的是否激活数是false,则计数器-1
                        this.multiSouceBillList[index]['count']--;
                    }
                    if(this.multiSouceBillList[index]['count'] == 0){
                    if (this.multiSouceBillList[index]['count'] == 0) {
                        // 没有选中的单据,则移除缓存中的数据
                        this.multiSouceBillList.splice(index, 1)
                    }
@@ -190,30 +225,46 @@
                this.length = 0
                this.page = 0
                this.curPage = 1
            console.log("1",this.HBillType)
            console.log("2",this.HSourceBillType)
            console.log("3",this.HStockOrgID)
            console.log("4",this.HSourceBillNo)
            console.log("5",this.HMater)
            console.log("6",this.HCustom)
                console.log("1", this.HBillType)
                console.log("2", this.HSourceBillType)
                console.log("3", this.HStockOrgID)
                console.log("4", this.HSourceBillNo)
                console.log("5", this.HMater)
                console.log("6", this.HCustom)
                CommonUtils.doRequest(
                    "/WEBSController/GetSourceBillList_Json", {
                        HBilltype: this.HBillType,
                        HSourceBillType: this.HSourceBillType,
                        HStockOrgID: this.HStockOrgID,
                        HSourceBillNo: this.HSourceBillNo || "",
                        HMater: this.HMater || "",
                        HCustom: this.HCustom || ""
                        HSourceBillNo: this.HSourceBillNo || '',
                        HMater: this.HMater || '',
                        HCustom: this.HCustom || ''
                    },
                    (res) => {
                        let {
                            data,
                            count,
                            Message
                            Message,
                            list
                        } = res.data
                        if (count == 1) {
                            this.length = Array.from(data).length
                            const result = [];
                            let fieldList = CommonUtils.fieldListFilterRole({
                                ExcludeKeys: ['物料名称', '数量'],
                                FieldList: list
                            })
                            if (fieldList.status == false) {
                                CommonUtils.showTips({
                                    title: '温馨提示',
                                    message: `获取表单结构失败: ${fieldList.Message}`
                                })
                            }
                            this.HFieldList = fieldList.data
                            for (let i = 0; i < data.length; i += this.size) {
                                result.push(data.slice(i, i + this.size));
                            }
@@ -313,4 +364,10 @@
            background-color: rgba(0, 122, 255, 0.2);
        }
    }
   .enable-icon-button {
       background-color: #3a78ff;
       padding: 6rpx;
       color: #fff;
       border-radius: 100%;
   }
</style>