From 1eff6fe0753bfd7c0ac6d107bf9ce2221ebb478c Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 06 八月 2026 09:30:08 +0800
Subject: [PATCH] 新疆_马铃薯 1.人员选择下拉框添加筛选功能
---
src/views/qualityManagement/processInspection/index.vue | 193 +++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 181 insertions(+), 12 deletions(-)
diff --git a/src/views/qualityManagement/processInspection/index.vue b/src/views/qualityManagement/processInspection/index.vue
index 9fe630a..68f4cb4 100644
--- a/src/views/qualityManagement/processInspection/index.vue
+++ b/src/views/qualityManagement/processInspection/index.vue
@@ -11,6 +11,14 @@
placeholder="璇烽�夋嫨"
clearable
@change="changeDaterange" />
+ <span style="margin-left: 10px"
+ class="search_title">妫�楠屽憳锛�</span>
+ <el-input v-model="searchForm.checkName"
+ style="width: 240px"
+ placeholder="璇疯緭鍏ユ楠屽憳鎼滅储"
+ @change="handleQuery"
+ clearable
+ :prefix-icon="Search" />
<el-button type="primary"
@click="handleQuery"
style="margin-left: 10px">鎼滅储</el-button>
@@ -21,7 +29,7 @@
<el-button type="primary" @click="openQuickCheck">蹇�熸楠�</el-button>
<el-button type="primary" @click="openForm('add')">鏂板</el-button>
<el-button @click="handleOut">瀵煎嚭</el-button>
- <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>
+ <el-button type="danger" plain @click="handleDelete" v-hasPermi="['qualityManagement:processInspection:remove']">鍒犻櫎</el-button>
</div>
<PIMTable rowKey="id"
:column="tableColumn"
@@ -53,7 +61,7 @@
ref="formRef">
<el-form-item label="妫�楠屽憳锛�"
prop="checkName">
- <el-select v-model="form.checkName"
+ <el-select filterable v-model="form.checkName"
placeholder="璇烽�夋嫨"
clearable>
<el-option v-for="item in userList"
@@ -68,6 +76,35 @@
<el-button type="primary"
@click="submitForm">纭</el-button>
<el-button @click="closeDia">鍙栨秷</el-button>
+ </div>
+ </template>
+ </el-dialog>
+
+ <el-dialog v-model="templateDialogVisible"
+ title="閫夋嫨瀵煎嚭妯℃澘"
+ width="450px"
+ @close="closeTemplateDialog">
+ <div class="template-grid">
+ <div class="template-item" @click="handleTemplateExport('weilong')">
+ <div class="template-icon weilong-icon">浼�</div>
+ <div class="template-name">浼熼緳妯℃澘</div>
+ </div>
+ <div class="template-item" @click="handleTemplateExport('baishi')">
+ <div class="template-icon baishi-icon">鐧�</div>
+ <div class="template-name">鐧句簨妯℃澘</div>
+ </div>
+ <div class="template-item" @click="handleTemplateExport('dali')">
+ <div class="template-icon dali-icon">杈�</div>
+ <div class="template-name">杈惧埄妯℃澘</div>
+ </div>
+ <div class="template-item" @click="handleTemplateExport('common')">
+ <div class="template-icon common-icon">閫�</div>
+ <div class="template-name">閫氱敤妯℃澘</div>
+ </div>
+ </div>
+ <template #footer>
+ <div class="dialog-footer">
+ <el-button @click="closeTemplateDialog">鍙栨秷</el-button>
</div>
</template>
</el-dialog>
@@ -96,6 +133,9 @@
qualityInspectListPage,
qualityInspectUpdate,
submitQualityInspect,
+ exportWeilongTemplate,
+ exportBaishiTemplate,
+ exportDaliTemplate,
} from "@/api/qualityManagement/rawMaterialInspection.js";
import FilesDia from "@/views/qualityManagement/processInspection/components/filesDia.vue";
import dayjs from "dayjs";
@@ -106,6 +146,7 @@
searchForm: {
entryDate: undefined, // 褰曞叆鏃ユ湡
workOrderNo: "",
+ checkName: "",
entryDateStart: undefined,
entryDateEnd: undefined,
},
@@ -205,6 +246,22 @@
},
},
{
+ label: "妫�楠岃鍒�",
+ prop: "inspectRule",
+ width: 100,
+ formatData: (val) => val === 0 ? "鍏ㄦ" : val === 1 ? "鎶芥" : ""
+ },
+ {
+ label: "鎶芥姣斾緥(%)",
+ prop: "sampleRatio",
+ width: 120,
+ },
+ {
+ label: "鎶芥鏁伴噺",
+ prop: "sampleQuantity",
+ width: 100,
+ },
+ {
dataType: "action",
label: "鎿嶄綔",
align: "center",
@@ -301,6 +358,9 @@
const quickCheckDia = ref();
const { proxy } = getCurrentInstance();
const userStore = useUserStore();
+
+ const templateDialogVisible = ref(false);
+ const currentExportRow = ref(null);
const changeDaterange = value => {
searchForm.value.entryDateStart = undefined;
searchForm.value.entryDateEnd = undefined;
@@ -447,21 +507,70 @@
});
};
const downLoadFile = row => {
- downloadQualityInspect({ id: row.id }).then(blobData => {
- const blob = new Blob([blobData], {
+ currentExportRow.value = row;
+ templateDialogVisible.value = true;
+ };
+
+ const closeTemplateDialog = () => {
+ templateDialogVisible.value = false;
+ currentExportRow.value = null;
+ };
+
+ const handleTemplateExport = async (templateType) => {
+ if (!currentExportRow.value) {
+ proxy.$modal.msgError("璇烽�夋嫨瑕佸鍑虹殑鏁版嵁");
+ return;
+ }
+ const id = currentExportRow.value.id;
+
+ if (templateType === 'common') {
+ downloadQualityInspect({ id }).then(blobData => {
+ const blob = new Blob([blobData], {
+ type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
+ });
+ const link = document.createElement("a");
+ link.href = URL.createObjectURL(blob);
+ link.download = "杩囩▼妫�楠屾姤鍛�.docx";
+ document.body.appendChild(link);
+ link.click();
+ document.body.removeChild(link);
+ URL.revokeObjectURL(link.href);
+ proxy.$modal.msgSuccess("瀵煎嚭鎴愬姛");
+ closeTemplateDialog();
+ }).catch(() => {
+ proxy.$modal.msgError("瀵煎嚭澶辫触");
+ });
+ return;
+ }
+
+ const fileNameMap = {
+ weilong: "浼熼緳妯$増妫�楠岀粨鏋�.doc",
+ baishi: "鐧句簨妯$増妫�楠岀粨鏋�.doc",
+ dali: "杈惧埄妯$増妫�楠岀粨鏋�.doc",
+ };
+ const exportFuncMap = {
+ weilong: exportWeilongTemplate,
+ baishi: exportBaishiTemplate,
+ dali: exportDaliTemplate,
+ };
+ try {
+ const response = await exportFuncMap[templateType](id);
+ const blob = new Blob([response], {
type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
});
- const downloadUrl = window.URL.createObjectURL(blob);
-
const link = document.createElement("a");
- link.href = downloadUrl;
- link.download = "杩囩▼妫�楠屾姤鍛�.docx";
+ link.href = URL.createObjectURL(blob);
+ link.download = fileNameMap[templateType];
document.body.appendChild(link);
link.click();
-
document.body.removeChild(link);
- window.URL.revokeObjectURL(downloadUrl);
- });
+ URL.revokeObjectURL(link.href);
+ proxy.$modal.msgSuccess("瀵煎嚭鎴愬姛");
+ closeTemplateDialog();
+ } catch (error) {
+ console.error("瀵煎嚭澶辫触", error);
+ proxy.$modal.msgError("瀵煎嚭澶辫触");
+ }
};
// 瀵煎嚭
const handleOut = () => {
@@ -486,4 +595,64 @@
});
</script>
-<style scoped></style>
+<style scoped>
+.template-grid {
+ display: grid;
+ grid-template-columns: repeat(2, 1fr);
+ gap: 20px;
+ padding: 20px 10px;
+}
+
+.template-item {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ padding: 24px 16px;
+ border: 1px solid #e4e7ed;
+ border-radius: 8px;
+ cursor: pointer;
+ transition: all 0.3s;
+}
+
+.template-item:hover {
+ border-color: #409eff;
+ box-shadow: 0 2px 12px rgba(64, 158, 255, 0.2);
+ transform: translateY(-2px);
+}
+
+.template-icon {
+ width: 56px;
+ height: 56px;
+ border-radius: 50%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 24px;
+ font-weight: bold;
+ color: #fff;
+ margin-bottom: 12px;
+}
+
+.weilong-icon {
+ background: linear-gradient(135deg, #409eff, #1677ff);
+}
+
+.baishi-icon {
+ background: linear-gradient(135deg, #67c23a, #529b2e);
+}
+
+.dali-icon {
+ background: linear-gradient(135deg, #e6a23c, #c4860c);
+}
+
+.common-icon {
+ background: linear-gradient(135deg, #909399, #6d6d6d);
+}
+
+.template-name {
+ font-size: 15px;
+ color: #303133;
+ font-weight: 500;
+}
+</style>
--
Gitblit v1.9.3