From 4b64310ae6edb6db229d1c72d5484ff947fb360f Mon Sep 17 00:00:00 2001
From: chenhj <1263187585@qq.com>
Date: 星期三, 25 三月 2026 15:16:29 +0800
Subject: [PATCH] Merge branch 'dev_长治_健齿齿科器材' of http://114.132.189.42:9002/r/product-inventory-management into dev_长治_健齿齿科器材
---
src/views/productionManagement/productionProcess/index.vue | 427 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 425 insertions(+), 2 deletions(-)
diff --git a/src/views/productionManagement/productionProcess/index.vue b/src/views/productionManagement/productionProcess/index.vue
index 9761f25..a2d5572 100644
--- a/src/views/productionManagement/productionProcess/index.vue
+++ b/src/views/productionManagement/productionProcess/index.vue
@@ -48,6 +48,90 @@
@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>
+
+ <!-- 鏌ョ湅璁惧寮规 -->
+ <el-dialog v-model="isShowDeviceModal"
+ title="璁惧鍒楄〃"
+ width="900px">
+ <div style="text-align: right"
+ class="mb10">
+ <el-button type="primary"
+ @click="showAddDeviceModal">娣诲姞璁惧</el-button>
+ </div>
+ <PIMTable rowKey="id"
+ :column="deviceColumns"
+ :tableData="deviceTableData"
+ :page="devicePage"
+ :isSelection="false"
+ @pagination="devicePagination"
+ :total="devicePage.total"></PIMTable>
+ </el-dialog>
+
+ <!-- 娣诲姞璁惧寮规 -->
+ <el-dialog v-model="isShowSelectDeviceModal"
+ title="閫夋嫨璁惧"
+ width="900px">
+ <PIMTable rowKey="id"
+ :column="selectDeviceColumns"
+ :tableData="selectDeviceTableData"
+ :page="selectDevicePage"
+ :isSelection="true"
+ @selection-change="handleSelectDeviceChange"
+ @pagination="selectDevicePagination"
+ :total="selectDevicePage.total"></PIMTable>
+ <template #footer>
+ <div class="dialog-footer">
+ <el-button type="primary"
+ @click="handleBindDevices">纭畾</el-button>
+ <el-button @click="isShowSelectDeviceModal = false">鍙栨秷</el-button>
+ </div>
+ </template>
+ </el-dialog>
+
<new-process v-if="isShowNewModal"
v-model:visible="isShowNewModal"
@completed="getList" />
@@ -79,7 +163,17 @@
del,
importData,
downloadTemplate,
+ getBindDevices,
+ bindDevices,
+ unbindDevice,
} 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 { getLedgerPage } from "@/api/equipmentManagement/ledger.js";
import { getToken } from "@/utils/auth";
const data = reactive({
@@ -126,8 +220,22 @@
label: "鎿嶄綔",
align: "center",
fixed: "right",
- width: 280,
+ width: 350,
operation: [
+ {
+ name: "鐢熶骇鍙傛暟",
+ type: "text",
+ clickFun: row => {
+ showProcessParamModal(row);
+ },
+ },
+ {
+ name: "鏌ョ湅璁惧",
+ type: "text",
+ clickFun: row => {
+ showDeviceModal(row);
+ },
+ },
{
name: "缂栬緫",
type: "text",
@@ -138,15 +246,129 @@
],
},
]);
+ // 宸ュ簭宸茬粦瀹氱殑鐢熶骇璁板綍鍒楄〃鍒楅厤缃�
+ 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 deviceColumns = ref([
+ { label: "璁惧缂栧彿", prop: "deviceCode" },
+ { label: "璁惧鍚嶇О", prop: "deviceName" },
+ { label: "瑙勬牸鍨嬪彿", prop: "deviceModel" },
+ { label: "璁惧鍝佺墝", prop: "deviceBrand" },
+ { label: "璁惧绫诲瀷", prop: "type" },
+ { label: "渚涘簲鍟�", prop: "supplierName" },
+ {
+ dataType: "action",
+ label: "鎿嶄綔",
+ align: "center",
+ width: 100,
+ operation: [
+ {
+ name: "鍒犻櫎",
+ type: "text",
+ typeAttrs: { danger: true },
+ clickFun: row => {
+ handleUnbindDevice(row);
+ },
+ },
+ ],
+ },
+ ]);
+
+ // 鍙�夎澶囧垪琛ㄥ垪閰嶇疆
+ const selectDeviceColumns = ref([
+ { label: "璁惧缂栧彿", prop: "deviceCode" },
+ { label: "璁惧鍚嶇О", prop: "deviceName" },
+ { label: "瑙勬牸鍨嬪彿", prop: "deviceModel" },
+ { label: "璁惧鍝佺墝", prop: "deviceBrand" },
+ { label: "璁惧绫诲瀷", prop: "type" },
+ { label: "渚涘簲鍟�", prop: "supplierName" },
+ ]);
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({
+ current: 1,
+ 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 isShowDeviceModal = ref(false);
+ const isShowSelectDeviceModal = ref(false);
+ const deviceTableData = ref([]);
+ const selectDeviceTableData = ref([]);
+ const selectedDeviceRows = ref([]);
+ const devicePage = reactive({
+ current: 1,
+ size: 100,
+ total: 0,
+ });
+ const selectDevicePage = reactive({
current: 1,
size: 100,
total: 0,
@@ -170,6 +392,16 @@
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;
const params = { ...searchForm.value, ...page };
@@ -179,7 +411,7 @@
tableLoading.value = false;
tableData.value = res.data.records.map(item => ({
...item,
- typeText: item.type ? (item.type === 0 ? "璁℃椂" : "璁′欢") : "",
+ typeText: item.type !== undefined && item.type !== null ? (item.type === 0 ? "璁℃椂" : "璁′欢") : "",
}));
page.total = res.data.total;
})
@@ -192,6 +424,14 @@
selectedRows.value = selection;
};
+ const handleProcessParamSelectionChange = selection => {
+ processParamSelectedRows.value = selection;
+ };
+
+ const handleProductParamSelectionChange = selection => {
+ productParamSelectedRows.value = selection;
+ };
+
// 鎵撳紑鏂板寮规
const showNewModal = () => {
isShowNewModal.value = true;
@@ -202,6 +442,189 @@
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(() => {});
+ };
+
+ // 鏌ョ湅璁惧寮规
+ const showDeviceModal = row => {
+ currentProcess.value = row;
+ isShowDeviceModal.value = true;
+ devicePage.current = 1;
+ getDeviceList();
+ };
+
+ // 鑾峰彇宸茬粦瀹氱殑璁惧鍒楄〃
+ const getDeviceList = () => {
+ if (!currentProcess.value) return;
+ getBindDevices(currentProcess.value.id)
+ .then(res => {
+ deviceTableData.value = res.data || [];
+ devicePage.total = res.data?.length || 0;
+ })
+ .catch(() => {});
+ };
+
+ // 璁惧鍒楄〃鍒嗛〉
+ const devicePagination = obj => {
+ devicePage.current = obj.page;
+ devicePage.size = obj.limit;
+ getDeviceList();
+ };
+
+ // 瑙g粦璁惧
+ const handleUnbindDevice = row => {
+ if (!currentProcess.value) return;
+ proxy.$modal.confirm("鏄惁纭瑙g粦璇ヨ澶囷紵")
+ .then(() => {
+ return unbindDevice(currentProcess.value.id, row.id);
+ })
+ .then(() => {
+ proxy.$modal.msgSuccess("瑙g粦鎴愬姛");
+ getDeviceList();
+ })
+ .catch(() => {});
+ };
+
+ // 鎵撳紑娣诲姞璁惧寮规
+ const showAddDeviceModal = () => {
+ isShowSelectDeviceModal.value = true;
+ selectDevicePage.current = 1;
+ selectedDeviceRows.value = [];
+ getSelectDeviceList();
+ };
+
+ // 鑾峰彇鍙�夎澶囧垪琛�
+ const getSelectDeviceList = () => {
+ if (!currentProcess.value) return;
+ // 鍏堣幏鍙栧凡缁戝畾鐨勮澶嘔D
+ getBindDevices(currentProcess.value.id)
+ .then(res => {
+ const boundDeviceIds = new Set(
+ (res.data || []).map(item => item.id).filter(id => !!id)
+ );
+ // 鑾峰彇璁惧鍙拌处鍒嗛〉鍒楄〃
+ return getLedgerPage(selectDevicePage).then(deviceRes => {
+ const allDevices = deviceRes.data?.records || [];
+ // 杩囨护鎺夊凡缁戝畾鐨勮澶囷紝骞舵爣璁颁负disabled
+ selectDeviceTableData.value = allDevices.map(item => ({
+ ...item,
+ disabled: boundDeviceIds.has(item.id),
+ }));
+ selectDevicePage.total = deviceRes.data?.total || 0;
+ });
+ })
+ .catch(() => {});
+ };
+
+ // 閫夋嫨璁惧鍙樺寲
+ const handleSelectDeviceChange = selection => {
+ selectedDeviceRows.value = selection;
+ };
+
+ // 閫夋嫨璁惧鍒嗛〉
+ const selectDevicePagination = obj => {
+ selectDevicePage.current = obj.page;
+ selectDevicePage.size = obj.limit;
+ getSelectDeviceList();
+ };
+
+ // 缁戝畾璁惧
+ const handleBindDevices = () => {
+ if (!currentProcess.value) return;
+ const selectedList = selectedDeviceRows.value || [];
+ if (!selectedList.length) {
+ proxy.$modal.msgWarning("璇烽�夋嫨瑕佺粦瀹氱殑璁惧");
+ return;
+ }
+ const deviceIds = selectedList.map(item => item.id);
+ bindDevices(currentProcess.value.id, deviceIds)
+ .then(() => {
+ proxy.$modal.msgSuccess("缁戝畾鎴愬姛");
+ isShowSelectDeviceModal.value = false;
+ getDeviceList();
+ })
+ .catch(() => {});
+ };
+
// 鍒犻櫎
function handleDelete() {
const no = selectedRows.value.map(item => item.no);
--
Gitblit v1.9.3