From 3077a47d1503fd81b83401cf890a6df47a3503bb Mon Sep 17 00:00:00 2001 From: zxy Date: Mon, 20 Apr 2026 18:07:31 +0800 Subject: [PATCH] =?UTF-8?q?feat(tsoorder):=20=E6=96=B0=E5=A2=9E=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E7=B1=BB=E5=9E=8B=E5=AD=97=E5=85=B8=E5=B9=B6=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E7=94=9F=E4=BA=A7=E8=AE=A2=E5=8D=95=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ProOrderServiceImpl.java | 10 ++ .../jnpf-web/src/views/example/common/dict.js | 3 + .../src/views/example/proline/select.vue | 43 +++-- .../views/example/tsoorder/generate/index.vue | 150 +++++++++--------- .../src/views/example/tsoorder/index.vue | 56 ++++--- 5 files changed, 154 insertions(+), 108 deletions(-) diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/ProOrderServiceImpl.java b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/ProOrderServiceImpl.java index f5d5518..9955975 100644 --- a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/ProOrderServiceImpl.java +++ b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/ProOrderServiceImpl.java @@ -16,6 +16,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; +import java.math.BigDecimal; import java.util.List; /** @@ -132,6 +133,7 @@ public class ProOrderServiceImpl extends ServiceImpl proLines = orderForm.getProLines(); diff --git a/jnpf-java-boot/jnpf-web/src/views/example/common/dict.js b/jnpf-java-boot/jnpf-web/src/views/example/common/dict.js index 3df2ea6..a44359c 100644 --- a/jnpf-java-boot/jnpf-web/src/views/example/common/dict.js +++ b/jnpf-java-boot/jnpf-web/src/views/example/common/dict.js @@ -10,6 +10,8 @@ export const dictMaps = { paramType: { '1': '温度', '2': '压力', '3': '时间', '4': '速度' }, // 启用状态 enabledStatus: { '1': '启用', '2': '未启用' }, + // 订单类型 + ordType: { '1': '备库订单', '2': '销售订单' }, }; // 根据映射自动生成下拉选项(使用id和fullName字段) @@ -33,5 +35,6 @@ export function getLabel(type, value) { // 快捷导出常用选项 export const paramTypeOptions = dictOptions.paramType; export const enabledStatusOptions = dictOptions.enabledStatus; +export const ordTypeOptions = dictOptions.ordType; diff --git a/jnpf-java-boot/jnpf-web/src/views/example/proline/select.vue b/jnpf-java-boot/jnpf-web/src/views/example/proline/select.vue index edf9b2f..14e202e 100644 --- a/jnpf-java-boot/jnpf-web/src/views/example/proline/select.vue +++ b/jnpf-java-boot/jnpf-web/src/views/example/proline/select.vue @@ -68,6 +68,16 @@ export default { if (val) { this.loadProLineList(); } + }, + selectedLineCodes: { + handler() { + if (this.visible && this.proLineList.length > 0) { + this.$nextTick(() => { + this.setDefaultSelection(); + }); + } + }, + deep: true } }, methods: { @@ -78,7 +88,7 @@ export default { data: { currentPage: this.page.currentPage, pageSize: this.page.pageSize, - // selectKey: this.search.selectKey, + selectKey: this.search.selectKey, dataType: 0, enabledStatus: 1 } @@ -86,24 +96,31 @@ export default { if (res.code === 200) { this.proLineList = res.data.list || []; this.page.total = res.data.pagination ? res.data.pagination.total : 0; - this.$nextTick(() => { + // 确保数据加载完成后设置默认选择 + setTimeout(() => { this.setDefaultSelection(); - }); + }, 100); } }); }, setDefaultSelection() { - if (this.selectedLineCodes.length > 0) { - const table = this.$refs.proLineTable; + if (this.selectedLineCodes.length > 0 && this.proLineList.length > 0) { + // JNPF-table组件内部使用的ref是JNPFTable + const jnpfTable = this.$refs.proLineTable; + const table = jnpfTable ? jnpfTable.$refs.JNPFTable : null; + if (table) { table.clearSelection(); - const defaultSelected = this.proLineList.filter(line => - this.selectedLineCodes.includes(line.proLineCd) - ); + const defaultSelected = this.proLineList.filter(line => { + const lineCode = line.proLineCd || line.lineCode || ''; + return this.selectedLineCodes.includes(lineCode); + }); this.selectedLines = [...defaultSelected]; - defaultSelected.forEach(line => { - table.toggleRowSelection(line, true); + this.$nextTick(() => { + defaultSelected.forEach(line => { + table.toggleRowSelection(line, true); + }); }); } } @@ -134,9 +151,9 @@ export default { const selectedData = this.selectedLines.map(line => ({ lineId: line.id || line.lineId || '', - lineCode: line.lineCode || line.proLineCd || '', - lineName: line.lineName || line.proLineName || '', - remark: line.remark || "" + lineCode: line.proLineCd || line.lineCode || '', + lineName: line.proLineName || line.lineName || '', + remark: "" })); this.$emit("confirm", selectedData); diff --git a/jnpf-java-boot/jnpf-web/src/views/example/tsoorder/generate/index.vue b/jnpf-java-boot/jnpf-web/src/views/example/tsoorder/generate/index.vue index 14f2d60..01abf70 100644 --- a/jnpf-java-boot/jnpf-web/src/views/example/tsoorder/generate/index.vue +++ b/jnpf-java-boot/jnpf-web/src/views/example/tsoorder/generate/index.vue @@ -17,19 +17,19 @@ - + - + - - + + @@ -37,31 +37,31 @@ - + - + - + - + - - - - - + + + - + - - + + - + 所有产线 @@ -131,30 +131,30 @@
- - + + - - - - + + + + @@ -162,9 +162,9 @@ {{ scope.row.isUrgent === '1' ? '是' : '否' }} - - - + + + --> - + - + @@ -165,7 +166,7 @@ export default { pageSize: 20, }, ordItemStatusOptions: [], - ordItemStatusProps: { label: "fullName", value: "enCode" }, + ordItemStatusProps: { label: "fullName", value: "id" }, ordStatusOptions: [], hasSelected: false, selectedRows: [], @@ -182,6 +183,15 @@ export default { this.initSearchData(); this.initData(); }, + watch: { + '$route.query.refresh': function(newVal) { + if (newVal) { + this.initData(); + // 移除refresh参数,避免重复刷新 + this.$router.replace({ query: {} }); + } + } + }, methods: { initSearchData() { let date = new Date(); @@ -267,30 +277,30 @@ export default { this.$message.warning("请选择需要转生产的销售订单信息,请确认!"); return; } - + const materialNames = [...new Set(selectedRows.map(row => row.materialName))]; const specs = [...new Set(selectedRows.map(row => row.spec))]; - + if (materialNames.length > 1) { this.$message.error("必须选择产品名称和规格型号一致的产品,请确认!"); return; } - + if (specs.length > 1) { this.$message.error("必须选择产品名称和规格型号一致的产品,请确认!"); return; } - + const saleOrdNos = [...new Set(selectedRows.map(row => row.saleOrdNo))]; const orderIds = selectedRows.map(row => row.itemId); - + const params = { orderIds: orderIds, materialName: materialNames[0], spec: specs[0], saleOrdNo: saleOrdNos.join(', ') }; - + this.$router.push({ path: "/example/tsoorder/generate", query: { data: JSON.stringify(params) }