xwt
2025-06-03 e1669bfd21fb445d3cd755290d28c900c5a3a831
搜索框添加物料规格,增加批量NG
已修改3个文件
181 ■■■■ 文件已修改
pages/QC/LLJ/List.vue 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/QC/LLJ/detail.vue 173 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
store/index.js 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/QC/LLJ/List.vue
@@ -121,7 +121,7 @@
                pageIndex: 1,
                limit: 20,
                IQCJL: 0,
                options: ['项目', '物料编号', '物料名称', '供应商', '采购员','到货单号','检验单号'],
                options: ['项目', '物料编号', '物料名称', '供应商', '采购员','到货单号','检验单号','物料规格'],
                searchValue: ''
            }
@@ -143,6 +143,7 @@
                    4: 'purchaser' ,// 采购员
                    5: 'lotNO' ,// 到货单号
                    6: 'releaseNO' ,// 检验单号
                    7: 'ItemModel',//物料规格
                };
                this.selectedField = fieldMap[this.optionsIndex];
            },
pages/QC/LLJ/detail.vue
@@ -108,6 +108,17 @@
            <view class="section">
                <view class="section-header">检验结果录入</view>
                <view class="section-body">
                    <view class="input-group" v-if="tableData.length >= formData.checkQyt">
                        <view class="input-wrapper">
                            <input v-model="batchInput" type="text" class="result-input"
                                placeholder="格式:OK-3 或 NG-3(请勿修改结果为数字的值)" placeholder-class="placeholder"
                                @input="validateBatchInput" @blur="validateBatchInput" />
                            <button :disabled="!isBatchInputValid" :class="{ 'btn-disabled': !isBatchInputValid }"
                                style="margin: 0px;background-color: #3498db;color:#ffffff ;" class="btn primary-btn"
                                @tap="batchUpdateResults">批量修改</button>
                        </view>
                        <view v-if="batchInputError" class="error-message">{{ batchInputError }}</view>
                    </view>
                    <view class="input-group input1">
                        <view class="input-wrapper">
@@ -127,10 +138,10 @@
                                @tap="saveResult">保存结果</button>
                        </view>
                    </view>
                    <view class="input-group input2">
                        <view class="input-wrapper">
                            <button class="btn upload-btn" @tap="chooseImage">
                                <uni-icons type="upload" size="16" color="#fff"></uni-icons>
                                上传/查看图片
@@ -141,7 +152,7 @@
                            </button>
                        </view>
                        <view class="input-wrapper" style="margin-top: 15px;">
                            <input v-if="(tableData.length < formData.checkQyt)" @input="search($event)"
                                v-model="inputTxt" type="text" class="result-input" placeholder="请输入检验结果..."
                                placeholder-class="placeholder" />
@@ -157,7 +168,8 @@
            <view v-if="tableData.length>0" class="table-container">
                <view class="table-header">
                    <view class="th">编号</view>
                    <view class="th">检验结果<i style="color: rgb(0 212 68);" v-if="!(tableData.length < formData.checkQyt)">(输入已完成)</i></view>
                    <view class="th">检验结果<i style="color: rgb(0 212 68);"
                            v-if="!(tableData.length < formData.checkQyt)">(输入已完成)</i></view>
                    <view class="th" v-if="current">操作</view>
                </view>
@@ -168,7 +180,7 @@
                            {{ item.fcheckResu }}
                        </view>
                    </view>
                    <view class="td" v-if="current" >
                    <view class="td" v-if="current">
                        <button v-if="!isNumber" class="btn danger-btn" @tap="toggleResult(item)">
                            {{ editResult(item.fcheckResu) }}
                        </button>
