| | |
| | | <script setup> |
| | | import {onMounted, reactive, ref, watch} from "vue"; |
| | | import {onMounted, reactive, ref, watch, inject} from "vue"; |
| | | import {useI18n} from "vue-i18n"; |
| | | import {Platform, Search, SuccessFilled} from "@element-plus/icons-vue"; |
| | | import useUserInfoStore from "@/stores/userInfo"; |
| | |
| | | } |
| | | }); |
| | | |
| | | // 注入 projectNo |
| | | const injectedProjectNo = inject('projectNo', null); |
| | | |
| | | const selectOptions = [ |
| | | { |
| | |
| | | const optionVal = ref(50) |
| | | |
| | | // 定义装载率 |
| | | const percentage1 = ref(80) |
| | | const percentage1 = ref(50) |
| | | const percentage2 = ref(50) |
| | | |
| | | // 定义其他表单数据 |
| | |
| | | // 定义响应式数据,用于绑定工程号输入框的值 |
| | | let inputValue=ref(null) |
| | | if(props.project!==undefined){ |
| | | inputValue= ref(props.project.projectNumber); |
| | | quantity.value=props.project.quantity |
| | | inputValue = ref(props.project.projectNumber); |
| | | quantity.value = props.project.quantity |
| | | } else if(props.projectNo) { |
| | | inputValue.value = props.projectNo; |
| | | } else if(injectedProjectNo) { |
| | | // 从 provide/inject 获取 projectNo |
| | | inputValue.value = injectedProjectNo.value || injectedProjectNo; |
| | | }else { |
| | | // 从 localStorage 获取 |
| | | const storedProjectNo = localStorage.getItem('currentProjectNo'); |
| | | if (storedProjectNo) { |
| | | inputValue.value = storedProjectNo; |
| | | } |
| | | } |
| | | |
| | | // 添加 watch 监听注入的 projectNo |
| | | watch(() => injectedProjectNo, (newVal) => { |
| | | if(newVal && !inputValue.value) { |
| | | inputValue.value = newVal.value || newVal; |
| | | } |
| | | }, { immediate: true }); |
| | | |
| | | const fetchSettings = async (username) => { |
| | | try { |
| | |
| | | }; |
| | | |
| | | |
| | | const handleSimulationClick = () => { |
| | | const handleSimulationClick = async () => { |
| | | |
| | | try { |
| | | const projectNumber = inputValue.value; |
| | | if (!projectNumber) { |
| | | ElMessage.warning('请输入工程号'); |
| | | return; |
| | | } |
| | | |
| | | const res = await request.post(`/glassOptimize/getProjectState/${projectNumber}`); |
| | | if (Number(res.code) === 200) { |
| | | const projectData = res.data.data; |
| | | |
| | | // 检查 tempering_state 状态 |
| | | if (projectData.tempering_state === 1) { |
| | | // 如果已完成模拟计算,提示用户并阻止继续执行 |
| | | ElMessage.warning('已完成模拟计算,不允许重复计算'); |
| | | return; |
| | | } |
| | | } else { |
| | | ElMessage.warning(res.msg); |
| | | return; |
| | | } |
| | | } catch (error) { |
| | | ElMessage.error('检查工程状态失败,请稍后重试'); |
| | | console.error('检查工程状态失败:', error); |
| | | return; |
| | | } |
| | | |
| | | |
| | | inputValues.project_no = inputValue.value; |
| | | inputValues.chaos_pct = optionVal.value * 0.01; // 混排等级 |
| | |
| | | }; |
| | | |
| | | emit('sendData', sendData); |
| | | emit('simulate-click'); |
| | | |
| | | |
| | | |
| | |
| | | |
| | | </div> |
| | | </div> |
| | | <!-- <div class="demo-progress" style="margin-top: -10px"> |
| | | <div style="display: flex; align-items: center"> |
| | | <span>理片笼空闲度</span> |
| | | <!– 进度条设置 –> |
| | | <el-slider |
| | | style="max-width: 400px; flex: 1; margin-left: 10px" |
| | | v-model="percentage2" |
| | | :min="0" |
| | | :max="100" |
| | | :step="1"/> |
| | | <span style="margin-left: 20px ; width: 35px;">{{ percentage2 }}%</span> |
| | | <span style="float: right ; margin-left: 150px;"> |
| | | 加热时间(秒)<el-select style="width: 50px;height: 30px" v-model="rotateMode"> |
| | | <el-option |
| | | v-for="item in selectOptions" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | 长轴间隔 <vxe-input size="small" class="input" clearable v-model="spacingLong"></vxe-input> |
| | | 炉长(mm) <vxe-input size="small" class="input" clearable v-model="furnaceLength"></vxe-input> |
| | | </span> |
| | | </div> |
| | | </div>--> |
| | | </div> |
| | | <div style="height: 50%"> |
| | | <vxe-grid |