首页加载速度优化

This commit is contained in:
朱昊天
2026-07-04 09:42:18 +08:00
parent 73ede33466
commit 247e351af3
3 changed files with 28 additions and 5 deletions

View File

@@ -102,7 +102,7 @@
</select> </select>
<select id="countByPlanId" parameterType="Long" resultType="int"> <select id="countByPlanId" parameterType="Long" resultType="int">
select count(1) from mill_production_actual where plan_id = #{planId} and del_flag = '0' select count(1) from mill_production_actual where plan_id = #{_parameter} and del_flag = '0'
</select> </select>
<insert id="insertMillProductionActual" parameterType="MillProductionActual" useGeneratedKeys="true" keyProperty="actualId"> <insert id="insertMillProductionActual" parameterType="MillProductionActual" useGeneratedKeys="true" keyProperty="actualId">

View File

@@ -105,9 +105,13 @@ export default {
} }
}, },
created() { created() {
this.getCode();
this.getCookie(); this.getCookie();
}, },
mounted() {
requestAnimationFrame(() => {
this.getCode();
});
},
methods: { methods: {
getCode() { getCode() {
getCodeImg().then(res => { getCodeImg().then(res => {

View File

@@ -4,7 +4,7 @@
<!-- 上方轧制队列 --> <!-- 上方轧制队列 -->
<div class="queue-section"> <div class="queue-section">
<div class="section-header"><span>轧制队列</span></div> <div class="section-header"><span>轧制队列</span></div>
<el-table :data="planList" border size="mini" class="queue-table" <el-table ref="queueTable" :data="planList" border size="mini" class="queue-table"
:row-class-name="queueRowClass" :row-class-name="queueRowClass"
@current-change="handleQueueSelect" @current-change="handleQueueSelect"
highlight-current-row highlight-current-row
@@ -359,6 +359,7 @@ export default {
passList: [], passList: [],
recipeOptions: [], recipeOptions: [],
query: { inMatNo: '', dateRange: null, hideFinished: false }, query: { inMatNo: '', dateRange: null, hideFinished: false },
suppressQueueSelect: false,
// 编辑模式 // 编辑模式
passEditMode: false, passEditMode: false,
@@ -439,7 +440,18 @@ export default {
params.params.endTime = this.query.dateRange[1] params.params.endTime = this.query.dateRange[1]
} }
if (!Object.keys(params.params).length) delete params.params if (!Object.keys(params.params).length) delete params.params
listPlan(params).then(res => { this.planList = res.data || [] }) listPlan(params).then(res => {
const list = res.data || []
this.planList = list
if (this.selectedPlan && this.selectedPlan.planId != null) {
const stillExists = list.some(p => p.planId === this.selectedPlan.planId)
if (!stillExists) {
this.selectedPlan = null
this.passList = []
if (this.$refs.queueTable) this.$refs.queueTable.setCurrentRow()
}
}
})
}, },
resetQuery() { resetQuery() {
this.query = { inMatNo: '', dateRange: null, hideFinished: false } this.query = { inMatNo: '', dateRange: null, hideFinished: false }
@@ -448,9 +460,16 @@ export default {
// ── 队列行点击 ── // ── 队列行点击 ──
handleQueueSelect(row) { handleQueueSelect(row) {
if (this.suppressQueueSelect) {
this.suppressQueueSelect = false
return
}
if (this.passEditMode) { if (this.passEditMode) {
// 正在编辑时禁止切换行
this.$message.warning('请先保存或取消当前编辑') this.$message.warning('请先保存或取消当前编辑')
this.suppressQueueSelect = true
this.$nextTick(() => {
if (this.$refs.queueTable) this.$refs.queueTable.setCurrentRow(this.selectedPlan)
})
return return
} }
this.selectedPlan = row this.selectedPlan = row