@@ -228,16 +240,95 @@
                showPopup: false,
                editData: {},
                inputTxt: '',
                formID:'',
                releaseNo:'',
                current:false
                formID: '',
                releaseNo: '',
                current: false,
                batchInput: '',
                batchInputError: '',
                isBatchInputValid: false
            }
        },
        methods: {
            switchTab(index,mainIds) {
            switchTab(index, mainIds) {
                this.currentTab = index
                this.mainId = mainIds;
                this.refreshResult();
            },
            validateBatchInput() {
                const input = this.batchInput.trim();
                if (!input) {
                    this.batchInputError = '';
                    this.isBatchInputValid = false;
                    return;
                }
                // 验证格式:OK-数字 或 NG-数字
                const match = input.match(/^(OK|NG)-(\d+)$/);
                if (!match) {
                    this.batchInputError = '格式错误,请输入:OK-数字 或 NG-数字';
                    this.isBatchInputValid = false;
                    return;
                }
                const count = parseInt(match[2]);
                if (count <= 0 || count > this.tableData.length) {
                    this.batchInputError = `数量必须在 1-${this.tableData.length} 之间`;
                    this.isBatchInputValid = false;
                    return;
                }
                this.batchInputError = '';
                this.isBatchInputValid = true;
            },
            // 批量更新检验结果
            batchUpdateResults() {
                if (!this.isBatchInputValid) return;
                const [status, countStr] = this.batchInput.split('-');
                const count = parseInt(countStr);
                if (this.tableData.length > 0) {
                    const firstItem = this.tableData[0];
                    const isNumber = /^-?\d+(\.\d+)?$/.test(firstItem.fcheckResu);
                    if (isNumber) {
                        this.$showMessage("不能批量修改数字类型的结果");
                        return;
                    }
                }
                let updatedCount = 0;
                const requests = [];
                for (let i = 0; i < count; i++) {
                    const item = this.tableData[i];
                    const fstand = status === 'OK' ? '√' : '×';
                    const fcheckResu = status;
                    requests.push(this.$post({
                        url: "/LLJ/UpdateQSItemDetail",
                        data: {
                            id: item.id,
                            mainId: this.formData.id,
                            releaseNo: this.formData.releaseNo,
                            fstand: fstand,
                            fcheckResu: fcheckResu,
                            updateBy: this.$loginInfo.account,
                        }
                    }));
                }
                Promise.all(requests)
                    .then(() => {
                        this.$showMessage(`成功将前${count}个结果修改为${status}`);
                        this.batchInput = '';
                        this.batchInputError = '';
                        this.isBatchInputValid = false;
                        this.refreshResult(); // 刷新结果
                    })
                    .catch(error => {
                        this.$showMessage(`批量修改失败: ${error.message}`);
                    });
            },
            //检测输入框的输入,并给变量赋值
            search(event) {
@@ -359,7 +450,7 @@
                    //fupAllow  fdownAllow  standardValue
                    if (this.formData.fupAllow && this.formData.fdownAllow && this.formData.fstand) {
                        this.isNumber = true;
                    }else{
                    } else {
                        this.isNumber = false;
                    }
                })
@@ -475,10 +566,10 @@
            let params = options;
            this.mainId = params["mainId"];
            this.refreshResult();
            this.formID= params["formID"];
            this.releaseNo= params["releaseNo"];
            this.currentTab=parseInt(params["index"]);
            this.current=params["current"] === 'true' ? true : false;
            this.formID = params["formID"];
            this.releaseNo = params["releaseNo"];
            this.currentTab = parseInt(params["index"]);
            this.current = params["current"] === 'true' ? true : false;
            this.$post({
                url: "/LLJ/getJYItem",
                data: {
@@ -497,7 +588,7 @@
                        return 0;
                    }
                });
                 this.tabs = tableData;
                this.tabs = tableData;
                // if (this.tableData.length === 0) {
                //     this.isShowTable = true;
                // }
@@ -505,7 +596,12 @@
                    this.set(item, 'current', this.current);
                });
                console.log(this.tableData);
            })
            this.$nextTick(() => {
                this.validateBatchInput();
            });
        }
    }
</script>
@@ -745,20 +841,41 @@
        background-color: #3498db;
        color: white;
    }
 .input1{
            display: block;
 }
 .input2{
            display: none;
 }
    .input1 {
        display: block;
    }
    .input2 {
        display: none;
    }
    /* 响应式设计 */
    @media (max-width: 500px) {
       .input1{
           display: none;
       }
       .input2{
           display: block;
       }
        .input1 {
            display: none;
        }
        .input2 {
            display: block;
        }
    }
    .error-message {
        color: $danger-color;
        font-size: 12px;
        margin-top: 4px;
    }
    .input-group:first-child {
        .result-input {
            border-color: $primary-color;
            box-shadow: 0 0 0 2px rgba($primary-color, 0.2);
        }
    }
    .btn-disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }
</style>
store/index.js
@@ -10,9 +10,10 @@
            networkFlag:'内网', 
            serverURLInt:'http://192.168.11.251:10055',//服务器体检 10.0.1.104:10054
            serverURL:'http://localhost:10055',//本地调试地址
            // serverAPI:'http://localhost:5184/api',//当前正在使用的服务器,默认为外网  localhost
            serverAPI:'http://192.168.1.22:10054/api',//当前正在使用的服务器,默认为外网  10054为正式API
            //serverAPI:'http://localhost:5184/api',//当前正在使用的服务器,默认为外网  localhost
            //serverAPI:'http://192.168.1.22:10054/api',//当前正在使用的服务器,默认为外网  10054为正式API
            //serverAPI:'http://192.168.1.104:10055/api',//当前正在使用的服务器,默认为外网  10055为测试API
            serverAPI:'http://36.26.21.214:10054/api',
        }
    },
    mutations: {