| | |
| | | </el-icon>新增工序 |
| | | </el-button> |
| | | </div> |
| | | <div class="process-card-list"> |
| | | <div v-for="process in processList" |
| | | <div class="process-card-list" |
| | | v-loading="processLoading"> |
| | | <div v-for="process in processValueList" |
| | | :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="process-name">{{ process.name }} <span class="process-code">{{ process.no }}</span></div> |
| | | <div class="card-actions"> |
| | | <el-button link |
| | | type="primary" |
| | |
| | | </div> |
| | | </div> |
| | | <div class="card-body"> |
| | | <div class="process-name">{{ process.processName }}</div> |
| | | <div class="process-desc">{{ process.processDesc || '暂无描述' }}</div> |
| | | <!-- <div class="process-name">{{ process.name }}</div> --> |
| | | <div class="process-desc">{{ process.remark || '暂无描述' }}</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 class="status-tag"> <el-tag size="small" |
| | | :type="process.status ? 'success' : 'info'"> |
| | | {{ process.status ? '启用' : '停用' }} |
| | | </el-tag> |
| | | <el-tag size="small" |
| | | :type="process.isQuality ? 'warning' : 'info'" |
| | | style="margin-left: 8px"> |
| | | {{ process.isQuality ? '质检' : '非质检' }} |
| | | </el-tag> |
| | | </div> |
| | | <span class="param-count">工资定额: ¥{{ process.salaryQuota || 0 }}</span> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | <div class="param-list-section"> |
| | | <div class="section-header"> |
| | | <h3 class="section-title"> |
| | | {{ selectedProcess ? selectedProcess.processName + ' - 参数配置' : '请选择工序' }} |
| | | {{ selectedProcess ? selectedProcess.name + ' - 参数配置' : '请选择工序' }} |
| | | </h3> |
| | | <el-button type="primary" |
| | | size="small" |
| | | :disabled="!selectedProcess" |
| | | @click="handleSelectParam"> |
| | | @click="openParamDialog"> |
| | | <el-icon> |
| | | <Plus /> |
| | | </el-icon>选择参数 |
| | |
| | | :tableData="paramList" |
| | | :page="paramPage" |
| | | height="calc(100vh - 280px)" |
| | | :tableLoading="paramLoading" |
| | | :isSelection="false" |
| | | @pagination="handleParamPagination" /> |
| | | <div v-else |
| | |
| | | ref="processFormRef" |
| | | label-width="100px"> |
| | | <el-form-item label="工序编码" |
| | | prop="processCode"> |
| | | <el-input v-model="processForm.processCode" |
| | | prop="no"> |
| | | <el-input v-model="processForm.no" |
| | | placeholder="请输入工序编码" /> |
| | | </el-form-item> |
| | | <el-form-item label="工序名称" |
| | | prop="processName"> |
| | | <el-input v-model="processForm.processName" |
| | | prop="name"> |
| | | <el-input v-model="processForm.name" |
| | | placeholder="请输入工序名称" /> |
| | | </el-form-item> |
| | | <el-form-item label="工资定额" |
| | | prop="salaryQuota"> |
| | | <el-input v-model="processForm.salaryQuota" |
| | | type="number" |
| | | :step="0.001" /> |
| | | </el-form-item> |
| | | <el-form-item label="是否质检" |
| | | prop="isQuality"> |
| | | <el-switch v-model="processForm.isQuality" |
| | | :active-value="true" |
| | | inactive-value="false" /> |
| | | </el-form-item> |
| | | <el-form-item label="工序描述" |
| | | prop="processDesc"> |
| | | <el-input v-model="processForm.processDesc" |
| | | prop="remark"> |
| | | <el-input v-model="processForm.remark" |
| | | type="textarea" |
| | | :rows="3" |
| | | placeholder="请输入工序描述" /> |
| | |
| | | <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 :label="true">启用</el-radio> |
| | | <el-radio :label="false">停用</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | </el-form> |
| | |
| | | placeholder="请输入参数名称搜索" |
| | | clearable |
| | | size="small" |
| | | @input="handleParamSearch"> |
| | | @input="handleSelectParam"> |
| | | <template #prefix> |
| | | <el-icon> |
| | | <Search /> |
| | |
| | | </el-input> |
| | | </div> |
| | | <el-table :data="filteredParamList" |
| | | height="360" |
| | | height="300" |
| | | border |
| | | highlight-current-row |
| | | @current-change="handleParamSelect"> |
| | | <el-table-column prop="parameterCode" |
| | | label="参数编号" |
| | | width="100" /> |
| | | <el-table-column prop="parameterName" |
| | | <el-table-column prop="paramName" |
| | | label="参数名称" /> |
| | | <el-table-column prop="parameterType" |
| | | label="参数类型" |
| | | width="100"> |
| | | <el-table-column prop="paramType" |
| | | label="参数类型"> |
| | | <template #default="scope"> |
| | | <el-tag size="small" |
| | | :type="getParamTypeTag(scope.row.parameterType)"> |
| | | {{ scope.row.parameterType }} |
| | | :type="getParamTypeTag(scope.row.paramType)"> |
| | | {{ getParamTypeText(scope.row.paramType) }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!-- 分页控件 --> |
| | | <div class="pagination-container" |
| | | style="margin-top: 10px;"> |
| | | <el-pagination v-model:current-page="paramPage.current" |
| | | v-model:page-size="paramPage.size" |
| | | :page-sizes="[10, 20, 50, 100]" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :total="paramPage.total" |
| | | @size-change="handleParamSizeChange" |
| | | @current-change="handleParamCurrentChange" |
| | | size="small" /> |
| | | </div> |
| | | </div> |
| | | <!-- 右侧参数详情 --> |
| | | <div class="param-detail-area"> |
| | |
| | | :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> |
| | | <span class="detail-text">{{ selectedParam.paramName }}</span> |
| | | </el-form-item> |
| | | <el-form-item label="参数模式"> |
| | | <el-tag size="small" |
| | | :type="selectedParam.parameterType2 === '1' ? 'success' : 'warning'"> |
| | | {{ selectedParam.parameterType2 === '1' ? '单值' : '区间' }} |
| | | :type="selectedParam.valueMode == '1' ? 'success' : 'warning'"> |
| | | {{ selectedParam.valueMode == '1' ? '单值' : '区间' }} |
| | | </el-tag> |
| | | </el-form-item> |
| | | <el-form-item label="参数类型"> |
| | | <el-tag size="small" |
| | | :type="getParamTypeTag(selectedParam.parameterType)"> |
| | | {{ selectedParam.parameterType }} |
| | | :type="getParamTypeTag(selectedParam.paramType)"> |
| | | {{ getParamTypeText(selectedParam.paramType) }} |
| | | </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> |
| | | <span class="detail-text">{{ selectedParam.paramFormat || '-' }}</span> |
| | | </el-form-item> |
| | | <el-form-item label="单位"> |
| | | <span class="detail-text">{{ selectedParam.unit || '-' }}</span> |
| | | </el-form-item> |
| | | <el-form-item label="标准值" |
| | | v-if="selectedParam.valueMode == '1'"> |
| | | <el-input v-model="selectedParam.standardValue" |
| | | type="number" |
| | | placeholder="请输入默认值" /> |
| | | </el-form-item> |
| | | <el-form-item label="最小值" |
| | | v-if="selectedParam.valueMode == '2'"> |
| | | <el-input v-model="selectedParam.minValue" |
| | | type="number" |
| | | placeholder="请输入最小值" /> |
| | | </el-form-item> |
| | | <el-form-item label="最大值" |
| | | v-if="selectedParam.valueMode == '2'"> |
| | | <el-input v-model="selectedParam.maxValue" |
| | | type="number" |
| | | placeholder="请输入最大值" /> |
| | | </el-form-item> |
| | | <el-form-item label="排序"> |
| | | <el-input v-model="selectedParam.sort" |
| | | type="number" |
| | | placeholder="请输入排序" /> |
| | | </el-form-item> |
| | | <el-form-item label="是否必填"> |
| | | <el-switch v-model="selectedParam.isRequired" |
| | | :active-value="1" |
| | | :inactive-value="0" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <el-empty v-else |
| | |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | <!-- 编辑参数对话框 --> |
| | | <el-dialog v-model="editParamDialogVisible" |
| | | title="编辑参数" |
| | | width="600px"> |
| | | <el-form :model="editParamForm" |
| | | :rules="editParamRules" |
| | | ref="editParamFormRef" |
| | | label-width="120px"> |
| | | <el-form-item label="参数名称"> |
| | | <span class="detail-text">{{ editParamForm.paramName }}</span> |
| | | </el-form-item> |
| | | <el-form-item label="参数模式"> |
| | | <el-tag size="small" |
| | | :type="editParamForm.valueMode == '1' ? 'success' : 'warning'"> |
| | | {{ editParamForm.valueMode == '1' ? '单值' : '区间' }} |
| | | </el-tag> |
| | | </el-form-item> |
| | | <el-form-item label="标准值" |
| | | v-if="editParamForm.valueMode == '1'" |
| | | prop="standardValue"> |
| | | <el-input v-model="editParamForm.standardValue" |
| | | type="number" |
| | | placeholder="请输入标准值" /> |
| | | </el-form-item> |
| | | <el-form-item label="最小值" |
| | | v-if="editParamForm.valueMode == '2'" |
| | | prop="minValue"> |
| | | <el-input v-model="editParamForm.minValue" |
| | | type="number" |
| | | placeholder="请输入最小值" /> |
| | | </el-form-item> |
| | | <el-form-item label="最大值" |
| | | v-if="editParamForm.valueMode == '2'" |
| | | prop="maxValue"> |
| | | <el-input v-model="editParamForm.maxValue" |
| | | type="number" |
| | | placeholder="请输入最大值" /> |
| | | </el-form-item> |
| | | <el-form-item label="排序" |
| | | prop="sort"> |
| | | <el-input v-model="editParamForm.sort" |
| | | type="number" |
| | | placeholder="请输入排序" /> |
| | | </el-form-item> |
| | | <el-form-item label="是否必填" |
| | | prop="isRequired"> |
| | | <el-switch v-model="editParamForm.isRequired" |
| | | :active-value="1" |
| | | :inactive-value="0" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="editParamDialogVisible = false">取消</el-button> |
| | | <el-button type="primary" |
| | | @click="handleEditParamSubmit">确定</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | import { Plus, Edit, Delete, Search } from "@element-plus/icons-vue"; |
| | | import PIMTable from "@/components/PIMTable/PIMTable.vue"; |
| | | import { listType } from "@/api/system/dict/type"; |
| | | import { |
| | | add, |
| | | update, |
| | | del, |
| | | list as getProcessListApi, |
| | | processList, |
| | | getProcessParamList, |
| | | addProcessParam, |
| | | editProcessParam, |
| | | deleteProcessParam, |
| | | } from "@/api/productionManagement/productionProcess.js"; |
| | | import { getBaseParamList } from "@/api/basicData/parameterMaintenance.js"; |
| | | |
| | | // 工序列表数据 |
| | | const processList = ref([]); |
| | | const processValueList = 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 dictTypes = ref([]); |
| | |
| | | const processFormRef = ref(null); |
| | | const processForm = reactive({ |
| | | id: null, |
| | | processCode: "", |
| | | processName: "", |
| | | processDesc: "", |
| | | status: "1", |
| | | no: "", |
| | | name: "", |
| | | salaryQuota: null, |
| | | isQuality: false, |
| | | remark: "", |
| | | status: true, |
| | | }); |
| | | const processRules = { |
| | | processCode: [{ required: true, message: "请输入工序编码", trigger: "blur" }], |
| | | processName: [{ required: true, message: "请输入工序名称", trigger: "blur" }], |
| | | no: [{ required: true, message: "请输入工序编码", trigger: "blur" }], |
| | | name: [{ required: true, message: "请输入工序名称", trigger: "blur" }], |
| | | salaryQuota: [ |
| | | { |
| | | required: false, |
| | | message: "请输入工资定额", |
| | | trigger: "blur", |
| | | validator: (rule, value, callback) => { |
| | | if (isNaN(value) || value < 0) { |
| | | callback(new Error("工资定额必须是非负数字")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }, |
| | | }, |
| | | ], |
| | | }; |
| | | |
| | | // 参数对话框 |
| | |
| | | const selectedParam = ref(null); |
| | | const paramSearchKeyword = ref(""); |
| | | |
| | | // 可选参数分页 |
| | | const paramPage = reactive({ |
| | | current: 1, |
| | | size: 10, |
| | | total: 0, |
| | | }); |
| | | |
| | | // 编辑参数对话框 |
| | | const editParamDialogVisible = ref(false); |
| | | const editParamFormRef = ref(null); |
| | | const editParamForm = reactive({ |
| | | id: null, |
| | | processId: null, |
| | | paramId: null, |
| | | paramName: "", |
| | | valueMode: "1", |
| | | standardValue: null, |
| | | minValue: null, |
| | | maxValue: null, |
| | | sort: 1, |
| | | isRequired: 0, |
| | | tenantId: 1, |
| | | }); |
| | | const editParamRules = { |
| | | standardValue: [ |
| | | { |
| | | required: true, |
| | | message: "请输入标准值", |
| | | trigger: "blur", |
| | | validator: (rule, value, callback) => { |
| | | if (value === null || value === undefined || value === "") { |
| | | callback(new Error("请输入标准值")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }, |
| | | }, |
| | | ], |
| | | minValue: [ |
| | | { |
| | | required: true, |
| | | message: "请输入最小值", |
| | | trigger: "blur", |
| | | validator: (rule, value, callback) => { |
| | | if (value === null || value === undefined || value === "") { |
| | | callback(new Error("请输入最小值")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }, |
| | | }, |
| | | ], |
| | | maxValue: [ |
| | | { |
| | | required: true, |
| | | message: "请输入最大值", |
| | | trigger: "blur", |
| | | validator: (rule, value, callback) => { |
| | | if (value === null || value === undefined || value === "") { |
| | | callback(new Error("请输入最大值")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }, |
| | | }, |
| | | ], |
| | | sort: [ |
| | | { |
| | | required: true, |
| | | message: "请输入排序", |
| | | trigger: "blur", |
| | | validator: (rule, value, callback) => { |
| | | if (value === null || value === undefined || value === "") { |
| | | callback(new Error("请输入排序")); |
| | | } else if (isNaN(value) || value < 1) { |
| | | callback(new Error("排序必须是大于0的整数")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }, |
| | | }, |
| | | ], |
| | | }; |
| | | |
| | | // 参数表格列配置 |
| | | const paramColumn = ref([ |
| | | { |
| | | label: "参数编号", |
| | | prop: "parameterCode", |
| | | className: "code-cell", |
| | | }, |
| | | { |
| | | label: "参数名称", |
| | | prop: "parameterName", |
| | | prop: "paramName", |
| | | }, |
| | | { |
| | | label: "参数模式", |
| | | prop: "parameterType2", |
| | | prop: "valueMode", |
| | | dataType: "tag", |
| | | formatType: row => (row.parameterType2 === "1" ? "success" : "warning"), |
| | | formatData: row => (row.parameterType2 === "1" ? "单值" : "区间"), |
| | | formatType: row => (row.valueMode === "1" ? "success" : "warning"), |
| | | formatData: row => (row.valueMode === "1" ? "单值" : "区间"), |
| | | }, |
| | | { |
| | | label: "参数类型", |
| | | prop: "parameterType", |
| | | prop: "paramType", |
| | | dataType: "tag", |
| | | formatType: row => { |
| | | formatType: params => { |
| | | const typeMap = { |
| | | 数值格式: "primary", |
| | | 文本格式: "info", |
| | | 下拉选项: "warning", |
| | | 时间格式: "success", |
| | | 1: "primary", |
| | | 2: "info", |
| | | 3: "warning", |
| | | 4: "success", |
| | | }; |
| | | return typeMap[row.parameterType] || "default"; |
| | | return typeMap[params] || "default"; |
| | | }, |
| | | formatData: val => { |
| | | const labelMap = { |
| | | 1: "数值格式", |
| | | 2: "文本格式", |
| | | 3: "下拉选项", |
| | | 4: "时间格式", |
| | | }; |
| | | return labelMap[val] || val; |
| | | }, |
| | | }, |
| | | { |
| | | label: "参数格式", |
| | | prop: "parameterFormat", |
| | | label: "取值格式", |
| | | prop: "paramFormat", |
| | | formatData: (val, row) => { |
| | | if (row.paramType == "3") { |
| | | const dict = dictTypes.value.find(item => item.dictType === val); |
| | | return dict ? "字典:" + dict.dictName : val; |
| | | } |
| | | return val; |
| | | }, |
| | | }, |
| | | { |
| | | label: "标准值", |
| | | prop: "standardValue", |
| | | className: row => (row.parameterType === "数值格式" ? "quantity-cell" : ""), |
| | | formatData: (val, row) => { |
| | | return row.valueMode == "1" ? val : "-"; |
| | | }, |
| | | }, |
| | | { |
| | | label: "最小值", |
| | | prop: "minValue", |
| | | formatData: (val, row) => { |
| | | return row.valueMode == "2" ? val : "-"; |
| | | }, |
| | | }, |
| | | { |
| | | label: "最大值", |
| | | prop: "maxValue", |
| | | formatData: (val, row) => { |
| | | return row.valueMode == "2" ? val : "-"; |
| | | }, |
| | | }, |
| | | { |
| | | label: "单位", |
| | | prop: "unit", |
| | | }, |
| | | { |
| | | label: "排序", |
| | | prop: "sort", |
| | | }, |
| | | { |
| | | label: "是否必填", |
| | | prop: "isRequired", |
| | | dataType: "tag", |
| | | formatType: row => (row.isRequired === 1 ? "success" : "info"), |
| | | formatData: row => (row.isRequired === 1 ? "是" : "否"), |
| | | }, |
| | | { |
| | | label: "操作", |
| | | dataType: "action", |
| | | width: "100", |
| | | width: "150", |
| | | operation: [ |
| | | { |
| | | name: "编辑", |
| | | clickFun: row => handleEditParam(row), |
| | | }, |
| | | { |
| | | name: "删除", |
| | | clickFun: row => handleDeleteParam(row), |
| | |
| | | |
| | | // 获取工序列表 |
| | | 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, |
| | | }, |
| | | ]; |
| | | processLoading.value = true; |
| | | getProcessListApi() |
| | | .then(res => { |
| | | processValueList.value = res.data || []; |
| | | }) |
| | | .catch(() => { |
| | | ElMessage.error("获取工序列表失败"); |
| | | }) |
| | | .finally(() => { |
| | | processLoading.value = false; |
| | | }); |
| | | }; |
| | | |
| | | // 获取参数列表 |
| | | 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: "正常", |
| | | 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); |
| | | getProcessParamList(processId) |
| | | .then(res => { |
| | | paramList.value = res.data || []; |
| | | paramPage.total = paramList.value.length; |
| | | }) |
| | | .catch(() => { |
| | | ElMessage.error("获取参数列表失败"); |
| | | }) |
| | | .finally(() => { |
| | | paramLoading.value = false; |
| | | }); |
| | | }; |
| | | |
| | | // 选择工序 |
| | |
| | | const handleAddProcess = () => { |
| | | isProcessEdit.value = false; |
| | | processForm.id = null; |
| | | processForm.processCode = ""; |
| | | processForm.processName = ""; |
| | | processForm.processDesc = ""; |
| | | processForm.status = "1"; |
| | | processForm.no = ""; |
| | | processForm.name = ""; |
| | | processForm.salaryQuota = null; |
| | | processForm.isQuality = false; |
| | | processForm.remark = ""; |
| | | processForm.status = true; |
| | | processDialogVisible.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.no = process.no; |
| | | processForm.name = process.name; |
| | | processForm.salaryQuota = process.salaryQuota; |
| | | processForm.isQuality = process.isQuality || false; |
| | | processForm.remark = process.remark || ""; |
| | | processForm.status = process.status; |
| | | processDialogVisible.value = true; |
| | | }; |
| | |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }).then(() => { |
| | | ElMessage.success("删除成功"); |
| | | getProcessList(); |
| | | if (selectedProcess.value?.id === process.id) { |
| | | selectedProcess.value = null; |
| | | paramList.value = []; |
| | | } |
| | | del([process.id]) |
| | | .then(() => { |
| | | ElMessage.success("删除成功"); |
| | | getProcessList(); |
| | | if (selectedProcess.value?.id === process.id) { |
| | | selectedProcess.value = null; |
| | | paramList.value = []; |
| | | } |
| | | }) |
| | | .catch(() => { |
| | | ElMessage.error("删除失败"); |
| | | }); |
| | | }); |
| | | }; |
| | | |
| | | const handleProcessSubmit = () => { |
| | | processFormRef.value.validate(valid => { |
| | | if (valid) { |
| | | ElMessage.success(isProcessEdit.value ? "编辑成功" : "新增成功"); |
| | | processDialogVisible.value = false; |
| | | getProcessList(); |
| | | const apiMethod = isProcessEdit.value ? update : add; |
| | | apiMethod(processForm) |
| | | .then(() => { |
| | | ElMessage.success(isProcessEdit.value ? "编辑成功" : "新增成功"); |
| | | processDialogVisible.value = false; |
| | | getProcessList(); |
| | | }) |
| | | .catch(() => { |
| | | ElMessage.error(isProcessEdit.value ? "编辑失败" : "新增失败"); |
| | | }); |
| | | } |
| | | }); |
| | | }; |
| | | const openParamDialog = () => { |
| | | paramSearchKeyword.value = ""; |
| | | if (!selectedProcess.value) { |
| | | ElMessage.warning("请先选择一个工序"); |
| | | return; |
| | | } |
| | | // 获取可选参数列表 |
| | | getBaseParamList({ |
| | | paramName: paramSearchKeyword.value, |
| | | current: paramPage.current, |
| | | size: paramPage.size, |
| | | }).then(res => { |
| | | if (res.code === 200) { |
| | | filteredParamList.value = res.data?.records || []; |
| | | paramPage.total = res.data?.total || 0; |
| | | } else { |
| | | ElMessage.error(res.msg || "查询失败"); |
| | | } |
| | | }); |
| | | console.log(filteredParamList.value, "可选参数列表"); |
| | | selectedParam.value = null; |
| | | paramDialogVisible.value = true; |
| | | }; |
| | | |
| | | // 参数操作 |
| | |
| | | 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: "正常", |
| | | 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 = ""; |
| | | // 获取可选参数列表 |
| | | getBaseParamList({ |
| | | paramName: paramSearchKeyword.value, |
| | | current: paramPage.current, |
| | | size: paramPage.size, |
| | | }).then(res => { |
| | | if (res.code === 200) { |
| | | filteredParamList.value = res.data?.records || []; |
| | | paramPage.total = res.data?.total || 0; |
| | | } else { |
| | | ElMessage.error(res.msg || "查询失败"); |
| | | } |
| | | }); |
| | | console.log(filteredParamList.value, "可选参数列表"); |
| | | selectedParam.value = null; |
| | | paramDialogVisible.value = true; |
| | | }; |
| | |
| | | }; |
| | | |
| | | const handleParamSearch = () => { |
| | | const keyword = paramSearchKeyword.value.trim().toLowerCase(); |
| | | if (!keyword) { |
| | | filteredParamList.value = availableParamList.value; |
| | | } else { |
| | | filteredParamList.value = availableParamList.value.filter(item => |
| | | item.parameterName.toLowerCase().includes(keyword) |
| | | ); |
| | | } |
| | | // 重置分页 |
| | | paramPage.current = 1; |
| | | // 重新加载数据 |
| | | handleSelectParam(); |
| | | }; |
| | | |
| | | // 处理分页大小变化 |
| | | const handleParamSizeChange = size => { |
| | | paramPage.size = size; |
| | | handleSelectParam(); |
| | | }; |
| | | |
| | | // 处理当前页码变化 |
| | | const handleParamCurrentChange = current => { |
| | | paramPage.current = current; |
| | | handleSelectParam(); |
| | | }; |
| | | const getParamTypeText = type => { |
| | | const typeMap = { |
| | | 1: "数值格式", |
| | | 2: "文本格式", |
| | | 3: "下拉选项", |
| | | 4: "时间格式", |
| | | }; |
| | | return typeMap[type] || "未知参数类型"; |
| | | }; |
| | | const getParamTypeTag = type => { |
| | | const typeMap = { |
| | | 数值格式: "primary", |
| | | 文本格式: "info", |
| | | 下拉选项: "warning", |
| | | 时间格式: "success", |
| | | 1: "primary", |
| | | 2: "info", |
| | | 3: "warning", |
| | | 4: "success", |
| | | }; |
| | | return typeMap[type] || "default"; |
| | | }; |
| | |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }).then(() => { |
| | | ElMessage.success("删除成功"); |
| | | getParamList(selectedProcess.value.id); |
| | | deleteProcessParam(row.id) |
| | | .then(() => { |
| | | ElMessage.success("删除成功"); |
| | | getParamList(selectedProcess.value.id); |
| | | }) |
| | | .catch(() => { |
| | | ElMessage.error("删除失败"); |
| | | }); |
| | | }); |
| | | }; |
| | | |
| | | const handleEditParam = row => { |
| | | editParamForm.id = row.id; |
| | | editParamForm.processId = row.processId; |
| | | editParamForm.paramId = row.paramId; |
| | | editParamForm.paramName = row.paramName; |
| | | editParamForm.valueMode = row.valueMode; |
| | | editParamForm.standardValue = row.standardValue; |
| | | editParamForm.minValue = row.minValue; |
| | | editParamForm.maxValue = row.maxValue; |
| | | editParamForm.sort = row.sort || 1; |
| | | editParamForm.isRequired = row.isRequired || 0; |
| | | editParamForm.tenantId = 1; |
| | | editParamDialogVisible.value = true; |
| | | }; |
| | | |
| | | const handleEditParamSubmit = () => { |
| | | editParamFormRef.value.validate(valid => { |
| | | if (valid) { |
| | | editProcessParam(editParamForm) |
| | | .then(() => { |
| | | ElMessage.success("编辑成功"); |
| | | editParamDialogVisible.value = false; |
| | | getParamList(selectedProcess.value.id); |
| | | }) |
| | | .catch(() => { |
| | | ElMessage.error("编辑失败"); |
| | | }); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | |
| | | ElMessage.warning("请先选择一个参数"); |
| | | return; |
| | | } |
| | | ElMessage.success("添加成功"); |
| | | paramDialogVisible.value = false; |
| | | getParamList(selectedProcess.value.id); |
| | | addProcessParam({ |
| | | processId: selectedProcess.value.id, |
| | | paramId: selectedParam.value.id, |
| | | sort: selectedParam.value.sort || 1, |
| | | standardValue: selectedParam.value.standardValue, |
| | | minValue: selectedParam.value.minValue, |
| | | maxValue: selectedParam.value.maxValue, |
| | | isRequired: selectedParam.value.isRequired || 0, |
| | | tenantId: 1, |
| | | }) |
| | | .then(() => { |
| | | ElMessage.success("添加成功"); |
| | | paramDialogVisible.value = false; |
| | | getParamList(selectedProcess.value.id); |
| | | }) |
| | | .catch(() => { |
| | | ElMessage.error("添加失败"); |
| | | }); |
| | | }; |
| | | |
| | | const handleParamPagination = obj => { |
| | |
| | | // 左侧工序列表 |
| | | .process-list-section { |
| | | width: 370px; |
| | | min-width: 370px; |
| | | flex-shrink: 0; |
| | | background: #fff; |
| | | border-radius: 8px; |
| | | box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1); |
| | |
| | | |
| | | .process-code { |
| | | font-size: 12px; |
| | | color: #909399; |
| | | // color: #909399; |
| | | color: #cb9b18; |
| | | font-family: "Courier New", monospace; |
| | | } |
| | | |
| | |
| | | .param-table-wrapper { |
| | | flex: 1; |
| | | padding: 0 20px 20px; |
| | | overflow: hidden; |
| | | overflow: auto; |
| | | } |
| | | |
| | | /* 表格横向滚动 */ |
| | | :deep(.el-table) { |
| | | // min-width: 800px; |
| | | } |
| | | |
| | | .empty-tip { |
| | |
| | | th { |
| | | background: transparent; |
| | | font-weight: 600; |
| | | color: #ffffff; |
| | | // color: #ffffff; |
| | | border-bottom: none; |
| | | padding: 16px 0; |
| | | } |
| | |
| | | height: 450px; |
| | | |
| | | .param-list-area { |
| | | flex: 1; |
| | | // flex: 1; |
| | | width: 380px; |
| | | display: flex; |
| | | flex-direction: column; |
| | | |
| | |
| | | } |
| | | |
| | | .param-detail-area { |
| | | width: 380px; |
| | | // width: 380px; |
| | | flex: 1; |
| | | display: flex; |
| | | flex-direction: column; |
| | | background: #f5f7fa; |