diff --git a/apps/l2/src/api/l2/roller.js b/apps/l2/src/api/l2/roller.js index a1f2a90..6fe203d 100644 --- a/apps/l2/src/api/l2/roller.js +++ b/apps/l2/src/api/l2/roller.js @@ -29,13 +29,12 @@ export function getChangeIdList() { * @param {object} params.endTime 结束时间 * @param {string} params.changeId 换辊号 * @param {string} params.rollid 轧辊号 - * @param {number} params.pageNum - * @param {number} params.pageSize + * @param {number} params.pageNum + * @param {number} params.pageSize * @returns */ export function getRollHistorytList(params) { - console.log('API调用参数:', params) - + return l2Request({ method: 'post', data: params, @@ -46,7 +45,7 @@ export function getRollHistorytList(params) { }) } -/** +/** * 轧辊操作-备辊 * @param {object} params ReadyRollDataVO * @param {string} params.rollid 轧辊号 @@ -65,7 +64,7 @@ export function backupRoll(data) { }) } -/** +/** * 轧辊操作-上线 * @param {object} data 上线数据 * @returns @@ -78,7 +77,7 @@ export function onlineRoll(data) { }) } -/** +/** * 轧辊数据-获取在线辊信息 * @returns */ @@ -89,7 +88,7 @@ export function getOnlineRollList() { }) } -/** +/** * 轧辊数据-获取备用辊信息 * @param {string} position 位置,可用值:TOP,BOTTOM * @param {string} type 类型,可用值:WORK,INTERMEDIATE,BACKUP @@ -102,7 +101,7 @@ export function getOfflineRollList(position, type) { }) } -/** +/** * 轧辊数据-获取当前备辊信息 * @returns */ @@ -111,4 +110,4 @@ export function getReadyRollList() { method: 'get', url: '/api/roller/data/standby' }) -} \ No newline at end of file +} diff --git a/apps/l2/src/views/l2/plan/components/PlanRecommendPanel.vue b/apps/l2/src/views/l2/plan/components/PlanRecommendPanel.vue new file mode 100644 index 0000000..ba9d114 --- /dev/null +++ b/apps/l2/src/views/l2/plan/components/PlanRecommendPanel.vue @@ -0,0 +1,704 @@ + + + + + + diff --git a/apps/l2/src/views/l2/plan/components/ProcessRecommendPanel.vue b/apps/l2/src/views/l2/plan/components/ProcessRecommendPanel.vue new file mode 100644 index 0000000..418bb86 --- /dev/null +++ b/apps/l2/src/views/l2/plan/components/ProcessRecommendPanel.vue @@ -0,0 +1,169 @@ + + + + + + diff --git a/apps/l2/src/views/l2/plan/components/setupForm.vue b/apps/l2/src/views/l2/plan/components/setupForm.vue index f03ab8e..4737f9f 100644 --- a/apps/l2/src/views/l2/plan/components/setupForm.vue +++ b/apps/l2/src/views/l2/plan/components/setupForm.vue @@ -1,7 +1,30 @@ @@ -123,135 +186,352 @@ import { getRollforce } from '@/api/business/rollforce' // 光整机轧制力 import { getTl } from '@/api/business/tl' // 拉矫机 import { getMesh } from '@/api/business/mesh' // 光整机插入量 import { getFur } from '@/api/business/fur' // 炉火段 +import { PARAMETER_GROUPS } from './setupRecommendationConfig' + +const REQUIRED_FIELDS = [ + 'entryThick', + 'yieldPoint', + 'steelGrade', + 'spmElongation', + 'spmRollforce', + 'entryWidth' +] + +const FIELD_LABEL_MAP = { + entryThick: '入口厚度', + yieldPoint: '屈服点', + steelGrade: '钢种', + spmElongation: '延伸率(%)', + spmRollforce: 'SPM轧制力', + entryWidth: '入口宽度' +} + +const createDefaultForm = () => ({ + // 全线张力 + porTension: undefined, // 开卷机张力 + celTension: undefined, // 入口活套张力 + cleanTension: undefined, // 清洗段张力 + furTension: undefined, // 炉区张力 + towerTension: undefined, // 冷却塔张力 + tmNoneTension: undefined, // 光整机不投张力 + tmEntryTension: undefined, // 光整机入口张力 + tmExitTension: undefined, // 光整机出口张力 + tlNoneTension: undefined, // 拉矫机不投张力 + tlExitTension: undefined, // 拉矫机出口张力 + coatTension: undefined, // 后处理张力 + cxlTension: undefined, // 出口活套张力 + trTension: undefined, // 卷取机张力 + + // 光整机 + tmRollforce: undefined, // 光整机轧制力 + tmBendforce: undefined, // 光整机弯辊力 + tmAcrMesh: undefined, // 光整机防皱辊插入量 + tmBrMesh: undefined, // 光整机防颤辊插入量 + + // 拉矫机 + tlElong: undefined, // 拉矫机延伸率 + tlLvlMesh1: undefined, // 拉矫机矫直辊插入量1 + tlLvlMesh2: undefined, // 拉矫机矫直辊插入量2 + tlAcbMesh: undefined, // 拉矫机防横弓插入量 + + // 炉火段 + preheatingSection: undefined, // 炉火段预热段出口板温 + heatingSection: undefined, // 炉火段加热段出口板温 + coolingSection: undefined, // 炉火段冷却段出口板温 +}) export default { props: { income: { type: Object, required: true + }, + steelGradeOptions: { + type: Array, + default: () => [] + }, + planHistory: { + type: Array, + default: () => [] + }, + showRecommendationPanel: { + type: Boolean, + default: true } }, data() { return { - form: { - // 全线张力 - porTension: undefined, // 开卷机张力 - celTension: undefined, // 入口活套张力 - cleanTension: undefined, // 清洗段张力 - furTension: undefined, // 炉区张力 - towerTension: undefined, // 冷却塔张力 - tmNoneTension: undefined, // 光整机不投张力 - tmEntryTension: undefined, // 光整机入口张力 - tmExitTension: undefined, // 光整机出口张力 - tlNoneTension: undefined, // 拉矫机不投张力 - tlExitTension: undefined, // 拉矫机出口张力 - coatTension: undefined, // 后处理张力 - cxlTension: undefined, // 出口活套张力 - trTension: undefined, // 卷取机张力 - - // 光整机 - tmRollforce: undefined, // 光整机轧制力 - tmBendforce: undefined, // 光整机弯辊力 - tmAcrMesh: undefined, // 光整机防皱辊插入量 - tmBrMesh: undefined, // 光整机防颤辊插入量 - - // 拉矫机 - tlElong: undefined, // 拉矫机延伸率 - tlLvlMesh1: undefined, // 拉矫机矫直辊插入量1 - tlLvlMesh2: undefined, // 拉矫机矫直辊插入量2 - tlAcbMesh: undefined, // 拉矫机防横弓插入量 - - // 炉火段 - preheatingSection: undefined, // 炉火段预热段出口板温 - heatingSection: undefined, // 炉火段加热段出口板温 - coolingSection: undefined, // 炉火段冷却段出口板温 - }, - loading: false + form: createDefaultForm(), + recommendation: createDefaultForm(), + loading: false, + lastSignature: '' } }, - mounted() { - this.fetchSetup() + computed: { + missingFieldKeys() { + return REQUIRED_FIELDS.filter(key => !this.hasValue(this.income && this.income[key])) + }, + missingFieldLabels() { + return this.missingFieldKeys.map(key => FIELD_LABEL_MAP[key]) + }, + canGenerate() { + return this.missingFieldKeys.length === 0 + }, + hasRecommendation() { + return Object.values(this.recommendation).some(val => this.hasValue(val)) + }, + parameterGroups() { + return PARAMETER_GROUPS + } + }, + watch: { + income: { + handler() { + this.handleIncomeChange() + }, + immediate: true, + deep: true + } }, methods: { + hasValue(value) { + return !(value === null || value === undefined || value === '') + }, + generateSignature() { + return REQUIRED_FIELDS.map(key => (this.income && this.income[key]) ?? '').join('|') + }, + async handleIncomeChange() { + if (!this.canGenerate) { + this.lastSignature = '' + this.recommendation = createDefaultForm() + this.emitRecommendationChange() + return + } + const signature = this.generateSignature() + if (signature === this.lastSignature) { + return + } + this.lastSignature = signature + await this.fetchSetup() + }, async fetchSetup() { + if (!this.canGenerate) return this.loading = true - const { entryThick, yieldPoint, steelGrade, spmElongation, spmRollforce, entryWidth } = this.income - const res1 = await getTension({ - thick: entryThick, - yieldStren: yieldPoint - }) - if (res1.data) { - // 全线张力的各种参数 - this.form.porTension = res1.data.value1; - this.form.celTension = res1.data.value2; - this.form.cleanTension = res1.data.value3; - this.form.furTension = res1.data.value4; - this.form.towerTension = res1.data.value5; - this.form.tmNoneTension = res1.data.value6; - this.form.tmEntryTension = res1.data.value7; - this.form.tmExitTension = res1.data.value8; - this.form.tlNoneTension = res1.data.value9; - this.form.tlExitTension = res1.data.value10; - this.form.coatTension = res1.data.value11; - this.form.cxlTension = res1.data.value12; - this.form.trTension = res1.data.value13; - } - + this.recommendation = createDefaultForm() + const { + entryThick, + yieldPoint, + steelGrade, + spmElongation, + spmRollforce, + entryWidth + } = this.income - const res2 = await getTl({ - thick: entryThick, - yieldStren: yieldPoint, - steelGrade: steelGrade - }) - if (res2.data) { - this.form.tlElong = res2.data.value1; - this.form.tlLvlMesh1 = res2.data.value2; - this.form.tlLvlMesh2 = res2.data.value3; - this.form.tlAcbMesh = res2.data.value4; - } + try { + const [ + tensionRes, + tlRes, + rollforceRes, + bendforceRes, + meshRes, + furRes + ] = await Promise.allSettled([ + getTension({ thick: entryThick, yieldStren: yieldPoint }), + getTl({ thick: entryThick, yieldStren: yieldPoint, steelGrade }), + getRollforce({ thick: entryThick, yieldStren: yieldPoint, steelGrade, elong: spmElongation }), + getBendforce({ width: entryWidth, rollForce: spmRollforce }), + getMesh({ thick: entryThick, yieldStren: yieldPoint, steelGrade }), + getFur(steelGrade) + ]) - const res3 = await getRollforce({ - thick: entryThick, - yieldStren: yieldPoint, - steelGrade: steelGrade, - elong: spmElongation - }) - if (res3.data) { - this.form.tmRollforce = res3.data.value1; - } + if (tensionRes.status === 'fulfilled' && tensionRes.value.data) { + const data = tensionRes.value.data + this.recommendation.porTension = data.value1 + this.recommendation.celTension = data.value2 + this.recommendation.cleanTension = data.value3 + this.recommendation.furTension = data.value4 + this.recommendation.towerTension = data.value5 + this.recommendation.tmNoneTension = data.value6 + this.recommendation.tmEntryTension = data.value7 + this.recommendation.tmExitTension = data.value8 + this.recommendation.tlNoneTension = data.value9 + this.recommendation.tlExitTension = data.value10 + this.recommendation.coatTension = data.value11 + this.recommendation.cxlTension = data.value12 + this.recommendation.trTension = data.value13 + } - const res4 = await getBendforce({ - width: entryWidth, - rollForce: spmRollforce - }) - if (res4.data) { - this.form.tmBendforce = res4.data.value1; - } + if (tlRes.status === 'fulfilled' && tlRes.value.data) { + const data = tlRes.value.data + this.recommendation.tlElong = data.value1 + this.recommendation.tlLvlMesh1 = data.value2 + this.recommendation.tlLvlMesh2 = data.value3 + this.recommendation.tlAcbMesh = data.value4 + } - const res5 = await getMesh({ - thick: entryThick, - yieldStren: yieldPoint, - steelGrade: steelGrade - }) - if (res5.data) { - this.form.tmAcrMesh = res5.data.value1; - this.form.tmBrMesh = res5.data.value2; - } + if (rollforceRes.status === 'fulfilled' && rollforceRes.value.data) { + this.recommendation.tmRollforce = rollforceRes.value.data.value1 + } - const res6 = await getFur(steelGrade) - if (res6.data) { - this.form.preheatingSection = res6.data.value1; - this.form.heatingSection = res6.data.value2; - this.form.coolingSection = res6.data.value3; - } + if (bendforceRes.status === 'fulfilled' && bendforceRes.value.data) { + this.recommendation.tmBendforce = bendforceRes.value.data.value1 + } - console.log('表单初始化完成', this.form) + if (meshRes.status === 'fulfilled' && meshRes.value.data) { + const data = meshRes.value.data + this.recommendation.tmAcrMesh = data.value1 + this.recommendation.tmBrMesh = data.value2 + } + + if (furRes.status === 'fulfilled' && furRes.value.data) { + const data = furRes.value.data + this.recommendation.preheatingSection = data.value1 + this.recommendation.heatingSection = data.value2 + this.recommendation.coolingSection = data.value3 + } + } catch (error) { + console.error('获取工艺参数提示失败', error) + } finally { + this.loading = false + this.emitRecommendationChange() + } + }, + emitRecommendationChange() { + this.$emit('recommendation-change', { ...this.recommendation }) + }, + applyRecommended(field) { + if (!this.hasValue(this.recommendation[field])) return + this.$set(this.form, field, this.recommendation[field]) this.syncModal() - this.loading = false + }, + applyAll() { + if (!this.hasRecommendation) return + Object.keys(this.recommendation).forEach((key) => { + if (this.hasValue(this.recommendation[key])) { + this.$set(this.form, key, this.recommendation[key]) + } + }) + this.syncModal() + }, + formatValue(val) { + return this.hasValue(val) ? val : '-' }, syncModal() { this.$emit('input', this.form) } } } - \ No newline at end of file + + + \ No newline at end of file diff --git a/apps/l2/src/views/l2/plan/components/setupRecommendationConfig.js b/apps/l2/src/views/l2/plan/components/setupRecommendationConfig.js new file mode 100644 index 0000000..75befd1 --- /dev/null +++ b/apps/l2/src/views/l2/plan/components/setupRecommendationConfig.js @@ -0,0 +1,47 @@ +export const PARAMETER_GROUPS = [ + { + title: '全线张力', + items: [ + { label: '开卷机张力', key: 'porTension' }, + { label: '入口活套张力', key: 'celTension' }, + { label: '清洗段张力', key: 'cleanTension' }, + { label: '炉区张力', key: 'furTension' }, + { label: '冷却塔张力', key: 'towerTension' }, + { label: '光整机不投张力', key: 'tmNoneTension' }, + { label: '光整机入口张力', key: 'tmEntryTension' }, + { label: '光整机出口张力', key: 'tmExitTension' }, + { label: '拉矫机不投张力', key: 'tlNoneTension' }, + { label: '拉矫机出口张力', key: 'tlExitTension' }, + { label: '后处理张力', key: 'coatTension' }, + { label: '出口活套张力', key: 'cxlTension' }, + { label: '卷取机张力', key: 'trTension' } + ] + }, + { + title: '光整机参数', + items: [ + { label: '光整机轧制力', key: 'tmRollforce' }, + { label: '光整机弯辊力', key: 'tmBendforce' }, + { label: '光整机防皱辊插入量', key: 'tmAcrMesh' }, + { label: '光整机防颤辊插入量', key: 'tmBrMesh' } + ] + }, + { + title: '拉矫机参数', + items: [ + { label: '拉矫机延伸率', key: 'tlElong' }, + { label: '矫直辊插入量1', key: 'tlLvlMesh1' }, + { label: '矫直辊插入量2', key: 'tlLvlMesh2' }, + { label: '防横弓插入量', key: 'tlAcbMesh' } + ] + }, + { + title: '炉火段参数', + items: [ + { label: '预热段出口板温', key: 'preheatingSection' }, + { label: '加热段出口板温', key: 'heatingSection' }, + { label: '冷却段出口板温', key: 'coolingSection' } + ] + } +] + diff --git a/apps/l2/src/views/l2/plan/index.vue b/apps/l2/src/views/l2/plan/index.vue index 7416cf9..22bfb98 100644 --- a/apps/l2/src/views/l2/plan/index.vue +++ b/apps/l2/src/views/l2/plan/index.vue @@ -230,77 +230,92 @@ - - - 基础信息 - - - - - - - - - - - - - - - - - - +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
+ + 工艺参数 + +
+
- - 工艺参数 - +
+ + +
+