From 7bb4635dff502d78ff82768c1e6f68e88b2c291b Mon Sep 17 00:00:00 2001 From: cuilei <ray_tsu1@163.com> Date: 星期五, 29 八月 2025 16:10:57 +0800 Subject: [PATCH] 排产计划生成页面增加物料、计划生产数量筛选输入框;修复日历组件展示超出错位问题 --- src/views/mes/modules/MesProductionWorkOrderScheduleModal.vue | 158 ++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 122 insertions(+), 36 deletions(-) diff --git a/src/views/mes/modules/MesProductionWorkOrderScheduleModal.vue b/src/views/mes/modules/MesProductionWorkOrderScheduleModal.vue index 8a0a54a..6a43c88 100644 --- a/src/views/mes/modules/MesProductionWorkOrderScheduleModal.vue +++ b/src/views/mes/modules/MesProductionWorkOrderScheduleModal.vue @@ -17,13 +17,15 @@ <div class="table-page-search-wrapper"> <a-form layout="inline" @keyup.enter.native="searchQuery"> <a-row :gutter="12"> - <a-col :span="7"> + <a-col :span="10"> <a-form-item label="浜х嚎" :label-col="{span: 6}" :wrapper-col="{span: 18}"> - <j-tree-select dict="base_factory,factory_name,id" pid-field="parent_id" - v-model="queryParam.factoryId" style="width: 100%"></j-tree-select> + <j-search-select-tag placeholder="璇烽�夋嫨" v-model="queryParam.factoryId" + dict="base_factory,factory_name,id,del_flag=0 and factory_category = '3'" + @change="handleFactoryChange" + ></j-search-select-tag> </a-form-item> </a-col> - <a-col :span="9"> + <a-col :span="10"> <a-form-item label="鏃ユ湡" :label-col="{span: 4}" :wrapper-col="{span: 20}"> <a-range-picker style="width: 100%" @@ -34,9 +36,24 @@ /> </a-form-item> </a-col> - <a-col :span="8"> + <a-col :span="4"> <span style="float: left;overflow: hidden;white-space: nowrap;" class="table-page-search-submitButtons"> - <a-button type="primary" @click="searchQuery" icon="search">鏌ヨ</a-button> + <a-button type="primary" @click="searchQuery" icon="search" style="margin-left: 8px">鏌ヨ</a-button> + </span> + </a-col> + <a-col :span="10"> + <a-form-item label="鐗╂枡" :label-col="{span: 6}" :wrapper-col="{span: 18}"> + <a-select placeholder="璇烽�夋嫨" v-model="queryParam.materialNumber" + :options="materialSelectOptions"></a-select> + </a-form-item> + </a-col> + <a-col :span="10"> + <a-form-item label="璁″垝鐢熶骇鏁伴噺" :label-col="{span: 6}" :wrapper-col="{span: 18}"> + <a-input-number :min="1" v-model="queryParam.planQuantity" style="width: 100%" placeholder="璇疯緭鍏ヨ鍒掔敓浜ф暟閲�" /> + </a-form-item> + </a-col> + <a-col :span="4"> + <span style="float: left;overflow: hidden;white-space: nowrap;" class="table-page-search-submitButtons"> <a-button type="info" @click="searchReset" icon="reload" style="margin-left: 8px">閲嶇疆</a-button> </span> </a-col> @@ -157,7 +174,6 @@ <!-- :layouts="['PrevPage', 'JumpNumber', 'NextPage', 'FullJump', 'Sizes', 'Total']"--> <!-- @page-change="handlePageChange">--> <!-- </vxe-pager>--> - </div> </a-card> </a-col> <a-col :span="12"> @@ -173,16 +189,33 @@ @change="onCalendarChange" > <template #dateCell="{ date, isSelected, isToday }"> - <div class="custom-date-content"> + <div class="custom-date-content" style="overflow: hidden; max-height: 120px;"> <div v-for="(workOrder, index) in getWorkOrdersForDate(date)" :key="workOrder.id" class="work-order-item" - :class="getColorClass(index)" + :class="getColorClass(index)" style=" + display: flex; + flex-direction: column; + align-items: flex-start; + overflow: hidden; + padding: 2px 4px; + margin-bottom: 2px; + background-color: #f0f0f0; + border-radius: 2px; + max-width: 100%; + box-sizing: border-box; + width: 100%; + word-break: break-all; + " > - <span class="work-order-shift">{{ workOrder.shiftCode }}</span> - <span class="work-order-material">{{ workOrder.materialName }}</span> - <span class="work-order-quantity">{{ workOrder.planQuantity }}</span> + <div class="work-order-shift-quantity"> + <span class="work-order-shift">{{ workOrder.shiftCode }}</span> + <span class="work-order-quantity">{{ workOrder.planQuantity }}</span> + </div> + <div class="work-order-material" :title="workOrder.materialName"> + {{ workOrder.materialName }} + </div> </div> </div> </template> @@ -223,6 +256,7 @@ materialOptions: [], materNumberNameMap: {}, workOrderDateOptions: [], + materialSelectOptions: [], selectedRowKeys: [], selectionRows: [], /* 鍒嗛〉鍙傛暟 */ @@ -233,16 +267,17 @@ }, // 琛ㄥご url: { - list: '/mesproductionworkorder/mesProductionWorkOrder/list', - delete: '/mesproductionworkorder/mesProductionWorkOrder/delete', - deleteBatch: '/mesproductionworkorder/mesProductionWorkOrder/deleteBatch', - exportXlsUrl: '/mesproductionworkorder/mesProductionWorkOrder/exportXls', - importExcelUrl: 'mesproductionworkorder/mesProductionWorkOrder/importExcel', + list: '/mes/mesProductionWorkOrder/list', + delete: '/mes/mesProductionWorkOrder/delete', + deleteBatch: '/mes/mesProductionWorkOrder/deleteBatch', + exportXlsUrl: '/mes/mesProductionWorkOrder/exportXls', + importExcelUrl: 'mes/mesProductionWorkOrder/importExcel', listProductionLinesOption: '/base/factory/queryIdTree', queryShiftGroupByFactoryId: '/base/shiftGroup/queryShiftGroupByFactoryId', queryFactoryById: '/base/factory/queryById', - schedule: '/mesproductionworkorder/mesProductionWorkOrder/schedule', - addSchedulePlan: '/mesproductionworkorder/mesProductionWorkOrder/addSchedulePlan' + queryLswMaterialByProductionType: '/lsw/lswMaterial/queryLswMaterialByProductionType', + schedule: '/mes/mesProductionWorkOrder/schedule', + addSchedulePlan: '/mes/mesProductionWorkOrder/addSchedulePlan' }, editRules: { materialNumber: [ @@ -301,6 +336,21 @@ close() { this.$emit('close') this.visible = false + }, + handleFactoryChange(value) { + this.materialSelectOptions = [] + if (value) { + getAction(this.url.queryLswMaterialByProductionType, { factoryId: value }).then(res => { + if (res.success) { + this.materialSelectOptions = res.result.map(item => { + return { + value: item.materialNumber, + label: item.materialName + } + }) + } + }) + } }, handleOk() { // 琛ㄦ牸鍏ㄨ〃鏍¢獙 @@ -482,21 +532,20 @@ }); promises.push(shiftGroupPromise); - const materialNumberPromise = ajaxGetDictItems("lsw_material,material_name,material_number,del_flag!='1' order by material_number asc", null).then(res => { + const materialNumberPromise = getAction(this.url.queryLswMaterialByProductionType, { factoryId: factoryId }).then(res => { if (res.success) { this.materialOptions = res.result.map(item => { return { - value: item.value, - label: item.value + value: item.materialNumber, + label: item.materialNumber } - }); + }) this.materNumberNameMap = res.result.reduce((map, item) => { - map[item.value] = item.text + map[item.materialNumber] = item.materialName return map }, {}) } - }).catch(() => { - }); + }) promises.push(materialNumberPromise); // 绛夊緟鎵�鏈夎姹傚畬鎴� @@ -513,7 +562,9 @@ getAction(this.url.schedule, { factoryId: this.queryParam.factoryId, startDate: this.dateRange[0].format('YYYY-MM-DD'), - endDate: this.dateRange[1].format('YYYY-MM-DD') + endDate: this.dateRange[1].format('YYYY-MM-DD'), + materialNumber: this.queryParam.materialNumber, + planQuantity: this.queryParam.planQuantity }).then(res => { if (res.success) { const record = res.result @@ -522,6 +573,8 @@ if (this.dateRange[0]) { this.calendarStartDate = this.dateRange[0].clone().startOf('week'); } + } else { + this.$message.error(res.message) } }) }, @@ -600,11 +653,15 @@ } else { factoryCode = this.dataSource[0].factoryCode } + let material + if (this.queryParam.materialNumber) { + material = this.materialSelectOptions.find(item => item.value === this.queryParam.materialNumber) + } // 鍒涘缓鏂拌鏁版嵁 const newRow = { workOrderCode: factoryCode, - materialNumber: '', - materialName: '', + materialNumber: this.dataSource.length > 0 ? this.dataSource[0].materialNumber : this.queryParam.materialNumber ? this.queryParam.materialNumber : '', + materialName: this.dataSource.length > 0 ? this.dataSource[0].materialName : this.queryParam.materialNumber ? material.label : '', factoryId: this.dataSource.length > 0 ? this.dataSource[0].factoryId : this.queryParam.factoryId, factoryCode: factoryCode, groupId: '', @@ -612,13 +669,14 @@ shiftCode: '', shiftName: '', workOrderDate: '', - planQuantity: '' + planQuantity: this.dataSource.length > 0 ? this.dataSource[0].planQuantity : this.queryParam.planQuantity ? this.queryParam.planQuantity : '', } this.initDictSelectOptions(null).then(() => { // 鏍规嵁鏃ユ湡鑼冨洿鐢熸垚鎺掍骇鏃ユ湡閫夐」 if (this.dateRange && this.dateRange.length === 2) { this.workOrderDateOptions = this.generateDateRangeOptions(this.dateRange[0], this.dateRange[1]); } + this.updateWorkOrderCode(newRow) this.dataSource.push(newRow) this.pagination.total += 1 // 婵�娲绘柊澧炵殑琛岃繘鍏ョ紪杈戠姸鎬� @@ -713,7 +771,7 @@ onDateSelect(date) { console.log('Selected date:', date.format('YYYY-MM-DD')) // 鏇存柊鏃ュ巻鏄剧ず涓洪�変腑鏃ユ湡鎵�鍦ㄥ懆 - this.calendarStartDate = date.clone().startOf('week'); + // this.calendarStartDate = date.clone().startOf('week'); }, // 澶勭悊鏃ュ巻鍛ㄥ彉鍖栦簨浠� @@ -757,6 +815,13 @@ color: #999; } +.custom-date-content { + overflow: hidden; + max-height: 120px; + padding: 4px 0; + box-sizing: border-box; +} + .work-order-item { font-size: 12px; padding: 2px 4px; @@ -766,6 +831,9 @@ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; + max-width: 100%; + box-sizing: border-box; + width: 100%; } .work-order-item.blue-item { @@ -778,16 +846,34 @@ border-left: 2px solid #f5222d; } +.work-order-shift-quantity { + display: flex; + align-items: center; + justify-content: space-between; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + width: 100%; + margin-bottom: 2px; +} + .work-order-shift { font-weight: bold; margin-right: 4px; -} - -.work-order-material { - margin-right: 4px; + flex-shrink: 0; } .work-order-quantity { - float: right; + color: #666; + flex-shrink: 0; + min-width: 30px; + text-align: right; +} + +.work-order-material { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + width: 100%; } </style> \ No newline at end of file -- Gitblit v1.9.3