xwt
2025-09-17 3164a6e650b74e8cfbe74ae010e1f60fd2e59ab0
SJ,XJ,RKJ
已修改4个文件
139 ■■■■ 文件已修改
pages/QC/RKJ/Add.vue 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/QC/SJ/Add.vue 105 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/QC/SJ/List.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
store/index.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/QC/RKJ/Add.vue
@@ -143,6 +143,7 @@
        <view class="action-buttons">
            <button v-if="isUpdate && !isShowTable && current" class="primary-btn" @click="getItem">生成检验单</button>
            <button v-if="!isUpdate && !isShowTable" class="secondary-btn" @click="toImage">图片管理</button>
            <button v-if="!isUpdate && !isShowTable" class="secondary-btn" @click="fetchItems">获取检验项目</button>
            <button v-if="!isUpdate && !isShowTable" class="secondary-btn" @click="saveRemarks">添加描述</button>
            <button v-if="!isUpdate && !isShowTable" class="secondary-btn" @click="showTablePopup = true">查看数据</button>
            <button v-if="!isUpdate && !isShowTable && current" class="primary-btn" @click="submitInspection">检验提交</button>
@@ -300,6 +301,35 @@
            this.initPopupTableData();
        },
        methods: {
            // 手动获取现有检验项目(调用 /RKJ/getItems)
            fetchItems() {
                if (!this.formData.id) {
                    this.$showMessage("请先生成或打开检验单");
                    return;
                }
                this.$post({
                    url: "/RKJ/getItems",
                    data: { pid: this.formData.id }
                }).then(res1 => {
                    let tableData = res1.data.tbBillList;
                    // 排序与 init 保持一致
                    tableData.sort((a, b) => {
                        if (a.result === '未完成' && b.result === '合格') {
                            return -1;
                        } else if (a.result === '合格' && b.result === '未完成') {
                            return 1;
                        } else {
                            return 0;
                        }
                    });
                    this.tableData = tableData;
                    this.isShowTable = this.tableData.length === 0;
                    // 为每一项添加 current 属性
                    this.tableData.forEach((item) => {
                        this.$set(item, 'current', this.current);
                    });
                });
            },
            // 获取合格项目数量
            getPassedCount() {
                return this.tableData.filter(item => item.result === '合格').length;
pages/QC/SJ/Add.vue
@@ -110,6 +110,8 @@
        <view class="action-buttons">
            <button class="action-btn primary" v-if="isUpdate && !isShowTable" @click="save">创建检验单并生成部分默认值</button>
            <button class="action-btn secondary" v-if="!isUpdate && !isShowTable" @click="toImage">上传/查看图片</button>
            <button class="action-btn secondary" v-if="!isUpdate && !isShowTable" @click="refreshItems">刷新检验项目</button>
            <button class="action-btn success" v-if="!isUpdate && !isShowTable" @click="submit">提交检验</button>
            <!-- <button class="action-btn danger" v-if="!isUpdate && !formData.statusUser && !isShowTable" @click="removeXJ">删除单据</button> -->
            <button class="action-btn secondary" v-if="!isUpdate && !isShowTable" @click="saveRemarks">添加不合格描述</button>
            <!-- <button class="action-btn success" v-if="!isUpdate && !isShowTable" @click="submit">审核单据</button> -->
@@ -218,6 +220,30 @@
            }
        },
        methods: {
            refreshItems() {
                if (!this.formData.id) {
                    this.$showMessage("请先保存检验单");
                    return;
                }
                this.$post({
                    url: "/SJ/GenUpdateSJ",
                    data: {
                        id: this.formData.id,
                        no: this.formData.billNo,
                        userNo: this.$loginInfo.account
                    }
                }).then(res => {
                    if (res.status === 0) {
                        this.$showMessage(res.message || "已刷新检验项目");
                        this.init();
                    } else {
                        this.$showMessage(res.message || "刷新失败");
                    }
                }).catch(err => {
                    console.error("刷新检验项目失败:", err);
                    this.$showMessage("刷新失败,请稍后重试");
                });
            },
            removeXJ() {
                if (this.formData.id) {
                    this.$post({
@@ -240,6 +266,17 @@
            },
            submit() {
                // 校验:所有检验项目必须完成
                const hasIncomplete = this.tableData && this.tableData.some(item => {
                    // 允许的完成条件:result 不为 '未完成' 且 已检次数达到要求
                    const resultIncomplete = item.result === '未完成';
                    const countIncomplete = (item.isCheck ?? 0) < (item.levelNum ?? 0);
                    return resultIncomplete || countIncomplete;
                });
                if (hasIncomplete) {
                    this.$showMessage("还有未完成的检验项目,无法提交");
                    return;
                }
                this.$post({
                    url: "/SJ/SJQaSubmit",
                    data: {
@@ -247,16 +284,15 @@
                        id: this.formData.id
                    }
                }).then(res => {
                    //2024-11-28 kyy 校验合格提交增加提示
                    console.log("Status Code的值:", res.statusCode);
                    if (res.statusCode === 200) {
                    // 按后端统一返回结构判断
                    if (res.status === 0) {
                        this.$showMessage("成功提交检验");
                        // 使用setTimeout在7秒后隐藏消息
                        setTimeout(() => {
                            this.hideCustomMessage();
                        }, 7000); // 7000毫秒等于7秒
                    } else {
                        this.$showMessage(res.data.message || "审核失败");
                        this.$showMessage(res.message || "审核失败");
                    }
                }).catch(error => {
                    console.error("审核提交失败:", error);
@@ -737,54 +773,65 @@
/* 按钮样式 */
.record-btn {
  padding: 6px 12px;
  background-color: #f8f9fa;
  border: 1px solid #ddd;
  padding: 8px 16px;
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 12px;
  transition: all 0.3s ease;
  font-weight: 500;
  font-size: 13px;
  box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3);
}
.record-btn:hover {
  background-color: #e9ecef;
  background: linear-gradient(135deg, #2980b9, #1f618d);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(52, 152, 219, 0.4);
}
.record-btn:active {
  transform: translateY(0);
}
/* 填写状态按钮 */
.record-btn-fill {
  background-color: #2ecc71;
  color: white;
  border-color: #27ae60;
  background: linear-gradient(135deg, #2ecc71, #27ae60);
  box-shadow: 0 2px 4px rgba(46, 204, 113, 0.3);
}
.record-btn-fill:hover {
  background-color: #27ae60;
  background: linear-gradient(135deg, #27ae60, #229954);
  box-shadow: 0 4px 8px rgba(46, 204, 113, 0.4);
}
/* 查看状态按钮 */
.record-btn-view {
  background-color: #95a5a6;
  color: white;
  border-color: #7f8c8d;
  background: linear-gradient(135deg, #95a5a6, #7f8c8d);
  box-shadow: 0 2px 4px rgba(149, 165, 166, 0.3);
}
.record-btn-view:hover {
  background-color: #7f8c8d;
  background: linear-gradient(135deg, #7f8c8d, #6c7b7d);
  box-shadow: 0 4px 8px rgba(149, 165, 166, 0.4);
}
/* 操作按钮区 */
.action-buttons {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 20px;
  margin-top: 20px;
}
.action-btn {
  padding: 12px 20px;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
  transition: all 0.3s;
}
.action-btn.primary {
@@ -797,12 +844,12 @@
}
.action-btn.secondary {
  background-color: #95a5a6;
  color: white;
  background-color: #ecf0f1;
  color: #7f8c8d;
}
.action-btn.secondary:hover {
  background-color: #7f8c8d;
  background-color: #d5dbdb;
}
.action-btn.danger {
@@ -815,12 +862,12 @@
}
.action-btn.success {
  background-color: #2ecc71;
  background: linear-gradient(135deg, #2ecc71, #27ae60);
  color: white;
}
.action-btn.success:hover {
  background-color: #27ae60;
  background: linear-gradient(135deg, #27ae60, #229954);
}
/* 弹出框样式 */
pages/QC/SJ/List.vue
@@ -34,7 +34,7 @@
          <view class="badge normal" v-if="item.isFirst == 1">首次</view>
          <view class="card-title">检验单号: {{item.billNo}}</view>
          <view class="status" :class="{'status-pending': current === 0, 'status-assigned': current === 0 && item.statusUser, 'status-pass': current === 1 && item.result === '合格', 'status-fail': current === 1 && item.result === '不合格'}">
            {{current === 0 ? (item.statusUser ? '已分配' : '未提交') : (item.result ? item.result : '已提交')}}
            {{current === 0 ? (item.statusUser ? '已分配' : '未提交') : (item.result ? item.result : '已完成')}}
          </view>
        </view>
store/index.js
@@ -16,7 +16,7 @@
    // },
    {
        name: '本地调试',
        url: 'http://localhost:10054/api'
        url: 'http://localhost:5184/api'
    },
    {
        name: '正式地址',