From d2fb1300564eaa8166f4db1184c521e468cd2ed3 Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期五, 17 四月 2026 14:23:09 +0800
Subject: [PATCH] 不合格处理:增加字段增删改,展示
---
src/views/productionManagement/productionProcess/index.vue | 171 ++++++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 158 insertions(+), 13 deletions(-)
diff --git a/src/views/productionManagement/productionProcess/index.vue b/src/views/productionManagement/productionProcess/index.vue
index ea2a341..92530e5 100644
--- a/src/views/productionManagement/productionProcess/index.vue
+++ b/src/views/productionManagement/productionProcess/index.vue
@@ -1,17 +1,38 @@
+// 宸ュ簭
<template>
<div class="app-container">
<div class="search_form">
<el-form :model="searchForm"
:inline="true">
- <el-form-item label="宸ュ簭鍚嶇О:">
+ <el-form-item label="浜у搧鍚嶇О:">
<el-input v-model="searchForm.name"
- placeholder="璇疯緭鍏�"
+ placeholder="璇疯緭鍏ヤ骇鍝佸悕绉�"
clearable
prefix-icon="Search"
style="width: 200px;"
@change="handleQuery" />
</el-form-item>
- <el-form-item label="宸ュ簭缂栧彿:">
+ <el-form-item label="閮ㄤ欢绫诲瀷:">
+ <el-select v-model="searchForm.type"
+ placeholder="璇烽�夋嫨"
+ clearable
+ style="width: 200px;"
+ @change="handleQuery">
+ <el-option label="鍔犲伐"
+ :value="1" />
+ <el-option label="鍒澘鍐疯姱鍒朵綔"
+ :value="2" />
+ <el-option label="绠¤矾缁勫"
+ :value="3" />
+ <el-option label="缃愪綋杩炴帴鍙婅皟璇�"
+ :value="4" />
+ <el-option label="娴嬭瘯鎵撳帇"
+ :value="5" />
+ <el-option label="鍏朵粬"
+ :value="6" />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="閮ㄤ欢缂栧彿:">
<el-input v-model="searchForm.no"
placeholder="璇疯緭鍏�"
clearable
@@ -29,11 +50,14 @@
<div style="text-align: right"
class="mb10">
<el-button type="primary"
- @click="showNewModal">鏂板宸ュ簭</el-button>
+ @click="showNewModal">鏂板閮ㄤ欢</el-button>
+ <el-button type="info"
+ plain
+ @click="handleImport">瀵煎叆</el-button>
<el-button type="danger"
@click="handleDelete"
:disabled="selectedRows.length === 0"
- plain>鍒犻櫎宸ュ簭</el-button>
+ plain>鍒犻櫎閮ㄤ欢</el-button>
</div>
<PIMTable rowKey="id"
:column="tableColumn"
@@ -52,38 +76,84 @@
v-model:visible="isShowEditModal"
:record="record"
@completed="getList" />
+ <ImportDialog ref="importDialogRef"
+ v-model="importDialogVisible"
+ title="瀵煎叆閮ㄤ欢"
+ :action="importAction"
+ :headers="importHeaders"
+ :loading="importLoading"
+ :disabled="importLoading"
+ :auto-upload="false"
+ :on-progress="handleImportProgress"
+ :on-success="handleImportSuccess"
+ :on-error="handleImportError"
+ @confirm="handleImportConfirm"
+ @download-template="handleDownloadTemplate"
+ @close="handleImportClose" />
</div>
</template>
<script setup>
- import { onMounted, ref } from "vue";
+ import { onMounted, ref, reactive, toRefs, getCurrentInstance } from "vue";
import NewProcess from "@/views/productionManagement/productionProcess/New.vue";
import EditProcess from "@/views/productionManagement/productionProcess/Edit.vue";
- import { listPage, del } from "@/api/productionManagement/productionProcess.js";
+ import ImportDialog from "@/components/Dialog/ImportDialog.vue";
+ import {
+ listPage,
+ del,
+ importData,
+ downloadTemplate,
+ } from "@/api/productionManagement/productionProcess.js";
+ import { getToken } from "@/utils/auth";
const data = reactive({
searchForm: {
name: "",
+ type: undefined,
no: "",
},
});
const { searchForm } = toRefs(data);
const tableColumn = ref([
+
{
- label: "宸ュ簭鍚嶇О",
+ label: "浜у搧鍚嶇О",
prop: "name",
},
{
- label: "宸ュ簭缂栧彿",
+ label: "浜у搧瑙勬牸",
+ prop: "productModel",
+ },
+ {
+ label: "閮ㄤ欢缂栧彿",
prop: "no",
},
{
- label: "宸ヨ祫瀹氶",
+ label: "閮ㄤ欢绫诲瀷",
+ prop: "typeText",
+ },
+ {
+ label: "璁″垝宸ユ椂(灏忔椂)",
prop: "salaryQuota",
+ },
+ {
+ label: "璁″垝浜哄憳",
+ prop: "plannerName",
+ },
+ {
+ label: "鏄惁璐ㄦ",
+ prop: "isQuality",
+ formatData: (params) => {
+ return params ? "鏄�" : "鍚�";
+ },
},
{
label: "澶囨敞",
prop: "remark",
+ },
+ {
+ label: "鏇存柊鏃堕棿",
+ prop: "updateTime",
},
{
dataType: "action",
@@ -108,12 +178,21 @@
const isShowNewModal = ref(false);
const isShowEditModal = ref(false);
const record = ref({});
+ const importDialogVisible = ref(false);
+ const importLoading = ref(false);
+ const importDialogRef = ref(null);
const page = reactive({
current: 1,
size: 100,
total: 0,
});
const { proxy } = getCurrentInstance();
+
+
+ // 瀵煎叆鐩稿叧閰嶇疆
+ const importAction =
+ import.meta.env.VITE_APP_BASE_API + "/productProcess/importData";
+ const importHeaders = { Authorization: "Bearer " + getToken() };
// 鏌ヨ鍒楄〃
/** 鎼滅储鎸夐挳鎿嶄綔 */
@@ -136,6 +215,7 @@
tableLoading.value = false;
tableData.value = res.data.records.map(item => ({
...item,
+ typeText: item.type !== undefined && item.type !== null ? (item.type === 1 ? "鍔犲伐" : item.type === 2 ? "鍒澘鍐疯姱鍒朵綔" : item.type === 3 ? "绠¤矾缁勫" : item.type === 4 ? "缃愪綋杩炴帴鍙婅皟璇�" : item.type === 5 ? "娴嬭瘯鎵撳帇" : "鍏朵粬") : "",
}));
page.total = res.data.total;
})
@@ -165,7 +245,7 @@
if (no.length > 2) {
proxy.$modal
.confirm(
- '鏄惁纭鍒犻櫎宸ュ簭缂栧彿涓�"' +
+ '鏄惁纭鍒犻櫎閮ㄤ欢缂栧彿涓�"' +
no[0] +
"銆�" +
no[1] +
@@ -183,7 +263,7 @@
.catch(() => {});
} else {
proxy.$modal
- .confirm('鏄惁纭鍒犻櫎宸ュ簭缂栧彿涓�"' + no + '"鐨勬暟鎹」锛�')
+ .confirm('鏄惁纭鍒犻櫎閮ㄤ欢缂栧彿涓�"' + no + '"鐨勬暟鎹」锛�')
.then(function () {
return del(ids);
})
@@ -195,6 +275,71 @@
}
}
+ // 瀵煎叆
+ const handleImport = () => {
+ importDialogVisible.value = true;
+ };
+
+ // 纭瀵煎叆
+ const handleImportConfirm = () => {
+ if (importDialogRef.value) {
+ importDialogRef.value.submit();
+ }
+ };
+
+ // 瀵煎叆涓�
+ const handleImportProgress = () => {
+ importLoading.value = true;
+ };
+
+ // 瀵煎叆鎴愬姛
+ const handleImportSuccess = response => {
+ importLoading.value = false;
+ if (response.code === 200) {
+ proxy.$modal.msgSuccess("瀵煎叆鎴愬姛");
+ importDialogVisible.value = false;
+ if (importDialogRef.value) {
+ importDialogRef.value.clearFiles();
+ }
+ getList();
+ } else {
+ proxy.$modal.msgError(response.msg || "瀵煎叆澶辫触");
+ }
+ };
+
+ // 瀵煎叆澶辫触
+ const handleImportError = error => {
+ importLoading.value = false;
+ proxy.$modal.msgError("瀵煎叆澶辫触锛�" + (error.message || "鏈煡閿欒"));
+ };
+
+ // 鍏抽棴瀵煎叆寮圭獥
+ const handleImportClose = () => {
+ importLoading.value = false;
+ if (importDialogRef.value) {
+ importDialogRef.value.clearFiles();
+ }
+ };
+
+ // 涓嬭浇妯℃澘
+ const handleDownloadTemplate = async () => {
+ try {
+ const res = await downloadTemplate();
+ const blob = new Blob([res], {
+ type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
+ });
+ const url = window.URL.createObjectURL(blob);
+ const link = document.createElement("a");
+ link.href = url;
+ link.download = "閮ㄤ欢瀵煎叆妯℃澘.xlsx";
+ link.click();
+ window.URL.revokeObjectURL(url);
+ proxy.$modal.msgSuccess("妯℃澘涓嬭浇鎴愬姛");
+ } catch (error) {
+ proxy.$modal.msgError("妯℃澘涓嬭浇澶辫触");
+ }
+ };
+
// 瀵煎嚭
// const handleOut = () => {
// ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
@@ -203,7 +348,7 @@
// type: "warning",
// })
// .then(() => {
- // proxy.download("/salesLedger/scheduling/exportTwo", {}, "宸ュ簭鎺掍骇.xlsx");
+ // proxy.download("/salesLedger/scheduling/exportTwo", {}, "閮ㄤ欢鎺掍骇.xlsx");
// })
// .catch(() => {
// proxy.$modal.msg("宸插彇娑�");
--
Gitblit v1.9.3