zhangwencui
7 小时以前 21e379a778415d5aa4d3c32e23c4348c30646f51
成品检
已添加1个文件
已修改4个文件
779 ■■■■ 文件已修改
src/api/qualityManagement/rawMaterialInspection.js 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/finalInspection/components/ratioDialog.vue 180 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/finalInspection/index.vue 570 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/processInspection/components/detailDialog.vue 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/processInspection/index.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/qualityManagement/rawMaterialInspection.js
@@ -71,3 +71,19 @@
        params: query,
    })
}
// æŸ¥è¯¢æˆå“æ£€æ£€åˆ—表
export function qualityInspectFinishedListPage(query) {
    return request({
        url: '/quality/qualityInspect/finishedPage',
        method: 'get',
        params: query,
    })
}
// æˆå“æ£€-查看标准投入产出比例
export function qualityInspectFinishedRatio(query) {
    return request({
        url: '/quality/qualityInspect/finishedRatio',
        method: 'get',
        params: query,
    })
}
src/views/qualityManagement/finalInspection/components/ratioDialog.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,180 @@
<template>
  <div>
    <el-dialog v-model="dialogVisible"
               title="标准投入产出比例"
               width="1000px"
               @close="closeDialog">
      <!-- <el-card class="detail-card">
        <template #header>
          <div class="card-header">
            <span>生产订单信息</span>
          </div>
        </template>
        <div class="detail-info">
          <div class="info-row">
            <div class="info-item">
              <span class="info-label">生产订单号:</span>
              <span class="info-value">{{ orderInfo.npsNo }}</span>
            </div>
            <div class="info-item">
              <span class="info-label">产品名称:</span>
              <span class="info-value">{{ orderInfo.productName }}</span>
            </div>
            <div class="info-item">
              <span class="info-label">规格:</span>
              <span class="info-value">{{ orderInfo.model }}</span>
            </div>
            <div class="info-item">
              <span class="info-label">产品类型:</span>
              <span class="info-value">{{ orderInfo.strength }}</span>
            </div>
          </div>
        </div>
      </el-card> -->
      <el-card class="detail-card"
               style="margin-top: 20px;">
        <template #header>
          <div class="card-header">
            <span>投入产出比例明细</span>
          </div>
        </template>
        <el-table :data="ratioData"
                  style="width: 100%">
          <el-table-column prop="materialCode"
                           label="产品编码"
                           width="120" />
          <el-table-column prop="productName"
                           label="产品名称"
                           width="150" />
          <el-table-column prop="model"
                           label="规格"
                           width="100" />
          <!-- <el-table-column prop="unit"
                           label="单位"
                           width="80" /> -->
          <el-table-column prop="actualInputQuantity"
                           label="实际投入量"
                           width="120">
            <template #default="scope">
              <span style="color: #409eff;">{{ scope.row.actualInputQuantity }}</span> {{ scope.row.unit }}
            </template>
          </el-table-column>
          <el-table-column prop="actualOutputQuantity"
                           label="实际产出量"
                           width="120">
            <template #default="scope">
              <span style="color: #409eff;">{{ scope.row.actualOutputQuantity }}</span> {{ scope.row.unit }}
            </template>
          </el-table-column>
          <el-table-column prop="standardInputOutputRatio"
                           label="标准投入产出比例"
                           width="150">
            <template #default="scope">
              <span style="color: #f68f00;">{{ scope.row.standardInputOutputRatio }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="deviationRate"
                           label="偏差率"
                           width="120">
            <template #default="scope">
              <span :style="{ color: scope.row.deviationRate >= 0 ? '#67c23a' : '#f56c6c' }">
                {{ scope.row.deviationRate >= 0 ? '+' : '' }}{{ scope.row.deviationRate.toFixed(2) }}%
              </span>
            </template>
          </el-table-column>
        </el-table>
      </el-card>
      <template #footer>
        <div class="dialog-footer">
          <el-button @click="closeDialog">关闭</el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>
<script setup>
  import { ref } from "vue";
  import { qualityInspectFinishedRatio } from "@/api/qualityManagement/rawMaterialInspection.js";
  const emit = defineEmits(["close"]);
  const dialogVisible = ref(false);
  const ratioData = ref([]);
  const orderInfo = ref({});
  const loading = ref(false);
  const openDialog = row => {
    dialogVisible.value = true;
    orderInfo.value = row;
    getRatioDetails(row);
  };
  const getRatioDetails = row => {
    loading.value = true;
    // æž„建请求参数
    const params = {
      productOrderId: row.productOrderId,
    };
    qualityInspectFinishedRatio(params)
      .then(res => {
        ratioData.value = res.data || [];
        loading.value = false;
      })
      .catch(err => {
        loading.value = false;
        console.error("获取标准投入产出比例失败:", err);
      });
  };
  const closeDialog = () => {
    dialogVisible.value = false;
    emit("close");
  };
  defineExpose({
    openDialog,
  });
</script>
<style scoped>
  .detail-card {
    margin-bottom: 20px;
  }
  .card-header {
    font-size: 16px;
    font-weight: bold;
    color: #333;
  }
  .detail-info {
    padding: 10px 0;
  }
  .info-row {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 10px;
  }
  .info-item {
    width: 25%;
    margin-bottom: 10px;
  }
  .info-label {
    display: inline-block;
    width: 120px;
    font-weight: bold;
    color: #666;
  }
  .info-value {
    color: #333;
  }
  .dialog-footer {
    text-align: center;
  }
</style>
src/views/qualityManagement/finalInspection/index.vue
@@ -2,396 +2,220 @@
  <div class="app-container">
    <div class="search_form">
      <div>
        <span class="search_title">产品名称:</span>
        <el-input
            v-model="searchForm.productName"
            style="width: 240px"
            placeholder="请输入产品名称搜索"
            @change="handleQuery"
            clearable
            :prefix-icon="Search"
        />
        <span  style="margin-left: 10px" class="search_title">检测日期:</span>
        <el-date-picker  v-model="searchForm.entryDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD" type="daterange"
                         placeholder="请选择" clearable @change="changeDaterange" />
        <el-button type="primary" @click="handleQuery" style="margin-left: 10px"
        >搜索</el-button
        >
      </div>
      <div>
        <el-button type="primary" @click="openForm('add')">新增</el-button>
        <el-button @click="handleOut">导出</el-button>
        <el-button type="danger" plain @click="handleDelete">删除</el-button>
        <span class="search_title">生产工单号:</span>
        <el-input v-model="searchForm.npsNo"
                  style="width: 200px"
                  placeholder="请输入生产工单号搜索"
                  @change="handleQuery"
                  clearable
                  :prefix-icon="Search" />
        <span style="margin-left: 20px"
              class="search_title">产品编码:</span>
        <el-input v-model="searchForm.materialCode"
                  style="width: 240px"
                  placeholder="请输入产品编码搜索"
                  @change="handleQuery"
                  clearable
                  :prefix-icon="Search" />
        <span style="margin-left: 20px"
              class="search_title">产品名称:</span>
        <el-input v-model="searchForm.productName"
                  style="width: 240px"
                  placeholder="请输入产品名称搜索"
                  @change="handleQuery"
                  clearable
                  :prefix-icon="Search" />
        <el-button type="primary"
                   @click="handleQuery"
                   style="margin-left: 10px">搜索</el-button>
        <el-button type="info"
                   @click="handleReset"
                   style="margin-left: 10px">重置</el-button>
      </div>
    </div>
    <div class="table_list">
      <PIMTable
          rowKey="id"
          :column="tableColumn"
          :tableData="tableData"
          :page="page"
          :isSelection="true"
          @selection-change="handleSelectionChange"
          :tableLoading="tableLoading"
          @pagination="pagination"
          :total="page.total"
      ></PIMTable>
      <PIMTable rowKey="id"
                :column="tableColumn"
                :tableData="tableData"
                :page="page"
                :tableLoading="tableLoading"
                @pagination="pagination"
                :total="page.total">
        <template #needQuantity="{ row }">
          <span style="font-weight: bold;color: #f68f00;">{{ row.needQuantity }}</span><span style="margin-left: 5px;color: #909399;">方</span>
        </template>
        <template #quantity="{ row }">
          <span style="font-weight: bold;color: #409eff;">{{ row.quantity }}</span><span style="margin-left: 5px;color: #909399;">方</span>
        </template>
        <template #qualifiedQuantity="{ row }">
          <span style="font-weight: bold;color: #67c23a;">{{ row.qualifiedQuantity }}</span><span style="margin-left: 5px;color: #909399;">方</span>
        </template>
        <template #unqualifiedQuantity="{ row }">
          <span style="font-weight: bold;color: #f56c6c;">{{ row.unqualifiedQuantity }}</span><span style="margin-left: 5px;color: #909399;">方</span>
        </template>
      </PIMTable>
    </div>
    <InspectionFormDia ref="inspectionFormDia" @close="handleQuery"></InspectionFormDia>
    <FormDia ref="formDia" @close="handleQuery"></FormDia>
    <files-dia ref="filesDia" @close="handleQuery"></files-dia>
        <el-dialog v-model="dialogFormVisible" title="编辑检验员" width="30%"
                             @close="closeDia">
            <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef">
                <el-form-item label="检验员:" prop="checkName">
                    <el-select v-model="form.checkName" placeholder="请选择" clearable>
                        <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName"
                                             :value="item.nickName"/>
                    </el-select>
                </el-form-item>
            </el-form>
            <template #footer>
                <div class="dialog-footer">
                    <el-button type="primary" @click="submitForm">确认</el-button>
                    <el-button @click="closeDia">取消</el-button>
                </div>
            </template>
        </el-dialog>
    <RatioDialog ref="ratioDialog"
                 @close="handleQuery"></RatioDialog>
  </div>
</template>
<script setup>
import { Search } from "@element-plus/icons-vue";
import {onMounted, ref, reactive, toRefs, getCurrentInstance, nextTick} from "vue";
import InspectionFormDia from "@/views/qualityManagement/finalInspection/components/inspectionFormDia.vue";
import FormDia from "@/views/qualityManagement/finalInspection/components/formDia.vue";
import {ElMessageBox} from "element-plus";
import {
    downloadQualityInspect,
    qualityInspectDel,
    qualityInspectListPage, qualityInspectUpdate,
    submitQualityInspect
} from "@/api/qualityManagement/rawMaterialInspection.js";
import FilesDia from "@/views/qualityManagement/finalInspection/components/filesDia.vue";
import dayjs from "dayjs";
import {userListNoPage} from "@/api/system/user.js";
import useUserStore from "@/store/modules/user";
  import { Search } from "@element-plus/icons-vue";
  import { onMounted, ref, reactive, toRefs, nextTick } from "vue";
  import RatioDialog from "@/views/qualityManagement/finalInspection/components/ratioDialog.vue";
  import { qualityInspectFinishedListPage } from "@/api/qualityManagement/rawMaterialInspection.js";
  import dayjs from "dayjs";
const data = reactive({
  searchForm: {
    productName: "",
    entryDate: undefined, // å½•入日期
    entryDateStart: undefined,
    entryDateEnd: undefined,
  },
    rules: {
        checkName: [{required: true, message: "请选择", trigger: "change"}],
    },
});
const { searchForm } = toRefs(data);
const tableColumn = ref([
  {
    label: "检测日期",
    prop: "checkTime",
    width: 120
  },
  {
    label: "生产工单号",
    prop: "workOrderNo",
    width: 120
  },
  {
    label: "检验员",
    prop: "checkName",
  },
  {
    label: "产品名称",
    prop: "productName",
  },
  {
    label: "规格型号",
    prop: "model",
  },
  {
    label: "单位",
    prop: "unit",
  },
  {
    label: "数量",
    prop: "quantity",
    width: 100
  },
  {
    label: "检测单位",
    prop: "checkCompany",
    width: 120
  },
  {
    label: "检测结果",
    prop: "checkResult",
    dataType: "tag",
    formatType: (params) => {
      if (params == '不合格') {
        return "danger";
      } else if (params == '合格') {
        return "success";
      } else {
        return null;
      }
  const data = reactive({
    searchForm: {
      npsNo: "",
      materialCode: "",
      productName: "",
    },
  },
    {
        label: "提交状态",
        prop: "inspectState",
        formatData: (params) => {
            if (params) {
                return "已提交";
            } else {
                return "未提交";
            }
        },
    },
  {
    dataType: "action",
    label: "操作",
    align: "center",
    fixed: "right",
    width: 280,
    operation: [
      {
        name: "编辑",
        type: "text",
        clickFun: (row) => {
          openForm("edit", row);
        },
                disabled: (row) => {
                    // å·²æäº¤åˆ™ç¦ç”¨
                    if (row.inspectState == 1) return true;
                    // å¦‚果检验员有值,只有当前登录用户能编辑
                    if (row.checkName) {
                        return row.checkName !== userStore.nickName;
                    }
                    return false;
                }
  });
  const { searchForm } = toRefs(data);
  const tableColumn = ref([
    {
      label: "生产工单号",
      prop: "npsNo",
      width: 140,
    },
    {
      label: "产品编码",
      prop: "materialCode",
      width: 120,
    },
    {
      label: "产品名称",
      prop: "productName",
    },
    {
      label: "规格型号",
      prop: "model",
    },
    {
      label: "产品类型",
      prop: "strength",
    },
    {
      label: "所需数量",
      prop: "needQuantity",
      dataType: "slot",
      slot: "needQuantity",
    },
    {
      label: "产出数量",
      prop: "quantity",
      dataType: "slot",
      slot: "quantity",
    },
    {
      label: "合格数量",
      prop: "qualifiedQuantity",
      dataType: "slot",
      slot: "qualifiedQuantity",
    },
    {
      label: "不合格数量",
      prop: "unqualifiedQuantity",
      dataType: "slot",
      slot: "unqualifiedQuantity",
    },
    {
      label: "状态",
      prop: "status",
      dataType: "tag",
      formatType: params => {
        const typeMap = {
          1: "primary",
          2: "warning",
          3: "success",
          4: "danger",
        };
        return typeMap[params] || "default";
      },
      {
        name: "附件",
        type: "text",
        clickFun: (row) => {
          openFilesFormDia(row);
        },
      formatData: val => {
        const labelMap = {
          1: "待开始",
          2: "进行中",
          3: "已完成",
          4: "已取消",
        };
        return labelMap[val] || val;
      },
            {
                name: "提交",
                type: "text",
                clickFun: (row) => {
                    submit(row.id);
                },
                disabled: (row) => {
                    // å·²æäº¤åˆ™ç¦ç”¨
                    if (row.inspectState == 1) return true;
                    // å¦‚果检验员有值,只有当前登录用户能提交
                    if (row.checkName) {
                        return row.checkName !== userStore.nickName;
                    }
                    return false;
                }
            },
            {
                name: "分配检验员",
                type: "text",
                clickFun: (row) => {
                    if (!row.checkName) {
                        open(row)
                    } else {
                        proxy.$modal.msgError("检验员已存在");
                    }
                },
                disabled: (row) => {
                    return row.inspectState == 1 || row.checkName;
                }
            },
            {
                name: "下载",
                type: "text",
                clickFun: (row) => {
                    downLoadFile(row);
                },
            },
    ],
  },
]);
const tableData = ref([]);
const selectedRows = ref([]);
const tableLoading = ref(false);
const currentRow = ref(null)
const page = reactive({
  current: 1,
  size: 100,
  total: 0
});
const formDia = ref()
const filesDia = ref()
const inspectionFormDia = ref()
const { proxy } = getCurrentInstance()
const userStore = useUserStore()
const userList = ref([]);
const form = ref({
    checkName: ""
});
const dialogFormVisible = ref(false);
    },
    {
      dataType: "action",
      label: "操作",
      align: "center",
      fixed: "right",
      width: 180,
      operation: [
        {
          name: "查看标准投入产出比例",
          type: "text",
          clickFun: row => {
            openFilesFormDia(row);
          },
        },
      ],
    },
  ]);
  const tableData = ref([]);
  const tableLoading = ref(false);
  const page = reactive({
    current: 1,
    size: 100,
    total: 0,
  });
  const ratioDialog = ref();
  /** é‡ç½®æŒ‰é’®æ“ä½œ */
  const handleReset = () => {
    searchForm.value = {
      npsNo: "",
      materialCode: "",
      productName: "",
    };
    handleQuery();
  };
const changeDaterange = (value) => {
  searchForm.value.entryDateStart = undefined;
  searchForm.value.entryDateEnd = undefined;
  if (value) {
    searchForm.value.entryDateStart = dayjs(value[0]).format("YYYY-MM-DD");
    searchForm.value.entryDateEnd = dayjs(value[1]).format("YYYY-MM-DD");
  }
  getList();
};
// æŸ¥è¯¢åˆ—表
/** æœç´¢æŒ‰é’®æ“ä½œ */
const handleQuery = () => {
  page.current = 1;
  getList();
};
const pagination = (obj) => {
  page.current = obj.page;
  page.size = obj.limit;
  getList();
};
const getList = () => {
  tableLoading.value = true;
  const params = { ...searchForm.value, ...page };
  params.entryDate = undefined
  qualityInspectListPage({...params, inspectType: 2}).then(res => {
    tableLoading.value = false;
    tableData.value = res.data.records
    page.total = res.data.total;
  }).catch(err => {
    tableLoading.value = false;
  })
};
// è¡¨æ ¼é€‰æ‹©æ•°æ®
const handleSelectionChange = (selection) => {
  selectedRows.value = selection;
};
// æ‰“开弹框
const openForm = (type, row) => {
  nextTick(() => {
    formDia.value?.openDialog(type, row)
  })
};
// æ‰“开新增检验弹框
const openInspectionForm = (type, row) => {
  nextTick(() => {
    inspectionFormDia.value?.openDialog(type, row)
  })
};
// æ‰“开附件弹框
const openFilesFormDia = (type, row) => {
  nextTick(() => {
    filesDia.value?.openDialog(type, row)
  })
};
// åˆ é™¤
const handleDelete = () => {
  let ids = [];
  if (selectedRows.value.length > 0) {
    ids = selectedRows.value.map((item) => item.id);
  } else {
    proxy.$modal.msgWarning("请选择数据");
    return;
  }
  ElMessageBox.confirm("选中的内容将被删除,是否确认删除?", "导出", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
  })
      .then(() => {
        qualityInspectDel(ids).then((res) => {
          proxy.$modal.msgSuccess("删除成功");
          getList();
        });
  // æŸ¥è¯¢åˆ—表
  /** æœç´¢æŒ‰é’®æ“ä½œ */
  const handleQuery = () => {
    page.current = 1;
    getList();
  };
  const pagination = obj => {
    page.current = obj.page;
    page.size = obj.limit;
    getList();
  };
  const getList = () => {
    tableLoading.value = true;
    const params = { ...searchForm.value, ...page };
    params.entryDate = undefined;
    qualityInspectFinishedListPage({ ...params })
      .then(res => {
        tableLoading.value = false;
        tableData.value = res.data.records;
        page.total = res.data.total;
      })
      .catch(() => {
        proxy.$modal.msg("已取消");
      .catch(err => {
        tableLoading.value = false;
      });
};
// å¯¼å‡º
const handleOut = () => {
  ElMessageBox.confirm("选中的内容将被导出,是否确认导出?", "导出", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
  })
      .then(() => {
        proxy.download("/quality/qualityInspect/export", {inspectType: 2}, "出厂检验.xlsx");
      })
      .catch(() => {
        proxy.$modal.msg("已取消");
      });
};
  };
// æä»·
const submit = async (id) => {
    const res = await submitQualityInspect({id: id})
    if (res.code === 200) {
        proxy.$modal.msgSuccess("提交成功");
        getList();
    }
}
  // æ‰“开标准投入产出比例弹框
  const openFilesFormDia = row => {
    nextTick(() => {
      ratioDialog.value?.openDialog(row);
    });
  };
// å…³é—­å¼¹æ¡†
const closeDia = () => {
    proxy.resetForm("formRef");
    dialogFormVisible.value = false;
};
const submitForm = () => {
    if (currentRow.value) {
        const data = {
            ...form.value,
            id: currentRow.value.id
        }
        qualityInspectUpdate(data).then(res => {
            proxy.$modal.msgSuccess("提交成功");
            closeDia();
            getList();
        })
    }
};
const open = async (row) => {
    let userLists = await userListNoPage();
    userList.value = userLists.data;
    currentRow.value = row
    dialogFormVisible.value = true
}
const downLoadFile = (row) => {
    downloadQualityInspect({ id: row.id }).then((blobData) => {
        const blob = new Blob([blobData], {
            type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
        })
        const downloadUrl = window.URL.createObjectURL(blob)
        const link = document.createElement('a')
        link.href = downloadUrl
        link.download = '原材料检验报告.docx'
        document.body.appendChild(link)
        link.click()
        document.body.removeChild(link)
        window.URL.revokeObjectURL(downloadUrl)
    })
};
onMounted(() => {
  getList();
});
  onMounted(() => {
    getList();
  });
</script>
<style scoped></style>
src/views/qualityManagement/processInspection/components/detailDialog.vue
@@ -73,6 +73,12 @@
              <span class="info-value"><span style="font-weight: bold;color: #b43434;">{{ detailData.unqualifiedQuantity }}</span> æ–¹</span>
            </div>
          </div>
          <div class="info-row">
            <div class="info-item">
              <span class="info-label">报工单号:</span>
              <span class="info-value">{{ detailData.productNo }}</span>
            </div>
          </div>
        </div>
      </el-card>
      <el-card v-for="group in groupedInspectionData"
@@ -81,7 +87,7 @@
               style="margin-top: 20px;">
        <template #header>
          <div class="card-header">
            <span v-if="groupedInspectionData.length > 1">检验指标组 - {{ group.sourceSort }}</span>
            <span v-if="groupedInspectionData.length > 1">检验zhi组 - {{ group.sourceSort }}</span>
            <span v-else>检验指标</span>
          </div>
        </template>
src/views/qualityManagement/processInspection/index.vue
@@ -229,7 +229,8 @@
    },
    {
      label: "报工单号",
      prop: "productionProductRouteItemId",
      prop: "productNo",
      width: "130",
    },
    {
      label: "产出数量",
@@ -255,7 +256,7 @@
      label: "操作",
      align: "center",
      fixed: "right",
      width: 100,
      width: 120,
      operation: [
        {
          name: "详情",