| | |
| | | }) |
| | | } |
| | | |
| | | // 查询原检详情 |
| | | export function findRawMaterialDetail(id) { |
| | | return request({ |
| | | url: '/quality/rawMaterial/detail/' + id, |
| | | method: 'get', |
| | | }) |
| | | } |
| | | |
| | | // 新增原检 |
| | | export function createRawMaterial(data) { |
| | | return request({ |
| | |
| | | }) |
| | | } |
| | | |
| | | // 提交 |
| | | export function submitRawMaterial(id) { |
| | | return request({ |
| | | url: '/quality/rawMaterial/submit/' + id, |
| | | method: 'patch', |
| | | }) |
| | | } |
| | | |
| | | // 修改检验人 |
| | | export function updateCheckUserName(data) { |
| | | return request({ |
| | | url: '/quality/rawMaterial/updateCheckUserName', |
| | | method: 'patch', |
| | | data: data, |
| | | }) |
| | | } |
| | | |
| | | // 修改原检 |
| | | export function updateRawMaterial(data) { |
| | | return request({ |
| | |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="规格型号:" prop="productModelId"> |
| | | <el-select v-model="form.productModelId" placeholder="请选择" clearable :disabled="operationType === 'edit'" |
| | | <el-select v-model="form.productModelId" placeholder="请选择" clearable |
| | | :disabled="operationType === 'edit'" |
| | | filterable readonly @change="handleChangeModel"> |
| | | <el-option v-for="item in modelOptions" :key="item.id" :label="item.model" :value="item.id" /> |
| | | <el-option v-for="item in modelOptions" :key="item.id" :label="item.model" :value="item.id"/> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | <el-col :span="12"> |
| | | <el-form-item label="检测结果:" prop="checkResult"> |
| | | <el-select v-model="form.checkResult"> |
| | | <el-option label="合格" :value="1"/> |
| | | <el-option label="不合格" :value="0"/> |
| | | <el-option label="合格" :value="0"/> |
| | | <el-option label="不合格" :value="1"/> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="检验员:" prop="checkName"> |
| | | <el-select v-model="form.checkName" placeholder="请选择" clearable filterable style="width: 100%"> |
| | | <el-form-item label="检验员:" prop="checkUserName"> |
| | | <el-select v-model="form.checkUserName" placeholder="请选择" clearable filterable style="width: 100%"> |
| | | <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName" |
| | | :value="item.nickName"/> |
| | | </el-select> |
| | |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :tableLoading="tableLoading" |
| | | :is-show-pagination="false" |
| | | height="400" |
| | | > |
| | | <template #slot="{ row }"> |
| | |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <item-select v-model="isShowItems" @confirm="handleItemSelect" /> |
| | | <item-select v-model="isShowItems" @confirm="handleItemSelect"/> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | import {qualityInspectParamInfo} from "@/api/qualityManagement/qualityInspectParam.js"; |
| | | import {qualityInspectDetailByProductId} from "@/api/qualityManagement/metricMaintenance.js"; |
| | | import {userListNoPage} from "@/api/system/user.js"; |
| | | import {createRawMaterial, updateRawMaterial} from "@/api/qualityManagement/rawMaterial.js"; |
| | | import {createRawMaterial, findRawMaterialDetail, updateRawMaterial} from "@/api/qualityManagement/rawMaterial.js"; |
| | | import ProductSelectDialog from "@/views/basicData/product/ProductSelectDialog.vue"; |
| | | |
| | | const {proxy} = getCurrentInstance() |
| | |
| | | form: { |
| | | checkTime: "", |
| | | supplier: "", |
| | | checkName: "", |
| | | productName: "", |
| | | productId: "", |
| | | productModelId: "", |
| | | model: "", |
| | | batchNo: "", |
| | | unit: "", |
| | | quantity: "", |
| | | checkCompany: "", |
| | | checkType: "", |
| | | checkResult: "", |
| | | unit: "", |
| | | checkUserName: "", |
| | | }, |
| | | rules: { |
| | | checkTime: [{required: true, message: "请输入", trigger: "blur"},], |
| | | supplier: [{required: true, message: "请输入", trigger: "blur"}], |
| | | checkName: [{required: false, message: "请输入", trigger: "blur"}], |
| | | checkUserName: [{required: false, message: "请选择检验员", trigger: "blur"}], |
| | | productId: [{required: true, message: "请输入", trigger: "blur"}], |
| | | productModelId: [{required: true, message: "请选择产品型号", trigger: "change"}], |
| | | batchNo: [{required: false, message: "请输入批次", trigger: "blur"}], |
| | | unit: [{required: false, message: "请输入", trigger: "blur"}], |
| | | quantity: [{required: true, message: "请输入", trigger: "blur"}], |
| | | checkCompany: [{required: false, message: "请输入", trigger: "blur"}], |
| | | checkType: [{required: false, message: "请选择检验类型", trigger: "blur"}], |
| | | checkResult: [{required: true, message: "请选择检测结果", trigger: "change"}], |
| | | }, |
| | | }); |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "指标", |
| | | prop: "parameterItem", |
| | | label: "检测项目", |
| | | prop: "name", |
| | | }, |
| | | { |
| | | label: "单位", |
| | |
| | | }, |
| | | { |
| | | label: "内控值", |
| | | prop: "controlValue", |
| | | prop: "internalControl", |
| | | }, |
| | | { |
| | | label: "化验值", |
| | |
| | | dataType: 'slot', |
| | | slot: 'slot', |
| | | }, |
| | | { |
| | | dataType: 'action', |
| | | label: '操作', |
| | | align: 'center', |
| | | fixed: 'right', |
| | | width: 140, |
| | | operation: [ |
| | | { |
| | | name: '删除', |
| | | type: 'text', |
| | | clickFun: (row) => handleDelete(row.id), |
| | | } |
| | | ] |
| | | } |
| | | ]); |
| | | const tableData = ref([]); |
| | | const tableLoading = ref(false); |
| | |
| | | const userList = ref([]); |
| | | const productOptions = ref([]); |
| | | const currentProductId = ref(0); |
| | | const testStandardOptions = ref([]); // 指标选择下拉框数据 |
| | | const modelOptions = ref([]); |
| | | |
| | | // 打开弹框 |
| | |
| | | userList.value = res.data || []; |
| | | }) |
| | | // 先重置表单数据(保持字段完整,避免弹窗首次渲染时触发必填红框“闪一下”) |
| | | form.value = { |
| | | form.value = { |
| | | checkTime: "", |
| | | supplier: "", |
| | | checkName: "", |
| | | productName: "", |
| | | productId: "", |
| | | productModelId: "", |
| | | model: "", |
| | | batchNo: "", |
| | | unit: "", |
| | | quantity: "", |
| | | checkCompany: "", |
| | | checkType: "", |
| | | checkResult: "", |
| | | unit: "", |
| | | checkUserName: "", |
| | | } |
| | | testStandardOptions.value = []; |
| | | tableData.value = []; |
| | | // 先确保产品树已加载,否则编辑时产品/规格型号无法反显 |
| | | await getProductOptions(); |
| | | if (operationType.value === 'edit') { |
| | | form.value = {...row} |
| | | await fetchData(row.id); |
| | | currentProductId.value = row.productId || 0 |
| | | // 关键:编辑时加载规格型号下拉选项,才能反显 productModelId |
| | | if (currentProductId.value) { |
| | | try { |
| | | const res = await modelList({ id: currentProductId.value }); |
| | | const res = await modelList({id: currentProductId.value}); |
| | | modelOptions.value = res || []; |
| | | // 同步回填 model / unit(有些接口返回的 row 里可能没带全) |
| | | if (form.value.productModelId) { |
| | |
| | | modelOptions.value = []; |
| | | currentProductId.value = value |
| | | form.value.productName = findNodeById(productOptions.value, value); |
| | | modelList({ id: value }).then((res) => { |
| | | modelList({id: value}).then((res) => { |
| | | modelOptions.value = res; |
| | | }) |
| | | if (currentProductId.value) { |
| | |
| | | }; |
| | | |
| | | const handleItemSelect = (value) => { |
| | | // 过滤已存在的指标 |
| | | value = value.filter(item => !tableData.value.some(existingItem => existingItem.id === item.id)); |
| | | tableData.value.push(...value) |
| | | } |
| | | |
| | |
| | | const submitForm = () => { |
| | | proxy.$refs.formRef.validate(valid => { |
| | | if (valid) { |
| | | form.value.inspectType = 0 |
| | | if (operationType.value === "add") { |
| | | tableData.value.forEach((item) => { |
| | | delete item.id |
| | | }) |
| | | } |
| | | const data = {...form.value, qualityInspectParams: tableData.value} |
| | | const data = {...form.value, qualityInspectItem: tableData.value} |
| | | if (operationType.value === "add") { |
| | | createRawMaterial(data).then(res => { |
| | | proxy.$modal.msgSuccess("提交成功"); |
| | |
| | | |
| | | const getList = () => { |
| | | if (!currentProductId.value) { |
| | | testStandardOptions.value = []; |
| | | tableData.value = []; |
| | | return; |
| | | } |
| | |
| | | const closeDia = () => { |
| | | proxy.resetForm("formRef"); |
| | | tableData.value = []; |
| | | testStandardOptions.value = []; |
| | | dialogFormVisible.value = false; |
| | | emit('close') |
| | | }; |
| | | |
| | | const handleDelete = (id) => { |
| | | tableData.value = tableData.value.filter(item => item.id !== id); |
| | | } |
| | | |
| | | const fetchData = (id) => { |
| | | tableLoading.value = true; |
| | | findRawMaterialDetail(id).then(res => { |
| | | form.value = res.data; |
| | | tableData.value = res.data.qualityInspectItem; |
| | | }).finally(() => { |
| | | tableLoading.value = false; |
| | | }) |
| | | } |
| | | defineExpose({ |
| | | openDialog, |
| | | }); |
| | |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| | | </style> |
| | |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title">供应商:</span> |
| | | <el-input |
| | | v-model="searchForm.supplier" |
| | | style="width: 240px" |
| | | placeholder="请输入供应商搜索" |
| | | @change="handleQuery" |
| | | clearable |
| | | :prefix-icon="Search" |
| | | /> |
| | | <!-- <span class="search_title">供应商:</span>--> |
| | | <!-- <el-input--> |
| | | <!-- v-model="searchForm.supplier"--> |
| | | <!-- 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-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-form-item label="检验员:" prop="checkUserName"> |
| | | <el-select v-model="form.checkUserName" placeholder="请选择" clearable> |
| | | <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName" |
| | | :value="item.nickName"/> |
| | | </el-select> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import {Search} from "@element-plus/icons-vue"; |
| | | import {onMounted, ref, reactive, toRefs, getCurrentInstance, nextTick} from "vue"; |
| | | import InspectionFormDia from "@/views/qualityManagement/rawMaterial/components/inspectionFormDia.vue"; |
| | | import FormDia from "@/views/qualityManagement/rawMaterial/components/formDia.vue"; |
| | | import {ElMessageBox} from "element-plus"; |
| | | import { |
| | | downloadQualityInspect, |
| | | qualityInspectUpdate, |
| | | submitQualityInspect |
| | | } from "@/api/qualityManagement/rawMaterialInspection.js"; |
| | | import FilesDia from "@/views/qualityManagement/rawMaterial/components/filesDia.vue"; |
| | | import dayjs from "dayjs"; |
| | | import {userListNoPage} from "@/api/system/user.js"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | import {deleteRawMaterial, findRawMaterialListPage} from "@/api/qualityManagement/rawMaterial.js"; |
| | | import { |
| | | deleteRawMaterial, |
| | | findRawMaterialListPage, |
| | | submitRawMaterial, updateCheckUserName, |
| | | } from "@/api/qualityManagement/rawMaterial.js"; |
| | | |
| | | const data = reactive({ |
| | | searchForm: { |
| | |
| | | entryDateEnd: undefined, |
| | | }, |
| | | rules: { |
| | | checkName: [{required: true, message: "请选择", trigger: "change"}], |
| | | checkUserName: [{required: true, message: "请选择", trigger: "change"}], |
| | | }, |
| | | }); |
| | | const {searchForm, rules} = toRefs(data); |
| | |
| | | }, |
| | | { |
| | | label: "检验员", |
| | | prop: "checkName", |
| | | prop: "checkUserName", |
| | | }, |
| | | { |
| | | label: "产品名称", |
| | |
| | | prop: "model", |
| | | }, |
| | | { |
| | | label: "单位", |
| | | prop: "unit", |
| | | }, |
| | | { |
| | | label: "数量", |
| | | prop: "quantity", |
| | | label: "批次号", |
| | | prop: "batchNo", |
| | | width: 120 |
| | | }, |
| | | { |
| | |
| | | return "success"; |
| | | } else { |
| | | return null; |
| | | } |
| | | }, |
| | | formatData: (params) => { |
| | | if (params === 1) { |
| | | return "不合格"; |
| | | } else if (params === 0) { |
| | | return "合格"; |
| | | } |
| | | }, |
| | | }, |
| | |
| | | clickFun: (row) => { |
| | | openForm("edit", row); |
| | | }, |
| | | disabled: (row) => { |
| | | // 已提交则禁用 |
| | | if (row.inspectState == 1) return true; |
| | | // 如果检验员有值,只有当前登录用户能编辑 |
| | | if (row.checkName) { |
| | | return row.checkName !== userStore.nickName; |
| | | } |
| | | return false; |
| | | } |
| | | disabled: (row) => { |
| | | // 已提交则禁用 |
| | | if (row.inspectState == 1) return true; |
| | | // 如果检验员有值,只有当前登录用户能编辑 |
| | | if (row.checkUserName) { |
| | | return row.checkUserName !== userStore.nickName; |
| | | } |
| | | return false; |
| | | } |
| | | }, |
| | | { |
| | | name: "附件", |
| | |
| | | clickFun: (row) => { |
| | | submit(row.id); |
| | | }, |
| | | disabled: (row) => { |
| | | // 已提交则禁用 |
| | | if (row.inspectState == 1) return true; |
| | | // 如果检验员有值,只有当前登录用户能提交 |
| | | if (row.checkName) { |
| | | return row.checkName !== userStore.nickName; |
| | | } |
| | | return false; |
| | | } |
| | | disabled: (row) => { |
| | | // 已提交则禁用 |
| | | if (row.inspectState == 1) return true; |
| | | // 如果检验员有值,只有当前登录用户能提交 |
| | | if (row.checkUserName) { |
| | | return row.checkUserName !== userStore.nickName; |
| | | } |
| | | return false; |
| | | } |
| | | }, |
| | | { |
| | | name: "分配检验员", |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | if (!row.checkName) { |
| | | if (!row.checkUserName) { |
| | | open(row) |
| | | } else { |
| | | proxy.$modal.msgError("检验员已存在"); |
| | | } |
| | | }, |
| | | disabled: (row) => { |
| | | return row.inspectState == 1 || row.checkName; |
| | | } |
| | | disabled: (row) => { |
| | | return row.inspectState === 1 || row.checkUserName || row.checkUserName !== ''; |
| | | } |
| | | }, |
| | | { |
| | | name: "下载", |
| | |
| | | const userList = ref([]); |
| | | const dialogFormVisible = ref(false); |
| | | const form = ref({ |
| | | checkName: "" |
| | | checkUserName: "" |
| | | }); |
| | | const page = reactive({ |
| | | current: 1, |
| | |
| | | |
| | | // 提价 |
| | | const submit = async (id) => { |
| | | const res = await submitQualityInspect({id: id}) |
| | | const res = await submitRawMaterial(id) |
| | | if (res.code === 200) { |
| | | proxy.$modal.msgSuccess("提交成功"); |
| | | getList(); |
| | |
| | | ...form.value, |
| | | id: currentRow.value.id |
| | | } |
| | | qualityInspectUpdate(data).then(res => { |
| | | updateCheckUserName(data).then(res => { |
| | | proxy.$modal.msgSuccess("提交成功"); |
| | | closeDia(); |
| | | getList(); |
| | |
| | | } |
| | | |
| | | const downLoadFile = (row) => { |
| | | downloadQualityInspect({ id: row.id }).then((blobData) => { |
| | | downloadQualityInspect({id: row.id}).then((blobData) => { |
| | | const blob = new Blob([blobData], { |
| | | type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', |
| | | }) |