From 4acf9156ee445cb9f2367d77824e1c6e25b397ab Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期六, 14 三月 2026 10:52:45 +0800
Subject: [PATCH] 工序和公益路线页面开发
---
src/views/productionManagement/productionProcess/index.vue | 1191 +++++++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 943 insertions(+), 248 deletions(-)
diff --git a/src/views/productionManagement/productionProcess/index.vue b/src/views/productionManagement/productionProcess/index.vue
index 7ab8c9a..5ecb747 100644
--- a/src/views/productionManagement/productionProcess/index.vue
+++ b/src/views/productionManagement/productionProcess/index.vue
@@ -1,302 +1,997 @@
<template>
<div class="app-container">
- <div class="search_form">
- <el-form :model="searchForm"
- :inline="true">
- <el-form-item label="宸ュ簭鍚嶇О:">
- <el-input v-model="searchForm.name"
- placeholder="璇疯緭鍏�"
- clearable
- prefix-icon="Search"
- style="width: 200px;"
- @change="handleQuery" />
- </el-form-item>
- <el-form-item label="宸ュ簭缂栧彿:">
- <el-input v-model="searchForm.no"
- placeholder="璇疯緭鍏�"
- clearable
- prefix-icon="Search"
- style="width: 200px;"
- @change="handleQuery" />
- </el-form-item>
- <el-form-item>
+ <div class="process-config-container">
+ <!-- 宸︿晶宸ュ簭鍒楄〃 -->
+ <div class="process-list-section">
+ <div class="section-header">
+ <h3 class="section-title">宸ュ簭鍒楄〃</h3>
<el-button type="primary"
- @click="handleQuery">鎼滅储</el-button>
+ size="small"
+ @click="handleAddProcess">
+ <el-icon>
+ <Plus />
+ </el-icon>鏂板宸ュ簭
+ </el-button>
+ </div>
+ <div class="process-card-list">
+ <div v-for="process in processList"
+ :key="process.id"
+ class="process-card"
+ :class="{ active: selectedProcess?.id === process.id }"
+ @click="selectProcess(process)">
+ <div class="card-header">
+ <span class="process-code">{{ process.processCode }}</span>
+ <div class="card-actions">
+ <el-button link
+ type="primary"
+ @click.stop="handleEditProcess(process)">
+ <el-icon>
+ <Edit />
+ </el-icon>
+ 缂栬緫
+ </el-button>
+ <el-button link
+ type="danger"
+ @click.stop="handleDeleteProcess(process)">
+ <el-icon>
+ <Delete />
+ </el-icon>
+ 鍒犻櫎
+ </el-button>
+ </div>
+ </div>
+ <div class="card-body">
+ <div class="process-name">{{ process.processName }}</div>
+ <div class="process-desc">{{ process.processDesc || '鏆傛棤鎻忚堪' }}</div>
+ </div>
+ <div class="card-footer">
+ <el-tag size="small"
+ :type="process.status === '1' ? 'success' : 'info'">
+ {{ process.status === '1' ? '鍚敤' : '鍋滅敤' }}
+ </el-tag>
+ <span class="param-count">鍙傛暟: {{ process.paramCount || 0 }}涓�</span>
+ </div>
+ </div>
+ </div>
+ </div>
+ <!-- 鍙充晶鍙傛暟鍒楄〃 -->
+ <div class="param-list-section">
+ <div class="section-header">
+ <h3 class="section-title">
+ {{ selectedProcess ? selectedProcess.processName + ' - 鍙傛暟閰嶇疆' : '璇烽�夋嫨宸ュ簭' }}
+ </h3>
+ <el-button type="primary"
+ size="small"
+ :disabled="!selectedProcess"
+ @click="handleSelectParam">
+ <el-icon>
+ <Plus />
+ </el-icon>閫夋嫨鍙傛暟
+ </el-button>
+ </div>
+ <div class="param-table-wrapper">
+ <PIMTable v-if="selectedProcess"
+ rowKey="id"
+ :column="paramColumn"
+ :tableData="paramList"
+ :page="paramPage"
+ height="calc(100vh - 280px)"
+ :tableLoading="paramLoading"
+ :isSelection="false"
+ @pagination="handleParamPagination" />
+ <div v-else
+ class="empty-tip">
+ <el-empty description="璇蜂粠宸︿晶閫夋嫨涓�涓伐搴�" />
+ </div>
+ </div>
+ </div>
+ </div>
+ <!-- 宸ュ簭鏂板/缂栬緫瀵硅瘽妗� -->
+ <el-dialog v-model="processDialogVisible"
+ :title="isProcessEdit ? '缂栬緫宸ュ簭' : '鏂板宸ュ簭'"
+ width="500px">
+ <el-form :model="processForm"
+ :rules="processRules"
+ ref="processFormRef"
+ label-width="100px">
+ <el-form-item label="宸ュ簭缂栫爜"
+ prop="processCode">
+ <el-input v-model="processForm.processCode"
+ placeholder="璇疯緭鍏ュ伐搴忕紪鐮�" />
+ </el-form-item>
+ <el-form-item label="宸ュ簭鍚嶇О"
+ prop="processName">
+ <el-input v-model="processForm.processName"
+ placeholder="璇疯緭鍏ュ伐搴忓悕绉�" />
+ </el-form-item>
+ <el-form-item label="宸ュ簭鎻忚堪"
+ prop="processDesc">
+ <el-input v-model="processForm.processDesc"
+ type="textarea"
+ :rows="3"
+ placeholder="璇疯緭鍏ュ伐搴忔弿杩�" />
+ </el-form-item>
+ <el-form-item label="鐘舵��"
+ prop="status">
+ <el-radio-group v-model="processForm.status">
+ <el-radio label="1">鍚敤</el-radio>
+ <el-radio label="0">鍋滅敤</el-radio>
+ </el-radio-group>
</el-form-item>
</el-form>
- </div>
- <div class="table_list">
- <div style="text-align: right"
- class="mb10">
- <el-button type="primary"
- @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>
+ <template #footer>
+ <span class="dialog-footer">
+ <el-button @click="processDialogVisible = false">鍙栨秷</el-button>
+ <el-button type="primary"
+ @click="handleProcessSubmit">纭畾</el-button>
+ </span>
+ </template>
+ </el-dialog>
+ <!-- 閫夋嫨鍙傛暟瀵硅瘽妗� -->
+ <el-dialog v-model="paramDialogVisible"
+ title="閫夋嫨鍙傛暟"
+ width="1000px">
+ <div class="param-select-container">
+ <!-- 宸︿晶鍙傛暟鍒楄〃 -->
+ <div class="param-list-area">
+ <div class="area-title">鍙�夊弬鏁�</div>
+ <div class="search-box">
+ <el-input v-model="paramSearchKeyword"
+ placeholder="璇疯緭鍏ュ弬鏁板悕绉版悳绱�"
+ clearable
+ size="small"
+ @input="handleParamSearch">
+ <template #prefix>
+ <el-icon>
+ <Search />
+ </el-icon>
+ </template>
+ </el-input>
+ </div>
+ <el-table :data="filteredParamList"
+ height="360"
+ border
+ highlight-current-row
+ @current-change="handleParamSelect">
+ <el-table-column prop="parameterCode"
+ label="鍙傛暟缂栧彿"
+ width="100" />
+ <el-table-column prop="parameterName"
+ label="鍙傛暟鍚嶇О" />
+ <el-table-column prop="parameterType"
+ label="鍙傛暟绫诲瀷"
+ width="100">
+ <template #default="scope">
+ <el-tag size="small"
+ :type="getParamTypeTag(scope.row.parameterType)">
+ {{ scope.row.parameterType }}
+ </el-tag>
+ </template>
+ </el-table-column>
+ </el-table>
+ </div>
+ <!-- 鍙充晶鍙傛暟璇︽儏 -->
+ <div class="param-detail-area">
+ <div class="area-title">鍙傛暟璇︽儏</div>
+ <el-form v-if="selectedParam"
+ :model="selectedParam"
+ label-width="100px"
+ class="param-detail-form">
+ <el-form-item label="鍙傛暟缂栧彿">
+ <span class="detail-text">{{ selectedParam.parameterCode }}</span>
+ </el-form-item>
+ <el-form-item label="鍙傛暟鍚嶇О">
+ <span class="detail-text">{{ selectedParam.parameterName }}</span>
+ </el-form-item>
+ <el-form-item label="鍙傛暟妯″紡">
+ <el-tag size="small"
+ :type="selectedParam.parameterType2 === '1' ? 'success' : 'warning'">
+ {{ selectedParam.parameterType2 === '1' ? '鍗曞��' : '鍖洪棿' }}
+ </el-tag>
+ </el-form-item>
+ <el-form-item label="鍙傛暟绫诲瀷">
+ <el-tag size="small"
+ :type="getParamTypeTag(selectedParam.parameterType)">
+ {{ selectedParam.parameterType }}
+ </el-tag>
+ </el-form-item>
+ <el-form-item label="鍙傛暟鏍煎紡">
+ <span class="detail-text">{{ selectedParam.parameterFormat || '-' }}</span>
+ </el-form-item>
+ <el-form-item label="鏍囧噯鍊�">
+ <span class="detail-text">{{ selectedParam.standardValue }}</span>
+ </el-form-item>
+ <el-form-item label="鍗曚綅">
+ <span class="detail-text">{{ selectedParam.unit || '-' }}</span>
+ </el-form-item>
+ </el-form>
+ <el-empty v-else
+ description="璇蜂粠宸︿晶閫夋嫨鍙傛暟" />
+ </div>
</div>
- <PIMTable rowKey="id"
- :column="tableColumn"
- :tableData="tableData"
- :page="page"
- :isSelection="true"
- @selection-change="handleSelectionChange"
- :tableLoading="tableLoading"
- @pagination="pagination"
- :total="page.total"></PIMTable>
- </div>
- <new-process v-if="isShowNewModal"
- v-model:visible="isShowNewModal"
- @completed="getList" />
- <edit-process v-if="isShowEditModal"
- v-model:visible="isShowEditModal"
- :record="record"
- @completed="getList" />
- <ImportDialog
- ref="importDialogRef"
- v-model="importDialogVisible"
- title="瀵煎叆宸ュ簭"
- :action="importAction"
- :headers="importHeaders"
- :auto-upload="false"
- :on-success="handleImportSuccess"
- :on-error="handleImportError"
- @confirm="handleImportConfirm"
- @download-template="handleDownloadTemplate"
- @close="handleImportClose"
- />
+ <template #footer>
+ <span class="dialog-footer">
+ <el-button @click="paramDialogVisible = false">鍙栨秷</el-button>
+ <el-button type="primary"
+ :disabled="!selectedParam"
+ @click="handleParamSubmit">纭畾</el-button>
+ </span>
+ </template>
+ </el-dialog>
</div>
</template>
<script setup>
- 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 ImportDialog from "@/components/Dialog/ImportDialog.vue";
- import { listPage, del, importData, downloadTemplate } from "@/api/productionManagement/productionProcess.js";
- import { getToken } from "@/utils/auth";
+ import { ref, reactive, onMounted } from "vue";
+ import { ElMessage, ElMessageBox } from "element-plus";
+ import { Plus, Edit, Delete, Search } from "@element-plus/icons-vue";
+ import PIMTable from "@/components/PIMTable/PIMTable.vue";
+ import { listType } from "@/api/system/dict/type";
- const data = reactive({
- searchForm: {
- name: "",
- no: "",
- },
+ // 宸ュ簭鍒楄〃鏁版嵁
+ const processList = ref([]);
+ const selectedProcess = ref(null);
+ const processLoading = ref(false);
+
+ // 鍙傛暟鍒楄〃鏁版嵁
+ const paramList = ref([]);
+ const paramLoading = ref(false);
+ const paramPage = reactive({
+ current: 1,
+ size: 10,
+ total: 0,
});
- const { searchForm } = toRefs(data);
- const tableColumn = ref([
+
+ // 鏁版嵁瀛楀吀
+ const dictTypes = ref([]);
+
+ // 宸ュ簭瀵硅瘽妗�
+ const processDialogVisible = ref(false);
+ const isProcessEdit = ref(false);
+ const processFormRef = ref(null);
+ const processForm = reactive({
+ id: null,
+ processCode: "",
+ processName: "",
+ processDesc: "",
+ status: "1",
+ });
+ const processRules = {
+ processCode: [{ required: true, message: "璇疯緭鍏ュ伐搴忕紪鐮�", trigger: "blur" }],
+ processName: [{ required: true, message: "璇疯緭鍏ュ伐搴忓悕绉�", trigger: "blur" }],
+ };
+
+ // 鍙傛暟瀵硅瘽妗�
+ const paramDialogVisible = ref(false);
+ const availableParamList = ref([]);
+ const filteredParamList = ref([]);
+ const selectedParam = ref(null);
+ const paramSearchKeyword = ref("");
+
+ // 鍙傛暟琛ㄦ牸鍒楅厤缃�
+ const paramColumn = ref([
{
- label: "宸ュ簭缂栧彿",
- prop: "no",
+ label: "鍙傛暟缂栧彿",
+ prop: "parameterCode",
+ className: "code-cell",
},
{
- label: "宸ュ簭鍚嶇О",
- prop: "name",
- },
-
- {
- label: "宸ヨ祫瀹氶",
- prop: "salaryQuota",
+ label: "鍙傛暟鍚嶇О",
+ prop: "parameterName",
},
{
- label: "澶囨敞",
- prop: "remark",
- },
- {
- label: "鏇存柊鏃堕棿",
- prop: "updateTime",
+ label: "鍙傛暟妯″紡",
+ prop: "parameterType2",
+ dataType: "tag",
+ formatType: row => (row.parameterType2 === "1" ? "success" : "warning"),
+ formatData: row => (row.parameterType2 === "1" ? "鍗曞��" : "鍖洪棿"),
},
{
- dataType: "action",
+ label: "鍙傛暟绫诲瀷",
+ prop: "parameterType",
+ dataType: "tag",
+ formatType: row => {
+ const typeMap = {
+ 鏁板�兼牸寮�: "primary",
+ 鏂囨湰鏍煎紡: "info",
+ 涓嬫媺閫夐」: "warning",
+ 鏃堕棿鏍煎紡: "success",
+ };
+ return typeMap[row.parameterType] || "default";
+ },
+ },
+ {
+ label: "鍙傛暟鏍煎紡",
+ prop: "parameterFormat",
+ },
+ {
+ label: "鏍囧噯鍊�",
+ prop: "standardValue",
+ className: row => (row.parameterType === "鏁板�兼牸寮�" ? "quantity-cell" : ""),
+ },
+ {
+ label: "鍗曚綅",
+ prop: "unit",
+ },
+ {
label: "鎿嶄綔",
- align: "center",
- fixed: "right",
- width: 280,
+ dataType: "action",
+ width: "100",
operation: [
{
- name: "缂栬緫",
- type: "text",
- clickFun: row => {
- showEditModal(row);
- },
+ name: "鍒犻櫎",
+ clickFun: row => handleDeleteParam(row),
},
],
},
]);
- const tableData = ref([]);
- const selectedRows = ref([]);
- const tableLoading = ref(false);
- const isShowNewModal = ref(false);
- const isShowEditModal = ref(false);
- const record = ref({});
- const importDialogVisible = 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() };
- // 鏌ヨ鍒楄〃
- /** 鎼滅储鎸夐挳鎿嶄綔 */
- const handleQuery = () => {
- page.current = 1;
- getList();
+ // 鑾峰彇宸ュ簭鍒楄〃
+ const getProcessList = () => {
+ // 鍋囨暟鎹�
+ processList.value = [
+ {
+ id: 1,
+ processCode: "PROC001",
+ processName: "鍘熸枡閰嶆瘮",
+ processDesc: "鍘熸潗鏂欓厤姣斿伐搴�",
+ status: "1",
+ paramCount: 3,
+ },
+ {
+ id: 2,
+ processCode: "PROC002",
+ processName: "鎼呮媽娣峰悎",
+ processDesc: "鎼呮媽娣峰悎宸ュ簭",
+ status: "1",
+ paramCount: 2,
+ },
+ {
+ id: 3,
+ processCode: "PROC003",
+ processName: "娴囩瓚鎴愬瀷",
+ processDesc: "娴囩瓚鎴愬瀷宸ュ簭",
+ status: "1",
+ paramCount: 4,
+ },
+ {
+ id: 4,
+ processCode: "PROC004",
+ processName: "钂稿帇鍏绘姢",
+ processDesc: "钂稿帇鍏绘姢宸ュ簭",
+ status: "0",
+ paramCount: 2,
+ },
+ {
+ id: 5,
+ processCode: "PROC005",
+ processName: "鍒囧壊鍔犲伐",
+ processDesc: "鍒囧壊鍔犲伐宸ュ簭",
+ status: "1",
+ paramCount: 3,
+ },
+ ];
};
- const pagination = obj => {
- page.current = obj.page;
- page.size = obj.limit;
- getList();
- };
- const getList = () => {
- tableLoading.value = true;
- const params = { ...searchForm.value, ...page };
- params.entryDate = undefined;
- listPage(params)
- .then(res => {
- tableLoading.value = false;
- tableData.value = res.data.records.map(item => ({
- ...item,
- }));
- page.total = res.data.total;
- })
- .catch(err => {
- tableLoading.value = false;
- });
- };
- // 琛ㄦ牸閫夋嫨鏁版嵁
- const handleSelectionChange = selection => {
- selectedRows.value = selection;
+ // 鑾峰彇鍙傛暟鍒楄〃
+ const getParamList = processId => {
+ paramLoading.value = true;
+ // 鍋囨暟鎹�
+ setTimeout(() => {
+ paramLoading.value = false;
+ const mockData = {
+ 1: [
+ {
+ id: 1,
+ parameterCode: "P001",
+ parameterName: "姘存偿姣斾緥",
+ parameterType2: "1",
+ parameterType: "鏁板�兼牸寮�",
+ parameterFormat: "",
+ standardValue: "30",
+ unit: "%",
+ },
+ {
+ id: 2,
+ parameterCode: "P002",
+ parameterName: "鐮傛瘮渚�",
+ parameterType2: "1",
+ parameterType: "鏁板�兼牸寮�",
+ parameterFormat: "",
+ standardValue: "60",
+ unit: "%",
+ },
+ {
+ id: 3,
+ parameterCode: "P003",
+ parameterName: "姘存瘮渚�",
+ parameterType2: "1",
+ parameterType: "鏁板�兼牸寮�",
+ parameterFormat: "",
+ standardValue: "10",
+ unit: "%",
+ },
+ ],
+ 2: [
+ {
+ id: 4,
+ parameterCode: "P004",
+ parameterName: "鎼呮媽鏃堕棿",
+ parameterType2: "1",
+ parameterType: "鏁板�兼牸寮�",
+ parameterFormat: "",
+ standardValue: "5",
+ unit: "鍒嗛挓",
+ },
+ {
+ id: 5,
+ parameterCode: "P005",
+ parameterName: "鎼呮媽閫熷害",
+ parameterType2: "2",
+ parameterType: "鏁板�兼牸寮�",
+ parameterFormat: "",
+ standardValue: "100-200",
+ unit: "rpm",
+ },
+ ],
+ 3: [
+ {
+ id: 6,
+ parameterCode: "P006",
+ parameterName: "娴囩瓚娓╁害",
+ parameterType2: "2",
+ parameterType: "鏁板�兼牸寮�",
+ parameterFormat: "",
+ standardValue: "20-30",
+ unit: "鈩�",
+ },
+ {
+ id: 7,
+ parameterCode: "P007",
+ parameterName: "娴囩瓚鍘嬪姏",
+ parameterType2: "1",
+ parameterType: "鏁板�兼牸寮�",
+ parameterFormat: "",
+ standardValue: "0.5",
+ unit: "MPa",
+ },
+ {
+ id: 8,
+ parameterCode: "P008",
+ parameterName: "鎴愬瀷鐘舵��",
+ parameterType2: "1",
+ parameterType: "涓嬫媺閫夐」",
+ parameterFormat: "status",
+ standardValue: "姝e父",
+ unit: "",
+ },
+ {
+ id: 9,
+ parameterCode: "P009",
+ parameterName: "鎴愬瀷鏃堕棿",
+ parameterType2: "1",
+ parameterType: "鏃堕棿鏍煎紡",
+ parameterFormat: "YYYY-MM-DD HH:mm:ss",
+ standardValue: "2024-01-01 08:00:00",
+ unit: "",
+ },
+ ],
+ 4: [
+ {
+ id: 10,
+ parameterCode: "P010",
+ parameterName: "钂稿帇娓╁害",
+ parameterType2: "2",
+ parameterType: "鏁板�兼牸寮�",
+ parameterFormat: "",
+ standardValue: "180-200",
+ unit: "鈩�",
+ },
+ {
+ id: 11,
+ parameterCode: "P011",
+ parameterName: "钂稿帇鍘嬪姏",
+ parameterType2: "1",
+ parameterType: "鏁板�兼牸寮�",
+ parameterFormat: "",
+ standardValue: "1.2",
+ unit: "MPa",
+ },
+ ],
+ 5: [
+ {
+ id: 12,
+ parameterCode: "P012",
+ parameterName: "鍒囧壊灏哄",
+ parameterType2: "1",
+ parameterType: "鏂囨湰鏍煎紡",
+ parameterFormat: "",
+ standardValue: "600x200x100",
+ unit: "mm",
+ },
+ {
+ id: 13,
+ parameterCode: "P013",
+ parameterName: "鍒囧壊绮惧害",
+ parameterType2: "1",
+ parameterType: "鏁板�兼牸寮�",
+ parameterFormat: "",
+ standardValue: "卤1",
+ unit: "mm",
+ },
+ {
+ id: 14,
+ parameterCode: "P014",
+ parameterName: "鍒囧壊閫熷害",
+ parameterType2: "1",
+ parameterType: "鏁板�兼牸寮�",
+ parameterFormat: "",
+ standardValue: "2",
+ unit: "m/min",
+ },
+ ],
+ };
+ paramList.value = mockData[processId] || [];
+ paramPage.total = paramList.value.length;
+ }, 300);
};
- // 鎵撳紑鏂板寮规
- const showNewModal = () => {
- isShowNewModal.value = true;
+ // 閫夋嫨宸ュ簭
+ const selectProcess = process => {
+ selectedProcess.value = process;
+ getParamList(process.id);
};
- const showEditModal = row => {
- isShowEditModal.value = true;
- record.value = row;
+ // 宸ュ簭鎿嶄綔
+ const handleAddProcess = () => {
+ isProcessEdit.value = false;
+ processForm.id = null;
+ processForm.processCode = "";
+ processForm.processName = "";
+ processForm.processDesc = "";
+ processForm.status = "1";
+ processDialogVisible.value = true;
};
- // 鍒犻櫎
- function handleDelete() {
- const no = selectedRows.value.map(item => item.no);
- const ids = selectedRows.value.map(item => item.id);
- if (no.length > 2) {
- proxy.$modal
- .confirm(
- '鏄惁纭鍒犻櫎宸ュ簭缂栧彿涓�"' +
- no[0] +
- "銆�" +
- no[1] +
- '"绛�' +
- no.length +
- "鏉℃暟鎹」锛�"
- )
- .then(function () {
- return del(ids);
- })
- .then(() => {
- getList();
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
- })
- .catch(() => {});
- } else {
- proxy.$modal
- .confirm('鏄惁纭鍒犻櫎宸ュ簭缂栧彿涓�"' + no + '"鐨勬暟鎹」锛�')
- .then(function () {
- return del(ids);
- })
- .then(() => {
- getList();
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
- })
- .catch(() => {});
- }
- }
-
- // 瀵煎叆
- const handleImport = () => {
- importDialogVisible.value = true;
+ const handleEditProcess = process => {
+ isProcessEdit.value = true;
+ processForm.id = process.id;
+ processForm.processCode = process.processCode;
+ processForm.processName = process.processName;
+ processForm.processDesc = process.processDesc;
+ processForm.status = process.status;
+ processDialogVisible.value = true;
};
- // 纭瀵煎叆
- const handleImportConfirm = () => {
- if (importDialogRef.value) {
- importDialogRef.value.submit();
- }
- };
-
- // 瀵煎叆鎴愬姛
- const handleImportSuccess = (response) => {
- if (response.code === 200) {
- proxy.$modal.msgSuccess("瀵煎叆鎴愬姛");
- importDialogVisible.value = false;
- if (importDialogRef.value) {
- importDialogRef.value.clearFiles();
+ const handleDeleteProcess = process => {
+ ElMessageBox.confirm("纭畾瑕佸垹闄よ宸ュ簭鍚楋紵", "鎻愮ず", {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ }).then(() => {
+ ElMessage.success("鍒犻櫎鎴愬姛");
+ getProcessList();
+ if (selectedProcess.value?.id === process.id) {
+ selectedProcess.value = null;
+ paramList.value = [];
}
- getList();
+ });
+ };
+
+ const handleProcessSubmit = () => {
+ processFormRef.value.validate(valid => {
+ if (valid) {
+ ElMessage.success(isProcessEdit.value ? "缂栬緫鎴愬姛" : "鏂板鎴愬姛");
+ processDialogVisible.value = false;
+ getProcessList();
+ }
+ });
+ };
+
+ // 鍙傛暟鎿嶄綔
+ const handleSelectParam = () => {
+ if (!selectedProcess.value) {
+ ElMessage.warning("璇峰厛閫夋嫨涓�涓伐搴�");
+ return;
+ }
+ // 鑾峰彇鍙�夊弬鏁板垪琛紙鍋囨暟鎹級
+ availableParamList.value = [
+ {
+ id: 101,
+ parameterCode: "P101",
+ parameterName: "娓╁害",
+ parameterType2: "2",
+ parameterType: "鏁板�兼牸寮�",
+ parameterFormat: "",
+ standardValue: "20-30",
+ unit: "鈩�",
+ },
+ {
+ id: 102,
+ parameterCode: "P102",
+ parameterName: "鍘嬪姏",
+ parameterType2: "1",
+ parameterType: "鏁板�兼牸寮�",
+ parameterFormat: "",
+ standardValue: "0.5",
+ unit: "MPa",
+ },
+ {
+ id: 103,
+ parameterCode: "P103",
+ parameterName: "婀垮害",
+ parameterType2: "2",
+ parameterType: "鏁板�兼牸寮�",
+ parameterFormat: "",
+ standardValue: "40-60",
+ unit: "%",
+ },
+ {
+ id: 104,
+ parameterCode: "P104",
+ parameterName: "閫熷害",
+ parameterType2: "1",
+ parameterType: "鏁板�兼牸寮�",
+ parameterFormat: "",
+ standardValue: "100",
+ unit: "m/min",
+ },
+ {
+ id: 105,
+ parameterCode: "P105",
+ parameterName: "鐘舵��",
+ parameterType2: "1",
+ parameterType: "涓嬫媺閫夐」",
+ parameterFormat: "status",
+ standardValue: "姝e父",
+ unit: "",
+ },
+ {
+ id: 106,
+ parameterCode: "P106",
+ parameterName: "璁板綍鏃堕棿",
+ parameterType2: "1",
+ parameterType: "鏃堕棿鏍煎紡",
+ parameterFormat: "YYYY-MM-DD HH:mm:ss",
+ standardValue: "2024-01-01 08:00:00",
+ unit: "",
+ },
+ {
+ id: 107,
+ parameterCode: "P107",
+ parameterName: "澶囨敞",
+ parameterType2: "1",
+ parameterType: "鏂囨湰鏍煎紡",
+ parameterFormat: "",
+ standardValue: "鏃�",
+ unit: "",
+ },
+ ];
+ filteredParamList.value = availableParamList.value;
+ paramSearchKeyword.value = "";
+ selectedParam.value = null;
+ paramDialogVisible.value = true;
+ };
+
+ const handleParamSelect = row => {
+ selectedParam.value = row;
+ };
+
+ const handleParamSearch = () => {
+ const keyword = paramSearchKeyword.value.trim().toLowerCase();
+ if (!keyword) {
+ filteredParamList.value = availableParamList.value;
} else {
- proxy.$modal.msgError(response.msg || "瀵煎叆澶辫触");
+ filteredParamList.value = availableParamList.value.filter(item =>
+ item.parameterName.toLowerCase().includes(keyword)
+ );
}
};
- // 瀵煎叆澶辫触
- const handleImportError = (error) => {
- proxy.$modal.msgError("瀵煎叆澶辫触锛�" + (error.message || "鏈煡閿欒"));
+ const getParamTypeTag = type => {
+ const typeMap = {
+ 鏁板�兼牸寮�: "primary",
+ 鏂囨湰鏍煎紡: "info",
+ 涓嬫媺閫夐」: "warning",
+ 鏃堕棿鏍煎紡: "success",
+ };
+ return typeMap[type] || "default";
};
- // 鍏抽棴瀵煎叆寮圭獥
- const handleImportClose = () => {
- if (importDialogRef.value) {
- importDialogRef.value.clearFiles();
+ const handleDeleteParam = row => {
+ ElMessageBox.confirm("纭畾瑕佸垹闄よ鍙傛暟鍚楋紵", "鎻愮ず", {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ }).then(() => {
+ ElMessage.success("鍒犻櫎鎴愬姛");
+ getParamList(selectedProcess.value.id);
+ });
+ };
+
+ const handleParamSubmit = () => {
+ if (!selectedParam.value) {
+ ElMessage.warning("璇峰厛閫夋嫨涓�涓弬鏁�");
+ return;
}
+ ElMessage.success("娣诲姞鎴愬姛");
+ paramDialogVisible.value = false;
+ getParamList(selectedProcess.value.id);
};
- // 涓嬭浇妯℃澘
- 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 handleParamPagination = obj => {
+ paramPage.current = obj.page;
+ paramPage.size = obj.limit;
+ getParamList(selectedProcess.value.id);
};
- // 瀵煎嚭
- // const handleOut = () => {
- // ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
- // confirmButtonText: "纭",
- // cancelButtonText: "鍙栨秷",
- // type: "warning",
- // })
- // .then(() => {
- // proxy.download("/salesLedger/scheduling/exportTwo", {}, "宸ュ簭鎺掍骇.xlsx");
- // })
- // .catch(() => {
- // proxy.$modal.msg("宸插彇娑�");
- // });
- // };
+ // 鑾峰彇鏁版嵁瀛楀吀
+ const getDictTypes = () => {
+ listType({ pageNum: 1, pageSize: 1000 }).then(res => {
+ dictTypes.value = res.rows || [];
+ });
+ };
onMounted(() => {
- getList();
+ getProcessList();
+ getDictTypes();
});
</script>
-<style scoped></style>
+<style scoped lang="scss">
+ .app-container {
+ padding: 20px;
+ background-color: #f0f2f5;
+ min-height: calc(100vh - 84px);
+ }
+
+ .process-config-container {
+ display: flex;
+ gap: 20px;
+ height: calc(100vh - 124px);
+ }
+
+ // 宸︿晶宸ュ簭鍒楄〃
+ .process-list-section {
+ width: 370px;
+ background: #fff;
+ border-radius: 8px;
+ box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+ display: flex;
+ flex-direction: column;
+ }
+
+ .section-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 16px 20px;
+ border-bottom: 1px solid #ebeef5;
+
+ .section-title {
+ margin: 0;
+ font-size: 16px;
+ font-weight: 600;
+ color: #303133;
+ }
+ }
+
+ .process-card-list {
+ flex: 1;
+ overflow-y: auto;
+ padding: 16px;
+ }
+
+ .process-card {
+ background: #fff;
+ border: 1px solid #ebeef5;
+ border-radius: 8px;
+ padding: 16px;
+ margin-bottom: 12px;
+ cursor: pointer;
+ transition: all 0.3s ease;
+
+ &:hover {
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
+ transform: translateY(-2px);
+ }
+
+ &.active {
+ border-color: #409eff;
+ background: #f5f7fa;
+ box-shadow: 0 4px 12px rgba(64, 158, 255, 0.2);
+ }
+
+ .card-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 8px;
+
+ .process-code {
+ font-size: 12px;
+ color: #909399;
+ font-family: "Courier New", monospace;
+ }
+
+ .card-actions {
+ display: flex;
+ gap: 4px;
+
+ .el-button {
+ padding: 4px;
+ }
+ }
+ }
+
+ .card-body {
+ margin-bottom: 12px;
+
+ .process-name {
+ font-size: 16px;
+ font-weight: 600;
+ color: #303133;
+ margin-bottom: 4px;
+ }
+
+ .process-desc {
+ font-size: 12px;
+ color: #909399;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+ }
+
+ .card-footer {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+
+ .param-count {
+ font-size: 12px;
+ color: #606266;
+ }
+ }
+ }
+
+ // 鍙充晶鍙傛暟鍒楄〃
+ .param-list-section {
+ flex: 1;
+ background: #fff;
+ border-radius: 8px;
+ box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+ display: flex;
+ flex-direction: column;
+ }
+
+ .param-table-wrapper {
+ flex: 1;
+ padding: 0 20px 20px;
+ overflow: hidden;
+ }
+
+ .empty-tip {
+ flex: 1;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+
+ // 琛ㄦ牸鏍峰紡
+ :deep(.el-table) {
+ border: none;
+ border-radius: 6px;
+ overflow: hidden;
+
+ .el-table__header-wrapper {
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+
+ th {
+ background: transparent;
+ font-weight: 600;
+ color: #ffffff;
+ border-bottom: none;
+ padding: 16px 0;
+ }
+ }
+
+ .el-table__body-wrapper {
+ tr {
+ transition: all 0.3s ease;
+
+ &:hover {
+ background: linear-gradient(
+ 90deg,
+ rgba(102, 126, 234, 0.05) 0%,
+ rgba(118, 75, 162, 0.05) 100%
+ );
+ }
+
+ td {
+ border-bottom: 1px solid #f0f0f0;
+ padding: 14px 0;
+ color: #303133;
+ }
+ }
+ }
+ }
+
+ // 缂栫爜鍗曞厓鏍兼牱寮�
+ :deep(.code-cell) {
+ color: #e6a23c;
+ font-family: "Courier New", monospace;
+ font-weight: 500;
+ }
+
+ // 鏁板�煎崟鍏冩牸鏍峰紡
+ :deep(.quantity-cell) {
+ font-weight: 600;
+ color: #409eff;
+ font-family: "Courier New", monospace;
+ }
+
+ // 閫夋嫨鍙傛暟瀵硅瘽妗嗘牱寮�
+ .param-select-container {
+ display: flex;
+ gap: 20px;
+ height: 450px;
+
+ .param-list-area {
+ flex: 1;
+ display: flex;
+ flex-direction: column;
+
+ .area-title {
+ font-size: 14px;
+ font-weight: 600;
+ color: #303133;
+ margin-bottom: 12px;
+ padding-bottom: 8px;
+ border-bottom: 1px solid #ebeef5;
+ }
+
+ .search-box {
+ margin-bottom: 12px;
+
+ .el-input {
+ width: 100%;
+ }
+ }
+ }
+
+ .param-detail-area {
+ width: 380px;
+ display: flex;
+ flex-direction: column;
+ background: #f5f7fa;
+ border-radius: 8px;
+ padding: 16px;
+
+ .area-title {
+ font-size: 14px;
+ font-weight: 600;
+ color: #303133;
+ margin-bottom: 16px;
+ padding-bottom: 8px;
+ border-bottom: 1px solid #ebeef5;
+ }
+
+ .param-detail-form {
+ .el-form-item {
+ margin-bottom: 12px;
+
+ .el-form-item__label {
+ color: #606266;
+ font-weight: 500;
+ }
+ }
+
+ .detail-text {
+ color: #303133;
+ font-weight: 500;
+ }
+ }
+ }
+ }
+</style>
--
Gitblit v1.9.3