From 459336e98dbd474a0cbf5a11660cc8821a092411 Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期六, 14 三月 2026 16:41:46 +0800
Subject: [PATCH] 新增合格率字段到生产工序的新增和编辑页面,并在表格中显示相关参数。增加生产记录选择和批量删除功能。
---
src/views/productionManagement/productionProcess/index.vue | 222 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/components/PIMTable/PIMTable.vue | 6 +
src/views/productionManagement/productionProcess/Edit.vue | 8 +
src/views/productionManagement/productionProcess/New.vue | 4 +
4 files changed, 239 insertions(+), 1 deletions(-)
diff --git a/src/components/PIMTable/PIMTable.vue b/src/components/PIMTable/PIMTable.vue
index a418280..159c533 100644
--- a/src/components/PIMTable/PIMTable.vue
+++ b/src/components/PIMTable/PIMTable.vue
@@ -26,6 +26,7 @@
type="selection"
width="55"
v-if="isSelection"
+ :selectable="rowSelectable"
/>
<el-table-column align="center" label="搴忓彿" type="index" width="60" />
@@ -333,6 +334,11 @@
},
});
+// 閫夋嫨妗嗙鐢ㄦ帶鍒讹細琛屽璞′笂濡傛灉鏈� disabled === true锛屽垯涓嶅厑璁搁�変腑
+const rowSelectable = (row, index) => {
+ return !row.disabled;
+};
+
// Data
const uploadRefs = ref([]);
const currentFiles = ref({});
diff --git a/src/views/productionManagement/productionProcess/Edit.vue b/src/views/productionManagement/productionProcess/Edit.vue
index 8e92403..b9a012a 100644
--- a/src/views/productionManagement/productionProcess/Edit.vue
+++ b/src/views/productionManagement/productionProcess/Edit.vue
@@ -28,6 +28,9 @@
<el-form-item label="宸ヨ祫瀹氶" prop="salaryQuota">
<el-input v-model="formState.salaryQuota" type="number" :step="0.001" />
</el-form-item>
+ <el-form-item label="鍚堟牸鐜�" prop="qualifiedRate">
+ <el-input v-model="formState.qualifiedRate" type="number" :step="0.01" />
+ </el-form-item>
<el-form-item label="鏄惁璐ㄦ" prop="isQuality">
<el-switch v-model="formState.isQuality" :active-value="true" inactive-value="false"/>
</el-form-item>
@@ -70,6 +73,7 @@
no: props.record.no,
remark: props.record.remark,
salaryQuota: props.record.salaryQuota,
+ qualifiedRate: props.record.qualifiedRate,
isQuality: props.record.isQuality,
});
@@ -91,7 +95,8 @@
no: newRecord.no || '',
remark: newRecord.remark || '',
salaryQuota: newRecord.salaryQuota || '',
- isQuality: props.record.isQuality,
+ qualifiedRate: newRecord.qualifiedRate || '',
+ isQuality: newRecord.isQuality,
};
}
}, { immediate: true, deep: true });
@@ -105,6 +110,7 @@
no: props.record.no || '',
remark: props.record.remark || '',
salaryQuota: props.record.salaryQuota || '',
+ qualifiedRate: props.record.qualifiedRate || '',
isQuality: props.record.isQuality,
};
}
diff --git a/src/views/productionManagement/productionProcess/New.vue b/src/views/productionManagement/productionProcess/New.vue
index 5443e8d..6dc6b5c 100644
--- a/src/views/productionManagement/productionProcess/New.vue
+++ b/src/views/productionManagement/productionProcess/New.vue
@@ -28,6 +28,9 @@
<el-form-item label="宸ヨ祫瀹氶" prop="salaryQuota">
<el-input v-model="formState.salaryQuota" type="number" :step="0.001" />
</el-form-item>
+ <el-form-item label="鍚堟牸鐜�" prop="qualifiedRate">
+ <el-input v-model="formState.qualifiedRate" type="number" :step="0.01" />
+ </el-form-item>
<el-form-item label="鏄惁璐ㄦ" prop="isQuality">
<el-switch v-model="formState.isQuality" :active-value="true" inactive-value="false"/>
</el-form-item>
@@ -63,6 +66,7 @@
name: '',
remark: '',
salaryQuota: '',
+ qualifiedRate: '',
isQuality: false,
});
diff --git a/src/views/productionManagement/productionProcess/index.vue b/src/views/productionManagement/productionProcess/index.vue
index 4f3f3ef..df847df 100644
--- a/src/views/productionManagement/productionProcess/index.vue
+++ b/src/views/productionManagement/productionProcess/index.vue
@@ -48,6 +48,50 @@
@pagination="pagination"
:total="page.total"></PIMTable>
</div>
+
+ <!-- 宸ュ簭鐢熶骇璁板綍鍒楄〃寮规 -->
+ <el-dialog v-model="isShowProcessParamModal"
+ title="鐢熶骇璁板綍"
+ width="800px">
+ <div style="text-align: right"
+ class="mb10">
+ <el-button type="primary"
+ @click="showSelectProductParamModal">鏂板</el-button>
+ <el-button type="danger"
+ plain
+ @click="handleDeleteProcessParam"
+ :disabled="processParamSelectedRows.length === 0">鎵归噺鍒犻櫎</el-button>
+ </div>
+ <PIMTable rowKey="id"
+ :column="processParamColumns"
+ :tableData="processParamTableData"
+ :page="processParamPage"
+ :isSelection="true"
+ @selection-change="handleProcessParamSelectionChange"
+ @pagination="processParamPagination"
+ :total="processParamPage.total"></PIMTable>
+ </el-dialog>
+
+ <!-- 閫夋嫨鐢熶骇璁板綍寮规 -->
+ <el-dialog v-model="isShowSelectParamModal"
+ title="閫夋嫨鐢熶骇璁板綍"
+ width="800px">
+ <PIMTable rowKey="id"
+ :column="productParamColumns"
+ :tableData="productParamTableData"
+ :page="productParamPage"
+ :isSelection="true"
+ @selection-change="handleProductParamSelectionChange"
+ @pagination="productParamPagination"
+ :total="productParamPage.total"></PIMTable>
+ <template #footer>
+ <div class="dialog-footer">
+ <el-button type="primary"
+ @click="handleAddProcessParam">纭畾</el-button>
+ <el-button @click="isShowSelectParamModal = false">鍙栨秷</el-button>
+ </div>
+ </template>
+ </el-dialog>
<new-process v-if="isShowNewModal"
v-model:visible="isShowNewModal"
@completed="getList" />
@@ -80,6 +124,12 @@
importData,
downloadTemplate,
} from "@/api/productionManagement/productionProcess.js";
+ import {
+ listPage as listProcessParamPage,
+ del as delProcessParam,
+ addProductProcessParameter,
+ } from "@/api/productionManagement/productProcessParameter.js";
+ import { listPage as listProductParamPage } from "@/api/productionManagement/productionRecords.js";
import { getToken } from "@/utils/auth";
const data = reactive({
@@ -101,6 +151,10 @@
{
label: "宸ヨ祫瀹氶",
prop: "salaryQuota",
+ },
+ {
+ label: "鍚堟牸鐜�",
+ prop: "qualifiedRate",
},
{
label: "鏄惁璐ㄦ",
@@ -125,6 +179,13 @@
width: 280,
operation: [
{
+ name: "鏌ョ湅",
+ type: "text",
+ clickFun: row => {
+ showProcessParamModal(row);
+ },
+ },
+ {
name: "缂栬緫",
type: "text",
clickFun: row => {
@@ -134,12 +195,59 @@
],
},
]);
+ // 宸ュ簭宸茬粦瀹氱殑鐢熶骇璁板綍鍒楄〃鍒楅厤缃�
+ const processParamColumns = ref([
+ { label: "鍙傛暟缂栫爜", prop: "code" },
+ { label: "鍙傛暟椤�", prop: "parameterItem" },
+ {
+ label: "鍙傛暟绫诲瀷",
+ prop: "type",
+ formatData: val => {
+ const dictList = (proxy.useDict && proxy.useDict("parameter_tyep")?.parameter_tyep) || [];
+ const list = dictList.value || dictList;
+ const hit = (list || []).find(d => d.value === val);
+ return hit ? hit.label : val;
+ },
+ },
+ { label: "鍗曚綅", prop: "unit" },
+ { label: "鍙傛暟鏍煎紡", prop: "parameterFormat" },
+ {
+ label: "鏄惁蹇呭~",
+ prop: "isRequired",
+ formatData: v => (v === "1" || v === 1 ? "鏄�" : "鍚�"),
+ },
+ ]);
+ // 鍙�夋嫨鐨勭敓浜ц褰曞垪琛ㄥ垪閰嶇疆
+ const productParamColumns = ref([
+ { label: "鍙傛暟缂栫爜", prop: "code" },
+ { label: "鍙傛暟椤�", prop: "parameterItem" },
+ {
+ label: "鍙傛暟绫诲瀷",
+ prop: "type",
+ formatData: val => {
+ const dictList = (proxy.useDict && proxy.useDict("parameter_tyep")?.parameter_tyep) || [];
+ const list = dictList.value || dictList;
+ const hit = (list || []).find(d => d.value === val);
+ return hit ? hit.label : val;
+ },
+ },
+ { label: "鍗曚綅", prop: "unit" },
+ { label: "鍙傛暟鏍煎紡", prop: "parameterFormat" },
+ {
+ label: "鏄惁蹇呭~",
+ prop: "isRequired",
+ formatData: v => (v === "1" || v === 1 ? "鏄�" : "鍚�"),
+ },
+ ]);
const tableData = ref([]);
const selectedRows = ref([]);
const tableLoading = ref(false);
const isShowNewModal = ref(false);
const isShowEditModal = ref(false);
+ const isShowProcessParamModal = ref(false);
+ const isShowSelectParamModal = ref(false);
const record = ref({});
+ const currentProcess = ref(null);
const importDialogVisible = ref(false);
const importDialogRef = ref(null);
const page = reactive({
@@ -147,6 +255,20 @@
size: 100,
total: 0,
});
+ const processParamPage = reactive({
+ current: 1,
+ size: 100,
+ total: 0,
+ });
+ const productParamPage = reactive({
+ current: 1,
+ size: 100,
+ total: 0,
+ });
+ const processParamTableData = ref([]);
+ const productParamTableData = ref([]);
+ const processParamSelectedRows = ref([]);
+ const productParamSelectedRows = ref([]);
const { proxy } = getCurrentInstance();
// 瀵煎叆鐩稿叧閰嶇疆
@@ -165,6 +287,16 @@
page.current = obj.page;
page.size = obj.limit;
getList();
+ };
+ const processParamPagination = obj => {
+ processParamPage.current = obj.page;
+ processParamPage.size = obj.limit;
+ getProcessParamList();
+ };
+ const productParamPagination = obj => {
+ productParamPage.current = obj.page;
+ productParamPage.size = obj.limit;
+ getProductParamList();
};
const getList = () => {
tableLoading.value = true;
@@ -187,6 +319,14 @@
selectedRows.value = selection;
};
+ const handleProcessParamSelectionChange = selection => {
+ processParamSelectedRows.value = selection;
+ };
+
+ const handleProductParamSelectionChange = selection => {
+ productParamSelectedRows.value = selection;
+ };
+
// 鎵撳紑鏂板寮规
const showNewModal = () => {
isShowNewModal.value = true;
@@ -197,6 +337,88 @@
record.value = row;
};
+ // 鏌ョ湅褰撳墠宸ュ簭鐨勭敓浜ц褰�
+ const showProcessParamModal = row => {
+ currentProcess.value = row;
+ isShowProcessParamModal.value = true;
+ processParamPage.current = 1;
+ getProcessParamList();
+ };
+
+ const getProcessParamList = () => {
+ if (!currentProcess.value) return;
+ const params = {
+ processId: currentProcess.value.id,
+ ...processParamPage,
+ };
+ listProcessParamPage(params).then(res => {
+ processParamTableData.value = res.data.records || [];
+ processParamPage.total = res.data.total || 0;
+ });
+ };
+
+ // 鍒犻櫎褰撳墠宸ュ簭缁戝畾鐨勭敓浜ц褰�
+ const handleDeleteProcessParam = () => {
+ const ids = processParamSelectedRows.value.map(item => item.id);
+ if (!ids.length) {
+ proxy.$modal.msgWarning("璇烽�夋嫨瑕佸垹闄ょ殑璁板綍");
+ return;
+ }
+ proxy.$modal
+ .confirm("鏄惁纭鍒犻櫎閫変腑鐨勭敓浜ц褰曪紵")
+ .then(() => delProcessParam(ids))
+ .then(() => {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ getProcessParamList();
+ })
+ .catch(() => {});
+ };
+
+ // 鎵撳紑閫夋嫨鐢熶骇璁板綍寮规
+ const showSelectProductParamModal = () => {
+ isShowSelectParamModal.value = true;
+ productParamPage.current = 1;
+ getProductParamList();
+ };
+
+ const getProductParamList = () => {
+ const params = {
+ ...productParamPage,
+ };
+ listProductParamPage(params).then(res => {
+ const records = res.data.records || [];
+ // 宸茬粦瀹氬埌褰撳墠宸ュ簭鐨勭敓浜ц褰曪紝涓嶅厑璁稿啀娆¢�夋嫨 -> 鏍规嵁鍙傛暟缂栫爜鎵撲笂 disabled 鏍囪
+ const boundCodeSet = new Set(
+ (processParamTableData.value || [])
+ .map(item => item.code ?? item.parameterCode)
+ .filter(code => !!code)
+ );
+ productParamTableData.value = records.map(item => ({
+ ...item,
+ disabled: item.code ? boundCodeSet.has(item.code) : false,
+ }));
+ productParamPage.total = res.data.total || 0;
+ });
+ };
+
+ // 纭缁欏綋鍓嶅伐搴忔柊澧炵敓浜ц褰�
+ const handleAddProcessParam = () => {
+ if (!currentProcess.value) return;
+ const selectedList = productParamSelectedRows.value || [];
+ if (!selectedList.length) {
+ proxy.$modal.msgWarning("璇烽�夋嫨瑕佺粦瀹氱殑鐢熶骇璁板綍");
+ return;
+ }
+ // processId 鏀惧湪璺緞閲岋紝body 鐩存帴浼犻�変腑鐨勭敓浜ц褰曟暟缁�
+ addProductProcessParameter(currentProcess.value.id, selectedList)
+ .then(() => {
+ proxy.$modal.msgSuccess("鏂板鎴愬姛");
+ isShowSelectParamModal.value = false;
+ getProcessParamList();
+ })
+ .catch(() => {});
+ };
+
// 鍒犻櫎
function handleDelete() {
const no = selectedRows.value.map(item => item.no);
--
Gitblit v1.9.3