| | |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="processDialogVisible = false">取消</el-button> |
| | | <el-button type="primary" |
| | | @click="handleProcessSubmit">确定</el-button> |
| | | <el-button @click="processDialogVisible = false">取消</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | |
| | | </el-form-item> |
| | | <el-form-item label="标准值"> |
| | | <el-input v-model="selectedParam.standardValue" |
| | | @input="val => onStandardValueInput(val, selectedParam)" |
| | | placeholder="请输入默认值" /> |
| | | </el-form-item> |
| | | </el-form> |
| | |
| | | </div> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="paramDialogVisible = false">取消</el-button> |
| | | <el-button type="primary" |
| | | :disabled="!selectedParam" |
| | | @click="handleParamSubmit">确定</el-button> |
| | | <el-button @click="paramDialogVisible = false">取消</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | |
| | | <el-form-item label="标准值" |
| | | prop="standardValue"> |
| | | <el-input v-model="editParamForm.standardValue" |
| | | @input="val => onStandardValueInput(val, editParamForm)" |
| | | placeholder="请输入标准值" /> |
| | | </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> |
| | | <el-button @click="editParamDialogVisible = false">取消</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, onMounted } from "vue"; |
| | | import { ref, reactive, computed, 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"; |
| | |
| | | const processLoading = ref(false); |
| | | const deviceOptions = ref([]); |
| | | |
| | | // 参数列表数据 |
| | | const paramList = ref([]); |
| | | // 工序已选参数表格分页(接口一次返回全量) |
| | | const paramPage2 = ref({ |
| | | current: 1, |
| | | size: 10, |
| | | total: 0, |
| | | }); |
| | | const paramListRaw = ref([]); |
| | | const paramList = computed(() => { |
| | | const all = paramListRaw.value; |
| | | const { current, size } = paramPage2.value; |
| | | const start = (current - 1) * size; |
| | | return all.slice(start, start + size); |
| | | }); |
| | | const paramLoading = ref(false); |
| | | |
| | | // 数据字典 |
| | |
| | | technologyParamId: null, |
| | | paramName: "", |
| | | standardValue: null, |
| | | paramType: null, |
| | | }); |
| | | |
| | | const onStandardValueInput = (val, target) => { |
| | | const data = target.value || target; |
| | | const type = data.paramType; |
| | | if (type === 1) { |
| | | // 数值格式:不能输入中文或英文字符 |
| | | data.standardValue = val.replace(/[a-zA-Z\u4e00-\u9fa5]/g, ""); |
| | | } |
| | | }; |
| | | |
| | | const editParamRules = { |
| | | standardValue: [ |
| | | { |
| | |
| | | if (value === null || value === undefined || value === "") { |
| | | callback(new Error("请输入标准值")); |
| | | } else { |
| | | const type = editParamForm.paramType; |
| | | if (type === 1 && value) { |
| | | if (/[a-zA-Z\u4e00-\u9fa5]/.test(value)) { |
| | | return callback(new Error("数值格式不能包含中英文字符")); |
| | | } |
| | | } |
| | | callback(); |
| | | } |
| | | }, |
| | |
| | | } |
| | | }; |
| | | |
| | | const paramPage2 = ref({ |
| | | current: 1, |
| | | size: 10, |
| | | total: 0, |
| | | }); |
| | | |
| | | // 获取参数列表 |
| | | const getParamList = processId => { |
| | | paramLoading.value = true; |
| | | console.log(paramPage2.value, "paramPage2.value"); |
| | | getProcessParamList({ technologyOperationId: processId }) |
| | | .then(res => { |
| | | console.log(res, "res"); |
| | | paramList.value = res.data || []; |
| | | paramPage2.value.total = 0; |
| | | const list = res.data || []; |
| | | paramListRaw.value = Array.isArray(list) ? list : []; |
| | | paramPage2.value.total = paramListRaw.value.length; |
| | | const maxPage = Math.max( |
| | | 1, |
| | | Math.ceil(paramPage2.value.total / paramPage2.value.size) || 1 |
| | | ); |
| | | if (paramPage2.value.current > maxPage) { |
| | | paramPage2.value.current = maxPage; |
| | | } |
| | | }) |
| | | .catch(() => { |
| | | ElMessage.error("获取参数列表失败"); |
| | |
| | | // 选择工序 |
| | | const selectProcess = process => { |
| | | selectedProcess.value = process; |
| | | paramPage2.value.current = 1; |
| | | getParamList(process.id); |
| | | }; |
| | | |
| | |
| | | getProcessList(); |
| | | if (selectedProcess.value?.id === process.id) { |
| | | selectedProcess.value = null; |
| | | paramList.value = []; |
| | | paramListRaw.value = []; |
| | | paramPage2.value.total = 0; |
| | | } |
| | | }) |
| | | .catch(() => { |
| | |
| | | editParamForm.technologyParamId = row.technologyParamId; |
| | | editParamForm.paramName = row.paramName; |
| | | editParamForm.standardValue = row.standardValue; |
| | | editParamForm.paramType = row.paramType; |
| | | editParamDialogVisible.value = true; |
| | | }; |
| | | |
| | |
| | | }; |
| | | |
| | | const handleParamPagination = obj => { |
| | | console.log(obj, "obj"); |
| | | paramPage2.value.current = obj.page; |
| | | paramPage2.value.size = obj.limit; |
| | | getParamList(selectedProcess.value.id); |
| | | }; |
| | | |
| | | // 获取数据字典 |